From eb45d5af75130d97705e8c251f0f654ca8e5aea3 Mon Sep 17 00:00:00 2001 From: Robert Down RN Date: Thu, 10 Aug 2023 21:47:59 -0400 Subject: [PATCH] feat: Issues UI makeover (#6667) Improved user interface to the issues page --- interface/patient_file/summary/stats_full.php | 910 +++++++++++++------------- 1 file changed, 457 insertions(+), 453 deletions(-) rewrite interface/patient_file/summary/stats_full.php (68%) diff --git a/interface/patient_file/summary/stats_full.php b/interface/patient_file/summary/stats_full.php dissimilarity index 68% index ec11b2e02..0224c00b2 100644 --- a/interface/patient_file/summary/stats_full.php +++ b/interface/patient_file/summary/stats_full.php @@ -1,453 +1,457 @@ - - * @author Brady Miller - * @copyright Copyright (c) 2005-2017 Rod Roark - * @copyright Copyright (c) 2018 Brady Miller - * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 - */ - -require_once('../../globals.php'); -require_once($GLOBALS['srcdir'] . '/lists.inc.php'); -require_once($GLOBALS['fileroot'] . '/custom/code_types.inc.php'); -require_once($GLOBALS['srcdir'] . '/options.inc.php'); - -use OpenEMR\Common\Acl\AclMain; -use OpenEMR\Common\Csrf\CsrfUtils; -use OpenEMR\Common\Twig\TwigContainer; -use OpenEMR\Core\Header; -use OpenEMR\Menu\PatientMenuRole; -use OpenEMR\OeUI\OemrUI; - -// Check if user has permission for any issue type. -$auth = false; -foreach ($ISSUE_TYPES as $type => $dummy) { - if (AclMain::aclCheckIssue($type)) { - $auth = true; - break; - } -} - -if ($auth) { - $tmp = getPatientData($pid, "squad"); - if ($tmp['squad'] && ! AclMain::aclCheckCore('squads', $tmp['squad'])) { - die(xlt('Not authorized')); - } -} else { - echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Patient Issues")]); - exit; -} - - // Collect parameter(s) - $category = empty($_REQUEST['category']) ? '' : $_REQUEST['category']; - -// Get patient's preferred language for the patient education URL. -$tmp = getPatientData($pid, 'language'); -$language = $tmp['language']; -?> - - - - - - -<?php echo xlt('Patient Issues'); ?> - - - - xl('Medical Issues'), - 'include_patient_name' => true, - 'expandable' => true, - 'expandable_files' => array("stats_full_patient_xpd", "external_data_patient_xpd", "patient_ledger_patient_xpd"),//all file names need suffix _xpd - 'action' => "",//conceal, reveal, search, reset, link or back - 'action_title' => "", - 'action_href' => "",//only for actions - reset, link or back - 'show_help_icon' => true, - 'help_file_name' => "issues_dashboard_help.php" -); -$oemr_ui = new OemrUI($arrOeUiSettings); -?> - - - - - -
-
-
- -
-
- displayHorizNavBarMenu(); - ?> - -
-
-
- - - $focustitles) { - if (!AclMain::aclCheckIssue($focustype)) { - continue; - } - - if ($category) { - // Only show this category - if ($focustype != $category) { - continue; - } - } - - if ($first) { - $first = 0; - } else { - echo "
"; - } - - // Show header - $disptype = $focustitles[0]; - echo "
" . text($disptype) . "\n"; - - if (AclMain::aclCheckIssue($focustype, '', array('write', 'addonly'))) { - if (($focustype == 'allergy' || $focustype == 'medication') && $GLOBALS['erx_enable']) { - echo "" . - xlt('Add') . "\n"; - } else { - echo "" . xlt('Add') . "\n"; - } - } - - $canDelete = AclMain::aclCheckCore('admin', 'super'); - if ($canDelete) { - echo "\n"; - } - - echo "
"; - - $canSelect = $canDelete; - - echo "
"; - ?> - - - - - - - - - - - - - - - - - - - - - - - - "; - } else { - // Data entry has not happened to this type, so can show the none selection option. - echo ""; - } - } - - // display issues - while ($row = sqlFetchArray($pres)) { - $rowid = $row['id']; - - $disptitle = trim($row['title']) ? $row['title'] : "[Missing Title]"; - - $ierow = sqlQuery("SELECT count(*) AS count FROM issue_encounter WHERE " . - "list_id = ?", array($rowid)); - - // encount is used to toggle the color of the table-row output below - ++$encount; - $bgclass = (($encount & 1) ? "bg1" : "bg2"); - - $colorstyle = empty($row['enddate']) ? "style='color: var(--danger)'" : ""; - - // look up the diag codes - $codetext = ""; - if ($row['diagnosis'] != "") { - $diags = explode(";", $row['diagnosis']); - foreach ($diags as $diag) { - $codedesc = lookup_code_descriptions($diag); - list($codetype, $code) = explode(':', $diag); - if ($codetext) { - $codetext .= "
"; - } - - $codetext .= "" . - text($diag . " (" . $codedesc . ")") . ""; - } - } - - // calculate the status - if ($row['outcome'] == "1" && $row['enddate'] != null) { - // Resolved - $statusCompute = generate_display_field(array('data_type' => '1','list_id' => 'outcome'), $row['outcome']); - } elseif ($row['enddate'] == null) { - $statusCompute = xlt("Active"); - } else { - if ($focustype == 'medical_problem') { - // MU3 criteria, show medical problem's with end dates as a status of Completed. - $statusCompute = xlt("Completed"); - } else { - $statusCompute = xlt("Inactive"); - } - } - - $click_class = 'statrow'; - if ($row['erx_source'] == 1 && $focustype == 'allergy') { - $click_class = ''; - } elseif ($row['erx_uploaded'] == 1 && $focustype == 'medication') { - $click_class = ''; - } - - echo " \n"; - if ($canSelect) { - echo " \n"; - } - echo " \n"; - echo " \n"; - echo " \n"; - // both codetext and statusCompute have already been escaped above with htmlspecialchars) - echo " \n"; - echo " \n"; - echo " \n"; - if ($focustype == "allergy") { - echo " \n"; - } - if ($focustype == "allergy" || $focustype == "medical_problem") { - $codeListName = (!empty($thistype) && ($thistype == 'medical_problem')) ? 'condition-verification' : 'allergyintolerance-verification'; - echo " \n"; - } - echo " \n"; - echo " \n"; - echo " \n"; - echo " "; - echo " \n"; - } - } - - echo "
- -
" . xlt("None{{Issue}}") . "
" . xlt("None{{Issue}}") . "
" . text($disptitle) . "" . text(trim(oeFormatDateTime($row['begdate']))) . " " . text(trim(oeFormatDateTime($row['enddate']))) . " " . $codetext . "" . $statusCompute . " "; - echo generate_display_field(array('data_type' => '1','list_id' => 'occurrence'), $row['occurrence']); - echo ""; - echo generate_display_field(array('data_type' => '1','list_id' => 'reaction'), $row['reaction']); - echo ""; - echo generate_display_field(array('data_type' => '1','list_id' => $codeListName), $row['verification']); - echo "" . text($row['referredby']) . "" . text(oeFormatDateTime($row['modifydate'])) . "" . text($row['comments']) . ""; - echo " "; - echo "
"; - ?> - -
-
-
-
- oeBelowContainerDiv();?> - - - - - - - + + * @author Brady Miller + * @copyright Copyright (c) 2005-2017 Rod Roark + * @copyright Copyright (c) 2018 Brady Miller + * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 + */ + +require_once('../../globals.php'); +require_once($GLOBALS['srcdir'] . '/lists.inc.php'); +require_once($GLOBALS['fileroot'] . '/custom/code_types.inc.php'); +require_once($GLOBALS['srcdir'] . '/options.inc.php'); + +use OpenEMR\Common\Acl\AclMain; +use OpenEMR\Common\Csrf\CsrfUtils; +use OpenEMR\Common\Twig\TwigContainer; +use OpenEMR\Core\Header; +use OpenEMR\Menu\PatientMenuRole; +use OpenEMR\OeUI\OemrUI; +use OpenEMR\Services\ListService; + +// Check if user has permission for any issue type. +$auth = false; +foreach ($ISSUE_TYPES as $type => $dummy) { + if (AclMain::aclCheckIssue($type)) { + $auth = true; + break; + } +} + +if ($auth) { + $tmp = getPatientData($pid, "squad"); + if ($tmp['squad'] && ! AclMain::aclCheckCore('squads', $tmp['squad'])) { + die(xlt('Not authorized')); + } +} else { + echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Patient Issues")]); + exit; +} + + // Collect parameter(s) + $category = empty($_REQUEST['category']) ? '' : $_REQUEST['category']; + +// Get patient's preferred language for the patient education URL. +$tmp = getPatientData($pid, 'language'); +$language = $tmp['language']; +?> + + + +<?php echo xlt('Patient Issues'); ?> + + + xl('Medical Issues'), + 'include_patient_name' => true, + 'expandable' => true, + 'expandable_files' => array("stats_full_patient_xpd", "external_data_patient_xpd", "patient_ledger_patient_xpd"),//all file names need suffix _xpd + 'action' => "",//conceal, reveal, search, reset, link or back + 'action_title' => "", + 'action_href' => "",//only for actions - reset, link or back + 'show_help_icon' => true, + 'help_file_name' => "issues_dashboard_help.php" +); +$oemr_ui = new OemrUI($arrOeUiSettings); +?> + + + + + +
+
+
+ +
+
+ displayHorizNavBarMenu(); + ?> + +
+
+ $focustitles) : ?> + '../../eRx.php?page=medentry', + 'onclick' => 'top.restoreSession()', + ]; + } else { + $btnAdd = [ + 'href' => '#', + 'onclick' => 'dopclick(0, ' . attr_js($t) . ')' + ]; + } + } + + $condition = ($GLOBALS['erx_enable'] && $GLOBALS['erx_medication_display'] && $focustype == 'medication') ? "AND erx_uploaded != '1'" : ''; + $pres = sqlStatement("SELECT * FROM lists WHERE pid = ? AND type = ? $condition ORDER BY begdate", [$pid, $t]); + $noIssues = false; + $nothingRecorded = false; + + // if no issues (will place a 'None' text vs. toggle algorithm here) + if (sqlNumRows($pres) < 1) { + if (getListTouch($pid, $focustype)) { + // Data entry has happened to this type, so can display an explicit None. + $noIssues = true; + } else { + // Data entry has not happened to this type, so can show the none selection option. + $nothingRecorded = true; + } + } + + ?> +
+
+ + + + +

