25c661fd69b24ea5b6a701fc944d4ba414206013
[openemr.git] / interface / forms / vitals / templates / vitals / general_new.html
blob25c661fd69b24ea5b6a701fc944d4ba414206013
1 <html>
2 <head>
3 {php}html_header_show();{/php}
5 <style type="text/css">@import url({$FORM_ACTION}/library/dynarch_calendar.css);</style>
6 <script type="text/javascript" src="{$FORM_ACTION}/library/dialog.js"></script>
7 <script type="text/javascript" src="{$FORM_ACTION}/library/textformat.js"></script>
8 <script type="text/javascript" src="{$FORM_ACTION}/library/dynarch_calendar.js"></script>
9 {php} include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); {/php}
10 <script type="text/javascript" src="{$FORM_ACTION}/library/dynarch_calendar_setup.js"></script>
12 <script type="text/javascript">
13 var mypcc = '{php} echo $GLOBALS['phone_country_code'] {/php}';
14 {literal}
15 // Only load jquery if not already closing. This page serves two purposes now,
16 // for entring of vitals and for graphing/trending previous vitals by being embedded
17 // in the interface/patient_file/encounter/trend_form.php page.
18 if (typeof jQuery == 'undefined') {
19 document.write("<script type='text/javascript' src='{/literal}{php}echo $GLOBALS['webroot'];{/php}{literal}/library/js/jquery.js'><\/script>")
21 </script>
22 <style type="text/css" title="mystyles" media="all">
23 .title {
24 font-size: 120%;
25 font-weight: bold;
27 .currentvalues {
28 border-right: 1px solid black;
29 padding-right:5px;
30 text-align: left;
32 .valuesunfocus {
33 border-right: 1px solid black;
34 padding-right:5px;
35 background-color: #ccc;
36 text-align: left;
38 .unfocus {
39 background-color: #ccc;
41 .historicalvalues {
42 background-color: #ccc;
43 border-bottom: 1px solid #ddd;
44 border-right: 1px solid #ddd;
45 text-align: right;
47 table {
48 border-collapse: collapse;
50 td,th {
51 padding-right: 10px;
52 padding-left: 10px;
54 .hide {
55 display:none;
57 .readonly {
58 display:none;
60 </style>
61 {/literal}
63 </head>
64 <body bgcolor="{$STYLE.BGCOLOR2}">
65 <p><table><tr><td><span class="title">{xl t="Vitals"}</span></td><td>&nbsp;&nbsp;&nbsp;<a href="../summary/demographics.php" class="readonly css_button_small" onclick="top.restoreSession()"> <span>{xl t="View Patient"}</span></a></td></tr></table></p>
66 <form name="vitals" method="post" action="{$FORM_ACTION}/interface/forms/vitals/save.php" onSubmit="return top.restoreSession()">
67 <div id="chart"></div>
68 <table>
69 <tr><th align="left">{xl t="Name"}</th><th align="left">{xl t="Unit"}</th>
70 <th class='currentvalues' title='{xl t='Date and time of this observation'}'>
71 <input type='text' size='14' name='date' id='date'
72 value='{$vitals->get_date()|date_format:"%Y-%m-%d %H:%M"}'
73 onkeyup='datekeyup(this,mypcc,true)' onblur='dateblur(this,mypcc,true)' />
74 <img src='{$FORM_ACTION}/interface/pic/show_calendar.gif' id='img_date' align='absbottom'
75 width='24' height='22' border='0' alt='[?]' style='cursor:pointer' />
76 </th>
77 {foreach item=result from=$results}
78 <th class='historicalvalues'>{$result.date|date_format:"%Y-%m-%d %H:%M"}</th>
79 {/foreach}</tr>
81 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
82 {if $units_of_measurement == 2}<td class="unfocus graph" id="weight">{else}<td class="graph" id="weight">{/if}{xl t="Weight"}</td>
83 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="lbs"}</td>
84 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
85 <input type="text" size='5' name='weight' id='weight_input' value="{if $vitals->get_weight() != 0}{$vitals->get_weight()}{/if}" onChange="convLbtoKg('weight_input');"/>
86 </td>
87 {foreach item=result from=$results}
88 <td class='historicalvalues'>{if $result.weight != 0}{$result.weight}{/if}</td>
89 {/foreach}</tr>
91 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
92 {if $units_of_measurement == 1}<td class="unfocus graph" id="weight_metric">{else}<td class="graph" id="weight_metric">{/if}{xl t="Weight"}</td>
93 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="kg"}</td>
94 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
95 <input type="text" size='5' id='weight_input_metric' value="{if $vitals->get_weight() != 0}{math equation="number * constant" number=$vitals->get_weight() constant=0.45359237 format="%.2f"}{/if}" onChange="convKgtoLb('weight_input');"/>
96 </td>
97 {foreach item=result from=$results}
98 <td class='historicalvalues'>{if $result.weight != 0}{math equation="number * constant" number=$result.weight constant=0.45359237 format="%.2f"}{/if}</td>
99 {/foreach}</tr>
101 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
102 {if $units_of_measurement == 2}<td class="unfocus graph" id="height">{else}<td class="graph" id="height">{/if}{xl t="Height"}</td>
103 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
104 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
105 <input type="text" size='5' name='height' id='height_input' value="{if $vitals->get_height() != 0}{$vitals->get_height()}{/if}" onChange="convIntoCm('height_input');"/>
106 </td>
107 {foreach item=result from=$results}
108 <td class='historicalvalues'>{if $result.height != 0}{$result.height}{/if}</td>
109 {/foreach}</tr>
111 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
112 {if $units_of_measurement == 1}<td class="unfocus graph" id="height_metric">{else}<td class="graph" id="height_metric">{/if}{xl t="Height"}</td>
113 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
114 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
115 <input type="text" size='5' id='height_input_metric' value="{if $vitals->get_height() != 0}{math equation="number * constant" number=$vitals->get_height() constant=2.54 format="%.2f"}{/if}" onChange="convCmtoIn('height_input');"/>
116 </td>
117 {foreach item=result from=$results}
118 <td class='historicalvalues'>{if $result.height != 0}{math equation="number * constant" number=$result.height constant=2.54 format="%.2f"}{/if}</td>
119 {/foreach}</tr>
121 <tr><td class="graph" id="bps">{xl t="BP Systolic"}</td><td>{xl t="mmHg"}</td>
122 <td class='currentvalues'><input type="text" size='5'
123 name='bps' id='bps_input' value="{$vitals->get_bps()}"/></td>
124 {foreach item=result from=$results}
125 <td class='historicalvalues'>{$result.bps}</td>
126 {/foreach}</tr>
127 <tr><td class="graph" id="bpd">{xl t="BP Diastolic"}</td><td>{xl t="mmHg"}</td>
128 <td class='currentvalues'><input type="text" size='5'
129 name='bpd' id='bpd_input' value="{$vitals->get_bpd()}"/></td>
130 {foreach item=result from=$results}
131 <td class='historicalvalues'>{$result.bpd}</td>
132 {/foreach}</tr>
133 <tr><td class="graph" id="pulse">{xl t="Pulse"}</td><td>{xl t="per min"}</td>
134 <td class='currentvalues'><input type="text" size='5'
135 name='pulse' id='pulse_input' value="{if $vitals->get_pulse() != 0}{$vitals->get_pulse()|string_format:"%.0f"}{/if}"/></td>
136 {foreach item=result from=$results}
137 <td class='historicalvalues'>{if $result.pulse != 0}{$result.pulse|string_format:"%.0f"}{/if}</td>
138 {/foreach}</tr>
139 <tr><td class="graph" id="respiration">{xl t="Respiration"}</td><td>{xl t="per min"}</td>
140 <td class='currentvalues'><input type="text" size='5'
141 name='respiration' id='respiration_input' value="{if $vitals->get_respiration() != 0}{$vitals->get_respiration()|string_format:"%.0f"}{/if}"/></td>
142 {foreach item=result from=$results}
143 <td class='historicalvalues'>{if $result.respiration != 0}{$result.respiration|string_format:"%.0f"}{/if}</td>
144 {/foreach}</tr>
146 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
147 {if $units_of_measurement == 2}<td class="unfocus graph" id="temperature">{else}<td class="graph" id="temperature">{/if}{xl t="Temperature"}</td>
148 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="F"}</td>
149 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
150 <input type="text" size='5' name='temperature' id='temperature_input' value="{if $vitals->get_temperature() != 0}{$vitals->get_temperature()}{/if}" onChange="convFtoC('temperature_input');"/>
151 </td>
152 {foreach item=result from=$results}
153 <td class='historicalvalues'>{if $result.temperature != 0}{$result.temperature}{/if}</td>
154 {/foreach}</tr>
156 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
157 {if $units_of_measurement == 1}<td class="unfocus graph" id="temperature_metric">{else}<td class="graph" id="temperature_metric">{/if}{xl t="Temperature"}</td>
158 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="C"}</td>
159 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
160 <input type="text" size='5' id='temperature_input_metric' value="{if $vitals->get_temperature() != 0}{math equation="(number - constant2 ) * constant" number=$vitals->get_temperature() constant=0.5556 constant2=32 format="%.2f"}{/if}" onChange="convCtoF('temperature_input');"/>
161 </td>
162 {foreach item=result from=$results}
163 <td class='historicalvalues'>{if $result.temperature != 0}{math equation="(number - constant2 ) * constant" number=$result.temperature constant=0.5556 constant2=32 format="%.2f"}{/if}</td>
164 {/foreach}</tr>
166 <tr><td>{xl t="Temp Location"}<td></td></td>
167 <td class='currentvalues'><select name="temp_method" id='temp_method'/><option value=""> </option>
168 <option value="Oral" {if $vitals->get_temp_method() == "Oral" || $vitals->get_temp_method() == 2 } selected{/if}>{xl t="Oral"}
169 <option value="Tympanic Membrane" {if $vitals->get_temp_method() == "Tympanic Membrane" || $vitals->get_temp_method() == 1 } selected{/if}>{xl t="Tympanic Membrane"}
170 <option value="Rectal" {if $vitals->get_temp_method() == "Rectal" || $vitals->get_temp_method() == 3 } selected{/if}>{xl t="Rectal"}
171 <option value="Axillary" {if $vitals->get_temp_method() == "Axillary" || $vitals->get_temp_method() == 4 } selected{/if}>{xl t="Axillary"}
172 <option value="Temporal Artery" {if $vitals->get_temp_method() == "Temporal Artery" } selected{/if}>{xl t="Temporal Artery"}
173 </select></td>
174 {foreach item=result from=$results}
175 <td class='historicalvalues'>{if $result.temp_method}{xl t=$result.temp_method}{/if}</td>
176 {/foreach}</tr>
178 <tr><td class="graph" id="oxygen_saturation">{xl t="Oxygen Saturation"}</td><td>{xl t="%"}</td>
179 <td class='currentvalues'><input type="text" size='5'
180 name='oxygen_saturation' id='oxygen_saturation_input' value="{if $vitals->get_oxygen_saturation() != 0}{$vitals->get_oxygen_saturation()|string_format:"%.0f"}{/if}"/></td>
181 {foreach item=result from=$results}
182 <td class='historicalvalues'>{if $result.oxygen_saturation != 0}{$result.oxygen_saturation|string_format:"%.0f"}{/if}</td>
183 {/foreach}</tr>
185 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
186 {if $units_of_measurement == 2}<td class="unfocus graph" id="head_circ">{else}<td class="graph" id="head_circ">{/if}{xl t="Head Circumference"}</td>
187 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
188 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
189 <input type="text" size='5' name='head_circ' id='head_circ_input' value="{if $vitals->get_head_circ() != 0}{$vitals->get_head_circ()}{/if}" onChange="convIntoCm('head_circ_input');"/>
190 </td>
191 {foreach item=result from=$results}
192 <td class='historicalvalues'>{if $result.head_circ != 0}{$result.head_circ}{/if}</td>
193 {/foreach}</tr>
195 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
196 {if $units_of_measurement == 1}<td class="unfocus graph" id="head_circ_metric">{else}<td class="graph" id="head_circ_metric">{/if}{xl t="Head Circumference"}</td>
197 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
198 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
199 <input type="text" size='5' id='head_circ_input_metric' value="{if $vitals->get_head_circ() != 0}{math equation="number * constant" number=$vitals->get_head_circ() constant=2.54 format="%.2f"}{/if}" onChange="convCmtoIn('head_circ_input');"/>
200 </td>
201 {foreach item=result from=$results}
202 <td class='historicalvalues'>{if $result.head_circ != 0}{math equation="number * constant" number=$result.head_circ constant=2.54 format="%.2f"}{/if}</td>
203 {/foreach}</tr>
205 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
206 {if $units_of_measurement == 2}<td class="unfocus graph" id="waist_circ">{else}<td class="graph" id="waist_circ">{/if}{xl t="Waist Circumference"}</td>
207 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
208 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
209 <input type="text" size='5' name='waist_circ' id='waist_circ_input' value="{if $vitals->get_waist_circ() != 0}{$vitals->get_waist_circ()}{/if}" onChange="convIntoCm('waist_circ_input');"/>
210 </td>
211 {foreach item=result from=$results}
212 <td class='historicalvalues'>{if $result.waist_circ != 0}{$result.waist_circ}{/if}</td>
213 {/foreach}</tr>
215 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
216 {if $units_of_measurement == 1}<td class="unfocus graph" id="waist_circ_metric">{else}<td class="graph" id="waist_circ_metric">{/if}{xl t="Waist Circumference"}</td>
217 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
218 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
219 <input type="text" size='5' id='waist_circ_input_metric' value="{if $vitals->get_waist_circ() != 0}{math equation="number * constant" number=$vitals->get_waist_circ() constant=2.54 format="%.2f"}{/if}" onChange="convCmtoIn('waist_circ_input');"/>
220 </td>
221 {foreach item=result from=$results}
222 <td class='historicalvalues'>{if $result.waist_circ != 0}{math equation="number * constant" number=$result.waist_circ constant=2.54 format="%.2f"}{/if}</td>
223 {/foreach}</tr>
225 <tr><td class="graph" id="BMI">{xl t="BMI"}</td><td>{xl t="kg/m^2"}</td>
226 <td class='currentvalues'><input type="text" size='5'
227 name='BMI' id='BMI_input' value="{if $vitals->get_BMI() != 0}{$vitals->get_BMI()|substr:0:5}{/if}"/></td>
228 {foreach item=result from=$results}
229 <td class='historicalvalues'>{if $result.BMI != 0}{$result.BMI|substr:0:5}{/if}</td>
230 {/foreach}</tr>
232 <tr><td>{xl t="BMI Status"}</td><td>{xl t="Type"}</td>
233 <td class='currentvalues'><input type="text" size='15'
234 name="BMI_status" id="BMI_status' value="{$vitals->get_BMI_status()}"/></td>
235 {foreach item=result from=$results}
236 <td class='historicalvalues'>{if $result.BMI_status}{xl t=$result.BMI_status}{/if}</td>
237 {/foreach}
238 </tr>
240 <tr><td>{xl t="Other Notes"}<td></td></td>
241 <td class='currentvalues'><input type="text" size='20'
242 name="note" id='note' value="{$vitals->get_note()}" /></td>
243 {foreach item=result from=$results}
244 <td class='historicalvalues'>{$result.note}</td>
245 {/foreach}</tr>
247 <tr>
248 <td colspan='3' style='text-align:center'>
249 {if $patient_age <= 20 || (preg_match('/month/', $patient_age))}
250 <!-- only show growth-chart button for patients < 20 years old -->
251 <!-- <input type="button" id="growthchart" value="{xl t="Growth-Chart"}" style='margin-left: 20px;'> -->
252 <input type="button" id="pdfchart" value="{xl t="Growth-Chart"} ({xl t="PDF"})" style='margin-left: 20px;'>
253 <input type="button" id="htmlchart" value="{xl t="Growth-Chart"} ({xl t="HTML"})" style='margin-left: 20px;'>
254 {/if}
255 </td>
256 </tr>
257 <tr><td colspan='3' style='text-align:center'>&nbsp;</td></tr>
258 <tr>
259 <td colspan='3' style='text-align:center'>
260 <input type="submit" class="editonly" name="Submit" value="{xl t="Save Form"}">
261 <input type="button" class="editonly" id="cancel" value="{xl t="Don't Save"}">
262 </td>
263 </tr>
264 </table>
265 <br><br>
266 <input type="hidden" name="id" id='id' value="{$vitals->get_id()}" />
267 <input type="hidden" name="activity" id='activity' value="{$vitals->get_activity()}">
268 <input type="hidden" name="pid" id='pid' value="{$vitals->get_pid()}">
269 <input type="hidden" name="process" id='process' value="true">
270 </form>
271 </body>
273 <script language="javascript">
274 var formdate = '{$vitals->get_date()|date_format:"%Y%m%d"}';
275 // vitals array elements are in the format:
276 // date-height-weight-head_circumference
277 var vitals = new Array();
278 // get values from the current form elements
279 vitals[0] = formdate+'-{$vitals->get_height()}-{$vitals->get_weight()}-{$vitals->get_head_circ()}';
280 // historic values
281 {foreach item=result from=$results}
282 vitals[vitals.length] = '{$result.date|date_format:"%Y%m%d"}-{$result.height}-{$result.weight}-{$result.head_circ}';
283 {/foreach}
284 var webroot = '{$FORM_ACTION}';
285 var pid = '{$vitals->get_pid()}';
286 var cancellink = '{$DONT_SAVE_LINK}';
287 {literal}
289 $(document).ready(function(){
290 $("#growthchart").click(function() { ShowGrowthchart(); });
291 $("#pdfchart").click(function() { ShowGrowthchart(1); });
292 $("#htmlchart").click(function() { ShowGrowthchart(2); });
293 $("#cancel").click(function() { location.href=cancellink; });
296 function ShowGrowthchart(doPDF) {
297 // get values from the current form elements
298 {/literal}
299 vitals[0] = formdate+'-'+$("#height_input").val()+'-'+$("#weight_input").val()+'-'+$("#head_circ_input").val();
300 {literal}
301 // build the data string
302 var datastring = "";
303 for(var i=0; i<vitals.length; i++) {
304 datastring += vitals[i]+"~";
306 newURL = webroot+'/interface/forms/vitals/growthchart/chart.php?pid='+pid+'&data='+datastring;
307 if (doPDF == 1) newURL += "&pdf=1";
308 if (doPDF == 2) newURL += "&html=1";
309 // do the new window stuff
310 top.restoreSession();
311 window.open(newURL, '_blank', "menubar=1,toolbar=1,scrollbars=1,resizable=1,width=600,height=450");
314 function convLbtoKg(name) {
315 var lb = $("#"+name).val();
317 if (lb == "0") {
318 $("#"+name+"_metric").val("0");
320 else if (lb == parseFloat(lb)) {
321 kg = lb*0.45359237;
322 kg = kg.toFixed(2);
323 $("#"+name+"_metric").val(kg);
325 else {
326 $("#"+name+"_metric").val("");
329 if (name == "weight") {
330 calculateBMI();
334 function convKgtoLb(name) {
335 var kg = $("#"+name+"_metric").val();
337 if (kg == "0") {
338 $("#"+name).val("0");
340 else if (kg == parseFloat(kg)) {
341 lb = kg/0.45359237;
342 lb = lb.toFixed(2);
343 $("#"+name).val(lb);
345 else {
346 $("#"+name).val("");
349 if (name == "weight_input") {
350 calculateBMI();
354 function convIntoCm(name) {
355 var inch = $("#"+name).val();
357 if (inch == "0") {
358 $("#"+name+"_metric").val("0");
360 else if (inch == parseFloat(inch)) {
361 cm = inch*2.54;
362 cm = cm.toFixed(2);
363 $("#"+name+"_metric").val(cm);
365 else {
366 $("#"+name+"_metric").val("");
369 if (name == "height_input") {
370 calculateBMI();
374 function convCmtoIn(name) {
375 var cm = $("#"+name+"_metric").val();
377 if (cm == "0") {
378 $("#"+name).val("0");
380 else if (cm == parseFloat(cm)) {
381 inch = cm/2.54;
382 inch = inch.toFixed(2);
383 $("#"+name).val(inch);
385 else {
386 $("#"+name).val("");
389 if (name == "height_input") {
390 calculateBMI();
394 function convFtoC(name) {
395 var Fdeg = $("#"+name).val();
396 if (Fdeg == "0") {
397 $("#"+name+"_metric").val("0");
399 else if (Fdeg == parseFloat(Fdeg)) {
400 Cdeg = (Fdeg-32)*0.5556;
401 Cdeg = Cdeg.toFixed(2);
402 $("#"+name+"_metric").val(Cdeg);
404 else {
405 $("#"+name+"_metric").val("");
409 function convCtoF(name) {
410 var Cdeg = $("#"+name+"_metric").val();
411 if (Cdeg == "0") {
412 $("#"+name).val("0");
414 else if (Cdeg == parseFloat(Cdeg)) {
415 Fdeg = (Cdeg/0.5556)+32;
416 Fdeg = Fdeg.toFixed(2);
417 $("#"+name).val(Fdeg);
419 else {
420 $("#"+name).val("");
424 function calculateBMI() {
425 var bmi = 0;
426 var height = $("#height_input").val();
427 var weight = $("#weight_input").val();
428 if(height == 0 || weight == 0) {
429 $("#BMI").val("");
431 else if((height == parseFloat(height)) && (weight == parseFloat(weight))) {
432 bmi = weight/height/height*703;
433 bmi = bmi.toFixed(1);
434 $("#BMI_input").val(bmi);
436 else {
437 $("#BMI_input").val("");
441 Calendar.setup({inputField:"date", ifFormat:"%Y-%m-%d %H:%M", button:"img_date", showsTime:true});
443 </script>
444 {/literal}
446 </html>