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