+
+ +
+ + + '>  + + + +
+
+
+ +
+ +
+
+ type="checkbox" name="" id=""> + +
+
+ + + "; + } + + $codetext .= "" . + text($diag . " (" . $codedesc . ")") . ""; + } + } + + // calculate the status + $resolved = false; + if ($row['outcome'] == "1" && $row['enddate'] != null) { + // Resolved + $resolved = true; + $statusCompute = generate_display_field(array('data_type' => '1','list_id' => 'outcome'), $row['outcome']); + } elseif ($row['enddate'] == null) { + $statusCompute = xlt("Active"); + } else { + // MU3 criteria, show medical problem's with end dates as a status of Completed. + $statusCompute = ($t == 'medical_problem') ? xlt("Completed") : xlt("Inactive"); + $resolved = ($t == "medical_problems") ? true : false; + } + + $click_class = 'statrow'; + if ($row['erx_source'] == 1 && $focustype == 'allergy') { + $click_class = ''; + } elseif ($row['erx_uploaded'] == 1 && $focustype == 'medication') { + $click_class = ''; + } + + $shortBegDate = trim(oeFormatShortDate($row['begdate'])); + $shortEndDate = trim(oeFormatShortDate($row['enddate'])); + $fullBegDate = trim(oeFormatDateTime($row['begdate'])); + $fullEndDate = trim(oeFormatDateTime($row['enddate'])); + $shortModDate = trim(oeFormatShortDate($row['modifydate'])); + $fullModDate = trim(oeFormatDateTime($row['modifydate'])); + + $outcome = ($row['outcome']) ? generate_display_field(['data_type' => 1, 'list_id' => 'outcome'], $row['outcome']) : false; + ?> +
+
+ + + +
+
+ + +
+ "> + +  () + '1','list_id' => 'reaction'), $row['reaction']); + endif; + ?> +
+ getListOption('severity_ccda', $row['severity_al']); + $hgl = (in_array($row['severity_al'], ['severe', 'life_threatening_severity', 'fatal'])) ? 'bg-warning font-weight-bold px-1' : ''; + ?> + + + + +
+ + '1', 'list_id' => 'occurrence'], $row['occurrence']); ?> +
+
+
+
+
+
+
+
+
+ +
+
+
+
+ + +
+
+
+
+ + +
+
+
+ '1','list_id' => $codeListName), $row['verification']); + ?> +
+
+ + +
+
+
+
+ + +
+
+
+
+ +
+
+ +
+
+
+
+ +
+ +
+
+
+ oeBelowContainerDiv();?> + + + -- 2.11.4.GIT