5 * @link http://www.open-emr.org
6 * @author Brady Miller
<brady.g.miller@gmail.com
>
7 * @copyright Copyright (c)
2017 Brady Miller
<brady.g.miller@gmail.com
>
8 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License
3
15 <link rel=
"stylesheet" href=
"{$GLOBALS.css_header}" type=
"text/css">
16 <link rel=
"stylesheet" href=
"{$GLOBALS.assets_static_relative}/jquery-ui-1-12-1/themes/base/jquery-ui.min.css" type=
"text/css" />
19 <style type=
"text/css">
30 <script language=
"Javascript">
33 function my_process () {
35 opener
.document
.prescribe
.drug
.value
= document
.lookup
.drug
.value
;
44 <script type=
"text/javascript" src=
"{$GLOBALS.assets_static_relative}/jquery-min-3-1-1/index.js"></script>
45 <script type=
"text/javascript" src=
"{$GLOBALS.webroot}/library/dialog.js?v={$GLOBALS.v_js_includes}"></script>
46 <script type=
"text/javascript" src=
"{$GLOBALS.assets_static_relative}/jquery-ui-1-12-1/jquery-ui.js"></script>
49 <script language='JavaScript'
>
51 // This holds all the default drug attributes.
52 // This was html escaped previously
54 var drugopts
= [{$DRUG_ATTRIBUTES
}];
57 // Helper to choose an option from its value.
58 function selchoose(sel
, value
) {
60 for (i
= 0; i
< o
.length
; ++i
) {
61 o
[i
].selected
= (o
[i
].value
== value
);
65 // Fill in default values when a drop-down drug is selected.
66 function drugselected(sel
) {
67 var f
= document
.forms
[0];
68 var i
= f
.drug_id
.selectedIndex
- 1;
72 selchoose(f
.form
, d
[1]);
73 f
.dosage
.value
= d
[2];
75 f
.rxnorm_drugcode
.value
= d
[11];
76 selchoose(f
.unit
, d
[4]);
77 selchoose(f
.route
, d
[5]);
78 selchoose(f
.interval
, d
[6]);
79 selchoose(f
.substitute
, d
[7]);
80 f
.quantity
.value
= d
[8];
81 f
.disp_quantity
.value
= d
[8];
82 selchoose(f
.refills
, d
[9]);
83 f
.per_refill
.value
= d
[10];
87 // Invoke the popup to dispense a drug.
89 var f
= document
.forms
[0];
90 dlgopen('interface/drugs/dispense_drug.php' +
91 {/literal
}'?drug_id={$prescription->get_drug_id()}' +{literal
}
92 '&prescription=' + f
.id
.value
+
93 '&quantity=' + f
.disp_quantity
.value
+
94 '&fee=' + f
.disp_fee
.value
,
98 function quantityChanged() {
99 var f
= document
.forms
[0];
100 f
.per_refill
.value
= f
.quantity
.value
;
101 if (f
.disp_quantity
) {
102 f
.disp_quantity
.value
= f
.quantity
.value
;
109 <body class=
"body_top">
111 <form name=
"prescribe" id=
"prescribe" method=
"post" action=
"{$FORM_ACTION}" >
113 <tr><td class=
"title"><font><b>{xl t='Add'|escape:'html'}/{xl t='Edit'|escape:'html'}
</b></font> </td>
114 <td><a href=#
onclick=
"submitfun();" class=
"css_button_small"><span>{xl t='Save'|escape:'html'}
</span></a>
115 {if $DRUG_ARRAY_VALUES}
116
117 {if $prescription-
>get_refills()
>= $prescription-
>get_dispensation_count()}
118 <input type=
"submit" name=
"disp_button" value=
"{xl t='Save and Dispense'|escape:'html'}" />
119 <input type=
"text" name=
"disp_quantity" size=
"2" maxlength=
"10" value=
"{$DISP_QUANTITY|escape:'html'}" />
121 <input type=
"text" name=
"disp_fee" size=
"5" maxlength=
"10" value=
"{$DISP_FEE|escape:'html'}" />
123 {xl t='prescription has reached its limit of'|escape:'html'} {$prescription-
>get_refills()|escape:'html'} {xl t='refills'|escape:'html'}.
126 <a class='css_button_small'
href=
"controller.php?prescription&list&id={$prescription->patient->id|escape:'html'}"><span>{xl t='Back'|escape:'html'}
</span></a>
130 {if $GLOBALS.enable_amc_prompting}
131 <div style='float:right;margin-right:
25px;border-style:solid;border-width:
1px;'
>
132 <div style='float:left;margin:
5px
5px
5px
5px;'
>
133 {amcCollect amc_id='e_prescribe_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
134 {if not $amcCollectReturn}
135 <input type=
"checkbox" id=
"escribe_flag" name=
"escribe_flag">
137 <input type=
"checkbox" id=
"escribe_flag" name=
"escribe_flag" checked
>
139 <span class=
"text">{xl t='E-Prescription?'|escape:'html'}
</span><br>
141 {amcCollect amc_id='e_prescribe_chk_formulary_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
142 {if not $amcCollectReturn}
143 <input type=
"checkbox" id=
"checked_formulary_flag" name=
"checked_formulary_flag">
145 <input type=
"checkbox" id=
"checked_formulary_flag" name=
"checked_formulary_flag" checked
>
147 <span class=
"text">{xl t='Checked Drug Formulary?'|escape:'html'}
</span><br>
149 {amcCollect amc_id='e_prescribe_cont_subst_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
150 {if not $amcCollectReturn}
151 <input type=
"checkbox" id=
"controlled_substance_flag" name=
"controlled_substance_flag">
153 <input type=
"checkbox" id=
"controlled_substance_flag" name=
"controlled_substance_flag" checked
>
155 <span class=
"text">{xl t='Controlled Substance?'|escape:'html'}
</span><br>
161 <table CELLSPACING=
"0" CELLPADDING=
"3" BORDER=
"0">
163 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Currently Active'|escape:'html'}
</td>
164 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
165 <input type=
"checkbox" name=
"active" value=
"1"{if $prescription-
>get_active()
> 0} checked{/if}
/>
169 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Starting Date'|escape:'html'}
</td>
170 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
171 {html_select_date
start_year=
"-10" end_year=
"+5" time=$prescription-
>start_date
prefix=
"start_date_"}
172 <input type=
"hidden" name=
"start_date" value=
"{$prescription->start_date|escape:'html'}">
176 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Provider'|escape:'html'}
</td>
177 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
178 {html_options
name=
"provider_id" options=$prescription-
>provider-
>utility_provider_array() selected=$prescription-
>provider-
>get_id()}
179 <input type=
"hidden" name=
"patient_id" value=
"{$prescription->patient->id|escape:'html'}" />
184 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Drug'|escape:'html'}
</td>
185 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
186 <input type=
"input" size=
"20" name=
"drug" id=
"drug" value=
"{$prescription->drug|escape:'html'}"/>
187 <a href=
"javascript:;" id=
"druglookup" class=
"small" name=
"B4" onclick=
"$('#hiddendiv').show(); document.getElementById('hiddendiv').innerHTML='<iframe src="controller.php?prescription&lookup&drug=" width="100%"height="52" scrolling="no" frameborder="no"></iframe>'">
188 ({xl t='click here to search'|escape:'html'})
</a>
189 <div id=hiddendiv
style=
"display:none"> </div>
192 {if $DRUG_ARRAY_VALUES}
194 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" > {xl t='in-house'|escape:'html'}
</td>
195 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
196 <select name=
"drug_id" onchange=
"drugselected(this)">
197 {html_options values=$DRUG_ARRAY_VALUES output=$DRUG_ARRAY_OUTPUT selected=$prescription-
>get_drug_id()}
199 <input type=
"hidden" name=
"rxnorm_drugcode" value=
"{$prescription->rxnorm_drugcode|escape:'html'}">
204 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Quantity'|escape:'html'}
</td>
205 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
206 <input TYPE=
"TEXT" NAME=
"quantity" id=
"quantity" SIZE=
"10" MAXLENGTH=
"31"
207 VALUE=
"{$prescription->quantity|escape:'html'}"
208 onchange=
"quantityChanged()" />
211 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription-
>size}
212 <tr style='display:none;'
>
216 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Medicine Units'|escape:'html'}
</td>
217 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
218 <input TYPE=
"TEXT" NAME=
"size" id=
"size" SIZE=
"11" MAXLENGTH=
"10" VALUE=
"{$prescription->size|escape:'html'}"/>
219 <select name=
"unit" id=
"unit">{html_options options=$prescription-
>unit_array selected=$prescription-
>unit}
</select>
223 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Directions'|escape:'html'}
</td>
224 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
225 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription-
>form && !$prescription-
>route && !$prescription-
>interval}
226 <input TYPE=
"text" NAME=
"dosage" id=
"dosage" SIZE=
"30" MAXLENGTH=
"100" VALUE=
"{$prescription->dosage|escape:'html'}" />
227 <input type=
"hidden" name=
"form" id=
"form" value=
"0" />
228 <input type=
"hidden" name=
"route" id=
"route" value=
"0" />
229 <input type=
"hidden" name=
"interval" id=
"interval" value=
"0" />
231 <input TYPE=
"TEXT" NAME=
"dosage" id=
"dosage" SIZE=
"2" MAXLENGTH=
"10" VALUE=
"{$prescription->dosage|escape:'html'}"/> {xl t='in'|escape:'html'}
232 <select name=
"form" id=
"form">{html_options options=$prescription-
>form_array selected=$prescription-
>form}
</select>
233 <select name=
"route" id=
"route">{html_options options=$prescription-
>route_array selected=$prescription-
>route}
</select>
234 <select name=
"interval" id=
"interval">{html_options options=$prescription-
>interval_array selected=$prescription-
>interval}
</select>
239 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Refills'|escape:'html'}
</td>
240 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
241 {html_options
name=
"refills" options=$prescription-
>refills_array selected=$prescription-
>refills}
242 {if $SIMPLIFIED_PRESCRIPTIONS}
243 <input TYPE=
"hidden" ID=
"per_refill" NAME=
"per_refill" VALUE=
"{$prescription->per_refill|escape:'html'}" />
245 # {xl t='of tablets'}:
246 <input TYPE=
"TEXT" ID=
"per_refill" NAME=
"per_refill" SIZE=
"2" MAXLENGTH=
"10" VALUE=
"{$prescription->per_refill|escape:'html'}" />
251 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Notes'|escape:'html'}
</td>
252 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
253 <textarea name=
"note" cols=
"30" rows=
"2" wrap=
"virtual">{$prescription-
>note|escape:'html'}
</textarea>
257 {if $WEIGHT_LOSS_CLINIC}
258 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Substitution'|escape:'html'}
</td>
259 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
260 {html_options
name=
"substitute" options=$prescription-
>substitute_array selected=$prescription-
>substitute}
263 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Add to Medication List'|escape:'html'}
</td>
264 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
265 {html_radios
name=
"medication" options=$prescription-
>medication_array selected=$prescription-
>medication}
267 {html_options
name=
"substitute" options=$prescription-
>substitute_array selected=$prescription-
>substitute}
272 <input type=
"hidden" name=
"id" value=
"{$prescription->id|escape:'html'}" />
273 <input type=
"hidden" name=
"process" value=
"{$PROCESS|escape:'html'}" />
274 <script language='JavaScript'
>
280 <!-- for the fancy jQuery stuff -->
281 <script type=
"text/javascript">
283 function submitfun() {
284 top
.restoreSession();
285 if (CheckForErrors(this)) {
286 document
.forms
["prescribe"].submit();
293 function iframetopardiv(string
){
295 document
.getElementById('drug').value
=name
;
296 $("#hiddendiv").html( " " );
297 $('#hiddendiv').hide();
300 function cancelParlookup () {
301 $('#hiddendiv').hide();
302 $("#hiddendiv").html( " " );
305 $().ready(function() {
308 {if $GLOBALS
.weno_rx_enable
}
310 $('#drug').autocomplete({
311 source
: 'library/ajax/drug_autocomplete/search.php',
317 $('#drug').autocomplete({
318 source
: 'library/ajax/prescription_drugname_lookup.php',
326 $("#prescribe").submit(function() { return CheckForErrors(this) });
327 $("#druglookup").click(function() { DoDrugLookup(this) });
331 // pop up a drug lookup window with the value of the drug name, if we have one
332 function DoDrugLookup(eObj
) {
334 if ($('#drug').val() != "") { drugname
= $('#drug').val(); }
335 $("#druglist").css('display','block');
336 document
.lookup
.action
='controller.php?prescription&edit&id=&pid={/literal}{$prescription->patient->id}{literal}&drug=sss'+drugname
;
337 drugPopup
= window
.open('controller.php?prescription&lookup&drug='+drugname
, 'drugPopup', 'width=400,height=50,menubar=no,titlebar=no,left = 825,top = 400');
338 drugPopup
.opener
= self
;
343 // check the form for required fields before submitting
344 var CheckForErrors = function(eObj
) {
346 if (CheckRequired('drug') == false) { return false; }
347 if (CheckRequired('quantity') == false) { return false; }
348 //if (CheckRequired('unit') == false) { return false; }
349 //if (CheckRequired('size') == false) { return false; }
350 if (CheckRequired('dosage') == false) { return false; }
351 //if (CheckRequired('form') == false) { return false; }
352 //if (CheckRequired('route') == false) { return false; }
353 //if (CheckRequired('interval') == false) { return false; }
355 return top
.restoreSession();
358 function CheckRequired(objID
) {
361 if ($('#'+objID
).is('input')) {
362 if ($('#'+objID
).val() == "") {
363 alert("{/literal}{xl t='Missing a required field and will be highlighted'}{literal}");
364 $('#'+objID
).css("backgroundColor", "pink");
370 if ($('#'+objID
).is('select')) {
371 if ($('#'+objID
).val() == "0") {
372 alert("{/literal}{xl t='Missing a required field'}{literal}");
373 $('#'+objID
).css("backgroundColor", "pink");