use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Place in project integration-adaptor-111 by nhsconnect.
the class PatientMapperTest method mockBirthPlace.
private void mockBirthPlace(POCDMT000002UK01Patient itkPatient) {
when(itkPatient.isSetBirthplace()).thenReturn(true);
POCDMT000002UK01Birthplace birthPlace = mock(POCDMT000002UK01Birthplace.class);
POCDMT000002UK01Place place = mock(POCDMT000002UK01Place.class);
EN placeName = mock(EN.class);
when(itkPatient.getBirthplace()).thenReturn(birthPlace);
when(itkPatient.getBirthplace().getPlace()).thenReturn(place);
when(place.getName()).thenReturn(placeName);
}
use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Place in project integration-adaptor-111 by nhsconnect.
the class LocationMapper method mapHealthcareFacilityToLocationComponent.
public Encounter.EncounterLocationComponent mapHealthcareFacilityToLocationComponent(POCDMT000002UK01ClinicalDocument1 clinicalDocument) {
POCDMT000002UK01EncompassingEncounter encompassingEncounter = clinicalDocument.getComponentOf().getEncompassingEncounter();
POCDMT000002UK01Place place = Optional.ofNullable(encompassingEncounter).map(POCDMT000002UK01EncompassingEncounter::getLocation).map(POCDMT000002UK01Location::getHealthCareFacility).map(POCDMT000002UK01HealthCareFacility::getLocation).orElse(null);
if (place != null) {
Location location = new Location();
location.setIdElement(resourceUtil.newRandomUuid());
location.setName(nodeUtil.getAllText(place.getName().getDomNode()));
AD address = place.getAddr();
if (address != null) {
location.setAddress(addressMapper.mapAddress(address));
}
Encounter.EncounterLocationComponent encounterLocationComponent = new Encounter.EncounterLocationComponent();
encounterLocationComponent.setStatus(Encounter.EncounterLocationStatus.COMPLETED);
encounterLocationComponent.setLocation(resourceUtil.createReference(location));
encounterLocationComponent.setLocationTarget(location);
return encounterLocationComponent;
}
return null;
}
Aggregations