Search in sources :

Example 1 with EncounterLocationComponent

use of org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent in project openmrs-module-fhir2 by openmrs.

the class EncounterLocationTranslatorImplTest method setUp.

@Before
public void setUp() {
    encounterLocationTranslator = new EncounterLocationTranslatorImpl();
    encounterLocationTranslator.setLocationDao(locationDao);
    location = new Location();
    location.setUuid(LOCATION_UUID);
    location.setName(TEST_LOCATION_NAME);
    encounterLocationComponent = new Encounter.EncounterLocationComponent();
    Reference reference = new Reference(LOCATION_URI);
    encounterLocationComponent.setLocation(reference);
}
Also used : Reference(org.hl7.fhir.r4.model.Reference) Encounter(org.hl7.fhir.r4.model.Encounter) Location(org.openmrs.Location) Before(org.junit.Before)

Example 2 with EncounterLocationComponent

use of org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent in project integration-adaptor-111 by nhsconnect.

the class EncounterMapper method getLocationComponents.

private List<EncounterLocationComponent> getLocationComponents(POCDMT000002UK01ClinicalDocument1 clinicalDocument1) {
    List<EncounterLocationComponent> locations = new ArrayList<>();
    if (clinicalDocument1.sizeOfRecordTargetArray() > 0) {
        locations = stream(clinicalDocument1.getRecordTargetArray()).filter(recordTarget -> recordTarget.getPatientRole().getProviderOrganization() != null).map(recordTarget -> recordTarget.getPatientRole().getProviderOrganization()).map(locationMapper::mapOrganizationToLocationComponent).collect(Collectors.toList());
    }
    EncounterLocationComponent healthcareFacility = locationMapper.mapHealthcareFacilityToLocationComponent(clinicalDocument1);
    if (healthcareFacility != null) {
        locations.add(healthcareFacility);
    }
    return locations;
}
Also used : Arrays(java.util.Arrays) REFERRAL(uk.nhs.adaptors.oneoneone.cda.report.enums.MessageHeaderEvent.REFERRAL) Identifier(org.hl7.fhir.dstu3.model.Identifier) Coding(org.hl7.fhir.dstu3.model.Coding) NodeUtil(uk.nhs.adaptors.oneoneone.cda.report.util.NodeUtil) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) AppointmentService(uk.nhs.adaptors.oneoneone.cda.report.service.AppointmentService) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) ArrayList(java.util.ArrayList) Organization(org.hl7.fhir.dstu3.model.Organization) Group(org.hl7.fhir.dstu3.model.Group) Period(org.hl7.fhir.dstu3.model.Period) POCDMT000002UK01ClinicalDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) EncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent) POCDMT000002UK01PatientRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PatientRole) FINISHED(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED) Reference(org.hl7.fhir.dstu3.model.Reference) EncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent) IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) Collectors(java.util.stream.Collectors) POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) Encounter(org.hl7.fhir.dstu3.model.Encounter) DISCHARGE_DETAILS(uk.nhs.adaptors.oneoneone.cda.report.enums.MessageHeaderEvent.DISCHARGE_DETAILS) List(java.util.List) Component(org.springframework.stereotype.Component) POCDMT000002UK01Encounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter) Narrative(org.hl7.fhir.dstu3.model.Narrative) Patient(org.hl7.fhir.dstu3.model.Patient) GENERATED(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED) ResourceUtil(uk.nhs.adaptors.oneoneone.cda.report.util.ResourceUtil) Optional(java.util.Optional) POCDMT000002UK01Informant12(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12) AllArgsConstructor(lombok.AllArgsConstructor) Arrays.stream(java.util.Arrays.stream) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) EncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent) ArrayList(java.util.ArrayList)

Example 3 with EncounterLocationComponent

use of org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent in project eCRNow by drajer-health.

the class CdaFhirUtilities method getLocation.

