Search in sources :

Example 6 with AD

use of uk.nhs.connect.iucds.cda.ucr.AD 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;
}
Also used : AD(uk.nhs.connect.iucds.cda.ucr.AD) POCDMT000002UK01IntendedRecipient(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) IdType(org.hl7.fhir.dstu3.model.IdType)

Example 7 with AD

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

the class PatientMapperTest method mockAddress.

private void mockAddress(POCDMT000002UK01PatientRole patientRole) {
    when(patientRole.sizeOfAddrArray()).thenReturn(1);
    AD itkAddress = mock(AD.class);
    when(patientRole.getAddrArray()).thenReturn(Arrays.array(itkAddress));
    when(addressMapper.mapAddress(any())).thenReturn(address);
}
Also used : AD(uk.nhs.connect.iucds.cda.ucr.AD)

Example 8 with AD

use of uk.nhs.connect.iucds.cda.ucr.AD 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

AD (uk.nhs.connect.iucds.cda.ucr.AD)8 IdType (org.hl7.fhir.dstu3.model.IdType)4 Encounter (org.hl7.fhir.dstu3.model.Encounter)2 Location (org.hl7.fhir.dstu3.model.Location)2 Test (org.junit.jupiter.api.Test)2 TEL (uk.nhs.connect.iucds.cda.ucr.TEL)2 Organization (org.hl7.fhir.dstu3.model.Organization)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 CE (uk.nhs.connect.iucds.cda.ucr.CE)1 II (uk.nhs.connect.iucds.cda.ucr.II)1 PN (uk.nhs.connect.iucds.cda.ucr.PN)1 POCDMT000002UK01EncompassingEncounter (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01EncompassingEncounter)1 POCDMT000002UK01IntendedRecipient (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient)1 POCDMT000002UK01Location (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Location)1 POCDMT000002UK01Organization (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization)1 POCDMT000002UK01ParticipantRole (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ParticipantRole)1 POCDMT000002UK01Place (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Place)1 POCDMT000002UK01PlayingEntity (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PlayingEntity)1