use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedAuthor in project integration-adaptor-111 by nhsconnect.
the class PractitionerRoleMapperTest method mockAuthors.
private void mockAuthors() {
when(author.getTypeCode()).thenReturn(AUTHOR_TYPE_CODE);
POCDMT000002UK01AssignedAuthor assignedAuthor = mock(POCDMT000002UK01AssignedAuthor.class);
when(author.getAssignedAuthor()).thenReturn(assignedAuthor);
CE ce = mockCode();
when(assignedAuthor.getCode()).thenReturn(ce);
when(assignedAuthor.getRepresentedOrganization()).thenReturn(mock(POCDMT000002UK01Organization.class));
when(organizationMapper.mapOrganization(any(POCDMT000002UK01Organization.class))).thenReturn(organization);
when(practitionerMapper.mapPractitioner(any(POCDMT000002UK01AssignedAuthor.class))).thenReturn(practitioner);
}
use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedAuthor in project integration-adaptor-111 by nhsconnect.
the class PractitionerMapperTest method shouldMapPractitionerForAssignedAuthor.
@Test
public void shouldMapPractitionerForAssignedAuthor() {
POCDMT000002UK01AssignedAuthor associatedEntity = POCDMT000002UK01AssignedAuthor.Factory.newInstance();
associatedEntity.setAssignedPerson(createPerson());
associatedEntity.setTelecomArray(createTelecomArray());
associatedEntity.setAddrArray(createAddrArray());
when(humanNameMapper.mapHumanName(ArgumentMatchers.any())).thenReturn(humanName);
when(contactPointMapper.mapContactPoint(ArgumentMatchers.any())).thenReturn(contactPoint);
when(addressMapper.mapAddress(ArgumentMatchers.any())).thenReturn(address);
when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
Practitioner practitioner = practitionerMapper.mapPractitioner(associatedEntity);
assertThat(practitioner.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
assertThat(practitioner.getActive()).isEqualTo(true);
assertThat(practitioner.getNameFirstRep()).isEqualTo(humanName);
assertThat(practitioner.getTelecomFirstRep()).isEqualTo(contactPoint);
assertThat(practitioner.getAddressFirstRep()).isEqualTo(address);
}
use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedAuthor 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;
}
Aggregations