Search in sources :

Example 96 with ContactPoint

use of org.hl7.fhir.r4b.model.ContactPoint in project integration-adaptor-111 by nhsconnect.

the class LocationMapperTest method prepareIntendedRecipientMocks.

private POCDMT000002UK01IntendedRecipient prepareIntendedRecipientMocks() {
    POCDMT000002UK01IntendedRecipient itkIntendedRecipient = mock(POCDMT000002UK01IntendedRecipient.class);
    AD itkAddress = mock(AD.class);
    TEL itkTelecom = mock(TEL.class);
    when(itkIntendedRecipient.sizeOfAddrArray()).thenReturn(new AD[] { itkAddress }.length);
    when(addressMapper.mapAddress(any())).thenReturn(address);
    when(itkIntendedRecipient.getTelecomArray()).thenReturn(new TEL[] { itkTelecom });
    when(contactPointMapper.mapContactPoint(any())).thenReturn(contactPoint);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    return itkIntendedRecipient;
}
Also used : AD(uk.nhs.connect.iucds.cda.ucr.AD) POCDMT000002UK01IntendedRecipient(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) IdType(org.hl7.fhir.dstu3.model.IdType)

Example 97 with ContactPoint

use of org.hl7.fhir.r4b.model.ContactPoint in project integration-adaptor-111 by nhsconnect.

the class OrganizationMapperTest method shouldMapOrganization.

@Test
public void shouldMapOrganization() {
    POCDMT000002UK01Organization itkOrganization = mockItkOrganization();
    when(nodeUtil.getNodeValueString(itkOrganization.getNameArray(0))).thenReturn(ORGANIZATION_NAME);
    Organization organization = organizationMapper.mapOrganization(itkOrganization);
    assertThat(organization.getName()).isEqualTo(ORGANIZATION_NAME);
    assertThat(organization.getAddressFirstRep()).isEqualTo(address);
    assertThat(organization.getTelecomFirstRep()).isEqualTo(contactPoint);
    assertThat(organization.getType().get(0).getText()).isEqualTo(GP_PRACTICE);
    assertThat(organization.getIdentifierFirstRep().getValue()).isEqualTo(ODS_CODE);
}
Also used : Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) Test(org.junit.jupiter.api.Test)

Example 98 with ContactPoint

use of org.hl7.fhir.r4b.model.ContactPoint in project integration-adaptor-111 by nhsconnect.

the class PatientMapperTest method shouldMapPatient.

@Test
@SuppressWarnings("MagicNumber")
public void shouldMapPatient() {
    POCDMT000002UK01PatientRole patientRole = mock(POCDMT000002UK01PatientRole.class);
    POCDMT000002UK01Patient itkPatient = mock(POCDMT000002UK01Patient.class);
    when(patientRole.isSetPatient()).thenReturn(true);
    when(patientRole.getPatient()).thenReturn(itkPatient);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    when(resourceUtil.createReference(organization)).thenReturn(new Reference(organization));
    mockNames(itkPatient);
    mockAddress(patientRole);
    mockIdentifier(patientRole);
    mockContactPoint(patientRole);
    mockGeneralPractitioner(patientRole);
    mockLanguage(itkPatient);
    mockGuardian(itkPatient);
    mockExtensions(itkPatient);
    mockBirthTime(itkPatient);
    mockBirthPlace(itkPatient);
    mockGender(itkPatient);
    mockMaritalStatus(itkPatient);
    Patient fhirPatient = patientMapper.mapPatient(patientRole);
    assertThat(fhirPatient.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(fhirPatient.getActive()).isEqualTo(true);
    assertThat(fhirPatient.getNameFirstRep()).isEqualTo(humanName);
    assertThat(fhirPatient.getAddressFirstRep()).isEqualTo(address);
    assertThat(fhirPatient.getTelecomFirstRep()).isEqualTo(contactPoint);
    assertThat(fhirPatient.getGeneralPractitionerFirstRep().getResource()).isEqualTo(organization);
    assertThat(fhirPatient.getLanguage()).isEqualTo("EN");
    assertThat(fhirPatient.getContactFirstRep()).isEqualTo(contactComponent);
    assertThat(fhirPatient.getExtension().size()).isEqualTo(3);
    assertThat(fhirPatient.getBirthDate()).isEqualTo(date);
    assertThat(fhirPatient.getGender().toCode()).isEqualTo("unknown");
    assertThat(fhirPatient.getMaritalStatus().getCoding().get(0).getDisplay()).isEqualTo("Married");
    assertThat(fhirPatient.getMaritalStatus().getCoding().get(0).getSystem()).isEqualTo("http://hl7.org/fhir/v3/MaritalStatus");
    assertThat(fhirPatient.getMaritalStatus().getCoding().get(0).getCode()).isEqualTo("M");
    verifyNhsNumber(fhirPatient);
}
Also used : POCDMT000002UK01Patient(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Patient) POCDMT000002UK01PatientRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PatientRole) Reference(org.hl7.fhir.dstu3.model.Reference) POCDMT000002UK01Patient(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Patient) Patient(org.hl7.fhir.dstu3.model.Patient) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Example 99 with ContactPoint

