Search in sources :

Example 1 with POCDMT000002UK01Informant12

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

the class ParticipantMapperTest method shouldMapEncounterRelatedPerson.

@Test
public void shouldMapEncounterRelatedPerson() {
    IVLTS time = IVLTS.Factory.newInstance();
    POCDMT000002UK01RelatedEntity relatedEntity = POCDMT000002UK01RelatedEntity.Factory.newInstance();
    relatedEntity.setEffectiveTime(time);
    POCDMT000002UK01Informant12 informant = POCDMT000002UK01Informant12.Factory.newInstance();
    informant.setTypeCode("INF");
    informant.setRelatedEntity(relatedEntity);
    Encounter encounter = new Encounter();
    RelatedPerson relatedPerson = new RelatedPerson();
    relatedPerson.setId(RELATED_PERSON_ID);
    when(relatedPersonMapper.mapRelatedPerson(informant, encounter)).thenReturn(relatedPerson);
    when(periodMapper.mapPeriod(ArgumentMatchers.isA(IVLTS.class))).thenReturn(period);
    when(resourceUtil.createReference(relatedPerson)).thenReturn(new Reference(relatedPerson));
    Encounter.EncounterParticipantComponent participantComponent = participantMapper.mapEncounterRelatedPerson(informant, encounter);
    assertThat(participantComponent.getType().get(0).getText()).isEqualTo("Informant");
    assertThat(participantComponent.getIndividualTarget().getId()).isEqualTo(RELATED_PERSON_ID);
    assertThat(participantComponent.getPeriod()).isEqualTo(period);
}
Also used : IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) POCDMT000002UK01Informant12(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12) POCDMT000002UK01RelatedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RelatedEntity) Reference(org.hl7.fhir.dstu3.model.Reference) Encounter(org.hl7.fhir.dstu3.model.Encounter) RelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson) Test(org.junit.jupiter.api.Test)

Example 2 with POCDMT000002UK01Informant12

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

the class EncounterMapper method getEncounterParticipantComponents.

private List<EncounterParticipantComponent> getEncounterParticipantComponents(POCDMT000002UK01ClinicalDocument1 clinicalDocument, List<PractitionerRole> authorPractitionerRoles, Optional<PractitionerRole> responsibleParty, Encounter encounter) {
    List<EncounterParticipantComponent> encounterParticipantComponents = stream(clinicalDocument.getParticipantArray()).filter(it -> !PARTCIPANT_TYPE_CODE_REFT.equals(it.getTypeCode())).map(participantMapper::mapEncounterParticipant).collect(Collectors.toList());
    if (authorPractitionerRoles.size() > 0) {
        authorPractitionerRoles.stream().map(it -> buildParticipantComponent(it, AUTHOR_PARTICIPANT_CODE, AUTHOR_PARTICIPANT_DISPLAY)).forEach(encounterParticipantComponents::add);
    }
    if (clinicalDocument.sizeOfInformantArray() > 0) {
        stream(clinicalDocument.getInformantArray()).map(informantMapper::mapInformantIntoParticipantComponent).filter(Optional::isPresent).map(Optional::get).forEach(encounterParticipantComponents::add);
        for (POCDMT000002UK01Informant12 informant : clinicalDocument.getInformantArray()) {
            EncounterParticipantComponent encounterParticipantComponent = participantMapper.mapEncounterRelatedPerson(informant, encounter);
            encounterParticipantComponents.add(encounterParticipantComponent);
        }
    }
    if (clinicalDocument.isSetDataEnterer()) {
        encounterParticipantComponents.add(dataEntererMapper.mapDataEntererIntoParticipantComponent(clinicalDocument.getDataEnterer()));
    }
    responsibleParty.ifPresent(it -> encounterParticipantComponents.add(buildParticipantComponent(it, RESPONSIBLE_PARTY_PARTICIPANT_CODE, RESPONSIBLE_PARTY_PARTICIPANT_DISPLAY)));
    return encounterParticipantComponents;
}
Also used : EncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent) Arrays(java.util.Arrays) REFERRAL(uk.nhs.adaptors.oneoneone.cda.report.enums.MessageHeaderEvent.REFERRAL) Identifier(org.hl7.fhir.dstu3.model.Identifier) Coding(org.hl7.fhir.dstu3.model.Coding) NodeUtil(uk.nhs.adaptors.oneoneone.cda.report.util.NodeUtil) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) AppointmentService(uk.nhs.adaptors.oneoneone.cda.report.service.AppointmentService) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) ArrayList(java.util.ArrayList) Organization(org.hl7.fhir.dstu3.model.Organization) Group(org.hl7.fhir.dstu3.model.Group) Period(org.hl7.fhir.dstu3.model.Period) POCDMT000002UK01ClinicalDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) EncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent) POCDMT000002UK01PatientRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PatientRole) FINISHED(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED) Reference(org.hl7.fhir.dstu3.model.Reference) EncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent) IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) Collectors(java.util.stream.Collectors) POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) Encounter(org.hl7.fhir.dstu3.model.Encounter) DISCHARGE_DETAILS(uk.nhs.adaptors.oneoneone.cda.report.enums.MessageHeaderEvent.DISCHARGE_DETAILS) List(java.util.List) Component(org.springframework.stereotype.Component) POCDMT000002UK01Encounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter) Narrative(org.hl7.fhir.dstu3.model.Narrative) Patient(org.hl7.fhir.dstu3.model.Patient) GENERATED(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED) ResourceUtil(uk.nhs.adaptors.oneoneone.cda.report.util.ResourceUtil) Optional(java.util.Optional) POCDMT000002UK01Informant12(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12) AllArgsConstructor(lombok.AllArgsConstructor) Arrays.stream(java.util.Arrays.stream) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) POCDMT000002UK01Informant12(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12) Optional(java.util.Optional)

