Details
-
Improvement
-
Status: Approved
-
Should
-
Resolution: Fixed
-
Reference Application 2.7.0
-
Low
Description
In our openmrs implementation, we have three major programs (PMTCT, ART and HTS). Each of the these programs has forms that relate to them. We want a situation where patient is enrolled on a particular program, and only forms that relate to the program should be displayed.
Similar with what we have in the link below: Conditionally displaying Apps and Extensions but for program areas.
You can put a blank line after this one: https://github.com/openmrs/openmrs-module-coreapps/blob/master/omod/src/main/java/org/openmrs/module/coreapps/page/controller/clinicianfacing/PatientPageController.java#L96
Then put code like below:
List<Program> programs = new ArrayList<Program>(); List<PatientProgram> patientPrograms = Context.getProgramWorkflowService().getPatientPrograms(patient, null, null, null, null, null, false); for (PatientProgram patientProgram : patientPrograms) { programs.add(patientProgram.getProgram()); } contextModel.put("patientPrograms", ConversionUtil.convertToRepresentation(programs, Representation.DEFAULT));
Remember to put another blank line after this code.
Then one should be able to for instance configure a form for patients on the ART program with the show if condition below:
hasMemberWithProperty (patientPrograms, 'name', 'ART')
or
hasMemberWithProperty (patientPrograms, 'uuid', 'uuid-for-the-art-program')
After this code has been merged, update the above wiki documentation by adding how one can conditionally show forms based on patient program enrolment.
Just in case you are not aware of these pull request tips: https://wiki.openmrs.org/display/docs/Pull+Request+Tips
Gliffy Diagrams
Attachments
Issue Links
- links to