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
14 {headerTemplate assets='jquery-ui|jquery-ui-base'}
17 <style type=
"text/css">
28 <script language=
"Javascript">
31 function my_process () {
33 opener
.document
.prescribe
.drug
.value
= document
.lookup
.drug
.value
;
41 <script language='JavaScript'
>
43 // This holds all the default drug attributes.
44 // This was html escaped previously
46 var drugopts
= [{$DRUG_ATTRIBUTES
}];
49 // Helper to choose an option from its value.
50 function selchoose(sel
, value
) {
52 for (i
= 0; i
< o
.length
; ++i
) {
53 o
[i
].selected
= (o
[i
].value
== value
);
57 // Fill in default values when a drop-down drug is selected.
58 function drugselected(sel
) {
59 var f
= document
.forms
[0];
60 var i
= f
.drug_id
.selectedIndex
- 1;
64 selchoose(f
.form
, d
[1]);
65 f
.dosage
.value
= d
[2];
67 f
.rxnorm_drugcode
.value
= d
[11];
68 selchoose(f
.unit
, d
[4]);
69 selchoose(f
.route
, d
[5]);
70 selchoose(f
.interval
, d
[6]);
71 selchoose(f
.substitute
, d
[7]);
72 f
.quantity
.value
= d
[8];
73 f
.disp_quantity
.value
= d
[8];
74 selchoose(f
.refills
, d
[9]);
75 f
.per_refill
.value
= d
[10];
79 // Invoke the popup to dispense a drug.
81 var f
= document
.forms
[0];
82 dlgopen('interface/drugs/dispense_drug.php' +
83 {/literal
}'?drug_id={$prescription->get_drug_id()}' +{literal
}
84 '&prescription=' + f
.id
.value
+
85 '&quantity=' + f
.disp_quantity
.value
+
86 '&fee=' + f
.disp_fee
.value
,
90 function quantityChanged() {
91 var f
= document
.forms
[0];
92 f
.per_refill
.value
= f
.quantity
.value
;
93 if (f
.disp_quantity
) {
94 f
.disp_quantity
.value
= f
.quantity
.value
;
101 <body id=
"prescription_edit" class=
"body_top">
103 <form name=
"prescribe" id=
"prescribe" method=
"post" action=
"{$FORM_ACTION}" >
105 <tr><td class=
"title"><font><b>{xl t='Add'|escape:'html'}/{xl t='Edit'|escape:'html'}
</b></font> </td>
106 <td><a href=#
onclick=
"submitfun();" class=
"css_button_small"><span>{xl t='Save'|escape:'html'}
</span></a>
107 {if $DRUG_ARRAY_VALUES}
108
109 {if $prescription-
>get_refills()
>= $prescription-
>get_dispensation_count()}
110 <input type=
"submit" name=
"disp_button"class='css_button_small'
style=
"margin:0 5px 0 2px;" value=
"{xl t='Save and Dispense'|escape:'html'}" />
111 <input class=
"input-sm" type=
"text" name=
"disp_quantity" size=
"2" maxlength=
"10" value=
"{$DISP_QUANTITY|escape:'html'}" />
113 <input class=
"input-sm" type=
"text" name=
"disp_fee" size=
"5" maxlength=
"10" value=
"{$DISP_FEE|escape:'html'}" />
115 {xl t='prescription has reached its limit of'|escape:'html'} {$prescription-
>get_refills()|escape:'html'} {xl t='refills'|escape:'html'}.
118 <a class='css_button_small'
href=
"controller.php?prescription&list&id={$prescription->patient->id|escape:'html'}"><span>{xl t='Back'|escape:'html'}
</span></a>
122 {if $GLOBALS.enable_amc_prompting}
123 <div style='float:right;margin-right:
25px;border-style:solid;border-width:
1px;'
>
124 <div style='float:left;margin:
5px
5px
5px
5px;'
>
125 {amcCollect amc_id='e_prescribe_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
126 {if not $amcCollectReturn}
127 <input type=
"checkbox" id=
"escribe_flag" name=
"escribe_flag">
129 <input type=
"checkbox" id=
"escribe_flag" name=
"escribe_flag" checked
>
131 <span class=
"text">{xl t='E-Prescription?'|escape:'html'}
</span><br>
133 {amcCollect amc_id='e_prescribe_chk_formulary_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
134 {if not $amcCollectReturn}
135 <input type=
"checkbox" id=
"checked_formulary_flag" name=
"checked_formulary_flag">
137 <input type=
"checkbox" id=
"checked_formulary_flag" name=
"checked_formulary_flag" checked
>
139 <span class=
"text">{xl t='Checked Drug Formulary?'|escape:'html'}
</span><br>
141 {amcCollect amc_id='e_prescribe_cont_subst_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
142 {if not $amcCollectReturn}
143 <input type=
"checkbox" id=
"controlled_substance_flag" name=
"controlled_substance_flag">
145 <input type=
"checkbox" id=
"controlled_substance_flag" name=
"controlled_substance_flag" checked
>
147 <span class=
"text">{xl t='Controlled Substance?'|escape:'html'}
</span><br>
153 <table CELLSPACING=
"0" CELLPADDING=
"3" BORDER=
"0">
155 <td COLSPAN=
"1" class=
"text input-sm" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Currently Active'|escape:'html'}
</td>
156 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
157 <input class=
"input-sm"type=
"checkbox" name=
"active" value=
"1"{if $prescription-
>get_active()
> 0} checked{/if}
/>
161 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Starting Date'|escape:'html'}
</td>
162 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
163 {html_select_date
class=
"input-sm" start_year=
"-10" end_year=
"+5" time=$prescription-
>start_date
prefix=
"start_date_"}
164 <input type=
"hidden" name=
"start_date" value=
"{$prescription->start_date|escape:'html'}">
168 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Provider'|escape:'html'}
</td>
169 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
170 {html_options
class=
"input-sm" name=
"provider_id" options=$prescription-
>provider-
>utility_provider_array() selected=$prescription-
>provider-
>get_id()}
171 <input type=
"hidden" name=
"patient_id" value=
"{$prescription->patient->id|escape:'html'}" />
176 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Drug'|escape:'html'}
</td>
177 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
178 <input class=
"input-sm" type=
"input" size=
"35" name=
"drug" id=
"drug" value=
"{$prescription->drug|escape:'html'}"/>
179 <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="75" scrolling="no" frameborder="no"></iframe>'">
180 ({xl t='click here to search'|escape:'html'})
</a>
181 <div class=
"well well-sm" id=
"hiddendiv" style=
"display:none"> </div>
184 {if $DRUG_ARRAY_VALUES}
186 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" > {xl t='in-house'|escape:'html'}
</td>
187 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
188 <select class=
"input-sm" name=
"drug_id" onchange=
"drugselected(this)">
189 {html_options values=$DRUG_ARRAY_VALUES output=$DRUG_ARRAY_OUTPUT selected=$prescription-
>get_drug_id()}
191 <input type=
"hidden" name=
"rxnorm_drugcode" value=
"{$prescription->rxnorm_drugcode|escape:'html'}">
196 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Quantity'|escape:'html'}
</td>
197 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
198 <input class=
"input-sm" TYPE=
"TEXT" NAME=
"quantity" id=
"quantity" SIZE=
"10" MAXLENGTH=
"31"
199 VALUE=
"{$prescription->quantity|escape:'html'}"
200 onchange=
"quantityChanged()" />
203 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription-
>size}
204 <tr style='display:none;'
>
208 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Medicine Units'|escape:'html'}
</td>
209 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
210 <input class=
"input-sm" TYPE=
"TEXT" NAME=
"size" id=
"size" SIZE=
"11" MAXLENGTH=
"10" VALUE=
"{$prescription->size|escape:'html'}"/>
211 <select class=
"input-sm" name=
"unit" id=
"unit">{html_options options=$prescription-
>unit_array selected=$prescription-
>unit}
</select>
215 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Directions'|escape:'html'}
</td>
216 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
217 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription-
>form && !$prescription-
>route && !$prescription-
>interval}
218 <input class=
"input-sm" TYPE=
"text" NAME=
"dosage" id=
"dosage" SIZE=
"30" MAXLENGTH=
"100" VALUE=
"{$prescription->dosage|escape:'html'}" />
219 <input type=
"hidden" name=
"form" id=
"form" value=
"0" />
220 <input type=
"hidden" name=
"route" id=
"route" value=
"0" />
221 <input type=
"hidden" name=
"interval" id=
"interval" value=
"0" />
223 <input class=
"input-sm" TYPE=
"TEXT" NAME=
"dosage" id=
"dosage" SIZE=
"2" MAXLENGTH=
"10" VALUE=
"{$prescription->dosage|escape:'html'}"/> {xl t='in'|escape:'html'}
224 <select class=
"input-sm" name=
"form" id=
"form">{html_options options=$prescription-
>form_array selected=$prescription-
>form}
</select>
225 <select class=
"input-sm" name=
"route" id=
"route">{html_options options=$prescription-
>route_array selected=$prescription-
>route}
</select>
226 <select class=
"input-sm" name=
"interval" id=
"interval">{html_options options=$prescription-
>interval_array selected=$prescription-
>interval}
</select>
231 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Refills'|escape:'html'}
</td>
232 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
233 {html_options
name=
"refills" options=$prescription-
>refills_array selected=$prescription-
>refills}
234 {if $SIMPLIFIED_PRESCRIPTIONS}
235 <input TYPE=
"hidden" ID=
"per_refill" NAME=
"per_refill" VALUE=
"{$prescription->per_refill|escape:'html'}" />
237 # {xl t='of tablets'}:
238 <input class=
"input-sm" TYPE=
"TEXT" ID=
"per_refill" NAME=
"per_refill" SIZE=
"2" MAXLENGTH=
"10" VALUE=
"{$prescription->per_refill|escape:'html'}" />
243 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Notes'|escape:'html'}
</td>
244 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
245 <textarea class=
"form-control" name=
"note" cols=
"30" rows=
"1" wrap=
"virtual">{$prescription-
>note|escape:'html'}
</textarea>
249 {if $WEIGHT_LOSS_CLINIC}
250 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Substitution'|escape:'html'}
</td>
251 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
252 {html_options
name=
"substitute" options=$prescription-
>substitute_array selected=$prescription-
>substitute}
255 <td COLSPAN=
"1" class=
"text input-sm" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Add to Medication List'|escape:'html'}
</td>
256 <td COLSPAN=
"2" class=
"text input-sm" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
257 {html_radios
class=
"input-sm" name=
"medication" options=$prescription-
>medication_array selected=$prescription-
>medication}
259 {html_options
class=
"input-sm" name=
"substitute" options=$prescription-
>substitute_array selected=$prescription-
>substitute}
264 <input type=
"hidden" name=
"id" value=
"{$prescription->id|escape:'html'}" />
265 <input type=
"hidden" name=
"process" value=
"{$PROCESS|escape:'html'}" />
266 <script language='JavaScript'
>
272 <!-- for the fancy jQuery stuff -->
273 <script type=
"text/javascript">
275 function submitfun() {
276 top
.restoreSession();
277 if (CheckForErrors(this)) {
278 document
.forms
["prescribe"].submit();
285 function iframetopardiv(string
){
287 document
.getElementById('drug').value
=name
;
288 $("#hiddendiv").html( " " );
289 $('#hiddendiv').hide();
292 function cancelParlookup () {
293 $('#hiddendiv').hide();
294 $("#hiddendiv").html( " " );
297 $().ready(function() {
300 {if $GLOBALS
.weno_rx_enable
}
302 $('#drug').autocomplete({
303 source
: 'library/ajax/drug_autocomplete/search.php',
309 $('#drug').autocomplete({
310 source
: 'library/ajax/prescription_drugname_lookup.php',
318 $("#prescribe").submit(function() { return CheckForErrors(this) });
321 // check the form for required fields before submitting
322 var CheckForErrors = function(eObj
) {
324 if (CheckRequired('drug') == false) { return false; }
325 if (CheckRequired('quantity') == false) { return false; }
326 //if (CheckRequired('unit') == false) { return false; }
327 //if (CheckRequired('size') == false) { return false; }
328 if (CheckRequired('dosage') == false) { return false; }
329 //if (CheckRequired('form') == false) { return false; }
330 //if (CheckRequired('route') == false) { return false; }
331 //if (CheckRequired('interval') == false) { return false; }
333 return top
.restoreSession();
336 function CheckRequired(objID
) {
339 if ($('#'+objID
).is('input')) {
340 if ($('#'+objID
).val() == "") {
341 alert("{/literal}{xl t='Missing a required field and will be highlighted'}{literal}");
342 $('#'+objID
).css("backgroundColor", "pink");
348 if ($('#'+objID
).is('select')) {
349 if ($('#'+objID
).val() == "0") {
350 alert("{/literal}{xl t='Missing a required field'}{literal}");
351 $('#'+objID
).css("backgroundColor", "pink");