Search in sources :

Example 46 with Organization

use of org.hl7.fhir.r4.model.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;
}
Also used : Organization(org.hl7.fhir.dstu3.model.Organization) Reference(org.hl7.fhir.dstu3.model.Reference)

Example 47 with Organization

use of org.hl7.fhir.r4.model.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;
}
Also used : Optional.empty(java.util.Optional.empty) Practitioner(org.hl7.fhir.dstu3.model.Practitioner) POCDMT000002UK01AssignedAuthor(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedAuthor) CE(uk.nhs.connect.iucds.cda.ucr.CE) Coding(org.hl7.fhir.dstu3.model.Coding) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) ArrayList(java.util.ArrayList) POCDMT000002UK01Author(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Author) Organization(org.hl7.fhir.dstu3.model.Organization) List(java.util.List) Component(org.springframework.stereotype.Component) POCDMT000002UK01Component1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component1) Arrays.asList(java.util.Arrays.asList) ResourceUtil(uk.nhs.adaptors.oneoneone.cda.report.util.ResourceUtil) POCDMT000002UK01ClinicalDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1) Optional(java.util.Optional) POCDMT000002UK01ResponsibleParty(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ResponsibleParty) POCDMT000002UK01AssignedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity) AllArgsConstructor(lombok.AllArgsConstructor) Arrays.stream(java.util.Arrays.stream) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) POCDMT000002UK01AssignedAuthor(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedAuthor) Practitioner(org.hl7.fhir.dstu3.model.Practitioner) Organization(org.hl7.fhir.dstu3.model.Organization) ArrayList(java.util.ArrayList) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole)

Example 48 with Organization

use of org.hl7.fhir.r4.model.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);
}
Also used : HealthcareService(org.hl7.fhir.dstu3.model.HealthcareService) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Example 49 with Organization

use of org.hl7.fhir.r4.model.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);
}
Also used : POCDMT000002UK01IntendedRecipient(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient) Location(org.hl7.fhir.dstu3.model.Location) Test(org.junit.jupiter.api.Test)

Example 50 with Organization

use of org.hl7.fhir.r4.model.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);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Aggregations

Test (org.junit.jupiter.api.Test)101 Organization (org.hl7.fhir.dstu3.model.Organization)90 Organization (org.hl7.fhir.r4.model.Organization)69 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)41 Resource (org.hl7.fhir.r4.model.Resource)38 ArrayList (java.util.ArrayList)34 List (java.util.List)33 Reference (org.hl7.fhir.r4.model.Reference)33 Identifier (org.hl7.fhir.r4.model.Identifier)30 Bundle (org.hl7.fhir.dstu3.model.Bundle)27 UUID (java.util.UUID)26 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)25 Patient (org.hl7.fhir.r4.model.Patient)25 IdType (org.hl7.fhir.dstu3.model.IdType)24 Bundle (org.hl7.fhir.r4.model.Bundle)24 Coding (org.hl7.fhir.r4.model.Coding)24 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)19 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)17 Reference (org.hl7.fhir.dstu3.model.Reference)16 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)16