/** * This function returns the TARGET IOP values for a given ($pid) if ever set, otherwise returns the DEFAULT IOP. * when a value is found for a given field in the Eye Form for a given patient ($pid) * @param $name is in the name of the field * * @return $ranges. A mysqlArray(max_FIELD,max_date,min_date) */ function display_GlaucomaFlowSheet($pid, $bywhat = 'byday') { global $PMSFH; global $documents; global $form_folder; global $priors; global $providerID; global $documents; global $encounter_data; global $ODIOPTARGET; global $OSIOPTARGET; global $dated; if (!$documents) { list($documents) = document_engine($pid); } $count_OCT = count($documents['docs_in_name']['OCT']); if ($count_OCT > 0) { foreach ($documents['docs_in_name']['OCT'] as $OCT) { $OCT_date[] = $OCT['docdate']; } } $count_VF = count($documents['docs_in_name']['VF']); if ($count_VF > 0) { foreach ($documents['docs_in_name']['VF'] as $VF) { $VF_date[] = $VF['docdate']; } } $i = 0; //if there are no priors, this is the first visit, display a generic splash screen. if ($priors) { foreach ($priors as $visit) { //we need to build the lists - dates_OU,times_OU,gonio_OU,OCT_OU,VF_OU,ODIOP,OSIOP,IOPTARGETS $old_date_timestamp = strtotime($visit['visit_date']); $visit['exam_date'] = date('Y-m-d', $old_date_timestamp); $VISITS_date[$i] = $visit['exam_date']; //$date_OU[$i] = $visit['exam_date']; $time_here = explode(":", $visit['IOPTIME']); $time = $time_here[0] . ":" . $time_here[1]; $time_OU[$i] = $time; if ($visit['ODGONIO'] > '' || $visit['OSGONIO'] > '') { $GONIO_date[$i] = $visit["exam_date"]; $GONIO[$i]["list"] = '1'; } else { $GONIO[$i]["list"] = ''; } if ($visit['ODIOPAP'] > '') { $ODIOP[$i]['IOP'] = $visit['ODIOPAP']; $ODIOP[$i]['method'] = "AP"; } else { if ($visit['ODIOPTPN'] > '') { $ODIOP[$i]['IOP'] = $visit['ODIOPTPN']; $ODIOP[$i]['method'] = "TPN"; } else { $ODIOP[$i]['IOP'] = ""; } } if ($visit['OSIOPAP'] > '') { $OSIOP[$i]['IOP'] = $visit['OSIOPAP']; $OSIOPMETHOD[$i]['method'] = "AP"; } else { if ($visit['OSIOPTPN'] > '') { $OSIOP[$i]['IOP'] = $visit['OSIOPTPN']; $OSIOPMETHOD[$i]['method'] = "TPN"; } else { $OSIOP[$i]['IOP'] = "null"; //we are ignoring finger tension for graphing purposes but include this should another form of IOP measurement arrive... //What about the Triggerfish contact lens continuous IOP device for example... } } //build the Target line values for each date. $j = $i - 1; if ($visit['ODIOPTARGET'] > '') { $ODIOPTARGETS[$i] = $visit['ODIOPTARGET']; } else { if (!$ODIOPTARGETS[$j]) { //get this from the provider's default list_option $query = "SELECT * FROM `list_options` WHERE `list_id` LIKE 'Eye_defaults_" . $providerID . "' and (option_id = 'ODIOPTARGET' OR option_id = 'OSIOPTARGET')"; $results = sqlQuery($query); while ($default_TARGETS = sqlFetchArray($result)) { if ($default_TARGETS['option_id'] == 'ODIOPTARGET') { $ODIOPTARGETS[$i] = $default_TARGETS["title"]; } if ($default_TARGETS['option_id'] == 'OSIOPTARGET') { $OSIOPTARGETS[$i] = $default_TARGETS["title"]; } } } else { $ODIOPTARGETS[$i] = $ODIOPTARGETS[$j]; } } if ($visit['OSIOPTARGET'] > '') { $OSIOPTARGETS[$i] = $visit['OSIOPTARGET']; } else { if (!$OSIOPTARGETS[$j] > '') { if (!$OSIOPTARGETS[$i]) { $query = "SELECT * FROM `list_options` WHERE `list_id` LIKE 'Eye_defaults_" . $providerID . "' and (option_id = 'ODIOPTARGET' OR option_id = 'OSIOPTARGET')"; $results = sqlQuery($query); while ($default_TARGETS = sqlFetchArray($result)) { if ($default_TARGETS['option_id'] == 'OSIOPTARGET') { $OSIOPTARGETS[$i] = $default_TARGETS["title"]; } } } } else { $OSIOPTARGETS[$i] = $OSIOPTARGETS[$j]; } } $i++; } } else { //there are no priors, get info for this visit $VISITS_date[0] = $dated; if ($encounter_data['IOPTIME']) { $time_here = explode(":", $encounter_data['IOPTIME']); $time = $time_here[0] . ":" . $time_here[1]; $time_OU[] = $time; } if ($encounter_data['ODGONIO'] || $encounter_data['OSGONIO']) { $GONIO_date[$i] = $dated; } $ODIOP[$i]['time'] = $time; $OSIOP[$i]['time'] = $time; //$IOPTARGET['visit_date'] = $encounter_data['exam_date']; if ($encounter_data['ODIOPAP'] > '') { $ODIOP[$i]['IOP'] = $encounter_data['ODIOPAP']; $ODIOP[$i]['method'] = "AP"; } else { if ($encounter_data['ODIOPTPN'] > '') { $ODIOP[$i]['IOP'] = $encounter_data['ODIOPTPN']; $ODIOP[$i]['method'] = "TPN"; } } if ($encounter_data['OSIOPAP'] > '') { $OSIOP[$i]['IOP'] = $encounter_data['OSIOPAP']; $OSIOP[$i]['method'] = "AP"; } else { if ($encounter_data['OSIOPTPN'] > '') { $OSIOP[$i]['IOP'] = $encounter_data['OSIOPTPN']; $OSIOP[$i]['method'] = "TPN"; } else { //we are ignoring finger tension for graphing purposes but include this should another form of IOP measurement arrive... //What about the Triggerfish contact lens continuous IOP device for example... } } if ($encounter_data['ODIOPTARGET'] > '') { $ODIOPTARGETS[$i] = $encounter_data['ODIOPTARGET']; } else { $query = "SELECT * FROM `list_options` WHERE `list_id` LIKE 'Eye_defaults_" . $providerID . "' and (option_id = 'ODIOPTARGET' OR option_id = 'OSIOPTARGET')"; $results = sqlQuery($query); while ($default_TARGETS = sqlFetchArray($result)) { if ($default_TARGETS['option_id'] == 'ODIOPTARGET') { $ODIOPTARGETS[$i] = $default_TARGETS["title"]; } if ($default_TARGETS['option_id'] == 'OSIOPTARGET') { $OSIOPTARGETS[$i] = $default_TARGETS["title"]; } } } if ($encounter_data['OSIOPTARGET'] > '') { $OSIOPTARGETS[$i] = $encounter_data['ODIOPTARGET']; } else { if (!$OSIOPTARGETS[$i] > '') { $query = "SELECT * FROM `list_options` WHERE `list_id` LIKE 'Eye_defaults_" . $providerID . "' and (option_id = 'ODIOPTARGET' OR option_id = 'OSIOPTARGET')"; $results = sqlQuery($query); while ($default_TARGETS = sqlFetchArray($result)) { if ($default_TARGETS['option_id'] == 'OSIOPTARGET') { $OSIOPTARGETS[$i] = $default_TARGETS["title"]; } } } } } //There are visits for testing only, no IOP. //We need to insert these dates into the arrays created above. //recreate them to include the testing only dates, placing null values for those dates if not done. //can't merge empty arrays $list = array(); $arrs[] = $OCT_date; $arrs[] = $VF_date; $arrs[] = $GONIO_date; $arrs[] = $VISITS_date; foreach ($arrs as $arr) { if (is_array($arr)) { $list = array_merge($list, $arr); } } $date_OU = array_unique($list); usort($date_OU, "cmp"); $times_OU = $time_OU; usort($times_OU, "cmp"); for ($a = 0; $a < count($date_OU); $a++) { foreach ($GONIO_date as $GONIO) { if ($date_OU[$a] == $GONIO) { $GONIO_values[$a] = "1"; break; } } if (!$GONIO_values[$a]) { $GONIO_values[$a] = ""; } if ($count_OCT > 0) { foreach ($OCT_date as $OCT) { if ($date_OU[$a] == $OCT) { $OCT_values[$a] = "1"; break; } } } if (!$OCT_values[$a]) { $OCT_values[$a] = ""; } if ($count_VF > 0) { foreach ($VF_date as $VF) { if ($date_OU[$a] == $VF) { $VF_values[$a] = "1"; break; } } } if (!$VF_values[$a]) { $VF_values[] = ""; } for ($k = 0; $k < count($VISITS_date); $k++) { if ($date_OU[$a] == $VISITS_date[$k]) { $OD_values[$a] = "'" . $ODIOP[$k]['IOP'] . "'"; $OD_methods[$a] = $ODIOP[$k]['method']; $OS_values[$a] = $OSIOP[$k]['IOP']; $OS_methods[$a] = $OSIOP[$k]['method']; $ODIOPTARGET_values[$a] = $ODIOPTARGETS[$k]; $OSIOPTARGET_values[$a] = $OSIOPTARGETS[$k]; break; } } if (!$OD_values[$a]) { $OD_values[$a] = ''; } if (!$OS_values[$a]) { $OS_values[$a] = ''; } if (!$OD_methods[$a]) { $OD_methods[$a] = ""; } if (!$OS_methods[$a]) { $OS_methods[$a] = ""; } if (!$ODIOPTARGET_values[$a]) { $ODIOPTARGET_values[$a] = ""; } if (!$OSIOPTARGET_values[$a]) { $OSIOPTARGET_values[$a] = ""; } } for ($a = 0; $a < count($times_OU); $a++) { for ($k = 0; $k < count($ODIOP); $k++) { if ($times_OU[$a] == $time_OU[$k]) { $OD_time_values[$a] = $ODIOP[$k]['IOP']; $OS_time_values[$a] = $OSIOP[$k]['IOP']; break; } } if (!$OD_time_values[$a]) { $OD_time_values[$a] = ""; } if (!$OS_time_values[$a]) { $OS_time_values[$a] = ""; } } $dates_OU = "'" . implode("','", $date_OU) . "'"; $OD_values = implode(",", $OD_values); $OS_values = implode(",", $OS_values); $OCT_values = "'" . implode("','", $OCT_values) . "'"; $VF_values = "'" . implode("','", $VF_values) . "'"; $GONIO_values = "'" . implode("','", $GONIO_values) . "'"; $IOPTARGET_values = implode(",", $ODIOPTARGET_values); $times_OU = "'" . implode("','", $times_OU) . "'"; $OD_time_values = "'" . implode("','", $OD_time_values) . "'"; $OS_time_values = "'" . implode("','", $OS_time_values) . "'"; ?> <b> <?php echo xlt('Glaucoma Zone'); ?> :</b> <br /><br /> <span class="closeButton fa fa-close" id="Close_IOP" name="Close_IOP"></span> <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%;"> <table class="GFS_table"> <tr > <td colspan="1" class="GFS_title_1" style="padding-bottom:3px;border:none;" nowrap><?php echo xlt('Current Target'); ?> : <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> <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($OSIOPTARGET); ?> " /></td> </tr> <tr> <td colspan="3" class="hideme nodisplay"> TARGET IOP HISTORY </td> </tr> <?php //what active meds have a subtype eye? $i = 0; $count_Meds = count($PMSFH[0]['Medication']); if ($count_Meds > '0') { foreach ($PMSFH[0]['Medication'] as $drug) { if ($drug['row_subtype'] == "eye" && $drug['enddate'] !== "") { $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']) . "'\n onclick=\"alter_issue2('" . attr(addslashes($drug['rowid'])) . "','Medication','{$i}');\">" . text($drug['title']) . "</span></td>\n <td class='GFS_td'>" . oeFormatShortDate($drug['begdate']) . "</td></tr>"; } else { if ($drug['row_subtype'] == "eye" && $drug['enddate'] > "" && strtotime($drug['enddate']) < strtotime($visit_date)) { //what meds have a subtype eye that are discontinued? $hideme = "hideme_drugs nodisplay"; $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']) . "'\n onclick=\"alter_issue2('" . attr(addslashes($drug['rowid'])) . "','Medication','{$i}');\">" . text($drug['title']) . "</span></td>\n <td class='GFS_td'>" . oeFormatShortDate($drug['begdate']) . "</td><td class='GFS_td'>" . oeFormatShortDate($drug['enddate']) . "</td></tr>"; } } $i++; } if (!$current_drugs) { $current_drugs = "<tr><td colspan='3' class='GFS_td_1' style='text-align:center;'>" . xlt('None documented') . "</td></tr>"; $no_drugs = '1'; } foreach ($PMSFH[0]['Medication'] as $drug) { if ($drug['row_subtype'] == "eye" && $drug['enddate'] > "") { $FAILED_drug .= "<li>" . text($drug['title']) . "</li>"; } } } ?> <tr class="GFS_tr"> <td colspan="2" class="GFS_title"><?php echo xlt('Current Eye Meds'); ?> :</td> <?php $no_drugs ? $meds_here = '' : ($meds_here = xlt('Start')); ?> <td class="GFS_title" style="text-align:center;"><?php echo $meds_here; ?> </td> <?php if ($FAILED_drugs) { echo '<td><span class="right toggleme" id="toggle_drugs"><i class="fa fa-toggle-down"></i></span></td>'; } ?> </tr> <?php echo $current_drugs; if ($FAILED_drugs) { 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>'; } echo $FAILED_drugs; //start VF section if ($count_VF > '0') { //need to decide how many to show on open, and hide the rest? For now the first only. $count = 0; foreach ($documents['docs_in_name']['VF'] as $VF) { if ($count < 1) { $current_VF = '<tr><td colspan="3" class="GFS_td_1 blue"><a href="../../forms/' . $form_folder . '/php/Anything_simple.php?display=i&category_id=' . attr($VF['parent']) . '&encounter=' . $encounter . '&category_name=VF" ' . 'onclick="return dopopup(\'../../forms/' . $form_folder . '/php/Anything_simple.php?display=i&category_id=' . attr($VF['parent']) . '&encounter=' . $encounter . '&category_name=VF"> ' . $VF['encounter_date'] . ' <img src="../../forms/' . $form_folder . '/images/jpg.png" class="little_image" style="width:15px; height:15px;" /></a></td></tr>'; } else { $old_VFs .= '<tr><td colspan="3" class="GFS_td_1 hideme_VFs nodisplay""><a href="../../forms/' . $form_folder . '/php/Anything_simple.php?display=i&category_id=' . attr($VF['parent']) . '&encounter=' . $encounter . '&category_name=VF" ' . 'onclick="return dopopup(\'../../forms/' . $form_folder . '/php/Anything_simple.php?display=i&category_id=' . attr($VF['parent']) . '&encounter=' . $encounter . '&category_name=VF"> ' . $VF['encounter_date'] . ' <img src="../../forms/' . $form_folder . '/images/jpg.png" class="little_image" style="width:15px; height:15px;" /></a></td></tr>'; } $count++; } } else { $current_VF = "<tr><td colspan='3' class='GFS_td_1' style='text-align:center;'>" . xlt('Not documented') . "</td></tr>"; } ?> <tr class="GFS_tr"> <td colspan="3" class="GFS_title"><?php echo xlt('Visual Fields'); ?> : <?php if ($old_VFs) { echo '<td><span class="top right" id="toggle_VFs"><i class="fa fa-toggle-down"></i></span></td>'; } ?> </tr> <?php echo $current_VF . $old_VFs; //end VF section //start Optic Nerve section ?> <tr> <td colspan="3" class="GFS_title"><?php echo xlt('Optic Nerve Analysis'); ?> : <?php if ($count_OCT > '0') { //need to decide how many to show on open, and hide the rest? For now show first, hide rest. $count = 0; foreach ($documents['docs_in_name']['OCT'] as $OCT) { //get encounter date from encounter id if ($count < 1) { $current_OCT = '<tr><td colspan="3" class="GFS_td_1"><a href="../../forms/' . $form_folder . '/php/Anything_simple.php?display=i&category_id=' . attr($OCT['parent']) . '&encounter=' . $encounter . '&category_name=OCT" ' . 'onclick="return dopopup(\'../../forms/' . $form_folder . '/php/Anything_simple.php?display=i&category_id=' . attr($OCT['parent']) . '&encounter=' . $encounter . '&category_name=OCT"> ' . $OCT['encounter_date'] . ' <img src="../../forms/' . $form_folder . '/images/jpg.png" class="little_image" style="width:15px; height:15px;" /></a></td></tr>'; } else { $old_OCTs .= '<tr><td class="hideme_OCTs nodisplay GFS_td_1" colspan="3"><a href="../../forms/' . $form_folder . '/php/Anything_simple.php?display=i&category_id=' . attr($OCT['parent']) . '&encounter=' . $encounter . '&category_name=OCT" ' . 'onclick="return dopopup(\'../../forms/' . $form_folder . '/php/Anything_simple.php?display=i&category_id=' . attr($OCT['parent']) . '&encounter=' . $encounter . '&category_name=OCT"> ' . $OCT['encounter_date'] . ' <img src="../../forms/' . $form_folder . '/images/jpg.png" class="little_image" style="width:15px; height:15px;" /></a></td></tr>'; } $count++; } } else { $current_OCT = "<tr><td colspan='3' class='GFS_td_1' style='text-align:center;'>" . xlt('Not documented') . "</td></tr>"; } if ($old_OCTs) { echo '<td><span class="top right " id="toggle_OCTs"><i class="fa fa-toggle-down"></i></span></td>'; } echo "</tr>"; echo $current_OCT . $old_OCTs; $count = 0; $hideme = ''; foreach ($priors as $visit) { if ($visit['ODGONIO'] > " " || $visit['OSGONIO'] > " ") { // something is here if ($count > 0) { $hideme = "hideme_gonios nodisplay"; } // show the first only, hide the rest for now $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>"; $GONIO_chart .= '"1",'; $count++; } else { $GONIO_chart .= ','; } } $GONIO = chop($GONIO, ","); if ($count == 0) { $gonios = "<tr><td colspan='3' class='GFS_td_1' style='text-align:center;'>" . xlt('Not documented') . "</td></tr>"; } ?> <tr> <td class="GFS_title_1" id="GFS_gonios" name="GFS_gonios" style="position:relative;"><?php echo xlt('Gonioscopy'); ?> :</td> <?php if ($count > '0') { echo "<td class='GFS_title center'>" . xlt('OD{{right eye}}') . "</td><td class='GFS_title center'>" . xlt('OS{{left eye}}') . "</td>"; } else { echo "<td class='GFS_title center'></td><td class='GFS_title center'></td>"; } if ($hideme) { echo '<td><span class="top right" id="toggle_gonios"><i class="fa fa-toggle-down"></i></span></td>'; } ?> </tr> <?php echo $gonios; $count = '0'; $hideme = ''; foreach ($priors as $visit) { if ($visit['ODCUP'] > "" || $visit['OSCUP'] > "") { if ($count > 0) { $hideme = "hideme_cups nodisplay"; } $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>"; $DISCS_chart .= '"1",'; $count++; } else { $DISCS_chart .= '"",'; } } $DISCS_chart = chop($DISCS_chart, ","); if ($count == 0) { $cups = "<tr><td colspan='3' class='GFS_td_1' style='text-align:center;'>" . xlt('Not documented') . "</td></tr>"; } ?> <tr> <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'); ?> : <?php if ($hideme) { $plus = '<td><span class="top right" id="toggle_cups"><i class="fa fa-toggle-down"></i></span></td>'; } if ($count > '0') { echo "<td class='GFS_title center'>" . xlt('OD{{right eye}}') . "</td><td class='GFS_title center'>" . xlt('OS{{left eye}}') . "</td>" . $plus; } else { echo "<td class='GFS_title center'></td><td class='GFS_title center'></td>"; } ?> </tr> <?php echo $cups; ?> </table> </div> <script src="<?php echo $GLOBALS['assets_static_relative']; ?> /Chart.js-2-1-3/dist/Chart.bundle.min.js"></script> <div style="position:relative;float:right; margin: 0px 5px;text-align:center;width:60%;"> <?php if ($priors) { if ($bywhat == 'byday') { //$bywhat='byday' $class_1 = "nodisplay"; $class_2 = ""; } else { $class_2 = "nodisplay"; $class_1 = ""; } ?> <canvas id="canvas_byday" class="<?php echo $class_2; ?> "></canvas> <canvas id="canvas_byhour" class="<?php echo $class_1; ?> "></canvas> <button id="dailyData" class="<?php echo $class_1; ?> " style="background: #063f80;"><?php echo xlt('Show IOP by Date'); ?> </button> <button id="hourlyData" class="<?php echo $class_2; ?> " style="background: #063f80;"><?php echo xlt('Show IOP by Time'); ?> </button> <script> /** * Below is the Chart.js code to render IOP by day and IOP by time * */ var visit_date = '<?php echo attr($dated); ?> '; var dateFormat = 'YYYY-MM-DD'; var timeFormat = 'HH tt'; var customTooltips = function(tooltip) { // Tooltip Element var tooltipEl = $('#chartjs-tooltip'); if (!tooltipEl[0]) { $('body').append('<div id="chartjs-tooltip"></div>'); tooltipEl = $('#chartjs-tooltip'); } // Hide if no tooltip if (!tooltip.opacity) { tooltipEl.css({ opacity: 0.3 }); $('.chartjs-wrap canvas') .each(function(index, el) { $(el).css('cursor', 'default'); }); return; } $(this._chart.canvas).css('cursor', 'pointer'); // Set caret Position tooltipEl.removeClass('above below no-transform'); if (tooltip.yAlign) { tooltipEl.addClass(tooltip.yAlign); } else { tooltipEl.addClass('no-transform'); } // Set Text if (tooltip.body) { var innerHtml = [ (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 || []) .join('\n'), (tooltip.footer || []).join('\n'), (tooltip.afterFooter || []).join('\n') ]; tooltipEl.html(innerHtml.join('\n')); } // Find Y Location on page var top = 0; if (tooltip.yAlign) { if (tooltip.yAlign == 'above') { top = tooltip.y - tooltip.caretHeight - tooltip.caretPadding; } else { top = tooltip.y + tooltip.caretHeight + tooltip.caretPadding; } } var position = $(this._chart.canvas)[0].getBoundingClientRect(); // Display, position, and set styles for font tooltipEl.css({ opacity: 0.5, width: tooltip.width ? (tooltip.width + 'px') : 'auto', left: position.left + tooltip.x + 'px', top: position.top + top + 'px', fontFamily: tooltip._fontFamily, fontSize: tooltip.fontSize, fontStyle: tooltip._fontStyle, padding: tooltip.yPadding + 'px ' + tooltip.xPadding + 'px', }); }; var config_byhour = { type: 'line', data: { labels: [<?php echo $times_OU; ?> ], datasets: [{ label: "OD", data: [<?php echo $OD_time_values; ?> ], fill: false, borderColor : "#44a3a7", backgroundColor : "#44a3a7", pointBorderColor : "#055d2b", pointBackgroundColor : "#44a3a7", pointBorderWidth : 3, lineTension: 0.3, borderCapStyle: 'butt', borderDashOffset: 0.0, borderJoinStyle: 'miter', pointHoverRadius: 5, pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 3 }, { label: 'OS', data: [<?php echo $OS_time_values; ?> ], fill: false, lineTension: 3, borderColor : "#000099", backgroundColor : "#000099", pointBorderColor : "black", pointBackgroundColor : "#000099", pointBorderWidth : 3, lineTension: 0.3, borderCapStyle: 'butt', borderJoinStyle: 'miter', pointHoverRadius: 5, pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 3, }] }, options: { responsive: true, animation: false, onAnimationComplete: function () { // prevents the update from triggering an infinite loop if (!this.clearCycle) { this.clearCycle = true; this.datasets.forEach(function (dataset) { dataset.points.forEach(function (point) { if (point.value === 0) { point.display = false; point.hasValue = function () { return false; } } }) }) this.update(); } else delete this.clearCycle; }, scaleShowHorizontalLines: true, title:{ display:true, text:'<?php echo xla("Intraocular Pressures") . " (" . xla("mmHg") . ") by Hour"; ?> ' }, tooltips: { mode: 'label' }, hover: { mode: 'dataset' }, scales: { xAxes: [{ type: "time", time: { format: "HH:mm", unit: 'hour', unitStepSize: 2, displayFormats: { 'minute': 'h:mm a', 'hour': 'h:mm a' }, tooltipFormat: 'h:mm a' }, scaleLabel: { display: true, labelString: 'Time' }, ticks: { suggestedMin: 4, suggestedMax: 24, } } ], yAxes: [{ type: "linear", display: true, position: "left", //id: "y-axis-2", gridLines:{ display: false }, labels: { show:true, }, scaleLabel: { display: true, labelString: 'IOP (mmHg)' }, ticks: { suggestedMin: 0, suggestedMax: 24, } }] } } }; $('#dailyData').click(function(event) { event.preventDefault(); $('#canvas_byday').removeClass('nodisplay'); $('#canvas_byhour').addClass('nodisplay'); $('#dailyData').addClass('nodisplay'); $('#hourlyData').removeClass('nodisplay'); $('#showTesting').addClass('nodisplay'); }); $('#hourlyData').click(function(event) { event.preventDefault(); $('#canvas_byhour').removeClass('nodisplay'); $('#canvas_byday').addClass('nodisplay'); $('#dailyData').removeClass('nodisplay'); $('#hourlyData').addClass('nodisplay'); $('#showTesting').removeClass('nodisplay'); }); var config_byday = { type: 'bar', data: { labels: [<?php echo $dates_OU; ?> ], datasets: [ { type: 'line', label: "Target", data: [<?php echo $IOPTARGET_values; ?> ], fill: false, borderColor : "#f28282", backgroundColor : "#f28282", pointBorderColor : "black", pointBackgroundColor : "#f28282", pointBorderWidth : 3, drugs: ["test1\ntimoptic","test2","test3"], yAxisID: 'y-axis-1', lineTension: 0.3, borderCapStyle: 'round', borderDash: [1,5], borderJoinStyle: 'miter', pointHoverRadius: 5, pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 3 },{ type: 'line', label: "OD", data: [<?php echo $OD_values; ?> ], fill: false, borderColor : "#44a3a7", backgroundColor : "#44a3a7", pointBorderColor : "#055d2b", pointBackgroundColor : "#44a3a7", pointBorderWidth : 3, yAxisID: 'y-axis-1', lineTension: 0.3, borderCapStyle: 'butt', borderDashOffset: 0.0, borderJoinStyle: 'miter', pointHoverRadius: 5, pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 3 }, { type: 'line', label: 'OS', data: [<?php echo $OS_values; ?> ], fill: false, lineTension: 3, borderColor : "#000099", backgroundColor : "#000099", pointBorderColor : "black", pointBackgroundColor : "#000099", pointBorderWidth : 3, yAxisID: 'y-axis-1', lineTension: 0.3, borderCapStyle: 'butt', borderJoinStyle: 'miter', pointHoverRadius: 5, pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 3, },{ type: 'bar', label: "VF", strokeColor: '#5CABFA', fillColor:"#5CABFA", data: [<?php echo $VF_values; ?> ], fill: false, backgroundColor: '#5CABFA', borderColor: '#000000', yAxisID: 'y-axis-2' },{ type: 'bar', label: "OCT", data: [<?php echo $OCT_values; ?> ],//0/null is not done, 1 if performed. fill: true, backgroundColor: '#71B37C', borderColor: '#000000', yAxisID: 'y-axis-2' },{ type: 'bar', label: "Gonio", data: [<?php echo $GONIO_values; ?> ], fill: false, strokeColor: 'rgba(209, 30, 93, 0.3)', fillColor:'rgba(209, 30, 93, 0.3)', backgroundColor: 'red', borderColor: '#000000', yAxisID: 'y-axis-2' }] }, options: { responsive: true, scaleShowHorizontalLines: true, title:{ display: true, text:'<?php echo xla("Intraocular Pressures (mmHg) by Date"); ?> ' }, tooltips: { enabled: true, //id: "tooltip-1", //backgroundColor: '#FCFFC5', //mode: 'label', enabled: true, shared: false, callbacks: { label: function(tooltipItem, data) { if (tooltipItem.yLabel =='0') { return data.datasets[tooltipItem.datasetIndex].label + " --- "; ; } else if (tooltipItem.yLabel =='1') { return data.datasets[tooltipItem.datasetIndex].label + " <?php echo xlt('performed'); ?> "; } else if (tooltipItem.yLabel > '1') { return data.datasets[tooltipItem.datasetIndex].label + ": "+tooltipItem.yLabel; } }, afterBody: function(tooltipItems, data) { //console.log(tooltipItems); //return data.datasets[2].drugs[tagme]; } } }, hover: { mode: 'label' }, scales: { xAxes: [{ type: "time", stacked:false, id: "x-axis-1", time: { format: dateFormat, round: 'day', tooltipFormat: 'll' }, categoryPercentage: 0.5, barPercentage:1.0, //categoryPercentage:0.3, scaleLabel: { display: true, labelString: 'Date' }, ticks: { suggestedMin: 3, suggestedMax: 6 } }, ], yAxes: [{ type: "linear", display: false, position: "right", id: "y-axis-2", stacked: false, gridLines:{ display: false }, labels: { show:true, }, scaleLabel: { display: false, labelString: 'Testing' }, ticks: { suggestedMin: 4, suggestedMax: 4 } }, { type: "linear", display: true, position: "left", id: "y-axis-1", gridLines:{ display: true }, labels: { show:true, }, scaleLabel: { display: true, labelString: 'IOP (mmHg)' }, ticks: { suggestedMin: 4, suggestedMax: 24, } }] } } }; var ctx1 = document.getElementById("canvas_byday").getContext("2d"); var ctx2 = document.getElementById("canvas_byhour").getContext("2d"); var myLine = new Chart.Bar(ctx1, config_byday); var myLine2 = new Chart(ctx2, config_byhour); </script> <?php } else { echo "<div style='text-align:left;padding-left:20px;'><h4>The Glaucoma Flow Sheet graphically displays:\n <ul>\n <li> IOP measurements</li>\n <li> Target IOPs </li>\n <li> related tests (OCT/VF/Gonio)</li>\n <li> diurnal IOP curve</li>\n </ul>\n The graphs are not generated on the initial visit...</h4></div>"; } ?> </div> </div> <?php }
$display = $_REQUEST['display']; $category_id = $_REQUEST['category_id']; $encounter = $_REQUEST['encounter']; $category_name = $_REQUEST['category_name']; $query = "SELECT * FROM patient_data where pid=?"; $pat_data = sqlQuery($query, array($pid)); $providerID = getProviderIdOfEncounter($encounter); $providerNAME = getProviderName($providerID); $query = "SELECT * FROM users where id = ?"; $prov_data = sqlQuery($query, array($providerID)); $query = "select form_encounter.date as encounter_date, form_eye_mag.* from form_eye_mag ,forms,form_encounter\n where \n form_encounter.encounter =? and \n form_encounter.encounter = forms.encounter and \n form_eye_mag.id=forms.form_id and\n forms.deleted != '1' and \n form_eye_mag.pid=? "; $encounter_data = sqlQuery($query, array($encounter, $pid)); $dated = new DateTime($encounter_data['encounter_date']); $dated = $dated->format('Y-m-d'); $visit_date = oeFormatShortDate($dated); list($documents) = document_engine($pid); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo xlt('Document Library'); ?> </title> <link rel="shortcut icon" href="<?php echo $GLOBALS['assets_static_relative']; ?> /AnythingSlider-1-9-4/demos/images/favicon.ico" type="image/x-icon"> <link rel="apple-touch-icon" href="<?php