Skip to content

Commit

Permalink
Hide dashboard card 2 (#7423)
Browse files Browse the repository at this point in the history
  • Loading branch information
juggernautsei committed May 6, 2024
1 parent 842ffbe commit 6e94bfb
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 13 deletions.
2 changes: 2 additions & 0 deletions Documentation/help_files/medical_dashboard_help.php
Expand Up @@ -166,6 +166,8 @@

<p><?php echo xlt("These items can be edited if the user has sufficient privilege");?>.</p>

<p><?php echo xlt("Some of these data sections can be turned off if not being utilized by the clinic. Go to Admin, Config, Appearance to hide the cards to streamline the dashboard"); ?></p>

<p><?php echo xlt("Billing - provides a summary of the balances - Patient Balance Due, Insurance Balance Due, Total Balance Due and lists the name of the Primary Insurance along with its effective date");?>.</p>

<p><?php echo xlt("Demographics - patient demographics and insurance information");?>.</p>
Expand Down
43 changes: 31 additions & 12 deletions interface/patient_file/summary/demographics.php
Expand Up @@ -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']);

Expand All @@ -79,6 +76,7 @@
// want smart support in their system.
$smartLaunchController = new SMARTLaunchController($GLOBALS["kernel"]->getEventDispatcher());
$smartLaunchController->registerContextEvents();
$hiddenCards = getHiddenDashboardCards();

/**
* @var EventDispatcher
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1038,9 +1047,9 @@ function setMyPatient() {
<?php
$t = $twig->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 ";
Expand Down Expand Up @@ -1189,7 +1198,7 @@ function filterActiveIssues(array $i): array
ob_end_clean();

echo "<div class=\"col\">";
echo $t->render('patient/card/rx.html.twig', $viewArgs);
echo $t->render('patient/card/rx.html.twig', $viewArgs); // render core prescription card
echo "</div>";
endif;
?>
Expand Down Expand Up @@ -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')) :
Expand All @@ -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')) :
Expand Down Expand Up @@ -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')) :
Expand Down Expand Up @@ -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')) :
Expand All @@ -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
Expand Down
32 changes: 32 additions & 0 deletions interface/super/edit_globals.php
Expand Up @@ -645,6 +645,38 @@ function checkBackgroundServices()
echo "</option>\n";
}
echo " </select>\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 " <select multiple class='form-control' name='form_{$i}[]' id='form_{$i}[]' size='8'>\n";
foreach ($res as $row) {
echo " <option value='" . attr($row['card_abrev']) . "'";
foreach ($glarr as $glrow) {
if ($glrow['gl_value'] == $row['card_abrev']) {
echo " selected";
break;
}
}
echo ">";
echo xlt($row['card_name']);
echo "</option>\n";
}
echo " </select>\n";
} elseif ($fldtype == GlobalSetting::DATA_TYPE_COLOR_CODE) {
if ($userMode) {
$globalTitle = $globalValue;
Expand Down
7 changes: 6 additions & 1 deletion library/globals.inc.php
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/Services/Globals/GlobalSetting.php
Expand Up @@ -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
Expand Down

0 comments on commit 6e94bfb

Please sign in to comment.