use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ResponsibleParty in project integration-adaptor-111 by nhsconnect.
the class PractitionerRoleMapperTest method mockResponsibleParty.
private void mockResponsibleParty() {
when(clinicalDocument.isSetComponentOf()).thenReturn(true);
POCDMT000002UK01Component1 component1 = mock(POCDMT000002UK01Component1.class);
when(clinicalDocument.getComponentOf()).thenReturn(component1);
POCDMT000002UK01EncompassingEncounter encompassingEncounter = mock(POCDMT000002UK01EncompassingEncounter.class);
when(component1.getEncompassingEncounter()).thenReturn(encompassingEncounter);
when(encompassingEncounter.isSetResponsibleParty()).thenReturn(true);
POCDMT000002UK01ResponsibleParty responsibleParty = mock(POCDMT000002UK01ResponsibleParty.class);
when(encompassingEncounter.getResponsibleParty()).thenReturn(responsibleParty);
POCDMT000002UK01AssignedEntity assignedEntity = mock(POCDMT000002UK01AssignedEntity.class);
when(assignedEntity.isSetRepresentedOrganization()).thenReturn(true);
when(assignedEntity.getRepresentedOrganization()).thenReturn(mock(POCDMT000002UK01Organization.class));
CE ce = mockCode();
when(assignedEntity.getCode()).thenReturn(ce);
when(responsibleParty.getAssignedEntity()).thenReturn(assignedEntity);
when(organizationMapper.mapOrganization(any(POCDMT000002UK01Organization.class))).thenReturn(organization);
when(practitionerMapper.mapPractitioner(any(POCDMT000002UK01AssignedEntity.class))).thenReturn(practitioner);
}
use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ResponsibleParty in project integration-adaptor-111 by nhsconnect.
the class PractitionerRoleMapper method mapResponsibleParty.
public Optional<PractitionerRole> mapResponsibleParty(POCDMT000002UK01ClinicalDocument1 clinicalDocument) {
if (clinicalDocument.isSetComponentOf()) {
POCDMT000002UK01Component1 componentOf = clinicalDocument.getComponentOf();
if (componentOf.getEncompassingEncounter().isSetResponsibleParty()) {
PractitionerRole role = new PractitionerRole();
role.setIdElement(resourceUtil.newRandomUuid());
POCDMT000002UK01ResponsibleParty responsibleParty = componentOf.getEncompassingEncounter().getResponsibleParty();
POCDMT000002UK01AssignedEntity assignedEntity = responsibleParty.getAssignedEntity();
role.setCode(asList(getCode(assignedEntity.getCode())));
if (assignedEntity.isSetRepresentedOrganization()) {
Organization organization = organizationMapper.mapOrganization(assignedEntity.getRepresentedOrganization());
role.setOrganization(resourceUtil.createReference(organization));
role.setOrganizationTarget(organization);
}
Practitioner practitioner = practitionerMapper.mapPractitioner(assignedEntity);
role.setPractitioner(resourceUtil.createReference(practitioner));
role.setPractitionerTarget(practitioner);
return Optional.of(role);
}
}
return empty();
}
Aggregations