Search in sources :

Example 1 with POCDMT000002UK01Organization

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

the class OrganizationMapperTest method mockItkOrganization.

private POCDMT000002UK01Organization mockItkOrganization() {
    POCDMT000002UK01Organization itkOrganization = mock(POCDMT000002UK01Organization.class);
    AD itkAddress = mock(AD.class);
    TEL itkTelecom = mock(TEL.class);
    CE codeEntity = mock(CE.class);
    II[] iiArray = new II[] { ii };
    when(itkOrganization.getIdArray()).thenReturn(iiArray);
    when(ii.isSetExtension()).thenReturn(true);
    when(ii.getExtension()).thenReturn(ODS_CODE);
    when(itkOrganization.sizeOfIdArray()).thenReturn(1);
    when(itkOrganization.getAddrArray()).thenReturn(new AD[] { itkAddress });
    when(itkOrganization.getTelecomArray()).thenReturn(new TEL[] { itkTelecom });
    when(itkOrganization.isSetStandardIndustryClassCode()).thenReturn(true);
    when(itkOrganization.getStandardIndustryClassCode()).thenReturn(codeEntity);
    when(codeEntity.getDisplayName()).thenReturn(GP_PRACTICE);
    when(contactPointMapper.mapContactPoint(any())).thenReturn(contactPoint);
    when(addressMapper.mapAddress(any())).thenReturn(address);
    when(nodeUtil.getNodeValueString(itkOrganization.getNameArray(0))).thenReturn(ORGANIZATION_NAME);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Organization organization = organizationMapper.mapOrganization(itkOrganization);
    assertThat(organization.getName()).isEqualTo(ORGANIZATION_NAME);
    assertThat(organization.getAddressFirstRep()).isEqualTo(address);
    assertThat(organization.getTelecomFirstRep()).isEqualTo(contactPoint);
    assertThat(organization.getTypeFirstRep().getText()).isEqualTo(GP_PRACTICE);
    assertThat(organization.getIdentifierFirstRep().getValue()).isEqualTo(ODS_CODE);
    assertThat(organization.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    return itkOrganization;
}
Also used : II(uk.nhs.connect.iucds.cda.ucr.II) CE(uk.nhs.connect.iucds.cda.ucr.CE) AD(uk.nhs.connect.iucds.cda.ucr.AD) Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) IdType(org.hl7.fhir.dstu3.model.IdType)

Example 2 with POCDMT000002UK01Organization

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

the class OrganizationMapper method mapOrganization.

public Organization mapOrganization(POCDMT000002UK01Organization itkOrganization) {
    Organization fhirOrganization = new Organization();
    fhirOrganization.setIdElement(resourceUtil.newRandomUuid());
    fhirOrganization.setName(nodeUtil.getNodeValueString(itkOrganization.getNameArray(0)));
    fhirOrganization.setAddress(Arrays.stream(itkOrganization.getAddrArray()).map(addressMapper::mapAddress).collect(Collectors.toList()));
    fhirOrganization.setTelecom(Arrays.stream(itkOrganization.getTelecomArray()).map(contactPointMapper::mapContactPoint).collect(Collectors.toList()));
    if (itkOrganization.isSetStandardIndustryClassCode()) {
        fhirOrganization.setType(Collections.singletonList(new CodeableConcept().setText(itkOrganization.getStandardIndustryClassCode().getDisplayName())));
    }
    if (itkOrganization.isSetAsOrganizationPartOf()) {
        if (itkOrganization.getAsOrganizationPartOf().getWholeOrganization() != null) {
            Organization partOf = mapOrganization(itkOrganization.getAsOrganizationPartOf().getWholeOrganization());
            fhirOrganization.setPartOf(resourceUtil.createReference(partOf));
            fhirOrganization.setPartOfTarget(partOf);
        }
    }
    if (itkOrganization.sizeOfIdArray() > 0) {
        List<Identifier> identifierList = new ArrayList<>();
        for (II id : itkOrganization.getIdArray()) {
            if (id.isSetExtension()) {
                identifierList.add(new Identifier().setValue(id.getExtension()));
            }
        }
        fhirOrganization.setIdentifier(identifierList);
    }
    return fhirOrganization;
}
Also used : II(uk.nhs.connect.iucds.cda.ucr.II) Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) Identifier(org.hl7.fhir.dstu3.model.Identifier) ArrayList(java.util.ArrayList) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 3 with POCDMT000002UK01Organization

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

the class GuardianMapperTest method mockGuardianOrganization.

