Add new modules loaded event (#7463)
[openemr.git] / interface / forms / eye_mag / php / eye_mag_functions.php
blobf365746255f33a9fc5c247a13691be9a94642383
1 <?php
3 /**
4 * forms/eye_mag/php/eye_mag_functions.php
6 * Functions which extend clinical forms
8 * @package OpenEMR
9 * @link https://www.open-emr.org
10 * @author Ray Magauran <rmagauran@gmail.com>
11 * @copyright Copyright (c) 2016- Raymond Magauran <rmagauran@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 $form_folder = "eye_mag";
16 require_once(dirname(__FILE__) . "/../../../../custom/code_types.inc.php");
17 require_once(dirname(__FILE__) . "/../../../../library/options.inc.php");
18 global $PMSFH;
20 use OpenEMR\Common\Acl\AclMain;
21 use OpenEMR\Services\FacilityService;
23 $facilityService = new FacilityService();
25 /**
26 * This function returns HTML old record selector widget when needed (4 input values)
28 * @param string $zone options ALL,EXT,ANTSEG,RETINA,NEURO, DRAW_PRIORS_$zone
29 * @param string $visit_date Future functionality to limit result set. UTC DATE Formatted
30 * @param string $pid value = patient id
31 * @param string $type options text(default) image
32 * @return string returns the HTML old record/image selector widget for the desired zone and type
34 function priors_select($zone, $orig_id, $id_to_show, $pid, $type = 'text')
36 global $priors;
37 global $form_id;
38 global $earlier;
40 if ($type == "canvas") {
41 $zone = $zone . "_canvas";
44 $tables = array('form_eye_hpi','form_eye_ros','form_eye_vitals',
45 'form_eye_acuity','form_eye_refraction','form_eye_biometrics',
46 'form_eye_external', 'form_eye_antseg','form_eye_postseg',
47 'form_eye_neuro','form_eye_locking');
48 $output_return = "<span id='" . attr($zone) . "_prefix_oldies' name='" . attr($zone) . "_prefix_oldies' class='oldies_prefix'>";
49 $selected = '';
50 $current = '';
51 if (!$priors) { //we have to build it
52 $query = "select form_encounter.date as encounter_date,form_eye_base.id as form_id, form_eye_base.*
53 from form_eye_base,forms,form_encounter
54 where
55 form_encounter.encounter = forms.encounter and
56 form_eye_base.id=forms.form_id and
57 forms.deleted != '1' and
58 forms.pid =form_eye_base.pid and
59 forms.formdir='eye_mag' and form_eye_base.pid=? ORDER BY encounter_date DESC LIMIT 20";
60 // Unlike the obj data(PMSFH,Clinical,IMPPLAN etc), this data is static.
61 // It only needs to be passed once to the client side.
62 $result = sqlStatement($query, array($pid));
63 $counter = sqlNumRows($result);
64 $priors = array();
65 if ($counter < 2) {
66 return;
69 $i = "0";
70 while ($prior = sqlFetchArray($result)) {
71 $dated = new DateTime($prior['encounter_date']);
72 $dated = $dated->format('Y-m-d');
73 $oeexam_date = oeFormatShortDate($dated);
74 foreach ($tables as $table) {
75 $sql = "SELECT * from " . $table . " WHERE id=?";
76 $sub_data = sqlStatement($sql, array($prior['id']));
77 $data = sqlFetchArray($sub_data);
78 if ($data) {
79 $prior = array_merge($prior, $data);
82 $priors[$i] = $prior;
83 $priors[$i]['encounter_date'] = $oeexam_date;
85 if (($i > 0) && ($prior['PLAN'])) {
86 //this plan is a todo list for next visit, which is $i-1 actually
87 $j = $i - 1;
88 $priors[$j]['TODO'] = array();
89 $priors[$j]['TODO'] = $prior['PLAN'];
92 $selected = '';
93 $priors[$i]['visit_date'] = $oeexam_date;
94 $priors[$i]['exam_date'] = $oeexam_date;
95 if ($id_to_show == $prior['form_id']) {
96 $selected = 'selected="selected"';
97 $current = $i;
100 if (!empty($output)) {
101 $output .= "<option value='" . attr($prior['id']) . "' " . attr($selected) . ">" . text($oeexam_date) . "</option>";
102 } else {
103 $output = "<option value='" . attr($prior['id']) . "' " . attr($selected) . ">" . text($oeexam_date) . "</option>";
105 $selected = '';
106 $i++;
108 } else {
109 //priors[] exists, containing the visits data AND the priors[earlier] field at the end, so iterate through all but the last one.
110 //$visit_count = count($priors) - 1;
111 for ($i = 0; $i < count($priors); $i++) {
112 if ($form_id == $priors[$i]['id']) {
113 $selected = 'selected=selected';
114 $current = $i;
115 } else {
116 $selected = '';
119 if (!empty($output)) {
120 $output .= "<option value='" . attr($priors[$i]['id']) . "' " . attr($selected) . ">" . text($priors[$i]['exam_date']) . "</option>";
121 } else {
122 $output = "<option value='" . attr($priors[$i]['id']) . "' " . attr($selected) . ">" . text($priors[$i]['exam_date']) . "</option>";
127 $i--;
128 if ($current < $i) {
129 $earlier = $current + 1;
130 } else {
131 $earlier = $current;
134 if ($current > '0') {
135 $later = ($current - 1);
136 } else {
137 $later = "0";
141 //current visit =[0]
142 if (!$priors[$current]['PLAN']) {
143 $priors[$current]['PLAN'] = array();
144 $query = "SELECT * from form_eye_mag_orders where form_id=?";
145 $orders = sqlStatement($query, array($priors[$earlier]['id']));
146 while ($row = sqlFetchArray($orders)) {
147 $priors[$current]["PLAN"][] = $row;
148 $priors[$later]["TODO"][] = $row;
151 if ($id_to_show != $orig_id) {
152 $output_return .= '
153 <span title="' . xla($zone) . ': ' . xla("Copy these values into current visit.") . '
154 ' . xla("Updated fields will be purple.") . '"
156 id="COPY_' . attr($zone) . '"
157 name="COPY_' . attr($zone) . '"
158 value="' . attr($id_to_show) . '" onclick=\'$("#COPY_SECTION").val("' . attr($zone) . '-' . attr($id_to_show) . '").trigger("change");\'>
159 <i class="fa fa-paste fa-lg"></i>
160 </span>
161 &nbsp;&nbsp;';
164 $output_return .= '
165 <span onclick=\'$("#PRIOR_' . attr($zone) . '").val("' . attr($priors[$i]['id']) . '").trigger("change");\'
166 id="PRIORS_' . attr($zone) . '_earliest"
167 name="PRIORS_' . attr($zone) . '_earliest"
168 class="fa fa-fast-backward fa-sm PRIORS"
169 title="' . attr($zone) . ': ' . attr($priors[$i]['encounter_date']) . '">
170 </span>
171 &nbsp;
172 <span onclick=\'$("#PRIOR_' . attr($zone) . '").val("' . attr($priors[$earlier]['id']) . '").trigger("change");\'
173 id="PRIORS_' . attr($zone) . '_minus_one"
174 name="PRIORS_' . attr($zone) . '_minus_one"
175 class="fa fa-step-backward fa-sm PRIORS"
176 title="' . attr($zone) . ': ' . attr($priors[$earlier]['encounter_date']) . '">
177 </span>&nbsp;&nbsp;
178 <select name="PRIOR_' . attr($zone) . '"
179 id="PRIOR_' . attr($zone) . '"
180 style="padding:0 0;font-size:1.2em;"
181 class="PRIORS">
182 ' . ($output ?? '') . '
183 </select>
184 &nbsp;
185 <span onclick=\'$("#PRIOR_' . attr($zone) . '").val("' . attr($priors[$later]['id']) . '").trigger("change");\'
186 id="PRIORS_' . attr($zone) . '_plus_one"
187 name="PRIORS_' . attr($zone) . '_plus_one"
188 class="fa fa-step-forward PRIORS"
189 title="' . attr($zone) . ': ' . attr($priors[$later]['encounter_date']) . '">
190 </span>&nbsp;&nbsp;
191 <span onclick=\'$("#PRIOR_' . attr($zone) . '").val("' . attr($priors[0]['id']) . '").trigger("change");\'
192 id="PRIORS_' . attr($zone) . '_latest"
193 name="PRIORS_' . attr($zone) . '_latest"
194 class="fa fa-fast-forward PRIORS"
195 title="' . attr($zone) . ': ' . attr($priors[0]['encounter_date']) . '"> &nbsp;
196 </span>
197 </span>';
198 return $output_return;
202 * This function returns ZONE specific HTML for a PRIOR record (3 input values)
204 * This is where the magic of displaying the old records happens.
205 * Each section is a duplicate of the base html except the values are from a prior visit,
206 * the background and background-color are different, and the input fields are disabled.
208 * @param string $zone options ALL,EXT,ANTSEG,RETINA,NEURO. DRAW_PRIORS_$zone and IMPPLAN to do.
209 * @param string $visit_date. Future functionality to limit result set. UTC DATE Formatted
210 * @param string $pid value = patient id
211 * @return outputs the ZONE specific HTML for a prior record + "priors_select" widget for the desired zone
213 function display_PRIOR_section($zone, $orig_id, $id_to_show, $pid, $report = '0')
215 global $form_folder;
217 $query = "SELECT * FROM form_eye_mag_prefs
218 where PEZONE='PREFS' AND id=?
219 ORDER BY ZONE_ORDER,ordering";
221 $result = sqlStatement($query, array($_SESSION['authUserID']));
222 while ($prefs = sqlFetchArray($result)) {
223 ${$prefs['LOCATION']} = $prefs['GOVALUE'];
226 $query = "SELECT *
227 from form_eye_base,
228 form_eye_hpi,form_eye_ros,form_eye_vitals,
229 form_eye_acuity,form_eye_refraction,form_eye_biometrics,
230 form_eye_external, form_eye_antseg,form_eye_postseg,
231 form_eye_neuro,form_eye_locking
232 where
233 form_eye_base.id=form_eye_hpi.id and
234 form_eye_base.id=form_eye_ros.id and
235 form_eye_base.id=form_eye_vitals.id and
236 form_eye_base.id=form_eye_acuity.id and
237 form_eye_base.id=form_eye_refraction.id and
238 form_eye_base.id=form_eye_biometrics.id and
239 form_eye_base.id=form_eye_external.id and
240 form_eye_base.id=form_eye_antseg.id and
241 form_eye_base.id=form_eye_postseg.id and
242 form_eye_base.id=form_eye_neuro.id and
243 form_eye_base.id=form_eye_locking.id and
244 form_eye_base.pid =? and
245 form_eye_base.id=?";
246 $result = sqlQuery($query, array($pid,$id_to_show));
247 @extract($result);
248 ob_start();
249 if ($zone == "REFRACTIONS") {
250 //TODO maybe just sql _refraction+acuity
251 display_refractive_data($result);
252 } elseif ($zone == "EXT") {
253 if ($report == '0') {
254 $output = priors_select($zone, $orig_id, $id_to_show, $pid);
257 <input disabled type="hidden" id="PRIORS_<?php echo attr($zone); ?>_prefix" name="PRIORS_<?php echo attr($zone); ?>_prefix" value="">
258 <span class="closeButton float-right fas fa-times" id="Close_PRIORS_<?php echo attr($zone); ?>" name="Close_PRIORS_<?php echo attr($zone); ?>"></span>
259 <div name="prior_selector">
260 <?php
261 echo $output;//prior visit selector - already sanitized
263 </div>
264 <span style="font-weight:bold;">
265 <?php
266 if ($report == '0') {
267 echo xlt('Prior Exam');
268 } else {
269 echo xlt($zone);
270 } ?>: </span>
271 <br />
272 <div id="PRIORS_EXT_left_1">
273 <table>
274 <?php
275 list($imaging,$episode) = display($pid, $encounter ?? '', "EXT");
276 echo $episode;
278 </table>
279 <table>
280 <tr>
281 <td></td><td><?php echo xlt('R'); ?></td><td><?php echo xlt('L{{left}}'); ?></td>
282 </tr>
283 <tr>
284 <td class="right"><?php echo xlt('Lev Fn{{levator function}}'); ?></td>
285 <td><input disabled type="text" size="1" name="PRIOR_RLF" id="PRIOR_RLF" value="<?php echo attr($RLF); ?>"></td>
286 <td><input disabled type="text" size="1" name="PRIOR_LLF" id="PRIOR_LLF" value="<?php echo attr($LLF); ?>"></td>
287 </tr>
288 <tr>
289 <td class="right"><?php echo xlt('MRD{{marginal reflex distance}}'); ?></td>
290 <td><input disabled type="text" size="1" name="PRIOR_RMRD" id="PRIOR_RMRD" value="<?php echo attr($RMRD); ?>"></td>
291 <td><input disabled type="text" size="1" name="PRIOR_LMRD" id="PRIOR_LMRD" value="<?php echo attr($LMRD); ?>"></td>
292 </tr>
293 <tr>
294 <td class="right"><?php echo xlt('Vert Fissure{{vertical fissure height}}'); ?></td>
295 <td><input disabled type="text" size="1" name="PRIOR_RVFISSURE" id="PRIOR_RVFISSURE" value="<?php echo attr($RVFISSURE); ?>"></td>
296 <td><input disabled type="text" size="1" name="PRIOR_LVFISSURE" id="PRIOR_LVFISSURE" value="<?php echo attr($LVFISSURE); ?>"></td>
297 </tr>
298 <tr>
299 <td class="right"><?php echo xlt('Carotid Bruit'); ?></td>
300 <td><input disabled type="text" name="PRIOR_RCAROTID" id="PRIOR_RCAROTID" value="<?php echo attr($RCAROTID); ?>"></td>
301 <td><input disabled type="text" name="PRIOR_LCAROTID" id="PRIOR_LCAROTID" value="<?php echo attr($LCAROTID); ?>"></td>
302 </tr>
303 <tr>
304 <td class="right"><?php echo xlt('Temporal Art.{{Temporal Artery}}'); ?></td>
305 <td><input disabled type="text" size="1" name="PRIOR_RTEMPART" id="PRIOR_RTEMPART" value="<?php echo attr($RTEMPART); ?>"></td>
306 <td><input disabled type="text" size="1" name="PRIOR_LTEMPART" id="PRIOR_LTEMPART" value="<?php echo attr($LTEMPART); ?>"></td>
307 </tr>
308 <tr>
309 <td class="right"><?php echo xlt('CN V{{cranial nerve five}}'); ?></td>
310 <td><input disabled type="text" size="1" name="PRIOR_RCNV" id="PRIOR_RCNV" value="<?php echo attr($RCNV); ?>"></td>
311 <td><input disabled type="text" size="1" name="PRIOR_LCNV" id="PRIOR_LCNV" value="<?php echo attr($LCNV); ?>"></td>
312 </tr>
313 <tr>
314 <td class="right"><?php echo xlt('CN VII{{cranial nerve seven}}'); ?></td>
315 <td><input disabled type="text" size="1" name="PRIOR_RCNVII" id="PRIOR_RCNVII" value="<?php echo attr($RCNVII); ?>"></td>
316 <td><input disabled type="text" size="1" name="PRIOR_LCNVII" id="PRIOR_LCNVII" value="<?php echo attr($LCNVII); ?>"></td>
317 </tr>
318 <tr><td colspan=3 class="underline"><?php echo xlt('Hertel Exophthalmometry'); ?></td></tr>
319 <tr class="center">
320 <td>
321 <input disabled type=text size=1 id="PRIOR_ODHERTEL" name="PRIOR_ODHERTEL" value="<?php echo attr($ODHERTEL); ?>">
322 <i class="fa fa-minus"></i>
323 </td>
324 <td>
325 <input disabled type=text size=3 id="PRIOR_HERTELBASE" name="PRIOR_HERTELBASE" value="<?php echo attr($HERTELBASE); ?>">
326 <i class="fa fa-minus"></i>
327 </td>
328 <td>
329 <input disabled type=text size=1 id="PRIOR_OSHERTEL" name="PRIOR_OSHERTEL" value="<?php echo attr($OSHERTEL); ?>">
330 </td>
331 </tr>
332 <tr><td>&nbsp;</td></tr>
333 </table>
334 </div>
336 <?php ($EXT_VIEW ?? '' == 1) ? ($display_EXT_view = "wide_textarea") : ($display_EXT_view = "narrow_textarea");?>
337 <?php ($display_EXT_view == "wide_textarea") ? ($marker = "fa-minus-square-o") : ($marker = "fa-plus-square-o");?>
338 <div id="PRIOR_EXT_text_list" name="PRIOR_EXT_text_list" class="borderShadow PRIORS <?php echo attr($display_EXT_view); ?>" >
339 <span class="top_right fa <?php echo attr($marker); ?>" name="PRIOR_EXT_text_view" id="PRIOR_EXT_text_view"></span>
340 <table cellspacing="0" cellpadding="0" >
341 <tr>
342 <th><?php echo xlt('Right'); ?></th><td style="width:100px;"></td><th><?php echo xlt('Left'); ?> </th>
343 </tr>
344 <tr>
345 <td><textarea disabled name="PRIOR_RBROW" id="PRIOR_RBROW" class="right EXT"><?php echo text($RBROW); ?></textarea></td>
346 <td class="ident"><?php echo xlt('Brow'); ?></td>
347 <td><textarea disabled name="PRIOR_LBROW" id="PRIOR_LBROW" class=""><?php echo text($LBROW); ?></textarea></td>
348 </tr>
349 <tr>
350 <td><textarea disabled name="PRIOR_RUL" id="PRIOR_RUL" class="right"><?php echo text($RUL); ?></textarea></td>
351 <td class="ident"><?php echo xlt('Upper Lids'); ?></td>
352 <td><textarea disabled name="PRIOR_LUL" id="PRIOR_LUL" class=""><?php echo text($LUL); ?></textarea></td>
353 </tr>
354 <tr>
355 <td><textarea disabled name="PRIOR_RLL" id="PRIOR_RLL" class="right"><?php echo text($RLL); ?></textarea></td>
356 <td class="ident"><?php echo xlt('Lower Lids'); ?></td>
357 <td><textarea disabled name="PRIOR_LLL" id="PRIOR_LLL" class=""><?php echo text($LLL); ?></textarea></td>
358 </tr>
359 <tr>
360 <td><textarea disabled name="PRIOR_RMCT" id="PRIOR_RMCT" class="right"><?php echo text($RMCT); ?></textarea></td>
361 <td class="ident"><?php echo xlt('Medial Canthi'); ?></td>
362 <td><textarea disabled name="PRIOR_LMCT" id="PRIOR_LMCT" class=""><?php echo text($LMCT); ?></textarea></td>
363 </tr>
364 <tr>
365 <td><textarea disabled name="PRIOR_RADNEXA" id="PRIOR_RADNEXA" class="right"><?php echo text($RADNEXA); ?></textarea></td>
366 <td class="ident"><?php echo xlt('Adnexa'); ?></td>
367 <td><textarea disabled name="PRIOR_LADNEXA" id="PRIOR_LADNEXA" class=""><?php echo text($LADNEXA); ?></textarea></td>
368 </tr>
369 </table>
370 </div>
371 <br />
372 <div class="QP_lengthen">
373 <span style="font-weight:bold;"><?php echo xlt('Comments'); ?>:</span>
374 <br />
375 <textarea disabled id="PRIOR_EXT_COMMENTS" name="PRIOR_EXT_COMMENTS"><?php echo text($EXT_COMMENTS); ?></textarea>
376 </div>
378 <?php
379 } elseif ($zone == "ANTSEG") {
380 if ($report == '0') {
381 $output = priors_select($zone, $orig_id, $id_to_show, $pid);
384 <input disabled type="hidden" id="PRIORS_<?php echo attr($zone); ?>_prefix" name="PRIORS_<?php echo attr($zone); ?>_prefix" value="">
385 <span class="closeButton float-right fas fa-times" id="Close_PRIORS_<?php echo attr($zone); ?>" name="Close_PRIORS_<?php echo attr($zone); ?>"></span>
386 <div name="prior_selector">
387 <?php
388 echo $output;
390 </div>
392 <span style="font-weight:bold;"> <?php echo xlt('Prior Exam'); ?>:</span>
393 <br />
394 <div class="text_clinical" id="PRIORS_ANTSEG_left_1">
395 <table>
396 <?php
397 list($imaging,$episode) = display($pid, $encounter ?? '', "ANTSEG");
398 echo $episode;
400 </table>
401 <table>
402 <tr >
403 <td></td><td><?php echo xlt('R{{right}}'); ?></td><td><?php echo xlt('L{{left}}'); ?></td>
404 </tr>
405 <tr>
406 <td class="right" ><?php echo xlt('Gonio{{Gonioscopy abbreviation}}'); ?></td>
407 <td><input disabled type="text" name="PRIOR_ODGONIO" id="PRIOR_ODGONIO" value="<?php echo attr($ODGONIO); ?>"></td>
408 <td><input disabled type="text" name="PRIOR_OSGONIO" id="PRIOR_OSGONIO" value="<?php echo attr($OSGONIO); ?>"></td>
409 </tr>
410 <tr>
411 <td class="right" ><?php echo xlt('Pachymetry'); ?></td>
412 <td><input disabled type="text" name="PRIOR_ODKTHICKNESS" id="PRIOR_ODKTHICKNESS" value="<?php echo attr($ODKTHICKNESS); ?>"></td>
413 <td><input disabled type="text" name="PRIOR_OSKTHICKNESS" id="PRIOR_OSKTHICKNESS" value="<?php echo attr($OSKTHICKNESS); ?>"></td>
414 </tr>
415 <tr>
416 <td class="right" title="<?php echo xla('Schirmers I (w/o anesthesia)'); ?>"><?php echo xlt('Schirmer I'); ?></td>
417 <td><input disabled type="text" name="PRIOR_ODSCHIRMER1" id="PRIOR_ODSCHIRMER1" value="<?php echo attr($ODSCHIRMER1); ?>"></td>
418 <td><input disabled type="text" name="PRIOR_OSSCHRIMER2" id="PRIOR_OSSCHIRMER1" value="<?php echo attr($OSSCHIRMER1); ?>"></td>
419 </tr>
420 <tr>
421 <td class="right" title="<?php echo xla('Schirmers II (w/ anesthesia)'); ?>"><?php echo xlt('Schirmer II'); ?></td>
422 <td><input disabled type="text" name="PRIOR_ODSCHIRMER2" id="PRIOR_ODSCHIRMER2" value="<?php echo attr($ODSCHIRMER2); ?>"></td>
423 <td><input disabled type="text" name="PRIOR_OSSCHRIMER2" id="PRIOR_OSSCHIRMER2" value="<?php echo attr($OSSCHIRMER2); ?>"></td>
424 </tr>
425 <tr>
426 <td class="right" title="<?php echo xla('Tear Break Up Time'); ?>"><?php echo xlt('TBUT{{tear breakup time}}'); ?></td>
427 <td><input disabled type="text" name="PRIOR_ODTBUT" id="PRIOR_ODTBUT" value="<?php echo attr($ODTBUT); ?>"></td>
428 <td><input disabled type="text" name="PRIOR_OSTBUT" id="PRIOR_OSTBUT" value="<?php echo attr($OSTBUT); ?>"></td>
429 </tr>
430 <tr>
431 <td colspan="3" rowspan="4" id="PRIORS_dil_box" nowrap="">
432 <br />
433 <?php
434 // This is going to be based off a list in the near future
435 // to allow for end-user customization
437 <span id="PRIORS_dil_listbox_title"><?php echo xlt('Dilation'); ?>:</span>
438 <span id="PRIORS_dil_meds" class="float-right"><?php
439 if ($DIL_MEDS) {
440 echo text($DIL_MEDS);
442 ?></span>
443 <br />
444 <table id="PRIORS_dil_listbox">
445 <tr>
446 <td>
447 <input disabled type="checkbox" class="dil_drug" id="PRIORS_CycloMydril" name="PRIORS_CYCLOMYDRIL" value="Cyclomydril" <?php
448 if ($CYCLOMYDRIL == 'Cyclomydril') {
449 echo "checked='checked'";
450 } ?> />
451 <label for="CycloMydril" class="input-helper input-helper--checkbox"><?php echo text('CycloMydril'); ?></label>
452 </td>
453 <td>
454 <input disabled type="checkbox" class="dil_drug" id="PRIORS_Tropicamide" name="PRIORS_TROPICAMIDE" value="Tropicamide 2.5%" <?php
455 if ($TROPICAMIDE == 'Tropicamide 2.5%') {
456 echo "checked='checked'";
457 } ?> />
458 <label for="Tropicamide" class="input-helper input-helper--checkbox"><?php echo text('Tropic 2.5%'); ?></label>
459 </td>
460 </tr>
461 <tr>
462 <td>
463 <input disabled type="checkbox" class="dil_drug" id="PRIORS_Neo25" name="PRIORS_NEO25" value="Neosynephrine 2.5%" <?php
464 if ($NEO25 == 'Neosynephrine 2.5%') {
465 echo "checked='checked'";
466 } ?> />
467 <label for="Neo25" class="input-helper input-helper--checkbox"><?php echo text('Neo 2.5%'); ?></label>
468 </td>
469 <td>
470 <input disabled type="checkbox" class="dil_drug" id="PRIORS_Neo10" name="PRIORS_NEO10" value="Neosynephrine 10%" <?php
471 if ($NEO10 ?? '' == 'Neosynephrine 10%') {
472 echo "checked='checked'";
473 } ?> />
474 <label for="Neo10" class="input-helper input-helper--checkbox"><?php echo text('Neo 10%'); ?></label>
475 </td>
476 </tr>
477 <tr>
478 <td>
479 <input disabled type="checkbox" class="dil_drug" id="PRIORS_Cyclogyl" style="left:150px;" name="PRIORS_CYCLOGYL" value="Cyclopentolate 1%" <?php
480 if ($CYCLOGYL == 'Cyclopentolate 1%') {
481 echo "checked='checked'";
482 } ?> />
483 <label for="Cyclogyl" class="input-helper input-helper--checkbox"><?php echo text('Cyclo 1%'); ?></label>
484 </td>
485 <td>
486 <input disabled type="checkbox" class="dil_drug" id="PRIORS_Atropine" name="PRIORS_ATROPINE" value="Atropine 1%" <?php
487 if ($ATROPINE == 'Atropine 1%') {
488 echo "checked='checked'";
489 } ?> />
490 <label for="Atropine" class="input-helper input-helper--checkbox"><?php echo text('Atropine 1%'); ?></label>
491 </td>
492 </tr>
493 </table>
494 </td>
495 </tr>
496 </table>
497 </div>
498 <?php ($ANTSEG_VIEW ?? '' == '1') ? ($display_ANTSEG_view = "wide_textarea") : ($display_ANTSEG_view = "narrow_textarea");?>
499 <?php ($display_ANTSEG_view == "wide_textarea") ? ($marker = "fa-minus-square-o") : ($marker = "fa-plus-square-o");?>
500 <div id="PRIOR_ANTSEG_text_list" name="PRIOR_ANTSEG_text_list" class="borderShadow PRIORS <?php echo attr($display_ANTSEG_view); ?>" >
501 <span class="top_right fa <?php echo attr($marker); ?>" name="PRIOR_ANTSEG_text_view" id="PRIOR_ANTSEG_text_view"></span>
502 <table>
503 <tr>
504 <th><?php echo xlt('OD{{right eye}}'); ?></th><th></th><th><?php echo xlt('OS{{left eye}}'); ?></th></td>
505 </tr>
506 <tr>
507 <td><textarea disabled name="PRIOR_ODCONJ" id="PRIOR_ODCONJ" class="right"><?php echo text($ODCONJ); ?></textarea></td>
508 <td class="ident"><?php echo xlt('Conj{{Conjunctiva}}'); ?> / <?php echo xlt('Sclera'); ?></td>
509 <td><textarea disabled name="PRIOR_OSCONJ" id="PRIOR_OSCONJ" class=""><?php echo text($OSCONJ); ?></textarea></td>
510 </tr>
511 <tr>
512 <td><textarea disabled name="PRIOR_ODCORNEA" id="PRIOR_ODCORNEA" class="right"><?php echo text($ODCORNEA); ?></textarea></td>
513 <td class="ident"><?php echo xlt('Cornea'); ?></td>
514 <td><textarea disabled name="PRIOR_OSCORNEA" id="PRIOR_OSCORNEA" class=""><?php echo text($OSCORNEA); ?></textarea></td>
515 </tr>
516 <tr>
517 <td><textarea disabled name="PRIOR_ODAC" id="PRIOR_ODAC" class="right"><?php echo text($ODAC); ?></textarea></td>
518 <td class="ident"><?php echo xlt('A/C{{anterior chamber}}'); ?></td>
519 <td><textarea disabled name="PRIOR_OSAC" id="PRIOR_OSAC" class=""><?php echo text($OSAC); ?></textarea></td>
520 </tr>
521 <tr>
522 <td><textarea disabled name="PRIOR_ODLENS" id="PRIOR_ODLENS" class=" right"><?php echo text($ODLENS); ?></textarea></td>
523 <td class="ident" ><?php echo xlt('Lens'); ?></td>
524 <td><textarea disabled name="PRIOR_OSLENS" id="PRIOR_OSLENS" class=""><?php echo text($OSLENS); ?></textarea></td>
525 </tr>
526 <tr>
527 <td><textarea disabled name="PRIOR_ODIRIS" id="PRIOR_ODIRIS" class="right"><?php echo text($ODIRIS); ?></textarea></td>
528 <td class="ident"><?php echo xlt('Iris'); ?></td>
529 <td><textarea disabled name="PRIOR_OSIRIS" id="PRIOR_OSIRIS" class=""><?php echo text($OSIRIS); ?></textarea></td>
530 </tr>
531 </table>
532 </div>
533 <br />
534 <div class="QP_lengthen">
535 <span style="font-weight:bold;"><?php echo xlt('Comments'); ?>:</span>
536 <br />
537 <textarea disabled id="PRIOR_ANTSEG_COMMENTS" name="PRIOR_ANTSEG_COMMENTS"><?php echo text($ANTSEG_COMMENTS); ?></textarea>
538 </div>
540 <?php
541 } elseif ($zone == "RETINA") {
542 if ($report == '0') {
543 $output = priors_select($zone, $orig_id, $id_to_show, $pid);
546 <input disabled type="hidden" id="PRIORS_<?php echo attr($zone); ?>_prefix" name="PRIORS_<?php echo attr($zone); ?>_prefix" value="">
547 <span class="closeButton float-right fas fa-times" id="Close_PRIORS_<?php echo attr($zone); ?>" name="Close_PRIORS_<?php echo attr($zone); ?>"></span>
548 <div name="prior_selector">
549 <?php
550 echo $output;
552 </div>
553 <span style="font-weight:bold;"><?php echo xlt('Prior Exam'); ?>:</span>
554 <br />
555 <div id="PRIORS_RETINA_left_1" class="text_clinical">
556 <table>
557 <?php
558 list($imaging,$episode) = display($pid, $encounter ?? '', "POSTSEG");
559 echo $episode;
561 </table>
562 <br />
563 <table>
564 <tr class="bold">
565 <td></td>
566 <td><?php echo xlt('OD{{right eye}}'); ?> </td><td><?php echo xlt('OS{{left eye}}'); ?> </td>
567 </tr>
568 <tr>
569 <td class="bold right"><?php echo xlt('C/D Ratio{{cup to disc ration}}'); ?>:</td>
570 <td>
571 <input type="text" disabled name="PRIOR_ODCUP" size="4" id="PRIOR_ODCUP" value="<?php echo attr($ODCUP); ?>">
572 </td>
573 <td>
574 <input type="text" disabled name="PRIOR_OSCUP" size="4" id="PRIOR_OSCUP" value="<?php echo attr($OSCUP); ?>">
575 </td>
576 </tr>
578 <tr>
579 <td class="bold right">
580 <?php echo xlt('CMT{{Central Macular Thickness}}'); ?>:</td>
581 <td>
582 <input type="text" disabled name="PRIOR_ODCMT" size="4" id="PRIOR_ODCMT" value="<?php echo attr($ODCMT); ?>">
583 </td>
584 <td>
585 <input type="text" disabled name="PRIOR_OSCMT" size="4" id="PRIOR_OSCMT" value="<?php echo attr($OSCMT); ?>">
586 </td>
587 </tr>
588 </table>
589 <br />
590 <table>
591 <?php
592 list($imaging,$episode) = display($pid, $encounter ?? '', "NEURO");
593 echo $episode;
595 </table>
596 </div>
598 <?php ($RETINA_VIEW ?? '' == 1) ? ($display_RETINA_view = "wide_textarea") : ($display_RETINA_view = "narrow_textarea");?>
599 <?php ($display_RETINA_view == "wide_textarea") ? ($marker = "fa-minus-square-o") : ($marker = "fa-plus-square-o");?>
600 <div>
601 <div id="PRIOR_RETINA_text_list" name="PRIOR_RETINA_text_list" class="borderShadow PRIORS <?php echo attr($display_RETINA_view); ?>">
602 <span class="top_right fa <?php echo attr($marker); ?>" name="PRIOR_RETINA_text_view" id="PRIOR_RETINA_text_view"></span>
603 <table cellspacing="0" cellpadding="0">
604 <tr>
605 <th><?php echo xlt('OD{{right eye}}'); ?></th><td style="width:100px;"></td><th><?php echo xlt('OS{{left eye}}'); ?></th></td>
606 </tr>
607 <tr>
608 <td><textarea disabled name="PRIOR_ODDISC" id="PRIOR_ODDISC" class="right"><?php echo text($ODDISC); ?></textarea></td>
609 <td style="text-align:center;font-size:0.9em;"><?php echo xlt('Disc'); ?></td>
610 <td><textarea disabled name="PRIOR_OSDISC" id="PRIOR_OSDISC"><?php echo text($OSDISC); ?></textarea></td>
611 </tr>
612 <tr>
613 <td><textarea disabled name="ODMACULA" id="ODMACULA" class="right"><?php echo text($ODMACULA); ?></textarea></td>
614 <td style="text-align:center;font-size:0.9em;"><?php echo xlt('Macula'); ?></td>
615 <td><textarea disabled name="PRIOR_OSMACULA" id="PRIOR_OSMACULA"><?php echo text($OSMACULA); ?></textarea></td>
616 </tr>
617 <tr>
618 <td><textarea disabled name="PRIOR_ODVESSELS" id="PRIOR_ODVESSELS" class="right"><?php echo text($ODVESSELS); ?></textarea></td>
619 <td style="text-align:center;font-size:0.9em;"><?php echo xlt('Vessels'); ?></td>
620 <td><textarea disabled name="PRIOR_OSVESSELS" id="PRIOR_OSVESSELS"><?php echo text($OSVESSELS); ?></textarea></td>
621 </tr>
622 <tr>
623 <td><textarea name="PRIOR_ODVITREOUS" id="PRIOR_ODVITREOUS" class="right"><?php echo text($ODVITREOUS); ?></textarea></td>
624 <td style="text-align:center;font-size:0.9em;" ><?php echo xlt('Vitreous'); ?></td>
625 <td><textarea name="PRIOR_OSVITREOUS" id="PRIOR_OSVITREOUS"><?php echo text($OSVITREOUS); ?></textarea></td>
626 </tr>
627 <tr>
628 <td><textarea disabled name="PRIOR_ODPERIPH" id="PRIOR_ODPERIPH" class="right"><?php echo text($ODPERIPH); ?></textarea></td>
629 <td style="text-align:center;font-size:0.9em;" class=""><?php echo xlt('Periph'); ?></td>
630 <td><textarea disabled name="PRIOR_OSPERIPH" id="PRIOR_OSPERIPH"><?php echo text($OSPERIPH); ?></textarea></td>
631 </tr>
632 </table>
633 </div>
634 </div>
635 <br />
636 <br />
637 <div class="QP_lengthen">
638 <SPAN style="font-weight:bold;"><?php echo xlt('Comments'); ?>:</SPAN>
639 <br />
640 <textarea disabled id="PRIOR_RETINA_COMMENTS" name="PRIOR_RETINA_COMMENTS" style="width:4.0in;height:3.0em;"><?php echo text($RETINA_COMMENTS); ?></textarea>
641 </div>
642 <?php
643 } elseif ($zone == "NEURO") {
644 if ($report == '0') {
645 $output = priors_select($zone, $orig_id, $id_to_show, $pid);
648 <input disabled type="hidden" id="PRIORS_<?php echo attr($zone); ?>_prefix" name="PRIORS_<?php echo attr($zone); ?>_prefix" value="">
649 <span class="closeButton float-right fas fa-times" id="Close_PRIORS_<?php echo attr($zone); ?>" name="Close_PRIORS_<?php echo attr($zone); ?>"></span>
650 <div name="prior_selector">
651 <?php
652 echo $output;
654 </div>
655 <span style="font-weight:bold;"><?php echo xlt('Prior Exam'); ?>:</span>
656 <br />
657 <div style="float:left;margin-top:0.8em;font-size:0.8em;">
658 <div id="PRIOR_NEURO_text_list" class="borderShadow PRIORS" style="border:1pt solid black;float:left;width:195px;padding:10px;text-align:center;margin:2 2;font-weight:bold;">
659 <table style="font-size:1.0em;font-weight:600;">
660 <tr>
661 <td></td><td style="text-align:center;"><?php echo xlt('OD{{right eye}}'); ?></td><td style="text-align:center;"><?php echo xlt('OS{{left eye}}'); ?></td></tr>
662 <tr>
663 <td class="right">
664 <?php echo xlt('Color'); ?>:
665 </td>
666 <td>
667 <input disabled type="text" id="PRIOR_ODCOLOR" name="PRIOR_ODCOLOR" value="<?php
668 if ($ODCOLOR) {
669 echo attr($ODCOLOR);
670 } else {
671 echo " / ";
672 } ?>"/>
673 </td>
674 <td>
675 <input disabled type="text" id="PRIOR_OSCOLOR" name="PRIOR_OSCOLOR" value="<?php
676 if ($OSCOLOR) {
677 echo attr($OSCOLOR);
678 } else {
679 echo " / ";
680 } ?>"/>
681 </td>
682 <td style="text-align:bottom;">
683 &nbsp;<span title="<?php echo xla('Insert normals - 11/11'); ?>" class="fa fa-reply"></span>
684 </td>
685 </tr>
686 <tr>
687 <td class="right" style="white-space: nowrap;font-size:0.9em;">
688 <span title="<?php echo xla('Variation in red color discrimination between the eyes (eg. OD=100, OS=75)'); ?>"><?php echo xlt('Red Desat{{red desaturation}}'); ?>:</span>
689 </td>
690 <td>
691 <input disabled type="text" size="6" name="PRIOR_ODREDDESAT" id="PRIOR_ODREDDESAT" value="<?php echo attr($ODREDDESAT); ?>"/>
692 </td>
693 <td>
694 <input disabled type="text" size="6" name="PRIOR_OSREDDESAT" id="PRIOR_OSREDDESAT" value="<?php echo attr($OSREDDESAT); ?>"/>
695 </td>
696 <td>&nbsp;
697 <span id="" class="fa fa-reply" name="" title="<?php echo xla('Insert normals - 100/100'); ?>"></span>
698 </td>
699 </tr>
700 <tr>
701 <td class="right" style="white-space: nowrap;font-size:0.9em;">
702 <span title="<?php echo xla('Variation in white (muscle) light brightness discrimination between the eyes (eg. OD=$1.00, OS=$0.75)'); ?>"><?php echo xlt('Coins'); ?>:</span>
703 </td>
704 <td>
705 <input disabled type="text" size="6" name="PRIOR_ODCOINS" id="PRIOR_ODCOINS" value="<?php echo attr($ODCOINS); ?>"/>
706 </td>
707 <td>
708 <input disabled type="text" size="6" name="PRIOR_OSCOINS" id="PRIOR_OSCOINS" value="<?php echo attr($OSCOINS); ?>"/>
709 </td>
710 <td>&nbsp;
711 <span id="" class="fa fa-reply" name="" title="<?php echo xla('Insert normals - 100/100'); ?>"></span>
712 </td>
713 </tr>
714 </table>
715 </div>
716 <div class="borderShadow" style="position: relative;
718 float: right;
720 text-align: center;
722 width: 260px;
724 z-index: 1;
726 margin: 2px 0 2px 2px;">
727 <span class="closeButton fa fa-th" id="PRIOR_Close_ACTMAIN" name="PRIOR_Close_ACTMAIN"></span>
728 <table class="ACT_top bold">
729 <tr style="text-align:left;height:26px;vertical-align:middle;width:180px;">
730 <td >
731 <span id="PRIOR_ACTTRIGGER" name="PRIOR_ACTTRIGGER" style="text-decoration:underline;"><?php echo ('Alternate Cover Test'); ?>:</span>
732 </td>
733 <td>
734 <span id="PRIOR_ACTNORMAL_CHECK" name="PRIOR_ACTNORMAL_CHECK">
735 <label for="PRIOR_ACT" class="input-helper input-helper--checkbox"><?php echo xlt('Ortho'); ?></label>
736 <input disabled type="checkbox" name="PRIOR_ACT" id="PRIOR_ACT" checked="<?php
737 if ($ACT == '1') {
738 echo "checked";
739 } ?>"></span>
740 </td>
741 </tr>
742 <tr>
743 <td colspan="2" style="text-align:center;">
744 <br />
745 <div id="PRIOR_ACTMAIN" name="PRIOR_ACTMAIN" class="ACT_TEXT nodisplay" style="position:relative;z-index:1;margin 10 auto;">
746 <table cellpadding="0" style="position:relative;margin: 7 5 19 5;">
747 <tr>
748 <td id="PRIOR_ACT_tab_SCDIST" name="PRIOR_ACT_tab_SCDIST" class="ACT_selected"> <?php echo xlt('scDist{{ACT without Correction Distance}}'); ?> </td>
749 <td id="PRIOR_ACT_tab_CCDIST" name="PRIOR_ACT_tab_CCDIST" class="ACT_deselected"> <?php echo xlt('ccDist{{ACT with Correction Distance}}'); ?> </td>
750 <td id="PRIOR_ACT_tab_SCNEAR" name="PRIOR_ACT_tab_SCNEAR" class="ACT_deselected"> <?php echo xlt('scNear{{ACT without Correction Near}}'); ?> </td>
751 <td id="PRIOR_ACT_tab_CCNEAR" name="PRIOR_ACT_tab_CCNEAR" class="ACT_deselected"> <?php echo xlt('ccNear{{ACT with Correction Near}}'); ?> </td>
752 </tr>
753 <tr>
754 <td colspan="4" style="text-align:center;font-size:0.8em;">
755 <div id="PRIOR_ACT_SCDIST" name="PRIOR_ACT_SCDIST" class="ACT_box">
756 <br />
757 <table>
758 <tr>
759 <td class="text-center"><?php echo xlt('R{{right}}'); ?></td>
760 <td style="border-right:1pt solid black;border-bottom:1pt solid black;text-align:right;">
761 <textarea disabled id="PRIOR_ACT1SCDIST" name="PRIOR_ACT1SCDIST" class="ACT"><?php echo text($ACT1SCDIST); ?></textarea></td>
762 <td style="border:1pt solid black;border-top:0pt;text-align:center;">
763 <textarea disabled id="PRIOR_ACT2SCDIST" name="PRIOR_ACT2SCDIST"class="ACT"><?php echo text($ACT2SCDIST); ?></textarea></td>
764 <td style="border-left:1pt solid black;border-bottom:1pt solid black;text-align:left;">
765 <textarea disabled id="PRIOR_ACT3SCDIST" name="PRIOR_ACT3SCDIST" class="ACT"><?php echo text($ACT3SCDIST); ?></textarea></td>
766 <td class="text-center"><?php echo xlt('L{{left}}'); ?></td>
767 </tr>
768 <tr>
769 <td class="text-center"><i class="fa fa-reply rotate-left"></i></td>
770 <td style="border:1pt solid black;border-left:0pt;text-align:right;">
771 <textarea disabled id="PRIOR_ACT4SCDIST" name="PRIOR_ACT4SCDIST" class="ACT"><?php echo text($ACT4SCDIST); ?></textarea></td>
772 <td style="border:1pt solid black;text-align:center;">
773 <textarea disabled id="PRIOR_ACT5SCDIST" name="PRIOR_ACT5SCDIST" class="ACT"><?php echo text($ACT5SCDIST); ?></textarea></td>
774 <td style="border:1pt solid black;border-right:0pt;text-align:left;">
775 <textarea disabled id="PRIOR_ACT6SCDIST" name="PRIOR_ACT6SCDIST" class="ACT"><?php echo text($ACT6SCDIST); ?></textarea></td>
776 <td class="text-center"><i class="fa fa-reply flip-left"></i></td>
777 </tr>
778 <tr>
779 <td style="border:0; border-top:2pt solid black;border-right:2pt solid black;text-align:right;">
780 <textarea disabled id="PRIOR_ACT10SCDIST" name="PRIOR_ACT10SCDIST" class="ACT"><?php echo text($ACT10SCDIST); ?></textarea></td>
781 <td style="border-right:1pt solid black;border-top:1pt solid black;text-align:right;">
782 <textarea disabled id="PRIOR_ACT7SCDIST" name="PRIOR_ACT7SCDIST" class="ACT"><?php echo text($ACT7SCDIST); ?></textarea></td>
783 <td style="border:1pt solid black;border-bottom:0pt;text-align:center;">
784 <textarea disabled id="PRIOR_ACT8SCDIST" name="PRIOR_ACT8SCDIST" class="ACT"><?php echo text($ACT8SCDIST); ?></textarea></td>
785 <td style="border-left:1pt solid black;border-top:1pt solid black;text-align:left;">
786 <textarea disabled id="PRIOR_ACT9SCDIST" name="PRIOR_ACT9SCDIST" class="ACT"><?php echo text($ACT9SCDIST); ?></textarea></td>
787 <td style="border:0; border-top:2pt solid black;border-left:2pt solid black;text-align:left;vertical-align:middle;">
788 <textarea disabled id="PRIOR_ACT11SCDIST" name="PRIOR_ACT11SCDIST" class="ACT"><?php echo text($ACT11SCDIST); ?></textarea>
789 </td>
790 </tr>
791 </table>
792 <br />
793 </div>
794 <div id="PRIOR_ACT_CCDIST" name="PRIOR_ACT_CCDIST" class="nodisplay ACT_box">
795 <br />
796 <table>
797 <tr>
798 <td class="text-center"><?php echo xlt('R{{right}}'); ?></td>
799 <td style="border-right:1pt solid black;border-bottom:1pt solid black;text-align:right;">
800 <textarea disabled id="PRIOR_ACT1CCDIST" name="PRIOR_ACT1CCDIST" class="ACT"><?php echo text($ACT1CCDIST); ?></textarea></td>
801 <td style="border:1pt solid black;border-top:0pt;text-align:center;">
802 <textarea disabled id="PRIOR_ACT2CCDIST" name="PRIOR_ACT2CCDIST"class="ACT"><?php echo text($ACT2CCDIST); ?></textarea></td>
803 <td style="border-left:1pt solid black;border-bottom:1pt solid black;text-align:left;">
804 <textarea disabled id="PRIOR_ACT3CCDIST" name="PRIOR_ACT3CCDIST" class="ACT"><?php echo text($ACT3CCDIST); ?></textarea></td>
805 <td class="text-center"><?php echo xlt('L{{left}}'); ?></td>
806 </tr>
807 <tr>
808 <td class="text-center"><i class="fa fa-reply rotate-left"></i></td>
809 <td style="border:1pt solid black;border-left:0pt;text-align:right;">
810 <textarea disabled id="PRIOR_ACT4CCDIST" name="PRIOR_ACT4CCDIST" class="ACT"><?php echo text($ACT4CCDIST); ?></textarea></td>
811 <td style="border:1pt solid black;text-align:center;">
812 <textarea disabled id="PRIOR_ACT5CCDIST" name="PRIOR_ACT5CCDIST" class="ACT"><?php echo text($ACT5CCDIST); ?></textarea></td>
813 <td class="text-center">
814 <textarea disabled id="PRIOR_ACT6CCDIST" name="PRIOR_ACT6CCDIST" class="ACT"><?php echo text($ACT6CCDIST); ?></textarea></td>
815 <td><i class="fa fa-reply flip-left"></i></td>
816 </tr>
817 <tr>
818 <td style="border:0; border-top:2pt solid black;border-right:2pt solid black;text-align:right;">
819 <textarea disabled id="PRIOR_ACT10CCDIST" name="PRIOR_ACT10CCDIST" class="ACT"><?php echo text($ACT10CCDIST); ?></textarea></td>
820 <td style="border-right:1pt solid black;border-top:1pt solid black;text-align:right;">
821 <textarea disabled id="PRIOR_ACT7CCDIST" name="PRIOR_ACT7CCDIST" class="ACT"><?php echo text($ACT7CCDIST); ?></textarea></td>
822 <td style="border:1pt solid black;border-bottom:0pt;text-align:center;">
823 <textarea disabled id="PRIOR_ACT8CCDIST" name="PRIOR_ACT8CCDIST" class="ACT"><?php echo text($ACT8CCDIST); ?></textarea></td>
824 <td style="border-left:1pt solid black;border-top:1pt solid black;text-align:left;">
825 <textarea disabled id="PRIOR_ACT9CCDIST" name="PRIOR_ACT9CCDIST" class="ACT"><?php echo text($ACT9CCDIST); ?></textarea></td>
826 <td style="border:0; border-top:2pt solid black;border-left:2pt solid black;text-align:left;vertical-align:middle;">
827 <textarea disabled id="PRIOR_ACT11CCDIST" name="PRIOR_ACT11CCDIST" class="ACT"><?php echo text($ACT11CCDIST); ?></textarea></td>
828 </tr>
829 </table>
830 <br />
831 </div>
832 <div id="PRIOR_ACT_SCNEAR" name="PRIOR_ACT_SCNEAR" class="nodisplay ACT_box">
833 <br />
834 <table>
835 <tr>
836 <td class="text-center"><?php echo xlt('R{{right}}'); ?></td>
837 <td style="border-right:1pt solid black;border-bottom:1pt solid black;text-align:right;">
838 <textarea disabled id="PRIOR_ACT1SCNEAR" name="PRIOR_ACT1SCNEAR" class="ACT"><?php echo text($ACT1SCNEAR); ?></textarea></td>
839 <td style="border:1pt solid black;border-top:0pt;text-align:center;">
840 <textarea disabled id="PRIOR_ACT2SCNEAR" name="PRIOR_ACT2SCNEAR"class="ACT"><?php echo text($ACT2SCNEAR); ?></textarea></td>
841 <td style="border-left:1pt solid black;border-bottom:1pt solid black;text-align:left;">
842 <textarea disabled id="PRIOR_ACT3SCNEAR" name="PRIOR_ACT3SCNEAR" class="ACT"><?php echo text($ACT3SCNEAR); ?></textarea></td>
843 <td style="text-align:center;"><?php echo xlt('L{{left}}'); ?></td>
844 </tr>
845 <tr>
846 <td class="text-center"><i class="fa fa-reply rotate-left"></i></td>
847 <td style="border:1pt solid black;border-left:0pt;text-align:right;">
848 <textarea disabled id="PRIOR_ACT4SCNEAR" name="PRIOR_ACT4SCNEAR" class="ACT"><?php echo text($ACT4SCNEAR); ?></textarea></td>
849 <td style="border:1pt solid black;text-align:center;">
850 <textarea disabled id="PRIOR_ACT5SCNEAR" name="PRIOR_ACT5SCNEAR" class="ACT"><?php echo text($ACT5SCNEAR); ?></textarea></td>
851 <td style="border:1pt solid black;border-right:0pt;text-align:left;">
852 <textarea disabled id="PRIOR_ACT6SCNEAR" name="PRIOR_ACT6SCNEAR" class="ACT"><?php echo text($ACT6SCNEAR); ?></textarea></td>
853 <td class="text-center"><i class="fa fa-reply flip-left"></i></td>
854 </tr>
855 <tr>
856 <td style="border:0; border-top:2pt solid black;border-right:2pt solid black;text-align:right;">
857 <textarea disabled id="PRIOR_ACT10SCNEAR" name="PRIOR_ACT10SCNEAR" class="ACT"><?php echo text($ACT10SCNEAR); ?></textarea></td>
858 <td style="border-right:1pt solid black;border-top:1pt solid black;text-align:right;">
859 <textarea disabled id="PRIOR_ACT7SCNEAR" name="PRIOR_ACT7SCNEAR" class="ACT"><?php echo text($ACT7SCNEAR); ?></textarea></td>
860 <td style="border:1pt solid black;border-bottom:0pt;text-align:center;">
861 <textarea disabled id="PRIOR_ACT8SCNEAR" name="PRIOR_ACT8SCNEAR" class="ACT"><?php echo text($ACT8SCNEAR); ?></textarea></td>
862 <td style="border-left:1pt solid black;border-top:1pt solid black;text-align:left;">
863 <textarea disabled id="PRIOR_ACT9SCNEAR" name="PRIOR_ACT9SCNEAR" class="ACT"><?php echo text($ACT9SCNEAR); ?></textarea></td>
864 <td style="border:0; border-top:2pt solid black;border-left:2pt solid black;text-align:left;vertical-align:middle;">
865 <textarea disabled id="PRIOR_ACT11SCNEAR" name="PRIOR_ACT11SCNEAR" class="ACT"><?php echo text($ACT11SCNEAR); ?></textarea>
866 </td>
867 </tr>
868 </table>
869 <br />
870 </div>
871 <div id="PRIOR_ACT_CCNEAR" name="PRIOR_ACT_CCNEAR" class="nodisplay ACT_box">
872 <br />
873 <table>
874 <tr>
875 <td class="text-center"><?php echo xlt('R{{right}}'); ?></td>
876 <td style="border-right:1pt solid black;border-bottom:1pt solid black;text-align:right;">
877 <textarea disabled id="PRIOR_ACT1CCNEAR" name="PRIOR_ACT1CCNEAR" class="ACT"><?php echo text($ACT1CCNEAR); ?></textarea></td>
878 <td style="border:1pt solid black;border-top:0pt;text-align:center;">
879 <textarea disabled id="PRIOR_ACT2CCNEAR" name="PRIOR_ACT2CCNEAR"class="ACT"><?php echo text($ACT2CCNEAR); ?></textarea></td>
880 <td style="border-left:1pt solid black;border-bottom:1pt solid black;text-align:left;">
881 <textarea disabled id="PRIOR_ACT3CCNEAR" name="PRIOR_ACT3CCNEAR" class="ACT"><?php echo text($ACT3CCNEAR); ?></textarea></td>
882 <td class="text-center"><?php echo xlt('L{{left}}'); ?></td>
883 </tr>
884 <tr>
885 <td class="text-center"><i class="fa fa-reply rotate-left"></i></td>
886 <td style="border:1pt solid black;border-left:0pt;text-align:right;">
887 <textarea disabled id="PRIOR_ACT4CCNEAR" name="PRIOR_ACT4CCNEAR" class="ACT"><?php echo text($ACT4CCNEAR); ?></textarea></td>
888 <td style="border:1pt solid black;text-align:center;">
889 <textarea disabled id="PRIOR_ACT5CCNEAR" name="PRIOR_ACT5CCNEAR" class="ACT"><?php echo text($ACT5CCNEAR); ?></textarea></td>
890 <td style="border:1pt solid black;border-right:0pt;text-align:left;">
891 <textarea disabled id="PRIOR_ACT6CCNEAR" name="PRIOR_ACT6CCNEAR" class="ACT"><?php echo text($ACT6CCNEAR); ?></textarea></td>
892 <td class="text-center"><i class="fa fa-reply flip-left"></i></td>
893 </tr>
894 <tr>
895 <td style="border:0; border-top:2pt solid black;border-right:2pt solid black;text-align:right;">
896 <textarea disabled id="PRIOR_ACT10CCNEAR" name="PRIOR_ACT10CCNEAR" class="ACT"><?php echo text($ACT10CCNEAR); ?></textarea></td>
897 <td style="border-right:1pt solid black;border-top:1pt solid black;text-align:right;">
898 <textarea disabled id="PRIOR_ACT7CCNEAR" name="PRIOR_ACT7CCNEAR" class="ACT"><?php echo text($ACT7CCNEAR); ?></textarea></td>
899 <td style="border:1pt solid black;border-bottom:0pt;text-align:center;">
900 <textarea disabled id="PRIOR_ACT8CCNEAR" name="PRIOR_ACT8CCNEAR" class="ACT"><?php echo text($ACT8CCNEAR); ?></textarea></td>
901 <td style="border-left:1pt solid black;border-top:1pt solid black;text-align:left;">
902 <textarea disabled id="PRIOR_ACT9CCNEAR" name="PRIOR_ACT9CCNEAR" class="ACT"><?php echo text($ACT9CCNEAR); ?></textarea></td>
903 <td style="border:0; border-top:2pt solid black;border-left:2pt solid black;text-align:left;vertical-align:middle;">
904 <textarea disabled id="PRIOR_ACT11CCNEAR" name="PRIOR_ACT11CCNEAR" class="ACT"><?php echo text($ACT11CCNEAR); ?></textarea>
905 </td>
906 </tr>
907 </table>
908 <br />
909 </div>
910 </td>
911 </tr>
912 </table>
913 </div>
914 </td>
915 </tr>
916 </table>
917 <br />
918 <div id="PRIOR_NPCNPA" name="PRIOR_NPCNPA">
919 <table style="position:relative;float:left;text-align:center;margin: 4 2;width:100%;font-size:1.0em;padding:4px;">
920 <tr style="">
921 <td style="width:50%;"></td>
922 <td style="font-weight:bold;"><?php echo xlt('OD{{right eye}}'); ?></td>
923 <td style="font-weight:bold;"><?php echo xlt('OS{{left eye}}'); ?></td>
924 </tr>
925 <tr>
926 <td class="right"><span title="<?php echo xla('Near Point of Accomodation'); ?>"><?php echo xlt('NPA{{near point of accomodation}}'); ?>:</span></td>
927 <td><input disabled type="text" id="PRIOR_ODNPA" style="width:70%;" name="PRIOR_ODNPA" value="<?php echo attr($ODNPA); ?>"></td>
928 <td><input disabled type="text" id="PRIOR_OSNPA" style="width:70%;" name="PRIOR_OSNPA" value="<?php echo attr($OSNPA); ?>"></td>
929 </tr>
930 <tr>
931 <td class="right"><span title="<?php echo xla('Near Point of Convergence'); ?>"><?php echo xlt('NPC{{near point of convergence}}'); ?>:</span></td>
932 <td colspan="2" ><input disabled type="text" style="width:85%;" id="PRIOR_NPC" name="PRIOR_NPC" value="<?php echo attr($NPC); ?>">
933 </td>
934 </tr>
935 <tr>
936 <td class="right">
937 <?php echo xlt('Stereopsis'); ?>:
938 </td>
939 <td colspan="2">
940 <input disabled type="text" style="width:85%;" name="PRIOR_STEREOPSIS" id="PRIOR_STEREOPSIS" value="<?php echo attr($STEREOPSIS); ?>">
941 </td>
942 </tr>
943 <tr>
944 <td colspan="3">&nbsp;</td>
945 </tr>
946 <tr><td class="bold underline"><?php echo xlt('Amplitudes'); ?>:</td>
947 <td ><?php echo xlt('Distance'); ?></td>
948 <td><?php echo xlt('Near'); ?></td>
949 </tr>
950 <tr>
951 <td style="text-align:right;"><?php echo xlt('Divergence'); ?>:</td>
952 <td><input disabled type="text" id="PRIOR_DACCDIST" name="PRIOR_DACCDIST" value="<?php echo attr($DACCDIST); ?>"></td>
953 <td><input disabled type="text" id="PRIOR_DACCNEAR" name="PRIOR_DACCNEAR" value="<?php echo attr($DACCNEAR); ?>"></td></tr>
954 <tr>
955 <td style="text-align:right;"><?php echo xlt('Convergence'); ?>:</td>
956 <td><input disabled type="text" id="PRIOR_CACCDIST" name="PRIOR_CACCDIST" value="<?php echo attr($CACCDIST); ?>"></td>
957 <td><input disabled type="text" id="PRIOR_CACCNEAR" name="PRIOR_CACCNEAR" value="<?php echo attr($CACCNEAR); ?>"></td></tr>
958 </tr>
959 <tr>
960 <td class="right">
961 <?php echo xlt('Vertical Fusional'); ?>:
962 </td>
963 <td colspan="2">
964 <input disabled type="text" style="width:90%;" name="PRIOR_VERTFUSAMPS" id="PRIOR_VERTFUSAMPS" value="<?php echo attr($VERTFUSAMPS); ?>">
965 <br />
966 </td>
967 </tr>
968 </table>
969 </div>
971 </div>
972 <?php
973 $hash_tag = '<i class="fa fa-minus"></i>';
974 if ($MOTILITY_RS > '0') {
975 $PRIOR_MOTILITYNORMAL = '';
976 for ($index = 1; $index <= $MOTILITY_RS; ++$index) {
977 $here = "PRIOR_MOTILITY_RS_" . $index;
978 $$here = $hash_tag;
982 if ($MOTILITY_RI > '0') {
983 $PRIOR_MOTILITYNORMAL = '';
984 for ($index = 1; $index <= $MOTILITY_RI; ++$index) {
985 $here = "PRIOR_MOTILITY_RI_" . $index;
986 $$here = $hash_tag;
990 if ($MOTILITY_LS > '0') {
991 $PRIOR_MOTILITYNORMAL = '';
992 for ($index = 1; $index <= $MOTILITY_LS; ++$index) {
993 $here = "PRIOR_MOTILITY_LS_" . $index;
994 $$here = $hash_tag;
998 if ($MOTILITY_LI > '0') {
999 $PRIOR_MOTILITYNORMAL = '';
1000 for ($index = 1; $index <= $MOTILITY_LI; ++$index) {
1001 $here = "PRIOR_MOTILITY_LI_" . $index;
1002 $$here = $hash_tag;
1006 if ($MOTILITY_RRSO > '0') {
1007 $PRIOR_MOTILITYNORMAL = '';
1008 for ($index = 1; $index <= $MOTILITY_RRSO; ++$index) {
1009 $here = "PRIOR_MOTILITY_RRSO_" . $index;
1010 $$here = $hash_tag;
1014 if ($MOTILITY_LRSO > '0') {
1015 $PRIOR_MOTILITYNORMAL = '';
1016 for ($index = 1; $index <= $MOTILITY_LRSO; ++$index) {
1017 $here = "PRIOR_MOTILITY_LRSO_" . $index;
1018 $$here = $hash_tag;
1022 if ($MOTILITY_RLIO > '0') {
1023 $PRIOR_MOTILITYNORMAL = '';
1024 for ($index = 1; $index <= $MOTILITY_RLIO; ++$index) {
1025 $here = "PRIOR_MOTILITY_RLIO_" . $index;
1026 $$here = $hash_tag;
1030 if ($MOTILITY_LLIO > '0') {
1031 $PRIOR_MOTILITYNORMAL = '';
1032 for ($index = 1; $index <= $MOTILITY_LLIO; ++$index) {
1033 $here = "PRIOR_MOTILITY_LLIO_" . $index;
1034 $$here = $hash_tag;
1038 if ($MOTILITY_RLSO > '0') {
1039 $PRIOR_MOTILITYNORMAL = '';
1040 for ($index = 1; $index <= $MOTILITY_RLSO; ++$index) {
1041 $here = "PRIOR_MOTILITY_RLSO_" . $index;
1042 $$here = $hash_tag;
1046 if ($MOTILITY_LLSO > '0') {
1047 $PRIOR_MOTILITYNORMAL = '';
1048 for ($index = 1; $index <= $MOTILITY_LLSO; ++$index) {
1049 $here = "PRIOR_MOTILITY_LLSO_" . $index;
1050 $$here = $hash_tag;
1054 if ($MOTILITY_RRIO > '0') {
1055 $PRIOR_MOTILITYNORMAL = '';
1056 for ($index = 1; $index <= $MOTILITY_RRIO; ++$index) {
1057 $here = "PRIOR_MOTILITY_RRIO_" . $index;
1058 $$here = $hash_tag;
1062 if ($MOTILITY_LRIO > '0') {
1063 $PRIOR_MOTILITYNORMAL = '';
1064 for ($index = 1; $index <= $MOTILITY_LRIO; ++$index) {
1065 $here = "PRIOR_MOTILITY_LRIO_" . $index;
1066 $$here = $hash_tag;
1071 $hash_tag = '<i class="fa fa-minus rotate-left"></i>';
1072 if ($MOTILITY_LR > '0') {
1073 $PRIOR_MOTILITYNORMAL = '';
1074 for ($index = 1; $index <= $MOTILITY_LR; ++$index) {
1075 $here = "PRIOR_MOTILITY_LR_" . $index;
1076 $$here = $hash_tag;
1080 if ($MOTILITY_LL > '0') {
1081 $PRIOR_MOTILITYNORMAL = '';
1082 for ($index = 1; $index <= $MOTILITY_LL; ++$index) {
1083 $here = "PRIOR_MOTILITY_LL_" . $index;
1084 $$here = $hash_tag;
1088 if ($MOTILITY_RR > '0') {
1089 $PRIOR_MOTILITYNORMAL = '';
1090 for ($index = 1; $index <= $MOTILITY_RR; ++$index) {
1091 $here = "PRIOR_MOTILITY_RR_" . $index;
1092 $$here = $hash_tag;
1096 if ($MOTILITY_RL > '0') {
1097 $PRIOR_MOTILITYNORMAL = '';
1098 for ($index = 1; $index <= $MOTILITY_RL; ++$index) {
1099 $here = "PRIOR_MOTILITY_RL_" . $index;
1100 $$here = $hash_tag;
1104 <div id="PRIOR_NEURO_MOTILITY" class="text_clinical borderShadow"
1105 style="float:left;font-size:0.9em;margin:2 2;padding: 0 10;font-weight:bold;height:134px;width:195px;">
1106 <div>
1107 <table style="width:100%;margin:0 0 1 0;">
1108 <tr>
1109 <td style="width:40%;font-size:0.9em;margin:0 auto;font-weight:bold;"><?php echo xlt('Motility'); ?>:</td>
1110 <td style="font-size:0.9em;vertical-align:middle;text-align:right;top:0.0in;right:0.1in;height:30px;">
1111 <label for="PRIOR_MOTILITYNORMAL" class="input-helper input-helper--checkbox"><?php echo xlt('Normal'); ?></label>
1112 <input disabled id="PRIOR_MOTILITYNORMAL" name="PRIOR_MOTILITYNORMAL" type="checkbox" value="1" <?php
1113 if ($MOTILITYNORMAL > '0') {
1114 echo "checked";
1115 } ?> disabled>
1116 </td>
1117 </tr>
1118 </table>
1119 </div>
1120 <input disabled type="hidden" name="PRIOR_MOTILITY_RS" id="PRIOR_MOTILITY_RS" value="<?php echo attr($MOTILITY_RS); ?>">
1121 <input disabled type="hidden" name="PRIOR_MOTILITY_RI" id="PRIOR_MOTILITY_RI" value="<?php echo attr($MOTILITY_RI); ?>">
1122 <input disabled type="hidden" name="PRIOR_MOTILITY_RR" id="PRIOR_MOTILITY_RR" value="<?php echo attr($MOTILITY_RR); ?>">
1123 <input disabled type="hidden" name="PRIOR_MOTILITY_RL" id="PRIOR_MOTILITY_RL" value="<?php echo attr($MOTILITY_RL); ?>">
1124 <input disabled type="hidden" name="PRIOR_MOTILITY_LS" id="PRIOR_MOTILITY_LS" value="<?php echo attr($MOTILITY_LS); ?>">
1125 <input disabled type="hidden" name="PRIOR_MOTILITY_LI" id="PRIOR_MOTILITY_LI" value="<?php echo attr($MOTILITY_LI); ?>">
1126 <input disabled type="hidden" name="PRIOR_MOTILITY_LR" id="PRIOR_MOTILITY_LR" value="<?php echo attr($MOTILITY_LR); ?>">
1127 <input disabled type="hidden" name="PRIOR_MOTILITY_LL" id="PRIOR_MOTILITY_LL" value="<?php echo attr($MOTILITY_LL); ?>">
1128 <input disabled type="hidden" name="PRIOR_MOTILITY_RRSO" id="PRIOR_MOTILITY_RRSO" value="<?php echo attr($MOTILITY_RRSO); ?>">
1129 <input disabled type="hidden" name="PRIOR_MOTILITY_RLSO" id="PRIOR_MOTILITY_RLSO" value="<?php echo attr($MOTILITY_RLSO); ?>">
1130 <input disabled type="hidden" name="PRIOR_MOTILITY_RRIO" id="PRIOR_MOTILITY_RRIO" value="<?php echo attr($MOTILITY_RRIO); ?>">
1131 <input disabled type="hidden" name="PRIOR_MOTILITY_RLIO" id="PRIOR_MOTILITY_RLIO" value="<?php echo attr($MOTILITY_RLIO); ?>">
1133 <input disabled type="hidden" name="PRIOR_MOTILITY_LRSO" id="PRIOR_MOTILITY_LRSO" value="<?php echo attr($MOTILITY_LRSO); ?>">
1134 <input disabled type="hidden" name="PRIOR_MOTILITY_LLSO" id="PRIOR_MOTILITY_LLSO" value="<?php echo attr($MOTILITY_LLSO); ?>">
1135 <input disabled type="hidden" name="PRIOR_MOTILITY_LRIO" id="PRIOR_MOTILITY_LRIO" value="<?php echo attr($MOTILITY_LRIO); ?>">
1136 <input disabled type="hidden" name="PRIOR_MOTILITY_LLIO" id="PRIOR_MOTILITY_LLIO" value="<?php echo attr($MOTILITY_LLIO); ?>">
1138 <div style="float:left;left:0.4in;text-decoration:underline;"><?php echo xlt('OD{{right eye}}'); ?></div>
1139 <div style="float:right;right:0.4in;text-decoration:underline;"><?php echo xlt('OS{{left eye}}'); ?></div><br />
1140 <div class="divTable" style="background: url(../../forms/<?php echo $form_folder; ?>/images/eom.bmp) no-repeat center center;background-size: 90% 75%;height:0.77in;width:0.71in;padding:1px;margin:6 1 1 2;">
1141 <div class="divRow">
1142 <div class="divCell">&nbsp;</div>
1143 </div>
1144 <div class="divRow">
1145 <div class="divCell"><?php echo $PRIOR_MOTILITY_RRSO_4 ?? ''; ?></div>
1146 <div class="divCell">&nbsp;</div>
1147 <div class="divCell">&nbsp;</div>
1148 <div class="divCell">&nbsp;</div>
1149 <div class="divCell" name="PRIOR_MOTILITY_RS_4_3" id="PRIOR_MOTILITY_RS_4_3">&nbsp;</div>
1150 <div class="divCell" name="PRIOR_MOTILITY_RS_4_1" id="PRIOR_MOTILITY_RS_4_1">&nbsp;</div>
1151 <div class="divCell" name="PRIOR_MOTILITY_RS_4" id="PRIOR_MOTILITY_RS_4"><?php echo $PRIOR_MOTILITY_RS_4 ?? ''; ?></div>
1152 <div class="divCell" name="PRIOR_MOTILITY_RS_4_2" id="PRIOR_MOTILITY_RS_4_2">&nbsp;</div>
1153 <div class="divCell" name="PRIOR_MOTILITY_RS_4_4" id="PRIOR_MOTILITY_RS_4_4">&nbsp;</div>
1154 <div class="divCell">&nbsp;</div>
1155 <div class="divCell">&nbsp;</div>
1156 <div class="divCell">&nbsp;</div>
1157 <div class="divCell"><?php echo $PRIOR_MOTILITY_RLSO_4 ?? ''; ?></div>
1158 </div>
1159 <div class="divRow">
1160 <div class="divCell">&nbsp;</div>
1161 <div class="divCell"><?php echo $PRIOR_MOTILITY_RRSO_3 ?? ''; ?></div>
1162 <div class="divCell">&nbsp;</div>
1163 <div class="divCell">&nbsp;</div>
1164 <div class="divCell">&nbsp;</div>
1165 <div class="divCell" name="PRIOR_MOTILITY_RS_3_1" id="PRIOR_MOTILITY_RS_3_1">&nbsp;</div>
1166 <div class="divCell" name="PRIOR_MOTILITY_RS_3" id="PRIOR_MOTILITY_RS_3"><?php echo $PRIOR_MOTILITY_RS_3 ?? ''; ?></div>
1167 <div class="divCell" name="PRIOR_MOTILITY_RS_3_2" id="PRIOR_MOTILITY_RS_3_2">&nbsp;</div>
1168 <div class="divCell">&nbsp;</div>
1169 <div class="divCell">&nbsp;</div>
1170 <div class="divCell">&nbsp;</div>
1171 <div class="divCell"><?php echo $PRIOR_MOTILITY_RLSO_3 ?? ''; ?></div>
1172 <div class="divCell">&nbsp;</div>
1173 </div>
1174 <div class="divRow">
1175 <div class="divCell">&nbsp;</div>
1176 <div class="divCell">&nbsp;</div>
1177 <div class="divCell"><?php echo $PRIOR_MOTILITY_RRSO_2 ?? ''; ?></div>
1178 <div class="divCell">&nbsp;</div>
1179 <div class="divCell">&nbsp;</div>
1180 <div class="divCell" name="PRIOR_MOTILITY_RS_2_1" id="PRIOR_MOTILITY_RS_2_1">&nbsp;</div>
1181 <div class="divCell" name="PRIOR_MOTILITY_RS_2" id="PRIOR_MOTILITY_RS_2"><?php echo $PRIOR_MOTILITY_RS_2 ?? ''; ?></div>
1182 <div class="divCell" name="PRIOR_MOTILITY_RS_2_2" id="PRIOR_MOTILITY_RS_2_2">&nbsp;</div>
1183 <div class="divCell">&nbsp;</div>
1184 <div class="divCell">&nbsp;</div>
1185 <div class="divCell"><?php echo $PRIOR_MOTILITY_RLSO_2 ?? ''; ?></div>
1186 <div class="divCell">&nbsp;</div>
1187 <div class="divCell">&nbsp;</div>
1188 </div>
1189 <div class="divRow">
1190 <div class="divCell">&nbsp;</div>
1191 <div class="divCell">&nbsp;</div>
1192 <div class="divCell">&nbsp;</div>
1193 <div class="divCell"><?php echo $PRIOR_MOTILITY_RRSO_1 ?? ''; ?></div>
1194 <div class="divCell">&nbsp;</div>
1195 <div class="divCell" name="PRIOR_MOTILITY_RS_1_1" id="PRIOR_MOTILITY_RS_1_1">&nbsp;</div>
1196 <div class="divCell" name="PRIOR_MOTILITY_RS_1" id="PRIOR_MOTILITY_RS_1"><?php echo $PRIOR_MOTILITY_RS_1 ?? ''; ?></div>
1197 <div class="divCell" name="PRIOR_MOTILITY_RS_1_2" id="PRIOR_MOTILITY_RS_1_2">&nbsp;</div>
1198 <div class="divCell">&nbsp;</div>
1199 <div class="divCell"><?php echo $PRIOR_MOTILITY_RLSO_1 ?? ''; ?></div>
1200 <div class="divCell">&nbsp;</div>
1201 <div class="divCell">&nbsp;</div>
1202 <div class="divCell">&nbsp;</div>
1203 </div>
1204 <div class="divRow">
1205 <div class="divCell">&nbsp;</div>
1206 <div class="divCell">&nbsp;</div>
1207 <div class="divCell">&nbsp;</div>
1208 <div class="divCell">&nbsp;</div>
1209 <div class="divCell">&nbsp;</div>
1210 <div class="divCell" name="PRIOR_MOTILITY_RS_0_1" id="PRIOR_MOTILITY_RS_0_1">&nbsp;</div>
1211 <div class="divCell" name="PRIOR_MOTILITY_RS_0" id="PRIOR_MOTILITY_RS_0">&nbsp;</div>
1212 <div class="divCell" name="PRIOR_MOTILITY_RS_0_1" id="PRIOR_MOTILITY_RS_0_1">&nbsp;</div>
1213 <div class="divCell">&nbsp;</div>
1214 <div class="divCell">&nbsp;</div>
1215 <div class="divCell">&nbsp;</div>
1216 <div class="divCell">&nbsp;</div>
1217 <div class="divCell">&nbsp;</div>
1218 </div>
1219 <div class="divMiddleRow">
1220 <div class="divCell">&nbsp;</div>
1221 <div class="divCell" name="PRIOR_MOTILITY_RR_4" id="PRIOR_MOTILITY_RR_4"><?php echo $PRIOR_MOTILITY_RR_4 ?? ''; ?></div>
1222 <div class="divCell" name="PRIOR_MOTILITY_RR_3" id="PRIOR_MOTILITY_RR_3"><?php echo $PRIOR_MOTILITY_RR_3 ?? ''; ?></div>
1223 <div class="divCell" name="PRIOR_MOTILITY_RR_2" id="PRIOR_MOTILITY_RR_2"><?php echo $PRIOR_MOTILITY_RR_2 ?? ''; ?></div>
1224 <div class="divCell" name="PRIOR_MOTILITY_RR_1" id="PRIOR_MOTILITY_RR_1"><?php echo $PRIOR_MOTILITY_RR_1 ?? ''; ?></div>
1225 <div class="divCell" name="PRIOR_MOTILITY_RR_0" id="PRIOR_MOTILITY_RR_0">&nbsp;</div>
1226 <div class="divCell" name="PRIOR_MOTILITY_R0" id="PRIOR_MOTILITY_R0">&nbsp;</div>
1227 <div class="divCell" name="PRIOR_MOTILITY_RL_0" id="PRIOR_MOTILITY_RL_0">&nbsp;</div>
1228 <div class="divCell" name="PRIOR_MOTILITY_RL_1" id="PRIOR_MOTILITY_RL_1"><?php echo $PRIOR_MOTILITY_RL_1 ?? ''; ?></div>
1229 <div class="divCell" name="PRIOR_MOTILITY_RL_2" id="PRIOR_MOTILITY_RL_2"><?php echo $PRIOR_MOTILITY_RL_2 ?? ''; ?></div>
1230 <div class="divCell" name="PRIOR_MOTILITY_RL_3" id="PRIOR_MOTILITY_RL_3"><?php echo $PRIOR_MOTILITY_RL_3 ?? ''; ?></div>
1231 <div class="divCell" name="PRIOR_MOTILITY_RL_4" id="PRIOR_MOTILITY_RL_4"><?php echo $PRIOR_MOTILITY_RL_4 ?? ''; ?></div>
1232 <div class="divCell">&nbsp;</div>
1233 </div>
1234 <div class="divRow">
1235 <div class="divCell">&nbsp;</div>
1236 <div class="divCell">&nbsp;</div>
1237 <div class="divCell">&nbsp;</div>
1238 <div class="divCell">&nbsp;</div>
1239 <div class="divCell">&nbsp;</div>
1240 <div class="divCell" name="PRIOR_MOTILITY_RI_0_1" id="PRIOR_MOTILITY_RI_0_1">&nbsp;</div>
1241 <div class="divCell" id="PRIOR_MOTILITY_RI_0" name="PRIOR_MOTILITY_RI_0">&nbsp;</div>
1242 <div class="divCell" name="PRIOR_MOTILITY_RI_0_2" id="PRIOR_MOTILITY_RI_0_2">&nbsp;</div>
1243 <div class="divCell">&nbsp;</div>
1244 <div class="divCell">&nbsp;</div>
1245 <div class="divCell">&nbsp;</div>
1246 <div class="divCell">&nbsp;</div>
1247 <div class="divCell">&nbsp;</div>
1248 </div>
1249 <div class="divRow">
1250 <div class="divCell">&nbsp;</div>
1251 <div class="divCell">&nbsp;</div>
1252 <div class="divCell">&nbsp;</div>
1253 <div class="divCell"><?php echo $PRIOR_MOTILITY_RRIO_1 ?? ''; ?></div>
1254 <div class="divCell">&nbsp;</div>
1255 <div class="divCell" name="PRIOR_MOTILITY_RI_1_1" id="PRIOR_MOTILITY_RI_1_1">&nbsp;</div>
1256 <div class="divCell" id="PRIOR_MOTILITY_RI_1" name="PRIOR_MOTILITY_RI_1"><?php echo $PRIOR_MOTILITY_RI_1 ?? ''; ?></div>
1257 <div class="divCell" name="PRIOR_MOTILITY_RI_1_2" id="PRIOR_MOTILITY_RI_1_2">&nbsp;</div>
1258 <div class="divCell">&nbsp;</div>
1259 <div class="divCell"><?php echo $PRIOR_MOTILITY_RLIO_1 ?? ''; ?></div>
1260 <div class="divCell">&nbsp;</div>
1261 <div class="divCell">&nbsp;</div>
1262 <div class="divCell">&nbsp;</div>
1263 </div>
1264 <div class="divRow">
1265 <div class="divCell">&nbsp;</div>
1266 <div class="divCell">&nbsp;</div>
1267 <div class="divCell"><?php echo $PRIOR_MOTILITY_RRIO_2 ?? ''; ?></div>
1268 <div class="divCell">&nbsp;</div>
1269 <div class="divCell">&nbsp;</div>
1270 <div class="divCell" name="PRIOR_MOTILITY_RI_2_1" id="PRIOR_MOTILITY_RI_2_1">&nbsp;</div>
1271 <div class="divCell" id="PRIOR_MOTILITY_RI_2" name="PRIOR_MOTILITY_RI_2"><?php echo $PRIOR_MOTILITY_RI_2 ?? ''; ?></div>
1272 <div class="divCell" name="PRIOR_MOTILITY_RI_2_2" id="PRIOR_MOTILITY_RI_2_2">&nbsp;</div>
1273 <div class="divCell">&nbsp;</div>
1274 <div class="divCell">&nbsp;</div>
1275 <div class="divCell"><?php echo $PRIOR_MOTILITY_RLIO_2 ?? ''; ?></div>
1276 <div class="divCell">&nbsp;</div>
1277 <div class="divCell">&nbsp;</div>
1278 </div>
1279 <div class="divRow">
1280 <div class="divCell">&nbsp;</div>
1281 <div class="divCell"><?php echo $PRIOR_MOTILITY_RRIO_3 ?? ''; ?></div>
1282 <div class="divCell">&nbsp;</div>
1283 <div class="divCell" name="PRIOR_MOTILITY_RI_3_5" id="PRIOR_MOTILITY_RI_3_5">&nbsp;</div>
1284 <div class="divCell" name="PRIOR_MOTILITY_RI_3_3" id="PRIOR_MOTILITY_RI_3_3">&nbsp;</div>
1285 <div class="divCell" name="PRIOR_MOTILITY_RI_3_1" id="PRIOR_MOTILITY_RI_3_1">&nbsp;</div>
1286 <div class="divCell" id="PRIOR_MOTILITY_RI_3" name="PRIOR_MOTILITY_RI_3"><?php echo $PRIOR_MOTILITY_RI_3 ?? ''; ?></div>
1287 <div class="divCell" name="PRIOR_MOTILITY_RI_3_2" id="PRIOR_MOTILITY_RI_3_2">&nbsp;</div>
1288 <div class="divCell" name="PRIOR_MOTILITY_RI_3_4" id="PRIOR_MOTILITY_RI_3_4">&nbsp;</div>
1289 <div class="divCell" name="PRIOR_MOTILITY_RI_3_6" id="PRIOR_MOTILITY_RI_3_6">&nbsp;</div>
1290 <div class="divCell">&nbsp;</div>
1291 <div class="divCell"><?php echo $PRIOR_MOTILITY_RLIO_3 ?? ''; ?></div>
1292 <div class="divCell"></div>
1293 </div>
1294 <div class="divRow">
1295 <div class="divCell"><?php echo $PRIOR_MOTILITY_RRIO_4 ?? ''; ?></div>
1296 <div class="divCell">&nbsp;</div>
1297 <div class="divCell">&nbsp;</div>
1298 <div class="divCell" name="PRIOR_MOTILITY_RI_4_5" id="PRIOR_MOTILITY_RI_4_5">&nbsp;</div>
1299 <div class="divCell" name="PRIOR_MOTILITY_RI_4_3" id="PRIOR_MOTILITY_RI_4_3">&nbsp;</div>
1300 <div class="divCell" name="PRIOR_MOTILITY_RI_4_1" id="PRIOR_MOTILITY_RI_4_1">&nbsp;</div>
1301 <div class="divCell" id="PRIOR_MOTILITY_RI_4" name="PRIOR_MOTILITY_RI_4"><?php echo $PRIOR_MOTILITY_RI_4 ?? ''; ?></div>
1302 <div class="divCell" name="PRIOR_MOTILITY_RI_4_2" id="PRIOR_MOTILITY_RI_4_2">&nbsp;</div>
1303 <div class="divCell" name="PRIOR_MOTILITY_RI_4_4" id="PRIOR_MOTILITY_RI_4_4">&nbsp;</div>
1304 <div class="divCell" name="PRIOR_MOTILITY_RI_4_6" id="PRIOR_MOTILITY_RI_4_6">&nbsp;</div>
1305 <div class="divCell">&nbsp;</div>
1306 <div class="divCell">&nbsp;</div>
1307 <div class="divCell"><?php echo $PRIOR_MOTILITY_RLIO_4 ?? ''; ?></div>
1308 </div>
1309 <div class="divRow">
1310 <div class="divCell">&nbsp;</div>
1311 </div>
1312 </div>
1313 <div class="divTable" style="float:right;background: url(../../forms/<?php echo $form_folder; ?>/images/eom.bmp) no-repeat center center;background-size: 90% 75%;height:0.77in;width:0.71in;padding:1px;margin:6 2 0 0;">
1314 <div class="divRow">
1315 <div class="divCell">&nbsp;</div>
1316 </div>
1317 <div class="divRow">
1318 <div class="divCell"><?php echo $PRIOR_MOTILITY_LRSO_4 ?? ''; ?></div>
1319 <div class="divCell">&nbsp;</div>
1320 <div class="divCell">&nbsp;</div>
1321 <div class="divCell">&nbsp;</div>
1322 <div class="divCell" name="PRIOR_MOTILITY_LS_4_3" id="PRIOR_MOTILITY_LS_4_3">&nbsp;</div>
1323 <div class="divCell" name="PRIOR_MOTILITY_LS_4_1" id="PRIOR_MOTILITY_LS_4_1">&nbsp;</div>
1324 <div class="divCell" name="PRIOR_MOTILITY_LS_4" id="PRIOR_MOTILITY_LS_4"><?php echo $PRIOR_MOTILITY_LS_4 ?? ''; ?></div>
1325 <div class="divCell" name="PRIOR_MOTILITY_LS_4_2" id="PRIOR_MOTILITY_LS_4_2">&nbsp;</div>
1326 <div class="divCell" name="PRIOR_MOTILITY_LS_4_4" id="PRIOR_MOTILITY_LS_4_4">&nbsp;</div>
1327 <div class="divCell">&nbsp;</div>
1328 <div class="divCell">&nbsp;</div>
1329 <div class="divCell">&nbsp;</div>
1330 <div class="divCell"><?php echo $PRIOR_MOTILITY_LLSO_4 ?? ''; ?></div>
1331 </div>
1332 <div class="divRow">
1333 <div class="divCell">&nbsp;</div>
1334 <div class="divCell"><?php echo $PRIOR_MOTILITY_LRSO_3 ?? ''; ?></div>
1335 <div class="divCell">&nbsp;</div>
1336 <div class="divCell">&nbsp;</div>
1337 <div class="divCell">&nbsp;</div>
1338 <div class="divCell" name="PRIOR_MOTILITY_LS_3_1" id="PRIOR_MOTILITY_LS_3_1">&nbsp;</div>
1339 <div class="divCell" name="PRIOR_MOTILITY_LS_3" id="PRIOR_MOTILITY_LS_3"><?php echo $PRIOR_MOTILITY_LS_3 ?? ''; ?></div>
1340 <div class="divCell" name="PRIOR_MOTILITY_LS_3_2" id="PRIOR_MOTILITY_LS_3_2">&nbsp;</div>
1341 <div class="divCell">&nbsp;</div>
1342 <div class="divCell">&nbsp;</div>
1343 <div class="divCell">&nbsp;</div>
1344 <div class="divCell"><?php echo $PRIOR_MOTILITY_LLSO_3 ?? ''; ?></div>
1345 <div class="divCell">&nbsp;</div>
1346 </div>
1347 <div class="divRow">
1348 <div class="divCell">&nbsp;</div>
1349 <div class="divCell">&nbsp;</div>
1350 <div class="divCell"><?php echo $PRIOR_MOTILITY_LRSO_2 ?? ''; ?></div>
1351 <div class="divCell">&nbsp;</div>
1352 <div class="divCell">&nbsp;</div>
1353 <div class="divCell" name="PRIOR_MOTILITY_LS_2_1" id="PRIOR_MOTILITY_LS_2_1">&nbsp;</div>
1354 <div class="divCell" name="PRIOR_MOTILITY_LS_2" id="PRIOR_MOTILITY_LS_2"><?php echo $PRIOR_MOTILITY_LS_2 ?? ''; ?></div>
1355 <div class="divCell" name="PRIOR_MOTILITY_LS_2_2" id="PRIOR_MOTILITY_LS_2_2">&nbsp;</div>
1356 <div class="divCell">&nbsp;</div>
1357 <div class="divCell">&nbsp;</div>
1358 <div class="divCell"><?php echo $PRIOR_MOTILITY_LLSO_2 ?? ''; ?></div>
1359 <div class="divCell">&nbsp;</div>
1360 <div class="divCell">&nbsp;</div>
1361 </div>
1362 <div class="divRow">
1363 <div class="divCell">&nbsp;</div>
1364 <div class="divCell">&nbsp;</div>
1365 <div class="divCell">&nbsp;</div>
1366 <div class="divCell"><?php echo $PRIOR_MOTILITY_LRSO_1 ?? ''; ?></div>
1367 <div class="divCell">&nbsp;</div>
1368 <div class="divCell" name="PRIOR_MOTILITY_LS_1_1" id="PRIOR_MOTILITY_LS_1_1">&nbsp;</div>
1369 <div class="divCell" name="PRIOR_MOTILITY_LS_1" id="PRIOR_MOTILITY_LS_1"><?php echo $PRIOR_MOTILITY_LS_1 ?? ''; ?></div>
1370 <div class="divCell" name="PRIOR_MOTILITY_LS_1_2" id="PRIOR_MOTILITY_LS_1_2">&nbsp;</div>
1371 <div class="divCell">&nbsp;</div>
1372 <div class="divCell"><?php echo $PRIOR_MOTILITY_LLSO_1 ?? ''; ?></div>
1373 <div class="divCell">&nbsp;</div>
1374 <div class="divCell">&nbsp;</div>
1375 <div class="divCell">&nbsp;</div>
1376 </div>
1377 <div class="divRow">
1378 <div class="divCell">&nbsp;</div>
1379 <div class="divCell">&nbsp;</div>
1380 <div class="divCell">&nbsp;</div>
1381 <div class="divCell">&nbsp;</div>
1382 <div class="divCell">&nbsp;</div>
1383 <div class="divCell" name="PRIOR_MOTILITY_LS_0_1" id="PRIOR_MOTILITY_LS_0_1">&nbsp;</div>
1384 <div class="divCell" name="PRIOR_MOTILITY_LS_0" id="PRIOR_MOTILITY_LS_0">&nbsp;</div>
1385 <div class="divCell" name="PRIOR_MOTILITY_LS_0_1" id="PRIOR_MOTILITY_LS_0_1">&nbsp;</div>
1386 <div class="divCell">&nbsp;</div>
1387 <div class="divCell">&nbsp;</div>
1388 <div class="divCell">&nbsp;</div>
1389 <div class="divCell">&nbsp;</div>
1390 <div class="divCell">&nbsp;</div>
1391 </div>
1392 <div class="divMiddleRow">
1393 <div class="divCell">&nbsp;</div>
1394 <div class="divCell" name="PRIOR_MOTILITY_LR_4" id="PRIOR_MOTILITY_LR_4"><?php echo $PRIOR_MOTILITY_LR_4 ?? ''; ?></div>
1395 <div class="divCell" name="PRIOR_MOTILITY_LR_3" id="PRIOR_MOTILITY_LR_3"><?php echo $PRIOR_MOTILITY_LR_3 ?? ''; ?></div>
1396 <div class="divCell" name="PRIOR_MOTILITY_LR_2" id="PRIOR_MOTILITY_LR_2"><?php echo $PRIOR_MOTILITY_LR_2 ?? ''; ?></div>
1397 <div class="divCell" name="PRIOR_MOTILITY_LR_1" id="PRIOR_MOTILITY_LR_1"><?php echo $PRIOR_MOTILITY_LR_1 ?? ''; ?></div>
1398 <div class="divCell" name="PRIOR_MOTILITY_LR_0" id="PRIOR_MOTILITY_LR_0">&nbsp;</div>
1399 <div class="divCell" name="PRIOR_MOTILITY_L0" id="PRIOR_MOTILITY_L0">&nbsp;</div>
1400 <div class="divCell" name="PRIOR_MOTILITY_LL_0" id="PRIOR_MOTILITY_LL_0">&nbsp;</div>
1401 <div class="divCell" name="PRIOR_MOTILITY_LL_1" id="PRIOR_MOTILITY_LL_1"><?php echo $PRIOR_MOTILITY_LL_1 ?? ''; ?></div>
1402 <div class="divCell" name="PRIOR_MOTILITY_LL_2" id="PRIOR_MOTILITY_LL_2"><?php echo $PRIOR_MOTILITY_LL_2 ?? ''; ?></div>
1403 <div class="divCell" name="PRIOR_MOTILITY_LL_3" id="PRIOR_MOTILITY_LL_3"><?php echo $PRIOR_MOTILITY_LL_3 ?? ''; ?></div>
1404 <div class="divCell" name="PRIOR_MOTILITY_LL_4" id="PRIOR_MOTILITY_LL_4"><?php echo $PRIOR_MOTILITY_LL_4 ?? ''; ?></div>
1405 <div class="divCell">&nbsp;</div>
1406 </div>
1407 <div class="divRow">
1408 <div class="divCell">&nbsp;</div>
1409 <div class="divCell" name="PRIOR_MOTILITY_LR_4_1" id="PRIOR_MOTILITY_LR_4_1">&nbsp;</div>
1410 <div class="divCell" name="PRIOR_MOTILITY_LR_3_1" id="PRIOR_MOTILITY_LR_3_1">&nbsp;</div>
1411 <div class="divCell" name="PRIOR_MOTILITY_LR_2_1" id="PRIOR_MOTILITY_LR_2_1">&nbsp;</div>
1412 <div class="divCell" name="PRIOR_MOTILITY_RO_I_1" id="PRIOR_MOTILITY_RO_I_1">&nbsp;</div>
1413 <div class="divCell">&nbsp;</div>
1414 <div class="divCell" id="PRIOR_MOTILITY_LI_0" name="PRIOR_MOTILITY_LI_0">&nbsp;</div>
1415 <div class="divCell">&nbsp;</div>
1416 <div class="divCell" name="PRIOR_MOTILITY_LO_I_1" id="PRIOR_MOTILITY_LO_I_1">&nbsp;</div>
1417 <div class="divCell" name="PRIOR_MOTILITY_LL_2_2" id="PRIOR_MOTILITY_LL_2_2">&nbsp;</div>
1418 <div class="divCell" name="PRIOR_MOTILITY_LL_3_2" id="PRIOR_MOTILITY_LL_3_2">&nbsp;</div>
1419 <div class="divCell" name="PRIOR_MOTILITY_LL_4_2" id="PRIOR_MOTILITY_LL_4_2">&nbsp;</div>
1420 <div class="divCell">&nbsp;</div>
1421 </div>
1422 <div class="divRow">
1423 <div class="divCell">&nbsp;</div>
1424 <div class="divCell" name="PRIOR_MOTILITY_LR_4_3" id="PRIOR_MOTILITY_LR_4_3">&nbsp;</div>
1425 <div class="divCell" name="PRIOR_MOTILITY_LR_3_3" id="PRIOR_MOTILITY_LR_3_3">&nbsp;</div>
1426 <div class="divCell" name="PRIOR_MOTILITY_RO_I_2" id="PRIOR_MOTILITY_RO_I_2"><?php echo $PRIOR_MOTILITY_LRIO_1 ?? ''; ?></div>
1427 <div class="divCell">&nbsp;</div>
1428 <div class="divCell">&nbsp;</div>
1429 <div class="divCell" id="PRIOR_MOTILITY_LI_1" name="PRIOR_MOTILITY_LI_1"><?php echo $PRIOR_MOTILITY_LI_1 ?? ''; ?></div>
1430 <div class="divCell">&nbsp;</div>
1431 <div class="divCell">&nbsp;</div>
1432 <div class="divCell" name="PRIOR_MOTILITY_LO_I_2" id="PRIOR_MOTILITY_LO_I_2"><?php echo $PRIOR_MOTILITY_LLIO_1 ?? ''; ?></div>
1433 <div class="divCell" name="PRIOR_MOTILITY_LL_3_4" id="PRIOR_MOTILITY_LL_3_4">&nbsp;</div>
1434 <div class="divCell" name="PRIOR_MOTILITY_LL_4_4" id="PRIOR_MOTILITY_LL_4_4">&nbsp;</div>
1435 <div class="divCell">&nbsp;</div>
1436 </div>
1437 <div class="divRow">
1438 <div class="divCell" name="PRIOR_MOTILITY_RO_I_3_1" id="PRIOR_MOTILITY_RO_I_3_1">&nbsp;</div>
1439 <div class="divCell" name="PRIOR_MOTILITY_RO_I_3" id="PRIOR_MOTILITY_RO_I_3">&nbsp;</div>
1440 <div class="divCell"><?php echo $PRIOR_MOTILITY_LRIO_2 ?? ''; ?></div>
1441 <div class="divCell">&nbsp;</div>
1442 <div class="divCell">&nbsp;</div>
1443 <div class="divCell" name="PRIOR_MOTILITY_LI_2_1" id="PRIOR_MOTILITY_LI_2_1">&nbsp;</div>
1444 <div class="divCell" id="PRIOR_MOTILITY_LI_2" name="PRIOR_MOTILITY_LI_2"><?php echo $PRIOR_MOTILITY_LI_2 ?? ''; ?></div>
1445 <div class="divCell" name="PRIOR_MOTILITY_LI_2_2" id="PRIOR_MOTILITY_LI_2_2">&nbsp;</div>
1446 <div class="divCell">&nbsp;</div>
1447 <div class="divCell">&nbsp;</div>
1448 <div class="divCell"><?php echo $PRIOR_MOTILITY_LLIO_2 ?? ''; ?></div>
1449 <div class="divCell" name="PRIOR_MOTILITY_LO_I_2" id="PRIOR_MOTILITY_RO_I_2">&nbsp;</div>
1450 <div class="divCell" name="PRIOR_MOTILITY_LO_I_3_1" id="PRIOR_MOTILITY_LO_I_3_1">&nbsp;</div>
1451 </div>
1452 <div class="divRow">
1453 <div class="divCell" name="PRIOR_MOTILITY_LO_I_3" id="PRIOR_MOTILITY_RO_I_3">&nbsp;</div>
1454 <div class="divCell"><?php echo $PRIOR_MOTILITY_LRIO_3 ?? ''; ?></div>
1455 <div class="divCell">&nbsp;</div>
1456 <div class="divCell" name="PRIOR_MOTILITY_LI_3_5" id="PRIOR_MOTILITY_LI_3_5">&nbsp;</div>
1457 <div class="divCell" name="PRIOR_MOTILITY_LI_3_3" id="PRIOR_MOTILITY_LI_3_3">&nbsp;</div>
1458 <div class="divCell" name="PRIOR_MOTILITY_LI_3_1" id="PRIOR_MOTILITY_LI_3_1">&nbsp;</div>
1459 <div class="divCell" name="PRIOR_MOTILITY_LI_3" id="PRIOR_MOTILITY_LI_3"><?php echo $PRIOR_MOTILITY_LI_3 ?? ''; ?></div>
1460 <div class="divCell" name="PRIOR_MOTILITY_LI_3_2" id="PRIOR_MOTILITY_LI_3_2">&nbsp;</div>
1461 <div class="divCell" name="PRIOR_MOTILITY_LI_3_4" id="PRIOR_MOTILITY_LI_3_4">&nbsp;</div>
1462 <div class="divCell" name="PRIOR_MOTILITY_LI_3_6" id="PRIOR_MOTILITY_LI_3_6">&nbsp;</div>
1463 <div class="divCell">&nbsp;</div>
1464 <div class="divCell"><?php echo $PRIOR_MOTILITY_LLIO_3 ?? ''; ?></div>
1465 <div class="divCell" name="PRIOR_MOTILITY_LO_I_3" id="PRIOR_MOTILITY_LO_I_3">&nbsp;</div>
1467 </div>
1468 <div class="divRow">
1469 <div class="divCell" name="PRIOR_MOTILITY_RO_I_4" id="PRIOR_MOTILITY_RO_I_4"><?php echo $PRIOR_MOTILITY_LRIO_4 ?? ''; ?></div>
1470 <div class="divCell">&nbsp;</div>
1471 <div class="divCell">&nbsp;</div>
1472 <div class="divCell" name="PRIOR_MOTILITY_LI_4_5" id="PRIOR_MOTILITY_LI_4_5">&nbsp;</div>
1473 <div class="divCell" name="PRIOR_MOTILITY_LI_4_3" id="PRIOR_MOTILITY_LI_4_3">&nbsp;</div>
1474 <div class="divCell" name="PRIOR_MOTILITY_LI_4_1" id="PRIOR_MOTILITY_LI_4_1">&nbsp;</div>
1475 <div class="divCell" id="PRIOR_MOTILITY_LI_4" name="PRIOR_MOTILITY_LI_4"><?php echo $PRIOR_MOTILITY_LI_4 ?? ''; ?></div>
1476 <div class="divCell" name="PRIOR_MOTILITY_LI_4_2" id="PRIOR_MOTILITY_LI_4_2">&nbsp;</div>
1477 <div class="divCell" name="PRIOR_MOTILITY_LI_4_4" id="PRIOR_MOTILITY_LI_4_4">&nbsp;</div>
1478 <div class="divCell" name="PRIOR_MOTILITY_LI_4_6" id="PRIOR_MOTILITY_LI_4_6">&nbsp;</div>
1479 <div class="divCell">&nbsp;</div>
1480 <div class="divCell">&nbsp;</div>
1481 <div class="divCell" name="PRIOR_MOTILITY_LO_I_4" id="PRIOR_MOTILITY_LO_I_4"><?php echo $PRIOR_MOTILITY_LLIO_4 ?? ''; ?></div>
1482 </div>
1483 <div class="divRow"><div class="divCell">&nbsp;</div>
1484 </div>
1485 </div>
1486 </div>
1487 </div>
1488 <br />
1489 <div class="QP_lengthen">
1490 <span style="font-weight:bold;"><?php echo xlt('Comments'); ?>:</span>
1491 <br />
1492 <textarea disabled id="PRIOR_NEURO_COMMENTS" name="PRIOR_NEURO_COMMENTS"><?php echo text($NEURO_COMMENTS); ?></textarea>
1493 </div>
1494 <input type="hidden" name="PRIOR_PREFS_ACT_SHOW" id="PRIOR_PREFS_ACT_SHOW" value="<?php echo attr($ACT_SHOW ?? ''); ?>">
1496 <script>
1497 $("#PRIOR_ACTTRIGGER").mouseover(function() {
1498 $("#PRIOR_ACTTRIGGER").toggleClass('buttonRefraction_selected').toggleClass('underline');
1500 $("#PRIOR_ACTTRIGGER").mouseout(function() {
1501 $("#PRIOR_ACTTRIGGER").toggleClass('buttonRefraction_selected').toggleClass('underline');
1503 $("#PRIOR_ACTTRIGGER").click(function() {
1504 $("#PRIOR_ACTMAIN").toggleClass('nodisplay'); //.toggleClass('fullscreen');
1505 $("#PRIOR_NPCNPA").toggleClass('nodisplay');
1506 $("#PRIOR_ACTNORMAL_CHECK").toggleClass('nodisplay');
1507 $("#PRIOR_ACTTRIGGER").toggleClass('underline');
1508 $("#PRIOR_Close_ACTMAIN").toggleClass('fa-random').toggleClass('fa-eye');
1510 $("[name^='PRIOR_ACT_tab_']").click(function() {
1511 var section = this.id.match(/PRIOR_ACT_tab_(.*)/)[1];
1512 $("[name^='PRIOR_ACT_']").addClass('nodisplay');
1513 $("[name^='PRIOR_ACT_tab_']").removeClass('nodisplay').removeClass('ACT_selected').addClass('ACT_deselected');
1514 $("#PRIOR_ACT_tab_" + section).addClass('ACT_selected').removeClass('ACT_deselected');
1515 $("#PRIOR_ACT_" + section).removeClass('nodisplay');
1516 $("#PRIOR_PREFS_ACT_SHOW").val(section);
1519 $("[name^='PRIOR_Close_']").click(function() {
1520 var section = this.id.match(/PRIOR_Close_(.*)$/)[1];
1521 if (section =="ACTMAIN") {
1522 $("#PRIOR_ACTTRIGGER").trigger( "click" );
1523 } else {
1524 $("#LayerVision_"+section+"_lightswitch").click();
1527 if ($("#PREFS_ACT_VIEW").val() == '1') {
1528 $("#PRIOR_ACTMAIN").toggleClass('nodisplay');
1529 $("#PRIOR_NPCNPA").toggleClass('nodisplay');
1530 $("#PRIOR_ACTNORMAL_CHECK").toggleClass('nodisplay');
1531 $("#PRIOR_ACTTRIGGER").toggleClass('underline');
1532 var show = $("#PREFS_ACT_SHOW").val();
1533 $("#PRIOR_ACT_tab_"+show).trigger('click');
1535 </script>
1536 <?php
1537 } elseif ($zone == "IMPPLAN") {
1538 if ($report == '0') {
1539 $output = priors_select($zone, $orig_id, $id_to_show, $pid);
1542 <input disabled type="hidden" id="PRIORS_<?php echo attr($zone); ?>_prefix" name="PRIORS_<?php echo attr($zone); ?>_prefix" value="">
1543 <span class="closeButton float-right fas fa-times" id="Close_PRIORS_<?php echo attr($zone); ?>" name="Close_PRIORS_<?php echo attr($zone); ?>"></span>
1544 <div name="prior_selector" class="PRIORS">
1545 <?php
1546 echo $output;
1548 </div>
1549 <span style="font-weight:bold;"> <?php echo xlt('Prior IMP/PLAN'); ?>:</span>
1550 <br />
1551 <?php
1552 $PRIOR_IMPPLAN_items = build_IMPPLAN_items($pid, $id_to_show);
1554 if ($PRIOR_IMPPLAN_items) {
1555 echo "<br /><br /><div style='width:90%;'>";
1556 $i = '0';
1557 $k = '1';
1558 foreach ($PRIOR_IMPPLAN_items as $item) {
1559 echo "<div class='IMPPLAN_class' style='clear:both;margin:10px;'>";
1560 echo " <span>$k. " . text($item['title']) . "</span><span class='float-right'>" . $item['code'] . "</span><br />";
1561 echo ' <div class="fake-textarea-disabled-4">' . nl2br(text($item['plan'])) . '</div>';
1562 echo '</div>';
1563 $i++;
1564 $k++;
1567 echo "</div>";
1569 } elseif ($zone == "ALL") {
1570 echo $selector = priors_select($zone, $orig_id, $id_to_show, $pid);
1571 } elseif ($zone == "PMSFH") {
1572 // Check authorization.
1573 if (AclMain::aclCheckCore('patients', 'med')) {
1574 $tmp = getPatientData($pid);
1577 // We are going to build the PMSFH panel.
1578 // There are two rows in our panel.
1579 echo "<div style='height:auto;'>";
1580 echo $display_PMSFH = display_PMSFH('2');
1581 echo "</div>";
1584 $output = ob_get_contents();
1586 ob_end_clean();
1587 return $output;
1591 * Function to prepare for sending the PMSFH_panel and PMSFH_right_panel
1592 * via display_PMSFH('2') and show_PMSFH_panel($PMSFH) respectively,
1593 * to javascript to display changes to the user.
1594 * @param associative array $PMSFH if it exists
1595 * @return json encoded string
1597 function send_json_values($PMSFH = "")
1599 global $pid;
1600 global $form_id;
1601 if (!$PMSFH) {
1602 build_PMSFH();
1605 $send['PMSFH'] = $PMSFH[0]; //actual array
1606 $send['PMH_panel'] = display_PMSFH('2');//display PMSFH next to the PMSFH Builder
1607 $send['right_panel'] = show_PMSFH_panel($PMSFH);//display PMSFH in a slidable right-sided panel
1608 $send['IMPPLAN_items'] = build_IMPPLAN_items($pid, $form_id);
1609 echo json_encode($send);
1613 * This function builds the complete PMSFH array for a given patient, including the ROS for this encounter.
1615 * It returns the PMSFH array to be used to display it anyway you like.
1616 * Currently it is used to display the expanded PMSFH 3 ways:
1617 * in the Quick Pick square;
1618 * as a persistent/hideable Right Panel;
1619 * and in the Printable Report form.
1620 * For other specialties, breaking out subtypes of surgeries, meds and
1621 * medical_problems should be done here by defining new ISSUE_TYPES which are subcategories of the current
1622 * ISSUE_TYPES medical_problem, surgery and medication. This way we do not change the base install ISSUE_TYPES,
1623 * we merely extend them through subcategorization, allowing the reporting features built in for MU1/2/3/100?
1624 * to function at their base level.
1626 * @param string $pid is the patient identifier
1627 * @return $PMSFH array, access items as $PMSFH[0]
1629 function build_PMSFH($pid)
1631 global $form_id;
1633 $PMSFH = [];
1634 $PMSFH['CHRONIC'] = [];
1635 //Define the PMSFH array elements as you need them:
1636 $PMSFH_labels = array("POH", "POS", "Eye Meds", "PMH", "Surgery", "Medication", "Allergy", "SOCH", "FH", "ROS");
1637 foreach ($PMSFH_labels as $panel_type) {
1638 $PMSFH[$panel_type] = [];
1639 $subtype = " and (subtype is NULL or subtype ='' )";
1640 $order = "ORDER BY title";
1641 if ($panel_type == "FH" || $panel_type == "SOCH" || $panel_type == "ROS") {
1643 * We are going to build SocHx, FH and ROS separately below since they don't feed off of
1644 * the pre-existing ISSUE_TYPE array - so for now do nothing
1646 continue;
1647 } elseif ($panel_type == 'POH') {
1648 $focusISSUE = "medical_problem"; //openEMR ISSUE_TYPE
1649 $subtype = " and subtype ='eye'";
1650 /* This is an "eye" form: providers would like ophthalmic medical problems listed separately.
1651 * Thus we split the ISSUE_TYPE 'medical_problem' using subtype "eye"
1652 * but it could be "GYN", "ONC", "GU" etc - for whoever wants to
1653 * extend this for their own specific "sub"-lists.
1654 * Similarly, consider Past Ocular Surgery, or Past GYN Surgery, etc for specialty-specific
1655 * surgery lists. They would be subtypes of the ISSUE_TYPE 'surgery'...
1656 * eg.
1657 * if ($panel_type =='POS') { //Past Ocular Surgery
1658 * $focusISSUE = "surgery";
1659 * $subtype=" and subtype ='eye'";
1661 * The concept is extensible to sub lists for Allergies & Medications too.
1662 * eg.
1663 * if ($panel_type =='OncMeds') {
1664 * $focusISSUE = "medication";
1665 * $subtype=" and subtype ='onc'";
1668 } elseif ($panel_type == 'POS') {
1669 $focusISSUE = "surgery"; //openEMR ISSUE_TYPE
1670 $subtype = " and subtype ='eye'";
1671 } elseif ($panel_type == 'PMH') {
1672 $focusISSUE = "medical_problem"; //openEMR ISSUE_TYPE
1673 $subtype = " and (subtype = '' OR subtype IS NULL)"; //fee_sheet makes subtype=
1674 } elseif ($panel_type == 'Surgery') {
1675 $focusISSUE = "surgery"; //openEMR ISSUE_TYPE
1676 $subtype = " and (subtype = '' OR subtype IS NULL)";
1677 $order = "ORDER BY begdate DESC";
1678 } elseif ($panel_type == 'Allergy') {
1679 $focusISSUE = "allergy"; //openEMR ISSUE_TYPE
1680 $subtype = "";
1681 } elseif ($panel_type == 'Medication') {
1682 $focusISSUE = "medication"; //openEMR ISSUE_TYPE
1683 $subtype = "";
1684 } elseif ($panel_type == 'Eye Meds') {
1685 $focusISSUE = "medication"; //openEMR ISSUE_TYPE
1686 $subtype = "and subtype = 'eye'";// and subtype ='eye' ";
1689 $pres = sqlStatement("SELECT * FROM lists WHERE pid = ? AND type = ? " .
1690 $subtype . " " . $order, array($pid,$focusISSUE));
1691 $row_counter = '0';
1692 while ($row = sqlFetchArray($pres)) {
1693 $rowid = $row['id'];
1694 $disptitle = text(trim($row['title'])) ? text($row['title']) : "[" . xlt("Missing Title") . "]";
1695 // look up the diag codes
1696 $codetext = "";
1697 $codedesc = "";
1698 $codetype = "";
1699 $code = "";
1700 if ($row['diagnosis'] != "") {
1701 $diags = explode(";", $row['diagnosis']);
1702 foreach ($diags as $diag) {
1703 $codedesc = lookup_code_descriptions($diag);
1704 list($codetype, $code) = explode(':', $diag);
1705 $order = array("\r\n", "\n","\r");
1706 $codedesc = str_replace($order, '', $codedesc);
1707 $codetext .= text($diag) . " (" . text($codedesc) . ")";
1711 // calculate the status
1712 if ($row['outcome'] == "1" && $row['enddate'] != null) {
1713 // Resolved
1714 $statusCompute = generate_display_field(array('data_type' => '1','list_id' => 'outcome'), $row['outcome']);
1715 } elseif ($row['enddate'] == null) {
1716 $statusCompute = xlt("Active");
1717 } else {
1718 $statusCompute = xlt("Inactive");
1721 ($row['comments'] != null) ? ($comments = $row['comments']) : ($comments = "");
1722 $counter_here = count($PMSFH[$panel_type]);
1723 $newdata = array (
1724 'title' => $disptitle,
1725 'status' => $statusCompute,
1726 'begdate' => $row['begdate'],
1727 'enddate' => $row['enddate'],
1728 'returndate' => $row['returndate'],
1729 'occurrence' => $row['occurrence'],
1730 'classification' => $row['classification'],
1731 'referredby' => $row['referredby'],
1732 'extrainfo' => $row['extrainfo'],
1733 'diagnosis' => $row['diagnosis'],
1734 'activity' => $row['activity'],
1735 'code' => $code,
1736 'codedesc' => $codedesc,
1737 'codetext' => $codetext,
1738 'codetype' => $codetype,
1739 'comments' => $comments,
1740 'issue' => $row['id'],
1741 'rowid' => $row['id'],
1742 'row_type' => $row['type'],
1743 'row_subtype' => $row['subtype'],
1744 'user' => $row['user'],
1745 'groupname' => $row['groupname'],
1746 'outcome' => $row['outcome'],
1747 'destination' => $row['destination'],
1748 'reinjury_id' => $row['reinjury_id'],
1749 'injury_part' => $row['injury_part'],
1750 'injury_type' => $row['injury_type'],
1751 'injury_grade' => $row['injury_grade'],
1752 'reaction' => $row['reaction'],
1753 'external_allergyid' => $row['external_allergyid'],
1754 'erx_source' => $row['erx_source'],
1755 'erx_uploaded' => $row['erx_uploaded'],
1756 'modifydate' => $row['modifydate'],
1757 'PMSFH_link' => $panel_type . "_" . $row_counter
1759 //let the end user decide on display elsewhere... This is all about the array itself.
1760 $PMSFH[$panel_type][] = $newdata;
1761 if ($row['occurrence'] == '4') {
1762 $PMSFH['CHRONIC'][] = $newdata;
1765 $row_counter++;
1769 //Build the SocHx portion of $PMSFH for this patient.
1770 //$given ="coffee,tobacco,alcohol,sleep_patterns,exercise_patterns,seatbelt_use,counseling,hazardous_activities,recreational_drugs";
1771 $result1 = sqlQuery("select * from history_data where pid=? order by date DESC limit 0,1", array($pid));
1773 $group_fields_query = sqlStatement("SELECT * FROM layout_options " .
1774 "WHERE form_id = 'HIS' AND group_id = '4' AND uor > 0 " .
1775 "ORDER BY seq");
1776 $PMSFH['SOCH'] = [];
1777 while ($group_fields = sqlFetchArray($group_fields_query)) {
1778 $titlecols = $group_fields['titlecols'];
1779 $datacols = $group_fields['datacols'];
1780 $data_type = $group_fields['data_type'];
1781 $field_id = $group_fields['field_id'];
1782 $list_id = $group_fields['list_id'];
1783 $currvalue = '';
1784 if ((preg_match("/^\|?0\|?\|?/", ($result1[$field_id] ?? ''))) || ($result1[$field_id] == '')) {
1785 continue;
1786 } else {
1787 $currvalue = $result1[$field_id];
1789 $PMSFH['SOCH'][$field_id] = [];
1790 if ($data_type == 28 || $data_type == 32) {
1791 $tmp = explode('|', $currvalue);
1792 switch (count($tmp)) {
1793 case "4":
1794 $PMSFH['SOCH'][$field_id]['resnote'] = $tmp[0];
1795 $PMSFH['SOCH'][$field_id]['restype'] = $tmp[1];
1796 $PMSFH['SOCH'][$field_id]['resdate'] = $tmp[2];
1797 $PMSFH['SOCH'][$field_id]['reslist'] = $tmp[3];
1798 break;
1799 case "3":
1800 $PMSFH['SOCH'][$field_id]['resnote'] = $tmp[0];
1801 $PMSFH['SOCH'][$field_id]['restype'] = $tmp[1];
1802 $PMSFH['SOCH'][$field_id]['resdate'] = $tmp[2];
1803 break;
1804 case "2":
1805 $PMSFH['SOCH'][$field_id]['resnote'] = $tmp[0];
1806 $PMSFH['SOCH'][$field_id]['restype'] = $tmp[1];
1807 $PMSFH['SOCH'][$field_id]['resdate'] = "";
1808 break;
1809 case "1":
1810 $PMSFH['SOCH'][$field_id]['resnote'] = $tmp[0];
1811 $PMSFH['SOCH'][$field_id]['resdate'] = $PMSFH['SOCH'][$field_id]['restype'] = "";
1812 break;
1813 default:
1814 $PMSFH['SOCH'][$field_id]['restype'] = $PMSFH['SOCH'][$field_id]['resdate'] = $PMSFH['SOCH'][$field_id]['resnote'] = "";
1815 break;
1818 $PMSFH['SOCH'][$field_id]['resnote'] = text($PMSFH['SOCH'][$field_id]['resnote']);
1819 $PMSFH['SOCH'][$field_id]['resdate'] = text($PMSFH['SOCH'][$field_id]['resdate']);
1820 } elseif ($data_type == 2) {
1821 $PMSFH['SOCH'][$field_id]['resnote'] = nl2br(htmlspecialchars($currvalue, ENT_NOQUOTES));
1824 if ($PMSFH['SOCH'][$field_id]['resnote'] > '') {
1825 $PMSFH['SOCH'][$field_id]['display'] = substr($PMSFH['SOCH'][$field_id]['resnote'], 0, 10);
1826 } elseif ($PMSFH['SOCH'][$field_id]['restype']) {
1827 $PMSFH['SOCH'][$field_id]['display'] = str_replace($field_id, '', $PMSFH['SOCH'][$field_id]['restype']);
1830 //coffee,tobacco,alcohol,sleep_patterns,exercise_patterns,seatbelt_use,counseling,hazardous_activities,recreational_drugs
1831 if ($field_id == "coffee") {
1832 $PMSFH['SOCH'][$field_id]['short_title'] = xlt("Caffeine");
1835 if ($field_id == "tobacco") {
1836 $PMSFH['SOCH'][$field_id]['short_title'] = xlt("Cigs");
1839 if ($field_id == "alcohol") {
1840 $PMSFH['SOCH'][$field_id]['short_title'] = xlt("ETOH");
1843 if ($field_id == "sleep_patterns") {
1844 $PMSFH['SOCH'][$field_id]['short_title'] = xlt("Sleep");
1847 if ($field_id == "exercise_patterns") {
1848 $PMSFH['SOCH'][$field_id]['short_title'] = xlt("Exercise");
1851 if ($field_id == "seatbelt_use") {
1852 $PMSFH['SOCH'][$field_id]['short_title'] = xlt("Seatbelt");
1855 if ($field_id == "counseling") {
1856 $PMSFH['SOCH'][$field_id]['short_title'] = xlt("Therapy");
1859 if ($field_id == "hazardous_activities") {
1860 $PMSFH['SOCH'][$field_id]['short_title'] = xlt("Thrills");
1863 if ($field_id == "recreational_drugs") {
1864 $PMSFH['SOCH'][$field_id]['short_title'] = xlt("Drug Use");
1868 // Drag in Marital status and Employment history to this Social Hx area.
1869 $patient = getPatientData($pid, "*");
1870 $PMSFH['SOCH']['marital_status'] = [];
1871 $PMSFH['SOCH']['occupation'] = [];
1872 $PMSFH['SOCH']['marital_status']['short_title'] = xlt("Marital");
1873 $PMSFH['SOCH']['marital_status']['display'] = text($patient['status']);
1874 $PMSFH['SOCH']['occupation']['short_title'] = xlt("Occupation");
1875 $PMSFH['SOCH']['occupation']['display'] = text($patient['occupation']);
1878 // Build the FH portion of $PMSFH,$PMSFH['FH']
1879 // history_mother history_father history_siblings history_offspring history_spouse
1880 // relatives_cancer relatives_tuberculosis relatives_diabetes relatives_high_blood_pressure relatives_heart_problems relatives_stroke relatives_epilepsy relatives_mental_illness relatives_suicide
1881 // There are two ways FH is stored in the history area, one on a specific relationship basis
1882 // ie. parent,sibling, offspring has X, or the other by "relatives_disease" basis.
1883 // Hmmm, neither really meets our needs. This is an eye form; we do a focused family history.
1884 // Cataracts, glaucoma, AMD, RD, cancer, heart disease etc.
1885 // The openEMR people who want to adapt this for another specialty will no doubt
1886 // have different diseases they want listed in the FH specifically. We all need to be able to
1887 // adjust the form. Perhaps we should use the UserDefined fields at the end of this history_data table?
1888 // Question 1. is, does anything use this family history data - any higher function like reporting?
1889 // Also 2., if there is an engine to validate level of exam, how do we tell it that this was completed?
1890 // First we would need to know the criteria this engine looks for and I don't think in reality there is anything
1891 // written yet that does validate exams for coding level, so maybe we should create a flag in the user defined area of the history_data
1892 // table to notate that the FH portion of the exam was completed? TBD.
1894 Cancer: Tuberculosis:
1895 Diabetes: High Blood Pressure:
1896 Heart Problems: Stroke:
1897 Epilepsy: Mental Illness:
1898 Suicide:
1900 $group_fields_query = sqlStatement("SELECT * FROM layout_options " .
1901 "WHERE form_id = 'HIS' AND group_id = '3' AND uor > 0 " .
1902 "ORDER BY seq");
1903 while ($group_fields = sqlFetchArray($group_fields_query)) {
1904 $titlecols = $group_fields['titlecols'];
1905 $datacols = $group_fields['datacols'];
1906 $data_type = $group_fields['data_type'];
1907 $field_id = $group_fields['field_id'];
1908 $list_id = $group_fields['list_id'];
1909 $currvalue = '';
1910 if ((preg_match("/^\|?0\|?\|?/", ($result1[$field_id] ?? ''))) || ($result1[$field_id] == '')) {
1911 continue;
1912 } else {
1913 $currvalue = $result1[$field_id];
1916 $PMSFH['FH'][$field_id]['resnote'] = nl2br(htmlspecialchars($currvalue, ENT_NOQUOTES));
1917 if ($PMSFH['FH'][$field_id]['resnote'] > '') {
1918 $PMSFH['FH'][$field_id]['display'] = substr($PMSFH['FH'][$field_id]['resnote'], 0, 100);
1919 } elseif ($PMSFH['FH'][$field_id]['restype']) {
1920 $PMSFH['FH'][$field_id]['display'] = str_replace($field_id, '', $PMSFH['FH'][$field_id]['restype']);
1921 } else {
1922 $PMSFH['FH'][$field_id]['display'] = xlt("denies");
1925 //coffee,tobacco,alcohol,sleep_patterns,exercise_patterns,seatbelt_use,counseling,hazardous_activities,recreational_drugs
1926 if ($field_id == "relatives_cancer") {
1927 $PMSFH['FH'][$field_id]['short_title'] = xlt("Cancer");
1930 if ($field_id == "relatives_diabetes") {
1931 $PMSFH['FH'][$field_id]['short_title'] = xlt("Diabetes");
1934 if ($field_id == "relatives_high_blood_pressure") {
1935 $PMSFH['FH'][$field_id]['short_title'] = xlt("HTN{{hypertension}}");
1938 if ($field_id == "relatives_heart_problems") {
1939 $PMSFH['FH'][$field_id]['short_title'] = xlt("Cor Disease");
1942 if ($field_id == "relatives_epilepsy") {
1943 $PMSFH['FH'][$field_id]['short_title'] = xlt("Epilepsy");
1946 if ($field_id == "relatives_mental_illness") {
1947 $PMSFH['FH'][$field_id]['short_title'] = xlt("Psych");
1950 if ($field_id == "relatives_suicide") {
1951 $PMSFH['FH'][$field_id]['short_title'] = xlt("Suicide");
1954 if ($field_id == "relatives_stroke") {
1955 $PMSFH['FH'][$field_id]['short_title'] = xlt("Stroke");
1958 if ($field_id == "relatives_tuberculosis") {
1959 $PMSFH['FH'][$field_id]['short_title'] = xlt("TB");
1963 // Now make some of our own using the usertext11-30 fields
1964 // These can be customized for specialties but remember this is just an array,
1965 // you will need to check the code re: how it is displayed elsewhere...
1966 // For now, just changing the short_titles will display intelligently
1967 // but it is best to change both in the long run.
1968 // $PMSFH['FH']['my_term']['display'] = (substr($result1['usertext11'],0,10));
1969 // $PMSFH['FH']['my_term']['short_title'] = xlt("My Term");
1971 $PMSFH['FH']['glaucoma']['display'] = (substr($result1['usertext11'] ?? '', 0, 100));
1972 $PMSFH['FH']['glaucoma']['short_title'] = xlt("Glaucoma");
1973 $PMSFH['FH']['cataract']['display'] = (substr($result1['usertext12'], 0, 100));
1974 $PMSFH['FH']['cataract']['short_title'] = xlt("Cataract");
1975 $PMSFH['FH']['amd']['display'] = (substr($result1['usertext13'], 0, 100));
1976 $PMSFH['FH']['amd']['short_title'] = xlt("AMD{{age related macular degeneration}}");
1977 $PMSFH['FH']['RD']['display'] = (substr($result1['usertext14'], 0, 100));
1978 $PMSFH['FH']['RD']['short_title'] = xlt("RD{{retinal detachment}}");
1979 $PMSFH['FH']['blindness']['display'] = (substr($result1['usertext15'], 0, 100));
1980 $PMSFH['FH']['blindness']['short_title'] = xlt("Blindness");
1981 $PMSFH['FH']['amblyopia']['display'] = (substr($result1['usertext16'], 0, 100));
1982 $PMSFH['FH']['amblyopia']['short_title'] = xlt("Amblyopia");
1983 $PMSFH['FH']['strabismus']['display'] = (substr($result1['usertext17'], 0, 100));
1984 $PMSFH['FH']['strabismus']['short_title'] = xlt("Strabismus");
1985 $PMSFH['FH']['other']['display'] = (substr($result1['usertext18'], 0, 100));
1986 $PMSFH['FH']['other']['short_title'] = xlt("Other");
1988 // Thinking this might be a good place to put in last_retinal exam and last_HbA1C?
1989 // I don't know enough about the reporting parameters - it is probably some alreay in openEMR?
1990 // Pull it in if it is and put it where?
1991 // $PMSFH['SOCH'][$field_id]['resnote'] = nl2br(htmlspecialchars($currvalue,ENT_NOQUOTES));
1993 // Build ROS into $PMSFH['ROS'] also for this patient.
1994 // ROS is not static and is directly linked to each encounter
1995 // True it could be a separate table, but it is currently in form_eye_mag for each visit
1996 // To use this for any other forms, we should consider making this its own separate table with id,pid and ?encounter link,
1997 // just like we are doing for Impression Plan. Mybe we can piggybak onto one of the ROS tables already in OpenEMR?
1999 //define the ROS area to include = $given
2000 $given = "ROSGENERAL,ROSHEENT,ROSCV,ROSPULM,ROSGI,ROSGU,ROSDERM,ROSNEURO,ROSPSYCH,ROSMUSCULO,ROSIMMUNO,ROSENDOCRINE,ROSCOMMENTS";
2001 $ROS_table = "form_eye_ros";
2002 $query = "SELECT $given from " . $ROS_table . " where id = ?";
2004 $ROS = sqlStatement($query, array($form_id));
2005 while ($row = sqlFetchArray($ROS)) {
2006 foreach (explode(',', $given) as $item) {
2007 $PMSFH['ROS'][$item]['display'] = $row[$item];
2011 // translator will need to translate each item in $given
2012 $PMSFH['ROS']['ROSGENERAL']['short_title'] = xlt("GEN{{General}}");
2013 $PMSFH['ROS']['ROSHEENT']['short_title'] = xlt("HEENT");
2014 $PMSFH['ROS']['ROSCV']['short_title'] = xlt("CV{{Cardiovascular}}");
2015 $PMSFH['ROS']['ROSPULM']['short_title'] = xlt("PULM{{Pulmonary}}");
2016 $PMSFH['ROS']['ROSGI']['short_title'] = xlt("GI{{Gastrointestinal}}");
2017 $PMSFH['ROS']['ROSGU']['short_title'] = xlt("GU{{Genitourinary}}");
2018 $PMSFH['ROS']['ROSDERM']['short_title'] = xlt("DERM{{Dermatology}}");
2019 $PMSFH['ROS']['ROSNEURO']['short_title'] = xlt("NEURO{{Neurology}}");
2020 $PMSFH['ROS']['ROSPSYCH']['short_title'] = xlt("PSYCH{{Psychiatry}}");
2021 $PMSFH['ROS']['ROSMUSCULO']['short_title'] = xlt("ORTHO{{Orthopedics}}");
2022 $PMSFH['ROS']['ROSIMMUNO']['short_title'] = xlt("IMMUNO{{Immunology/Rheumatology}}");
2023 $PMSFH['ROS']['ROSENDOCRINE']['short_title'] = xlt("ENDO{{Endocrine}}");
2024 $PMSFH['ROS']['ROSCOMMENTS']['short_title'] = xlt("Comments");
2026 $PMSFH['ROS']['ROSGENERAL']['title'] = xlt("General");
2027 $PMSFH['ROS']['ROSHEENT']['title'] = xlt("HEENT");
2028 $PMSFH['ROS']['ROSCV']['title'] = xlt("Cardiovascular");
2029 $PMSFH['ROS']['ROSPULM']['title'] = xlt("Pulmonary");
2030 $PMSFH['ROS']['ROSGI']['title'] = xlt("GI{{Gastrointestinal}}");
2031 $PMSFH['ROS']['ROSGU']['title'] = xlt("GU{{Genitourinary}}");
2032 $PMSFH['ROS']['ROSDERM']['title'] = xlt("Dermatology");
2033 $PMSFH['ROS']['ROSNEURO']['title'] = xlt("Neurology");
2034 $PMSFH['ROS']['ROSPSYCH']['title'] = xlt("Pyschiatry");
2035 $PMSFH['ROS']['ROSMUSCULO']['title'] = xlt("Musculoskeletal");
2036 $PMSFH['ROS']['ROSIMMUNO']['title'] = xlt("Immune System");
2037 $PMSFH['ROS']['ROSENDOCRINE']['title'] = xlt("Endocrine");
2038 $PMSFH['ROS']['ROSCOMMENTS']['title'] = xlt("Comments");
2040 return array($PMSFH); //yowsah!
2043 * This function uses the complete PMSFH array for a given patient, including the ROS for this encounter
2044 * and returns the PMSFH display square.
2045 * @param integer rows is the number of rows you want to display
2046 * @param option string view defaults to white on beige, versus right sliding panel (text on beige only).
2047 * @param option string min_height to set min height for the row
2048 * @return $display_PMSFH HTML pane when PMSFH is expanded to two panes.
2050 function display_PMSFH($rows, $view = "pending", $min_height = "min-height:344px;")
2052 global $PMSFH;
2053 global $pid;
2054 global $PMSFH_titles;
2055 if (!($PMFSH ?? '')) {
2056 $PMSFH = build_PMSFH($pid);
2059 ob_start();
2060 // There are two rows in our PMH section, only one in the side panel.
2061 // If you want it across the bottom in a panel with 8 rows? Or other wise?
2062 // This should be able to handle that too.
2064 // We are building the PMSFH panel.
2065 // Let's put half in each of the 2 rows... or try to at least.
2066 // Find out the number of items present now and put half in each column.
2067 foreach ($PMSFH[0] as $key => $value) {
2068 if (!empty($total_PMSFH)) {
2069 $total_PMSFH += count($PMSFH[0][$key]);
2070 $total_PMSFH += 2; //add two for the title and a space
2071 } else {
2072 $total_PMSFH = count($PMSFH[0][$key]);
2073 $total_PMSFH = 2; //add two for the title and a space
2075 $count[$key] = count($PMSFH[0][$key]) + 1;
2078 //SOCH, FH and ROS are listed in $PMSFH even if negative, only count positives
2079 foreach ($PMSFH[0]['ROS'] as $key => $value) {
2080 if (empty($value['display'])) {
2081 if (!empty($total_PMSFH)) {
2082 $total_PMSFH--;
2084 $count['ROS']--;
2088 foreach ($PMSFH[0]['FH'] as $key => $value) {
2089 if ($value['display'] == '') {
2090 if (!empty($total_PMSFH)) {
2091 $total_PMSFH--;
2092 } else {
2093 $total_PMSFH = 0;
2095 $count['FH']--;
2099 foreach ($PMSFH[0]['SOCH'] as $key => $value) {
2100 if (($value['display'] == '') || (($item['display'] ?? '') == 'not_applicable')) {
2101 $total_PMSFH--;
2102 $count['SOCH']--;
2106 $counter = "0";
2107 $column_max = round(($total_PMSFH ?? null) / $rows) + 1;
2108 if ($column_max < "25") {
2109 $column_max = '20';
2112 $open_table = "<div style='float:left' class='table PMSFH_table'>";
2113 $close_table = "</div>";
2114 // $div is used when $counter reaches $column_max and a new row is needed.
2115 // It is used only if $row_count <= $rows, ie. $rows -1 times.
2116 $div = '</div>
2117 <div id="PMSFH_block_2" name="PMSFH_block_2" class="QP_block_outer borderShadow text_clinical" style="' . attr($min_height) . '">';
2119 echo $header = '
2120 <div id="PMSFH_block_1" name="PMSFH_block_1" class="QP_block borderShadow text_clinical" style="' . attr($min_height) . ';">
2122 $row_count = 1;
2124 foreach ($PMSFH[0] as $key => $value) {
2125 if ($key == "FH" || $key == "SOCH" || $key == "ROS") {
2126 // We are going to build SocHx, FH and ROS separately below since they are different..
2127 continue;
2130 $table = '';
2131 $header = '';
2132 $header .= ' <table class="PMSFH_header">
2133 <tr>
2134 <td width="90%">
2135 <span class="left" style="font-weight:800;font-size:0.9em;">' . xlt($key) . '</span>
2136 </td>
2137 <td>
2138 <span class="right btn-sm" href="#PMH_anchor" onclick="alter_issue2(\'0\',' . attr_js($key) . ',\'0\');" style="text-align:right;font-size:8px;">' . xlt("New") . '</span>
2139 </td>
2140 </tr>
2141 </table>
2143 if (count($PMSFH[0][$key]) > '0') {
2144 $index = 0;
2145 foreach ($PMSFH[0][$key] as $item) {
2146 if (
2147 ( ($key == "Medication") || ($key == "Eye Meds") )
2149 ($item['status'] == "Inactive")
2151 continue;
2153 if (($key == "Medication") && ( !empty($item['row_subtype']))) {
2154 $subtype_Meds[$item['row_subtype']]['name'] = $item['row_subtype'];
2155 $subtype_Meds[$item['row_subtype']]['header'] = '
2156 <table class="PMSFH_header">
2157 <tr>
2158 <td width="90%">
2159 <span class="left" style="font-weight:800;font-size:0.9em;">' . xlt(ucwords($item['row_subtype'])) . ' Meds</span>
2160 </td>
2161 <td>
2162 <span class="right btn-sm" href="#PMH_anchor" onclick="alter_issue2(\'0\',\'Eye Meds\',\'0\');" style="text-align:right;font-size:8px;">' . xlt("New") . '</span>
2163 </td>
2164 </tr>
2165 </table>
2167 $subtype_Meds[$item['row_subtype']]['table'] .= "<span name='QP_PMH_" . attr($item['rowid']) . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid']) . "'
2168 onclick=\"alter_issue2(" . attr_js($item['rowid']) . ",\"Eye Meds\"," . attr_js($index) . ");\">" . text($item['title']) . "</span><br />";
2169 $index++;
2170 continue;
2173 if ($key == "Allergy") {
2174 if ($item['reaction']) {
2175 $reaction = " (" . text($item['reaction']) . ")";
2176 } else {
2177 $reaction = "";
2180 $red = "style='color:red;'";
2181 } else {
2182 $red = '';
2185 $table .= "<span $red name='QP_PMH_" . $item['rowid'] . "' href='#PMH_anchor' id='QP_PMH_" . $item['rowid'] . "'
2186 onclick=\"alter_issue2(" . attr_js($item['rowid']) . "," . attr_js($key) . "," . attr_js($index) . ");\">" . text($item['title'] . ($reaction ?? '')) . "</span><br />";
2187 $index++;
2189 } else {
2190 if ($key == "Allergy") {
2191 $table .= xlt("NKDA{{No known drug allergies}}");
2192 } else {
2193 $table .= xlt("None");
2196 $counter++;
2199 $display_PMSFH[$key] = $header . $open_table . $table . $close_table;
2202 echo $display_PMSFH['POH'];
2203 $count = $count['POH'] + $count['PMH'] + 4;
2204 if ($count >= $column_max) {
2205 echo $div . $header1;
2208 echo $display_PMSFH['POS'];
2209 $count = $count + ($count['POS'] ?? null) + 4;
2210 if ($count >= $column_max) {
2211 echo $div . $header1;
2214 echo $display_PMSFH['Eye Meds'];
2215 $count = $count + ($count['Surgery'] ?? null) + 4;
2216 if (($count >= $column_max) && ($row_count < $rows)) {
2217 echo $div;
2218 $count = 0;
2219 $row_count = 2;
2222 echo $display_PMSFH['PMH'];
2223 $count = $count + ($count['Surgery'] ?? null) + 4;
2224 if (($count >= $column_max) && ($row_count < $rows)) {
2225 echo $div;
2226 $count = 0;
2227 $row_count = 2;
2230 echo $display_PMSFH['Surgery'];
2232 $count = $count + ($count['Medication'] ?? null) + 4;
2233 if (($count >= $column_max) && ($row_count < $rows)) {
2234 echo $div;
2235 $count = 0;
2236 $row_count = 2;
2239 echo $display_PMSFH['Medication'];
2241 $count = $count + ($count['Allergy'] ?? null) + 4;
2242 if (($count >= $column_max) && ($row_count < $rows)) {
2243 echo $div;
2244 $count = 0;
2245 $row_count = 2;
2248 echo $display_PMSFH['Allergy'];
2250 $count = $count + ($count['FH'] ?? null) + 4;
2251 if (($count >= $column_max) && ($row_count < $rows)) {
2252 echo $div;
2253 $count = 0;
2254 $row_count = 2;
2255 } ?>
2256 <table class="PMSFH_header">
2257 <tr>
2258 <td width="90%">
2259 <span class="left" style="font-weight:800;font-size:0.9em;"><?php echo xlt("FH{{Family History}}"); ?></span>
2260 </td>
2261 <td >
2262 <span class="right btn-sm" href="#PMH_anchor" onclick="alter_issue2('0','FH','');" style="text-align:right;font-size:8px;"><?php echo xlt("New"); ?></span>
2263 </td>
2264 </tr>
2265 </table>
2266 <?php
2267 echo $open_table;
2268 $mention_FH = 0;
2269 if (count($PMSFH[0]['FH']) > 0) {
2270 foreach ($PMSFH[0]['FH'] as $item) {
2271 if (($counter > $column_max) && ($row_count < $rows)) {
2272 echo $close_table . $div . $open_table;
2273 $counter = "0";
2274 $row_count++;
2277 if ($item['display'] > '') {
2278 $counter++;
2279 echo "<span name='QP_PMH_" . attr($item['rowid'] ?? '') . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid'] ?? '') . "'
2280 onclick=\"alter_issue2('0','FH','');\">" . xlt($item['short_title']) . ": " . text($item['display']) . "</span><br />";
2281 $mention_FH++;
2286 if (empty($mention_FH)) { ?>
2287 <span href="#PMH_anchor" onclick="alter_issue2('0','FH','');" style="text-align:right;"><?php echo xlt("Negative"); ?></span><br />
2288 <?php
2289 $counter = $counter + 3;
2292 echo $close_table;
2293 $count = $count + ($count['SOCH'] ?? null) + 4;
2295 if (($count > $column_max) && ($row_count < $rows)) {
2296 echo $div;
2297 $count = 0;
2298 $row_count = 2;
2299 } ?>
2300 <table class="PMSFH_header">
2301 <tr>
2302 <td width="90%">
2303 <span class="left" style="font-weight:800;font-size:0.9em;"><?php echo xlt("Social"); ?></span>
2304 </td>
2305 <td >
2306 <span class="right btn-sm" href="#PMH_anchor" onclick="alter_issue2('0','SOCH','');" style="text-align:right;font-size:8px;"><?php echo xlt("New"); ?></span>
2307 </td>
2308 </tr>
2309 </table>
2310 <?php
2311 echo $open_table;
2312 $mention_SOCH = 0;
2313 foreach ($PMSFH[0]['SOCH'] as $item) {
2314 if (($counter > $column_max) && ($row_count < $rows)) {
2315 echo $close_table . $div . $open_table;
2316 $counter = "0";
2317 $row_count++;
2320 if (($item['display'] > '') && ($item['display'] != 'not_applicable')) {
2321 echo "<span name='QP_PMH_" . ($item['rowid'] ?? '') . "' href='#PMH_anchor' id='QP_PMH_" . ($item['rowid'] ?? '') . "'
2322 onclick=\"alter_issue2('0','SOCH','');\">" . xlt($item['short_title']) . ": " . text($item['display']) . "</span><br />";
2323 $counter++;
2324 $mention_SOCH++;
2328 if (empty($mention_SOCH)) {
2330 <span href="#PMH_anchor"
2331 onclick="alter_issue2('0','SOCH','');" style="text-align:right;"><?php echo xlt("Not documented"); ?></span><br />
2332 <?php
2333 $counter = $counter + 2;
2336 echo $close_table;
2337 $count = $count + ($count['ROS'] ?? null) + 4;
2339 if (($count > $column_max) && ($row_count < $rows)) {
2340 echo $div;
2341 $count = 0;
2342 $row_count = 2;
2343 } ?>
2344 <table class="PMSFH_header">
2345 <tr>
2346 <td width="90%">
2347 <span class="left" style="font-weight:800;font-size:0.9em;"><?php echo xlt("ROS{{Review of Systems}}"); ?></span>
2348 </td>
2349 <td >
2350 <span class="right btn-sm" href="#PMH_anchor" onclick="alter_issue2('0','ROS','');" style="text-align:right;font-size:8px;"><?php echo xlt("New"); ?></span>
2351 </td>
2352 </tr>
2353 </table>
2354 <?php
2355 echo $open_table;
2356 $mention = 0;
2358 foreach ($PMSFH[0]['ROS'] as $item) {
2359 if (($item['display'] ?? '') > '') {
2360 if (($counter > $column_max) && ($row_count < $rows)) {
2361 echo $close_table . $div . $open_table;
2362 $counter = "0";
2363 $row_count++;
2366 //xlt($item['short_title']) - for a list of short_titles, see the predefined ROS categories
2367 echo "<span name='QP_PMH_" . attr($item['rowid'] ?? '') . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid'] ?? '') . "'
2368 onclick=\"alter_issue2('0','ROS','');\">" . xlt($item['short_title']) . ": " . text($item['display']) . "</span><br />";
2369 $mention++;
2370 $counter++;
2374 if (empty($mention)) {
2375 echo xlt("Negative") . "<br />";
2376 $counter = $counter++;
2379 echo $close_table;
2381 </div>
2382 <?php
2383 $PMH_panel = ob_get_contents();
2384 ob_end_clean();
2385 return $PMH_panel;
2389 * This function uses the complete PMSFH array for a given patient, including the ROS for this encounter
2390 * and returns the PMSFH/ROS sliding Right Panel
2392 * @param array $PMSFH
2393 * @return $right_panel html
2395 function show_PMSFH_panel($PMSFH, $columns = '1')
2397 global $pcp_data;
2398 global $ref_data;
2399 ob_start();
2401 //<!-- POH -->
2402 echo "<br /><span class='panel_title' title='" . xla('Past Ocular History') . "'>" . xlt("POH{{Past Ocular History}}") . ":</span>";
2404 <span class="top-right btn-sm" href="#PMH_anchor"
2405 onclick="alter_issue2('0','POH','');"
2406 style="text-align:right;font-size:8px;"><?php echo xlt("Add"); ?></span>
2407 <br />
2408 <?php
2409 if ($PMSFH[0]['POH']) {
2410 $i = 0;
2411 foreach ($PMSFH[0]['POH'] as $item) {
2412 echo "<span name='QP_PMH_" . attr($item['rowid']) . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid']) . "'
2413 onclick=\"alter_issue2(" . attr_js($item['rowid']) . ",'POH','" . $i . "');\">" . text($item['title']) . "</span><br />";
2414 $i++;
2416 } else { ?>
2417 <span href="#PMH_anchor"
2418 onclick="alter_issue2('0','POH','');" class="disabled_button"><?php echo xlt("None"); ?><br /></span>
2419 <?php
2422 //<!-- POS -->
2423 echo "<br /><span class='panel_title' title='" . xla('Past Ocular Surgery') . "'>" . xlt("POS{{Past Ocular Surgery}}") . ":</span>";
2425 <span class="top-right btn-sm" href="#PMH_anchor"
2426 onclick="alter_issue2('0','POS','');"
2427 style="text-align:right;font-size:8px;"><?php echo xlt("Add"); ?></span>
2428 <br />
2429 <?php
2430 if ($PMSFH[0]['POS']) {
2431 $i = 0;
2432 foreach ($PMSFH[0]['POS'] as $item) {
2433 echo "<span name='QP_PMH_" . attr($item['rowid']) . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid']) . "'
2434 onclick=\"alter_issue2(" . attr_js($item['rowid']) . ",'POS','" . $i . "');\">" . text($item['title']) . "</span><br />";
2435 $i++;
2437 } else { ?>
2438 <span href="#PMH_anchor"
2439 onclick="alter_issue2('0','POS','');" class="disabled_button"><?php echo xlt("None"); ?><br /></span>
2440 <?php
2443 //<!-- Eye Meds -->
2444 echo "<br /><span class='panel_title' title='" . xla("Eye Meds") . "'>" . xlt("Eye Meds") . ":</span>";
2445 ?><span class="top-right btn-sm" href="#PMH_anchor"
2446 onclick="alter_issue2('0','Eye Meds','');" style="text-align:right;font-size:8px;"><?php echo xlt("Add"); ?></span>
2447 <br />
2448 <?php
2449 if ($PMSFH[0]['Eye Meds']) {
2450 $i = 0;
2451 foreach ($PMSFH[0]['Eye Meds'] as $item) {
2452 if (($item['status'] == "Inactive") || ($item['row_subtype'] != "eye")) {
2453 $i++;
2454 continue;
2456 echo "<span name='QP_PMH_" . attr($item['rowid']) . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid']) . "'
2457 onclick=\"alter_issue2(" . attr_js($item['rowid']) . ",'Eye Meds','" . $i . "');\" > " . text($item['title']) . "</span><br />";
2458 $i++;
2460 } else { ?>
2461 <span href="#PMH_anchor"
2462 onclick="alter_issue2('0','Medication','');" class="disabled_button"><?php echo xlt("None"); ?><br /></span>
2463 <?php
2466 //<!-- PMH -->
2467 echo "<br /> <span class='panel_title' title='" . xla('Past Medical History') . "'>" . xlt("PMH{{Past Medical History}}") . ":</span>";
2468 ?><span class="top-right btn-sm" href="#PMH_anchor"
2469 onclick="alter_issue2('0','PMH','');" style="text-align:right;font-size:8px;"><?php echo xlt("Add"); ?></span>
2470 <br />
2471 <?php
2472 if ($PMSFH[0]['PMH']) {
2473 $i = 0;
2474 foreach ($PMSFH[0]['PMH'] as $item) {
2475 if ($item['enddate'] !== " ") {
2476 echo "<span name='QP_PMH_" . attr($item['rowid']) . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid']) . "'
2477 onclick=\"alter_issue2(" . attr_js($item['rowid']) . ",'PMH','" . $i . "');\">" . text($item['title']) . "</span><br />";
2478 $i++;
2481 } else { ?>
2482 <span href="#PMH_anchor"
2483 onclick="alter_issue2('0','PMH','');" class="disabled_button"><?php echo xlt("None"); ?><br /></span>
2484 <?php
2487 //<!-- Surgeries -->
2488 echo "<br /><span class='panel_title' title='" . xla("Past Surgical History") . "'>" . xlt("Surgery") . ":</span>";
2489 ?><span class="top-right btn-sm" href="#PMH_anchor"
2490 onclick="alter_issue2('0','Surgery','');" style="text-align:right;font-size:8px;"><?php echo xlt("Add"); ?></span>
2491 <br />
2492 <?php
2493 if ($PMSFH[0]['Surgery']) {
2494 $i = 0;
2495 foreach ($PMSFH[0]['Surgery'] as $item) {
2496 echo "<span name='QP_PMH_" . attr($item['rowid']) . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid']) . "'
2497 onclick=\"alter_issue2(" . attr_js($item['rowid']) . ",'Surgery','" . $i . "');\">" . text($item['title']) . "<br /></span>";
2498 $i++;
2500 } else { ?>
2501 <span href="#PMH_anchor"
2502 onclick="alter_issue2('0','Surgery','');" class="disabled_button"><?php echo xlt("None"); ?><br /></span>
2503 <?php
2506 //<!-- Meds -->
2507 echo "<br /><span class='panel_title' title='" . xla("Medications") . "'>" . xlt("Medication") . ":</span>";
2508 ?><span class="top-right btn-sm" href="#PMH_anchor"
2509 onclick="alter_issue2('0','Medication','');" style="text-align:right;font-size:8px;"><?php echo xlt("Add"); ?></span>
2510 <br />
2511 <?php
2512 if ($PMSFH[0]['Medication']) {
2513 $i = 0;
2514 foreach ($PMSFH[0]['Medication'] as $item) {
2515 if (($item['row_subtype'] == "eye") || ($item['status'] == "Inactive")) {
2516 $i++;
2517 continue;
2519 echo "<span name='QP_PMH_" . attr($item['rowid']) . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid']) . "'
2520 onclick=\"alter_issue2(" . attr_js($item['rowid']) . ",'Medication','" . $i . "');\">" . text($item['title']) . "</span><br />";
2521 $i++;
2523 } else { ?>
2524 <span href="#PMH_anchor"
2525 onclick="alter_issue2('0','Medication','');" class="disabled_button"><?php echo xlt("None"); ?><br /></span>
2526 <?php
2530 //<!-- Allergies -->
2531 echo "<br /><span class='panel_title' title='" . xla("Allergies") . "'>" . xlt("Allergy") . ":</span>";
2532 ?><span class="top-right btn-sm" href="#PMH_anchor"
2533 onclick="alter_issue2('0','Allergy','');" style="text-align:right;font-size:8px;"><?php echo xlt("Add"); ?></span>
2534 <br />
2535 <?php
2536 if ($PMSFH[0]['Allergy']) {
2537 $i = 0;
2538 foreach ($PMSFH[0]['Allergy'] as $item) {
2539 if ($item['reaction']) {
2540 $reaction = "(" . text($item['reaction']) . ")";
2541 } else {
2542 $reaction = "";
2545 echo "<span style='color:red;' name='QP_PMH_" . attr($item['rowid']) . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid']) . "'
2546 onclick=\"alter_issue2(" . attr_js($item['rowid']) . ",'Allergy','" . $i . "');\">" . text($item['title']) . " " . $reaction . "</span><br />";
2547 $i++;
2549 } else { ?>
2550 <span href="#PMH_anchor"
2551 onclick="alter_issue2('0','Allergy','');" ><?php echo xlt("NKDA{{No known drug allergies}}"); ?><br /></span>
2552 <?php
2555 //<!-- Social History -->
2556 echo "<br /><span class='panel_title' title='" . xla("Social History") . "'>" . xlt('Soc Hx{{Social History}}') . ":</span>";
2557 ?><span class="top-right btn-sm" href="#PMH_anchor"
2558 onclick="alter_issue2('0','SOCH','');" style="text-align:right;font-size:8px;"><?php echo xlt("Add"); ?>
2559 </span><br />
2560 <?php
2561 $mention_SOCH = 0;
2562 foreach ($PMSFH[0]['SOCH'] as $k => $item) {
2563 if (($item['display']) && ($item['display'] != 'not_applicable')) {
2564 echo "<span name='QP_PMH_" . attr($item['rowid'] ?? '') . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid'] ?? '') . "'
2565 onclick=\"alter_issue2('0','SOCH','');\">" . xlt($item['short_title']) . ": " . text($item['display']) . "<br /></span>";
2566 $mention_SOCH++;
2570 if (empty($mention_SOCH)) {
2572 <span href="#PMH_anchor"
2573 onclick="alter_issue2('0','SOCH','');" class="disabled_button"><?php echo xlt("Negative"); ?><br /></span>
2574 <?php
2577 //<!-- Family History -->
2578 echo "<br /><span class='panel_title' title='" . xla("Family History") . "'>" . xlt("FH{{Family History}}") . ":</span>";
2579 ?><span class="top-right btn-sm" href="#PMH_anchor"
2580 onclick="alter_issue2('0','FH','');" style="text-align:right;font-size:8px;"><?php echo xlt("Add"); ?></span><br />
2582 <?php
2583 $mention_FH = 0;
2584 if (count($PMSFH[0]['FH']) > 0) {
2585 foreach ($PMSFH[0]['FH'] as $item) {
2586 if ($item['display'] > '') {
2587 echo "<span name='QP_PMH_" . attr($item['rowid'] ?? '') . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid'] ?? '') . "'
2588 onclick=\"alter_issue2('0','FH','');\">" . xlt($item['short_title']) . ": " . text($item['display']) . "<br /></span>";
2589 $mention_FH++;
2594 if (empty($mention_FH)) {
2596 <span href="#PMH_anchor"
2597 onclick="alter_issue2('0','FH','');" class="disabled_button"><?php echo xlt("Negative"); ?><br /></span>
2598 <?php
2601 echo "<br /><span class='panel_title' title='" . xla("Review of Systems") . "'>" . xlt("ROS{{Review of Systems}}") . ":</span>";
2602 ?><span class="top-right btn-sm" href="#PMH_anchor"
2603 onclick="alter_issue('0','ROS','');" style="text-align:right;font-size:8px;"><?php echo xlt("Add"); ?></span>
2604 <br />
2605 <?php
2606 $mention_ROS = 0;
2607 foreach ($PMSFH[0]['ROS'] as $item) {
2608 if ($item['display'] ?? '') {
2609 echo "<span name='QP_PMH_" . attr($item['rowid'] ?? '') . "' href='#PMH_anchor' id='QP_PMH_" . attr($item['rowid'] ?? '') . "'
2610 onclick=\"alter_issue2('0','ROS','');\">" . text($item['short_title']) . ": " . text($item['display']) . "</span><br />";
2611 $mention_ROS++;
2615 if (empty($mention_ROS)) { ?>
2616 <span href="#PMH_anchor"
2617 onclick="alter_issue2('0','ROS','');" class="disabled_button"><?php echo xlt('Negative'); ?><br /></span>
2618 <?php
2621 echo "<br /><br /><br />";
2622 $right_panel = ob_get_contents();
2624 ob_end_clean();
2625 return $right_panel;
2629 * This function displays via echo the PMSFH/ROS in the report
2631 * @param array $PMSFH
2634 function show_PMSFH_report($PMSFH)
2636 global $pid;
2637 global $ISSUE_TYPES;
2639 //4 panels
2640 $rows = '4';
2641 if (!($PMFSH ?? '')) {
2642 $PMSFH = build_PMSFH($pid);
2645 // Find out the number of items present now and put 1/4 in each column.
2646 foreach ($PMSFH[0] as $key => $value) {
2647 if (!empty($total_PMSFH)) {
2648 $total_PMSFH += count($PMSFH[0][$key]);
2649 $total_PMSFH += 2; //add two for the title and a space
2650 } else {
2651 $total_PMSFH = count($PMSFH[0][$key]);
2652 $total_PMSFH = 2; //add two for the title and a space
2654 $count[$key] = count($PMSFH[0][$key]) + 1;
2657 //SOCH, FH and ROS are listed in $PMSFH even if negative, only count positives
2658 foreach ($PMSFH[0]['ROS'] as $key => $value) {
2659 if (($value['display'] ?? '') == '') {
2660 if (!empty($total_PMSFH)) {
2661 $total_PMSFH--;
2662 } else {
2663 $total_PMSFH = 0;
2665 $count['ROS']--;
2669 foreach ($PMSFH[0]['FH'] as $key => $value) {
2670 if ($value['display'] == '') {
2671 if (!empty($total_PMSFH)) {
2672 $total_PMSFH--;
2673 } else {
2674 $total_PMSFH = 0;
2676 $count['FH']--;
2680 foreach ($PMSFH[0]['SOCH'] as $key => $value) {
2681 if (($value['display'] == '') || ($value['display'] == 'not_applicable')) {
2682 if (!empty($total_PMSFH)) {
2683 $total_PMSFH--;
2684 } else {
2685 $total_PMSFH = 0;
2687 $count['SOCH']--;
2691 $counter = "0";
2692 $column_max = round(($total_PMSFH ?? null) / $rows) ;
2693 $panel_size = round(($total_PMSFH ?? null) / $rows) ;
2695 //<!-- POH -->
2696 $counter++;
2697 $counter++;
2698 echo "<table style='width:700px;'>
2699 <tr>
2700 <td style='vertical-align:top;
2701 width:150px;
2702 padding-left: 14px;
2703 padding-right: 4px;
2704 text-align: left;'>
2705 <br /><span style='font-weight:bold;'>" . xlt("POH{{Past Ocular History}}") . ":</span>";
2706 //note the HTML2PDF does not like <span style="font-weight:bold;"></span> so we are using the deprecated <b></b>
2708 <br />
2709 <?php
2710 if ($PMSFH[0]['POH'] > "") {
2711 foreach ($PMSFH[0]['POH'] as $item) {
2712 echo text($item['title']) . " " . text($item['diagnosis']) . "<br />";
2713 $counter++;
2715 } else {
2716 echo xlt("None") . "<br />";
2719 if (($counter + $count['POS']) > $panel_size) {
2720 echo "</td><td style='padding-left: 14px;
2721 padding-right: 4px;
2722 text-align: left;
2723 vertical-align:top;
2724 width:150px;'>";
2725 $counter = "0";
2728 $counter++;
2729 $counter++;
2730 //<!-- PMH -->
2731 echo "<br /><span style='font-weight:bold;'>" . xlt("Eye Surgery") . ":</span>";
2733 <br />
2734 <?php
2735 if ($PMSFH[0]['POS'] > "") {
2736 foreach ($PMSFH[0]['POS'] as $item) {
2737 echo text($item['title']) . " " . text($item['diagnosis']) . "<br />";
2738 $counter++;
2740 } else {
2741 echo xlt("None") . "<br />";
2744 if (($counter + $count['PMH']) > $panel_size) {
2745 echo "</td><td style='padding-left: 14px;
2746 padding-right: 4px;
2747 text-align: left;
2748 vertical-align:top;
2749 width:150px;'>";
2750 $counter = "0";
2753 $counter++;
2754 $counter++;
2755 //<!-- PMH -->
2756 echo "<br /><span style='font-weight:bold;'>" . xlt("PMH") . ":</span>";
2758 <br />
2759 <?php
2760 if ($PMSFH[0]['PMH'] > "") {
2761 foreach ($PMSFH[0]['PMH'] as $item) {
2762 echo text($item['title']) . " " . text($item['diagnosis']) . "<br />";
2763 $counter++;
2765 } else {
2766 echo xlt("None") . "<br />";
2770 if ($counter + $count['Medication'] > $panel_size) {
2771 echo "</td><td style='padding-left: 14px;
2772 padding-right: 4px;
2773 text-align: left;
2774 vertical-align:top;
2775 width:150px;'>";
2776 $counter = "0";
2779 $counter++;
2780 $counter++;
2781 //<!-- Meds -->
2782 echo "<br /><span style='font-weight:bold;'>" . xlt("Medication") . ":</span>";
2784 <br />
2785 <?php
2786 if ($PMSFH[0]['Medication'] > "") {
2787 foreach ($PMSFH[0]['Medication'] as $item) {
2788 echo text($item['title']) . " " . text($item['diagnosis']) . "<br />";
2789 $counter++;
2791 } else {
2792 echo xlt("None") . "<br />";
2795 if ($counter + $count['Surgery'] > $panel_size) {
2796 echo "</td><td style='padding-left: 14px;
2797 padding-right: 4px;
2798 text-align: left;
2799 vertical-align:top;
2800 width:150px;'>";
2801 $counter = "0";
2804 //<!-- Surgeries -->
2805 $counter++;
2806 $counter++;
2807 echo "<br /><span style='font-weight:bold;'>" . xlt("Surgery") . ":</span>";
2808 ?><br />
2809 <?php
2810 if ($PMSFH[0]['Surgery'] > "") {
2811 foreach ($PMSFH[0]['Surgery'] as $item) {
2812 echo text($item['title']) . " " . text($item['diagnosis']) . "<br />";
2813 $counter++;
2815 } else {
2816 echo xlt("None") . "<br />";
2819 if ($counter + $count['Allergy'] > $panel_size) {
2820 echo "</td><td style='padding-left: 14px;
2821 padding-right: 4px;
2822 text-align: left;
2823 vertical-align:top;
2824 width:150px;'>";
2825 $counter = "0";
2828 $counter++;
2829 $counter++;
2830 //<!-- Allergies -->
2831 echo "<br /><span style='font-weight:bold;'>" . xlt("Allergy") . ":</span>";
2833 <br />
2834 <?php
2835 if ($PMSFH[0]['Allergy'] > "") {
2836 foreach ($PMSFH[0]['Allergy'] as $item) {
2837 echo text($item['title']) . "<br />";
2838 $counter++;
2840 } else {
2841 echo xlt("NKDA{{No known drug allergies}}") . "<br />";
2844 if ($counter + $count['SOCH'] > $panel_size) {
2845 echo "</td><td style='padding-left: 14px;
2846 padding-right: 4px;
2847 text-align: left;
2848 vertical-align:top;
2849 width:150px;'>";
2850 $counter = "0";
2853 $counter++;
2854 $counter++;
2855 //<!-- SocHx -->
2856 echo "<br /><span style='font-weight:bold;'>" . xlt("Soc Hx{{Social History}}") . ":</span>";
2858 <br />
2859 <?php
2860 $mention_PSOCH = 0;
2861 foreach ($PMSFH[0]['SOCH'] as $k => $item) {
2862 if (($item['display']) && ($item['display'] != 'not_applicable')) {
2863 echo xlt($item['short_title']) . ": " . text($item['display']) . "<br />";
2864 $mention_PSOCH++;
2865 $counter++;
2869 if (empty($mention_PSOCH)) {
2870 echo xlt("Negative") . "<br />";
2873 if (($counter + $count['FH']) > $panel_size) {
2874 echo "</td><td style='padding-left: 14px;
2875 padding-right: 4px;
2876 text-align: left;
2877 vertical-align:top;
2878 width:150px;'>";
2879 $counter = "0";
2882 $counter++;
2883 $counter++;
2884 //<!-- FH -->
2885 echo "<br /><span style='font-weight:bold;'>" . xlt("FH{{Family History}}") . ":</span>";
2887 <br />
2888 <?php
2889 $mention_FH = 0;
2890 foreach ($PMSFH[0]['FH'] as $item) {
2891 if ($item['display']) {
2892 echo xlt($item['short_title']) . ": " . text($item['display']) . "<br />";
2893 $mention_FH++;
2894 $counter++;
2898 if (empty($mention_FH)) {
2899 echo xlt("Negative") . "<br />";
2902 if (($counter !== "0") && (($counter + $count['ROS']) > $panel_size)) {
2903 echo "</td><td style='padding-left: 14px;
2904 padding-right: 4px;
2905 text-align: left
2906 vertical-align:top;
2907 width:150px;'>";
2908 $counter = "0";
2911 $counter++;
2912 $counter++;
2913 //<!-- ROS -->
2914 echo "<br /><span style='font-weight:bold;'>" . xlt("ROS{{Review of Systems}}") . ":</span>";
2915 ?><br />
2916 <?php
2917 $mention_ROS = 0;
2918 foreach ($PMSFH[0]['ROS'] as $item) {
2919 if ($item['display'] ?? '') {
2920 echo xlt($item['short_title']) . ": " . $item['display'] . "<br />";
2921 $mention_ROS++;
2922 $counter++;
2926 if (empty($mention_ROS)) {
2927 echo xlt("Negative");
2930 echo "</td></tr></table>";
2934 * This function returns the Provider-specific Quick Pick selections for a zone (2 input values)
2936 * These selctions are draw from an openEMR list, Eye_QP_$zone_$provider_id.
2937 * This list is created from Eye_QP_$zone_defaults when a new provider opens the form.
2938 * Because it is a "list", the end-user can modify it.
2939 * A link to the list "the pencil icon" is provided to allow customization - displayed in RTop frame.
2940 * If frames are ever removed, this will need to be reworked.
2942 * @param string $zone options EXT,ANTSEG,RETINA,NEURO
2943 * @param string $provider_id
2944 * @return QP text: when called directly outputs the ZONE QP lists for this provider
2946 function display_QP($zone, $provider_id)
2948 global $prov_data;
2949 if (!$zone || !$provider_id) {
2950 return;
2953 ob_start();
2954 $query = "SELECT * FROM list_options where list_id =? ORDER BY seq";
2955 $result = sqlStatement($query, array("Eye_QP_" . $zone . "_$provider_id"));
2956 if (sqlNumRows($result) < '1') {
2957 //this provider's list has not been created yet.
2958 $query = "REPLACE INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`) VALUES ('lists', ?, ?, '0', '1', '0')";
2959 sqlStatement($query, array('Eye_QP_' . $zone . '_' . $provider_id,'Eye QP List ' . $zone . ' for ' . $prov_data['lname']));
2960 $query = "SELECT * FROM list_options where list_id =? ORDER BY seq";
2961 $result = sqlStatement($query, array("Eye_QP_" . $zone . "_defaults"));
2962 $SQL_INSERT = "INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `mapping`, `notes`, `codes`, `activity`, `subtype`) VALUES (?,?,?,?,?,?,?,?,?)";
2963 } else {
2964 $SQL_INSERT = '';
2967 while ($QP = sqlFetchArray($result)) {
2968 if (!empty($SQL_INSERT)) {
2969 sqlStatement($SQL_INSERT, array("Eye_QP_" . $zone . "_" . $provider_id,$QP['option_id'],$QP['title'],$QP['seq'],$QP['mapping'],$QP['notes'],$QP['codes'],$QP['activity'],$QP['subtype']));
2972 $here[$QP['title']][$QP['subtype']]['notes'] = $QP['notes']; //the text to fill into form
2973 $here[$QP['title']][$QP['subtype']]['codes'] = $QP['codes']; //the code if attached.
2974 $here[$QP['title']][$QP['subtype']]['mapping'] = $QP['mapping']; //the fieldname without laterality eg CONJ
2975 $here[$QP['title']][$QP['subtype']]['activity'] = $QP['activity']; //1 to replace, 2 to append
2978 foreach ($here as $title => $values) { //start QP section items
2979 $title_show = (strlen($title) > 19) ? substr($title, 0, 16) . '...' : $title;
2980 if (preg_match('/clear field/', $title)) {
2981 $title_show = "<em><strong>$title</strong></em>";
2984 if ($values['OD'] ?? '') {
2985 if ($values['OD']['activity'] == '0') {
2986 $action = "ADD";
2989 if ($values['OD']['activity'] == '1') {
2990 $action = "REPLACE" ;
2993 if ($values['OD']['activity'] == '2') {
2994 $action = "APPEND" ;
2997 <span>
2998 <a class="underline QP" onclick="fill_QP_field('<?php echo attr($zone); ?>','OD','<?php echo attr($values['OD']['mapping']); ?>','<?php echo attr($values['OD']['notes']); ?>','<?php echo attr($action); ?>');"><?php echo xlt('OD{{right eye}}'); ?></a> |
2999 <a class="underline QP" onclick="fill_QP_field('<?php echo attr($zone); ?>','OS','<?php echo attr($values['OS']['mapping']); ?>','<?php echo attr($values['OS']['notes']); ?>','<?php echo attr($action); ?>');"><?php echo xlt('OS{{left eye}}'); ?></a> |
3000 <a class="underline QP" onclick="fill_QP_2fields('<?php echo attr($zone); ?>','OU','<?php echo attr($values['OU']['mapping']); ?>','<?php echo attr($values['OU']['notes']); ?>','<?php echo attr($action); ?>');"><?php echo xlt('OU{{both eyes}}'); ?></a>
3001 </span>
3002 &nbsp;
3003 <?php
3004 } elseif ($values['R']) {
3005 if ($values['R']['activity'] == '0') {
3006 $action = "ADD";
3009 if ($values['R']['activity'] == '1') {
3010 $action = "REPLACE" ;
3013 if ($values['R']['activity'] == '2') {
3014 $action = "APPEND" ;
3017 <span>
3018 <a class="underline QP" onclick="fill_QP_field('<?php echo attr($zone); ?>','R','<?php echo attr($values['R']['mapping']); ?>','<?php echo attr($values['R']['notes']); ?>','<?php echo attr($action); ?>');"><?php echo xlt('R{{right side}}'); ?></a> |
3019 <a class="underline QP" onclick="fill_QP_field('<?php echo attr($zone); ?>','L','<?php echo attr($values['L']['mapping'] ?? ''); ?>','<?php echo attr($values['L']['notes'] ?? ''); ?>','<?php echo attr($action); ?>');"><?php echo xlt('L{{left side}}'); ?></a> |
3020 <a class="underline QP" onclick="fill_QP_2fields('<?php echo attr($zone); ?>','B','<?php echo attr($values['B']['mapping']); ?>','<?php echo attr($values['B']['notes']); ?>','<?php echo attr($action); ?>');"><?php echo xlt('B{{both sides}}'); ?></a>
3021 </span>
3022 &nbsp;
3023 <?php
3026 echo $title_show;
3027 if (!empty($number_rows)) {
3028 $number_rows++;
3029 } else {
3030 $number_rows = 1;
3032 ?><br />
3033 <?php
3034 if (($number_rows ?? null) == 19) { ?>
3035 </div>
3036 <div class="QP_block_outer borderShadow text_clinical" ><?php
3039 if (($number_rows ?? null) == 38) {
3040 break;
3042 } //end QP section items
3044 <a href="JavaScript:void(0);"
3045 onclick="openNewForm('<?php echo $GLOBALS['webroot']; ?>/interface/super/edit_list.php?list_id=Eye_QP_<?php echo attr($zone) . "_" . attr($provider_id); ?>','QP Editor');"
3046 title="<?php echo xla('Click here to Edit this Doctor\'s Quick Pick list'); ?>"
3047 name="provider_todo"
3048 class="bold black"><i class="closeButton float-right fa fa-pencil-alt fa-fw"></i> </a>
3049 <?php
3050 $QP_panel = ob_get_contents();
3051 ob_end_clean();
3052 return $QP_panel;
3055 function canvas_select($zone, $encounter, $pid)
3057 /* This will provide a way to scroll back through prior VISIT images, to copy forward to today's visit,
3058 * just like we do in the text fields.
3059 * Will need to do a lot of thinking to create this. Jist is ajax call to server for image retrieval.
3060 * To get this to work we need a way to select an old image to work from, use current or return to baseline.
3061 * This will require a global BACK button like above (BUTTON_BACK_<?php echo attr($zone); ?>).
3062 * The Undo Redo buttons are currently javascript client side.
3063 * The Undo Redo features will only work for changes made since form was loaded locally.
3065 * If we want to look back at a prior VISITs saved final images,
3066 * we will need to create this logic.
3067 * Need to think about how to display this visually so it's intuitive, without cluttering the page...
3068 * At first glance, using the text PRIORS selection method should work... Not yet.
3071 * $documents['categories']=$categories;
3072 * $documents['my_name']=$my_name;
3073 * $documents['children_names']=$children_names;
3074 * $documents['parent_name'] = $parent_name;
3075 * $documents['zones'] = $zones;
3076 * $documents['docs_in_zone'] = $docs_in_zone;
3077 * $documents['docs_in_cat_id'] = $docs_in_cat_id;
3078 * $documents['docs_in_name'] = $docs_in_name;
3079 * $documents['docs_by_date'] = $docs_by_date;
3081 * Let's try $documents['docs_in_name'] where ['name']['zone']
3083 //iterate through documents?
3084 // which are in this zone?
3085 //are any from the same as the encounter? If so selected=selected
3087 global $documents;
3088 $side = "OU";
3089 $type_name = $side . "_" . $zone . "_VIEW";
3090 $canvi = [];
3091 if (!empty($documents['zones'][$zone]) && !empty($documents['docs_in_name']['Drawings'])) {
3092 foreach ($documents['docs_in_name']['Drawings'] as $doc) {
3093 if (!preg_match("/" . $zone . "_VIEW/", $doc['name'])) {
3094 continue;
3096 if (!$doc['encounter_id']) {
3097 continue;
3099 $canvi[] = $doc;
3102 usort($canvi, function ($a, $b) {
3103 return $b['encounter_date'] <=> $a['encounter_date'];
3105 if (!empty($canvi)) {
3106 if ($canvi[0]['encounter_id'] != $encounter) {
3107 //put today on the front as current, item "0"
3108 //echo "<pre style='text-align:left;'>".$canvi[0]['id'] ." and ". $encounter['encounter_id'];var_dump($canvi);echo "</pre>";
3109 //$today_doc = ["Hi"];
3110 $today_doc['encounter_date'] = 'New';
3111 array_unshift($canvi, $today_doc);
3114 if (count($canvi) > '1') {
3115 $select = '<div class="">';
3116 $select .= '<span id="old_canvas_leftest_' . attr($zone) . '"
3117 name="old_canvas_leftest"
3118 class="fa fa-fast-backward fa-sm PRIORS hand"
3119 data-target="SELECT_CANVAS_' . attr($zone) . '"
3120 data-direction="oldest"
3121 title="' . xla('Oldest drawing') . '"></span>';
3122 $select .= '<span id="old_canvas_left_' . attr($zone) . '"
3123 name="old_canvas"
3124 class="fa fa-step-backward fa-sm PRIORS hand"
3125 data-target="SELECT_CANVAS_' . attr($zone) . '"
3126 data-direction="older"
3127 title="' . xla('Look back one drawing') . '"></span>';
3129 $select .= "<select id='SELECT_CANVAS_" . attr($zone) . "' name='CANVAS_selector' data-step='0'>";
3130 $count = '0';
3131 foreach ($canvi as $hit) {
3132 if ($count == '0') {
3133 $select .= "<option value='current'>" . text($hit['encounter_date']) . "</option>\n";
3134 } else {
3135 $select .= "<option value='" . attr($hit['document_id']) . "'>" . text($hit['encounter_date']) . "</option>\n";
3137 $count++;
3139 $select .= "</select>";
3140 $select .= '<span id="old_canvas_right_' . attr($zone) . '"
3141 name="old_canvas"
3142 class="fa fa-step-forward PRIORS hand"
3143 data-target="SELECT_CANVAS_' . attr($zone) . '"
3144 data-direction="newer"
3145 data-step="1"
3146 title="' . xla('Forward one drawing') . '"></span>';
3147 $select .= '<span id="old_canvas_rightest_' . attr($zone) . '"
3148 name="old_canvas_rightest"
3149 class="fa fa-fast-forward PRIORS hand"
3150 data-target="SELECT_CANVAS_' . attr($zone) . '"
3151 data-direction="newest"
3152 title="' . xla('Forward to current canvas') . '"></span>
3154 </div>';
3157 return $select ?? '';
3160 * This function returns display the draw/sketch diagram for a zone (4 input values)
3162 * If there is already a drawing for this zone in this encounter, it is pulled from
3163 * from its stored location:
3164 * $GLOBALS['web_root']."/sites/".$_SESSION['site_id']."/".$form_folder."/".$pid."/".$encounter."/".$side."_".$zone."_VIEW.png?".rand();
3166 * Otherwise a "BASE" image is pulled from the images directory of the form... Customizable.
3168 * @param string $zone options ALL,EXT,ANTSEG,RETINA,NEURO
3169 * @param string $visit_date Future functionality to limit result set. UTC DATE Formatted
3170 * @param string $pid value = patient id
3171 * @param string OU by default. Future functionality will allow OD and OS values- not implemented yet.
3172 * @return true : when called directly outputs the ZONE specific HTML5 CANVAS widget
3174 function display_draw_section($zone, $encounter, $pid, $side = 'OU', $counter = '')
3176 global $form_folder;
3177 $filepath = $GLOBALS['oer_config']['documents']['repository'] . $pid . "/";
3178 $base_name = $pid . "_" . $encounter . "_" . $side . "_" . $zone . "_VIEW";
3180 $file_history = $filepath . $base_name;
3181 $file_store = $file_history . ".jpg";
3183 <div id="Draw_<?php echo attr($zone); ?>" name="Draw_<?php echo attr($zone); ?>" style="text-align:center;height: 2.5in;" class="Draw_class canvas">
3184 <span class="far fa-file-alt closeButton" id="BUTTON_TEXT_<?php echo attr($zone); ?>" name="BUTTON_TEXT_<?php echo attr($zone); ?>"></span>
3185 <i class="closeButton_2 fas fa-database" id="BUTTON_QP_<?php echo attr($zone); ?>_2" name="BUTTON_QP_<?php echo attr($zone); ?>"></i>
3186 <i class="closeButton_3 fas fa-user-md" name="Shorthand_kb" title="<?php echo xla("Open the Shorthand Window and display Shorthand Codes"); ?>"></i>
3188 <?php
3189 $output = canvas_select($zone, $encounter, $pid);
3190 echo $output;
3192 <div id="<?php echo attr($zone); ?>_canvas">
3193 <div class="tools">
3194 <div id="sketch_tooled_<?php echo attr($zone); ?>_8">
3195 <span id="sketch_tool_<?php echo attr($zone);?>_color"
3196 class="color_indicator jscolor"
3197 data-jscolor="{ previewElement:'#sketch_tool_<?php echo attr($zone); ?>_color',
3198 previewSize:75,
3199 valueElement:'#selColor_<?php echo attr($zone); ?>',
3200 position:'right',
3201 value:'#000',
3202 hash:'true'
3204 data-target="selColor_<?php echo attr($zone); ?>"
3205 ></span>
3206 </div>
3207 <?php
3209 $sql = "SELECT * from documents where name like ? ORDER by id DESC";
3210 $doc = sqlQuery($sql, array("%" . $base_name . "%"));
3211 $base_filetoshow = $GLOBALS['web_root'] . "/interface/forms/" . $form_folder . "/images/" . $side . "_" . $zone . "_BASE.jpg";
3212 if ((($doc['id'] ?? null) > '0')) {
3213 $filetoshow = $GLOBALS['web_root'] . "/controller.php?document&retrieve&patient_id=" . attr($pid) . "&document_id=" . attr($doc['id']) . "&as_file=false&show_original=true&blahblah=" . rand();
3214 } else {
3215 //base image.
3216 $filetoshow = $base_filetoshow;
3220 <input type="hidden" id="url_<?php echo attr($zone); ?>" name="url_<?php echo attr($zone); ?>" value="<?php echo $filetoshow; ?>" />
3221 <input type="hidden" id="base_url_<?php echo attr($zone); ?>" name="base_url_<?php echo attr($zone); ?>" value="<?php echo $base_filetoshow; ?>" />
3222 <input type="hidden" id="selWidth_<?php echo attr($zone); ?>" value="1">
3223 <input type="hidden" id="selColor_<?php echo attr($zone); ?>" value="#000" />
3227 <img id="sketch_tools_<?php echo attr($zone); ?>_1" onclick='$("#selColor_<?php echo attr($zone); ?>").val("#1AA2E1");' src="../../forms/<?php echo $form_folder; ?>/images/pencil_blue.png" style="height:30px;width:15px;">
3228 <img id="sketch_tools_<?php echo attr($zone); ?>_2" onclick='$("#selColor_<?php echo attr($zone); ?>").val("#ff0");' src="../../forms/<?php echo $form_folder; ?>/images/pencil_yellow.png" style="height:30px;width:15px;">
3229 <img id="sketch_tools_<?php echo attr($zone); ?>_3" onclick='$("#selColor_<?php echo attr($zone); ?>").val("#ffad00");' src="../../forms/<?php echo $form_folder; ?>/images/pencil_orange.png" style="height:30px;width:15px;">
3230 <img id="sketch_tools_<?php echo attr($zone); ?>_4" onclick='$("#selColor_<?php echo attr($zone); ?>").val("#AC8359");' src="../../forms/<?php echo $form_folder; ?>/images/pencil_brown.png" style="height:30px;width:15px;">
3231 <img id="sketch_tools_<?php echo attr($zone); ?>_5" onclick='$("#selColor_<?php echo attr($zone); ?>").val("#E10A17");' src="../../forms/<?php echo $form_folder; ?>/images/pencil_red.png" style="height:30px;width:15px;">
3232 <img id="sketch_tools_<?php echo attr($zone); ?>_6" onclick='$("#selColor_<?php echo attr($zone); ?>").val("#000");' src="../../forms/<?php echo $form_folder; ?>/images/pencil_black.png" style="height:50px;width:15px;">
3233 <img id="sketch_tools_<?php echo attr($zone); ?>_7" onclick='$("#selColor_<?php echo attr($zone); ?>").val("#fff");' src="../../forms/<?php echo $form_folder; ?>/images/pencil_white.png" style="height:30px;width:15px;">
3235 <span style="min-width:1in;">&nbsp;</span>
3236 <!-- now to pencil size -->
3237 <img id="sketch_sizes_<?php echo attr($zone); ?>_1" onclick='$("#selWidth_<?php echo attr($zone); ?>").val("1");' src="../../forms/<?php echo $form_folder; ?>/images/brush_1.png" style="height:20px;width:20px; border-bottom: 2pt solid black;">
3238 <img id="sketch_sizes_<?php echo attr($zone); ?>_3" onclick='$("#selWidth_<?php echo attr($zone); ?>").val("3");' src="../../forms/<?php echo $form_folder; ?>/images/brush_3.png" style="height:20px;width:20px;">
3239 <img id="sketch_sizes_<?php echo attr($zone); ?>_5" onclick='$("#selWidth_<?php echo attr($zone); ?>").val("5");' src="../../forms/<?php echo $form_folder; ?>/images/brush_5.png" style="height:20px;width:20px;">
3240 <img id="sketch_sizes_<?php echo attr($zone); ?>_10" onclick='$("#selWidth_<?php echo attr($zone); ?>").val("10");' src="../../forms/<?php echo $form_folder; ?>/images/brush_10.png" style="height:20px;width:20px;">
3241 <img id="sketch_sizes_<?php echo attr($zone); ?>_15" onclick='$("#selWidth_<?php echo attr($zone); ?>").val("15");' src="../../forms/<?php echo $form_folder; ?>/images/brush_15.png" style="height:20px;width:20px;">
3242 </div>
3244 <div align="center" class="borderShadow">
3245 <canvas id="myCanvas_<?php echo attr($zone); ?>" name="myCanvas_<?php echo attr($zone); ?>" width="450" height="225"></canvas>
3246 </div>
3247 <div style="margin-top: 7px;">
3248 <button onclick="javascript:cUndo('<?php echo attr($zone); ?>');return false;" id="Undo_Canvas_<?php echo attr($zone); ?>"><?php echo xlt("Undo"); ?></button>
3249 <button onclick="javascript:cRedo('<?php echo attr($zone); ?>');return false;" id="Redo_Canvas_<?php echo attr($zone); ?>"><?php echo xlt("Redo"); ?></button>
3250 <button onclick="javascript:drawImage('<?php echo attr($zone); ?>');return false;" id="Revert_Canvas_<?php echo attr($zone); ?>"><?php echo xlt("Revert"); ?></button>
3251 <button onclick="javascript:cReload('<?php echo attr($zone); ?>');return false;" id="Clear_Canvas_<?php echo attr($zone); ?>"><?php echo xlt("New"); ?></button>
3252 <button id="Blank_Canvas_<?php echo attr($zone); ?>"><?php echo xlt("Blank"); ?></button>
3253 </div>
3254 </div>
3255 <div id="<?php echo attr($zone); ?>_olddrawing"></div>
3256 </div>
3258 <?php
3262 * This function returns a JSON object to replace a requested section with copy_forward values (3 input values)
3263 * It will not replace the drawings with older encounter drawings... Not yet anyway.
3265 * @param string $zone options ALL,EXT,ANTSEG,RETINA,NEURO, EXT_DRAW, ANTSEG_DRAW, RETINA_DRAW, NEURO_DRAW
3266 * @param string $form_id is the form_eye_*.id where the data to carry forward is located
3267 * @param string $pid value = patient id
3268 * @return true : when called directly outputs the ZONE specific HTML for a prior record + widget for the desired zone
3270 function copy_forward($zone, $copy_from, $copy_to, $pid)
3272 global $form_id;
3274 $query = "select *,form_encounter.date as encounter_date
3276 from forms,form_encounter,form_eye_base,
3277 form_eye_hpi,form_eye_ros,form_eye_vitals,
3278 form_eye_acuity,form_eye_refraction,form_eye_biometrics,
3279 form_eye_external,form_eye_antseg,form_eye_postseg,
3280 form_eye_neuro,form_eye_locking
3281 where
3282 forms.deleted != '1' and
3283 forms.formdir='eye_mag' and
3284 forms.encounter=form_encounter.encounter and
3285 forms.form_id=form_eye_base.id and
3286 forms.form_id=form_eye_hpi.id and
3287 forms.form_id=form_eye_ros.id and
3288 forms.form_id=form_eye_vitals.id and
3289 forms.form_id=form_eye_acuity.id and
3290 forms.form_id=form_eye_refraction.id and
3291 forms.form_id=form_eye_biometrics.id and
3292 forms.form_id=form_eye_external.id and
3293 forms.form_id=form_eye_antseg.id and
3294 forms.form_id=form_eye_postseg.id and
3295 forms.form_id=form_eye_neuro.id and
3296 forms.form_id=form_eye_locking.id and
3297 forms.pid =? and
3298 forms.form_id =? ";
3300 $objQuery = sqlQuery($query, array($pid,$copy_from));
3301 if ($zone == "EXT") {
3302 $result['RUL'] = $objQuery['RUL'];
3303 $result['LUL'] = $objQuery['LUL'];
3304 $result['RLL'] = $objQuery['RLL'];
3305 $result['LLL'] = $objQuery['LLL'];
3306 $result['RBROW'] = $objQuery['RBROW'];
3307 $result['LBROW'] = $objQuery['LBROW'];
3308 $result['RMCT'] = $objQuery['RMCT'];
3309 $result['LMCT'] = $objQuery['LMCT'];
3310 $result['RADNEXA'] = $objQuery['RADNEXA'];
3311 $result['LADNEXA'] = $objQuery['LADNEXA'];
3312 $result['RMRD'] = $objQuery['RMRD'];
3313 $result['LMRD'] = $objQuery['LMRD'];
3314 $result['RLF'] = $objQuery['RLF'];
3315 $result['LLF'] = $objQuery['LLF'];
3316 $result['RVFISSURE'] = $objQuery['RVFISSURE'];
3317 $result['LVFISSURE'] = $objQuery['LVFISSURE'];
3318 $result['RCAROTID'] = $objQuery['RCAROTID'];
3319 $result['LCAROTID'] = $objQuery['LCAROTID'];
3320 $result['RTEMPART'] = $objQuery['RTEMPART'];
3321 $result['LTEMPART'] = $objQuery['LTEMPART'];
3322 $result['RCNV'] = $objQuery['RCNV'];
3323 $result['LCNV'] = $objQuery['LCNV'];
3324 $result['RCNVII'] = $objQuery['RCNVII'];
3325 $result['LCNVII'] = $objQuery['LCNVII'];
3326 $result['ODSCHIRMER1'] = $objQuery['ODSCHIRMER1'];
3327 $result['OSSCHIRMER1'] = $objQuery['OSSCHIRMER1'];
3328 $result['ODSCHIRMER2'] = $objQuery['ODSCHIRMER2'];
3329 $result['OSSCHIRMER2'] = $objQuery['OSSCHIRMER2'];
3330 $result['ODTBUT'] = $objQuery['ODTBUT'];
3331 $result['OSTBUT'] = $objQuery['OSTBUT'];
3332 $result['OSHERTEL'] = $objQuery['OSHERTEL'];
3333 $result['HERTELBASE'] = $objQuery['HERTELBASE'];
3334 $result['ODPIC'] = $objQuery['ODPIC'];
3335 $result['OSPIC'] = $objQuery['OSPIC'];
3336 $result['EXT_COMMENTS'] = $objQuery['EXT_COMMENTS'];
3337 $result["json"] = json_encode($result);
3338 echo json_encode($result);
3339 } elseif ($zone == "ANTSEG") {
3340 $result['OSCONJ'] = $objQuery['OSCONJ'];
3341 $result['ODCONJ'] = $objQuery['ODCONJ'];
3342 $result['ODCORNEA'] = $objQuery['ODCORNEA'];
3343 $result['OSCORNEA'] = $objQuery['OSCORNEA'];
3344 $result['ODAC'] = $objQuery['ODAC'];
3345 $result['OSAC'] = $objQuery['OSAC'];
3346 $result['ODLENS'] = $objQuery['ODLENS'];
3347 $result['OSLENS'] = $objQuery['OSLENS'];
3348 $result['ODIRIS'] = $objQuery['ODIRIS'];
3349 $result['OSIRIS'] = $objQuery['OSIRIS'];
3350 $result['ODKTHICKNESS'] = $objQuery['ODKTHICKNESS'];
3351 $result['OSKTHICKNESS'] = $objQuery['OSKTHICKNESS'];
3352 $result['ODGONIO'] = $objQuery['ODGONIO'];
3353 $result['OSGONIO'] = $objQuery['OSGONIO'];
3354 $result['ODSHRIMER1'] = $objQuery['ODSHIRMER1'];
3355 $result['OSSHRIMER1'] = $objQuery['OSSHIRMER1'];
3356 $result['ODSHRIMER2'] = $objQuery['ODSHIRMER2'];
3357 $result['OSSHRIMER2'] = $objQuery['OSSHIRMER2'];
3358 $result['ODTBUT'] = $objQuery['ODTBUT'];
3359 $result['OSTBUT'] = $objQuery['OSTBUT'];
3360 $result['ANTSEG_COMMENTS'] = $objQuery['ANTSEG_COMMENTS'];
3361 $result["json"] = json_encode($result);
3362 echo json_encode($result);
3363 } elseif ($zone == "RETINA") {
3364 $result['ODDISC'] = $objQuery['ODDISC'];
3365 $result['OSDISC'] = $objQuery['OSDISC'];
3366 $result['ODCUP'] = $objQuery['ODCUP'];
3367 $result['OSCUP'] = $objQuery['OSCUP'];
3368 $result['ODMACULA'] = $objQuery['ODMACULA'];
3369 $result['OSMACULA'] = $objQuery['OSMACULA'];
3370 $result['ODVESSELS'] = $objQuery['ODVESSELS'];
3371 $result['OSVESSELS'] = $objQuery['OSVESSELS'];
3372 $result['ODVITREOUS'] = $objQuery['ODVITREOUS'];
3373 $result['OSVITREOUS'] = $objQuery['OSVITREOUS'];
3374 $result['ODPERIPH'] = $objQuery['ODPERIPH'];
3375 $result['OSPERIPH'] = $objQuery['OSPERIPH'];
3376 $result['ODDRAWING'] = $objQuery['ODDRAWING'];
3377 $result['OSDRAWING'] = $objQuery['OSDRAWING'];
3378 $result['ODCMT'] = $objQuery['ODCMT'];
3379 $result['OSCMT'] = $objQuery['OSCMT'];
3380 $result['RETINA_COMMENTS'] = $objQuery['RETINA_COMMENTS'];
3381 $result["json"] = json_encode($result);
3382 echo json_encode($result);
3383 } elseif ($zone == "NEURO") {
3384 $result['ACT'] = $objQuery['ACT'];
3385 $result['ACT5CCDIST'] = $objQuery['ACT5CCDIST'];
3386 $result['ACT1CCDIST'] = $objQuery['ACT1CCDIST'];
3387 $result['ACT2CCDIST'] = $objQuery['ACT2CCDIST'];
3388 $result['ACT3CCDIST'] = $objQuery['ACT3CCDIST'];
3389 $result['ACT4CCDIST'] = $objQuery['ACT4CCDIST'];
3390 $result['ACT6CCDIST'] = $objQuery['ACT6CCDIST'];
3391 $result['ACT7CCDIST'] = $objQuery['ACT7CCDIST'];
3392 $result['ACT8CCDIST'] = $objQuery['ACT8CCDIST'];
3393 $result['ACT9CCDIST'] = $objQuery['ACT9CCDIST'];
3394 $result['ACT10CCDIST'] = $objQuery['ACT10CCDIST'];
3395 $result['ACT11CCDIST'] = $objQuery['ACT11CCDIST'];
3396 $result['ACT1SCDIST'] = $objQuery['ACT1SCDIST'];
3397 $result['ACT2SCDIST'] = $objQuery['ACT2SCDIST'];
3398 $result['ACT3SCDIST'] = $objQuery['ACT3SCDIST'];
3399 $result['ACT4SCDIST'] = $objQuery['ACT4SCDIST'];
3400 $result['ACT5SCDIST'] = $objQuery['ACT5SCDIST'];
3401 $result['ACT6SCDIST'] = $objQuery['ACT6SCDIST'];
3402 $result['ACT7SCDIST'] = $objQuery['ACT7SCDIST'];
3403 $result['ACT8SCDIST'] = $objQuery['ACT8SCDIST'];
3404 $result['ACT9SCDIST'] = $objQuery['ACT9SCDIST'];
3405 $result['ACT10SCDIST'] = $objQuery['ACT10SCDIST'];
3406 $result['ACT11SCDIST'] = $objQuery['ACT11SCDIST'];
3407 $result['ACT1SCNEAR'] = $objQuery['ACT1SCNEAR'];
3408 $result['ACT2SCNEAR'] = $objQuery['ACT2SCNEAR'];
3409 $result['ACT3SCNEAR'] = $objQuery['ACT3SCNEAR'];
3410 $result['ACT4SCNEAR'] = $objQuery['ACT4SCNEAR'];
3411 $result['ACT5CCNEAR'] = $objQuery['ACT5CCNEAR'];
3412 $result['ACT6CCNEAR'] = $objQuery['ACT6CCNEAR'];
3413 $result['ACT7CCNEAR'] = $objQuery['ACT7CCNEAR'];
3414 $result['ACT8CCNEAR'] = $objQuery['ACT8CCNEAR'];
3415 $result['ACT9CCNEAR'] = $objQuery['ACT9CCNEAR'];
3416 $result['ACT10CCNEAR'] = $objQuery['ACT10CCNEAR'];
3417 $result['ACT11CCNEAR'] = $objQuery['ACT11CCNEAR'];
3418 $result['ACT5SCNEAR'] = $objQuery['ACT5SCNEAR'];
3419 $result['ACT6SCNEAR'] = $objQuery['ACT6SCNEAR'];
3420 $result['ACT7SCNEAR'] = $objQuery['ACT7SCNEAR'];
3421 $result['ACT8SCNEAR'] = $objQuery['ACT8SCNEAR'];
3422 $result['ACT9SCNEAR'] = $objQuery['ACT9SCNEAR'];
3423 $result['ACT10SCNEAR'] = $objQuery['ACT10SCNEAR'];
3424 $result['ACT11SCNEAR'] = $objQuery['ACT11SCNEAR'];
3425 $result['ACT1CCNEAR'] = $objQuery['ACT1CCNEAR'];
3426 $result['ACT2CCNEAR'] = $objQuery['ACT2CCNEAR'];
3427 $result['ACT3CCNEAR'] = $objQuery['ACT3CCNEAR'];
3428 $result['ACT4CCNEAR'] = $objQuery['ACT4CCNEAR'];
3429 $result['ODVF1'] = $objQuery['ODVF1'];
3430 $result['ODVF2'] = $objQuery['ODVF2'];
3431 $result['ODVF3'] = $objQuery['ODVF3'];
3432 $result['ODVF4'] = $objQuery['ODVF4'];
3433 $result['OSVF1'] = $objQuery['OSVF1'];
3434 $result['OSVF2'] = $objQuery['OSVF2'];
3435 $result['OSVF3'] = $objQuery['OSVF3'];
3436 $result['OSVF4'] = $objQuery['OSVF4'];
3437 $result['MOTILITY_RS'] = $objQuery['MOTILITY_RS'];
3438 $result['MOTILITY_RI'] = $objQuery['MOTILITY_RI'];
3439 $result['MOTILITY_RR'] = $objQuery['MOTILITY_RR'];
3440 $result['MOTILITY_RL'] = $objQuery['MOTILITY_RL'];
3441 $result['MOTILITY_LS'] = $objQuery['MOTILITY_LS'];
3442 $result['MOTILITY_LI'] = $objQuery['MOTILITY_LI'];
3443 $result['MOTILITY_LR'] = $objQuery['MOTILITY_LR'];
3444 $result['MOTILITY_LL'] = $objQuery['MOTILITY_LL'];
3445 $result['NEURO_COMMENTS'] = $objQuery['NEURO_COMMENTS'];
3446 $result['STEREOPSIS'] = $objQuery['STEREOPSIS'];
3447 $result['ODNPA'] = $objQuery['ODNPA'];
3448 $result['OSNPA'] = $objQuery['OSNPA'];
3449 $result['VERTFUSAMPS'] = $objQuery['VERTFUSAMPS'];
3450 $result['DIVERGENCEAMPS'] = $objQuery['DIVERGENCEAMPS'];
3451 $result['NPC'] = $objQuery['NPC'];
3452 $result['DACCDIST'] = $objQuery['DACCDIST'];
3453 $result['DACCNEAR'] = $objQuery['DACCNEAR'];
3454 $result['CACCDIST'] = $objQuery['CACCDIST'];
3455 $result['CACCNEAR'] = $objQuery['CACCNEAR'];
3456 $result['ODCOLOR'] = $objQuery['ODCOLOR'];
3457 $result['OSCOLOR'] = $objQuery['OSCOLOR'];
3458 $result['ODCOINS'] = $objQuery['ODCOINS'];
3459 $result['OSCOINS'] = $objQuery['OSCOINS'];
3460 $result['ODREDDESAT'] = $objQuery['ODREDDESAT'];
3461 $result['OSREDDESAT'] = $objQuery['OSREDDESAT'];
3462 $result['ODPUPILSIZE1'] = $objQuery['ODPUPILSIZE1'];
3463 $result['ODPUPILSIZE2'] = $objQuery['ODPUPILSIZE2'];
3464 $result['ODPUPILREACTIVITY'] = $objQuery['ODPUPILREACTIVITY'];
3465 $result['ODAPD'] = $objQuery['ODAPD'];
3466 $result['OSPUPILSIZE1'] = $objQuery['OSPUPILSIZE1'];
3467 $result['OSPUPILSIZE2'] = $objQuery['OSPUPILSIZE2'];
3468 $result['OSPUPILREACTIVITY'] = $objQuery['OSPUPILREACTIVITY'];
3469 $result['OSAPD'] = $objQuery['OSAPD'];
3470 $result['DIMODPUPILSIZE1'] = $objQuery['DIMODPUPILSIZE1'];
3471 $result['DIMODPUPILSIZE2'] = $objQuery['DIMODPUPILSIZE2'];
3472 $result['DIMODPUPILREACTIVITY'] = $objQuery['DIMODPUPILREACTIVITY'];
3473 $result['DIMOSPUPILSIZE1'] = $objQuery['DIMOSPUPILSIZE1'];
3474 $result['DIMOSPUPILSIZE2'] = $objQuery['DIMOSPUPILSIZE2'];
3475 $result['DIMOSPUPILREACTIVITY'] = $objQuery['DIMOSPUPILREACTIVITY'];
3476 $result['PUPIL_COMMENTS'] = $objQuery['PUPIL_COMMENTS'];
3477 $result["json"] = json_encode($result);
3478 echo json_encode($result);
3479 } elseif ($zone == "IMPPLAN") {
3480 $result['IMPPLAN'] = build_IMPPLAN_items($pid, $copy_from);
3481 echo json_encode($result);
3482 } elseif ($zone == "ALL") {
3483 $result['RUL'] = $objQuery['RUL'];
3484 $result['LUL'] = $objQuery['LUL'];
3485 $result['RLL'] = $objQuery['RLL'];
3486 $result['LLL'] = $objQuery['LLL'];
3487 $result['RBROW'] = $objQuery['RBROW'];
3488 $result['LBROW'] = $objQuery['LBROW'];
3489 $result['RMCT'] = $objQuery['RMCT'];
3490 $result['LMCT'] = $objQuery['LMCT'];
3491 $result['RADNEXA'] = $objQuery['RADNEXA'];
3492 $result['LADNEXA'] = $objQuery['LADNEXA'];
3493 $result['RMRD'] = $objQuery['RMRD'];
3494 $result['LMRD'] = $objQuery['LMRD'];
3495 $result['RLF'] = $objQuery['RLF'];
3496 $result['LLF'] = $objQuery['LLF'];
3497 $result['RVFISSURE'] = $objQuery['RVFISSURE'];
3498 $result['LVFISSURE'] = $objQuery['LVFISSURE'];
3499 $result['ODHERTEL'] = $objQuery['ODHERTEL'];
3500 $result['OSHERTEL'] = $objQuery['OSHERTEL'];
3501 $result['HERTELBASE'] = $objQuery['HERTELBASE'];
3502 $result['ODPIC'] = $objQuery['ODPIC'];
3503 $result['OSPIC'] = $objQuery['OSPIC'];
3504 $result['EXT_COMMENTS'] = $objQuery['EXT_COMMENTS'];
3506 $result['OSCONJ'] = $objQuery['OSCONJ'];
3507 $result['ODCONJ'] = $objQuery['ODCONJ'];
3508 $result['ODCORNEA'] = $objQuery['ODCORNEA'];
3509 $result['OSCORNEA'] = $objQuery['OSCORNEA'];
3510 $result['ODAC'] = $objQuery['ODAC'];
3511 $result['OSAC'] = $objQuery['OSAC'];
3512 $result['ODLENS'] = $objQuery['ODLENS'];
3513 $result['OSLENS'] = $objQuery['OSLENS'];
3514 $result['ODIRIS'] = $objQuery['ODIRIS'];
3515 $result['OSIRIS'] = $objQuery['OSIRIS'];
3516 $result['ODKTHICKNESS'] = $objQuery['ODKTHICKNESS'];
3517 $result['OSKTHICKNESS'] = $objQuery['OSKTHICKNESS'];
3518 $result['ODGONIO'] = $objQuery['ODGONIO'];
3519 $result['OSGONIO'] = $objQuery['OSGONIO'];
3520 $result['ANTSEG_COMMENTS'] = $objQuery['ANTSEG_COMMENTS'];
3522 $result['ODDISC'] = $objQuery['ODDISC'];
3523 $result['OSDISC'] = $objQuery['OSDISC'];
3524 $result['ODCUP'] = $objQuery['ODCUP'];
3525 $result['OSCUP'] = $objQuery['OSCUP'];
3526 $result['ODMACULA'] = $objQuery['ODMACULA'];
3527 $result['OSMACULA'] = $objQuery['OSMACULA'];
3528 $result['ODVESSELS'] = $objQuery['ODVESSELS'];
3529 $result['OSVESSELS'] = $objQuery['OSVESSELS'];
3530 $result['ODVITREOUS'] = $objQuery['ODVITREOUS'];
3531 $result['OSVITREOUS'] = $objQuery['OSVITREOUS'];
3532 $result['ODPERIPH'] = $objQuery['ODPERIPH'];
3533 $result['OSPERIPH'] = $objQuery['OSPERIPH'];
3534 $result['ODDRAWING'] = $objQuery['ODDRAWING'];
3535 $result['OSDRAWING'] = $objQuery['OSDRAWING'];
3536 $result['ODCMT'] = $objQuery['ODCMT'];
3537 $result['OSCMT'] = $objQuery['OSCMT'];
3538 $result['RETINA_COMMENTS'] = $objQuery['RETINA_COMMENTS'];
3540 $result['ACT'] = $objQuery['ACT'];
3541 $result['ACT5CCDIST'] = $objQuery['ACT5CCDIST'];
3542 $result['ACT1CCDIST'] = $objQuery['ACT1CCDIST'];
3543 $result['ACT2CCDIST'] = $objQuery['ACT2CCDIST'];
3544 $result['ACT3CCDIST'] = $objQuery['ACT3CCDIST'];
3545 $result['ACT4CCDIST'] = $objQuery['ACT4CCDIST'];
3546 $result['ACT6CCDIST'] = $objQuery['ACT6CCDIST'];
3547 $result['ACT7CCDIST'] = $objQuery['ACT7CCDIST'];
3548 $result['ACT8CCDIST'] = $objQuery['ACT8CCDIST'];
3549 $result['ACT9CCDIST'] = $objQuery['ACT9CCDIST'];
3550 $result['ACT10CCDIST'] = $objQuery['ACT10CCDIST'];
3551 $result['ACT11CCDIST'] = $objQuery['ACT11CCDIST'];
3552 $result['ACT1SCDIST'] = $objQuery['ACT1SCDIST'];
3553 $result['ACT2SCDIST'] = $objQuery['ACT2SCDIST'];
3554 $result['ACT3SCDIST'] = $objQuery['ACT3SCDIST'];
3555 $result['ACT4SCDIST'] = $objQuery['ACT4SCDIST'];
3556 $result['ACT5SCDIST'] = $objQuery['ACT5SCDIST'];
3557 $result['ACT6SCDIST'] = $objQuery['ACT6SCDIST'];
3558 $result['ACT7SCDIST'] = $objQuery['ACT7SCDIST'];
3559 $result['ACT8SCDIST'] = $objQuery['ACT8SCDIST'];
3560 $result['ACT9SCDIST'] = $objQuery['ACT9SCDIST'];
3561 $result['ACT10SCDIST'] = $objQuery['ACT10SCDIST'];
3562 $result['ACT11SCDIST'] = $objQuery['ACT11SCDIST'];
3563 $result['ACT1SCNEAR'] = $objQuery['ACT1SCNEAR'];
3564 $result['ACT2SCNEAR'] = $objQuery['ACT2SCNEAR'];
3565 $result['ACT3SCNEAR'] = $objQuery['ACT3SCNEAR'];
3566 $result['ACT4SCNEAR'] = $objQuery['ACT4SCNEAR'];
3567 $result['ACT5CCNEAR'] = $objQuery['ACT5CCNEAR'];
3568 $result['ACT6CCNEAR'] = $objQuery['ACT6CCNEAR'];
3569 $result['ACT7CCNEAR'] = $objQuery['ACT7CCNEAR'];
3570 $result['ACT8CCNEAR'] = $objQuery['ACT8CCNEAR'];
3571 $result['ACT9CCNEAR'] = $objQuery['ACT9CCNEAR'];
3572 $result['ACT10CCNEAR'] = $objQuery['ACT10CCNEAR'];
3573 $result['ACT11CCNEAR'] = $objQuery['ACT11CCNEAR'];
3574 $result['ACT5SCNEAR'] = $objQuery['ACT5SCNEAR'];
3575 $result['ACT6SCNEAR'] = $objQuery['ACT6SCNEAR'];
3576 $result['ACT7SCNEAR'] = $objQuery['ACT7SCNEAR'];
3577 $result['ACT8SCNEAR'] = $objQuery['ACT8SCNEAR'];
3578 $result['ACT9SCNEAR'] = $objQuery['ACT9SCNEAR'];
3579 $result['ACT10SCNEAR'] = $objQuery['ACT10SCNEAR'];
3580 $result['ACT11SCNEAR'] = $objQuery['ACT11SCNEAR'];
3581 $result['ACT1CCNEAR'] = $objQuery['ACT1CCNEAR'];
3582 $result['ACT2CCNEAR'] = $objQuery['ACT2CCNEAR'];
3583 $result['ACT3CCNEAR'] = $objQuery['ACT3CCNEAR'];
3584 $result['ACT4CCNEAR'] = $objQuery['ACT4CCNEAR'];
3585 $result['ODVF1'] = $objQuery['ODVF1'];
3586 $result['ODVF2'] = $objQuery['ODVF2'];
3587 $result['ODVF3'] = $objQuery['ODVF3'];
3588 $result['ODVF4'] = $objQuery['ODVF4'];
3589 $result['OSVF1'] = $objQuery['OSVF1'];
3590 $result['OSVF2'] = $objQuery['OSVF2'];
3591 $result['OSVF3'] = $objQuery['OSVF3'];
3592 $result['OSVF4'] = $objQuery['OSVF4'];
3593 $result['MOTILITY_RS'] = $objQuery['MOTILITY_RS'];
3594 $result['MOTILITY_RI'] = $objQuery['MOTILITY_RI'];
3595 $result['MOTILITY_RR'] = $objQuery['MOTILITY_RR'];
3596 $result['MOTILITY_RL'] = $objQuery['MOTILITY_RL'];
3597 $result['MOTILITY_LS'] = $objQuery['MOTILITY_LS'];
3598 $result['MOTILITY_LI'] = $objQuery['MOTILITY_LI'];
3599 $result['MOTILITY_LR'] = $objQuery['MOTILITY_LR'];
3600 $result['MOTILITY_LL'] = $objQuery['MOTILITY_LL'];
3601 $result['NEURO_COMMENTS'] = $objQuery['NEURO_COMMENTS'];
3602 $result['STEREOPSIS'] = $objQuery['STEREOPSIS'];
3603 $result['ODNPA'] = $objQuery['ODNPA'];
3604 $result['OSNPA'] = $objQuery['OSNPA'];
3605 $result['VERTFUSAMPS'] = $objQuery['VERTFUSAMPS'];
3606 $result['DIVERGENCEAMPS'] = $objQuery['DIVERGENCEAMPS'];
3607 $result['NPC'] = $objQuery['NPC'];
3608 $result['DACCDIST'] = $objQuery['DACCDIST'];
3609 $result['DACCNEAR'] = $objQuery['DACCNEAR'];
3610 $result['CACCDIST'] = $objQuery['CACCDIST'];
3611 $result['CACCNEAR'] = $objQuery['CACCNEAR'];
3612 $result['ODCOLOR'] = $objQuery['ODCOLOR'];
3613 $result['OSCOLOR'] = $objQuery['OSCOLOR'];
3614 $result['ODCOINS'] = $objQuery['ODCOINS'];
3615 $result['OSCOINS'] = $objQuery['OSCOINS'];
3616 $result['ODREDDESAT'] = $objQuery['ODREDDESAT'];
3617 $result['OSREDDESAT'] = $objQuery['OSREDDESAT'];
3618 $result['ODPUPILSIZE1'] = $objQuery['ODPUPILSIZE1'];
3619 $result['ODPUPILSIZE2'] = $objQuery['ODPUPILSIZE2'];
3620 $result['ODPUPILREACTIVITY'] = $objQuery['ODPUPILREACTIVITY'];
3621 $result['ODAPD'] = $objQuery['ODAPD'];
3622 $result['OSPUPILSIZE1'] = $objQuery['OSPUPILSIZE1'];
3623 $result['OSPUPILSIZE2'] = $objQuery['OSPUPILSIZE2'];
3624 $result['OSPUPILREACTIVITY'] = $objQuery['OSPUPILREACTIVITY'];
3625 $result['OSAPD'] = $objQuery['OSAPD'];
3626 $result['DIMODPUPILSIZE1'] = $objQuery['DIMODPUPILSIZE1'];
3627 $result['DIMODPUPILSIZE2'] = $objQuery['DIMODPUPILSIZE2'];
3628 $result['DIMODPUPILREACTIVITY'] = $objQuery['DIMODPUPILREACTIVITY'];
3629 $result['DIMOSPUPILSIZE1'] = $objQuery['DIMOSPUPILSIZE1'];
3630 $result['DIMOSPUPILSIZE2'] = $objQuery['DIMOSPUPILSIZE2'];
3631 $result['DIMOSPUPILREACTIVITY'] = $objQuery['DIMOSPUPILREACTIVITY'];
3632 $result['PUPIL_COMMENTS'] = $objQuery['PUPIL_COMMENTS'];
3633 $result['IMP'] = $objQuery['IMP'];
3634 $result["json"] = json_encode($result);
3635 echo json_encode($result);
3636 } elseif ($zone == "READONLY") {
3637 $result = $objQuery;
3638 $count_rx = '0';
3639 $query1 = "select * from form_eye_mag_wearing where PID=? and ENCOUNTER=? and FORM_ID >'0' ORDER BY RX_NUMBER";
3640 $wear = sqlStatement($query1, array($pid,$_SESSION['encounter']));
3641 while ($wearing = sqlFetchArray($wear)) {
3642 ${"display_W_$count_rx"} = '';
3643 ${"ODSPH_$count_rx"} = $wearing['ODSPH'];
3644 ${"ODCYL_$count_rx"} = $wearing['ODCYL'];
3645 ${"ODAXIS_$count_rx"} = $wearing['ODAXIS'];
3646 ${"OSSPH_$count_rx"} = $wearing['OSSPH'];
3647 ${"OSCYL_$count_rx"} = $wearing['OSCYL'];
3648 ${"OSAXIS_$count_rx"} = $wearing['OSAXIS'];
3649 ${"ODMIDADD_$count_rx"} = $wearing['ODMIDADD'];
3650 ${"OSMIDADD_$count_rx"} = $wearing['OSMIDADD'];
3651 ${"ODADD_$count_rx"} = $wearing['ODADD'];
3652 ${"OSADD_$count_rx"} = $wearing['OSADD'];
3653 ${"ODVA_$count_rx"} = $wearing['ODVA'];
3654 ${"OSVA_$count_rx"} = $wearing['OSVA'];
3655 ${"ODNEARVA_$count_rx"} = $wearing['ODNEARVA'];
3656 ${"OSNEARVA_$count_rx"} = $wearing['OSNEARVA'];
3657 ${"ODPRISM_$count_rx"} = $wearing['ODPRISM'] ?? '';
3658 ${"OSPRISM_$count_rx"} = $wearing['OSPRISM'] ?? '';
3659 ${"W_$count_rx"} = '1';
3660 ${"RX_TYPE_$count_rx"} = $wearing['RX_TYPE'];
3661 ${"ODHPD_$count_rx"} = $wearing['ODHPD'];
3662 ${"ODHBASE_$count_rx"} = $wearing['ODHBASE'];
3663 ${"ODVPD_$count_rx"} = $wearing['ODVPD'];
3664 ${"ODVBASE_$count_rx"} = $wearing['ODVBASE'];
3665 ${"ODSLABOFF_$count_rx"} = $wearing['ODSLABOFF'];
3666 ${"ODVERTEXDIST_$count_rx"} = $wearing['ODVERTEXDIST'];
3667 ${"OSHPD_$count_rx"} = $wearing['OSHPD'];
3668 ${"OSHBASE_$count_rx"} = $wearing['OSHBASE'];
3669 ${"OSVPD_$count_rx"} = $wearing['OSVPD'];
3670 ${"OSVBASE_$count_rx"} = $wearing['OSVBASE'];
3671 ${"OSSLABOFF_$count_rx"} = $wearing['OSSLABOFF'];
3672 ${"OSVERTEXDIST_$count_rx"} = $wearing['OSVERTEXDIST'];
3673 ${"ODMPDD_$count_rx"} = $wearing['ODMPDD'];
3674 ${"ODMPDN_$count_rx"} = $wearing['ODMPDN'];
3675 ${"OSMPDD_$count_rx"} = $wearing['OSMPDD'];
3676 ${"OSMPDN_$count_rx"} = $wearing['OSMPDN'];
3677 ${"BPDD_$count_rx"} = $wearing['BPDD'];
3678 ${"BPDN_$count_rx"} = $wearing['BPDN'];
3679 ${"LENS_MATERIAL_$count_rx"} = $wearing['LENS_MATERIAL'];
3680 ${"LENS_TREATMENTS_$count_rx"} = $wearing['LENS_TREATMENTS'];
3681 ${"COMMENTS_$count_rx"} = $wearing['COMMENTS'];
3683 $result['IMPPLAN'] = build_IMPPLAN_items($pid, $copy_from);
3684 $result['query'] = $query;
3685 $result["json"] = json_encode($result);
3686 echo json_encode($result);
3691 * This builds the IMPPLAN_items variable for a given pid and form_id.
3692 * @param string $pid patient_id
3693 * @param string $form_id field id in table form_eye_mag
3694 * @return object IMPPLAN_items
3696 function build_IMPPLAN_items($pid, $form_id)
3698 global $form_folder;
3699 $query = "select * from form_" . $form_folder . "_impplan where form_id=? and pid=? ORDER BY IMPPLAN_order";
3700 $newdata = array();
3701 $fres = sqlStatement($query, array($form_id,$pid));
3702 $i = 0;
3703 while ($frow = sqlFetchArray($fres)) {
3704 $IMPPLAN_items[$i]['form_id'] = $frow['form_id'];
3705 $IMPPLAN_items[$i]['pid'] = $frow['pid'];
3706 $IMPPLAN_items[$i]['id'] = $frow['id'];
3707 $IMPPLAN_items[$i]['title'] = $frow['title'];
3708 $IMPPLAN_items[$i]['code'] = $frow['code'];
3709 $IMPPLAN_items[$i]['codetype'] = $frow['codetype'];
3710 $IMPPLAN_items[$i]['codedesc'] = $frow['codedesc'];
3711 $IMPPLAN_items[$i]['codetext'] = $frow['codetext'];
3712 $IMPPLAN_items[$i]['plan'] = $frow['plan'];
3713 $IMPPLAN_items[$i]['PMSFH_link'] = $frow['PMSFH_link'];
3714 $IMPPLAN_items[$i]['IMPPLAN_order'] = $frow['IMPPLAN_order'];
3715 $i++;
3718 return $IMPPLAN_items ?? [];
3722 * This builds the CODING_items variable for a given pid and encounter.
3723 * @param string $pid patient_id
3724 * @param string $encounter field id in table form_encounters
3725 * @return object CODING_items
3727 function build_CODING_items($pid, $encounter)
3729 $query = "select * from billing where encounter=? and pid=? ORDER BY id";
3730 $fres = sqlStatement($query, array($encounter,$pid));
3731 $i = 0;
3733 while ($frow = sqlFetchArray($fres)) {
3734 $CODING_items[$i]['encounter'] = $frow['encounter'];
3735 $CODING_items[$i]['pid'] = $frow['pid'];
3736 $CODING_items[$i]['id'] = $frow['id'];
3737 $CODING_items[$i]['codetype'] = $frow['code_type'];
3738 $CODING_items[$i]['codedesc'] = $frow['code_desc'] ?? '';
3739 $CODING_items[$i]['codetext'] = $frow['code_text'];
3740 $CODING_items[$i]['justify'] = $frow['justify'];
3741 $i++;
3744 return $CODING_items ?? '';
3748 * This function builds an array of documents for this patient ($pid).
3749 * We first list all the categories this practice has created by name and by category_id
3750 * for this patient ($pid)
3751 * Each document info from documents table is added to these as arrays
3753 * @param string $pid patient_id
3754 * @return array($documents)
3756 function document_engine($pid)
3758 $sql1 = sqlStatement("Select * from categories");
3759 while ($row1 = sqlFetchArray($sql1)) {
3760 $categories[] = $row1;
3761 $row1['name'] = preg_replace('/ - Eye/', '', $row1['name']);
3763 $my_name[$row1['id']] = $row1['name'];
3764 $children_names[$row1['parent'] ?? ''][] = $row1['name'] ?? '';
3765 if (!empty($parent_name)) {
3766 $parent_name[$row1['name']] = $my_name[$row1['parent']];
3768 if (($row1['value'] ?? '') > '') {
3769 //if there is a value, tells us what segment of exam ($zone) this belongs in...
3770 $zones[$row1['value']][] = $row1;
3771 } else {
3772 if ($row1['name'] != "Categories") {
3773 $zones['OTHER'][] = $row1;
3778 $query = "Select *, categories.name as cat_name
3779 from
3780 categories, documents,categories_to_documents
3781 where documents.foreign_id=? and documents.id=categories_to_documents.document_id and
3782 categories_to_documents.category_id=categories.id and documents.deleted = 0 ORDER BY categories.name";
3783 $sql2 = sqlStatement($query, array($pid));
3784 while ($row2 = sqlFetchArray($sql2)) {
3785 //the document may not be created on the same day as the encounter, use encounter date first
3786 //get encounter date from encounter id
3787 $row2['cat_name'] = preg_replace('/ - Eye/', '', $row2['cat_name']);
3788 $row2['display_url'] = preg_replace("|file:///.*/sites/|", $GLOBALS['webroot'] . "/sites/", $row2['url']);
3789 if ($row2['encounter_id']) {
3790 $visit = getEncounterDateByEncounter($row2['encounter_id']);
3791 $row2['encounter_date'] = oeFormatSDFT(strtotime($visit['date']));
3792 } else {
3793 $row2['encounter_date'] = $row2['docdate'];
3796 $documents[] = $row2;
3797 $docs_in_cat_id[$row2['category_id']][] = $row2;
3798 if ($row2['value'] > '') {
3799 $docs_in_zone[$row2['value']][] = $row2;
3800 } else {
3801 $docs_in_zone['OTHER'][] = $row2;
3804 $docs_in_name[$row2['cat_name']][] = $row2;
3805 $docs_by_date[$row2['encounter_date']][] = $row2;
3808 $documents['categories'] = $categories;
3809 $documents['my_name'] = $my_name;
3810 $documents['children_names'] = $children_names;
3811 $documents['parent_name'] = $parent_name ?? null;
3812 $documents['zones'] = $zones;
3813 $documents['docs_in_zone'] = $docs_in_zone ?? '';
3814 $documents['docs_in_cat_id'] = $docs_in_cat_id ?? '';
3815 $documents['docs_in_name'] = $docs_in_name ?? '';
3816 $documents['docs_by_date'] = $docs_by_date ?? '';
3818 return array($documents);
3822 * This function returns ICONS with links for a specific clinical subsection of the Document Library.
3824 * @param string $pid value = patient id
3825 * @param string $encounter is the encounter_id
3826 * @param string $category_value options EXT,ANTSEG,POSTSEG,NEURO,OTHER
3827 * These values are taken from the "value" field in the Documents' table "categories".
3828 * They allow us to regroup the categories how we like them.
3829 * @return array($imaging,$episode)
3831 function display($pid, $encounter, $category_value)
3833 global $form_folder;
3834 global $id;
3835 global $documents;
3836 $episode = '';
3838 * Each document is stored in a specific category. Think of a category as a Folder.
3839 * Practices can add/alter/delete category names as they wish.
3840 * In the Eye Form we link to these categories, not by name but by what part of the physical exam they belong to.
3841 * We needed a pointer to tell us if a document category is specific to a clinical section.
3842 * For example, a photo of the retina is stored in the category we named "Fundus".
3843 * A photo of the optic nerve is stored in the "Optic Disc" category. Someone else might change the
3844 * name to "Optic Nerve", or even a different language. No matter, these categories include documents
3845 * we would like to directly link to/open from the RETINA section of the link.
3846 * The categories table does have an unused field - "value".
3847 * This is where we link document categories to a clinical zone. We add the clinical section name
3848 * on install but the end user can change or add others as the devices evolve.
3849 * Currently the base install has EXT,ANTSEG,POSTSEG,NEURO
3850 * New names new categories. OCT would not have been a category 5 years ago.
3851 * Who knows what is next? Gene-lab construction?
3852 * So the name is user assigned as is the location.
3853 * Thus we need to build out the Documents section by adding another layer "zones"
3854 * to the associative array.
3856 if (!$documents) {
3857 list($documents) = document_engine($pid);
3860 for ($j = 0; $j < count($documents['zones'][$category_value]); $j++) {
3861 $count_here = empty($documents['docs_in_cat_id'][$documents['zones'][$category_value][$j]['id']]) ? 0 : count($documents['docs_in_cat_id'][$documents['zones'][$category_value][$j]['id']]);
3863 $id_to_show = $documents['docs_in_cat_id'][$documents['zones'][$category_value][$j]['id']][$count_here - 1]['document_id'] ?? '';
3864 $documents['zones'][$category_value][$j]['name'] = preg_replace("( - Eye)", "", $documents['zones'][$category_value][$j]['name']);
3865 $episode .= "<tr>
3866 <td class='right'><span class='font-weight-bold'>" . text($documents['zones'][$category_value][$j]['name']) . "</span>:&nbsp;</td>
3867 <td>
3868 <a onclick=\"openNewForm('" . $GLOBALS['webroot'] . "/controller.php?document&upload&patient_id=" . attr($pid) . "&parent_id=" . attr($documents['zones'][$category_value][$j]['id']) . "&', '" . xla('Upload') . " " . attr($documents['zones'][$category_value][$j]['name']) . "');\" href='#'>
3869 <img src='../../forms/" . $form_folder . "/images/upload_file.png' class='little_image'>
3870 </a>
3871 </td>
3872 <td>
3873 <a onclick=\"return showpnotes('" . $id_to_show . "');\">
3874 <img src='../../forms/" . $form_folder . "/images/upload_multi.png' class='little_image'>
3875 </a>
3876 </td>
3877 <td>";
3878 //open via OpenEMR Documents with treemenu
3879 if ($count_here > '0') {
3880 $episode .= '<a onclick="openNewForm(\'' . $GLOBALS['webroot'] . '/controller.php?document&view&patient_id=' . $pid . '&doc_id=' . $id_to_show . '\',\'' . xla('Documents') . ': ' . attr($documents['zones'][$category_value][$j]['name']) . '\');"><img src="../../forms/' . $form_folder . '/images/jpg.png" class="little_image" /></a>';
3883 $episode .= '</td></tr>';
3884 if (!empty($i)) {
3885 $i++;
3886 } else {
3887 $i = 1;
3891 return array($documents,$episode);
3895 * This is an application style menu (bootstrap) to start shifting clinical functions into a single page.
3897 * @param string $pid is the patient id
3898 * @param string $encounter is the encounter_id
3899 * @param string $title is the form title
3901 * @return nothing, outputs directly to screen
3903 function menu_overhaul_top($pid, $encounter, $title = "Eye Exam")
3905 global $form_folder;
3906 global $prov_data;
3907 global $encounter;
3908 global $form_id;
3909 global $display;
3910 global $provider_id;
3912 $providerNAME = $prov_data['fname'] . " " . $prov_data['lname'];
3913 if ($prov_data['suffix']) {
3914 $providerNAME .= ", " . $prov_data['suffix'];
3917 if (!empty($_REQUEST['display']) && ($_REQUEST['display'] == "fullscreen")) {
3918 $fullscreen_disable = 'disabled';
3919 } else {
3920 $frame_disabled = 'disabled';
3921 echo "<style>.tabHide{ display:none; }</style>";
3924 <!-- Navigation -->
3925 <nav class="navbar fixed-top navbar-custom navbar-bright navbar-inner navbar-expand-lg" data-role="page banner navigation"
3926 style="margin-bottom: 0;z-index: 9999999;">
3927 <!-- Brand and toggle get grouped for better mobile display -->
3928 <div class="container-fluid" style="margin-top:0px;padding:2px;">
3929 <div class="navbar-brand" style="color:black;">
3930 &nbsp;
3931 <img src="<?php echo $GLOBALS['webroot']; ?>/sites/default/images/login_logo.gif" class="little_image">
3932 <span class="brand"><?php echo xlt('Eye Exam'); ?></span>
3933 </div>
3934 <div class="navbar-collapse oer-navbar-collapse mr-auto mt-2 mt-lg-0" id="oer-navbar-collapse-1">
3935 <ul class="navbar-nav mr-auto">
3936 <li class="dropdown">
3937 <a class="dropdown-toggle" data-toggle="dropdown" id="menu_dropdown_file" role="button" aria-expanded="true"><?php echo xlt("File"); ?> </a>
3938 <ul class="dropdown-menu" role="menu">
3939 <li class="nav-lik" id="menu_PRINT_narrative" name="menu_PRINT_report"><a class="nav-link black" id="BUTTON_PRINT_report" target="_new" href="<?php echo $GLOBALS['webroot']; ?>/interface/patient_file/report/custom_report.php?printable=1&pdf=0&<?php echo attr_url($form_folder) . "_" . attr_url($form_id) . "=" . attr_url($encounter); ?>"><?php echo xlt("Print Report"); ?></a></li>
3940 <li class="nav-ite" id="menu_PRINT_narrative_2" name="menu_PRINT_report_2"><a class="nav-link black" id="BUTTON_PRINT_report_2" target="_new" href="#"
3941 onclick="top.restoreSession(); create_task('<?php echo attr($provider_id); ?>','Report','menu'); return false;">
3942 <?php echo xlt("Save Report as PDF"); ?></a></li>
3943 </ul>
3944 </li>
3945 <li class="dropdown">
3946 <a class="dropdown-toggle" data-toggle="dropdown" id="menu_dropdown_edit" role="button" aria-expanded="true"><?php echo xlt("Edit"); ?> </a>
3947 <ul class="dropdown-menu" role="menu">
3948 <li id="menu_Defaults" name="menu_Defaults" class="">
3949 <a class="nav-link black"
3950 id="BUTTON_Defaults_menu"
3951 onclick="openNewForm('<?php echo $GLOBALS['webroot']; ?>/interface/super/edit_list.php?list_id=Eye_defaults_<?php echo attr($provider_id); ?>', '<?php echo xla('Default Exam Values'); ?>');"
3952 name="provider_todo"
3953 href="JavaScript:void(0);">
3954 <?php echo xlt("Default Values"); ?> &nbsp;
3955 <span class="menu_icon"><i class="fa fa-pencil-alt fa-fw"></i> </span></a></li>
3956 <li id="menu_TEXT" name="menu_TEXT" class="active">
3957 <a class="nav-link black" href="#"><?php echo xlt("Text"); ?><span class="menu_icon">Ctl-T</span></a></li>
3958 <li id="menu_DRAW" name="menu_DRAW">
3959 <a class="nav-link black" href="#" id="BUTTON_DRAW_menu" name="BUTTON_DRAW_menu"><?php echo xlt("Draw"); ?><span class="menu_icon">Ctl-D</span></a></li>
3960 <li id="menu_QP" name="menu_QP">
3961 <a class="nav-link black" href="#" id="BUTTON_QP_menu" name="BUTTON_QP_menu"><?php echo xlt("Quick Picks"); ?><span class="menu_icon">Ctl-B</span></a></li>
3962 <li id="menu_PRIORS" name="menu_PRIORS">
3963 <a class="nav-link black" href="#"><?php echo xlt("Prior Visits"); ?><span class="menu_icon">Ctl-P</span></a></li>
3964 <li id="menu_KB" name="menu_KB">
3965 <a class="nav-link black" href="#"><?php echo xlt("Shorthand"); ?><span class="menu_icon">Ctl-K</span></a></li>
3966 <?php
3968 // This only shows up in fullscreen currently so hide it.
3969 // If the decision is made to show this is framed openEMR, then display it
3971 if ($display !== "fullscreen") { ?>
3972 <li class="divider"></li>
3973 <li id="menu_fullscreen" name="menu_fullscreen" <?php echo ($fullscreen ?? ''); ?>>
3974 <a class="nav-link black"
3975 onclick="openNewForm(<?php echo attr_js($GLOBALS['webroot']); ?> + '/interface/patient_file/encounter/load_form.php?formname=fee_sheet');top.restoreSession();dopopup(<?php echo attr_js($_SERVER['REQUEST_URI']); ?> + '&display=fullscreen&encounter=' + <?php echo attr_js(urlencode($encounter)); ?>);"
3976 href="JavaScript:void(0);"
3977 ><?php echo xlt('Fullscreen'); ?></a>
3978 </li>
3979 <?php
3980 } ?>
3981 </ul>
3982 </li>
3984 <li class="dropdown">
3985 <a class="dropdown-toggle" data-toggle="dropdown" id="menu_dropdown_view" role="button" aria-expanded="true"><?php echo xlt("View"); ?> </a>
3986 <ul class="dropdown-menu" role="menu">
3987 <li id="menu_HPI" name="menu_HPI"><a class="nav-link black" href="#"><?php echo xlt("HPI"); ?></a></li>
3988 <li id="menu_PMH" name="menu_PMH"><a class="nav-link black" href="#"><?php echo xlt("PMH{{Past Medical History}}"); ?></a></li>
3989 <li id="menu_EXT" name="menu_EXT" ><a class="nav-link black" href="#"><?php echo xlt("External"); ?></a></li>
3990 <li id="menu_ANTSEG" name="menu_ANTSEG" ><a class="nav-link black" href="#"><?php echo xlt("Anterior Segment"); ?></a></li>
3991 <li id="menu_POSTSEG" name="menu_POSTSEG" ><a class="nav-link black" href="#"><?php echo xlt("Posterior Segment"); ?></a></li>
3992 <li id="menu_NEURO" name="menu_NEURO" ><a class="nav-link black" href="#"><?php echo xlt("Neuro"); ?></a></li>
3993 <li id="menu_IMPPLAN" name="menu_IMPPLAN" ><a class="nav-link black" href="#"><?php echo xlt("Imp Plan"); ?></a></li>
3994 <li class="divider"></li>
3995 <li id="menu_Right_Panel" name="menu_Right_Panel"><a class="nav-link black" href="#"><?php echo xlt("PMSFH Panel"); ?><span class="menu_icon"><i class="fa fa-list" ></i></span></a></li>
3996 <li id="menu_left_tabs" name="menu_left_tabs"><a class="nav-link black" href="#"><?php echo xlt("Chart View"); ?><span class="menu_icon"><i class="fa fa-user-md" ></i></span></a></li>
3997 </ul>
3998 </li>
3999 <li class="dropdown">
4000 <a class="dropdown-toggle" data-toggle="dropdown"
4001 id="menu_dropdown_library" role="button"
4002 aria-expanded="true"><?php echo xlt("Library"); ?> </a>
4003 <ul class="dropdown-menu" role="menu">
4004 <li id="menu_IOP_graph" name="menu_IOP_graph" ><a class="nav-link black" href="#"><?php echo xlt("IOP Graph"); ?></a></li>
4005 </ul>
4006 </li>
4007 <li class="dropdown">
4008 <a class="dropdown-toggle" data-toggle="dropdown"
4009 id="menu_dropdown_help" role="button"
4010 aria-expanded="true"><?php echo xlt("Help"); ?> </a>
4011 <ul class="dropdown-menu" role="menu" aria-labelledby="menu1">
4012 <li>
4013 <a class="nav-link black" href="#" tabindex="-1" id="tooltips_toggle" name="tooltips_toggle">
4014 <i class="fa fa-help"></i> <?php echo xlt("Tooltips"); ?>
4015 <span id="tooltips_status" name="tooltips_status"></span>
4016 <span class="menu_icon"><i title="<?php echo xla('Turn the Tooltips on/off'); ?>" id="qtip_icon" class="fa fa-check fa-1"></i></span></a>
4017 </li>
4018 <li>
4019 <a class="nav-link black" tabindex="-1" target="_shorthand" href="<?php echo $GLOBALS['webroot']; ?>/interface/forms/eye_mag/help.php">
4020 <i class="fa fa-help"></i> <?php echo xlt("Shorthand Help"); ?>
4021 <span class="menu_icon">
4022 <i title="<?php echo xla('Click for Shorthand Help.'); ?>" class="fa fa-info-circle fa-1"></i></span></a>
4023 </li>
4024 </ul>
4025 </li>
4026 </ul>
4027 <ul class="nav navbar-nav navbar-right my-2 my-lg-0">
4028 <li><span style="margin-right:15px;color:black;" onclick="editScripts('<?php echo $GLOBALS['web_root']; ?>/controller.php?prescription&list&id=<?php echo attr_url($pid); ?>');">eRx</button>
4029 </span></li>
4030 <li ><span id="active_flag" name="active_flag" style="margin-right:15px;color:red;"> <?php echo xlt('Active Chart'); ?> </span>
4031 <span name="active_icon" id="active_icon" style="color:black;"><i class='fa fa-toggle-on'></i></span></li>
4033 </ul>
4035 </div><!-- /.navbar-collapse -->
4036 </div>
4037 </nav>
4038 <?php
4039 return;
4042 * This is currently a floating div top with patient demographics and such.
4043 * Used in fullscreen mode at the top.
4045 * @param string $pid patient_id
4046 * @param string $encounter is the current encounter number
4047 * @return nothing, outputs directly to screen
4049 function menu_overhaul_left($pid, $encounter)
4051 global $form_folder;
4052 global $pat_data;
4053 global $visit_date;
4054 global $documents;
4055 global $display;
4056 global $reason;
4057 global $priors;
4058 global $pcp_data;
4059 global $ref_data;
4060 global $ins_coA;
4061 global $ins_coB;
4064 * find out if the patient has a photo
4066 if (!$documents) {
4067 list($documents) = document_engine($pid);
4070 <div class="borderShadow row" id="title_bar">
4071 <div id="left_menu" name="left_menu" class="col-sm-4" style="padding-left: 18px;">
4072 <table style="text-align:left;">
4073 <tr><td class="right" >
4074 <?php
4075 $age = getPatientAgeDisplay($pat_data['DOB'], ($encounter_date ?? ''));
4076 $DOB = oeFormatShortDate($pat_data['DOB']);
4077 echo "<span class='font-weight-bold'>" . xlt('Name') . ":</span> </td><td nowrap> &nbsp;" . text($pat_data['fname']) . " " . text($pat_data['lname']) . " (" . text($pid) . ")</td></tr>
4078 <tr><td class='right'><span class='font-weight-bold'>" . xlt('DOB') . ":</span></td><td nowrap> &nbsp;" . text($DOB) . "&nbsp;&nbsp;(" . text($age) . ")";
4080 <?php
4082 </td>
4083 </tr>
4084 <?php
4085 echo "<tr><td class='right' nowrap><span class='font-weight-bold'>" . xlt('Visit Date') . ":</span></td><td>&nbsp;" . $visit_date . "</td></tr>";
4087 <tr><td class="right" style="vertical-align:top;" nowrap><span style="font-weight:bold;"><?php echo xlt("Provider"); ?>:</span>&nbsp;</td>
4088 <td><?php echo text(getProviderName(getProviderIdOfEncounter($encounter))); ?></td>
4089 </tr>
4091 <tr>
4092 <td class="right" style="vertical-align:top;" nowrap><span style="font-weight:bold;"><?php echo xlt("Reason"); ?>:</span>&nbsp;</td>
4093 <td><?php echo text($reason); ?></td>
4094 </tr>
4095 <?php
4096 if ($priors[0]['TODO'] ?? '') {
4098 <tr>
4099 <td class="right" style="vertical-align:top;" nowrap><span style="font-weight:bold;"><?php echo xlt("Plan"); ?>:</span>&nbsp;</td>
4100 <td style="vertical-align:top;">
4101 <?php
4102 $j = 1;
4103 foreach ($priors[0]['TODO'] as $plan) {
4104 echo "<span class='button'>" . $j++ . "</span> " . text($plan['ORDER_DETAILS']) . "<br />";
4107 </td>
4108 </tr>
4109 <?php } ?>
4110 </table>
4111 </div>
4112 <div id="left_menu3" name="left_menu3" class="col-sm-3" style="font-size:1.0em;">
4113 <?php //if the patient has a photograph, use it else use generic avitar thing.
4115 if (!empty($documents['docs_in_name']['Patient Photograph'][0])) {
4117 <object><embed
4118 src="<?php echo $GLOBALS['webroot']; ?>/controller.php?document&retrieve&patient_id=<?php echo attr($pid); ?>&document_id=<?php echo attr($documents['docs_in_name']['Patient Photograph'][0]['id']); ?>&as_file=false&original_file=true&disable_exit=false&show_original=true&context=patient_picture"
4120 Xsrc="<?php echo $GLOBALS['webroot']; ?>/controller.php?document&amp;retrieve&amp;patient_id=<?php echo attr($pid); ?>&amp;document_id=<?php echo attr($documents['docs_in_name']['Patient Photograph'][0]['id']); ?>&amp;as_file=false" frameborder="0"
4121 type="<?php echo attr($documents['docs_in_name']['Patient Photograph'][0]['mimetype']); ?>" allowscriptaccess="always" allowfullscreen="false" height="100"></embed></object>
4122 <?php
4123 } else {
4125 <object><embed src="<?php echo $GLOBALS['web_root']; ?>/interface/forms/<?php echo $form_folder; ?>/images/anon.gif" frameborder="0"
4126 type="image/gif" height="50"></embed></object>
4127 <?php
4130 </div>
4132 <div id="left_menu2" name="left_menu2" class="col-sm-4" style="font-size:1.0em;">
4134 <div style="position:relative;float:left;padding-left:18px;top:0px;">
4135 <table style="border:1pt;font-size:1.0em;">
4136 <tr>
4137 <td class="right"><span style="font-weight:bold;"><?php echo xlt("PCP"); ?>:</span>&nbsp;</td>
4138 <td class="left"> <span id="pcp_name"><?php echo text($pcp_data['fname'] ?? '') . " " . text($pcp_data['lname'] ?? ''); ?><?php if ($pcp_data['suffix'] ?? '') {
4139 echo ", " . text($pcp_data['suffix']);} ?></span></td>
4140 </td>
4141 </tr>
4143 <tr><td class="right" nowrap><span style="font-weight:bold;"><?php echo xlt("Referred By"); ?>:</span>&nbsp;</td>
4144 <td class="left"> <span id="ref_name"><?php echo text($ref_data['fname'] ?? '') . " " . text($ref_data['lname'] ?? ''); ?><?php if ($ref_data['suffix'] ?? '') {
4145 echo ", " . text($ref_data['suffix']);} ?></span></td>
4146 </tr>
4147 <tr><td class="right"><span style="font-weight:bold;"><?php echo xlt("Insurance"); ?>:</span>&nbsp;</td><td class="left">&nbsp;<?php echo text($ins_coA); ?></td></tr>
4148 <tr><td class="right"><span style="font-weight:bold;"><?php echo xlt("Secondary"); ?>:</span>&nbsp;</td><td class="left">&nbsp;<?php echo text($ins_coB); ?></td></tr>
4149 <tr><td class="right"><span style="font-weight:bold;"><?php echo xlt("Pharmacy"); ?>:</span>&nbsp;</td>
4150 <td class="left">&nbsp;
4151 <?php
4152 if (!empty($pat_data['pharmacy_id'])) {
4153 $sql = "SELECT d.id, d.name, a.line1, a.city, " .
4154 "a.state, p.area_code, p.prefix, p.number FROM pharmacies AS d " .
4155 "LEFT OUTER JOIN addresses AS a ON a.foreign_id = d.id " .
4156 "LEFT OUTER JOIN phone_numbers AS p ON p.foreign_id = d.id " .
4157 "AND p.type = 2 where d.id=? " .
4158 "ORDER BY state, city, name, area_code, prefix, number";
4159 $pharm = sqlQuery($sql, array($pat_data['pharmacy_id']));
4160 echo text($pharm['name'] . ", " . $pharm['city'] . " " . $pharm['state']);
4163 </td></tr>
4165 </table>
4166 </div>
4167 </div>
4169 </div>
4170 <?php
4173 * This is currently not used. It can easily be a footer with the practice info
4174 * or whatever you like. Maybe a placeholder for user groups or link outs to data repositories
4175 * such as Medfetch.com/PubMed/UpToDate/DynaMed????
4176 * It could provide information as to available data imports from connected machines - yes we have
4177 * data from an autorefractor needed to be imported. The footer can be fixed or floating.
4178 * It could have balance info, notes, or an upside down menu mirroring the header menu, maybe allowing
4179 * the user to decide which is fixed and which is not? Messaging? Oh the possibilities.
4181 * @param string $pid patient_id
4182 * @param string $encounter is the current encounter number
4183 * @return nothing, outputs directly to screen
4186 function menu_overhaul_bottom($pid, $encounter)
4188 ?><div class="navbar-custom" style="width:100%;height:25px;position:relative;border-top:1pt solid black;bottom:0px;z-index:1000000;">&nbsp;</div><?php
4192 * This was taken from new_form.php and is helping to integrate new menu with openEMR
4193 * menu seen on encounter page.
4195 function Menu_myGetRegistered($state = "1", $limit = "unlimited", $offset = "0")
4197 $sql = "SELECT category, nickname, name, state, directory, id, sql_run, " .
4198 "unpackaged, date FROM registry WHERE " .
4199 "state LIKE ? ORDER BY category, priority, name";
4200 if ($limit != "unlimited") {
4201 $sql .= " limit " . escape_limit($limit) . ", " . escape_limit($offset);
4204 $res = sqlStatement($sql, array($state));
4205 if ($res) {
4206 for ($iter = 0; $row = sqlFetchArray($res); $iter++) {
4207 $all[$iter] = $row;
4209 } else {
4210 return false;
4213 return $all;
4216 * This prints a header for documents. Keeps the brand uniform...
4217 * @param string $pid patient_id
4218 * @param string $direction, options "web" or anything else. Web provides apache-friendly url links.
4219 * @return outputs directly to screen
4221 function report_header($pid, $direction = 'shell')
4223 global $encounter;
4224 global $visit_date;
4225 global $facilityService;
4226 global $OE_SITE_DIR;
4228 /*******************************************************************
4229 $titleres = getPatientData($pid, "fname,lname,providerID");
4230 $sql = "SELECT * FROM facility ORDER BY billing_location DESC LIMIT 1";
4231 *******************************************************************/
4232 //$titleres = getPatientData($pid, "fname,lname,providerID,DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS");
4233 $titleres = getPatientData($pid, "fname,lname,providerID,DOB");
4234 $facility = null;
4235 if ($_SESSION['pc_facility']) {
4236 $facility = $facilityService->getById($_SESSION['pc_facility']);
4237 } else {
4238 $facility = $facilityService->getPrimaryBillingLocation();
4241 $DOB = oeFormatShortDate($titleres['DOB']);
4242 /******************************************************************/
4243 ob_start();
4244 // Use logo if it exists as 'practice_logo.gif' in the site dir
4245 // old code used the global custom dir which is no longer a valid
4246 //need to fix logo for multi-site
4248 <table style="width:100%;">
4249 <tr>
4250 <td style='width:150px;text-align:top;'>
4251 <?php
4252 if ($direction == "web") {
4253 $practice_logo = $GLOBALS['webroot'] . "/sites/default/images/practice_logo.gif";
4254 if (file_exists($OE_SITE_DIR . "/images/practice_logo.gif")) {
4255 echo "<img src='$practice_logo' align='left' style='width:150px;margin:0px 10px;'><br />\n";
4257 } else {
4258 $practice_logo = "$OE_SITE_DIR/images/practice_logo.gif";
4259 if (file_exists($practice_logo)) {
4260 echo "<img src='$practice_logo' align='left' style='width:100px;margin:0px 10px;'><br />\n";
4261 } else {
4262 $practice_logo = "$OE_SITE_DIR/images/login_logo.gif";
4263 if (file_exists($practice_logo)) {
4264 echo "<img src='$practice_logo' align='left' style='width:100px;margin:0px 10px;'><br />\n";
4269 </td>
4270 <td style='width:40%;'>
4271 <em style="font-weight:bold;font-size:1.4em;"><?php echo text($facility['name']); ?></em><br />
4272 <?php echo text($facility['street']); ?><br />
4273 <?php echo text($facility['city']); ?>, <?php echo text($facility['state']); ?> <?php echo text($facility['postal_code']); ?><br />
4274 <?php echo xlt('Phone') . ': ' . text($facility['phone']); ?><br />
4275 <?php echo xlt('Fax') . ': ' . text($facility['fax']); ?><br />
4276 <br clear='all' />
4277 <?php
4278 $visit = getEncounterDateByEncounter($encounter);
4279 $visit_date = $visit['date'];
4281 </td>
4282 <td>
4283 <em style="font-weight:bold;font-size:1.4em;"><?php echo text($titleres['fname']) . " " . text($titleres['lname']); ?></em><br />
4284 <span style="font-weight:bold;"><?php echo xlt('DOB'); ?>:</span> <?php echo text($DOB); ?><br />
4285 <span style="font-weight:bold;"><?php echo xlt('Generated on'); ?>:</span> <?php echo text(oeFormatShortDate()); ?><br />
4286 <span style="font-weight:bold;"><?php echo xlt('Visit Date'); ?>:</span> <?php echo oeFormatSDFT(strtotime($visit_date)); ?><br />
4287 <span style="font-weight:bold;"><?php echo xlt('Provider') . ':</span> ' . text(getProviderName(getProviderIdOfEncounter($encounter))) . '<br />'; ?>
4289 </td>
4290 </tr>
4291 </table>
4292 <?php
4293 $output = ob_get_contents();
4294 ob_end_clean();
4295 return $output;
4299 * This function mines the clinical fields for potential diagnostic codes.
4300 * The clinical fields are found in table list_options with list_id = Eye_Coding_Fields_
4301 * The clinical terms to mine for are in table list_options with list_id = Eye_Coding_Terms
4302 * Both can be directly extended by the user the via Administration -> Lists interface.
4303 * The Coding_Eye_Form_Terms list includes the following important fields:
4304 * Title (the term),
4305 * Notes (the form_field to search for the term)
4306 * Code(s) (the optional user-defined code).
4307 * Terms found in a form_field (Notes) with a predefined Code(s), have that code applied.
4308 * Terms found in a form_field (Notes) without a predefined Code(s) are concated with
4309 * the text value for the form_field (Notes) (found in the list Coding_Eye_Form_Fields: Notes)
4310 * and the codebase is searched for a match.
4311 * For example: the term "ptosis" is found in the RUL clinical field, and there is no Code value in the
4312 * Coding_Eye_Form_Terms Code(s) field. Thus openEMR Eye Form searches the active codebases for a match.
4313 * The codebases are determined in Administration->Lists->Code Types and include those Codesets flagged
4314 * as active and as Diagnostic codes. The terms "ptosis right upper eyelid" are sent to the
4315 * standard openEMR code search engine.
4316 * @param string $FIELDS - all the clinical fields we are going to scour for clinical terms to code.
4317 * @return outputs directly to screen
4319 function start_your_engines($FIELDS)
4321 //pass an assoc array of fields with terms in it and search them
4322 global $pid;
4323 global $codes_found;
4324 global $PMSFH;
4325 if (!($PMFSH ?? '')) {
4326 $PMSFH = build_PMSFH($pid);
4329 $query = "select * from list_options where list_id ='Eye_Coding_Fields' Order by seq";
4330 $result = sqlStatement($query);
4331 while ($fielding = sqlFetchArray($result)) {//build the list of clinical fields to search through
4332 $fields[$fielding['title']] = $fielding['notes'];
4335 //get the clinical terms to search for (title) and what field/where to look for it (notes)
4336 $query = "SELECT * FROM list_options WHERE list_id = 'Eye_Coding_Terms' order by seq";
4337 $result = sqlStatement($query);
4338 while ($term_sheet = sqlFetchArray($result)) {
4339 if ($term_sheet['title'] > '') {
4340 $newdata = array (
4341 'term' => $term_sheet['title'], //the term =/- possible option_values eg. CSME:DM|IOL|RVO
4342 'location' => $term_sheet['notes'], //the form field to search for the term
4343 'codes' => $term_sheet['codes'] //the specific code for this term/location, may be blank
4345 $clinical_terms[] = $newdata;
4349 if (!$clinical_terms) {
4350 return;
4353 $positives = array();
4354 // Terms are sequenced in the DB (seq) from detailed (more complex descriptions) to a simple (one word) description.
4355 // $clinical_terms[] is built in this sequence also.
4356 // eg. "cicatricial ectropion","spastic ectropion", "ectropion".
4357 // If "cicatricial ectropion" is present in this clinical field (or "spastic ectropion" for that matter),
4358 // then there is no need to report the presence of "ectropion" as a clinical finding to the Imp/Plan Builder.
4359 // needle/haystack lookup $positives[] = $term;
4360 // For terms that overlap other diseases, use term:option|option|option. These are always last to process.
4362 foreach ($clinical_terms as $amihere) {
4363 $option_values = "";
4364 $term = "";
4365 $code_found = array();
4366 if (stripos($amihere['term'], ":") !== false) { //options are stored here code:option_values
4367 list ($term,$option_values) = explode(":", $amihere['term']);
4368 } else {
4369 $term = $amihere['term'];
4372 if (stripos(($FIELDS[$amihere['location']] ?? ''), $term) !== false) {
4373 //the term is in the field
4374 $within_array = 'no';
4375 if (isset($positives[$amihere['location']]) > '') { //true if anything was already found in this field
4376 //do any of the previous hits found in in this location contain this term already?
4377 //if so stop; if not, continue onward to add to Builder.
4378 foreach ($positives[$amihere['location']] as $k => $v) {
4379 if (preg_match("/$term/", $v)) {
4380 $within_array = 'yes';
4381 break;
4386 if ($within_array == "yes") {
4387 continue;
4390 $positives[$amihere['location']][] = $term;
4391 if (preg_match("/^(OD)/", $amihere['location'])) {
4392 $side = "right eye";
4393 $side1 = "OD";
4394 $side2 = "R";
4395 } else {
4396 $side = "left eye";
4397 $side1 = "OS";
4398 $side2 = "L";
4401 if (($amihere['codes'] > '') && ($option_values == "")) { //did the user define a code for this term in list Eye_Coding_Terms?
4402 //If so process - we are primed and don't need the carburetor for the Builder
4403 //eg ICD10:H02.891
4404 if (stripos($amihere['codes'], ":") !== false) {
4405 list($code_type,$code) = explode(":", $amihere['codes']);
4406 } else {
4407 //default to ICD10. Maybe there is a GLOBALS value for this? Maybe there should be?
4408 $code_type = "ICD10";
4411 $code_found['code'] = $code_type . ":" . $code;
4412 $code_found['code_type'] = $code_type;
4413 list($sub_term,$newdata) = coding_engine($term, $code_found, $amihere['location']);
4414 $codes_found[$sub_term][] = $newdata;
4415 $positives[$amihere['location']][] = $term;
4416 } else { //no code was defined, further processing needed.
4417 if ($option_values) {
4418 // This clinical finding (term) can be found in more than one disease process ('option_values')
4419 // This special group of terms should be processed last, to identify all
4420 // possible results for the Builder.
4421 // 'option_values' contains pertinent DXs separated by '|', eg. CSME has option values='DM|IOL|RVO'
4422 // Need to see if any of these DX apply and builder Codes_found based on the currently installed list of codes
4423 // Currently for most users this is ICD10 but it is built to allow extension to any code sets in openEMR,
4424 // including foreign laguage code sets.
4425 $options = explode("|", $option_values);
4426 $hit_here = "0";
4428 foreach ($options as $option) {
4429 // if it has mass, try to execute it.
4430 $term_now = "";
4431 if ($option == "DM") {
4432 //This option is run for 3 conditions at present:
4433 //CSME/NVD/NVE per eye. It is the same every time so only do it once, per eye.
4434 //Did we already code this? If so move on.
4435 if ($hit_DM[$side1] == '1') {
4436 continue;
4439 //Are ICD10 etc codes used in other languages? Via Snomed? Via user?
4440 //Assume there is a standard for xlt/xla purposes...
4442 //is the patient diabetic?
4443 //search medical_problem for DM
4444 $within_array = "";
4445 foreach ($PMSFH[0]['PMH'] as $k => $v) {
4446 if (stripos($v['codedesc'], "diabetes")) {
4447 $DM_code = $v['codedesc'];
4448 $within_array = 'yes';
4452 if ($within_array == "yes") {
4453 if (stripos($DM_code, "1")) {
4454 $DM_text = "Type 1 diabetes mellitus";
4455 $label = "DM 1";
4456 } elseif (stripos($DM_code, "2")) {
4457 $DM_text = "Type 2 diabetes mellitus";
4458 $label = "DM 2";
4459 } else {
4460 $DM_text = "Other specified diabetes";
4461 $label = "DM";
4463 } else { //there is no code that lists diabetes in the PMH
4464 continue;
4467 //is there CSME
4468 if ($side == "right eye") {
4469 $location = "ODMACULA";
4470 $location1 = "ODDISC";
4471 $location2 = "ODVESSELS";
4472 $location3 = "ODPERIPH";
4473 } elseif ($side == "left eye") {
4474 $location = "OSMACULA";
4475 $location1 = "OSDISC";
4476 $location2 = "OSVESSELS";
4477 $location3 = "OSPERIPH";
4480 if ((stripos($FIELDS[$location], "flat") === false) && (stripos($FIELDS[$location], "CSME") !== false)) {
4481 //what if they type "no CSME" or "not flat"?
4482 $MAC_text = "with macular edema";
4483 $hit_CSME = "w/ CSME";
4484 } else {
4485 $MAC_text = "without macular edema";
4486 $hit_CSME = "w/o CSME";
4489 //is there (NVD or NVE) or BDR?
4490 //we often document this though as "no NVD/NVE/PDR" which in the current state would mean these would match as hits...
4491 $NVD = "NVD";
4492 $NVE = "NVE";
4493 $PPDR = "PPDR";
4494 $PDR = "PDR";
4495 $BDR = "BDR";
4496 $IRMA = "IrMA";
4497 //note stripos() is case-insensitive
4498 if (
4499 ( (stripos($FIELDS[$location1], $NVD) !== false) ||
4500 (stripos($FIELDS[$location2], $NVE) !== false) ||
4501 (stripos($FIELDS[$location3], $NVE) !== false) ) &&
4502 ( (stripos($FIELDS[$location1], "no " . $NVD) !== true) ||
4503 (stripos($FIELDS[$location2], "no " . $NVE) !== true) ||
4504 (stripos($FIELDS[$location3], "no " . $NVE) !== true) )
4506 $DX = "with proliferative";
4507 $label = $label . "w/ PDR " . $hit_CSME;
4508 $hit_PDR[$side] = '1';
4509 } elseif (
4510 (stripos($FIELDS[$location2], $PPDR) !== false) ||
4511 (stripos($FIELDS[$location2], $PPDR) !== false) ||
4512 (stripos($FIELDS[$location], $IRMA) !== false) ||
4513 (stripos($FIELDS[$location2], $IRMA) !== false) ||
4514 (stripos($FIELDS[$location3], $IRMA) !== false)
4516 $DX = "with severe nonproliferative";
4517 $label = $label . " w/ PPDR " . $hit_CSME;
4518 $hit_PPDR[$side] = '1';
4519 } elseif (
4520 (stripos($FIELDS[$location], $BDR) !== false) ||
4521 (stripos($FIELDS[$location2], $BDR) !== false)
4523 $trace = "tr";
4524 if (
4525 (stripos($FIELDS[$location], $trace . " " . $BDR) !== false) ||
4526 (stripos($FIELDS[$location2], "+1 " . $BDR) !== false) ||
4527 (stripos($FIELDS[$location], $trace . " " . $BDR) !== false) ||
4528 (stripos($FIELDS[$location2], "+1 " . $BDR) !== false)
4530 $DX = "with mild nonproliferative";
4531 $label = $label . " w/ mild BDR " . $hit_CSME;
4532 $hit_BDR[$side] = '1';
4533 } else {
4534 $DX = "with moderate nonproliferative";
4535 $label = $label . " w/ mod BDR " . $hit_CSME;
4536 $hit_BDR[$side] = '1';
4540 $code_found = coding_carburetor($DM_text, $MAC_text);
4541 if (isset($code_found)) { //there are matches, present them to the engine
4542 foreach ($code_found as $found) {
4543 list($sub_term,$newdata) = coding_engine($label, $found, $amihere['location'], $side1);
4544 // The carburetor is a simple machine - it has no boolean options -
4545 // so "with" and "without" match a search for "with"...
4546 // We need to be specific to whittle down the options.
4547 if ((stripos($newdata['codedesc'], $MAC_text)) && (stripos($newdata['codedesc'], $DX))) {
4548 //does this code already exist for the other eye (right eye is always first)?
4549 //if so, change OD to OU and skip adding this code.
4550 //or is there a code for both eyes?
4551 if ($side1 == "OS") {
4552 $count = '0';
4553 for ($i = 0; $i < count($codes_found[$sub_term]); $i++) {
4554 $swap = "OD";
4555 $codes_found[$sub_term][$i]['title'] = str_replace($swap, "OU", $codes_found[$sub_term][$i]['title']);
4556 break 2;
4557 $count++;
4561 $codes_found[$sub_term][] = $newdata;
4562 $positives["DM" . $side1][] = $newdata['code'];
4563 $hit_DM[$side1] = '1';
4567 } elseif ($option == "RVO") {
4568 //is there a CRVO or BRVO associated?
4569 //check Clinical fields for these terms
4570 if ($side == "right eye") {
4571 $location = "ODVESSELS";
4572 } else {
4573 $location = "OSVESSELS";
4576 if ($hit_RVO[$location] == '1') {
4577 continue;
4580 if (stripos($FIELDS[$location], "CRVO") !== false) {
4581 // this is a CRVO, look up code for location
4582 $terms = "CRVO";
4583 $code_found = coding_carburetor("central retinal vein", $side);
4584 if (isset($code_found)) { //there are matches, present them to the Builder
4585 foreach ($code_found as $found) {
4586 list($sub_term,$newdata) = coding_engine($terms, $found, $location, $side1);
4587 $codes_found[$sub_term][] = $newdata;
4588 $positives[$location][] = "CRVO";
4589 $hit_RVO[$location] = "1";
4592 } elseif (stripos($FIELDS[$location], "BRVO") !== false) {
4593 // this is a BRVO, look up code for location
4594 $code_found = coding_carburetor("branch retinal vein", $side);
4595 $terms = "BRVO " . $term;
4596 if (isset($code_found)) { //there are matches, present them to the Builder
4597 foreach ($code_found as $found) {
4598 list($sub_term,$newdata) = coding_engine($terms, $found, $location, $side1);
4599 $codes_found[$sub_term][] = $newdata;
4600 $positives[$location][] = "BRVO";
4601 $hit_RVO[$location] = '1';
4606 if (($term == "CSME") && ($hit_RVO[$location] == '1')) {
4607 //$code = "H35.81";
4608 $code_found = coding_carburetor("retinal", "edema");
4609 $terms = "Vein occlusion and macular edema";
4610 if (isset($code_found)) { //there are matches, present them to the Builder
4611 foreach ($code_found as $found) {
4612 if ($found['code'] == "ICD10:H35.81") {
4613 list($sub_term,$newdata) = coding_engine($terms, $found, $location, $side1);
4614 $codes_found[$sub_term][] = $newdata;
4615 $positives[$location][] = "CSME";
4616 $hit_RVO_CSME = '1';
4621 } elseif ($option == "IOL") {
4622 //are they within 3 months of cataract surgery on this eye? Yag?
4623 //search the same side Lens field for term IOL, ? procedure this eye in last 3 months?
4624 //search surgery_issue_list or even search the billng engine
4625 $query = "select begdate as surg_date from lists where pid=? and type='surgery' and title like '%IOL%' and (title like '%" . xlt($side1) . "%')";
4626 $surg = sqlQuery($query, array($pid));
4627 if ($surg['surg_date'] > '') {
4628 $date1 = date('Y-m-d');
4629 //$date2 = (DateTime($surg['surg_date']));
4630 //echo $term."\n".$date."\n";continue;
4631 $date_diff = strtotime($date1) - strtotime($surg['surg_date']);
4632 $interval = $date_diff / (60 * 60 * 24);
4633 //$interval was 180, now = 90;
4634 if (($interval < '90') && ($term == "CSME")) {
4635 //then this could be post procedure CSME cystoid macular edema H59.031,2 OD OS
4636 $code_found = coding_carburetor("cystoid macular edema", $side);
4637 if (isset($code_found)) { //there are matches, present them to the Builder
4638 foreach ($code_found as $found) {
4639 $term = "Post-cataract CME";
4640 list($sub_term,$newdata) = coding_engine($term, $found, $amihere['location'], $side1);
4641 $codes_found[$sub_term][] = $newdata;
4642 $positives[$amihere['location']][] = $term;
4643 $hit_IOL = '1';
4646 if ($side1 == "OS") {
4647 $count = '0';
4648 for ($i = 0; $i < count($codes_found[$sub_term]); $i++) {
4649 $swap = "OD";
4650 $codes_found[$sub_term][$i]['title'] = str_replace($swap, "OU", $codes_found[$sub_term][$i]['title']);
4651 break 2;
4652 $count++;
4655 } else {
4656 //echo "Not here. $term. $interval \n";
4660 } else {
4661 //should we have another big Dx often altering what a finding means to a coder; this is a placeholder.
4662 //include $option in our code search for this term
4663 $term_now = $term . " " . $option;
4664 $code_found = coding_carburetor($term_now, $FIELDS[$amihere['location']]);
4665 if (isset($code_found)) { //there are matches, present them to the Builder
4666 foreach ($code_found as $found) {
4667 list($sub_term,$newdata) = coding_engine($term, $found, $amihere['location'], $side1);
4668 $codes_found[$sub_term][] = $newdata;
4669 $positives[$amihere['location']][] = $term_now;
4674 } else {
4675 //there are no options and no code identified,
4676 //search via carburetor for possible matches to term and description of the form field
4677 $code_found = coding_carburetor($term, $FIELDS[$amihere['location']]);
4678 if ($code_found !== null) { //there are matches, present them to the Builder
4679 foreach ($code_found as $found) {
4680 list($sub_term,$newdata) = coding_engine($term, $found, $amihere['location']);
4681 $codes_found[$sub_term][] = $newdata;
4682 $positives[$amihere['location']][] = $term;
4690 // $codes_found contains the PE/Clinical findings for the Imp/Plan Builder engine.
4691 // It also gets "horsepower" from the POH/POS and PMH findings.
4692 // Together these three form the Imp/Plan Builder's suggestions available to the end user to build the Imp/Plan,
4693 // and by extension one of the data sources for the Coding Engine to populate the fee sheet.
4694 // When entering a Dx in the PMSFH, it pays to assign these codes up front...
4695 // The rest is exhaust fumes for the muffler.
4696 return $codes_found;
4699 * This function checks a single field for a term and, if found, codes it.
4700 * It is not called directly but via the wrapper function start_your_engines().
4702 * @param string $term, text to search for in the coding tables.
4703 * @param string $field, location where to search. In fact any text that refines the search can be contained here.
4704 * @return outputs array of $codes matching the $term & $field
4706 function coding_carburetor($term, $field)
4708 if (!$term || !$field) {
4709 return;
4712 $codes = array();
4713 $code_type = "ICD10"; //only option is PROD (product or drug search) or NOT PROD...
4714 $search_term = $term . " " . $field;
4715 $res = main_code_set_search($code_type, $search_term);
4716 while ($row = sqlFetchArray($res)) {
4717 $newdata = array (
4718 'code' => $row['code'],
4719 'code_text' => $row['code_text'],
4720 'code_type' => $row['code_type_name'],
4721 'code_desc' => $row['code_desc']
4723 $codes[] = $newdata;
4726 return $codes;
4729 * This function prepares a code found in a clinical field and returns it in $codes_found format.
4730 * @param $code is in the format code_type:code eg. ICD10:H34.811
4731 * @param $location is the descriptive name of the clinical field in question
4732 * @param $side is optional. Used as the descriptive text for finding in the Builder
4733 * and IMP/Plan if selected from the Builder
4734 * @return $subterm,$newdata. $subterm is used to link items in IMP/PLAN back to its orgin.
4735 * $newdata is the array of newly found items to include in the Builder.
4737 * This function is not called directly but via the wrapper function start_your_engines().
4739 function coding_engine($term, $code_found, $location, $side = '')
4741 if (strpos($code_found['code'], ":")) {
4742 list($code_type, $code) = explode(':', $code_found['code']);
4743 } else {
4744 $code = $code_found['code'];
4745 $code_type = "ICD10";//default to ICD10
4746 $code_found['code'] = $code_type . ":" . $code_found['code'];
4749 $code_desc = lookup_code_descriptions($code_found['code']);
4750 $order = array("\r\n", "\n","\r");
4751 $code_desc = str_replace($order, '', $code_desc);
4753 $code_text = text($code_found['code']) . " (" . text($code_desc) . ")";
4754 $replace = " ";
4755 $sub_term = str_replace($replace, "", $term);
4756 //some codes are bilateral, some not, some are per eyelid. Comment this out for now:
4757 //(preg_match("/right/",$code_desc))? $side = xlt('OD{{right eye}}') : $side = xlt('OS{{left eye}}');
4759 $newdata = array (
4760 'title' => ucfirst($term) . " " . $side,
4761 'location' => $location,
4762 'diagnosis' => $code,
4763 'code' => $code,
4764 'codetype' => $code_found['code_type'],
4765 'codedesc' => $code_desc,
4766 'codetext' => $code_text,
4767 'PMSFH_link' => "Clinical_" . $sub_term
4769 return array($sub_term,$newdata);
4772 * This is a function to sort an array of dates/times etc
4773 * Anything strtotime() can recognize at least.
4775 function cmp($a, $b)
4777 if ($a == $b) {
4778 return 0;
4781 return (strtotime($a) < strtotime($b)) ? -1 : 1;
4785 * This function returns the TARGET IOP values for a given ($pid) if ever set, otherwise returns the DEFAULT IOP.
4786 * when a value is found for a given field in the Eye Form for a given patient ($pid)
4787 * @param $name is in the name of the field
4789 * @return $ranges. A mysqlArray(max_FIELD,max_date,min_date)
4791 function display_GlaucomaFlowSheet($pid, $bywhat = 'byday')
4793 global $PMSFH;
4794 global $form_folder;
4795 global $priors;
4796 global $provider_id;
4797 global $documents;
4798 global $encounter_data;
4799 global $ODIOPTARGET;
4800 global $OSIOPTARGET;
4801 global $dated;
4802 global $visit_date;
4804 if (!$documents) {
4805 list($documents) = document_engine($pid);
4808 $count_OCT = empty($documents['docs_in_name']['OCT']) ? 0 : count($documents['docs_in_name']['OCT']);
4809 if ($count_OCT > 0) {
4810 foreach ($documents['docs_in_name']['OCT'] as $OCT) {
4811 $OCT_date[] = $OCT['docdate'];
4815 $count_VF = empty($documents['docs_in_name']['VF']) ? 0 : count($documents['docs_in_name']['VF']);
4816 if ($count_VF > 0) {
4817 foreach ($documents['docs_in_name']['VF'] as $VF) {
4818 $VF_date[] = $VF['docdate'];
4822 $i = 0;
4823 //if there are no priors, this is the first visit, display a generic splash screen.
4824 if ((array)$priors) {
4825 foreach ($priors as $visit) {
4826 //we need to build the lists - dates_OU,times_OU,gonio_OU,OCT_OU,VF_OU,ODIOP,OSIOP,IOPTARGETS
4827 if ($visit['date'] == '') {
4828 continue;
4831 $old_date_timestamp = strtotime($visit['visit_date']);
4832 $visit['exam_date'] = date('Y-m-d', $old_date_timestamp);
4833 $VISITS_date[$i] = $visit['exam_date'];
4835 //$date_OU[$i] = $visit['exam_date'];
4837 $time_here = explode(":", $visit['IOPTIME']);
4838 $time = $time_here[0] . ":" . $time_here[1];
4839 $time_OU[$i] = $time;
4841 if (($visit['ODGONIO'] > '') || ($visit['OSGONIO'] > '')) {
4842 $GONIO_date[$i] = $visit["exam_date"];
4843 $GONIO[$i]['list'] = '1';
4844 } else {
4845 $GONIO[$i]['list'] = '';
4848 if ($visit['ODIOPAP'] > '') {
4849 $ODIOP[$i]['IOP'] = $visit['ODIOPAP'];
4850 $ODIOP[$i]['method'] = "AP";
4851 } elseif ($visit['ODIOPTPN'] > '') {
4852 $ODIOP[$i]['IOP'] = $visit['ODIOPTPN'];
4853 $ODIOP[$i]['method'] = "TPN";
4854 } else {
4855 $ODIOP[$i]['IOP'] = "";
4858 if ($visit['OSIOPAP'] > '') {
4859 $OSIOP[$i]['IOP'] = $visit['OSIOPAP'];
4860 $OSIOPMETHOD[$i]['method'] = "AP";
4861 } elseif ($visit['OSIOPTPN'] > '') {
4862 $OSIOP[$i]['IOP'] = $visit['OSIOPTPN'];
4863 $OSIOPMETHOD[$i]['method'] = "TPN";
4864 } else {
4865 $OSIOP[$i]['IOP'] = "null";
4866 //we are ignoring finger tension for graphing purposes but include this should another form of IOP measurement arrive...
4867 //What about the Triggerfish contact lens continuous IOP device for example...
4870 //build the Target line values for each date.
4871 $j = $i - 1;
4873 if ($visit['ODIOPTARGET'] > '') {
4874 $ODIOPTARGETS[$i] = $visit['ODIOPTARGET'];
4875 } elseif ($i == 0) { //this should be set on in view/page load. Keep for reports though...
4876 list($ODIOPTARGETS[$i], ) = getIOPTARGETS($pid, ($id ?? ''), $provider_id);
4877 } elseif (!$ODIOPTARGETS[$j]) {
4878 list($ODIOPTARGETS[$i], ) = getIOPTARGETS($pid, $id, $provider_id);
4879 } else {
4880 $ODIOPTARGETS[$i] = $ODIOPTARGETS[$j];
4883 if ($visit['OSIOPTARGET'] > '') {
4884 $OSIOPTARGETS[$i] = $visit['OSIOPTARGET'];
4885 } elseif ($i == 0) {
4886 list( ,$OSIOPTARGETS[$i]) = getIOPTARGETS($pid, ($id ?? ''), $provider_id);
4887 } elseif (!$OSIOPTARGETS[$j]) {
4888 list( ,$OSIOPTARGETS[$i]) = getIOPTARGETS($pid, $id, $provider_id);
4889 } else {
4890 $OSIOPTARGETS[$i] = $OSIOPTARGETS[$j];
4892 $i++;
4894 } else { //there are no priors, get info for this visit
4895 $VISITS_date[0] = $dated;
4896 if ($encounter_data['IOPTIME']) {
4897 $time_here = explode(":", $encounter_data['IOPTIME']);
4898 $time = $time_here[0] . ":" . $time_here[1];
4899 $time_OU[] = $time;
4902 if ($encounter_data['ODGONIO'] || $encounter_data['OSGONIO']) {
4903 $GONIO_date[$i] = $dated;
4906 $ODIOP[$i]['time'] = $time;
4907 $OSIOP[$i]['time'] = $time;
4908 //$IOPTARGET['visit_date'] = $encounter_data['exam_date'];
4909 if ($encounter_data['ODIOPAP'] > '') {
4910 if (!is_int($encounter_data['ODIOPAP'])) {
4911 $ODIOP[$k]['IOP'] = '';
4912 } else {
4913 $ODIOP[$i]['IOP'] = $encounter_data['ODIOPAP']; }
4914 $ODIOP[$i]['method'] = "AP";
4915 } elseif ($encounter_data['ODIOPTPN'] > '') {
4916 $ODIOP[$i]['IOP'] = $encounter_data['ODIOPTPN'];
4917 $ODIOP[$i]['method'] = "TPN";
4920 if ($encounter_data['OSIOPAP'] > '') {
4921 if (!is_int($encounter_data['OSIOPAP'])) {
4922 $OSIOP[$k]['IOP'] = '';
4923 } else {
4924 $OSIOP[$i]['IOP'] = $encounter_data['OSIOPAP']; }
4925 $OSIOP[$i]['method'] = "AP";
4926 } elseif ($encounter_data['OSIOPTPN'] > '') {
4927 $OSIOP[$i]['IOP'] = $encounter_data['OSIOPTPN'];
4928 $OSIOP[$i]['method'] = "TPN";
4929 } else {
4930 //we are ignoring finger tension for graphing purposes but include this should another form of IOP measurement arrive...
4931 //What about the Triggerfish contact lens continuous IOP device for example... iCare device, etc
4934 if ($encounter_data['ODIOPTARGET'] > '0') {
4935 $ODIOPTARGETS[$i] = $encounter_data['ODIOPTARGET'];
4936 } else {
4937 list($ODIOPTARGET, ) = getIOPTARGETS($pid, ($id ?? ''), $provider_id);
4938 $ODIOPTARGETS[$i] = $ODIOPTARGET;
4939 $encounter_data['ODIOPTARGET'] = $ODIOPTARGET;
4942 if ($encounter_data['OSIOPTARGET']) {
4943 $OSIOPTARGETS[$i] = $encounter_data['OSIOPTARGET'];
4944 } else {
4945 list( ,$OSIOPTARGET ) = getIOPTARGETS($pid, ($id ?? ''), $provider_id);
4946 $OSIOPTARGETS[$i] = $OSIOPTARGET;
4947 $encounter_data['OSIOPTARGET'] = $OSIOPTARGET;
4951 //There are visits for testing only, no IOP.
4952 //We need to insert these dates into the arrays created above.
4953 //recreate them to include the testing only dates, placing null values for those dates if not done.
4955 //can't merge empty arrays
4956 $list = array();
4957 $arrs[] = $OCT_date ?? '';
4958 $arrs[] = $VF_date ?? '';
4959 $arrs[] = $GONIO_date ?? '';
4960 $arrs[] = $VISITS_date ?? '';
4962 foreach ($arrs as $arr) {
4963 if (is_array($arr)) {
4964 $list = array_merge($list, $arr);
4968 $date_OU = array_unique($list);
4969 usort($date_OU, "cmp");
4970 $times_OU = $time_OU;
4971 usort($times_OU, "cmp");
4973 for ($a = 0; $a < count($date_OU); $a++) {
4974 if (!empty($GONIO_date)) {
4975 foreach ($GONIO_date as $GONIO) {
4976 if ($date_OU[$a] == $GONIO) {
4977 $GONIO_values[$a] = "1";
4978 break;
4983 if (!($GONIO_values[$a] ?? null)) {
4984 $GONIO_values[$a] = "";
4987 if ($count_OCT > 0) {
4988 foreach ($OCT_date as $OCT) {
4989 if ($date_OU[$a] == $OCT) {
4990 $OCT_values[$a] = "1";
4991 break;
4996 if (!($OCT_values[$a] ?? null)) {
4997 $OCT_values[$a] = "";
5000 if ($count_VF > 0) {
5001 foreach ($VF_date as $VF) {
5002 if ($date_OU[$a] == $VF) {
5003 $VF_values[$a] = "1";
5004 break;
5009 if (!($VF_values[$a] ?? null)) {
5010 $VF_values[] = "";
5013 for ($k = 0; $k < count($VISITS_date); $k++) {
5014 if ($date_OU[$a] == $VISITS_date[$k]) {
5015 if (preg_match('/[a-z]/i', ($ODIOP[$k]['IOP'] ?? ''))) {
5016 $ODIOP[$k]['IOP'] = '';}
5017 if (preg_match('/[a-z]/i', ($OSIOP[$k]['IOP'] ?? ''))) {
5018 $OSIOP[$k]['IOP'] = '';}
5019 $OD_values[$a] = "'" . ($ODIOP[$k]['IOP'] ?? '') . "'";
5020 $OD_methods[$a] = $ODIOP[$k]['method'] ?? '';
5021 $OS_values[$a] = $OSIOP[$k]['IOP'] ?? '';
5022 $OS_methods[$a] = $OSIOP[$k]['method'] ?? '';
5023 $ODIOPTARGET_values[$a] = $ODIOPTARGETS[$k];
5024 $OSIOPTARGET_values[$a] = $OSIOPTARGETS[$k] ?? '';
5025 break;
5029 if (!$OD_values[$a]) {
5030 $OD_values[$a] = '';
5033 if (!$OS_values[$a]) {
5034 $OS_values[$a] = '';
5037 if (!$OD_methods[$a]) {
5038 $OD_methods[$a] = "";
5041 if (!$OS_methods[$a]) {
5042 $OS_methods[$a] = "";
5045 if (!$ODIOPTARGET_values[$a]) {
5046 $ODIOPTARGET_values[$a] = "";
5049 if (!$OSIOPTARGET_values[$a]) {
5050 $OSIOPTARGET_values[$a] = "";
5054 for ($a = 0; $a < count($times_OU); $a++) {
5055 for ($k = 0; $k < count($ODIOP); $k++) {
5056 if ($times_OU[$a] == $time_OU[$k]) {
5057 $OD_time_values[$a] = $ODIOP[$k]['IOP'] ?? '';
5058 $OS_time_values[$a] = $OSIOP[$k]['IOP'] ?? '';
5059 break;
5064 $dates_OU = "'" . implode("','", $date_OU) . "'";
5065 $OD_values = implode(",", $OD_values);
5066 $OS_values = implode(",", $OS_values);
5067 $OCT_values = "'" . implode("','", $OCT_values) . "'";
5068 $VF_values = "'" . implode("','", $VF_values) . "'";
5069 $GONIO_values = "'" . implode("','", $GONIO_values) . "'";
5070 $IOPTARGET_values = implode(",", $ODIOPTARGET_values);
5071 $times_OU = "'" . implode("','", $times_OU) . "'";
5072 $OD_time_values = "'" . implode("','", $OD_time_values) . "'";
5073 $OS_time_values = "'" . implode("','", $OS_time_values) . "'";
5075 ?> <p style="font-weight:bold;"> <?php echo xlt('Glaucoma Zone'); ?>:</p>
5076 <span class="closeButton fas fa-times" id="Close_IOP" name="Close_IOP"></span>
5077 <div id="GFS_table" name="GFS_table" class="table-responsive borderShadow" style="position:relative;display:table;float:left;margin-top:10px;padding:15px;text-align:left;vertical-align:center;width:30%;">
5078 <table class="GFS_table">
5079 <tr >
5080 <td colspan="1" class="GFS_title_1" style="padding-bottom:3px;border:none;" nowrap><?php echo xlt('Current Target'); ?>:
5081 <td class='GFS_title center' style="padding-bottom:3px;border:none;" nowrap><?php echo xlt('OD{{right eye}}'); ?>: <input type="text" style="width: 20px;" name="ODIOPTARGET" id="ODIOPTARGET" value="<?php echo attr($ODIOPTARGET); ?>" /></td>
5082 <td class='GFS_title center' style="padding-bottom:3px;border:none;" nowrap><?php echo xlt('OS{{left eye}}'); ?>: <input type="text" style="width: 20px;" name="OSIOPTARGET" id="OSIOPTARGET" value="<?php echo attr($encounter_data['OSIOPTARGET']); ?>" /></td>
5083 </tr>
5084 <tr>
5085 <td colspan="3" class="hideme nodisplay">
5086 TARGET IOP HISTORY
5087 </td>
5088 </tr>
5089 <?php
5090 //what active meds have a subtype eye?
5091 $i = 0;
5092 $count_Meds = count($PMSFH[0]['Medication']);
5093 if ($count_Meds > '0') {
5094 foreach ($PMSFH[0]['Medication'] as $drug) {
5095 if (($drug['row_subtype'] == "eye") && (strtotime($drug['enddate']) < strtotime($visit_date) ) && ($drug['status'] != "Inactive")) {
5096 $current_drugs .= "<tr><td colspan='2' class='GFS_td_1'><span name='QP_PMH_" . attr($drug['rowid']) . "' href='#PMH_anchor' id='QP_PMH_" . attr($drug['rowid']) . "'
5097 onclick=\"alter_issue2(" . attr_js($drug['rowid']) . ",'Medication','" . $i . "');\">" . text($drug['title']) . "</span></td>
5098 <td class='GFS_td'>" . text(oeFormatShortDate($drug['begdate'])) . "</td></tr>";
5099 } elseif (($drug['row_subtype'] == "eye") && (!empty($drug['enddate']))) {//what meds have a subtype eye that are discontinued?
5100 $hideme = "hideme_drugs nodisplay";
5101 $FAILED_drugs .= "<tr class='" . $hideme . "'><td colspan='1' class='GFS_td_1'><span name='QP_PMH_" . attr($drug['rowid']) . "' href='#PMH_anchor' id='QP_PMH_" . attr($drug['rowid']) . "'
5102 onclick=\"alter_issue2(" . attr_js($drug['rowid']) . ",'Medication','" . $i . "');\">" . text($drug['title']) . "</span></td>
5103 <td class='GFS_td'>" . text(oeFormatShortDate($drug['begdate'])) . "</td><td class='GFS_td'>" . text(oeFormatShortDate($drug['enddate'])) . "</td></tr>";
5106 $i++;
5109 if (!($current_drugs ?? null)) {
5110 $current_drugs = "<tr><td colspan='3' class='GFS_td_1' style='text-align:center;'>" . xlt('None documented') . "</td></tr>";
5111 $no_drugs = '1';
5114 foreach ($PMSFH[0]['Medication'] as $drug) {
5115 if (($drug['row_subtype'] == "eye") && (!empty($drug['enddate']))) {
5116 $FAILED_drug .= "<li>" . text($drug['title']) . "</li>";
5121 <tr class="GFS_tr">
5122 <td colspan="2" class="GFS_title"><?php echo xlt('Current Eye Meds'); ?>:</td>
5123 <?php ($no_drugs ?? null) ? ($meds_here = '') : $meds_here = xlt('Start'); ?>
5124 <td class="GFS_title" style="text-align:center;"><?php echo $meds_here; ?></td>
5125 <?php
5126 if ($FAILED_drugs ?? null) {
5127 echo '<td><span class="right toggleme" id="toggle_drugs"><i class="fa-regular fa-square-caret-down"></i></span></td>';
5128 } ?>
5129 </tr>
5130 <?php
5131 echo $current_drugs ?? '';
5132 if ($FAILED_drugs ?? null) {
5133 echo '<tr class="' . $hideme . '"><td class="GFS_title" colspan="1">' . xlt('Prior Eye Meds') . '</td><td class="GFS_title" style="text-align:center;">' . xlt('Start') . '</td><td style="text-align:center;" class="GFS_title">End</td></tr>';
5136 echo $FAILED_drugs ?? '';
5138 //start VF section
5139 if ($count_VF > '0') { //need to decide how many to show on open, and hide the rest? For now the first only.
5140 $count = 0;
5141 foreach ($documents['docs_in_name']['VF'] as $VF) {
5142 if ($count < 1) {
5143 // $episode .= '<a onclick="openNewForm(\''.$GLOBALS['webroot'].'/controller.php?document&view&patient_id='.$pid.'&doc_id='.$id_to_show.'\',\'Documents\');"><img src="../../forms/'.$form_folder.'/images/jpg.png" class="little_image" /></a>';
5145 $current_VF = '<tr><td class="GFS_td_1 blue">
5146 <a onclick="openNewForm(\'' . $GLOBALS['webroot'] . '/controller.php?document&view&patient_id=' . attr($pid) . '&doc_id=' . attr($VF['id']) . '\',\'Documents\');">
5147 <img src="../../forms/' . $form_folder . '/images/jpg.png" class="little_image" style="width:15px; height:15px;" /></a>
5148 </td>
5149 <td class="GFS_td_1">' . $VF['docdate'] . '</td>
5150 </tr>';
5151 } else {
5152 $old_VFs .= '<tr><td class="GFS_td_1 hideme_VFs nodisplay"">
5153 <a onclick="openNewForm(\'' . $GLOBALS['webroot'] . '/controller.php?document&view&patient_id=' . attr($pid) . '&doc_id=' . attr($VF['id']) . '\',\'Documents\');">
5154 <img src="../../forms/' . $form_folder . '/images/jpg.png" class="little_image" style="width:15px; height:15px;" /></a></td>
5155 <td class="hideme_VFs nodisplay GFS_td_1">' . $VF['docdate'] . '</td></tr>';
5158 $count++;
5160 } else {
5161 $current_VF = "<tr><td colspan='3' class='GFS_td_1' style='text-align:center;'>" . xlt('Not documented') . "</td></tr>";
5164 <tr class="GFS_tr">
5165 <td colspan="3" class="GFS_title"><?php echo xlt('Visual Fields'); ?>:
5166 <?php
5167 if ($old_VFs ?? null) {
5168 echo '<td><span class="top right" id="toggle_VFs"><i class="fa-regular fa-square-caret-down"></i></span></td>';
5171 </tr>
5172 <?php echo $current_VF . ($old_VFs ?? '');
5173 //end VF section
5175 //start Optic Nerve section
5177 <tr>
5178 <td colspan="3" class="GFS_title"><?php echo xlt('Optic Nerve Analysis'); ?>:&nbsp;
5179 <?php
5180 if ($count_OCT > '0') { //need to decide how many to show on open, and hide the rest? For now show first, hide rest.
5181 $count = 0;
5182 foreach ($documents['docs_in_name']['OCT'] as $OCT) {
5183 //get encounter date from encounter id
5184 if ($count < 1) {
5185 $current_OCT = '<tr>
5186 <td class="GFS_td_1">
5187 <a onclick="openNewForm(\'' . $GLOBALS['webroot'] . '/controller.php?document&view&patient_id=' . attr($pid) . '&doc_id=' . attr($OCT['id']) . '\',\'Documents\');"><img src="../../forms/' . $form_folder . '/images/jpg.png" class="little_image" style="width:15px; height:15px;" /></a>
5188 </td>
5189 <td class="GFS_td_1">' . $OCT['docdate'] . '</td>
5190 </tr>
5192 } else {
5193 $old_OCTs .= '<tr><td class="hideme_OCTs nodisplay GFS_td_1">
5194 <a onclick="openNewForm(\'' . $GLOBALS['webroot'] . '/controller.php?document&view&patient_id=' . attr($pid) . '&doc_id=' . attr($OCT['id']) . '\',\'Documents\');"><img src="../../forms/' . $form_folder . '/images/jpg.png" class="little_image" style="width:15px; height:15px;" /></a>
5195 </td><td class="hideme_OCTs nodisplay GFS_td_1">' . $OCT['docdate'] . '</td></tr>';
5197 $count++;
5199 } else {
5200 $current_OCT = "<tr><td colspan='3' class='GFS_td_1' style='text-align:center;'>" . xlt('Not documented') . "</td></tr>";
5203 if ($old_OCTs ?? null) {
5204 echo '<td><span class="top right " id="toggle_OCTs"><i class="fa-regular fa-square-caret-down"></i></span></td>';
5207 echo "</tr>";
5208 echo $current_OCT . ($old_OCTs ?? '');
5210 $count = 0;
5211 $hideme = '';
5212 foreach ($priors as $visit) {
5213 if (($visit['ODGONIO'] > " ") || ($visit['OSGONIO'] > " ")) { // something is here
5214 if ($count > 0) {
5215 $hideme = "hideme_gonios nodisplay";// show the first only, hide the rest for now
5218 $gonios .= "<tr><td class='GFS_td_1 " . $hideme . "'>" . $visit['exam_date'] . "</td><td class='GFS_td " . $hideme . "' style='border:1pt dotted gray;'>" . $visit['ODGONIO'] . "</td><td class='GFS_td " . $hideme . "' style='border:1pt dotted gray;'>" . $visit['OSGONIO'] . "</td></tr>";
5219 if (!empty($GONIO_chart)) {
5220 $GONIO_chart .= '"1",';
5221 } else {
5222 $GONIO_chart = '"1",';
5224 $count++;
5225 } else {
5226 if (!empty($GONIO_chart)) {
5227 $GONIO_chart .= ',';
5228 } else {
5229 $GONIO_chart = '"1",';
5233 if (!empty($GONIO[$i]['list'])) {
5234 $GONIO = chop(($GONIO[$i]['list']), ",");
5236 if ($count == 0) {
5237 $gonios = "<tr><td colspan='3' class='GFS_td_1' style='text-align:center;'>" . xlt('Not documented') . "</td></tr>";
5240 <tr>
5241 <td class="GFS_title_1" id="GFS_gonios" name="GFS_gonios" style="position:relative;"><?php echo xlt('Gonioscopy'); ?>:</td>
5242 <?php
5243 if ($count > '0') {
5244 echo "<td class='GFS_title center'>" . xlt('OD{{right eye}}') . "</td><td class='GFS_title center'>" . xlt('OS{{left eye}}') . "</td>";
5245 } else {
5246 echo "<td class='GFS_title center'></td><td class='GFS_title center'></td>";
5249 if ($hideme) {
5250 echo '<td><span class="top right" id="toggle_gonios"><i class="fa-regular fa-square-caret-down"></i></span></td>';
5253 </tr>
5254 <?php echo $gonios;
5256 $count = '0';
5257 $hideme = '';
5258 foreach ($priors as $visit) {
5259 if (($visit['ODCUP'] > "") || ($visit['OSCUP'] > "")) {
5260 if ($count > 0) {
5261 $hideme = "hideme_cups nodisplay";
5264 if ($cups ?? null) {
5265 $cups .= "<tr><td class='GFS_td_1 " . $hideme . " '>" . text($visit['exam_date']) . "</td><td class='GFS_td " . $hideme . "' style='border:1pt dotted gray;'>" . text($visit['ODCUP']) . "</td><td class='GFS_td " . $hideme . "' style='border:1pt dotted gray;''>" . text($visit['OSCUP']) . "</td></tr>";
5266 } else {
5267 $cups = "<tr><td class='GFS_td_1 " . $hideme . " '>" . text($visit['exam_date']) . "</td><td class='GFS_td " . $hideme . "' style='border:1pt dotted gray;'>" . text($visit['ODCUP']) . "</td><td class='GFS_td " . $hideme . "' style='border:1pt dotted gray;''>" . text($visit['OSCUP']) . "</td></tr>";
5270 $DISCS_chart .= '"1",';
5271 $count++;
5272 } else {
5273 if (!empty($DISCS_chart)) {
5274 $DISCS_chart .= '"",';
5275 } else {
5276 $DISCS_chart = '"",';
5281 $DISCS_chart = chop(($DISCS_chart ?? ''), ",");
5282 if ($count == 0) {
5283 $cups = "<tr><td colspan='3' class='GFS_td_1' style='text-align:center;'>" . xlt('Not documented') . "</td></tr>";
5286 <tr>
5287 <td class="GFS_title_1" id="GFS_cups" name="GFS_cups" title="<?php echo xla('Click this to display/hide additional tests'); ?>"style="position:relative;"><?php echo xlt('Optic Discs'); ?>:
5288 <?php
5289 if ($hideme) {
5290 $plus = '<td><span class="top right" id="toggle_cups"><i class="fa-regular fa-square-caret-down"></i></span></td>';
5293 if ($count > '0') {
5294 echo "<td class='GFS_title center'>" . xlt('OD{{right eye}}') . "</td><td class='GFS_title center'>" . xlt('OS{{left eye}}') . "</td>" . ($plus ?? '');
5295 } else {
5296 echo "<td class='GFS_title center'></td><td class='GFS_title center'></td>";
5299 </tr>
5300 <?php echo $cups ?? ''; ?>
5302 </table>
5303 </div>
5304 <div style="position:relative;float:right; margin: 0px 5px;text-align:center;width:60%;">
5305 <?php
5306 if ($priors) {
5307 if ($bywhat == 'byday') { //$bywhat='byday'
5308 $class_1 = "nodisplay";
5309 $class_2 = "";
5310 } else {
5311 $class_2 = "nodisplay";
5312 $class_1 = "";
5317 <canvas id="canvas_byday" class="<?php echo $class_2; ?>"></canvas>
5318 <canvas id="canvas_byhour" class="<?php echo $class_1; ?>"></canvas>
5320 <button id="dailyData" class="<?php echo $class_1; ?>"><?php echo xlt('Show IOP by Date'); ?></button>
5321 <button id="hourlyData" class="<?php echo $class_2; ?>"><?php echo xlt('Show IOP by Time'); ?></button>
5322 <script>
5324 * Below is the Chart.js code to render IOP by day and IOP by time
5327 var visit_date = '<?php echo attr($dated); ?>';
5328 var dateFormat = 'YYYY-MM-DD';
5329 var timeFormat = 'HH tt';
5330 var customTooltips = function(tooltip) {
5331 // Tooltip Element
5332 var tooltipEl = $('#chartjs-tooltip');
5333 if (!tooltipEl[0]) {
5334 $('body').append('<div id="chartjs-tooltip"></div>');
5335 tooltipEl = $('#chartjs-tooltip');
5337 // Hide if no tooltip
5338 if (!tooltip.opacity) {
5339 tooltipEl.css({
5340 opacity: 0.3
5342 $('.chartjs-wrap canvas')
5343 .each(function(index, el) {
5344 $(el).css('cursor', 'default');
5346 return;
5348 $(this._chart.canvas).css('cursor', 'pointer');
5349 // Set caret Position
5350 tooltipEl.removeClass('above below no-transform');
5351 if (tooltip.yAlign) {
5352 tooltipEl.addClass(tooltip.yAlign);
5353 } else {
5354 tooltipEl.addClass('no-transform');
5357 // Set Text
5358 if (tooltip.body) {
5359 var innerHtml = [
5360 (tooltip.beforeTitle || []).join('\n'), (tooltip.title || []).join('\n'), (tooltip.afterTitle || []).join('\n'), (tooltip.beforeBody || []).join('\n'), (tooltip.body || []).join('\n'), (tooltip.afterBody || []).join('\n'), (tooltip.beforeFooter || [])
5361 .join('\n'), (tooltip.footer || []).join('\n'), (tooltip.afterFooter || []).join('\n')
5363 tooltipEl.html(innerHtml.join('\n'));
5366 // Find Y Location on page
5367 var top = 0;
5368 if (tooltip.yAlign) {
5369 if (tooltip.yAlign == 'above') {
5370 top = tooltip.y - tooltip.caretHeight - tooltip.caretPadding;
5371 } else {
5372 top = tooltip.y + tooltip.caretHeight + tooltip.caretPadding;
5375 var position = $(this._chart.canvas)[0].getBoundingClientRect();
5376 // Display, position, and set styles for font
5377 tooltipEl.css({
5378 opacity: 0.5,
5379 width: tooltip.width ? (tooltip.width + 'px') : 'auto',
5380 left: position.left + tooltip.x + 'px',
5381 top: position.top + top + 'px',
5382 fontFamily: tooltip._fontFamily,
5383 fontSize: tooltip.fontSize,
5384 fontStyle: tooltip._fontStyle,
5385 padding: tooltip.yPadding + 'px ' + tooltip.xPadding + 'px',
5389 var config_byhour = {
5390 data: {
5391 labels: [<?php echo $times_OU; ?>],
5392 datasets: [
5394 type: 'line',
5395 label: "OD",
5396 data: [
5397 <?php echo $OD_time_values; ?>
5399 fill: false,
5400 borderColor : "#44a3a7",
5401 backgroundColor : "#44a3a7",
5402 pointBorderColor : "#055d2b",
5403 pointBackgroundColor : "#44a3a7",
5404 pointBorderWidth : 3,
5405 lineTension: 0.3,
5406 borderCapStyle: 'butt',
5407 borderDashOffset: 0.0,
5408 borderJoinStyle: 'miter',
5409 pointHoverRadius: 5,
5410 pointHoverBorderWidth: 2,
5411 pointRadius: 1,
5412 pointHitRadius: 3
5415 type: 'line',
5416 label: 'OS',
5417 data: [
5418 <?php echo $OS_time_values; ?>
5420 fill: false,
5421 lineTension: 3,
5422 borderColor : "#000099",
5423 backgroundColor : "#000099",
5424 pointBorderColor : "black",
5425 pointBackgroundColor : "#000099",
5426 pointBorderWidth : 3,
5427 lineTension: 0.3,
5428 borderCapStyle: 'butt',
5429 borderJoinStyle: 'miter',
5430 pointHoverRadius: 5,
5431 pointHoverBorderWidth: 2,
5432 pointRadius: 1,
5433 pointHitRadius: 3,
5437 options: {
5438 responsive: true,
5439 animation: false,
5440 onAnimationComplete: function () {
5441 // prevents the update from triggering an infinite loop
5442 if (!this.clearCycle) {
5443 this.clearCycle = true;
5445 this.datasets.forEach(function (dataset) {
5446 dataset.points.forEach(function (point) {
5447 if (point.value === 0) {
5448 point.display = false;
5449 point.hasValue = function () {
5450 return false;
5455 this.update();
5456 } else
5457 delete this.clearCycle;
5459 scaleShowHorizontalLines: true,
5460 title:{
5461 display: true,
5462 text:'<?php echo xla("Intraocular Pressures") . " (" . xla("mmHg") . ") by Hour"; ?>'
5464 tooltips: {
5465 mode: 'label'
5467 hover: {
5468 mode: 'dataset'
5470 scales: {
5471 xAxes: {
5472 type: "time",
5473 time: {
5474 format: "HH:mm",
5475 unit: 'hour',
5476 unitStepSize: 2,
5477 displayFormats: {
5478 'minute': 'h:mm a',
5479 'hour': 'h:mm a'
5481 tooltipFormat: 'h:mm a'
5483 scaleLabel: {
5484 display: true,
5485 labelString: 'Time'
5487 ticks: {
5488 suggestedMin: 4,
5489 suggestedMax: 24,
5492 yAxes: {
5493 type: "linear",
5494 display: true,
5495 position: "left",
5496 id: "y-axis-2",
5497 gridLines:{
5498 display: false
5500 labels: {
5501 show:true,
5503 scaleLabel: {
5504 display: true,
5505 labelString: 'IOP (mmHg)'
5507 ticks: {
5508 suggestedMin: 0,
5509 suggestedMax: 24,
5516 $('#dailyData').click(function(event) {
5517 event.preventDefault();
5518 $('#canvas_byday').removeClass('nodisplay');
5519 $('#canvas_byhour').addClass('nodisplay');
5521 $('#dailyData').addClass('nodisplay');
5522 $('#hourlyData').removeClass('nodisplay');
5523 $('#showTesting').addClass('nodisplay');
5525 $('#hourlyData').click(function(event) {
5526 event.preventDefault();
5527 $('#canvas_byhour').removeClass('nodisplay');
5528 $('#canvas_byday').addClass('nodisplay');
5529 $('#dailyData').removeClass('nodisplay');
5530 $('#hourlyData').addClass('nodisplay');
5531 $('#showTesting').removeClass('nodisplay');
5533 var config_byday = {
5534 type: 'bar',
5535 data: {
5536 labels: [
5537 <?php echo $dates_OU; ?>
5539 datasets: [
5541 axis: 'y',
5542 type: 'line',
5543 label: "Target",
5544 data: [<?php echo $IOPTARGET_values; ?>],
5545 fill: false,
5546 borderColor : "#f28282",
5547 backgroundColor : "#f28282",
5548 pointBorderColor : "black",
5549 pointBackgroundColor : "#f28282",
5550 pointBorderWidth : 3,
5551 drugs: ["test1\ntimoptic","test2","test3"],
5552 yAxisID: 'y-axis-1',
5553 lineTension: 0.3,
5554 borderCapStyle: 'round',
5555 borderDash: [1,5],
5556 borderJoinStyle: 'miter',
5557 pointHoverRadius: 5,
5558 pointHoverBorderWidth: 2,
5559 pointRadius: 1,
5560 pointHitRadius: 3
5563 axis: 'y',
5564 type: 'line',
5565 label: "OD",
5566 data: [<?php echo $OD_values; ?>],
5567 fill: false,
5568 borderColor : "#44a3a7",
5569 backgroundColor : "#44a3a7",
5570 pointBorderColor : "#055d2b",
5571 pointBackgroundColor : "#44a3a7",
5572 pointBorderWidth : 3,
5573 yAxisID: 'y-axis-1',
5574 lineTension: 0.3,
5575 borderCapStyle: 'butt',
5576 borderDashOffset: 0.0,
5577 borderJoinStyle: 'miter',
5578 pointHoverRadius: 5,
5579 pointHoverBorderWidth: 2,
5580 pointRadius: 1,
5581 pointHitRadius: 3
5584 axis: 'y',
5585 type: 'line',
5586 label: 'OS',
5587 data: [<?php echo $OS_values; ?>],
5588 fill: false,
5589 lineTension: 3,
5590 borderColor : "#000099",
5591 backgroundColor : "#000099",
5592 pointBorderColor : "black",
5593 pointBackgroundColor : "#000099",
5594 pointBorderWidth : 3,
5595 yAxisID: 'y-axis-1',
5596 lineTension: 0.3,
5597 borderCapStyle: 'butt',
5598 borderJoinStyle: 'miter',
5599 pointHoverRadius: 5,
5600 pointHoverBorderWidth: 2,
5601 pointRadius: 1,
5602 pointHitRadius: 3,
5605 axis: 'y',
5606 type: 'bar',
5607 label: "VF",
5608 strokeColor: '#5CABFA',
5609 fillColor:"#5CABFA",
5610 data: [<?php echo $VF_values; ?>],
5611 fill: false,
5612 backgroundColor: '#5CABFA',
5613 borderColor: 'var(--black)',
5614 yAxisID: 'y-axis-2'
5617 axis: 'y',
5618 type: 'bar',
5619 label: "OCT",
5620 data: [<?php echo $OCT_values; ?>],//0/null is not done, 1 if performed.
5621 fill: true,
5622 backgroundColor: '#71B37C',
5623 borderColor: 'var(--black)',
5624 yAxisID: 'y-axis-2'
5627 axis: 'y',
5628 type: 'bar',
5629 label: "Gonio",
5630 data: [<?php echo $GONIO_values; ?>],
5631 fill: false,
5632 strokeColor: 'rgba(209, 30, 93, 0.3)',
5633 fillColor:'rgba(209, 30, 93, 0.3)',
5634 backgroundColor: 'red',
5635 borderColor: 'var(--black)',
5636 yAxisID: 'y-axis-2'
5640 options: {
5641 responsive: true,
5642 scaleShowHorizontalLines: true,
5643 title: {
5644 display: true,
5645 text:'<?php echo xla("Intraocular Pressures (mmHg) by Date"); ?>'
5647 tooltips: {
5648 enabled: true,
5649 //id: "tooltip-1",
5650 //backgroundColor: '#FCFFC5',
5651 //mode: 'label',
5652 enabled: true,
5653 shared: false,
5655 callbacks: {
5656 label: function(tooltipItem, data) {
5657 if (tooltipItem.yLabel =='0') {
5658 return data.datasets[tooltipItem.datasetIndex].label + " --- "; ;
5659 } else if (tooltipItem.yLabel =='1') {
5660 return data.datasets[tooltipItem.datasetIndex].label + " <?php echo xlt('performed'); ?>";
5661 } else if (tooltipItem.yLabel > '1') {
5662 return data.datasets[tooltipItem.datasetIndex].label + ": "+tooltipItem.yLabel;
5665 afterBody: function(tooltipItems, data) {
5666 //console.log(tooltipItems);
5667 //return data.datasets[2].drugs[tagme];
5671 hover: {
5672 mode: 'label'
5674 scales: {
5675 xAxes: {
5676 type: "time",
5677 stacked:false,
5678 id: "x-axis-1",
5679 time: {
5680 format: dateFormat,
5681 round: 'day',
5682 tooltipFormat: 'h:mm a'
5684 categoryPercentage: 0.5,
5685 barPercentage:1.0,
5686 //categoryPercentage:0.3,
5687 scaleLabel: {
5688 display: true,
5689 labelString: 'Date'
5691 ticks: {
5692 suggestedMin: 3,
5693 suggestedMax: 6
5696 'y-Axis-1': {
5697 type: "linear",
5698 display: false,
5699 position: "right",
5700 id: "y-axis-1",
5701 stacked: false,
5702 gridLines:{
5703 display: false
5705 labels: {
5706 show:true,
5708 scaleLabel: {
5709 display: false,
5710 labelString: 'Testing'
5712 ticks: {
5713 suggestedMin: 4,
5714 suggestedMax: 4
5717 'y-Axis-2': {
5718 type: "linear",
5719 display: true,
5720 position: "left",
5721 id: "y-axis-2",
5722 gridLines:{
5723 display: true
5725 labels: {
5726 show:true,
5728 scaleLabel: {
5729 display: true,
5730 labelString: 'IOP (mmHg)'
5732 ticks: {
5733 suggestedMin: 4,
5734 suggestedMax: 24,
5741 var ctx1 = document.getElementById("canvas_byday").getContext("2d");
5742 var ctx2 = document.getElementById("canvas_byhour").getContext("2d");
5744 var myLine = new Chart(ctx1, config_byday);
5745 var myLine2 = new Chart(ctx2, config_byhour);
5747 </script>
5748 <?php
5749 } else {
5750 echo "<div style='text-align:left;padding-left:20px;'><span>The Glaucoma Flow Sheet graphically displays:
5751 <ul>
5752 <li> IOP measurements</li>
5753 <li> Target IOPs </li>
5754 <li> related tests (OCT/VF/Gonio)</li>
5755 <li> diurnal IOP curve</li>
5756 </ul>
5757 The graphs are not generated on the initial visit...</span></div>";
5758 } ?>
5759 </div>
5760 </div>
5761 <?php
5764 # gets the provider from the encounter file , or from the logged on user or from the patient file
5765 function findProvider($pid, $encounter)
5767 $find_provider = sqlQuery("SELECT * FROM form_encounter " .
5768 "WHERE pid = ? AND encounter = ? " .
5769 "ORDER BY id DESC LIMIT 1", array($pid,$encounter));
5770 $providerid = $find_provider['provider_id'] ?? '';
5771 if ($providerid < '1') {
5772 //find the default providerID from the calendar
5773 $visit_date = date('Y-m-d', strtotime($find_provider['date'] ?? ''));
5774 $query = "select * from openemr_postcalendar_events where pc_pid=? and pc_eventDate=?";
5775 $find_provider3 = sqlQuery($query, array($pid,$visit_date));
5776 $new_providerid = $find_provider3['pc_aid'] ?? '';
5777 if (($new_providerid < '1') || (!$new_providerid)) {
5778 $get_authorized = $_SESSION['userauthorized'];
5779 if ($get_authorized == 1) {
5780 $find_provider2 = sqlQuery("SELECT providerID FROM patient_data WHERE pid = ? ", array($pid));
5781 $new_providerid = $find_provider2['providerID'];
5785 $providerid = $new_providerid;
5786 sqlStatement("UPDATE form_encounter set provider_id =? WHERE pid = ? AND encounter = ?", array($providerid,$pid,$encounter));
5787 sqlStatement("UPDATE patient_data set providerID =? WHERE pid = ?", array($providerid,$pid));
5790 return $providerid;
5793 function generate_lens_treatments($W, $LTs_present)
5795 ob_start();
5796 $query = "SELECT * FROM list_options where list_id =? and activity='1' ORDER BY seq";
5797 $TXs_data = sqlStatement($query, array("Eye_Lens_Treatments"));
5798 $counter = 0;
5799 $TXs_arr = explode("|", $LTs_present);
5800 $tabindex = $W . "0144";
5801 while ($row = sqlFetchArray($TXs_data)) {
5802 $checked = '';
5803 $ID = $row['option_id'];
5804 if (in_array($ID, $TXs_arr)) {
5805 $checked = "checked='yes'";
5808 echo "<input type='checkbox' id='TXs_" . $W . "_" . $counter . "' name='LENS_TREATMENTS_" . $W . "[]' $checked value='" . attr($ID) . "' tabindex='$tabindex'> ";
5809 $label = text(substr($row['title'], 0, 30));
5810 echo "<label for='TXs_" . $W . "_" . $counter . "' class='input-helper input-helper--checkbox' title='" . attr($row['notes']) . "'>";
5811 echo $label . "</label><br />";
5812 $counter++;
5813 $tabindex++;
5816 $output = ob_get_contents();
5817 ob_end_clean();
5818 return $output;
5822 * Function to display the fields for a currently worn glasses/spectacle Rx.
5823 * @param $W - the Rx number, in order of documentation
5825 function generate_specRx($W)
5827 global $pid,$form_id,$encounter,$display_W_width;
5829 $query = "select * from form_eye_mag_wearing where PID=? and FORM_ID=? and ENCOUNTER=? and RX_NUMBER =?";
5830 $wear = sqlQuery($query, array($pid,$form_id,$encounter,$W));
5831 if ($wear) {
5832 $RX_VALUE = '1';
5833 @extract($wear);
5834 } else {
5835 $RX_VALUE = '';
5836 $display_W = 'nodisplay';
5839 ob_start();
5841 <input type="hidden" id="W_<?php echo attr($W); ?>" name="W_<?php echo attr($W); ?>" value="<?php echo attr($RX_VALUE); ?>">
5843 <div id="LayerVision_W_<?php echo attr($W); ?>" name="currentRX" class="refraction current_W borderShadow <?php echo attr($display_W); ?> <?php echo $display_W_width; ?>">
5844 <i class="closeButton fas fa-times" id="Close_W_<?php echo attr($W); ?>" name="Close_W_<?php echo attr($W); ?>"
5845 title="<?php echo xla('Close this panel and delete this Rx'); ?>"></i>
5846 <i class="closeButton_2 fas fa-arrows-alt-h" id="W_width_display_<?php echo attr($W); ?>" name="W_width_display"
5847 title="<?php echo xla("Rx Details"); ?>" ></i>
5848 <i onclick="top.restoreSession(); doscript('W','<?php echo attr($pid); ?>','<?php echo attr($encounter); ?>','<?php echo attr($W); ?>'); return false;"
5849 title="<?php echo xla("Dispense Rx"); ?>" class="closeButton_3 fa fa-print"></i>
5850 <i onclick="top.restoreSession(); dispensed('<?php echo attr($pid); ?>');return false;"
5851 title="<?php echo xla("List of previously dispensed Spectacle and Contact Lens Rxs"); ?>" class="closeButton_4 fa fa-list-ul"></i>
5852 <table id="wearing_<?php echo attr($W); ?>" >
5853 <tr>
5854 <th colspan="7"><?php echo xlt('Current Glasses'); ?>: #<?php echo attr($W); ?>
5855 </th>
5856 </tr>
5857 <tr>
5858 <td></td>
5859 <td><i class="fa fa-gamepad" name="reverseme" title="<?php echo xla('Convert between plus and minus cylinder'); ?>"aria-hidden="true" id="revW<?php echo attr($W); ?>" ></i></td>
5860 <td><?php echo xlt('Sph{{Sphere}}'); ?></td>
5861 <td><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
5862 <td><?php echo xlt('Axis{{Axis of a glasses prescription}}'); ?></td>
5863 <td><?php echo xlt('Acuity'); ?></td>
5864 <td name="W_wide"></td>
5865 <td name="W_wide" title="<?php echo xla('Horizontal Prism Power'); ?>"><?php echo xlt('HP{{abbreviation for Horizontal Prism Power}}'); ?></td>
5866 <td name="W_wide" title="<?php echo xla('Horizontal Prism Base'); ?>"><?php echo xlt('HB{{abbreviation for Horizontal Prism Base}}'); ?></td>
5867 <td name="W_wide" title="<?php echo xla('Vertical Prism Power'); ?>"><?php echo xlt('VP{{abbreviation for Vertical Prism Power}}'); ?></td>
5868 <td name="W_wide" title="<?php echo xla('Vertical Prism Base'); ?>"><?php echo xlt('VB{{abbreviation for Vertical Prism Base}}'); ?></td>
5869 <td name="W_wide" title="<?php echo xla('Slab Off'); ?>"><?php echo xlt('Slab Off'); ?></td>
5870 <td name="W_wide" title="<?php echo xla('Vertex Distance'); ?>"><?php echo xlt('VD{{abbreviation for Vertex Distance}}'); ?></td>
5871 <td name="W_wide" title="<?php echo xla('Monocular Pupillary Diameter - Distance'); ?>"><?php echo xlt('MPD-D{{abbreviation for Monocular Pupillary Diameter - Distance}}'); ?></td>
5872 <td name="W_wide" title="<?php echo xla('Monocular Pupillary Diameter - Near'); ?>"><?php echo xlt('MPD-N{{abbreviation for Monocular Pupillary Diameter - Near}}'); ?></td>
5874 <td rowspan="6" class="right">
5875 <?php echo xlt('Rx Type{{Type of glasses prescription}}'); ?></span><br />
5876 <label for="Single_<?php echo attr($W); ?>" class="input-helper input-helper--checkbox"><?php echo xlt('Single'); ?></label>
5877 <input type="radio" value="0" id="Single_<?php echo attr($W); ?>" name="RX_TYPE_<?php echo attr($W); ?>" <?php
5878 if (($RX_TYPE ?? null) == '0') {
5879 echo 'checked="checked"';
5880 } ?> /></span><br /><br />
5881 <label for="Bifocal_<?php echo attr($W); ?>" class="input-helper input-helper--checkbox"><?php echo xlt('Bifocal'); ?></label>
5882 <input type="radio" value="1" id="Bifocal_<?php echo attr($W); ?>" name="RX_TYPE_<?php echo attr($W); ?>" <?php
5883 if (($RX_TYPE ?? null) == '1') {
5884 echo 'checked="checked"';
5885 } ?> /></span><br /><br />
5886 <label for="Trifocal_<?php echo attr($W); ?>" class="input-helper input-helper--checkbox"><?php echo xlt('Trifocal'); ?></label>
5887 <input type="radio" value="2" id="Trifocal_<?php echo attr($W); ?>" name="RX_TYPE_<?php echo attr($W); ?>" <?php
5888 if (($RX_TYPE ?? null) == '2') {
5889 echo 'checked="checked"';
5890 } ?> /></span><br /><br />
5891 <label for="Progressive_<?php echo attr($W); ?>" class="input-helper input-helper--checkbox"><?php echo xlt('Prog.{{Progressive lenses}}'); ?></label>
5892 <input type="radio" value="3" id="Progressive_<?php echo attr($W); ?>" name="RX_TYPE_<?php echo attr($W); ?>" <?php
5893 if (($RX_TYPE ?? null) == '3') {
5894 echo 'checked="checked"';
5895 } ?> /></span><br />
5896 </td>
5897 </tr>
5898 <tr>
5899 <td rowspan="2"><?php echo xlt('Dist{{distance}}'); ?></td>
5900 <td style="font-weight:bold;"><?php echo xlt('OD{{right eye}}'); ?>:</td>
5901 <td><?php if (!empty(${"ODSPH_$W"})) {
5902 echo ${"ODSPH_$W"};} ?><input type="text" class="sphere" id="ODSPH_<?php echo attr($W); ?>" name="ODSPH_<?php echo attr($W); ?>" value="<?php echo attr($ODSPH ?? ''); ?>" tabindex="<?php echo attr($W); ?>0100"></td>
5903 <td><input type="text" class="cylinder" id="ODCYL_<?php echo attr($W); ?>" name="ODCYL_<?php echo attr($W); ?>" value="<?php echo attr($ODCYL ?? ''); ?>" tabindex="<?php echo attr($W); ?>0101"></td>
5904 <td><input type="text" class="axis" id="ODAXIS_<?php echo attr($W); ?>" name="ODAXIS_<?php echo attr($W); ?>" value="<?php echo attr($ODAXIS ?? ''); ?>" tabindex="<?php echo attr($W); ?>0102"></td>
5905 <td><input type="text" class="acuity" id="ODVA_<?php echo attr($W); ?>" name="ODVA_<?php echo attr($W); ?>" value="<?php echo attr($ODVA ?? ''); ?>" tabindex="<?php echo attr($W); ?>0108"></td>
5907 <td name="W_wide"></td>
5908 <td name="W_wide"><input type="text" class="prism" id="ODHPD_<?php echo attr($W); ?>" name="ODHPD_<?php echo attr($W); ?>" value="<?php echo attr($ODHPD ?? ''); ?>" tabindex="<?php echo attr($W); ?>0112"></td>
5909 <td name="W_wide"><input type="text" class="prism" id="ODHBASE_<?php echo attr($W); ?>" name="ODHBASE_<?php echo attr($W); ?>" value="<?php echo attr($ODHBASE ?? ''); ?>" tabindex="<?php echo attr($W); ?>0114"></td>
5910 <td name="W_wide"><input type="text" class="prism" id="ODVPD_<?php echo attr($W); ?>" name="ODVPD_<?php echo attr($W); ?>" value="<?php echo attr($ODVPD ?? ''); ?>" tabindex="<?php echo attr($W); ?>0116"></td>
5911 <td name="W_wide"><input type="text" class="prism" id="ODVBASE_<?php echo attr($W); ?>" name="ODVBASE_<?php echo attr($W); ?>" value="<?php echo attr($ODVBASE ?? ''); ?>" tabindex="<?php echo attr($W); ?>0118"></td>
5912 <td name="W_wide"><input type="text" class="prism" id="ODSLABOFF_<?php echo attr($W); ?>" name="ODSLABOFF_<?php echo attr($W); ?>" value="<?php echo attr($ODSLABOFF ?? ''); ?>" tabindex="<?php echo attr($W); ?>0120"></td>
5913 <td name="W_wide"><input type="text" class="prism" id="ODVERTEXDIST_<?php echo attr($W); ?>" name="ODVERTEXDIST_<?php echo attr($W); ?>" value="<?php echo attr($ODVERTEXDIST ?? ''); ?>" tabindex="<?php echo attr($W); ?>0122"></td>
5914 <td name="W_wide"><input type="text" class="prism" id="ODMPDD_<?php echo attr($W); ?>" name="ODMPDD_<?php echo attr($W); ?>" value="<?php echo attr($ODMPDD ?? ''); ?>" tabindex="<?php echo attr($W); ?>0124"></td>
5915 <td name="W_wide"><input type="text" class="prism" id="ODMPDN_<?php echo attr($W); ?>" name="ODMPDN_<?php echo attr($W); ?>" value="<?php echo attr($ODMPDN ?? ''); ?>" tabindex="<?php echo attr($W); ?>0126"></td>
5916 </tr>
5917 <tr>
5918 <td style="font-weight:bold;"><?php echo xlt('OS{{left eye}}'); ?>:</td>
5919 <td><input type="text" class="sphere" id="OSSPH_<?php echo attr($W); ?>" name="OSSPH_<?php echo attr($W); ?>" value="<?php echo attr($OSSPH ?? ''); ?>" tabindex="<?php echo attr($W); ?>0103"></td>
5920 <td><input type="text" class="cylinder" id="OSCYL_<?php echo attr($W); ?>" name="OSCYL_<?php echo attr($W); ?>" value="<?php echo attr($OSCYL ?? ''); ?>" tabindex="<?php echo attr($W); ?>0104"></td>
5921 <td><input type="text" class="axis" id="OSAXIS_<?php echo attr($W); ?>" name="OSAXIS_<?php echo attr($W); ?>" value="<?php echo attr($OSAXIS ?? ''); ?>" tabindex="<?php echo attr($W); ?>0105"></td>
5922 <td><input type="text" class="acuity" id="OSVA_<?php echo attr($W); ?>" name="OSVA_<?php echo attr($W); ?>" value="<?php echo attr($OSVA ?? ''); ?>" tabindex="<?php echo attr($W); ?>0109"></td>
5924 <td name="W_wide"></td>
5925 <td name="W_wide"><input type="text" class="prism" id="OSHPD_<?php echo attr($W); ?>" name="OSHPD_<?php echo attr($W); ?>" value="<?php echo attr($OSHPD ?? ''); ?>" tabindex="<?php echo attr($W); ?>0113"></td>
5926 <td name="W_wide"><input type="text" class="prism" id="OSHBASE_<?php echo attr($W); ?>" name="OSHBASE_<?php echo attr($W); ?>" value="<?php echo attr($OSHBASE ?? ''); ?>" tabindex="<?php echo attr($W); ?>0115"></td>
5927 <td name="W_wide"><input type="text" class="prism" id="OSVPD_<?php echo attr($W); ?>" name="OSVPD_<?php echo attr($W); ?>" value="<?php echo attr($OSVPD ?? ''); ?>" tabindex="<?php echo attr($W); ?>0117"></td>
5928 <td name="W_wide"><input type="text" class="prism" id="OSVBASE_<?php echo attr($W); ?>" name="OSVBASE_<?php echo attr($W); ?>" value="<?php echo attr($OSVBASE ?? ''); ?>" tabindex="<?php echo attr($W); ?>0119"></td>
5929 <td name="W_wide"><input type="text" class="prism" id="OSSLABOFF_<?php echo attr($W); ?>" name="OSSLABOFF_<?php echo attr($W); ?>" value="<?php echo attr($OSSLABOFF ?? ''); ?>" tabindex="<?php echo attr($W); ?>0121"></td>
5930 <td name="W_wide"><input type="text" class="prism" id="OSVERTEXDIST_<?php echo attr($W); ?>" name="OSVERTEXDIST_<?php echo attr($W); ?>" value="<?php echo attr($OSVERTEXDIST ?? ''); ?>" tabindex="<?php echo attr($W); ?>0123"></td>
5931 <td name="W_wide"><input type="text" class="prism" id="OSMPDD_<?php echo attr($W); ?>" name="OSMPDD_<?php echo attr($W); ?>" value="<?php echo attr($OSMPDD ?? ''); ?>" tabindex="<?php echo attr($W); ?>0125"></td>
5932 <td name="W_wide"><input type="text" class="prism" id="OSMPDN_<?php echo attr($W); ?>" name="OSMPDN_<?php echo attr($W); ?>" value="<?php echo attr($OSMPDN ?? ''); ?>" tabindex="<?php echo attr($W); ?>0127"></td>
5933 </tr>
5934 <tr class="WNEAR">
5935 <td rowspan=2><?php echo xlt('Mid{{middle Rx strength}}'); ?>/<br /><?php echo xlt('Near'); ?></td>
5936 <td style="font-weight:bold;"><?php echo xlt('OD{{right eye}}'); ?>:</td>
5937 <?php echo '<input type="hidden" name="RXStart_' . $W . ' id="RXStart_' . $W . '" value="' . attr($RX_TYPE ?? '') . '">'; ?>
5938 <td class="WMid"><input type="text" class="presbyopia" id="ODMIDADD_<?php echo attr($W); ?>" name="ODMIDADD_<?php echo attr($W); ?>" value="<?php echo attr($ODMIDADD ?? ''); ?>"></td>
5939 <td class="WAdd2"><input type="text" class="presbyopia" id="ODADD_<?php echo attr($W); ?>" name="ODADD_<?php echo attr($W); ?>" value="<?php echo attr($ODADD ?? ''); ?>" tabindex="<?php echo attr($W); ?>0106"></td>
5940 <td></td>
5941 <td><input class="jaeger" type="text" id="NEARODVA_<?php echo attr($W); ?>" name="NEARODVA_<?php echo attr($W); ?>" value="<?php echo attr($NEARODVA ?? ''); ?>" tabindex="<?php echo attr($W); ?>0110"></td>
5943 <td name="W_wide"></td>
5945 <td name="W_wide" title="<?php echo xla('Binocular Pupillary Diameter - Distance'); ?>"><?php echo xlt('PD-D{{abbreviation for Binocular Pupillary Diameter - Distance}}'); ?></td>
5946 <td name="W_wide" title="<?php echo xla('Binocular Pupillary Diameter - Near'); ?>"><?php echo xlt('PD-N{{abbreviation for Binocular Pupillary Diameter - Near}}'); ?></td>
5947 <td name="W_wide" title="<?php echo xla('Lens Material'); ?>" colspan="2">
5948 <a href="<?php echo $GLOBALS['webroot']; ?>/interface/super/edit_list.php?list_id=Eye_Lens_Material" target="RTop"
5949 title="<?php echo xla('Click here to edit list of available Lens Materials'); ?>"
5950 name="Lens_mat"><span class="underline"><?php echo xlt('Lens Material'); ?></span> <i class="fa fa-pencil-alt-alt fa-fw"></i> </a>
5951 </td>
5952 <td name="W_wide2" colspan="4" rowspan="4">
5953 <a href="<?php echo $GLOBALS['webroot']; ?>/interface/super/edit_list.php?list_id=Eye_Lens_Treatments" target="RTop"
5954 title="<?php echo xla('Click here to edit list of available Lens Treatment Options'); ?>"
5955 name="Lens_txs"><span class="underline"><?php echo xlt('Lens Treatments'); ?></span> <i class="fa fa-pencil-alt-alt fa-fw"></i> </a>
5956 <br />
5957 <?php echo generate_lens_treatments($W, ($LENS_TREATMENTS ?? '')); ?>
5958 </td>
5959 </tr>
5960 <tr class="WNEAR">
5961 <td style="font-weight:bold;"><?php echo xlt('OS{{left eye}}'); ?>:</td>
5962 <td class="WMid"><input type="text" class="presbyopia" id="OSMIDADD_<?php echo attr($W); ?>" name="OSMIDADD_<?php echo attr($W); ?>" value="<?php echo attr($OSMIDADD ?? ''); ?>"></td>
5963 <td class="WAdd2"><input type="text" class="presbyopia" id="OSADD_<?php echo attr($W); ?>" name="OSADD_<?php echo attr($W); ?>" value="<?php echo attr($OSADD ?? ''); ?>" tabindex="<?php echo attr($W); ?>0107"></td>
5964 <td></td>
5965 <td><input class="jaeger" type="text" id="NEAROSVA_<?php echo attr($W); ?>" name="NEAROSVA_<?php echo attr($W); ?>" value="<?php echo attr($NEAROSVA ?? ''); ?>" tabindex="<?php echo attr($W); ?>0111"></td>
5967 <td name="W_wide"></td>
5969 <td name="W_wide"><input type="text" class="prism" id="BPDD_<?php echo attr($W); ?>" name="BPDD_<?php echo attr($W); ?>" value="<?php echo attr($BPDD ?? ''); ?>" tabindex="<?php echo attr($W); ?>0128"></td>
5970 <td name="W_wide"><input type="text" class="prism" id="BPDN_<?php echo attr($W); ?>" name="BPDN_<?php echo attr($W); ?>" value="<?php echo attr($BPDN ?? ''); ?>" tabindex="<?php echo attr($W); ?>0129"></td>
5971 <td name="W_wide" title="<?php echo xla('Lens Material Options'); ?>" colspan="2">
5972 <?php echo generate_select_list("LENS_MATERIAL_" . $W, "Eye_Lens_Material", ($LENS_MATERIAL ?? ''), '', ' ', '', 'restoreSession;submit_form();', '', array('style' => 'width:120px','tabindex' => $W . '0130')); ?>
5973 </td>
5974 </tr>
5975 <tr>
5976 <td style="font-weight:bold;" colspan="2"><?php echo xlt('Comments'); ?>:
5977 </td>
5978 <td colspan="4" class="up"></td>
5979 </tr>
5980 <tr>
5981 <td colspan="6">
5982 <textarea id="COMMENTS_<?php echo attr($W); ?>" name="COMMENTS_W" tabindex="<?php echo attr($W); ?>0110"><?php echo text($COMMENTS ?? ''); ?></textarea>
5983 </td>
5984 <td colspan="2">
5985 </td>
5986 </tr>
5987 </table>
5988 </div>
5989 <?php
5990 $output = ob_get_contents();
5991 ob_end_clean();
5992 return $output;
5996 * Function to display Refractive Data for an encounter
5997 * @param array $encounter_data, visit data for a given encounter
5999 function display_refractive_data($encounter_data)
6001 @extract($encounter_data);
6002 $count_rx = '0';
6004 $query = "select * from form_eye_mag_wearing where PID=? and FORM_ID=? ORDER BY RX_NUMBER";
6006 $wear = sqlStatement($query, array($pid,$id));
6007 while ($wearing = sqlFetchArray($wear)) {
6008 $count_rx++;
6009 ${"display_W_$count_rx"} = '';
6010 ${"ODSPH_$count_rx"} = $wearing['ODSPH'];
6011 ${"ODCYL_$count_rx"} = $wearing['ODCYL'];
6012 ${"ODAXIS_$count_rx"} = $wearing['ODAXIS'];
6013 ${"OSSPH_$count_rx"} = $wearing['OSSPH'];
6014 ${"OSCYL_$count_rx"} = $wearing['OSCYL'];
6015 ${"OSAXIS_$count_rx"} = $wearing['OSAXIS'];
6016 ${"ODMIDADD_$count_rx"} = $wearing['ODMIDADD'];
6017 ${"OSMIDADD_$count_rx"} = $wearing['OSMIDADD'];
6018 ${"ODADD_$count_rx"} = $wearing['ODADD'];
6019 ${"OSADD_$count_rx"} = $wearing['OSADD'];
6020 ${"ODVA_$count_rx"} = $wearing['ODVA'];
6021 ${"OSVA_$count_rx"} = $wearing['OSVA'];
6022 ${"ODNEARVA_$count_rx"} = $wearing['ODNEARVA'];
6023 ${"OSNEARVA_$count_rx"} = $wearing['OSNEARVA'];
6024 ${"ODPRISM_$count_rx"} = $wearing['ODPRISM'];
6025 ${"OSPRISM_$count_rx"} = $wearing['OSPRISM'];
6026 ${"COMMENTS_$count_rx"} = $wearing['COMMENTS'];
6027 ${"W_$count_rx"} = '1';
6028 ${"RX_TYPE_$count_rx"} = $wearing['RX_TYPE'];
6031 if (!$ODVA || $OSVA || $ARODSPH || $AROSSPH || $MRODSPH || $MROSSPH || $CRODSPH || $CROSSPH || $CTLODSPH || $CTLOSSPH) { ?>
6032 <table class="refraction_tables">
6033 <tr class="text-center bold underline" style="background-color: #F3EEC7;">
6034 <td ><?php echo oeFormatShortDate($date); ?></td>
6035 <td ><?php echo xlt('Eye'); ?></td>
6036 <td ><?php echo xlt('Sph{{Sphere}}'); ?></td>
6037 <td ><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
6038 <td ><?php echo xlt('Axis{{Axis of a glasses prescription}}'); ?></td>
6039 <td ><?php echo xlt('Prism'); ?></td>
6040 <td ><?php echo xlt('Acuity'); ?></td>
6041 <td ><?php echo xlt('Mid{{Middle Distance Add}}'); ?></td>
6042 <td ><?php echo xlt('ADD{{Near Add}}'); ?></td>
6043 <td ><?php echo xlt('Acuity'); ?></td>
6044 </tr>
6045 <?php
6046 //$count_rx++;
6047 for ($i = 1; $i <= $count_rx; $i++) {
6048 if (${"RX_TYPE_$i"} == "0") {
6049 $RX_TYPE = '';
6050 } elseif (${"RX_TYPE_$i"} == "1") {
6051 $RX_TYPE = xlt('Bifocals');
6052 } elseif (${"RX_TYPE_$i"} == "2") {
6053 $RX_TYPE = xlt('Trifocals');
6054 } elseif (${"RX_TYPE_$i"} == "3") {
6055 $RX_TYPE = xlt('Progressive');
6058 <tr>
6059 <td class="bold"><?php echo xlt('Wear RX') . " #" . $i . ": "; ?></td>
6060 <td class="bold"><?php echo xlt('OD{{right eye}}'); ?></td>
6061 <td ><?php echo (text(${"ODSPH_$i"}) ?: "-"); ?></td>
6062 <td ><?php echo (text(${"ODCYL_$i"}) ?: "-"); ?></td>
6063 <td ><?php echo (text(${"ODAXIS_$i"}) ?: "-"); ?></td>
6064 <td ><?php echo (text(${"ODPRISM_$i"}) ?: "-"); ?></td>
6065 <td ><?php echo (text(${"ODVA_$i"}) ?: "-"); ?></td>
6066 <td ><?php echo (text(${"ODMIDADD_$i"}) ?: "-"); ?></td>
6067 <td ><?php echo (text(${"ODADD_$i"}) ?: "-"); ?></td>
6068 <td ><?php echo (text(${"ODNEARVA_$i"}) ?: "-"); ?></td>
6069 </tr>
6070 <tr>
6071 <td><?php echo $RX_TYPE; ?></td>
6072 <td class="bold"><?php echo xlt('OS{{left eye}}'); ?></td>
6073 <td ><?php echo (text(${"OSSPH_$i"}) ?: "-"); ?></td>
6074 <td ><?php echo (text(${"OSCYL_$i"}) ?: "-"); ?></td>
6075 <td ><?php echo (text(${"OSAXIS_$i"}) ?: "-"); ?></td>
6076 <td ><?php echo (text(${"OSPRISM_$i"}) ?: "-"); ?></td>
6077 <td ><?php echo (text(${"OSVA_$i"}) ?: "-"); ?></td>
6078 <td ><?php echo (text(${"OSMIDADD_$i"}) ?: "-"); ?></td>
6079 <td ><?php echo (text(${"OSADD_$i"}) ?: "-"); ?></td>
6080 <td ><?php echo (text(${"OSNEARVA_$i"}) ?: "-"); ?></td>
6081 </tr>
6082 <?php
6083 if (${"COMMENTS_$i"}) {
6085 <tr>
6086 <td></td>
6087 <td colspan="2"><?php echo xlt('Comments'); ?>:</td>
6088 <td colspan="7"><?php echo text(${"COMMENTS_$i"}); ?></td>
6089 </tr>
6090 <?php
6092 ?><tr><td colspan="10">--------------------------------------------------------</td></tr>
6093 <?php
6096 if ($ARODSPH || $AROSSPH) { ?>
6097 <tr style="border-bottom:1pt solid black;">
6098 <td class="bold"><?php echo xlt('AutoRef'); ?></td>
6099 <td class="bold"><?php echo xlt('OD{{right eye}}'); ?></td>
6100 <td ><?php echo (text($ARODSPH) ?: "-"); ?></td>
6101 <td ><?php echo (text($ARODCYL) ?: "-"); ?></td>
6102 <td ><?php echo (text($ARODAXIS) ?: "-"); ?></td>
6103 <td ><?php echo (text($ARODPRISM) ?: "-"); ?></td>
6104 <td ><?php echo (text($ARODVA) ?: "-"); ?></td>
6105 <td >-</td>
6106 <td ><?php echo (text($ARODADD) ?: "-"); ?></td>
6107 <td ><?php echo (text($ARNEARODVA) ?: "-"); ?></td>
6108 </tr>
6109 <tr>
6110 <td>&nbsp;</td>
6111 <td class="bold"><?php echo xlt('OS{{left eye}}'); ?></td>
6112 <td ><?php echo (text($AROSSPH) ?: "-"); ?></td>
6113 <td ><?php echo (text($AROSCYL) ?: "-"); ?></td>
6114 <td ><?php echo (text($AROSAXIS) ?: "-"); ?></td>
6115 <td ><?php echo (text($AROSPRISM) ?: "-"); ?></td>
6116 <td ><?php echo (text($AROSVA) ?: "-"); ?></td>
6117 <td >-</td>
6118 <td ><?php echo (text($AROSADD) ?: "-"); ?></td>
6119 <td ><?php echo (text($ARNEAROSVA) ?: "-"); ?></td>
6120 </tr>
6121 <?php
6122 if (${"COMMENTS_$i"}) {
6124 <tr>
6125 <td></td><td></td>
6126 <td>Comments:</td>
6127 <td colspan="7"><?php echo text(${"COMMENTS_$i"}); ?></td>
6128 </tr>
6129 <?php
6131 <tr><td colspan="10">--------------------------------------------------------</td></tr>
6132 <?php
6135 if ($MRODSPH || $MROSSPH) { ?>
6136 <tr>
6137 <td class="bold"><?php echo xlt('MR (Dry)'); ?></td>
6138 <td class="bold"><?php echo xlt('OD{{right eye}}'); ?></td>
6139 <td ><?php echo (text($MRODSPH) ?: "-"); ?></td>
6140 <td ><?php echo (text($MRODCYL) ?: "-"); ?></td>
6141 <td ><?php echo (text($MRODAXIS) ?: "-"); ?></td>
6142 <td ><?php echo (text($MRODPRISM) ?: "-"); ?></td>
6143 <td ><?php echo (text($MRODVA) ?: "-"); ?></td>
6144 <td >-</td>
6145 <td ><?php echo (text($MRODADD) ?: "-"); ?></td>
6146 <td ><?php echo (text($MRNEARODVA) ?: "-"); ?></td>
6147 </tr>
6148 <tr></tr>
6149 <tr>
6150 <td></td>
6151 <td class="bold"><?php echo xlt('OS{{left eye}}'); ?></td>
6152 <td ><?php echo (text($MROSSPH) ?: "-"); ?></td>
6153 <td ><?php echo (text($MROSCYL) ?: "-"); ?></td>
6154 <td ><?php echo (text($MROSAXIS) ?: "-"); ?></td>
6155 <td ><?php echo (text($MROSPRISM) ?: "-"); ?></td>
6156 <td ><?php echo (text($MROSVA) ?: "-"); ?></td>
6157 <td >-</td>
6158 <td ><?php echo (text($MROSADD) ?: "-"); ?></td>
6159 <td ><?php echo (text($MRNEAROSVA) ?: "-"); ?></td>
6160 </tr>
6161 <tr><td colspan="10">--------------------------------------------------------</td></tr>
6162 <?php
6165 if ($CRODSPH || $CROSSPH) { ?>
6166 <tr>
6167 <td class="bold"><?php echo xlt('CR (Wet)'); ?></td>
6168 <td class="bold"><?php echo xlt('OD{{right eye}}'); ?></td>
6169 <td ><?php echo (text($CRODSPH) ?: "-"); ?></td>
6170 <td ><?php echo (text($CRODCYL) ?: "-"); ?></td>
6171 <td ><?php echo (text($CRODAXIS) ?: "-"); ?></td>
6172 <td ><?php echo (text($CRODPRISM) ?: "-"); ?></td>
6173 <td ><?php echo (text($CRODVA) ?: "-"); ?></td>
6174 <td >-</td>
6175 <td ><?php echo (text($CRODADD) ?: "-"); ?></td>
6176 <td ><?php echo (text($CRNEARODVA) ?: "-"); ?></td>
6177 </tr>
6178 <tr>
6179 <td></td>
6180 <td class="bold"><?php echo xlt('OS{{left eye}}'); ?></td>
6181 <td ><?php echo (text($CROSSPH) ?: "-"); ?></td>
6182 <td ><?php echo (text($CROSCYL) ?: "-"); ?></td>
6183 <td ><?php echo (text($CROSAXIS) ?: "-"); ?></td>
6184 <td ><?php echo (text($CROSPRISM) ?: "-"); ?>&nbsp;</td>
6185 <td ><?php echo (text($CROSVA) ?: "-"); ?></td>
6186 <td >-</td>
6187 <td ><?php echo (text($CROSADD) ?: "-"); ?></td>
6188 <td ><?php echo (text($CRNEAROSVA) ?: "-"); ?></td>
6189 </tr>
6190 <tr><td colspan="10">--------------------------------------------------------</td></tr>
6191 <?php
6194 if ($CTLODSPH || $CTLOSSPH) { ?>
6195 <tr class="bold text-center underline">
6196 <td></td>
6197 <td><?php echo xlt('Eye'); ?></td>
6198 <td><?php echo xlt('Sph{{Sphere}}'); ?></td>
6199 <td><?php echo xlt('Cyl{{Cylinder}}'); ?></td>
6200 <td><?php echo xlt('Axis{{Axis of a glasses prescription}}'); ?></td>
6201 <td><?php echo xlt('BC{{Base Curve}}'); ?></td>
6202 <td><?php echo xlt('Diam{{Diameter}}'); ?></td>
6203 <td></td>
6204 <td><?php echo xlt('ADD'); ?></td>
6205 <td><?php echo xlt('Acuity'); ?></td>
6206 </tr>
6207 <tr>
6208 <td class="bold"><?php echo xlt('CTL'); ?></td>
6209 <td class="bold"><?php echo xlt('OD{{right eye}}'); ?></td>
6210 <td ><?php echo (text($CTLODSPH) ?: "-"); ?></td>
6211 <td ><?php echo (text($CTLODCYL) ?: "-"); ?></td>
6212 <td ><?php echo (text($CTLODAXIS) ?: "-"); ?></td>
6213 <td ><?php echo (text($CTLODBC) ?: "-"); ?></td>
6214 <td ><?php echo (text($CTLODDIAM) ?: "-"); ?></td>
6215 <td></td>
6216 <td ><?php echo (text($CTLODADD) ?: "-"); ?></td>
6217 <td ><?php echo (text($CTLODVA) ?: "-"); ?></td>
6218 </tr>
6219 <?php if (!empty($CTLODQUANTITY)) { ?>
6220 <tr>
6221 <td></td>
6222 <td colspan="8" class="text-left" style="font-size:10px;"><?php echo text($CTLODQUANTITY); ?></td>
6223 </tr>
6224 <?php } ?>
6225 <tr style="font-size:0.6em;">
6226 <td></td>
6227 <td colspan="3" class="bold text-left" style="font-size:10px;"><?php echo xlt('Brand'); ?>:<?php echo (text($CTLBRANDOD) ?: "-"); ?></td>
6228 <td colspan="2" class="bold text-left" style="font-size:10px;"><?php echo xlt('by{{made by/manufacturer}}'); ?> <?php echo (text($CTLMANUFACTUREROD) ?: "-"); ?></td>
6229 <td colspan="3" class="bold text-left" style="font-size:10px;"><?php echo xlt('via{{shipped by/supplier}}'); ?> <?php echo (text($CTLSUPPLIEROD) ?: "-"); ?></td>
6231 </tr>
6232 <tr>
6233 <td></td>
6234 <td class="bold"><?php echo xlt('OS{{left eye}}'); ?></td>
6235 <td ><?php echo (text($CTLOSSPH) ?: "-"); ?></td>
6236 <td ><?php echo (text($CTLOSCYL) ?: "-"); ?></td>
6237 <td ><?php echo (text($CTLOSAXIS) ?: "-"); ?></td>
6238 <td ><?php echo (text($CTLOSBC) ?: "-"); ?></td>
6239 <td ><?php echo (text($CTLOSDIAM) ?: "-"); ?></td>
6240 <td></td>
6241 <td ><?php echo (text($CTLOSADD) ?: "-"); ?></td>
6242 <td ><?php echo (text($CTLOSVA) ?: "-"); ?></td>
6243 </tr>
6244 <tr style="font-size:9px;">
6245 <td></td>
6246 <td colspan="3" class="bold text-left" style="font-size:10px;"><?php echo xlt('Brand'); ?>: <?php echo (text($CTLBRANDOS) ?: "-"); ?></td>
6247 <td colspan="2" class="bold text-left" style="font-size:10px;"><?php echo xlt('by{{made by/manufacturer}}'); ?> <?php echo (text($CTLMANUFACTUREROS) ?: "-"); ?></td>
6248 <td colspan="3" class="bold text-left" style="font-size:10px;"><?php echo xlt('via{{shipped by/supplier}}'); ?> <?php echo (text($CTLSUPPLIEROS) ?: "-"); ?></td>
6249 </tr>
6250 <?php if (!empty($CTLOSQUANTITY)) { ?>
6251 <tr>
6252 <td></td>
6253 <td colspan="8" class="text-left" style="font-size:10px;"><?php echo text($CTLOSQUANTITY); ?></td>
6254 </tr>
6255 <?php }
6256 if (!empty($COMMENTS)) { ?>
6257 <tr>
6258 <td></td>
6259 <td colspan="8" class="text-left" style="font-size:10px;"><?php echo text($COMMENTS); ?></td>
6260 </tr>
6261 <?php }
6264 <tr><td colspan="10">--------------------------------------------------------</td></tr>
6265 </table>
6267 <?php
6268 } ?>
6270 <?php
6271 if ($GLAREODVA || $CONTRASTODVA || $ODK1 || $ODK2 || $LIODVA || $PAMODBA) { ?>
6272 <table>
6273 <tr>
6274 <td id="LayerVision_ADDITIONAL" class="refraction <?php echo $display_Add; ?>" style="padding:10px;font-size:10px;">
6275 <table id="Additional" style="padding:5;font-size:10px;">
6276 <tr><td colspan="9" style="text-align:left;text-decoration:underline;font-weight:bold;"><?php echo xlt('Additional Data Points'); ?></td></tr>
6277 <tr class="bold"><td></td>
6278 <td><?php echo xlt('PH{{Pinhole}}'); ?></td>
6279 <td><?php echo xlt('PAM{{Potential Acuity Meter}}'); ?></td>
6280 <td><?php echo xlt('LI{{Laser Interferometry}}'); ?></td>
6281 <td><?php echo xlt('BAT{{Brightness Acuity Testing}}'); ?></td>
6282 <td><?php echo xlt('K1{{Keratometry 1}}'); ?></td>
6283 <td><?php echo xlt('K2{{Keratometry 2}}'); ?></td>
6284 <td><?php echo xlt('Axis{{Axis of a glasses prescription}}'); ?></td>
6285 </tr>
6286 <tr><td class="bold"><?php echo xlt('OD{{right eye}}'); ?>:</td>
6287 <td><?php echo text($PHODVA); ?></td>
6288 <td><?php echo text($PAMODVA); ?></td>
6289 <td><?php echo text($LIODVA); ?></td>
6290 <td><?php echo text($GLAREODVA); ?></td>
6291 <td><?php echo text($ODK1); ?></td>
6292 <td><?php echo text($ODK2); ?></td>
6293 <td><?php echo text($ODK2AXIS); ?></td>
6294 </tr>
6295 <tr>
6296 <td class="bold"><?php echo xlt('OS{{left eye}}'); ?>:</td>
6297 <td><?php echo text($PHOSVA); ?></td>
6298 <td><?php echo text($PAMOSVA); ?></td>
6299 <td><?php echo text($LIOSVA); ?></td>
6300 <td><?php echo text($GLAREOSVA); ?></td>
6301 <td><?php echo text($OSK1); ?></td>
6302 <td><?php echo text($OSK2); ?></td>
6303 <td><?php echo text($OSK2AXIS); ?></td>
6304 </tr>
6305 <tr><td>&nbsp;</td></tr>
6306 <tr class="bold">
6307 <td></td>
6308 <td><?php echo xlt('AxLength{{axial Length}}'); ?></td>
6309 <td><?php echo xlt('ACD{{anterior chamber depth}}'); ?></td>
6310 <td><?php echo xlt('PD{{pupillary distance}}'); ?></td>
6311 <td><?php echo xlt('LT{{lens thickness}}'); ?></td>
6312 <td><?php echo xlt('W2W{{white-to-white}}'); ?></td>
6313 <td><?php echo xlt('ECL{{equivalent contact lens power at the corneal level}}'); ?></td>
6314 <td><?php echo xlt('VABiNoc{{Binocular visual acuity}}'); ?></td>
6315 </tr>
6316 <tr><td class="bold"><?php echo xlt('OD{{right eye}}'); ?>:</td>
6317 <td><?php echo text($ODAXIALLENGTH); ?></td>
6318 <td><?php echo text($ODACD); ?></td>
6319 <td><?php echo text($ODPDMeasured); ?></td>
6320 <td><?php echo text($ODLT); ?></td>
6321 <td><?php echo text($ODW2W); ?></td>
6322 <td><?php echo text($ODECL); ?></td>
6323 <td><?php echo text($VABINOC); ?></td>
6324 </tr>
6325 <tr>
6326 <td class="bold"><?php echo xlt('OS{{left eye}}'); ?>:</td>
6327 <td><?php echo text($OSAXIALLENGTH); ?></td>
6328 <td><?php echo text($OSACD); ?></td>
6329 <td><?php echo text($OSPDMeasured); ?></td>
6330 <td><?php echo text($OSLT); ?></td>
6331 <td><?php echo text($OSW2W); ?></td>
6332 <td><?php echo text($OSECL); ?></td>
6333 <!-- <td><input type=text id="pend" name="pend" value="<?php echo text($pend); ?>"></td> -->
6334 </tr>
6335 </table>
6336 </td>
6337 </tr>
6338 </table>
6339 <?php
6344 * Function to search recursively through a multi-dimensional array for an item
6345 * Would be nice if it returned the location in the array too but it it doesn't.
6346 * Only returns true or false.
6347 * @param $needle
6348 * @param $haystack
6349 * @param bool $strict
6350 * @return bool*
6352 function in_array_r($needle, $haystack, $strict = false)
6354 if (empty($haystack)) {
6355 return false;
6357 foreach ($haystack as $item) {
6358 if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict))) {
6359 return true;
6362 return false;
6366 * Function to recursively search through prior eye appointments
6367 * to discover the target IOPS for this patient.
6369 * @param $pid = patient id
6370 * @param $id = form_id values are needed for
6371 * @param $provider_id = who is the patient's provider is only needed if there is no value anywhere else.
6372 * @return array (ODIOPTARGET AND OSIOPTARGET to be saved in this encounter
6374 function getIOPTARGETS($pid, $id, $provider_id)
6376 //iterate through this patient's encounters to find IOPTARGETS.
6377 //if none use provider's default value, or 21.
6379 $query = "SELECT ODIOPTARGET, OSIOPTARGET from form_eye_vitals where pid=? and id < ? ORDER BY id DESC";
6380 $result = sqlStatement($query, array($pid, $id));
6382 while ($row = sqlFetchArray($result)) {
6383 if (($row['ODIOPTARGET'] > '0') || ($row['OSIOPTARGET'] > '0')) {
6384 return array($row['ODIOPTARGET'], $row['OSIOPTARGET']);
6387 $query = "SELECT * FROM `list_options`
6388 WHERE
6389 `list_id` LIKE ? AND
6390 ( option_id = 'ODIOPTARGET' OR
6391 option_id = 'OSIOPTARGET' )
6393 $result = sqlQuery($query, array("Eye_defaults_" . $provider_id));
6394 while ($default_TARGETS = sqlFetchArray($result)) {
6395 if ($default_TARGETS['option_id'] == 'ODIOPTARGET') {
6396 $ODIOPTARGET = $default_TARGETS["title"];
6398 if ($default_TARGETS['option_id'] == 'OSIOPTARGET') {
6399 $OSIOPTARGET = $default_TARGETS["title"];
6402 if ((($ODIOPTARGET ?? null) > '0') || (($OSIOPTARGET ?? null) > '0')) {
6403 return array($ODIOPTARGET, $OSIOPTARGET);
6405 return array('21','21');