Search in sources :

Example 1 with POCDMT000002UK01RecordTarget

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

the class EncounterMapperTest method mockClinicalDocument.

private void mockClinicalDocument(POCDMT000002UK01ClinicalDocument1 clinicalDocument) {
    POCDMT000002UK01RecordTarget mockRecordTarget = mock(POCDMT000002UK01RecordTarget.class);
    when(clinicalDocument.getRecordTargetArray(anyInt())).thenReturn(mockRecordTarget);
    when(mockRecordTarget.getPatientRole()).thenReturn(mock(POCDMT000002UK01PatientRole.class));
    when(clinicalDocument.getComponentOf()).thenReturn(component1);
}
Also used : POCDMT000002UK01PatientRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PatientRole) POCDMT000002UK01RecordTarget(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RecordTarget)

Example 2 with POCDMT000002UK01RecordTarget

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

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

the class GroupMapperTest method mapGroupTest.

@Test
public void mapGroupTest() {
    POCDMT000002UK01RecordTarget recordTarget = mock(POCDMT000002UK01RecordTarget.class);
    POCDMT000002UK01PatientRole patientRole = mock(POCDMT000002UK01PatientRole.class);
    when(recordTarget.getPatientRole()).thenReturn(patientRole);
    when(patientMapper.mapPatient(any())).thenReturn(fhirPatient);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    when(resourceUtil.createReference(fhirPatient)).thenReturn(new Reference(fhirPatient));
    group = groupMapper.mapGroup(Arrays.array(recordTarget));
    assertThat(group.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(group.getActive()).isEqualTo(true);
    assertThat(group.getType().compareTo(Group.GroupType.PERSON)).isEqualTo(0);
    assertThat(group.getMemberFirstRep().getEntity().getResource()).isEqualTo(fhirPatient);
    assertThat(group.getMemberFirstRep().getEntityTarget()).isEqualTo(fhirPatient);
}
Also used : POCDMT000002UK01PatientRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PatientRole) Reference(org.hl7.fhir.dstu3.model.Reference) POCDMT000002UK01RecordTarget(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RecordTarget) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Example 4 with POCDMT000002UK01RecordTarget

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

the class RelatedPersonMapper method createEmergencyContactRelatedPerson.

public RelatedPerson createEmergencyContactRelatedPerson(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter) {
    RelatedPerson relatedPerson = new RelatedPerson();
    TEL[] telecomArray = Optional.ofNullable(clinicalDocument).map(document -> document.getRecordTargetArray(0)).map(POCDMT000002UK01RecordTarget::getPatientRole).map(POCDMT000002UK01PatientRole::getTelecomArray).orElse(null);
    if (getEmergencyTelecom(telecomArray).isPresent()) {
        relatedPerson.setIdElement(resourceUtil.newRandomUuid());
        relatedPerson.setPatient(encounter.getSubject());
        relatedPerson.setTelecom(getTelecomFromITK(new TEL[] { getEmergencyTelecom(telecomArray).get() }));
        markEmergencyContact(telecomArray, relatedPerson);
        return relatedPerson;
    }
    return null;
}
Also used : CollectionUtils.isEmpty(org.springframework.util.CollectionUtils.isEmpty) Coding(org.hl7.fhir.dstu3.model.Coding) POCDMT000002UK01RecordTarget(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RecordTarget) DateUtil(uk.nhs.adaptors.oneoneone.cda.report.util.DateUtil) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) POCDMT000002UK01RelatedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RelatedEntity) Period(org.hl7.fhir.dstu3.model.Period) POCDMT000002UK01ClinicalDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1) PN(uk.nhs.connect.iucds.cda.ucr.PN) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) POCDMT000002UK01PatientRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PatientRole) Address(org.hl7.fhir.dstu3.model.Address) AD(uk.nhs.connect.iucds.cda.ucr.AD) CE(uk.nhs.connect.iucds.cda.ucr.CE) POCDMT000002UK01Person(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Person) Collections.emptyList(java.util.Collections.emptyList) RelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson) IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) Collectors(java.util.stream.Collectors) Encounter(org.hl7.fhir.dstu3.model.Encounter) List(java.util.List) Component(org.springframework.stereotype.Component) UNKNOWN(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN) 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) HumanName(org.hl7.fhir.dstu3.model.HumanName) ContactPoint(org.hl7.fhir.dstu3.model.ContactPoint) POCDMT000002UK01RecordTarget(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RecordTarget) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) RelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson)

Example 5 with POCDMT000002UK01RecordTarget

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

the class GroupMapper method mapGroup.

public Group mapGroup(POCDMT000002UK01RecordTarget[] recordTargetArr) {
    Group group = new Group();
    group.setIdElement(resourceUtil.newRandomUuid());
    group.setActive(true);
    group.setType(Group.GroupType.PERSON);
    for (POCDMT000002UK01RecordTarget recordTarget : recordTargetArr) {
        Group.GroupMemberComponent groupMemberComponent = new Group.GroupMemberComponent();
        if (recordTarget.getPatientRole() != null) {
            Patient fhirPatient = patientMapper.mapPatient(recordTarget.getPatientRole());
            groupMemberComponent.setEntity(resourceUtil.createReference(fhirPatient));
            groupMemberComponent.setEntityTarget(fhirPatient);
            group.addMember(groupMemberComponent);
        }
    }
    return group;
}
Also used : Group(org.hl7.fhir.dstu3.model.Group) POCDMT000002UK01RecordTarget(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RecordTarget) Patient(org.hl7.fhir.dstu3.model.Patient)

Aggregations

POCDMT000002UK01RecordTarget (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RecordTarget)5 POCDMT000002UK01PatientRole (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PatientRole)4 Arrays.stream (java.util.Arrays.stream)1 Collections.emptyList (java.util.Collections.emptyList)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 AllArgsConstructor (lombok.AllArgsConstructor)1 Address (org.hl7.fhir.dstu3.model.Address)1 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 Coding (org.hl7.fhir.dstu3.model.Coding)1 ContactPoint (org.hl7.fhir.dstu3.model.ContactPoint)1 Encounter (org.hl7.fhir.dstu3.model.Encounter)1 UNKNOWN (org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN)1 Group (org.hl7.fhir.dstu3.model.Group)1 HumanName (org.hl7.fhir.dstu3.model.HumanName)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Patient (org.hl7.fhir.dstu3.model.Patient)1 Period (org.hl7.fhir.dstu3.model.Period)1 Reference (org.hl7.fhir.dstu3.model.Reference)1