use of org.hl7.fhir.r4b.model.ContactPoint in project integration-adaptor-111 by nhsconnect.

the class ContactPointMapperTest method shouldMapContactPointEmail.

@Test
public void shouldMapContactPointEmail() {
    TEL tel = TEL.Factory.newInstance();
    tel.setValue(EMAIL_ADDRESS);
    tel.setUse(singletonList(USE_ITK_MOBILE));
    tel.addNewUseablePeriod();
    when(periodMapper.mapPeriod(ArgumentMatchers.any())).thenReturn(period);
    ContactPoint contactPoint = contactPointMapper.mapContactPoint(tel);
    assertThat(contactPoint.getValue()).isEqualTo(EMAIL_ADDRESS);
    assertThat(contactPoint.getUse()).isEqualTo(MOBILE);
    assertThat(contactPoint.getPeriod()).isEqualTo(period);
    assertThat(contactPoint.getSystem()).isEqualTo(EMAIL);
}
Also used : ContactPoint(org.hl7.fhir.dstu3.model.ContactPoint) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) Test(org.junit.jupiter.api.Test)

Example 100 with ContactPoint

use of org.hl7.fhir.r4b.model.ContactPoint in project kindling by HL7.

the class CodeListToValueSetParser method generateConceptMapV3.

private void generateConceptMapV3(String v3map, ValueSet vs, CodeSystem cs) throws Exception {
    if (!v3map.startsWith("http://terminology.hl7.org/ValueSet/v3-"))
        v3map = "http://terminology.hl7.org/ValueSet/v3-" + v3map;
    ConceptMap cm = new ConceptMap();
    cm.setVersion(version);
    cm.setId("cm-" + vs.getId() + "-v3");
    cm.setUserData("path", cm.getId() + ".html");
    cm.setUserData("generate", true);
    cm.setUrl("http://hl7.org/fhir/ConceptMap/" + cm.getId());
    cm.setName("v3." + vs.getName());
    cm.setTitle("v3 map for " + vs.present());
    cm.setPublisher("HL7 (FHIR Project)");
    for (ContactDetail cc : vs.getContact()) {
        ContactDetail cd = cm.addContact();
        cd.setName(cc.getName());
        for (ContactPoint ccs : cc.getTelecom()) cd.addTelecom(ccs.copy());
    }
    cm.setCopyright(vs.getCopyright());
    // until we publish DSTU, then .review
    cm.setStatus(vs.getStatus());
    cm.setDate(vs.getDate());
    cm.setSource(Factory.newCanonical(vs.getUrl()));
    cm.setTarget(Factory.newCanonical(v3map));
    if (cs != null)
        processV3ConceptDefs(cm, cs.getUrl(), cs.getConcept());
    for (ConceptSetComponent cc : vs.getCompose().getInclude()) for (ConceptReferenceComponent c : cc.getConcept()) {
        processV3Map(cm, cc.getSystem(), c.getCode(), c.getUserString("v2"));
    }
    maps.see(cm, packageInfo);
}
Also used : ContactDetail(org.hl7.fhir.r5.model.ContactDetail) ContactPoint(org.hl7.fhir.r5.model.ContactPoint) ConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent) ConceptMap(org.hl7.fhir.r5.model.ConceptMap) ConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent)

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