Search in sources :

Example 1 with POCDMT000002UK01Author

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

the class ReferralRequestMapperTest method setup.

@BeforeEach
public void setup() {
    healthcareServiceList = new ArrayList<>();
    healthcareServiceList.add(healthcareService);
    encounter = new Encounter();
    String encounterId = "Encounter/1";
    encounter.setServiceProvider(serviceProviderRef).setSubject(patientRef).setId(encounterId);
    TS ts = TS.Factory.newInstance();
    ts.setValue(AUTHOR_TIME);
    POCDMT000002UK01Author[] authorArray = new POCDMT000002UK01Author[1];
    authorArray[0] = author;
    TS effectiveTime = TS.Factory.newInstance();
    effectiveTime.setValue("20220304");
    when(procedureRequestMapper.mapProcedureRequest(any(), any(), any())).thenReturn(procedureRequest);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    when(resourceUtil.createReference(encounter)).thenReturn(new Reference(encounter));
    when(resourceUtil.createReference(procedureRequest)).thenReturn(new Reference(procedureRequest));
    when(resourceUtil.createReference(practitioner)).thenReturn(new Reference(practitioner));
    when(author.getTime()).thenReturn(ts);
    when(author.getTypeCode()).thenReturn("AUT");
    when(clinicalDocument.getAuthorArray()).thenReturn(authorArray);
    when(clinicalDocument.getParticipantArray()).thenReturn(new POCDMT000002UK01Participant1[] { participantREFT, participantCALLBCK });
    when(clinicalDocument.getEffectiveTime()).thenReturn(effectiveTime);
    when(participantREFT.getTypeCode()).thenReturn(PARTICIPANT_TYPE_CODE_REFT);
    when(participantCALLBCK.getTypeCode()).thenReturn(PARTICIPANT_TYPE_CODE_CALLBCK);
    when(participantREFT.getAssociatedEntity()).thenReturn(associatedEntity);
    when(practitionerMapper.mapPractitioner(associatedEntity)).thenReturn(practitioner);
    when(periodMapper.mapPeriod(effectiveTime)).thenReturn(occurrence);
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) Encounter(org.hl7.fhir.dstu3.model.Encounter) POCDMT000002UK01Author(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Author) TS(uk.nhs.connect.iucds.cda.ucr.TS) IdType(org.hl7.fhir.dstu3.model.IdType) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with POCDMT000002UK01Author

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

the class PractitionerRoleMapper method mapAuthorRoles.

public List<PractitionerRole> mapAuthorRoles(POCDMT000002UK01Author[] authors) {
    List<PractitionerRole> roles = new ArrayList<>();
    stream(authors).filter(it -> it.getTypeCode().equals(AUTHOR_TYPE_CODE)).map(author -> {
        PractitionerRole role = new PractitionerRole();
        role.setIdElement(resourceUtil.newRandomUuid());
        POCDMT000002UK01AssignedAuthor assignedAuthor = author.getAssignedAuthor();
        role.setCode(asList(getCode(assignedAuthor.getCode())));
        Organization organization = organizationMapper.mapOrganization(assignedAuthor.getRepresentedOrganization());
        role.setOrganization(resourceUtil.createReference(organization));
        role.setOrganizationTarget(organization);
        Practitioner practitioner = practitionerMapper.mapPractitioner(assignedAuthor);
        role.setPractitioner(resourceUtil.createReference(practitioner));
        role.setPractitionerTarget(practitioner);
        return role;
    }).forEach(roles::add);
    return roles;
}
Also used : Optional.empty(java.util.Optional.empty) Practitioner(org.hl7.fhir.dstu3.model.Practitioner) POCDMT000002UK01AssignedAuthor(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedAuthor) CE(uk.nhs.connect.iucds.cda.ucr.CE) Coding(org.hl7.fhir.dstu3.model.Coding) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) ArrayList(java.util.ArrayList) POCDMT000002UK01Author(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Author) Organization(org.hl7.fhir.dstu3.model.Organization) List(java.util.List) Component(org.springframework.stereotype.Component) POCDMT000002UK01Component1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component1) Arrays.asList(java.util.Arrays.asList) ResourceUtil(uk.nhs.adaptors.oneoneone.cda.report.util.ResourceUtil) POCDMT000002UK01ClinicalDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1) Optional(java.util.Optional) POCDMT000002UK01ResponsibleParty(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ResponsibleParty) POCDMT000002UK01AssignedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity) AllArgsConstructor(lombok.AllArgsConstructor) Arrays.stream(java.util.Arrays.stream) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) POCDMT000002UK01AssignedAuthor(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedAuthor) Practitioner(org.hl7.fhir.dstu3.model.Practitioner) Organization(org.hl7.fhir.dstu3.model.Organization) ArrayList(java.util.ArrayList) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole)

Example 3 with POCDMT000002UK01Author

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

the class PractitionerRoleMapperTest method shouldMapAuthorRoles.

@Test
public void shouldMapAuthorRoles() {
    mockAuthors();
    POCDMT000002UK01Author[] authors = new POCDMT000002UK01Author[] { author };
    List<PractitionerRole> practitionerRoles = practitionerRoleMapper.mapAuthorRoles(authors);
    assertThat(practitionerRoles.size()).isEqualTo(1);
    PractitionerRole role = practitionerRoles.get(0);
    Coding codingFirstRep = role.getCodeFirstRep().getCodingFirstRep();
    assertThat(codingFirstRep.getCode()).isEqualTo(CODE);
    assertThat(codingFirstRep.getSystem()).isEqualTo(CODE_SYSTEM);
    assertThat(codingFirstRep.getDisplay()).isEqualTo(DISPLAY_NAME);
    assertThat(role.getPractitionerTarget()).isEqualTo(practitioner);
    assertThat(role.getOrganizationTarget()).isEqualTo(organization);
}
Also used : Coding(org.hl7.fhir.dstu3.model.Coding) POCDMT000002UK01Author(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Author) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) Test(org.junit.jupiter.api.Test)

Aggregations

POCDMT000002UK01Author (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Author)3 Coding (org.hl7.fhir.dstu3.model.Coding)2 PractitionerRole (org.hl7.fhir.dstu3.model.PractitionerRole)2 ArrayList (java.util.ArrayList)1 Arrays.asList (java.util.Arrays.asList)1 Arrays.stream (java.util.Arrays.stream)1 List (java.util.List)1 Optional (java.util.Optional)1 Optional.empty (java.util.Optional.empty)1 AllArgsConstructor (lombok.AllArgsConstructor)1 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 Encounter (org.hl7.fhir.dstu3.model.Encounter)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Organization (org.hl7.fhir.dstu3.model.Organization)1 Practitioner (org.hl7.fhir.dstu3.model.Practitioner)1 Reference (org.hl7.fhir.dstu3.model.Reference)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1 Component (org.springframework.stereotype.Component)1 ResourceUtil (uk.nhs.adaptors.oneoneone.cda.report.util.ResourceUtil)1