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);
}
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);
}
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);
}
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);
}
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;
}
Aggregations