use of org.hl7.fhir.r4b.model.ContactPoint in project elexis-server by elexis.
the class OrganizationTest method getOrganizationProperties.
/**
* Test all properties set by
* {@link TestDatabaseInitializer#initializeOrganization()}.
*/
@Test
public void getOrganizationProperties() {
Organization readOrganization = client.read().resource(Organization.class).withId(TestDatabaseInitializer.getOrganization().getId()).execute();
assertNotNull(readOrganization);
assertEquals("Test Organization", readOrganization.getName());
List<ContactPoint> telcoms = readOrganization.getTelecom();
assertNotNull(telcoms);
assertEquals(2, telcoms.size());
assertEquals(1, telcoms.get(0).getRank());
assertEquals("+01555345", telcoms.get(0).getValue());
assertEquals(ContactPointUse.MOBILE, telcoms.get(1).getUse());
assertEquals("+01444345", telcoms.get(1).getValue());
List<Address> addresses = readOrganization.getAddress();
assertNotNull(addresses);
assertEquals(1, addresses.size());
assertEquals("City", addresses.get(0).getCity());
assertEquals("123", addresses.get(0).getPostalCode());
assertEquals("Street 10", addresses.get(0).getLine().get(0).asStringValue());
}
use of org.hl7.fhir.r4b.model.ContactPoint in project integration-adaptor-111 by nhsconnect.
the class ContactPointMapper method mapContactPoint.
public ContactPoint mapContactPoint(TEL itkTelecom) {
ContactPoint contactPoint = new ContactPoint();
if (itkTelecom.sizeOfUseablePeriodArray() > 0) {
contactPoint.setPeriod(periodMapper.mapPeriod(itkTelecom.getUseablePeriodArray(0)));
}
if (itkTelecom.isSetUse()) {
contactPoint.setUse(CONTACT_POINT_USE_MAP.get(itkTelecom.getUse().get(0).toString()));
}
if (itkTelecom.isSetValue()) {
String telecomValue = itkTelecom.getValue();
contactPoint.setValue(telecomValue);
if (telecomValue.startsWith(PHONE_SYSTEM_PREFIX)) {
contactPoint.setSystem(CONTACT_POINT_SYSTEM_MAP.get(PHONE_SYSTEM_PREFIX));
} else if (telecomValue.startsWith(EMAIL_SYSTEM_PREFIX)) {
contactPoint.setSystem(CONTACT_POINT_SYSTEM_MAP.get(EMAIL_SYSTEM_PREFIX));
} else {
contactPoint.setSystem(OTHER);
}
}
return contactPoint;
}
use of org.hl7.fhir.r4b.model.ContactPoint in project integration-adaptor-111 by nhsconnect.
the class RelatedPersonMapperTest method setup.
public void setup() {
relatedEntity = POCDMT000002UK01RelatedEntity.Factory.newInstance();
relatedEntity.setRelatedPerson(createPerson());
relatedEntity.setTelecomArray(createTelecomArray());
relatedEntity.setAddrArray(createAddrArray());
relatedEntity.setCode(createCode());
informant12 = POCDMT000002UK01Informant12.Factory.newInstance();
informant12.setRelatedEntity(relatedEntity);
when(humanNameMapper.mapHumanName(ArgumentMatchers.any())).thenReturn(humanName);
when(contactPointMapper.mapContactPoint(ArgumentMatchers.any())).thenReturn(contactPoint);
when(addressMapper.mapAddress(ArgumentMatchers.any())).thenReturn(address);
when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
}
use of org.hl7.fhir.r4b.model.ContactPoint in project integration-adaptor-111 by nhsconnect.
the class RelatedPersonMapperTest method shouldMapRelatedPersonFromRelatedEntity.
@Test
public void shouldMapRelatedPersonFromRelatedEntity() {
setup();
RelatedPerson relatedPerson = relatedPersonMapper.mapRelatedPerson(informant12, encounter);
assertThat(relatedPerson.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
assertThat(relatedPerson.getActive()).isEqualTo(true);
assertThat(relatedPerson.getNameFirstRep()).isEqualTo(humanName);
assertThat(relatedPerson.getTelecomFirstRep()).isEqualTo(contactPoint);
assertThat(relatedPerson.getAddressFirstRep()).isEqualTo(address);
assertThat(relatedPerson.getGender()).isEqualTo(UNKNOWN);
assertThat(relatedPerson.hasRelationship()).isTrue();
assertThat(relatedPerson.getRelationship().getCoding().size()).isEqualTo(1);
assertThat(relatedPerson.getRelationship().getCodingFirstRep().getCode()).isEqualTo(CODE);
assertThat(relatedPerson.getRelationship().getCodingFirstRep().getDisplay()).isEqualTo(CODE_DISPLAY_NAME);
assertThat(relatedPerson.getRelationship().getCodingFirstRep().getSystem()).isEqualTo(CODE_SYSTEM);
}
use of org.hl7.fhir.r4b.model.ContactPoint in project integration-adaptor-111 by nhsconnect.
the class LocationMapperTest method shouldMapRecipientToLocationWithoutOrganizationIfItsEmpty.
@Test
public void shouldMapRecipientToLocationWithoutOrganizationIfItsEmpty() {
POCDMT000002UK01IntendedRecipient itkIntendedRecipient = prepareIntendedRecipientMocks();
Location referenceRecipientToLocation = locationMapper.mapRecipientToLocation(itkIntendedRecipient, new Organization());
assertThat(referenceRecipientToLocation.getId()).isEqualTo(RANDOM_UUID);
assertThat(referenceRecipientToLocation.getAddress()).isEqualTo(address);
assertThat(referenceRecipientToLocation.getTelecom()).isEqualTo(List.of(contactPoint));
assertThat(referenceRecipientToLocation.hasManagingOrganization()).isFalse();
assertThat(referenceRecipientToLocation.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
}
Aggregations