use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization in project integration-adaptor-111 by nhsconnect.
the class OrganizationMapperTest method shouldMapOrganization.
@Test
public void shouldMapOrganization() {
POCDMT000002UK01Organization itkOrganization = mockItkOrganization();
when(nodeUtil.getNodeValueString(itkOrganization.getNameArray(0))).thenReturn(ORGANIZATION_NAME);
Organization organization = organizationMapper.mapOrganization(itkOrganization);
assertThat(organization.getName()).isEqualTo(ORGANIZATION_NAME);
assertThat(organization.getAddressFirstRep()).isEqualTo(address);
assertThat(organization.getTelecomFirstRep()).isEqualTo(contactPoint);
assertThat(organization.getType().get(0).getText()).isEqualTo(GP_PRACTICE);
assertThat(organization.getIdentifierFirstRep().getValue()).isEqualTo(ODS_CODE);
}
use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization in project integration-adaptor-111 by nhsconnect.
the class OrganizationMapperTest method shouldMapOrganizationInformationRecipient.
@Test
public void shouldMapOrganizationInformationRecipient() {
POCDMT000002UK01Organization itkOrganization = mockItkOrganization();
when(informationRecipient.getIntendedRecipient()).thenReturn(intendedRecipient);
when(intendedRecipient.getReceivedOrganization()).thenReturn(itkOrganization);
when(intendedRecipient.isSetReceivedOrganization()).thenReturn(true);
when(informationRecipient.getTypeCode()).thenReturn(forString(PRCP_TYPE_CODE));
when(itkOrganization.getNameArray(0)).thenReturn(on);
when(nodeUtil.getNodeValueString(on)).thenReturn(HEALTHCARE_SERVICE_NAME);
Organization organization = organizationMapper.mapOrganization(informationRecipient);
assertThat(organization.getTypeFirstRep().getCodingFirstRep().getCode()).isEqualTo(PRCP_TYPE_CODE);
assertThat(organization.getTypeFirstRep().getCodingFirstRep().getDisplay()).isEqualTo(HEALTHCARE_SERVICE_NAME);
}
use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization in project integration-adaptor-111 by nhsconnect.
the class PatientMapperTest method mockGeneralPractitioner.
private void mockGeneralPractitioner(POCDMT000002UK01PatientRole patientRole) {
when(patientRole.isSetProviderOrganization()).thenReturn(true);
POCDMT000002UK01Organization itkOrganization = mock(POCDMT000002UK01Organization.class);
when(patientRole.getProviderOrganization()).thenReturn(itkOrganization);
when(organizationMapper.mapOrganization(any(POCDMT000002UK01Organization.class))).thenReturn(organization);
}
use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization in project integration-adaptor-111 by nhsconnect.
the class HealthcareServiceMapper method mapSingleHealthcareService.
private HealthcareService mapSingleHealthcareService(POCDMT000002UK01InformationRecipient informationRecipient) {
POCDMT000002UK01IntendedRecipient intendedRecipient = informationRecipient.getIntendedRecipient();
HealthcareService healthcareService = new HealthcareService().setActive(true);
healthcareService.setIdElement(resourceUtil.newRandomUuid());
Organization organization = new Organization();
if (intendedRecipient.isSetReceivedOrganization()) {
POCDMT000002UK01Organization receivedOrganization = intendedRecipient.getReceivedOrganization();
organization = organizationMapper.mapOrganization(informationRecipient);
healthcareService.setProvidedBy(resourceUtil.createReference(organization));
healthcareService.setProvidedByTarget(organization);
if (receivedOrganization.sizeOfNameArray() > 0) {
ON name = receivedOrganization.getNameArray(0);
healthcareService.setName(nodeUtil.getAllText(name.getDomNode()));
}
}
Location location = locationMapper.mapRecipientToLocation(intendedRecipient, organization);
healthcareService.addLocation(resourceUtil.createReference(location));
if (intendedRecipient.sizeOfTelecomArray() > 0) {
for (TEL tel : intendedRecipient.getTelecomArray()) {
healthcareService.addTelecom(contactPointMapper.mapContactPoint(tel));
}
}
return healthcareService;
}
use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization in project integration-adaptor-111 by nhsconnect.
the class LocationMapper method mapOrganizationToLocationComponent.
public Encounter.EncounterLocationComponent mapOrganizationToLocationComponent(POCDMT000002UK01Organization organization) {
Encounter.EncounterLocationComponent encounterLocationComponent = new Encounter.EncounterLocationComponent();
encounterLocationComponent.setStatus(Encounter.EncounterLocationStatus.ACTIVE);
Location location = new Location();
location.setIdElement(resourceUtil.newRandomUuid());
Organization managingOrganization = organizationMapper.mapOrganization(organization);
location.setManagingOrganization(resourceUtil.createReference(managingOrganization));
location.setManagingOrganizationTarget(managingOrganization);
encounterLocationComponent.setLocation(resourceUtil.createReference(location));
encounterLocationComponent.setLocationTarget(location);
if (organization.isSetAsOrganizationPartOf()) {
if (organization.getAsOrganizationPartOf().getEffectiveTime() != null) {
encounterLocationComponent.setPeriod(periodMapper.mapPeriod(organization.getAsOrganizationPartOf().getEffectiveTime()));
}
}
return encounterLocationComponent;
}
Aggregations