Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referrals #32

Open
wants to merge 4 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.apache.commons.lang.StringEscapeUtils;
import org.openmrs.Concept;
import org.openmrs.Location;
import org.openmrs.ConceptAnswer;
import org.openmrs.ConceptSet;
import org.openmrs.api.context.Context;
Expand All @@ -14,6 +15,7 @@
import org.openmrs.module.hospitalcore.PatientDashboardService;
import org.openmrs.module.hospitalcore.model.BillableService;
import org.openmrs.module.hospitalcore.model.InventoryDrug;
import org.openmrs.module.kenyaemr.api.KenyaEmrService;
import org.openmrs.module.hospitalcore.model.InventoryDrugFormulation;
import org.openmrs.module.patientdashboardapp.model.Note;
import org.openmrs.module.patientdashboardapp.model.Option;
Expand All @@ -22,7 +24,6 @@
import org.openmrs.module.patientdashboardapp.model.Qualifier;
import org.openmrs.module.patientdashboardapp.model.Referral;
import org.openmrs.module.patientdashboardapp.model.ReferralReasons;
import org.openmrs.module.patientdashboardapp.util.LabTestUtil;
import org.openmrs.ui.framework.SimpleObject;
import org.openmrs.ui.framework.UiUtils;
import org.openmrs.ui.framework.fragment.FragmentConfiguration;
Expand Down Expand Up @@ -50,6 +51,11 @@ public void controller(FragmentConfiguration config, FragmentModel model,
if (config.containsKey("opdLogId") && config.get("opdLogId") != null) {
opdLogId = Integer.parseInt(config.get("opdLogId").toString());
}

KenyaEmrService service = Context.getService(KenyaEmrService.class);
Location defaultLocation = service.getDefaultLocation();

model.addAttribute("defaultLocation", defaultLocation);
model.addAttribute("outcomeOptions", SimpleObject.fromCollection(Outcome.getAvailableOutcomes(), ui, "label", "id"));
model.addAttribute("listOfWards", SimpleObject.fromCollection(Outcome.getInpatientWards(), ui, "label", "id"));
model.addAttribute("internalReferralSources", SimpleObject.fromCollection(Referral.getInternalReferralOptions(), ui, "label", "id"));
Expand Down
25 changes: 18 additions & 7 deletions omod/src/main/webapp/fragments/clinicalNotes.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
ui.includeJavascript("uicommons", "navigator/navigatorTemplates.js")
ui.includeJavascript("uicommons", "navigator/exitHandlers.js")
ui.includeJavascript("patientdashboardapp", "knockout-3.4.0.js")

def fields = [
[
label: "Facility the patient is being referred to?",
formFieldName: "defaultLocation",
class: org.openmrs.Location,
initialValue: defaultLocation
]
]
%>

${ ui.includeFragment("patientdashboardapp", "patientDashboardAppScripts", [note: note, listOfWards: listOfWards, internalReferralSources: internalReferralSources, externalReferralSources: externalReferralSources, referralReasonsSources: referralReasonsSources, outcomeOptions: outcomeOptions ]) }
Expand Down Expand Up @@ -301,7 +310,6 @@ ${ ui.includeFragment("patientdashboardapp", "patientDashboardAppScripts", [note
<div class="onerow">
<div class="col4"><label for="internalReferral" >Referral Available</label></div>
<div class="col4"><label for="internalReferral" id="refTitle" >Internal Referral</label></div>
<div class="col4 last"><label for="internalReferral" id="facTitle" >Facility</label></div>
</div>

<div class="onerow">
Expand All @@ -320,15 +328,18 @@ ${ ui.includeFragment("patientdashboardapp", "patientDashboardAppScripts", [note
<select id="internalReferral" name="internalReferral" data-bind="options: \$root.internalReferralOptions, optionsText: 'label', value: \$root.referredTo, optionsCaption: 'Please select...'">
</select>

<select id="externalReferral" name="externalReferral" onchange="loadExternalReferralCases();" data-bind="options: \$root.externalReferralOptions, optionsText: 'label', value: \$root.referredTo, optionsCaption: 'Please select...'">
</select>
<%-- <select id="externalReferral" name="externalReferral" onchange="loadExternalReferralCases();" data-bind="options: \$root.externalReferralOptions, optionsText: 'label', value: \$root.referredTo, optionsCaption: 'Please select...'">
</select> --%>
</div>
</div>

<div class="col4 last">
<div class="input-position-class">
<input type="text" id="facility" placeholder="Facility Name" name="facility" data-bind="value: \$root.facility">
</input>
<div class="input-position-class" id="externalReferral">
<label for="externalReferral">External Referral</label>
<% fields.each { %>
${ ui.includeFragment("kenyaui", "widget/labeledField", it) }
<% } %>
<%-- <input type="text" id="facility" placeholder="Facility Name" name="facility" data-bind="value: \$root.facility" /> --%>
</div>
</div>
</div>
Expand All @@ -343,7 +354,7 @@ ${ ui.includeFragment("patientdashboardapp", "patientDashboardAppScripts", [note

<div class="onerow" style="padding-top:2px;" id="refReason2">
<div class="col4">
<select id="referralReasons" name="referralReasons" data-bind="options: \$root.referralReasonsOptions, optionsText: 'label', value: \$root.referralReasons, optionsCaption: 'Please select...'" style="margin-top: 5px;">
<select id="referralReasons" name="referralReasons" data-bind="options: \$root.referralReasonsSources, optionsText: 'label', value: \$root.referralReasons, optionsCaption: 'Please select...'" style="margin-top: 5px;">
</select>
</div>

Expand Down
2 changes: 2 additions & 0 deletions omod/src/main/webapp/resources/scripts/select2.js

Large diffs are not rendered by default.