PageRenderTime 125ms CodeModel.GetById 39ms RepoModel.GetById 1ms app.codeStats 2ms

/interface/forms/eye_mag/php/eye_mag_functions.php

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