use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.model.ContactPoint in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeContactPoint.
protected void composeContactPoint(Complex parent, String parentType, String name, ContactPoint element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeElement(t, "ContactPoint", name, element, index);
if (element.hasSystemElement())
composeEnum(t, "ContactPoint", "system", element.getSystemElement(), -1);
if (element.hasValueElement())
composeString(t, "ContactPoint", "value", element.getValueElement(), -1);
if (element.hasUseElement())
composeEnum(t, "ContactPoint", "use", element.getUseElement(), -1);
if (element.hasRankElement())
composePositiveInt(t, "ContactPoint", "rank", element.getRankElement(), -1);
if (element.hasPeriod())
composePeriod(t, "ContactPoint", "period", element.getPeriod(), -1);
}
Aggregations