Search in sources :

Example 36 with ContactPoint

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

the class PractitionerMapperTest method shouldMapPractitionerFromAssignedEntity.

@Test
public void shouldMapPractitionerFromAssignedEntity() {
    POCDMT000002UK01AssignedEntity assignedEntity = POCDMT000002UK01AssignedEntity.Factory.newInstance();
    assignedEntity.setAssignedPerson(createPerson());
    assignedEntity.setTelecomArray(createTelecomArray());
    assignedEntity.setAddrArray(createAddrArray());
    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));
    Practitioner practitioner = practitionerMapper.mapPractitioner(assignedEntity);
    assertThat(practitioner.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(practitioner.getActive()).isEqualTo(true);
    assertThat(practitioner.getNameFirstRep()).isEqualTo(humanName);
    assertThat(practitioner.getTelecomFirstRep()).isEqualTo(contactPoint);
    assertThat(practitioner.getAddressFirstRep()).isEqualTo(address);
}
Also used : Practitioner(org.hl7.fhir.dstu3.model.Practitioner) POCDMT000002UK01AssignedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Example 37 with ContactPoint

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

the class PractitionerMapperTest method shouldMapPractitionerForAssignedAuthor.

@Test
public void shouldMapPractitionerForAssignedAuthor() {
    POCDMT000002UK01AssignedAuthor associatedEntity = POCDMT000002UK01AssignedAuthor.Factory.newInstance();
    associatedEntity.setAssignedPerson(createPerson());
    associatedEntity.setTelecomArray(createTelecomArray());
    associatedEntity.setAddrArray(createAddrArray());
    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));
    Practitioner practitioner = practitionerMapper.mapPractitioner(associatedEntity);
    assertThat(practitioner.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(practitioner.getActive()).isEqualTo(true);
    assertThat(practitioner.getNameFirstRep()).isEqualTo(humanName);
    assertThat(practitioner.getTelecomFirstRep()).isEqualTo(contactPoint);
    assertThat(practitioner.getAddressFirstRep()).isEqualTo(address);
}
Also used : POCDMT000002UK01AssignedAuthor(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedAuthor) Practitioner(org.hl7.fhir.dstu3.model.Practitioner) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Example 38 with ContactPoint

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

the class LocationMapperTest method shouldMapRecipientToLocation.

@Test
public void shouldMapRecipientToLocation() {
    POCDMT000002UK01IntendedRecipient itkIntendedRecipient = prepareIntendedRecipientMocks();
    Location referenceRecipientToLocation = locationMapper.mapRecipientToLocation(itkIntendedRecipient, organization);
    assertThat(referenceRecipientToLocation.getId()).isEqualTo(RANDOM_UUID);
    assertThat(referenceRecipientToLocation.getAddress()).isEqualTo(address);
    assertThat(referenceRecipientToLocation.getTelecom()).isEqualTo(List.of(contactPoint));
    assertThat(referenceRecipientToLocation.getManagingOrganization()).isNotNull();
    assertThat(referenceRecipientToLocation.getManagingOrganizationTarget()).isEqualTo(organization);
    assertThat(referenceRecipientToLocation.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
}
Also used : POCDMT000002UK01IntendedRecipient(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient) Location(org.hl7.fhir.dstu3.model.Location) Test(org.junit.jupiter.api.Test)

Example 39 with ContactPoint

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

the class ContactPointMapperTest method shouldMapContactPointPhone.

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

Example 40 with ContactPoint

use of org.hl7.fhir.dstu2.model.ContactPoint in project org.hl7.fhir.core by hapifhir.

the class IEEE11073Convertor method generateLoincMdcMap.

private static ConceptMap generateLoincMdcMap(CodeSystem mdc, String dst, String src) throws IOException, FHIRException {
    ConceptMap cm = new ConceptMap();
    cm.setId("loinc-mdc");
    cm.setUrl("http:/???/fhir/ConceptMap/loinc-mdc");
    cm.setVersion("[todo]");
    cm.setName("LoincMdcCrossMap");
    cm.setTitle("Cross Map between LOINC and MDC");
    cm.setStatus(PublicationStatus.DRAFT);
    cm.setExperimental(true);
    cm.setDateElement(new DateTimeType());
    cm.setPublisher("HL7, Inc");
    ContactDetail cd = cm.addContact();
    cd.setName("LOINC + IEEE");
    ContactPoint cp = cd.addTelecom();
    cp.setSystem(ContactPointSystem.URL);
    cp.setValue("http://loinc.org");
    cm.setDescription("A Cross Map between the LOINC and MDC Code systems");
    cm.setPurpose("To implementers map between medical device codes and LOINC codes");
    cm.setCopyright("This content LOINC \u00ae is copyright \u00a9 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use");
    cm.setSource(new UriType("http://loinc.org/vs"));
    cm.setTarget(new UriType(MDC_ALL_VALUES));
    ConceptMapGroupComponent g = cm.addGroup();
    g.setSource("urn:iso:std:iso:11073:10101");
    g.setTarget("http://loinc.org");
    CSVReader csv = new CSVReader(new FileInputStream(src));
    csv.readHeaders();
    while (csv.line()) {
        SourceElementComponent e = g.addElement();
        e.setCode(csv.cell("IEEE_CF_CODE10"));
        e.setDisplay(csv.cell("IEEE_DESCRIPTION"));
        TargetElementComponent t = e.addTarget();
        t.setEquivalence(ConceptMapEquivalence.EQUIVALENT);
        t.setCode(csv.cell("LOINC_NUM"));
        t.setDisplay(csv.cell("LOINC_LONG_COMMON_NAME"));
    }
    new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(dst, "conceptmap-" + cm.getId() + ".xml")), cm);
    System.out.println("Done");
    return cm;
}
Also used : XmlParser(org.hl7.fhir.dstu3.formats.XmlParser) CSVReader(org.hl7.fhir.utilities.CSVReader) FileOutputStream(java.io.FileOutputStream) TargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent) ConceptMapGroupComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent) FileInputStream(java.io.FileInputStream) SourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent)

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