Search in sources :

Example 6 with POCDMT000002UK01Organization

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

the class OrganizationMapperTest method shouldMapOrganization.

@Test
public void shouldMapOrganization() {
    POCDMT000002UK01Organization itkOrganization = mockItkOrganization();
    when(nodeUtil.getNodeValueString(itkOrganization.getNameArray(0))).thenReturn(ORGANIZATION_NAME);
    Organization organization = organizationMapper.mapOrganization(itkOrganization);
    assertThat(organization.getName()).isEqualTo(ORGANIZATION_NAME);
    assertThat(organization.getAddressFirstRep()).isEqualTo(address);
    assertThat(organization.getTelecomFirstRep()).isEqualTo(contactPoint);
    assertThat(organization.getType().get(0).getText()).isEqualTo(GP_PRACTICE);
    assertThat(organization.getIdentifierFirstRep().getValue()).isEqualTo(ODS_CODE);
}
Also used : Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) Test(org.junit.jupiter.api.Test)

Example 7 with POCDMT000002UK01Organization

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

the class OrganizationMapperTest method shouldMapOrganizationInformationRecipient.

@Test
public void shouldMapOrganizationInformationRecipient() {
    POCDMT000002UK01Organization itkOrganization = mockItkOrganization();
    when(informationRecipient.getIntendedRecipient()).thenReturn(intendedRecipient);
    when(intendedRecipient.getReceivedOrganization()).thenReturn(itkOrganization);
    when(intendedRecipient.isSetReceivedOrganization()).thenReturn(true);
    when(informationRecipient.getTypeCode()).thenReturn(forString(PRCP_TYPE_CODE));
    when(itkOrganization.getNameArray(0)).thenReturn(on);
    when(nodeUtil.getNodeValueString(on)).thenReturn(HEALTHCARE_SERVICE_NAME);
    Organization organization = organizationMapper.mapOrganization(informationRecipient);
    assertThat(organization.getTypeFirstRep().getCodingFirstRep().getCode()).isEqualTo(PRCP_TYPE_CODE);
    assertThat(organization.getTypeFirstRep().getCodingFirstRep().getDisplay()).isEqualTo(HEALTHCARE_SERVICE_NAME);
}
Also used : Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) Test(org.junit.jupiter.api.Test)

Example 8 with POCDMT000002UK01Organization

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

the class PatientMapperTest method mockGeneralPractitioner.

private void mockGeneralPractitioner(POCDMT000002UK01PatientRole patientRole) {
    when(patientRole.isSetProviderOrganization()).thenReturn(true);
    POCDMT000002UK01Organization itkOrganization = mock(POCDMT000002UK01Organization.class);
    when(patientRole.getProviderOrganization()).thenReturn(itkOrganization);
    when(organizationMapper.mapOrganization(any(POCDMT000002UK01Organization.class))).thenReturn(organization);
}
Also used : POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization)

Example 9 with POCDMT000002UK01Organization

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

Example 10 with POCDMT000002UK01Organization

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

the class LocationMapper method mapOrganizationToLocationComponent.

public Encounter.EncounterLocationComponent mapOrganizationToLocationComponent(POCDMT000002UK01Organization organization) {
    Encounter.EncounterLocationComponent encounterLocationComponent = new Encounter.EncounterLocationComponent();
    encounterLocationComponent.setStatus(Encounter.EncounterLocationStatus.ACTIVE);
    Location location = new Location();
    location.setIdElement(resourceUtil.newRandomUuid());
    Organization managingOrganization = organizationMapper.mapOrganization(organization);
    location.setManagingOrganization(resourceUtil.createReference(managingOrganization));
    location.setManagingOrganizationTarget(managingOrganization);
    encounterLocationComponent.setLocation(resourceUtil.createReference(location));
    encounterLocationComponent.setLocationTarget(location);
    if (organization.isSetAsOrganizationPartOf()) {
        if (organization.getAsOrganizationPartOf().getEffectiveTime() != null) {
            encounterLocationComponent.setPeriod(periodMapper.mapPeriod(organization.getAsOrganizationPartOf().getEffectiveTime()));
        }
    }
    return encounterLocationComponent;
}
Also used : Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) 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

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