Example 3 with POCDMT000002UK01Informant12

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

the class EncounterMapperTest method mockParticipantWithAuthorInformantAndDataEnterer.

private void mockParticipantWithAuthorInformantAndDataEnterer(POCDMT000002UK01ClinicalDocument1 clinicalDocument) {
    mockParticipant(clinicalDocument);
    POCDMT000002UK01Informant12 informant = mock(POCDMT000002UK01Informant12.class);
    POCDMT000002UK01DataEnterer dataEnterer = mock(POCDMT000002UK01DataEnterer.class);
    when(clinicalDocument.sizeOfInformantArray()).thenReturn(1);
    when(clinicalDocument.getInformantArray()).thenReturn(new POCDMT000002UK01Informant12[] { informant });
    when(clinicalDocument.isSetDataEnterer()).thenReturn(true);
    when(clinicalDocument.getDataEnterer()).thenReturn(dataEnterer);
    when(informantMapper.mapInformantIntoParticipantComponent(any())).thenReturn(Optional.of(encounterParticipantComponent));
    when(dataEntererMapper.mapDataEntererIntoParticipantComponent(any())).thenReturn(encounterParticipantComponent);
    when(participantMapper.mapEncounterRelatedPerson(any(), any())).thenReturn(encounterParticipantComponent);
}
Also used : POCDMT000002UK01Informant12(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12) POCDMT000002UK01DataEnterer(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01DataEnterer)

Example 4 with POCDMT000002UK01Informant12

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

Aggregations

POCDMT000002UK01Informant12 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12)4 Reference (org.hl7.fhir.dstu3.model.Reference)3 Encounter (org.hl7.fhir.dstu3.model.Encounter)2 Test (org.junit.jupiter.api.Test)2 IVLTS (uk.nhs.connect.iucds.cda.ucr.IVLTS)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Arrays.stream (java.util.Arrays.stream)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 AllArgsConstructor (lombok.AllArgsConstructor)1 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 Coding (org.hl7.fhir.dstu3.model.Coding)1 EncounterLocationComponent (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent)1 EncounterParticipantComponent (org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent)1 FINISHED (org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED)1 Group (org.hl7.fhir.dstu3.model.Group)1 Identifier (org.hl7.fhir.dstu3.model.Identifier)1 Narrative (org.hl7.fhir.dstu3.model.Narrative)1