use of uk.nhs.connect.iucds.cda.ucr.ON 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;
}
Aggregations