public static Location getLocation(List<BundleEntryComponent> entries, Encounter en) {
    EncounterLocationComponent loc = en.getLocationFirstRep();
    if (loc != null && loc.getLocation() != null) {
        BundleEntryComponent ent = getResourceEntryForId(loc.getLocation().getReference(), "Location", entries);
        if (ent != null) {
            logger.debug("Found Location for Id {}", loc.getLocation().getReference());
            return (Location) ent.getResource();
        }
    }
    logger.debug("Did not find the location resource for encounter");
    return null;
}
Also used : BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) EncounterLocationComponent(org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent) Location(org.hl7.fhir.r4.model.Location)

Example 4 with EncounterLocationComponent

use of org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent in project eCRNow by drajer-health.

the class CdaFhirUtilitiesTest method testGetOrganization_withNullLocationComp.

@Test
public void testGetOrganization_withNullLocationComp() {
    EncounterLocationComponent loc = null;
    Reference ref = new Reference();
    ref.setReference("ResId");
    BundleEntryComponent bundleEntry = new BundleEntryComponent();
    Resource location = ResourceFactory.createResource("Location");
    location.setId("ResId");
    bundleEntry.setResource(location);
    List<BundleEntryComponent> entries = new ArrayList<BundleEntryComponent>();
    entries.add(bundleEntry);
    Encounter en = new Encounter();
    List<EncounterLocationComponent> locationList = new ArrayList<Encounter.EncounterLocationComponent>();
    locationList.add(loc);
    en.setLocation(locationList);
    Location testLocation = CdaFhirUtilities.getLocation(entries, en);
    assertNull(testLocation);
}
Also used : BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Reference(org.hl7.fhir.r4.model.Reference) EncounterLocationComponent(org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent) Resource(org.hl7.fhir.r4.model.Resource) ArrayList(java.util.ArrayList) Encounter(org.hl7.fhir.r4.model.Encounter) Location(org.hl7.fhir.r4.model.Location) Test(org.junit.Test)

Example 5 with EncounterLocationComponent

use of org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent in project eCRNow by drajer-health.

the class CdaFhirUtilitiesTest method testGetOrganization_withLocationEntry.

@Test
public void testGetOrganization_withLocationEntry() {
    EncounterLocationComponent loc = new EncounterLocationComponent();
    Reference ref = new Reference();
    ref.setReference("ResId");
    loc.setLocation(ref);
    BundleEntryComponent bundleEntry = new BundleEntryComponent();
    Resource location = ResourceFactory.createResource("Location");
    location.setId("ResId");
    bundleEntry.setResource(location);
    List<BundleEntryComponent> entries = new ArrayList<BundleEntryComponent>();
    entries.add(bundleEntry);
    Encounter en = new Encounter();
    List<EncounterLocationComponent> locationList = new ArrayList<Encounter.EncounterLocationComponent>();
    locationList.add(loc);
    en.setLocation(locationList);
    Location testLocation = CdaFhirUtilities.getLocation(entries, en);
    assertNotNull(testLocation);
}
Also used : BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Reference(org.hl7.fhir.r4.model.Reference) EncounterLocationComponent(org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent) Resource(org.hl7.fhir.r4.model.Resource) ArrayList(java.util.ArrayList) Encounter(org.hl7.fhir.r4.model.Encounter) Location(org.hl7.fhir.r4.model.Location) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)4 Encounter (org.hl7.fhir.dstu3.model.Encounter)4 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)4 EncounterLocationComponent (org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent)4 Encounter (org.hl7.fhir.r4.model.Encounter)3 Location (org.hl7.fhir.r4.model.Location)3 Reference (org.hl7.fhir.r4.model.Reference)3 EncounterLocationComponent (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent)2 Location (org.hl7.fhir.dstu3.model.Location)2 Organization (org.hl7.fhir.dstu3.model.Organization)2 Reference (org.hl7.fhir.dstu3.model.Reference)2 Resource (org.hl7.fhir.r4.model.Resource)2 Test (org.junit.Test)2 IVLTS (uk.nhs.connect.iucds.cda.ucr.IVLTS)2 POCDMT000002UK01EncompassingEncounter (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01EncompassingEncounter)2 POCDMT000002UK01Location (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Location)2 POCDMT000002UK01Organization (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization)2 Arrays (java.util.Arrays)1 Arrays.stream (java.util.Arrays.stream)1 HashMap (java.util.HashMap)1