private void mockGuardianOrganization(POCDMT000002UK01Guardian guardian) {
    when(guardian.isSetGuardianOrganization()).thenReturn(true);
    POCDMT000002UK01Organization itkOrganization = mock(POCDMT000002UK01Organization.class);
    when(guardian.getGuardianOrganization()).thenReturn(itkOrganization);
    when(organizationMapper.mapOrganization(any(POCDMT000002UK01Organization.class))).thenReturn(managingOrganization);
    when(resourceUtil.createReference(managingOrganization)).thenReturn(new Reference(managingOrganization));
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization)

Example 4 with POCDMT000002UK01Organization

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

the class EncounterMapperTest method setUp.

@BeforeEach
public void setUp() {
    POCDMT000002UK01RecordTarget recordTarget = mock(POCDMT000002UK01RecordTarget.class);
    POCDMT000002UK01PatientRole patientRole = mock(POCDMT000002UK01PatientRole.class);
    POCDMT000002UK01Organization organization = mock(POCDMT000002UK01Organization.class);
    when(clinicalDocument.getRecordTargetArray()).thenReturn(new POCDMT000002UK01RecordTarget[] { recordTarget });
    when(clinicalDocument.getRecordTargetArray(0)).thenReturn(recordTarget);
    when(clinicalDocument.sizeOfRecordTargetArray()).thenReturn(1);
    when(recordTarget.getPatientRole()).thenReturn(patientRole);
    when(patientRole.getProviderOrganization()).thenReturn(organization);
    mockClinicalDocument(clinicalDocument);
    mockEncompassingEncounter();
    mockParticipant(clinicalDocument);
    mockLocation();
    mockPeriod();
    mockServiceProvider();
    mockAppointment();
    mockSubject();
    mockParticipantWithAuthorInformantAndDataEnterer(clinicalDocument);
    mockEncounterTypeAndReason();
}
Also used : POCDMT000002UK01PatientRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PatientRole) POCDMT000002UK01RecordTarget(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RecordTarget) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with POCDMT000002UK01Organization

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

the class LocationMapperTest method shouldMapOrganizationToLocationComponent.

@Test
public void shouldMapOrganizationToLocationComponent() {
    POCDMT000002UK01Organization itkOrganization = mock(POCDMT000002UK01Organization.class);
    POCDMT000002UK01OrganizationPartOf partOf = mock(POCDMT000002UK01OrganizationPartOf.class);
    IVLTS effectiveTime = mock(IVLTS.class);
    when(organizationMapper.mapOrganization(any(POCDMT000002UK01Organization.class))).thenReturn(organization);
    when(itkOrganization.isSetAsOrganizationPartOf()).thenReturn(true);
    when(itkOrganization.getAsOrganizationPartOf()).thenReturn(partOf);
    when(partOf.getEffectiveTime()).thenReturn(effectiveTime);
    when(periodMapper.mapPeriod(any())).thenReturn(period);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Encounter.EncounterLocationComponent encounterLocationComponent = locationMapper.mapOrganizationToLocationComponent(itkOrganization);
    assertThat(encounterLocationComponent.getLocationTarget().getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(encounterLocationComponent.getLocationTarget().getManagingOrganizationTarget()).isEqualTo(organization);
    assertThat(encounterLocationComponent.getPeriod()).isEqualTo(period);
}
Also used : IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) Encounter(org.hl7.fhir.dstu3.model.Encounter) POCDMT000002UK01OrganizationPartOf(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01OrganizationPartOf) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Aggregations

POCDMT000002UK01Organization (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization)10 Organization (org.hl7.fhir.dstu3.model.Organization)6 Test (org.junit.jupiter.api.Test)3 Encounter (org.hl7.fhir.dstu3.model.Encounter)2 IdType (org.hl7.fhir.dstu3.model.IdType)2 Location (org.hl7.fhir.dstu3.model.Location)2 II (uk.nhs.connect.iucds.cda.ucr.II)2 TEL (uk.nhs.connect.iucds.cda.ucr.TEL)2 ArrayList (java.util.ArrayList)1 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 HealthcareService (org.hl7.fhir.dstu3.model.HealthcareService)1 Identifier (org.hl7.fhir.dstu3.model.Identifier)1 Reference (org.hl7.fhir.dstu3.model.Reference)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 AD (uk.nhs.connect.iucds.cda.ucr.AD)1 CE (uk.nhs.connect.iucds.cda.ucr.CE)1 IVLTS (uk.nhs.connect.iucds.cda.ucr.IVLTS)1 ON (uk.nhs.connect.iucds.cda.ucr.ON)1 POCDMT000002UK01EncompassingEncounter (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01EncompassingEncounter)1 POCDMT000002UK01IntendedRecipient (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient)1