use of org.hl7.fhir.dstu3.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);
}
use of org.hl7.fhir.dstu3.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;
}
use of org.hl7.fhir.dstu3.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;
}
use of org.hl7.fhir.dstu3.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);
}
use of org.hl7.fhir.dstu3.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);
}
Aggregations