Search in sources :

Example 91 with ContactPoint

use of org.hl7.fhir.dstu2.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());
}
Also used : ContactPoint(org.hl7.fhir.r4.model.ContactPoint) Organization(org.hl7.fhir.r4.model.Organization) Address(org.hl7.fhir.r4.model.Address) Test(org.junit.Test)

Example 92 with ContactPoint

use of org.hl7.fhir.dstu2.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;
}
Also used : ContactPoint(org.hl7.fhir.dstu3.model.ContactPoint)

Example 93 with ContactPoint

use of org.hl7.fhir.dstu2.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));
}
Also used : IdType(org.hl7.fhir.dstu3.model.IdType)

Example 94 with ContactPoint

use of org.hl7.fhir.dstu2.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);
}
Also used : RelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson) Test(org.junit.jupiter.api.Test)

Example 95 with ContactPoint

use of org.hl7.fhir.dstu2.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);
}
Also used : Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) POCDMT000002UK01IntendedRecipient(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient) Location(org.hl7.fhir.dstu3.model.Location) Test(org.junit.jupiter.api.Test)

Aggregations

ContactPoint (org.hl7.fhir.r4.model.ContactPoint)56 Test (org.junit.Test)28 Address (org.hl7.fhir.r4.model.Address)18 Identifier (org.hl7.fhir.r4.model.Identifier)17 HumanName (org.hl7.fhir.r4.model.HumanName)16 PersonAttribute (org.openmrs.PersonAttribute)15 NotImplementedException (org.apache.commons.lang3.NotImplementedException)14 ContactPoint (org.hl7.fhir.dstu3.model.ContactPoint)14 Test (org.junit.jupiter.api.Test)14 ArrayList (java.util.ArrayList)12 Organization (org.hl7.fhir.r4.model.Organization)12 ProviderAttribute (org.openmrs.ProviderAttribute)11 HashSet (java.util.HashSet)10 IdType (org.hl7.fhir.dstu3.model.IdType)9 Patient (org.hl7.fhir.r4.model.Patient)9 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)7 ContactDetail (org.hl7.fhir.r5.model.ContactDetail)6 ContactPoint (org.hl7.fhir.r5.model.ContactPoint)6 HashMap (java.util.HashMap)5 Base64 (org.apache.commons.codec.binary.Base64)5