From 8fcf191b91ef92b809ea55c5b016692d49d66b4f Mon Sep 17 00:00:00 2001 From: juggernautsei Date: Sun, 5 May 2024 19:50:13 -0400 Subject: [PATCH] Hide dashboard card 2 --- .../help_files/medical_dashboard_help.php | 2 + .../patient_file/summary/demographics.php | 43 +++++++++++++------ interface/super/edit_globals.php | 32 ++++++++++++++ library/globals.inc.php | 7 ++- src/Services/Globals/GlobalSetting.php | 3 ++ 5 files changed, 74 insertions(+), 13 deletions(-) diff --git a/Documentation/help_files/medical_dashboard_help.php b/Documentation/help_files/medical_dashboard_help.php index 0a869a37157..17801bf6d04 100644 --- a/Documentation/help_files/medical_dashboard_help.php +++ b/Documentation/help_files/medical_dashboard_help.php @@ -166,6 +166,8 @@

.

+

+

.

.

diff --git a/interface/patient_file/summary/demographics.php b/interface/patient_file/summary/demographics.php index ae2b0229d1e..20c21975bb2 100644 --- a/interface/patient_file/summary/demographics.php +++ b/interface/patient_file/summary/demographics.php @@ -55,9 +55,6 @@ use OpenEMR\Services\PatientIssuesService; use OpenEMR\Services\PatientService; use Symfony\Component\EventDispatcher\EventDispatcher; -use OpenEMR\Patient\Cards\InsuranceViewCard; -use OpenEMR\Patient\Cards\BillingViewCard; -use OpenEMR\Patient\Cards\DemographicsViewCard; $twig = new TwigContainer(null, $GLOBALS['kernel']); @@ -79,6 +76,7 @@ // want smart support in their system. $smartLaunchController = new SMARTLaunchController($GLOBALS["kernel"]->getEventDispatcher()); $smartLaunchController->registerContextEvents(); +$hiddenCards = getHiddenDashboardCards(); /** * @var EventDispatcher @@ -121,6 +119,17 @@ $insurance_array = array('primary', 'secondary', 'tertiary'); } +function getHiddenDashboardCards(): array +{ + $hiddenList = []; + $ret = sqlStatement("SELECT gl_value FROM `globals` WHERE `gl_name` = 'hide_dashboard_cards'"); + while ($row = sqlFetchArray($ret)) { + $hiddenList[] = $row['gl_value']; + } + + return $hiddenList; +} + function print_as_money($money) { preg_match("/(\d*)\.?(\d*)/", $money, $moneymatches); @@ -1038,9 +1047,9 @@ function setMyPatient() { getTwig(); - $allergy = (AclMain::aclCheckIssue('allergy')) ? 1 : 0; - $pl = (AclMain::aclCheckIssue('medical_problem')) ? 1 : 0; - $meds = (AclMain::aclCheckIssue('medication')) ? 1 : 0; + $allergy = (AclMain::aclCheckIssue('allergy') ? 1 : 0) && !in_array('card_allergies', $hiddenCards) ? 1 : 0; + $pl = (AclMain::aclCheckIssue('medical_problem') ? 1 : 0) && !in_array('card_medicalproblems', $hiddenCards) ? 1 : 0; + $meds = (AclMain::aclCheckIssue('medication') ? 1 : 0) && !in_array('card_medication', $hiddenCards) ? 1 : 0; $rx = (!$GLOBALS['disable_prescriptions'] && AclMain::aclCheckCore('patients', 'rx')) ? 1 : 0; $cards = max(1, ($allergy + $pl + $meds)); $col = "p-1 "; @@ -1189,7 +1198,7 @@ function filterActiveIssues(array $i): array ob_end_clean(); echo "
"; - echo $t->render('patient/card/rx.html.twig', $viewArgs); + echo $t->render('patient/card/rx.html.twig', $viewArgs); // render core prescription card echo "
"; endif; ?> @@ -1276,7 +1285,9 @@ function filterActiveIssues(array $i): array 'prependedInjection' => $dispatchResult->getPrependedInjection(), 'appendedInjection' => $dispatchResult->getAppendedInjection(), ]; - echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs); + if (!in_array('card_patientreminders', $hiddenCards)) { + echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs); + } endif; //end if prw is activated if (AclMain::aclCheckCore('patients', 'disclosure')) : @@ -1297,7 +1308,9 @@ function filterActiveIssues(array $i): array 'prependedInjection' => $dispatchResult->getPrependedInjection(), 'appendedInjection' => $dispatchResult->getAppendedInjection(), ]; - echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs); + if (!in_array('card_disclosure', $hiddenCards)) { + echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs); + } endif; // end if disclosures authorized if ($GLOBALS['amendments'] && AclMain::aclCheckCore('patients', 'amendment')) : @@ -1325,7 +1338,9 @@ function filterActiveIssues(array $i): array 'prependedInjection' => $dispatchResult->getPrependedInjection(), 'appendedInjection' => $dispatchResult->getAppendedInjection(), ]; - echo $twig->getTwig()->render('patient/card/amendments.html.twig', $viewArgs); + if (!in_array('card_amendments', $hiddenCards)) { + echo $twig->getTwig()->render('patient/card/amendments.html.twig', $viewArgs); + } endif; // end amendments authorized if (AclMain::aclCheckCore('patients', 'lab')) : @@ -1353,7 +1368,9 @@ function filterActiveIssues(array $i): array 'prependedInjection' => $dispatchResult->getPrependedInjection(), 'appendedInjection' => $dispatchResult->getAppendedInjection(), ]; - echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs); + if (!in_array('card_lab', $hiddenCards)) { + echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs); + } endif; // end labs authorized if ($vitals_is_registered && AclMain::aclCheckCore('patients', 'med')) : @@ -1376,7 +1393,9 @@ function filterActiveIssues(array $i): array 'prependedInjection' => $dispatchResult->getPrependedInjection(), 'appendedInjection' => $dispatchResult->getAppendedInjection(), ]; - echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs); + if (!in_array('card_vitals', $hiddenCards)) { + echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs); + } endif; // end vitals // if anyone wants to render anything after the patient demographic list diff --git a/interface/super/edit_globals.php b/interface/super/edit_globals.php index e61a5476519..7fa928bd852 100644 --- a/interface/super/edit_globals.php +++ b/interface/super/edit_globals.php @@ -645,6 +645,38 @@ function checkBackgroundServices() echo "\n"; } echo " \n"; + } elseif ($fldtype == GlobalSetting::DATA_TYPE_MULTI_DASHBOARD_CARDS) { + $hiddenList = []; + $ret = sqlStatement("SELECT gl_value FROM `globals` WHERE `gl_name` = 'hide_dashboard_cards'"); + while ($row = sqlFetchArray($ret)) { + $hiddenList[] = $row['gl_value']; + } + // The list of cards to hide. For now add to array new cards. + $res = array( + ['card_abrev' => '', 'card_name' => xlt('None or Reset')], + ['card_abrev' => attr('card_allergies'), 'card_name' => xlt('Allergies')], + ['card_abrev' => attr('card_amendments'), 'card_name' => xlt('Amendments')], + ['card_abrev' => attr('card_disclosure'), 'card_name' => xlt('Disclosures')], + ['card_abrev' => attr('card_lab'), 'card_name' => xlt('Labs')], + ['card_abrev' => attr('card_medicalproblems'), 'card_name' => xlt('Medical Problems')], + ['card_abrev' => attr('card_medication'), 'card_name' => xlt('Medications')], + //['card_abrev' => 'card_rx', 'card_name' => 'Prescriptions'], // For now don't hide because can be disabled as feature. + ['card_abrev' => attr('card_vitals'), 'card_name' => xlt('Vitals')] + ); + echo " \n"; } elseif ($fldtype == GlobalSetting::DATA_TYPE_COLOR_CODE) { if ($userMode) { $globalTitle = $globalValue; diff --git a/library/globals.inc.php b/library/globals.inc.php index dc3788a16fa..c9cf54aea73 100644 --- a/library/globals.inc.php +++ b/library/globals.inc.php @@ -191,7 +191,12 @@ function gblTimeZones() 'style_light.css', xl('Pick a general theme (need to logout/login after changing this setting).') ), - + 'hide_dashboard_cards' => array( + xl('Hide selected cards on patient dashboard'), + 'm_dashboard_cards', + '', + xl('Multi (Shift or CTRL) Select the cards you want to hide on the patient dashboard.') + ), 'window_title_add_patient_name' => array( xl('Add Patient Name To Window Title'), 'bool', // data type diff --git a/src/Services/Globals/GlobalSetting.php b/src/Services/Globals/GlobalSetting.php index c270ebec4a7..71f50508c0e 100644 --- a/src/Services/Globals/GlobalSetting.php +++ b/src/Services/Globals/GlobalSetting.php @@ -42,6 +42,9 @@ class GlobalSetting // multiple select language selector const DATA_TYPE_MULTI_LANGUAGE_SELECT = "m_lang"; + // multiple select dashboard cards + const DATA_TYPE_MULTI_DASHBOARD_CARDS = "m_dashboard_cards"; + // list of default visits in OpenEMR const DATA_TYPE_DEFAULT_VISIT_CATEGORY = "default_visit_category"; // CSS Theme selector