use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project integration-adaptor-111 by nhsconnect.
the class PatientMapper method getGeneralPractioner.
private Reference getGeneralPractioner(POCDMT000002UK01PatientRole patientRole) {
Reference reference = null;
if (patientRole.isSetProviderOrganization()) {
Organization organization = orgMapper.mapOrganization(patientRole.getProviderOrganization());
reference = resourceUtil.createReference(organization);
}
return reference;
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION 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 org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project integration-adaptor-111 by nhsconnect.
the class HealthcareServiceMapperTest method shouldMapHealthcareService.
@Test
public void shouldMapHealthcareService() {
when(informationRecipient.getIntendedRecipient()).thenReturn(intendedRecipient);
when(intendedRecipient.isSetReceivedOrganization()).thenReturn(true);
when(intendedRecipient.getReceivedOrganization()).thenReturn(receivedOrganization);
when(receivedOrganization.sizeOfNameArray()).thenReturn(1);
when(receivedOrganization.getNameArray(0)).thenReturn(name);
when(organizationMapper.mapOrganization(informationRecipient)).thenReturn(organization);
when(locationMapper.mapRecipientToLocation(intendedRecipient, organization)).thenReturn(location);
when(name.getDomNode()).thenReturn(node);
when(nodeUtil.getAllText(name.getDomNode())).thenReturn(HEALTHCARE_SERVICE_NAME);
when(informationRecipient.getTypeCode()).thenReturn(forString(PRCP_TYPE_CODE));
when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
List<HealthcareService> healthcareServiceList = healthcareServiceMapper.mapHealthcareService(clinicalDocument);
HealthcareService healthcareService = healthcareServiceList.get(0);
assertThat(organization).isEqualTo(healthcareService.getProvidedByTarget());
assertThat(HEALTHCARE_SERVICE_NAME).isEqualTo(healthcareService.getName());
assertThat(true).isEqualTo(healthcareService.getActive());
assertThat(healthcareServiceList).isNotEmpty();
assertThat(healthcareService.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project integration-adaptor-111 by nhsconnect.
the class LocationMapperTest method shouldMapRecipientToLocation.
@Test
public void shouldMapRecipientToLocation() {
POCDMT000002UK01IntendedRecipient itkIntendedRecipient = prepareIntendedRecipientMocks();
Location referenceRecipientToLocation = locationMapper.mapRecipientToLocation(itkIntendedRecipient, organization);
assertThat(referenceRecipientToLocation.getId()).isEqualTo(RANDOM_UUID);
assertThat(referenceRecipientToLocation.getAddress()).isEqualTo(address);
assertThat(referenceRecipientToLocation.getTelecom()).isEqualTo(List.of(contactPoint));
assertThat(referenceRecipientToLocation.getManagingOrganization()).isNotNull();
assertThat(referenceRecipientToLocation.getManagingOrganizationTarget()).isEqualTo(organization);
assertThat(referenceRecipientToLocation.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composePatientContactComponent.
protected void composePatientContactComponent(Complex parent, String parentType, String name, Patient.ContactComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "contact", name, element, index);
for (int i = 0; i < element.getRelationship().size(); i++) composeCodeableConcept(t, "Patient", "relationship", element.getRelationship().get(i), i);
if (element.hasName())
composeHumanName(t, "Patient", "name", element.getName(), -1);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "Patient", "telecom", element.getTelecom().get(i), i);
if (element.hasAddress())
composeAddress(t, "Patient", "address", element.getAddress(), -1);
if (element.hasGenderElement())
composeEnum(t, "Patient", "gender", element.getGenderElement(), -1);
if (element.hasOrganization())
composeReference(t, "Patient", "organization", element.getOrganization(), -1);
if (element.hasPeriod())
composePeriod(t, "Patient", "period", element.getPeriod(), -1);
}
Aggregations