use of uk.nhs.connect.iucds.cda.ucr.TEL 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;
}
use of uk.nhs.connect.iucds.cda.ucr.TEL in project integration-adaptor-111 by nhsconnect.
the class PatientMapperTest method mockContactPoint.
private void mockContactPoint(POCDMT000002UK01PatientRole patientRole) {
when(patientRole.sizeOfTelecomArray()).thenReturn(1);
TEL itkTelecom = mock(TEL.class);
when(patientRole.getTelecomArray()).thenReturn(Arrays.array(itkTelecom));
when(contactPointMapper.mapContactPoint(any())).thenReturn(contactPoint);
}
use of uk.nhs.connect.iucds.cda.ucr.TEL in project integration-adaptor-111 by nhsconnect.
the class RelatedPersonMapper method createEmergencyContactRelatedPerson.
public RelatedPerson createEmergencyContactRelatedPerson(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter) {
RelatedPerson relatedPerson = new RelatedPerson();
TEL[] telecomArray = Optional.ofNullable(clinicalDocument).map(document -> document.getRecordTargetArray(0)).map(POCDMT000002UK01RecordTarget::getPatientRole).map(POCDMT000002UK01PatientRole::getTelecomArray).orElse(null);
if (getEmergencyTelecom(telecomArray).isPresent()) {
relatedPerson.setIdElement(resourceUtil.newRandomUuid());
relatedPerson.setPatient(encounter.getSubject());
relatedPerson.setTelecom(getTelecomFromITK(new TEL[] { getEmergencyTelecom(telecomArray).get() }));
markEmergencyContact(telecomArray, relatedPerson);
return relatedPerson;
}
return null;
}
use of uk.nhs.connect.iucds.cda.ucr.TEL in project integration-adaptor-111 by nhsconnect.
the class HealthcareServiceMapper method mapSingleHealthcareService.
private HealthcareService mapSingleHealthcareService(POCDMT000002UK01InformationRecipient informationRecipient) {
POCDMT000002UK01IntendedRecipient intendedRecipient = informationRecipient.getIntendedRecipient();
HealthcareService healthcareService = new HealthcareService().setActive(true);
healthcareService.setIdElement(resourceUtil.newRandomUuid());
Organization organization = new Organization();
if (intendedRecipient.isSetReceivedOrganization()) {
POCDMT000002UK01Organization receivedOrganization = intendedRecipient.getReceivedOrganization();
organization = organizationMapper.mapOrganization(informationRecipient);
healthcareService.setProvidedBy(resourceUtil.createReference(organization));
healthcareService.setProvidedByTarget(organization);
if (receivedOrganization.sizeOfNameArray() > 0) {
ON name = receivedOrganization.getNameArray(0);
healthcareService.setName(nodeUtil.getAllText(name.getDomNode()));
}
}
Location location = locationMapper.mapRecipientToLocation(intendedRecipient, organization);
healthcareService.addLocation(resourceUtil.createReference(location));
if (intendedRecipient.sizeOfTelecomArray() > 0) {
for (TEL tel : intendedRecipient.getTelecomArray()) {
healthcareService.addTelecom(contactPointMapper.mapContactPoint(tel));
}
}
return healthcareService;
}
use of uk.nhs.connect.iucds.cda.ucr.TEL 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);
}
Aggregations