Skip to content

Commit 3e920d9

Browse files
authored
Merge pull request #644 from PIH/UHM-9199
UHM-9199: Inpatient List should limit to patients at current facility
2 parents eb47c54 + 6ae9bf3 commit 3e920d9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

omod/src/main/java/org/openmrs/module/pihcore/page/controller/adt/InpatientListPageController.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.openmrs.PatientIdentifier;
1010
import org.openmrs.PatientIdentifierType;
1111
import org.openmrs.api.PatientService;
12+
import org.openmrs.module.appui.UiSessionContext;
1213
import org.openmrs.module.coreapps.CoreAppsProperties;
1314
import org.openmrs.module.emrapi.EmrApiProperties;
1415
import org.openmrs.module.emrapi.adt.AdtService;
@@ -37,7 +38,13 @@ public void get(PageModel model,
3738
@SpringBean("coreAppsProperties") CoreAppsProperties coreAppsProperties,
3839
@SpringBean("patientService") PatientService patientService,
3940
@SpringBean("adtService") AdtService adtService,
40-
@SpringBean("emrApiProperties") EmrApiProperties emrApiProperties) throws EvaluationException {
41+
@SpringBean("emrApiProperties") EmrApiProperties emrApiProperties,
42+
UiSessionContext uiSessionContext) throws EvaluationException {
43+
44+
// use the closest visit location associated with the session location if the location param is not specified
45+
if (visitLocation == null) {
46+
visitLocation= adtService.getLocationThatSupportsVisits(uiSessionContext.getSessionLocation());
47+
}
4148

4249
InpatientAdmissionSearchCriteria criteria = new InpatientAdmissionSearchCriteria();
4350
criteria.setVisitLocation(visitLocation);

omod/src/main/webapp/pages/adt/inpatientList.gsp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@
5252

5353
<h3 class="inpatient-count">${ ui.message("emr.inpatients.patientCount") }: <span id="listSize">${inpatientsNumber}</span></h3>
5454
<div class="inpatient-filter">
55-
${ ui.includeFragment("emr", "field/location", [
55+
${ ui.includeFragment("pihapps", "field/location", [
5656
"id": "inpatients-filterByLocation",
5757
"formFieldName": "filterByLocationId",
5858
"label": "emr.inpatients.filterByCurrentWard",
59-
"withTag": "Admission Location;Transfer Location"
59+
"withTag": "Admission Location;Transfer Location",
60+
"restrictToVisitLocationAndDescendants": true
6061
] ) }
6162
</div>
6263

0 commit comments

Comments
 (0)