Search in sources :

Example 1 with POCDMT000002UK01AssignedEntity

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

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

the class PractitionerMapperTest method shouldMapPractitionerFromAssignedEntity.

@Test
public void shouldMapPractitionerFromAssignedEntity() {
    POCDMT000002UK01AssignedEntity assignedEntity = POCDMT000002UK01AssignedEntity.Factory.newInstance();
    assignedEntity.setAssignedPerson(createPerson());
    assignedEntity.setTelecomArray(createTelecomArray());
    assignedEntity.setAddrArray(createAddrArray());
    when(humanNameMapper.mapHumanName(ArgumentMatchers.any())).thenReturn(humanName);
    when(contactPointMapper.mapContactPoint(ArgumentMatchers.any())).thenReturn(contactPoint);
    when(addressMapper.mapAddress(ArgumentMatchers.any())).thenReturn(address);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Practitioner practitioner = practitionerMapper.mapPractitioner(assignedEntity);
    assertThat(practitioner.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(practitioner.getActive()).isEqualTo(true);
    assertThat(practitioner.getNameFirstRep()).isEqualTo(humanName);
    assertThat(practitioner.getTelecomFirstRep()).isEqualTo(contactPoint);
    assertThat(practitioner.getAddressFirstRep()).isEqualTo(address);
}
Also used : Practitioner(org.hl7.fhir.dstu3.model.Practitioner) POCDMT000002UK01AssignedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Example 3 with POCDMT000002UK01AssignedEntity

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

the class DataEntererMapperTest method shouldMapDataEntererToParticipantComponent.

@Test
public void shouldMapDataEntererToParticipantComponent() {
    POCDMT000002UK01DataEnterer dataEnterer = mock(POCDMT000002UK01DataEnterer.class);
    POCDMT000002UK01AssignedEntity assignedEntity = mock(POCDMT000002UK01AssignedEntity.class);
    TS time = mock(TS.class);
    when(dataEnterer.getAssignedEntity()).thenReturn(assignedEntity);
    when(dataEnterer.isSetTime()).thenReturn(true);
    when(dataEnterer.getTime()).thenReturn(time);
    when(dataEnterer.getTypeCode()).thenReturn("CON");
    when(practitionerMapper.mapPractitioner(isA(POCDMT000002UK01AssignedEntity.class))).thenReturn(practitioner);
    when(periodMapper.mapPeriod(isA(TS.class))).thenReturn(period);
    when(resourceUtil.createReference(practitioner)).thenReturn(new Reference(practitioner));
    Encounter.EncounterParticipantComponent participantComponent = dataEntererMapper.mapDataEntererIntoParticipantComponent(dataEnterer);
    assertThat(participantComponent.getIndividualTarget()).isEqualTo(practitioner);
    assertThat(participantComponent.getPeriod()).isEqualTo(period);
    assertThat(participantComponent.getType().get(0).getText()).isEqualTo("CON");
}
Also used : POCDMT000002UK01DataEnterer(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01DataEnterer) Reference(org.hl7.fhir.dstu3.model.Reference) Encounter(org.hl7.fhir.dstu3.model.Encounter) POCDMT000002UK01AssignedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity) TS(uk.nhs.connect.iucds.cda.ucr.TS) Test(org.junit.jupiter.api.Test)

Example 4 with POCDMT000002UK01AssignedEntity

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

the class InformantMapperTest method shouldMapInformantToParticipantComponent.

@Test
public void shouldMapInformantToParticipantComponent() {
    POCDMT000002UK01Informant12 informant = mock(POCDMT000002UK01Informant12.class);
    POCDMT000002UK01AssignedEntity assignedEntity = mock(POCDMT000002UK01AssignedEntity.class);
    when(informant.getTypeCode()).thenReturn("CON");
    when(informant.isSetAssignedEntity()).thenReturn(true);
    when(informant.getAssignedEntity()).thenReturn(assignedEntity);
    when(practitionerMapper.mapPractitioner(isA(POCDMT000002UK01AssignedEntity.class))).thenReturn(practitioner);
    when(resourceUtil.createReference(practitioner)).thenReturn(new Reference(practitioner));
    Optional<Encounter.EncounterParticipantComponent> participantComponent = informantMapper.mapInformantIntoParticipantComponent(informant);
    assertThat(participantComponent.isPresent()).isTrue();
    assertThat(participantComponent.get().getIndividualTarget()).isEqualTo(practitioner);
    assertThat(participantComponent.get().getType().get(0).getText()).isEqualTo("CON");
}
Also used : POCDMT000002UK01Informant12(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12) Reference(org.hl7.fhir.dstu3.model.Reference) POCDMT000002UK01AssignedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity) Test(org.junit.jupiter.api.Test)

Example 5 with POCDMT000002UK01AssignedEntity

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

the class PractitionerRoleMapper method mapResponsibleParty.

public Optional<PractitionerRole> mapResponsibleParty(POCDMT000002UK01ClinicalDocument1 clinicalDocument) {
    if (clinicalDocument.isSetComponentOf()) {
        POCDMT000002UK01Component1 componentOf = clinicalDocument.getComponentOf();
        if (componentOf.getEncompassingEncounter().isSetResponsibleParty()) {
            PractitionerRole role = new PractitionerRole();
            role.setIdElement(resourceUtil.newRandomUuid());
            POCDMT000002UK01ResponsibleParty responsibleParty = componentOf.getEncompassingEncounter().getResponsibleParty();
            POCDMT000002UK01AssignedEntity assignedEntity = responsibleParty.getAssignedEntity();
            role.setCode(asList(getCode(assignedEntity.getCode())));
            if (assignedEntity.isSetRepresentedOrganization()) {
                Organization organization = organizationMapper.mapOrganization(assignedEntity.getRepresentedOrganization());
                role.setOrganization(resourceUtil.createReference(organization));
                role.setOrganizationTarget(organization);
            }
            Practitioner practitioner = practitionerMapper.mapPractitioner(assignedEntity);
            role.setPractitioner(resourceUtil.createReference(practitioner));
            role.setPractitionerTarget(practitioner);
            return Optional.of(role);
        }
    }
    return empty();
}
Also used : Practitioner(org.hl7.fhir.dstu3.model.Practitioner) POCDMT000002UK01Component1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component1) Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01ResponsibleParty(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ResponsibleParty) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) POCDMT000002UK01AssignedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity)

Aggregations

POCDMT000002UK01AssignedEntity (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity)5 Test (org.junit.jupiter.api.Test)3 Practitioner (org.hl7.fhir.dstu3.model.Practitioner)2 Reference (org.hl7.fhir.dstu3.model.Reference)2 POCDMT000002UK01Component1 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component1)2 POCDMT000002UK01ResponsibleParty (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ResponsibleParty)2 Encounter (org.hl7.fhir.dstu3.model.Encounter)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Organization (org.hl7.fhir.dstu3.model.Organization)1 PractitionerRole (org.hl7.fhir.dstu3.model.PractitionerRole)1 CE (uk.nhs.connect.iucds.cda.ucr.CE)1 POCDMT000002UK01DataEnterer (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01DataEnterer)1 POCDMT000002UK01EncompassingEncounter (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01EncompassingEncounter)1 POCDMT000002UK01Informant12 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12)1 POCDMT000002UK01Organization (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization)1 TS (uk.nhs.connect.iucds.cda.ucr.TS)1