function consult_info() { if (func_num_args() > 0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } $arr_facility = array(); if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'm_lib_health_facility_barangay'")) != 0) { $q_facility = mysql_query("SELECT DISTINCT(a.facility_id),b.facility_name FROM m_lib_health_facility_barangay a,m_lib_health_facility b WHERE a.facility_id=b.facility_id ORDER by b.facility_name ASC") or die("Cannot query 1226 " . mysql_error()); if (mysql_num_rows($q_facility) != 0) { while (list($facility_id, $facility_name) = mysql_fetch_array($q_facility)) { array_push($arr_facility, array($facility_id, $facility_name)); } } } if (empty($arr_facility)) { $result = mysql_query("select c.consult_id, p.patient_id, p.patient_lastname, p.patient_firstname, see_doctor_flag from m_consult c, m_patient p where c.patient_id = p.patient_id and consult_end = '0000-00-00 00:00:00' order by c.consult_date asc") or die("Cannot query 1241 " . mysql_error()); } else { if (!empty($_GET["facid"])) { $q_facid = mysql_query("SELECT a.barangay_id FROM m_lib_barangay a, m_lib_health_facility_barangay b WHERE b.facility_id='{$_GET['facid']}' AND a.barangay_id=b.barangay_id") or die("Cannot query 1246 " . mysql_error()); if (mysql_num_rows($q_facid) != 0) { $arr_brgy = array(); while (list($brgy_id) = mysql_fetch_array($q_facid)) { array_push($arr_brgy, $brgy_id); } $str_brgy = implode(",", $arr_brgy); $result = mysql_query("select c.consult_id, p.patient_id, p.patient_lastname, p.patient_firstname, see_doctor_flag from m_consult c, m_patient p, m_family_members x, m_family_address y, m_lib_barangay z where c.patient_id = p.patient_id and consult_end = '0000-00-00 00:00:00' AND p.patient_id=x.patient_id AND x.family_id=y.family_id AND y.barangay_id IN ({$str_brgy}) AND y.barangay_id=z.barangay_id order by c.consult_date asc") or die("Cannot query 1258 " . mysql_error()); } else { echo "<script language='Javascript'>"; echo "window.alert('Invalid health facility code!')"; echo "</script>"; } } else { $result = mysql_query("select c.consult_id, p.patient_id, p.patient_lastname, p.patient_firstname, see_doctor_flag from m_consult c, m_patient p where c.patient_id = p.patient_id and consult_end = '0000-00-00 00:00:00' order by c.consult_date asc") or die("Cannot query 1271 " . mysql_error()); } } if ($result) { print "<a name='consults'></a>"; print "<span class='patient'>" . FTITLE_CONSULTS_TODAY . "</span><br>"; healthcenter::show_tab_headers($arr_facility); print "<table width=600 bgcolor='#FFFFFF' cellpadding='3' cellspacing='0' style='border: 2px solid black'>"; print "<tr><td>"; print "<span class='tinylight'>HIGHLIGHTED NAMES OR THOSE MARKED WITH <img src='../images/star.gif' border='0'/> WILL SEE PHYSICIAN.</span><br/>"; if (mysql_num_rows($result)) { // initialize array index $i = 0; // have to return always to consult page // wherever this is shown $consult_menu_id = module::get_menu_id("_consult"); while (list($cid, $pid, $plast, $pfirst, $see_doctor) = mysql_fetch_array($result)) { $q_lab = mysql_query("SELECT request_id,request_done FROM m_consult_lab WHERE patient_id='{$pid}' AND consult_id='{$cid}'") or die("Cannot query 1224" . mysql_error()); if (mysql_num_rows($q_lab) != 0) { $arr_done = array(); $arr_id = array(); while (list($req_id, $done_status) = mysql_fetch_array($q_lab)) { array_push($arr_id, $req_id); array_push($arr_done, $done_status); } $done = in_array("N", $arr_done) ? "N" : "Y"; $request_id = $arr_id[0]; $url = "page=CONSULTS&menu_id=1327&consult_id={$cid}&ptmenu=LABS#consults"; } else { $request_id = $done = ""; } $visits = healthcenter::get_total_visits($pid); $consult_array[$i] = "<a href='" . $_SERVER["PHP_SELF"] . "?page=CONSULTS&menu_id={$consult_menu_id}&consult_id={$cid}&ptmenu=DETAILS' title='" . INSTR_CLICK_TO_VIEW_RECORD . "' " . ($see_doctor == "Y" ? "style='background-color: #FFFF33'" : "") . ">" . "<b>{$plast}, {$pfirst}</b></a> [{$visits}] " . ($see_doctor == "Y" ? "<img src='../images/star.gif' border='0'/>" : "") . ($request_id != "" ? $done == "Y" ? "<a href='{$_SERVER['PHP_SELF']}?{$url}' title='lab completed'><img src='../images/lab.png' width='15px' height='15px' border='0' alt='lab completed' /></a>" : "<a href='{$_SERVER['PHP_SELF']}?{$url}' title='lab pending'><img src='../images/lab_untested.png' width='15px' height='15px' border='0' alt='lab pending' /></a>" : ""); $i++; } // pass on patient list to be columnized print $this->columnize_list($consult_array); } else { print "<font color='red'>No consults available.</font>"; } $sql_time = "select round(avg(unix_timestamp(consult_end)-unix_timestamp(consult_date))/60,2) consult_minutes from m_consult where consult_end>0 and to_days(consult_date) = to_days(sysdate());"; if ($result_time = mysql_query($sql_time)) { if (mysql_num_rows($result_time)) { list($mean_consult_time) = mysql_fetch_array($result_time); } if ($mean_consult_time) { print "<tr><td class='tinylight'>"; if ($mean_consult_time > 60) { $unit_time = "hour(s)"; } elseif ($meantime > 1440) { $unit_time = "day(s)"; } else { $unit_time = "minute(s)"; } print "AVERAGE CONSULT TIME: <font color='red'>{$mean_consult_time} {$unit_time}</font><br/>"; print "</td></tr>"; } } print "</td></tr>"; print "</table>"; } }
function consult_info() { if (func_num_args()>0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } $sql = "select c.consult_id, p.patient_id, p.patient_lastname, p.patient_firstname, see_doctor_flag ". "from m_consult c, m_patient p where c.patient_id = p.patient_id ". "and consult_end = '0000-00-00 00:00:00' order by c.consult_date asc"; if ($result = mysql_query($sql)) { print "<span class='patient'>".FTITLE_CONSULTS_TODAY."</span><br>"; print "<table width=600 bgcolor='#FFFFFF' cellpadding='3' cellspacing='0' style='border: 2px solid black'>"; print "<tr><td>"; print "<span class='tinylight'>HIGHLIGHTED NAMES OR THOSE MARKED WITH <img src='../images/star.gif' border='0'/> WILL SEE PHYSICIAN.</span><br/>"; if (mysql_num_rows($result)) { // initialize array index $i=0; // have to return always to consult page // wherever this is shown $consult_menu_id = module::get_menu_id("_consult"); while (list($cid, $pid, $plast, $pfirst, $see_doctor) = mysql_fetch_array($result)) { $visits = healthcenter::get_total_visits($pid); $consult_array[$i] = "<a href='".$_SERVER["PHP_SELF"]."?page=CONSULTS&menu_id=$consult_menu_id&consult_id=$cid&ptmenu=DETAILS' title='".INSTR_CLICK_TO_VIEW_RECORD."' ".($see_doctor=="Y"?"style='background-color: #FFFF33'":"").">". "<b>$plast, $pfirst</b></a> [$visits] ".($see_doctor=="Y"?"<img src='../images/star.gif' border='0'/>":""); $i++; } // pass on patient list to be columnized print $this->columnize_list($consult_array); } else { print "<font color='red'>No consults available.</font>"; } $sql_time = "select round(avg(unix_timestamp(consult_end)-unix_timestamp(consult_date))/60,2) consult_minutes from m_consult where consult_end>0 and to_days(consult_date) = to_days(sysdate());"; if ($result_time = mysql_query($sql_time)) { if (mysql_num_rows($result_time)) { list($mean_consult_time) = mysql_fetch_array($result_time); } if ($mean_consult_time) { print "<tr><td class='tinylight'>"; if ($mean_consult_time>60) { $unit_time = "hour(s)"; } elseif ($meantime>1440) { $unit_time = "day(s)"; } else { $unit_time = "minute(s)"; } print "AVERAGE CONSULT TIME: <font color='red'>$mean_consult_time $unit_time</font><br/>"; print "</td></tr>"; } } print "</td></tr>"; print "</table>"; } }
function _news() { if (func_num_args()>0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } print "<table width='300'>"; print "<tr valign='top'><td>"; print "<span class='library'>".FTITLE_SITE_NEWS."</span><br>"; print "</td></tr>"; if ($get_vars["news_id"]) { $sql = "select news_id, date_format(news_timestamp, '%e %b %Y, %l:%i%p'), news_title, news_author, news_lead, news_text from m_news where news_id = '".$get_vars["news_id"]."'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while (list($id, $ts, $title, $author, $lead, $text) = mysql_fetch_array($result)) { print "<tr valign='top'><td>"; if (!isset($menu_id)) { $menu_id = module::get_menu_id("_news"); } print "<a href='".$_SERVER["PHP_SELF"]."?page=CONTENT&menu_id=$menu_id&news_id=$id' class='newstitle'><b>".strtoupper($title)."</b></a><br />"; print "<span class='tiny'><b>$ts ".user::get_username($author)."</b></span><br/><br/>"; print "<span class='newsbody'><b>".nl2br(stripslashes($lead))."</b><br/><br/>"; print nl2br(stripslashes($text))."</span><br/><br/>"; print "<a href='".$_SERVER["PHP_SELF"]."'><img src='../images/back.png' border='0'/></a>"; print "</td></tr>"; } } } } else { $sql = "select news_id, date_format(news_timestamp, '%e %b %Y, %l:%i%p'), news_title, news_author, news_lead from m_news order by news_timestamp desc"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while (list($id, $ts, $title, $author, $lead) = mysql_fetch_array($result)) { print "<tr valign='top'><td>"; if (!isset($menu_id)) { $menu_id = module::get_menu_id("_news"); } print "<a href='".$_SERVER["SELF"]."?news_id=$id' class='newstitle'><b>".strtoupper($title)."</b></a><br />"; print "<span class='tiny'><b>$ts ".user::get_username($author)."</b></span><br/><br/>"; print "<span class='newsbody'>".nl2br(stripslashes($lead))."</span> "; print "<a href='".$_SERVER["SELF"]."?news_id=$id' class='newstitle'><img src='../images/view.png' border='0'/></a><br/>"; print "</td></tr>"; } } else { print "<tr valign='top'><td>"; print "<font color='red'>No content. You can post one in <b>CONTENT->News Archive</b>.</font><br/>"; print "</td></tr>"; } } } print "</table><br>"; }
function patient_info() { // // patients registered today // if (func_num_args() > 0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } $sql = "select patient_id, patient_lastname, patient_firstname, patient_dob, patient_gender, round((to_days(now())-to_days(patient_dob))/365 , 1) computed_age " . "from m_patient where to_days(registration_date) = to_days(now()) order by patient_lastname, patient_firstname"; if ($result = mysql_query($sql)) { print "<table width=600 bgcolor='#FFFFFF' cellpadding='3' cellspacing='0' style='border: 2px solid black'>"; print "<tr><td>"; print "<font color='red'><b>" . FTITLE_REGISTERED_TODAY . "</b></font><br>"; if (mysql_num_rows($result)) { print "<span class='tinylight'>CLICK ON PATIENT NAME TO EDIT DATA</span><br/>"; $i = 0; while (list($pid, $plast, $pfirst, $pdob, $pgender, $p_age) = mysql_fetch_array($result)) { $patient_array[$i] .= "<a href='" . $_SERVER["PHP_SELF"] . "?page=PATIENTS&menu_id={$menu_id}&patient_id={$pid}#ptform'><b>{$plast}, {$pfirst}</b></a> [{$p_age}/{$pgender}] {$pdob}"; if (class_exists("family")) { // show family icon if patient has a family $family_id = family::get_family_id($pid); if ($family_id != 0) { $family_menu_id = module::get_menu_id("_family"); $patient_array[$i] .= " <a href='" . $_SERVER["PHP_SELF"] . "?page=PATIENTS&menu_id={$family_menu_id}&family_id={$family_id}' title='GO TO FAMILY'><img src='../images/family.gif' border='0'/></a>"; } } if (class_exists("healthcenter")) { $consult_menu_id = module::get_menu_id("_consult"); $patient_array[$i] .= " <a href='" . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id={$consult_menu_id}&enter_consult={$pid}' title='" . INSTR_LOAD_PATIENT_RECORD . "'><img src='../images/records.gif' border='0'/></a>"; } $i++; } print $this->columnize_list($patient_array); } else { print "No patients registered today."; } print "</td></tr>"; print "</table>"; } }
function _news() { if (func_num_args() > 0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } $n = new news(); mysql_query("ALTER TABLE `m_news` DROP PRIMARY KEY, ADD PRIMARY KEY(`news_id`)"); $n->update_stats(); print "<script type='text/javascript' src='../site/calendar/calendar.js'></script>"; print "<form action = '" . $_SERVER["SELF"] . "' name='search_news' method='post'>"; //print "<input type='text' name='searchDate'>"; $setDate = isset($_REQUEST["date1"]) ? $_REQUEST["date1"] : ""; if ($setDate == '0000-00-00') { $setDate = date('Y-m-d'); } $n->_calendar($setDate); print "<input type='submit' name='submitDate' value='search' style='margin-left:8px'>"; print "</form>"; //$sql = "select news_id, date_format(news_timestamp, '%e %b %Y, %l:%i%p'), news_title, news_author, news_lead from m_news where date_format(news_timestamp,'%Y-%m-%d') = '".$_REQUEST["date1"]."'"; print "<table width='350'>"; print "<tr valign='top'><td>"; print "<span class='library'>" . FTITLE_SITE_NEWS . "</span><br>"; print "</td></tr>"; if ($get_vars["news_id"]) { if (isset($_REQUEST['submitDate']) && $_REQUEST['submitDate'] == 'search') { $sql = "select news_id, date_format(news_timestamp, '%e %b %Y, %l:%i%p'), news_title, news_author, news_lead, news_text from m_news where date_format(news_timestamp,'%Y-%m-%d') = '" . $setDate . "'"; } else { $sql = "select news_id, date_format(news_timestamp, '%e %b %Y, %l:%i%p'), news_title, news_author, news_lead, news_text from m_news where news_id = '" . $get_vars["news_id"] . "'"; } if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while (list($id, $ts, $title, $author, $lead, $text) = mysql_fetch_array($result)) { print "<tr valign='top'><td>"; if (!isset($menu_id)) { $menu_id = module::get_menu_id("_news"); } print "<a href='" . $_SERVER["SELF"] . "?page=CONTENT&menu_id={$menu_id}&news_id={$id}' class='newstitle'><b>" . strtoupper($title) . "</b></a><br />"; print "<span class='tiny'><b>{$ts} " . user::get_username($author) . "</b></span><br/><br/>"; print "<span class='newsbody'><b>" . nl2br(stripslashes($lead)) . "</b><br/><br/>"; print nl2br(stripslashes($text)) . "</span><br/><br/>"; print "<a href='" . $_SERVER["PHP_SELF"] . "'><img src='../images/back.png' border='0'/></a>"; print "</td></tr>"; } } else { print "<tr><td><font color='red'>No content. You can post one in <br/><b>CONTENT->News Archive</b>.</font></tr></td><br/>"; } } } else { if (isset($_REQUEST['submitDate']) && $_REQUEST['submitDate'] == 'search') { $sql = "select news_id, date_format(news_timestamp, '%e %b %Y, %l:%i%p'), news_title, news_author, news_lead from m_news where date_format(news_timestamp,'%Y-%m-%d') = '" . $setDate . "'"; } else { $sql = "select news_id, date_format(news_timestamp, '%e %b %Y, %l:%i%p'), news_title, news_author, news_lead from m_news order by news_timestamp desc LIMIT 0,10"; } if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while (list($id, $ts, $title, $author, $lead) = mysql_fetch_array($result)) { print "<tr valign='top'><td>"; if (!isset($menu_id)) { $menu_id = module::get_menu_id("_news"); } print "<a href='" . $_SERVER["SELF"] . "?news_id={$id}' class='newstitle'><b>" . strtoupper($title) . "</b></a><br />"; print "<span class='tiny'><b>{$ts} " . user::get_username($author) . "</b></span><br/><br/>"; print "<span class='newsbody'>" . nl2br(stripslashes($lead)) . "</span> "; print "<a href='" . $_SERVER["SELF"] . "?news_id={$id}' class='newstitle'><img src='../images/view.png' border='0'/></a><br/>"; print "</td></tr>"; } } else { print "<tr><td><font color='red'>No content. You can post one in <br/><b>CONTENT->News Archive</b>.</font></tr><td></br/>"; } } } print "</table><br>"; }
function _consult_ntp_followup() { // // main submodule for listing patients who // failed to followup by the day // // always check dependencies if ($exitinfo = $this->missing_dependencies('ntp')) { return print $exitinfo; } if (func_num_args() > 0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } print "<span class='patient'>" . FTITLE_NTP_FOLLOWUP_RECORD . "</span><br/><br/>"; $base_url = $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"]; if ($get_vars["year"] && $get_vars["month"] && $get_vars["day"]) { $date = $get_vars["year"] . "-" . $get_vars["month"] . "-" . $get_vars["day"]; } else { $date = date("Y-m-d"); } print "<table><tr valign='top'><td>"; calendar::display_calendar($menu_id, $post_vars, $get_vars, $validuser, $isadmin, $base_url); print "</td><td>"; print "<span class='tinylight'>"; print "<ol><b>NTP FOLLOWUP HOWTO:</b></ol>"; print "<ol>"; print "<li>THIS PAGE SHOWS PATIENTS ENROLLED IN THE NTP PROGRAM WHO FAILED TO APPEAR ON THE SELECTED DATE.</li>"; print "<li>TO SEE FAILED APPOINTMENTS OTHER THAN TODAY CLICK ON DESIRED CALENDAR DATE.</li>"; print "<li>YOU CAN ALSO USE THE CALENDAR NAVIGATION BUTTONS TO GO TO A DIFFERENT MONTH OR YEAR.</li>"; print "</ol>"; print "</span>"; print "</td></tr></table>"; $sql = "select a.schedule_id, a.patient_id, p.patient_lastname, p.patient_firstname, " . "p.patient_dob, p.patient_gender, l.appointment_name, " . "round((to_days(now())-to_days(p.patient_dob))/365 , 1) computed_age " . "from m_patient p, m_consult_appointments a, m_lib_appointment l " . "where p.patient_id = a.patient_id and " . "a.appointment_id = l.appointment_id and " . "to_days(a.visit_date) = to_days('{$date}') and " . "actual_date = '0000-00-00' " . "order by p.patient_lastname, p.patient_firstname"; if ($result = mysql_query($sql)) { print "<br/><table width=600 bgcolor='#FFFFFF' cellpadding='3' cellspacing='0' style='border: 2px solid black'>"; print "<tr><td>"; print "<span class='tinylight'><b>" . LBL_EXPECTED_TO_ARRIVE_TODAY . " " . $date . ":</b></span><br/><br/>"; if (mysql_num_rows($result)) { $i = 0; while (list($sid, $pid, $plast, $pfirst, $pdob, $pgender, $appname, $p_age) = mysql_fetch_array($result)) { if ($prev_app != $appname) { $patient_array[$i] .= "<span class='boxtitle'><font color='red'>" . strtoupper($appname) . "</font></span><br/>"; } $patient_array[$i] .= "<a href='" . $_SERVER["PHP_SELF"] . "?page=PATIENTS&menu_id={$menu_id}&patient_id={$pid}'><b>{$plast}, {$pfirst}</b></a> [{$p_age}/{$pgender}] {$pdob}"; if (class_exists("family")) { // show family icon if patient has a family $family_id = family::get_family_id($pid); if ($family_id != 0) { $family_menu_id = module::get_menu_id("_family"); $patient_array[$i] .= " <a href='" . $_SERVER["PHP_SELF"] . "?page=PATIENTS&menu_id={$family_menu_id}&family_id={$family_id}' title='GO TO FAMILY'><img src='../images/family.gif' border='0'/></a>"; } } if (class_exists("healthcenter")) { $consult_menu_id = module::get_menu_id("_consult"); $patient_array[$i] .= " <a href='" . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id={$consult_menu_id}&enter_consult={$pid}&appt_date={$date}&sked_id={$sid}' title='LOAD PATIENT RECORD'><img src='../images/records.gif' border='0'/></a>"; } $i++; $prev_app = $appname; } print $this->columnize_list($patient_array); } else { print "<font color='red'>No patients scheduled today.</font><br/>"; } print "</td></tr>"; print "</table>"; } }
function _news() { if (func_num_args()>0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; } print "<table width='300'>"; print "<tr valign='top'><td>"; print "<span class='library'>".FTITLE_SITE_NEWS."</span><br>"; print "</td></tr>"; $sql = "select news_id, news_timestamp, news_title, news_author, news_lead from m_news order by news_timestamp desc"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while (list($id, $ts, $title, $author, $lead) = mysql_fetch_array($result)) { print "<tr valign='top'><td>"; if (!isset($menu_id)) { $menu_id = module::get_menu_id("_news"); } print "<a href='".$_SERVER["SELF"]."?page=CONTENT&menu_id=$menu_id&news_id=$id' class='boxtext'><b>$title</b></a><br />"; print "<span class='tiny'><b>$ts ".user::get_username($author)."</b></span><br/>"; print "$lead<br />"; print "</td></tr>"; } } } print "</table><br>"; }