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);
}
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();
}
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);
}
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;
}
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;
}
Aggregations