function collect_next_appointment($from_date, $patient_id = null) { $events = array(); $events = fetchAppointments($from_date, null, $patient_id, null, null, null, null, null, null, false, true); $events = sortAppointments($events); $return_event = array(); $return_event[0] = $events[0]; return $return_event; }
function fetch_Patient_Tracker_Events($from_date, $to_date, $provider_id = null, $facility_id = null, $form_apptstatus = null, $form_apptcat =null) { # used to determine which providers to display in the Patient Tracker if ($provider_id == 'ALL'){ //set null to $provider id if it's 'all' $provider_id = null; } $events = fetchAppointments( $from_date, $to_date, null, $provider_id, $facility_id, $form_apptstatus, null, null, $form_apptcat, true ); return $events; }
function fetch_Patient_Tracker_Events($from_date, $to_date) { # used to determine which providers to display in the Patient Tracker $provider_id = null; if ($_SESSION['userauthorized'] && $GLOBALS['docs_see_entire_calendar'] != '1') { $provider_id = $_SESSION[authUserID]; } $events = fetchAppointments($from_date, $to_date, null, $provider_id, null, null, null, null, null, true); return $events; }
function fetchNextXAppts($from_date, $patient_id, $nextX = 1) { $appts = array(); $nextXAppts = array(); $appts = fetchAppointments($from_date, null, $patient_id, null, null, null, null, null, null, false, $nextX); if ($appts) { $appts = sortAppointments($appts); $nextXAppts = array_slice($appts, 0, $nextX); } return $nextXAppts; }
function sendAllNotifications($device_token, $user, $provider_id, $message = 'Notification!', $date = '') { $date = $date == '' ? date('Y-m-d') : $date; $assignee = $user; $sql = "SELECT count( 0 ) AS count\n FROM `pnotes`\n WHERE deleted != '1'\n AND date >= '" . add_escape_custom($date) . " 00:00:00'\n AND date <= '" . add_escape_custom($date) . " 24:00:00'\n AND assigned_to LIKE ?"; $result_notification = sqlQuery($sql, array($assignee)); $count_apt = 0; $appointments = fetchAppointments($date, $date, $patient_id = null, $provider_id, $facility_id = null); if ($appointments) { foreach ($appointments as $key => $appointment) { $count_apt++; } } if ($result_notification || $appointments) { $count_msg = $result_notification['count']; $badge = $count_msg + $count_apt; $res = notification($device_token, intval($badge), $count_msg, $count_apt, $message); return $res ? $badge : false; } else { return false; } }
$result = sqlQuery($strQuery); if ($result) { $userId = $result['id']; $token = getToken($userId, $emr, $password, $device_token); $provider_id = $result['id']; $xml_array['status'] = 0; $xml_array['reason'] = 'User fetched.'; $xml_array['token'] = $token; $xml_array['id'] = $result['id']; $xml_array['provider_id'] = $provider_id; $xml_array['firstname'] = $result['fname']; $xml_array['lastname'] = $result['lname']; $xml_array['greeting'] = ''; $xml_array['title'] = $result['title']; if ($getdashboardinfo) { $appointments = fetchAppointments($date, $date, $patient_id = null, $provider_id, $facility_id = null); if ($appointments) { foreach ($appointments as $key => $appointment) { $xml_array["Appointmentlist"]["Appointment-{$key}"] = $appointment; } } else { $xml_array["Appointmentlist"]['status'] = -1; $xml_array["Appointmentlist"]['reason'] = 'Appointment not found.'; } /** * Particular Date prescription */ $strQuery = "SELECT * FROM prescriptions WHERE date_added = ? AND provider_id = ?"; $result = sqlStatement($strQuery, array($date, $provider_id)); if ($result->_numOfRows > 0) { $xml_array["Prescriptionlist"]['status'] = 0;
if ($form_orderby == "comment") { echo " style=\"color:#00cc00\""; } ?> ><?php xl('Comment', 'e'); ?> </a> </th> </thead> <tbody> <!-- added for better print-ability --> <?php $lastdocname = ""; $appointments = fetchAppointments($from_date, $to_date, $patient, $provider, $facility); if ($show_available_times) { $availableSlots = getAvailableSlots($from_date, $to_date, $provider, $facility); $appointments = array_merge($appointments, $availableSlots); } $appointments = sortAppointments($appointments, $form_orderby); $pid_list = array(); // Initialize list of PIDs for Superbill option foreach ($appointments as $appointment) { array_push($pid_list, $appointment['pid']); $patient_id = $appointment['pid']; $docname = $appointment['ulname'] . ', ' . $appointment['ufname'] . ' ' . $appointment['umname']; $errmsg = ""; ?> <tr bgcolor='<?php
<!-- added for better print-ability --> <?php $lastdocname = ""; #Appointment Status Checking $form_apptstatus = $_POST['form_apptstatus']; $form_apptcat = null; if (isset($_POST['form_apptcat'])) { if ($form_apptcat != "ALL") { $form_apptcat = intval($_POST['form_apptcat']); } } #Without provider and facility data checking $with_out_provider = null; $with_out_facility = null; # get the appointments also set the trackerboard flag to true (last entry in the fetchAppointments call so we get the tracker stuff) $appointments = fetchAppointments($from_date, $to_date, $patient, $provider, $facility, $form_apptstatus, $with_out_provider, $with_out_facility, $form_apptcat, true); # sort the appointments by the appointment time $appointments = sortAppointments($appointments, $form_orderby); # $j is used to count the number of patients that match the selected criteria. $j = 0; //print_r2($appointments); foreach ($appointments as $appointment) { $patient_id = $appointment['pid']; $tracker_id = $appointment['pt_tracker_id']; $last_seq = $appointment['lastseq']; $docname = $appointment['ulname'] . ', ' . $appointment['ufname'] . ' ' . $appointment['umname']; # if there is a recurring appointment I just want the expanded entry. if ($appointment['pc_recurrtype'] == '1') { continue; } # only get items with a tracker id.
echo ">" . htmlspecialchars($row['title'], ENT_NOQUOTES) . "</option>\n"; } echo " </select>\n"; echo " <br /><span class='bold'>Return to Play:</span><br>\n"; echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " . "value='{$form_userdate1}' " . "title='" . htmlspecialchars(xl('yyyy-mm-dd Date of return to play'), ENT_QUOTES) . "' " . "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" . " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " . "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " . "title='" . htmlspecialchars(xl('Click here to choose a date'), ENT_QUOTES) . "'>\n"; echo " <input type='hidden' name='form_original_userdate1' value='" . htmlspecialchars($form_userdate1, ENT_QUOTES) . "' />\n"; echo " <input type='hidden' name='form_issue_id' value='' />\n"; echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n"; echo " </form>\n"; } // Show current and upcoming appointments. if (isset($pid) && !$GLOBALS['disable_calendar']) { // $current_date2 = date('Y-m-d'); $events = array(); $events = fetchAppointments($current_date2, null, $pid, null, null, null, null, null, null, false, true); ////// $events = sortAppointments($events); ////// if (acl_check('patients', 'med') && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw'])) { // clinical summary expand collapse widget $widgetTitle = xl("Clinical Reminders"); $widgetLabel = "clinical_reminders"; $widgetButtonLabel = xl("Edit"); $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=" . $pid; $widgetButtonClass = ""; $linkMethod = "html"; $bodyClass = "summary_item small"; $widgetAuth = true; $fixedWidth = false; expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
array_push($sqlBindArrayPaid, $selectedFromDate, $selectedToDate); } // if provider selected then append condition for provider if (isset($selectedProvider) && !empty($selectedProvider)) { $providerID = $selectedProvider; $whereNewPatientConditions .= ' AND `OPE`.`pc_aid` = ?'; array_push($sqlBindArrayNewPatient, $selectedProvider); $whereTotalVisitConditions .= ' AND `fc`.`provider_id` = ?'; array_push($sqlBindArrayTotalVisit, $selectedProvider); $whereTotalPaymentConditions .= ' AND `fe`.`provider_id` = ?'; array_push($sqlBindArrayTotalPayment, $selectedProvider); $wherePaidConditions .= ' AND `fe`.`provider_id` = ?'; array_push($sqlBindArrayPaid, $selectedProvider); } // pass last parameter as Boolean, which is getting the facility name in the resulted array $totalAppointmentSql = fetchAppointments($from_date, $to_date, null, $providerID, $facilityID); if (count($totalAppointmentSql) > 0) { // check if $totalAppointmentSql array has value foreach ($totalAppointmentSql as $appointment) { $eventDate = $appointment['pc_eventDate']; $facility = $appointment['name']; $providerName = $appointment['ufname'] . ' ' . $appointment['ulname']; // initialize each level of the data structure if it doesn't already exist if (!isset($totalAppointment[$eventDate])) { $totalAppointment[$eventDate] = []; } if (!isset($totalAppointment[$eventDate][$facility])) { $totalAppointment[$eventDate][$facility] = []; } if (!isset($totalAppointment[$eventDate][$facility][$providerName])) { $totalAppointment[$eventDate][$facility][$providerName] = [];
function sendAllNotifications($device_token, $user, $provider_id, $message = 'Notification!', $date = '') { global $db; $date = $date == '' ? date('Y-m-d') : $date; $assignee = $user; $sql = "SELECT count( 0 ) AS count\n FROM `pnotes`\n WHERE deleted != '1'\n AND date >= '{$date} 00:00:00'\n AND date <= '{$date} 24:00:00'\n AND assigned_to LIKE '{$assignee}'"; $result_notification = $db->get_row($sql); $count_apt = 0; $appointments = fetchAppointments($date, $date, $patient_id = null, $provider_id, $facility_id = null); if ($appointments) { foreach ($appointments as $key => $appointment) { $count_apt++; } } if ($result_notification || $appointments) { $count_msg = $result_notification->count; $badge = $count_msg + $count_apt; // echo $badge;exit; // $message = str_replace("%apt%", $count_apt, $message); // $message = str_replace("%msg%", $count_msg, $message); $res = notification($device_token, intval($badge), $count_msg, $count_apt, $message); return $res ? $badge : false; } else { return false; } }