use of org.hl7.fhir.dstu2016may.model.HumanName in project elexis-server by elexis.
the class PractitionerRoleTest method getPractitionerProperties.
/**
* Test all properties set by {@link TestDatabaseInitializer#initializeMandant()}.
*/
@Test
public void getPractitionerProperties() {
List<IUser> user = UserServiceHolder.get().getUsersByAssociatedContact(TestDatabaseInitializer.getMandant());
assertFalse(user.isEmpty());
PractitionerRole readPractitionerRole = client.read().resource(PractitionerRole.class).withId(user.get(0).getId()).execute();
assertNotNull(readPractitionerRole);
assertNotNull(readPractitionerRole.getPractitioner());
Practitioner readPractitioner = client.read().resource(Practitioner.class).withId(readPractitionerRole.getPractitioner().getReferenceElement().getIdPart()).execute();
assertNotNull(readPractitioner);
List<HumanName> names = readPractitioner.getName();
assertNotNull(names);
assertFalse(names.isEmpty());
assertEquals(2, names.size());
HumanName name = names.get(0);
assertNotNull(name);
assertEquals(NameUse.OFFICIAL, name.getUse());
assertEquals("Mandant", name.getFamily());
assertEquals("Test", name.getGivenAsSingleString());
HumanName sysName = names.get(1);
assertNotNull(sysName);
assertEquals(NameUse.ANONYMOUS, sysName.getUse());
assertEquals("tst", sysName.getText());
Date dob = readPractitioner.getBirthDate();
assertNotNull(dob);
assertEquals(LocalDate.of(1970, Month.JANUARY, 1), AllTests.getLocalDateTime(dob).toLocalDate());
assertEquals(AdministrativeGender.MALE, readPractitioner.getGender());
List<ContactPoint> telcoms = readPractitioner.getTelecom();
assertNotNull(telcoms);
assertEquals(2, telcoms.size());
assertEquals(1, telcoms.get(0).getRank());
assertEquals("+01555234", telcoms.get(0).getValue());
assertEquals(ContactPointUse.MOBILE, telcoms.get(1).getUse());
assertEquals("+01444234", telcoms.get(1).getValue());
List<Address> addresses = readPractitioner.getAddress();
assertNotNull(addresses);
assertEquals(1, addresses.size());
assertEquals("City", addresses.get(0).getCity());
assertEquals("123", addresses.get(0).getPostalCode());
assertEquals("Street 100", addresses.get(0).getLine().get(0).asStringValue());
List<Identifier> identifiers = readPractitioner.getIdentifier();
boolean eanFound = false;
boolean kskFound = false;
for (Identifier identifier : identifiers) {
if (identifier.getSystem().equals(XidConstants.DOMAIN_EAN)) {
assertEquals("2000000000002", identifier.getValue());
eanFound = true;
}
if (identifier.getSystem().equals("www.xid.ch/id/ksk")) {
assertEquals("C000002", identifier.getValue());
kskFound = true;
}
}
assertTrue(eanFound);
assertTrue(kskFound);
assertTrue(readPractitioner.getActive());
}
use of org.hl7.fhir.dstu2016may.model.HumanName in project openmrs-module-fhir2 by openmrs.
the class PersonFhirResourceProviderTest method initPerson.
@Before
public void initPerson() {
HumanName name = new HumanName();
name.addGiven(GIVEN_NAME);
name.setFamily(FAMILY_NAME);
person = new org.hl7.fhir.r4.model.Person();
person.setId(PERSON_UUID);
person.setGender(Enumerations.AdministrativeGender.MALE);
person.addName(name);
setProvenanceResources(person);
}
use of org.hl7.fhir.dstu2016may.model.HumanName in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonFhirResourceProviderTest method initRelatedPerson.
@Before
public void initRelatedPerson() {
HumanName name = new HumanName();
name.addGiven(GIVEN_NAME);
name.setFamily(FAMILY_NAME);
relatedPerson = new org.hl7.fhir.r4.model.RelatedPerson();
relatedPerson.setId(RELATED_PERSON_UUID);
relatedPerson.setGender(Enumerations.AdministrativeGender.MALE);
relatedPerson.addName(name);
setProvenanceResources(relatedPerson);
}
use of org.hl7.fhir.dstu2016may.model.HumanName in project openmrs-module-fhir2 by openmrs.
the class PatientFhirResourceProviderTest method initPatient.
@Before
public void initPatient() {
HumanName name = new HumanName();
name.addGiven(GIVEN_NAME);
name.setFamily(FAMILY_NAME);
patient = new Patient();
patient.setId(PATIENT_UUID);
patient.addName(name);
patient.setActive(true);
patient.setBirthDate(new Date());
patient.setGender(Enumerations.AdministrativeGender.MALE);
setProvenanceResources(patient);
}
use of org.hl7.fhir.dstu2016may.model.HumanName in project openmrs-module-fhir2 by openmrs.
the class PractitionerTranslatorProviderImplTest method shouldTranslateProviderGenderToFhirPractitionerType.
@Test
public void shouldTranslateProviderGenderToFhirPractitionerType() {
Person person = new Person();
PersonName name = new PersonName();
name.setGivenName(GIVEN_NAME);
name.setFamilyName(FAMILY_NAME);
person.addName(name);
provider.setPerson(person);
HumanName humanName = new HumanName();
humanName.setFamily(FAMILY_NAME);
humanName.addGiven(GIVEN_NAME);
when(nameTranslator.toFhirResource(name)).thenReturn(humanName);
Practitioner practitioner = practitionerTranslator.toFhirResource(provider);
assertThat(practitioner, notNullValue());
assertThat(practitioner.getName(), notNullValue());
assertThat(practitioner.getName(), not(empty()));
assertThat(practitioner.getName().get(0).getGiven().get(0).getValue(), equalTo(GIVEN_NAME));
assertThat(practitioner.getName().get(0).getFamily(), equalTo(FAMILY_NAME));
}
Aggregations