-
+ body {
+ background: var(--bg) !important;
+ }
-
' id='birthday_popup' style='display: none;' onclick='top.restoreSession()'>
-
+
+
+
+
+ getEventDispatcher()->dispatch(ViewEvent::EVENT_HANDLE, $viewEvent, 10);
+ $thisauth = AclMain::aclCheckCore('patients', 'demo');
- if (
- !$thisauth ||
- !$viewEvent->authorized()
- ) {
- echo "
(" . xlt('Demographics not authorized') . ")
\n";
- echo "\n\n";
+ if (!$thisauth || !$viewEvent->authorized()) {
+ echo $twig->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xlt("Medical Dashboard")]);
exit();
- }?>
+ }
+ ?>
-
-
-
-
+
+
+
' id='birthday_popup' style='display: none;' onclick='top.restoreSession()'>
- displayHorizNavBarMenu();
- // Get the document ID of the patient ID card if access to it is wanted here.
- $idcard_doc_id = false;
- if ($GLOBALS['patient_id_category_name']) {
- $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
- }
- ?>
-
-
-
-
-
-
-
-
-
-
- |
- |
-
-
-
- |
-
-
-
-
- |
-
-
-
-
-
-
-
- 0) { ?>
-
-
-
- |
-
-
-
-
-
- getEventDispatcher()->dispatch(RenderEvent::EVENT_SECTION_LIST_RENDER_BEFORE, new RenderEvent($pid), 10);
- ?>
-
-
-
- displayHorizNavBarMenu();
+ // Get the document ID of the patient ID card if access to it is wanted here.
+ $idcard_doc_id = false;
+ if ($GLOBALS['patient_id_category_name']) {
+ $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
+ }
+ ?>
+
+
+
+
+ xl('Billing'),
+ 'id' => $id,
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'hideBtn' => true,
+ 'patientBalance' => $patientbalance,
+ 'insuranceBalance' => $insurancebalance,
+ 'totalBalance' => $totalbalance,
+ 'forceAlwaysOpen' => $forceBillingExpandAlways,
+ ];
+
+ if (!empty($result['billing_note'])) {
+ $viewArgs['billingNote'] = $result['billing_note'];
}
- if ($insurance_count > 0) {
- // Insurance expand collapse widget
- $widgetTitle = xl("Insurance");
- $widgetLabel = "insurance";
- $widgetButtonLabel = xl("Edit");
- $widgetButtonLink = "demographics_full.php";
- $widgetButtonClass = "";
- $linkMethod = "html";
- $bodyClass = "";
- $widgetAuth = AclMain::aclCheckCore('patients', 'demo', '', 'write');
- $fixedWidth = false;
- expand_collapse_widget(
- $widgetTitle,
- $widgetLabel,
- $widgetButtonLabel,
- $widgetButtonLink,
- $widgetButtonClass,
- $linkMethod,
- $bodyClass,
- $widgetAuth,
- $fixedWidth
- );
-
- if ($insurance_count > 0) {
- ?>
-
-
-
-
-
-
-
-
- get_address();
- $insco_name = trim($icobj->get_name());
- ?>
-
-
-
-
-
-
-
-
- :
- |
-
-
-
-
- ';
- if (trim($adobj->get_line1())) {
- echo text($adobj->get_line1()) . ' ';
- echo text($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip());
- }
- } else {
- echo "" . xlt('Unassigned') . "";
- }
- ?>
-
- :
- :
- :
-
- |
-
- :
-
-
-
- :
-
- :
-
- :
-
-
- |
-
- :
-
-
-
-
-
-
-
- :
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
- :
-
-
-
- :
-
-
-
-
-
- :
-
-
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getTwig()->render('patient/card/billing.html.twig', $viewArgs);
+ endif; // End the hide_billing_widget
+
+ // if anyone wants to render anything before the patient demographic list
+ $GLOBALS["kernel"]->getEventDispatcher()->dispatch(RenderEvent::EVENT_SECTION_LIST_RENDER_BEFORE, new RenderEvent($pid), 10);
+
+ if (AclMain::aclCheckCore('patients', 'demo')) :
+ // Render the Demographics box
+ $viewArgs = [
+ 'title' => xl("Demographics"),
+ 'id' => "demographics_ps_expand",
+ 'btnText' => "Edit",
+ 'btnLink' => "demographics_full.php",
+ 'linkMethod' => "html",
+ 'auth' => ACLMain::aclCheckCore('patients', 'demo', '', 'write'),
+ 'requireRestore' => (!isset($_SESSION['patient_portal_onsite_two'])) ? true : false,
+ 'initiallyCollapsed' => getUserSetting("demographics_ps_expand") == true ? true : false,
+ 'tabID' => "DEM",
+ 'result' => $result,
+ 'result2' => $result2,
+ ];
+ echo $twig->getTwig()->render('patient/card/tab_base.html.twig', $viewArgs);
+
+ // Insurance
+ $insArr = [];
+ $sql = "SELECT * FROM insurance_data WHERE pid = ? AND type IN(?) ORDER BY date DESC";
+ $params[] = $pid;
+ $params[] = implode(", ", $insurance_array);
+ $res = sqlStatement($sql, $params);
+ while ($row = sqlFetchArray($res)) {
+ $insCount = ($row['provider']) ? $insCount++ : $insCount;
+ if ($row['provider']) {
+ $row['isOld'] = (strcmp($enddate, 'Present') != 0) ? true : false;
+ $icobj = new InsuranceCompany($row['provider']);
+ $adobj = $icobj->get_address();
+ $insco_name = trim($icobj->get_name());
+ $row['insco'] = [
+ 'name' => trim($icobj->get_name()),
+ 'address' => [
+ 'line1' => $adobj->get_line1(),
+ 'line2' => $adobj->get_line2(),
+ 'city' => $adobj->get_city(),
+ 'state' => $adobj->get_state(),
+ 'postal' => $adobj->get_zip(),
+ 'country' => $adobj->get_country()
+ ],
+ ];
+ $row['policy_type'] = (!empty($row['policy_type'])) ? $policy_types[$row['policy_type']] : false;
+ }
+ $row['dispFromDate'] = ((strcmp($row['date'], '0000-00-00') != 0) || $row['date'] == "") ? true : false;
+ $mname = ($row['subscriber_mname'] != "") ? $row['subscriber_mname'] : "";
+ $row['subscriber_full_name'] = str_replace("%mname%", $mname, "{$row['subscriber_fname']} %mname% {$row['subscriber_lname']}");
+ $insArr[] = $row;
+ }
- $fixedWidth = false;
- expand_collapse_widget(
- $widgetTitle,
- $widgetLabel,
- $widgetButtonLabel,
- $widgetButtonLink,
- $widgetButtonClass,
- $linkMethod,
- $bodyClass,
- $widgetAuth,
- $fixedWidth
- );
- ?>
-
-
-
-
-
-
-
-
-
-
-
+ $id = "insurance_ps_expand";
+ $viewArgs = [
+ 'title' => xl("Insurance"),
+ 'id' => $id,
+ 'btnText' => "Edit",
+ 'btnLink' => "demographics_full.php",
+ 'linkMethod' => 'html',
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'ins' => $insArr,
+ 'eligibility' => $output,
+ 'enable_oa' => $GLOBALS['enable_oa'],
+ 'auth' => AclMain::aclCheckCore('patients', 'demo', '', 'write'),
+ ];
+
+ if (count($insArr) > 0) {
+ echo $twig->getTwig()->render('patient/card/insurance.html.twig', $viewArgs);
+ }
+ endif; // end if demographics authorized
+
+ if (AclMain::aclCheckCore('patients', 'notes')) :
+ // Notes expand collapse widget
+ $id = "pnotes_ps_expand";
+ $viewArgs = [
+ 'title' => xl("Messages"),
+ 'id' => $id,
+ 'btnLabel' => "Edit",
+ 'btnLink' => "pnotes_full.php?form_active=1",
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'linkMethod' => "html",
+ 'bodyClass' => "notab",
+ 'auth' => AclMain::aclCheckCore('patients', 'notes', '', 'write'),
+ ];
+ echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs);
+ endif; // end if notes authorized
+
+ if (AclMain::aclCheckCore('patients', 'reminder') && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) :
+ // patient reminders collapse widget
+ $id = "patient_reminders_ps_expand";
+ $viewArgs = [
+ 'title' => xl('Patient Reminders'),
+ 'id' => $id,
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'btnLabel' => 'Edit',
+ 'btnLink' => '../reminder/patient_reminders.php?mode=simple&patient_id=' . attr_url($pid),
+ 'linkMethod' => 'html',
+ 'bodyClass' => 'notab collapse show',
+ 'auth' => AclMain::aclCheckCore('patients', 'reminder', '', 'write')
+ ];
+ echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs);
+ endif; //end if prw is activated
+
+ if (AclMain::aclCheckCore('patients', 'disclosure')) :
+ // disclosures expand collapse widget
+ $id = "disclosures_ps_expand";
+ $viewArgs = [
+ 'title' => xl('Disclosures'),
+ 'id' => $id,
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'btnLabel' => 'Edit',
+ 'btnLink' => 'disclosure_full.php',
+ 'linkMethod' => 'html',
+ 'bodyClass' => 'notab collapse show',
+ 'auth' => AclMain::aclCheckCore('patients', 'disclosure', '', 'write')
+ ];
+ echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs);
+ endif; // end if disclosures authorized
+
+ if ($GLOBALS['amendments'] && AclMain::aclCheckCore('patients', 'amendment')) :
+ // Amendments widget
+ $sql = "SELECT * FROM amendments WHERE pid = ? ORDER BY amendment_date DESC";
+ $result = sqlStatement($sql, [$pid]);
+ $amendments = [];
+ while ($row = sqlFetchArray($result)) {
+ $amendments[] = $row;
+ }
-getEventDispatcher()->dispatch(RenderEvent::EVENT_SECTION_LIST_RENDER_AFTER, new RenderEvent($pid), 10);
-// This generates a section similar to Vitals for each LBF form that
-// supports charting. The form ID is used as the "widget label".
-//
-$gfres = sqlStatement("SELECT grp_form_id AS option_id, grp_title AS title, grp_aco_spec " .
- "FROM layout_group_properties WHERE " .
- "grp_form_id LIKE 'LBF%' AND grp_group_id = '' AND grp_repeats > 0 AND grp_activity = 1 " .
- "ORDER BY grp_seq, grp_title");
-while ($gfrow = sqlFetchArray($gfres)) {
- // $jobj = json_decode($gfrow['notes'], true);
- $LBF_ACO = empty($gfrow['grp_aco_spec']) ? false : explode('|', $gfrow['grp_aco_spec']);
- if ($LBF_ACO && !AclMain::aclCheckCore($LBF_ACO[0], $LBF_ACO[1])) {
- continue;
- } ?>
-
- xl('Amendments'),
+ 'id' => $id,
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'btnLabel' => 'Edit',
+ 'btnLink' => $GLOBALS['webroot'] . "/interface/patient_file/summary/list_amendments.php?id=" . attr_url($pid),
+ 'btnCLass' => 'rx_modal',
+ 'linkMethod' => 'html',
+ 'bodyClass' => 'notab collapse show',
+ 'auth' => AclMain::aclCheckCore('patients', 'amendment', '', 'write'),
+ 'amendments' => $amendments,
+ ];
+ echo $twig->getTwig()->render('patient/card/amendments.html.twig', $viewArgs);
+ endif; // end amendments authorized
+
+ if (AclMain::aclCheckCore('patients', 'lab')) :
+ // labdata expand collapse widget
+ // check to see if any labdata exist
+ $spruch = "SELECT procedure_report.date_collected AS date
+ FROM procedure_report
+ JOIN procedure_order ON procedure_report.procedure_order_id = procedure_order.procedure_order_id
+ WHERE procedure_order.patient_id = ?
+ ORDER BY procedure_report.date_collected DESC";
+ $existLabdata = sqlQuery($spruch, array($pid));
+ $widgetAuth = ($existLabdata) ? true : false;
+
+ $id = "labdata_ps_expand";
+ $viewArgs = [
+ 'title' => xl('Labs'),
+ 'id' => $id,
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'btnLabel' => 'Trend',
+ 'btnLink' => "../summary/labdata.php",
+ 'linkMethod' => 'html',
+ 'bodyClass' => 'collapse show',
+ 'auth' => $widgetAuth,
+ ];
+ echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs);
+ endif; // end labs authorized
+
+ if ($vitals_is_registered && AclMain::aclCheckCore('patients', 'med')) :
+ // vitals expand collapse widget
+ // check to see if any vitals exist
+ $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid));
+ $widgetAuth = ($existVitals) ? true : false;
+
+ $id = "vitals_ps_expand";
+ $viewArgs = [
+ 'title' => xl('Vitals'),
+ 'id' => $id,
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'btnLabel' => 'Trend',
+ 'btnLink' => "../encounter/trend_form.php?formname=vitals",
+ 'linkMethod' => 'html',
+ 'bodyClass' => 'collapse show',
+ 'auth' => $widgetAuth,
+ ];
+ echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs);
+ endif; // end vitals
+
+ // if anyone wants to render anything after the patient demographic list
+ $GLOBALS["kernel"]->getEventDispatcher()->dispatch(RenderEvent::EVENT_SECTION_LIST_RENDER_AFTER, new RenderEvent($pid), 10);
+
+ // This generates a section similar to Vitals for each LBF form that
+ // supports charting. The form ID is used as the "widget label".
+ $gfres = sqlStatement("SELECT grp_form_id AS option_id, grp_title AS title, grp_aco_spec
+ FROM layout_group_properties
+ WHERE grp_form_id LIKE 'LBF%'
+ AND grp_group_id = ''
+ AND grp_repeats > 0
+ AND grp_activity = 1
+ ORDER BY grp_seq, grp_title");
+
+ while ($gfrow = sqlFetchArray($gfres)) :
+ // $jobj = json_decode($gfrow['notes'], true);
+ $LBF_ACO = empty($gfrow['grp_aco_spec']) ? false : explode('|', $gfrow['grp_aco_spec']);
+ if ($LBF_ACO && !AclMain::aclCheckCore($LBF_ACO[0], $LBF_ACO[1])) {
+ continue;
+ }
- $fixedWidth = false;
- expand_collapse_widget(
- $widgetTitle,
- $widgetLabel,
- $widgetButtonLabel,
- $widgetButtonLink,
- $widgetButtonClass,
- $linkMethod,
- $bodyClass,
- $widgetAuth,
- $fixedWidth
- ); ?>
-
-
-
-
-
-
-
-
-
+ // vitals expand collapse widget
+ $widgetAuth = false;
+ if (!$LBF_ACO || AclMain::aclCheckCore($LBF_ACO[0], $LBF_ACO[1], '', 'write')) {
+ // check to see if any instances exist for this patient
+ $existVitals = sqlQuery("SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0", [$pid, $vitals_form_id]);
+ $widgetAuth = $existVitals;
+ }
-
-
-
+ $viewArgs = [
+ 'title' => xl($gfrow['title']),
+ 'id' => $vitals_form_id,
+ 'initiallyCollapsed' => getUserSetting($vitals_form_id) == true ? true : false,
+ 'btnLabel' => 'Trend',
+ 'btnLink' => "../encounter/trend_form.php?formname=vitals",
+ 'linkMethod' => 'html',
+ 'bodyClass' => 'notab collapse show',
+ 'auth' => $widgetAuth,
+ ];
+ echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs);
+ endwhile; // end while
+ ?>
+
+
+
-
- xl("ID Card / Photos"),
+ 'id' => $id,
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'btnLabel' => 'Edit',
+ 'linkMethod' => "javascript",
+ 'bodyClass' => 'collapse show',
+ 'auth' => false,
+ 'patientIDCategoryID' => $GLOBALS['patient_id_category_name'],
+ 'patientPhotoCategoryName' => $GLOBALS['patient_photo_category_name'],
+ 'photos' => $photos,
+ 'idCardDocID' => $idcard_doc_id,
+ ];
+ echo $twig->getTwig()->render('patient/card/photo.html.twig', $viewArgs);
}
- ?>
-
-
-
- " .
- text(xl_document_category($nameDoc)) . " " .
- text($dateDoc);
- echo "
";
+ $tmp = [
+ 'pid' => $pid,
+ 'docID' => $idDoc,
+ 'docName' => $nameDoc,
+ 'docDate' => $dateDoc,
+ ];
+ $advDirArr[] = $tmp;
$limitCounter = $limitCounter + 1;
$counterFlag = true;
}
}
- }
- if (!$counterFlag) {
- echo " " . xlt('None{{Advanced_Directives}}');
- } ?>
-
- xl("Advance Directives"),
+ 'id' => $id,
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'btnLabel' => 'Edit',
+ 'linkMethod' => "javascript",
+ 'btnLink' => "return advdirconfigure();",
+ 'bodyClass' => 'collapse show',
+ 'auth' => true,
+ 'advDirArr' => $advDirArr,
+ 'counterFlag' => $counterFlag,
+ ];
+ echo $twig->getTwig()->render('patient/card/adv_dir.html.twig', $viewArgs);
+ }
} // close advanced dir block
- // Show Clinical Reminders for any user that has rules that are permitted.
+ // Show Clinical Reminders for any user that has rules that are permitted.
$clin_rem_check = resolve_rules_sql('', '0', true, '', $_SESSION['authUser']);
- if (
- !empty($clin_rem_check) && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw'] &&
- AclMain::aclCheckCore('patients', 'alert')
- ) {
+ $cdr = $GLOBALS['enable_cdr'];
+ $cdr_crw = $GLOBALS['enable_cdr_crw'];
+ if (!empty($clin_rem_check) && $cdr && $cdr_crw && AclMain::aclCheckCore('patients', 'alert')) {
// clinical summary expand collapse widget
- $widgetTitle = xl("Clinical Reminders");
- $widgetLabel = "clinical_reminders";
- $widgetButtonLabel = xl("Edit");
- $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=" . attr_url($pid);
- ;
- $widgetButtonClass = "";
- $linkMethod = "html";
- $bodyClass = "summary_item small";
- $widgetAuth = AclMain::aclCheckCore('patients', 'alert', '', 'write');
- $fixedWidth = false;
- expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
- echo "
";
- echo "
" . xlt('Loading') . "...
";
- echo "
";
+ $id = "clinical_reminders_ps_expand";
+ $viewArgs = [
+ 'title' => xl("Clinical Reminders"),
+ 'id' => $id,
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'btnLabel' => "Edit",
+ 'btnLink' => "../reminder/clinical_reminders.php?patient_id=" . attr_url($pid),
+ 'linkMethod' => "html",
+ 'auth' => AclMain::aclCheckCore('patients', 'alert', '', 'write'),
+ ];
+ echo $twig->getTwig()->render('patient/card/loader.html.twig', $viewArgs);
} // end if crw
- // Show current and upcoming appointments.
- //
- // Recurring appointment support and Appointment Display Sets
- // added to Appointments by Ian Jardine ( epsdky ).
- //
+ $displayAppts = false;
+ $displayRecurrAppts = false;
+ $displayPastAppts = false;
+
+ // Show current and upcoming appointments.
+ // Recurring appointment support and Appointment Display Sets
+ // added to Appointments by Ian Jardine ( epsdky ).
if (isset($pid) && !$GLOBALS['disable_calendar'] && AclMain::aclCheckCore('patients', 'appt')) {
- //
+ $displayAppts = true;
$current_date2 = date('Y-m-d');
$events = array();
- $apptNum = (int)$GLOBALS['number_of_appts_to_show'];
- if ($apptNum != 0) {
- $apptNum2 = abs($apptNum);
- } else {
- $apptNum2 = 10;
- }
+ $apptNum = (int) $GLOBALS['number_of_appts_to_show'];
+ $apptNum2 = ($apptNum != 0) ? abs($apptNum) : 10;
- //
$mode1 = !$GLOBALS['appt_display_sets_option'];
$colorSet1 = $GLOBALS['appt_display_sets_color_1'];
$colorSet2 = $GLOBALS['appt_display_sets_color_2'];
$colorSet3 = $GLOBALS['appt_display_sets_color_3'];
$colorSet4 = $GLOBALS['appt_display_sets_color_4'];
- //
- if ($mode1) {
- $extraAppts = 1;
- } else {
- $extraAppts = 6;
- }
+ $extraAppts = ($mode1) ? 1 : 6;
+ $extraApptDate = '';
+
+ $past_appts = [];
+ $recallArr = [];
$events = fetchNextXAppts($current_date2, $pid, $apptNum2 + $extraAppts, true);
- //////
+
if ($events) {
$selectNum = 0;
$apptNumber = count($events);
@@ -1578,12 +1303,10 @@ function setMyPatient() {
//
}
- //
$limitApptIndx = $apptNum2 - 1;
$limitApptDate = $events[$limitApptIndx]['pc_eventDate'] ?? '';
- //
+
switch ($selectNum) {
- //
case 2:
$lastApptIndx = $apptNumber - 1;
$thisNumber = $lastApptIndx - $limitApptIndx;
@@ -1594,8 +1317,7 @@ function setMyPatient() {
break;
}
}
-
- //
+ // Break in the loop to improve performance
case 1:
$firstApptIndx = 0;
for ($i = 1; $i <= $limitApptIndx; ++$i) {
@@ -1604,11 +1326,9 @@ function setMyPatient() {
break;
}
}
-
- //
+ // Break in the loop to improve performance
}
- //
if ($extraApptDate) {
if ($extraApptDate != $limitApptDate) {
$apptStyle2 = " style='background-color:" . attr($colorSet3) . ";'";
@@ -1617,20 +1337,8 @@ function setMyPatient() {
}
}
}
- // appointments expand collapse widget
- $widgetTitle = xl("Appointments");
- $widgetLabel = "appointments";
- $widgetButtonLabel = xl("Add");
- $widgetButtonLink = "return newEvt();";
- $widgetButtonClass = "";
- $linkMethod = "javascript";
- $bodyClass = "summary_item small";
- $widgetAuth = $resNotNull // $resNotNull reflects state of query in fetchAppointments
- && (AclMain::aclCheckCore('patients', 'appt', '', 'write') || AclMain::aclCheckCore('patients', 'appt', '', 'addonly'));
- $fixedWidth = false;
- expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
+
$count = 0;
- //
$toggleSet = true;
$priorDate = "";
$therapyGroupCategories = array();
@@ -1639,24 +1347,22 @@ function setMyPatient() {
$therapyGroupCategories[] = $result['pc_catid'];
}
- //
- foreach ($events as $row) { //////
+ // Build the UI Loop
+ $appts = [];
+ foreach ($events as $row) {
$count++;
- $dayname = date("l", strtotime($row['pc_eventDate'])); //////
- if ($GLOBALS['time_display_format'] == 0) {
- $dispampm = "";
- } else {
- $dispampm = "am";
- }
+ $dayname = date("D", strtotime($row['pc_eventDate']));
+ $displayMeridiem = ($GLOBALS['time_display_format'] == 0) ? "" : "am";
$disphour = substr($row['pc_startTime'], 0, 2) + 0;
$dispmin = substr($row['pc_startTime'], 3, 2);
if ($disphour >= 12 && $GLOBALS['time_display_format'] == 1) {
- $dispampm = "pm";
+ $displayMeridiem = "pm";
if ($disphour > 12) {
$disphour -= 12;
}
}
+ // Note the translaution occurs here instead of in teh Twig file for some specific concatenation needs
$etitle = xl('(Click to edit)');
if ($row['pc_hometext'] != "") {
$etitle = xl('Comments') . ": " . ($row['pc_hometext']) . "\r\n" . $etitle;
@@ -1670,122 +1376,75 @@ function setMyPatient() {
$toggleSet = !$toggleSet;
}
- if ($toggleSet) {
- $apptStyle = " style='background-color:" . attr($colorSet2) . ";'";
- } else {
- $apptStyle = " style='background-color:" . attr($colorSet1) . ";'";
- }
+ $bgColor = ($toggleSet) ? $colorSet2 : $colorSet1;
}
- echo "
";
- if (!in_array($row['pc_catid'], $therapyGroupCategories)) {
- echo "
";
- } else {
- echo "";
- }
-
- echo "" . text(oeFormatShortDate($row['pc_eventDate'])) . ", ";
- echo text(sprintf("%02d", $disphour) . ":$dispmin " . xl($dispampm) . " (" . xl($dayname)) . ") ";
- if ($row['pc_recurrtype']) {
- echo "";
- }
+ $row['pc_eventTime'] = sprintf("%02d", $disphour) . ":{$dispmin}";
+ $row['pc_status'] = generate_display_field(array('data_type' => '1', 'list_id' => 'apptstat'), $row['pc_apptstatus']);
- echo " '1', 'list_id' => 'apptstat'), $row['pc_apptstatus']) . "'>";
- echo "
" . xlt('Status') . "( " . text($row['pc_apptstatus']) . " ) ";
- echo text(xl_appt_category($row['pc_catname'])) . "\n";
if (in_array($row['pc_catid'], $therapyGroupCategories)) {
- echo "
" . xlt('Group name') . ": " . text(getGroup($row['pc_gid'])['group_name']) . "\n";
- }
-
- if ($row['pc_hometext']) {
- echo " Com";
+ $row['groupName'] = getGroup($row['pc_gid'])['group_name'];
}
- echo "
" . text($row['ufname'] . " " . $row['ulname']);
- echo !in_array($row['pc_catid'], $therapyGroupCategories) ? '' : '
';
- echo "\n";
+ $row['uname'] = text($row['ufname'] . " " . $row['ulname']);
+ $row['bgColor'] = $bgColor;
+ $row['dayName'] = $dayname;
+ $row['displayMeridiem'] = $displayMeridiem;
+ $row['jsEvent'] = attr_js(preg_replace("/-/", "", $row['pc_eventDate'])) . ', ' . attr_js($row['pc_eid']);
+ $appts[] = $row;
}
if ($resNotNull) {
- if ($count < 1) {
- echo " " . xlt('No Appointments');
- } else { //////
- if ($extraApptDate) {
- echo "
" . text($extraApptDate) . " ( + )
";
- }
- }
// Show Recall if one exists
- $query = sqlStatement("SELECT * FROM medex_recalls WHERE r_pid = ?", array($pid));
-
+ $query = sqlStatement("SELECT * FROM medex_recalls WHERE r_pid = ?", [$pid]);
+ $recallArr = [];
while ($result2 = sqlFetchArray($query)) {
//tabYourIt('recall', 'main/messages/messages.php?go=' + choice);
//parent.left_nav.loadFrame('1', tabNAME, url);
- echo "  
Recall: " . text(oeFormatShortDate($result2['r_eventDate'])) . " (" . text($result2['r_reason']) . ") ";
+ $recallArr[] = [
+ 'date' => $result2['r_eventDate'],
+ 'reason' => $result2['r_reason'],
+ ];
$count2++;
}
- //if there is no appt and no recall
- if (($count < 1) && empty($count2)) {
- echo "
" . xlt('No Recall') . "";
- }
- $count = 0;
- echo "
";
+ $id = "recall_ps_expand";
+ echo $twig->getTwig()->render('patient/card/recall.html.twig', [
+ 'title' => xl('Recall'),
+ 'id' => $id,
+ 'initiallyCollapsed' => (getUserSetting($id) == 0) ? false : true,
+ 'recalls' => $recallArr,
+ 'recallsAvailable' => ($count < 1 && empty($count2)) ? false : true,
+ ]);
}
} // End of Appointments Widget.
-
- /* Widget that shows recurrences for appointments. */
- if (
- isset($pid) && !$GLOBALS['disable_calendar'] && $GLOBALS['appt_recurrences_widget'] &&
- AclMain::aclCheckCore('patients', 'appt')
- ) {
- $widgetTitle = xl("Recurrent Appointments");
- $widgetLabel = "recurrent_appointments";
- $widgetButtonLabel = xl("Add");
- $widgetButtonLink = "return newEvt();";
- $widgetButtonClass = "";
- $linkMethod = "javascript";
- $bodyClass = "summary_item small";
- $widgetAuth = false;
- $fixedWidth = false;
- expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
+ /* Widget that shows recurrences for appointments. */
+ $recurr = [];
+ if (isset($pid) && !$GLOBALS['disable_calendar'] && $GLOBALS['appt_recurrences_widget'] && AclMain::aclCheckCore('patients', 'appt')) {
+ $displayRecurrAppts = true;
$count = 0;
$toggleSet = true;
$priorDate = "";
//Fetch patient's recurrences. Function returns array with recurrence appointments' category, recurrence pattern (interpreted), and end date.
$recurrences = fetchRecurrences($pid);
- if (empty($recurrences)) { //if there are no recurrent appointments:
- echo "