Search in sources :

Example 1 with POCDMT000002UK01EncompassingEncounter

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01EncompassingEncounter in project integration-adaptor-111 by nhsconnect.

the class PractitionerRoleMapperTest method mockResponsibleParty.

private void mockResponsibleParty() {
    when(clinicalDocument.isSetComponentOf()).thenReturn(true);
    POCDMT000002UK01Component1 component1 = mock(POCDMT000002UK01Component1.class);
    when(clinicalDocument.getComponentOf()).thenReturn(component1);
    POCDMT000002UK01EncompassingEncounter encompassingEncounter = mock(POCDMT000002UK01EncompassingEncounter.class);
    when(component1.getEncompassingEncounter()).thenReturn(encompassingEncounter);
    when(encompassingEncounter.isSetResponsibleParty()).thenReturn(true);
    POCDMT000002UK01ResponsibleParty responsibleParty = mock(POCDMT000002UK01ResponsibleParty.class);
    when(encompassingEncounter.getResponsibleParty()).thenReturn(responsibleParty);
    POCDMT000002UK01AssignedEntity assignedEntity = mock(POCDMT000002UK01AssignedEntity.class);
    when(assignedEntity.isSetRepresentedOrganization()).thenReturn(true);
    when(assignedEntity.getRepresentedOrganization()).thenReturn(mock(POCDMT000002UK01Organization.class));
    CE ce = mockCode();
    when(assignedEntity.getCode()).thenReturn(ce);
    when(responsibleParty.getAssignedEntity()).thenReturn(assignedEntity);
    when(organizationMapper.mapOrganization(any(POCDMT000002UK01Organization.class))).thenReturn(organization);
    when(practitionerMapper.mapPractitioner(any(POCDMT000002UK01AssignedEntity.class))).thenReturn(practitioner);
}
Also used : POCDMT000002UK01Component1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component1) CE(uk.nhs.connect.iucds.cda.ucr.CE) POCDMT000002UK01EncompassingEncounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01EncompassingEncounter) POCDMT000002UK01ResponsibleParty(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ResponsibleParty) POCDMT000002UK01AssignedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization)

Example 2 with POCDMT000002UK01EncompassingEncounter

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01EncompassingEncounter 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;
}
Also used : POCDMT000002UK01Location(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Location) POCDMT000002UK01EncompassingEncounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01EncompassingEncounter) AD(uk.nhs.connect.iucds.cda.ucr.AD) POCDMT000002UK01Place(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Place) POCDMT000002UK01EncompassingEncounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01EncompassingEncounter) Encounter(org.hl7.fhir.dstu3.model.Encounter) POCDMT000002UK01Location(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Location) Location(org.hl7.fhir.dstu3.model.Location)

Aggregations

POCDMT000002UK01EncompassingEncounter (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01EncompassingEncounter)2 Encounter (org.hl7.fhir.dstu3.model.Encounter)1 Location (org.hl7.fhir.dstu3.model.Location)1 AD (uk.nhs.connect.iucds.cda.ucr.AD)1 CE (uk.nhs.connect.iucds.cda.ucr.CE)1 POCDMT000002UK01AssignedEntity (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity)1 POCDMT000002UK01Component1 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component1)1 POCDMT000002UK01Location (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Location)1 POCDMT000002UK01Organization (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization)1 POCDMT000002UK01Place (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Place)1 POCDMT000002UK01ResponsibleParty (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ResponsibleParty)1