function family_info() { // // family details // 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 p.patient_id, p.patient_lastname, p.patient_firstname, p.patient_dob, p.patient_gender, round((to_days(now())-to_days(p.patient_dob))/365 , 1) computed_age, f.family_role ". "from m_family_members f, m_patient p where p.patient_id = f.patient_id and f.family_id = '".$get_vars["family_id"]."'". "order by p.patient_lastname, p.patient_firstname"; if ($result = mysql_query($sql)) { print "<table width=270 bgcolor='#FFFFFF' cellpadding='4' cellspacing='0' style='border: 2px solid black'>"; print "<tr><td>"; print "<span class='tinylight'>".INSTR_FAMILY_INFO."</span><br/>"; print "<b><font color='red'>SELECTED FAMILY</font> "; //print "<a href='".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&family_id=".$get_vars["family_id"]."&edit_family_id=".$get_vars["family_id"]."#family_form'>".module::pad_zero($get_vars["family_id"],5)."</a></b> "; print module::pad_zero($get_vars["family_id"],5)." <a href='".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&family_id=".$get_vars["family_id"]."&edit_family_id=".$get_vars["family_id"]."#family_form'>".edit."</a></b> "; print "<br>"; print "<font color='#999999'>"; print "<b>ADDRESS:</b> ".$this->show_address($get_vars["family_id"])."<br/>"; print "<b>BARANGAY:</b> ".$this->barangay_name($get_vars["family_id"])."<br/>"; print "</font>"; print "<br/>"; if (mysql_num_rows($result)) { $i=0; while (list($pid, $plast, $pfirst, $pdob, $pgender, $p_age, $role) = mysql_fetch_array($result)) { //$patient_menu_id = module::get_menu_id("_patient"); //$consult_menu_id = module::get_menu_id("_consult"); print "<a href='".$_SERVER["PHP_SELF"]."?page=PATIENTS&menu_id=".$get_vars["menu_id"]."&patient_id=$pid&family_id=".$get_vars["family_id"]."'><b>$plast, $pfirst</b></a> [$p_age/$pgender] "; if ($role=="head") { print "<img src='../images/star.gif' border='0'/> "; } if ($_SESSION["priv_delete"]) { print "<a href='".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&family_id=".$get_vars["family_id"]."&delete_id=$pid'><img src='../images/delete.png' border='0'/></a>"; } print "<br/>"; $i++; if ($get_vars["patient_id"]==$pid) { family::form_assign_role($menu_id, $post_vars, $get_vars); } } } else { print "No members for this family."; } print "</td></tr>"; print "</table><br/>"; } }
function process_tcl_inclusive_dates() { 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); } // loop through m_patient_ntp if ($post_vars["start_date"] && $post_vars["end_date"]) { } else { print $sql = "select c.consult_timestamp, c.consult_id consult_id, p.patient_id, " . "concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, " . "round((to_days(now())-to_days(p.patient_dob))/365 , 1) patient_age, p.patient_gender, n.tb_class, n.patient_type_id, " . "n.treatment_category_id, n.outcome_id, n.tb_class, n.treatment_partner_id " . "from m_patient_ntp n, m_patient p " . "where n.patient_id = p.patient_id"; } if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($ntp = mysql_fetch_array($result)) { print_r($ntp); // retrieve family address $family_id = family::get_family_id($ntp["patient_id"]); print $patient_address = family::show_address($family_id); // retrieve sputum exams $sputum_beforetx = sputum::get_sputum_results($ntp["ntp_id"], "DX"); $sputum_eo2 = sputum::get_sputum_results($ntp["ntp_id"], "EO2"); $sputum_eo3 = sputum::get_sputum_results($ntp["ntp_id"], "EO3"); $sputum_eo4 = sputum::get_sputum_results($ntp["ntp_id"], "EO4"); $sputum_eo5 = sputum::get_sputum_results($ntp["ntp_id"], "EO5"); $sputum_7m = sputum::get_sputum_results($ntp["ntp_id"], "7M"); $sql_insert = "insert into m_patient_ntp_tcl (ntp_id, " . "ntp_timestamp, patient_id, patient_name, " . "patient_age, patient_gender, patient_address, " . "facility_code, tb_class, patient_type, " . "treatment_category, sputum_beforetx_result, " . "sputum_beforetx_date, sputum_eo2_result, " . "sputum_eo2_date, sputum_eo3_result, sputum_eo3_date, " . "sputum_eo4_result, sputum_eo4_date, sputum_eo5_result, " . "sputum_eo5_date, sputum_7m_result, sputum_7m_date, " . "treatment_outcome, treatment_partner, remarks) " . "values ('" . $ntp["ntp_id"] . "', '" . $ntp["ntp_timestamp"] . "', " . "'" . $ntp["patient_id"] . "', '" . $ntp["patient_name"] . "', " . "'" . $ntp["patient_age"] . "', '" . $ntp["patient_gender"] . "', " . "'{$patient_address}', '" . $_SESSION["datanode"]["code"] . "', " . "'" . $ntp["tb_class"] . "','" . $ntp["patient_type_id"] . "', " . "'" . $ntp["treatment_category_id"] . "', '" . $sputum_beforetx["lab_diagnosis"] . "', " . "'" . $sputum_beforetx["lab_timestamp"] . "', '" . $sputum_eo2["lab_diagnosis"] . "', " . "'" . $sputum_eo2["lab_timestamp"] . "', '" . $sputum_eo3["lab_diagnosis"] . "', " . "'" . $sputum_eo3["lab_timestamp"] . "', '" . $sputum_eo4["lab_diagnosis"] . "', " . "'" . $sputum_eo4["lab_timestamp"] . "', '" . $sputum_eo5["lab_diagnosis"] . "', " . "'" . $sputum_eo5["lab_timestamp"] . "', '" . $sputum_7m["lab_diagnosis"] . "', " . "'" . $sputum_7m["lab_timestamp"] . "', '" . $ntp["outcome_id"] . "', " . "'" . $ntp["treatment_partner_id"] . "','')"; if ($result_insert = mysql_query($sql_insert)) { } else { $sql_update = "update m_patient_ntp_tcl set " . "sputum_beforetx_result = '" . $sputum_beforetx["lab_diagnosis"] . "', " . "sputum_beforetx_date = '" . $sputum_beforetx["lab_timestamp"] . "'," . "sputum_eo2_result = '" . $sputum_eo2["lab_diagnosis"] . "', " . "sputum_eo2_date = '" . $sputum_eo2["lab_timestamp"] . "', " . "sputum_eo3_result = '" . $sputum_eo3["lab_diagnosis"] . "', " . "sputum_eo3_date = '" . $sputum_eo3["lab_timestamp"] . "', " . "sputum_eo4_result = '" . $sputum_eo4["lab_diagnosis"] . "', " . "sputum_eo4_date = '" . $sputum_eo4["lab_timestamp"] . "', " . "sputum_eo5_result = '" . $sputum_eo5["lab_diagnosis"] . "', " . "sputum_eo5_date = '" . $sputum_eo5["lab_timestamp"] . "', " . "sputum_7m_result = '" . $sputum_7m["lab_diagnosis"] . "', " . "sputum_7m_date = '" . $sputum_7m["lab_timestamp"] . "' " . "where ntp_id = '" . $ntp["ntp_id"] . "'"; $result_update = mysql_query($sql_update) or die(mysql_error()); } } // while $sql = "select date_format(ntp_timestamp, '%Y-%m-%d') 'REG DATE', ntp_id 'ID', patient_name 'NAME', " . "concat(patient_age,'/',patient_gender) 'AGE/SEX', patient_address 'ADDRESS', " . "facility_code 'RHU/BHS', tb_class 'TB CLASS', patient_type 'PT TYPE', treatment_category 'TX CAT', " . "if(sputum_beforetx_result<>'', concat(sputum_beforetx_result,': ',sputum_beforetx_date),'NA') 'DX', " . "if(sputum_eo2_result<>'', concat(sputum_eo2_result,': ',sputum_eo2_date),'NA') 'EO Mo2', " . "if(sputum_eo3_result<>'', concat(sputum_eo3_result,': ',sputum_eo3_date), 'NA') 'EO Mo3', " . "if(sputum_eo4_result<>'', concat(sputum_eo4_result,': ',sputum_eo4_date), 'NA') 'EO Mo4', " . "if(sputum_eo5_result<>'', concat(sputum_eo5_result,': ',sputum_eo5_date), 'NA') 'EO Mo5', " . "if(sputum_7m_result<>'', concat(sputum_7m_result,': ',sputum_7m_date),'NA') '>7Mos', " . "treatment_outcome 'OUTCOME', treatment_partner 'PARTNER'" . "from m_patient_ntp_tcl order by ntp_timestamp"; $pdf = new PDF('L', 'pt', 'A3'); $pdf->SetFont('Arial', '', 10); $pdf->AliasNbPages(); $pdf->connect('localhost', 'root', 'kambing', 'game'); $attr = array('titleFontSize' => 14, 'titleText' => 'CONSULTS REGISTER'); $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/consult_tcl.pdf"); header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL"); } } }
} } if (file_exists('../modules/epi_report/class.epi_report.php')) { include '../modules/epi_report/class.epi_report.php'; $epi_report = new epi_report; if (!$module->activated('epi_report') && $initmod) { $epi_report->init_sql(); $epi_report->init_menu(); $epi_report->init_deps(); $epi_report->init_lang(); $epi_report->init_help(); } } if (file_exists('../modules/family/class.family.php')) { include '../modules/family/class.family.php'; $family = new family; if (!$module->activated('family') && $initmod) { $family->init_sql(); $family->init_menu(); $family->init_deps(); $family->init_lang(); $family->init_help(); } } if (file_exists('../modules/family_planning/class.family_planning.php')) { include '../modules/family_planning/class.family_planning.php'; $family_planning = new family_planning; if (!$module->activated('family_planning') && $initmod) { $family_planning->init_sql(); $family_planning->init_menu(); $family_planning->init_deps();
function form_family_members() { 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); } $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); $ccdev_id = ccdev::registry_record_exists($patient_id); $family_id = family::get_family_id($patient_id); print "<b>" . FTITLE_OTHER_FAMILY_MEMBERS . "</b><br/><br/>"; if ($family_id == 0) { print "<font color='red'>" . LBL_NO_FAMILY_ID . "</font><br/>"; } else { if ($ccdev_id == 0) { print "<font color='red'>" . LBL_NO_REGISTRY_ID . "</font><br/>"; } else { print "<span class='tiny'>" . LBL_SELECT_SIBLING . "</span><br/>"; $sql = "select p.patient_id, p.patient_lastname, p.patient_firstname, p.patient_dob, p.patient_gender, round((to_days(now())-to_days(p.patient_dob))/365 , 1) computed_age, f.family_role " . "from m_family_members f, m_patient p where p.patient_id = f.patient_id and f.family_id = '" . $get_vars["family_id"] . "' " . "and p.patient_id <> '{$patient_id}' " . "order by p.patient_lastname, p.patient_firstname"; print "<form method='post' action='" . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&consult_id=" . $get_vars["consult_id"] . "&ptmenu=" . $get_vars["ptmenu"] . "&module=" . $get_vars["module"] . "&ccdev=SIBLINGS'>"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while (list($pid, $plast, $pfirst, $pdob, $pgender, $p_age, $prole) = mysql_fetch_array($result)) { print "<input type='checkbox' name='patients[]' value='{$pid}'/> {$pfirst} {$plast} ({$p_age}/{$pgender})<br/>"; } } } if ($_SESSION["priv_add"]) { print "<input type='hidden' name='patient_id' value='{$patient_id}' />"; print "<input type='hidden' name='ccdev_id' value='{$ccdev_id}' />"; print "<br/><input type='submit' name='submitccdev' value='Add Sibling' class='tinylight' style='border: 1px solid black'/>"; } print "</form>"; } } }
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>"; } }
public $age; static $money = 100000; public function __construct() { parent::__construct(); // 调用父类构造方法 echo '这里是子类', PHP_EOL; } public function say() { parent::say(); // 调用父类中的方法 echo $this->name, "\tis\t", $this->gender, ",and is\t", $this->age, PHP_EOL; } public function cry() { echo parent::$money, PHP_EOL; echo '%>_<%', PHP_EOL; echo self::$money, PHP_EOL; // 调用自身构造方法 echo '(*^_^*)'; } } $poor = new family(); echo '<br>'; $poor->name = 'Lee'; $poor->gender = 'female'; $poor->age = 25; $poor->say(); echo '<br>'; $poor->cry();
function process_inclusive_dates() { 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_delete = "delete from m_patient_notifiable_tcl"; $result_delete = mysql_query($sql_delete) or die(mysql_error()); list($month, $day, $year) = explode("/", $post_vars["start_date"]); $start_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT); list($month, $day, $year) = explode("/", $post_vars["end_date"]); $end_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT); // loop through m_consult_disease_notifiable $sql = "select p.patient_id, c.consult_id, " . "concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, c.onset_date, " . "round((to_days(now())-to_days(p.patient_dob))/365 , 1) patient_age, p.patient_gender, " . "c.disease_id from m_consult_disease_notifiable c, m_patient p " . "where c.patient_id = p.patient_id and to_days(c.disease_timestamp) >= to_days('{$start_date}') " . "and to_days(c.disease_timestamp) <= to_days('{$end_date}')"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($report = mysql_fetch_array($result)) { // blank variables $family_id = 0; $patient_address = ''; $barangay_name = ''; $disease_name = ''; $icd_code = ''; // retrieve other data $family_id = family::get_family_id($report["patient_id"]); if ($family_id) { $patient_address = family::show_address($family_id); $barangay_name = family::barangay_name($family_id); } $disease_name = notifiable::get_notifiable_disease_name($report["patient_id"], $report[consult_id]); $icd_code = notifiable_report::get_disease_icdcode($report["patient_id"], $report[consult_id]); // insert data into tcl $sql_insert = "insert into m_patient_notifiable_tcl (consult_id, patient_id, " . "patient_name, onset_date, patient_age, patient_gender, patient_address, " . "barangay_name, diagnosis, icd10) " . "values ('" . $report["consult_id"] . "', '" . $report["patient_id"] . "', " . "'" . $report["patient_name"] . "', '" . $report["onset_date"] . "', '" . $report["patient_age"] . "', " . "'" . $report["patient_gender"] . "', '{$patient_address}', '{$barangay_name}', " . "'{$disease_name}', '{$icd_code}')"; $result_insert = mysql_query($sql_insert); } // while $sql = "select concat(patient_name,' / ',patient_gender,' / ',patient_age) " . "'PATIENT NAME / GENDER / AGE', patient_address 'ADDRESS', " . "barangay_name 'BARANGAY', onset_date 'ONSET DATE', " . "diagnosis 'DIAGNOSIS', icd10 'ICD10'" . "from m_patient_notifiable_tcl order by barangay_name, diagnosis"; $pdf = new PDF('P', 'pt', 'A4'); $pdf->SetFont('Arial', '', 10); $pdf->AliasNbPages(); $pdf->connect('localhost', 'root', 'root', 'chits'); $attr = array('titleFontSize' => 14, 'titleText' => 'TARGET CLIENT LIST FOR NOTIFIABLE DISEASES (' . $post_vars["start_date"] . ' - ' . $post_vars["end_date"] . ')'); $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/notifiable_tcl.pdf"); header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL"); } } }
/** * This function complites the family * * @access public * @author Ergo */ public function setCompleteFamily() { $familys = family::getFamilys(); $this->name = $familys[$this->idFamily]->name; }
function process_inclusive_dates() { if (func_num_args() > 0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; //$start_date = $arg_list[1]; //$end_date = $arg_list[2]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } $sql_delete = "delete from m_patient_epi_tcl"; $result_delete = mysql_query($sql_delete); list($month, $day, $year) = explode("/", $post_vars["start_date"]); $start_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT); list($month, $day, $year) = explode("/", $post_vars["end_date"]); $end_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT); // loop through m_consult_vaccine $sql = "select p.patient_id, p.patient_dob, concat(p.patient_lastname, ', ', p.patient_firstname) " . "patient_name, p.patient_mother, " . "date_format(adddate(p.patient_dob, interval 1 year), '%m-%Y') month_reaches_age1, m.fully_immunized_date " . "from m_patient p, m_patient_ccdev m " . "where p.patient_id = m.patient_id and " . "to_days(p.patient_dob) >= to_days('{$start_date}') and " . "to_days(p.patient_dob) <= to_days('{$end_date}') order by p.patient_dob "; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($report = mysql_fetch_array($result)) { // blank variables $family_id = 0; $patient_address = ''; $barangay_name = ''; //$vaccines = ''; //$icd_code = ''; // retrieve other data $family_id = family::get_family_id($report["patient_id"]); if ($family_id) { $patient_address = family::show_address($family_id); $barangay_name = family::barangay_name($family_id); } // insert data into tcl $sql_insert = "insert into m_patient_epi_tcl (patient_id, patient_dob, family_id, patient_name, " . "patient_mother, patient_address, barangay_name, month_reaches_age1, " . "fully_immunized_date) values ('" . $report["patient_id"] . "', " . "'" . $report["patient_dob"] . "', '{$family_id}', '" . $report["patient_name"] . "', " . "'" . $report["patient_mother"] . "', '{$patient_address}', '{$barangay_name}', " . "'" . $report["month_reaches_age1"] . "', '" . $report["fully_immunized_date"] . "')"; $result_insert = mysql_query($sql_insert) or die(mysql_error()); $this->get_vaccine_date($report["patient_id"], $start_date, $end_date); } // while $sql = "select * from m_patient_epi_tcl " . "order by barangay_name, patient_dob "; $pdf = new PDF('L', 'pt', 'Legal'); $pdf->SetFont('Arial', '', 10); $pdf->AliasNbPages(); $pdf->connect('localhost', 'root', 'root', 'lagrosa'); $attr = array('titleFontSize' => 14, 'titleText' => 'EPI REGISTER'); $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/epi_tcl.pdf"); header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL"); } } }
function display_appointment_details() { 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]; //print_r($arg_list); } $sql = "select schedule_id, visit_date, consult_id, date_format(schedule_timestamp, '%a %d %b %Y, %h:%i%p') schedule_timestamp, user_id, ". "patient_id, appointment_id, reminder_flag, actual_date, to_days(visit_date)- to_days(actual_date) variance ". "from m_consult_appointments where schedule_id = '".$get_vars["schedule_id"]."'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $appt = mysql_fetch_array($result); print "<a name='detail'>"; print "<table width='600' cellpadding='1'><tr valign='top'><td>"; // column 1 print "<form method='post' action='".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&patient_id=".$get_vars["patient_id"]."&schedule_id=".$appt["schedule_id"]."&year=".$get_vars["year"]."&month=".$get_vars["month"]."&day=".$get_vars["day"]."&s=0'>"; print "<table width='300' bgcolor='#FFFFCC' cellpadding='3'><tr><td>"; print "<span class='PATIENT'>".strtoupper(patient::get_name($appt["patient_id"]))."</span><br/><br/>"; print "VISIT DATE: <font color='red'><b>".$appt["visit_date"]."</b></font><br/>"; print "ACTUAL DATE: <font color='red'><b>".($appt["actual_date"]=="0000-00-00"?"No visit yet":$appt["actual_date"])."</b></font><br/>"; if ($appt["actual_date"]<>"0000-00-00") { print "VARIANCE, DAYS: ".($appt["variance"]<0?"<font color='red'><b>".$appt["variance"]."</b></font>":$appt["variance"])."<br/>"; } print "REMINDER: ".$appt["reminder_flag"]."<br/>"; print "APPT SET BY: ".user::get_username($appt["user_id"])."<br/><br/>"; print "<span class='boxtitle'>APPT CODE</span><br/> ".appointment::get_appointment_name($appt["appointment_id"])."<br/><br/>"; /* print "<span class='boxtitle'>ACTUAL FOLLOWUP DATE</span><br/>"; if ($injury["injury_date"]) { list($year, $month, $day) = explode("-", $injury["injury_date"]); $injury_date = "$month/$day/$year"; } print "<input type='text' size='15' maxlength='10' class='textbox' name='injury_date' value='".($injury_date?$injury_date:$post_vars["injury_date"])."' style='border: 1px solid #000000'> "; print "<a href=\"javascript:show_calendar4('document.form_consult_injury.injury_date', document.form_consult_injury.injury_date.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a><br>"; print "<small>Click on the calendar icon to select date. Otherwise use MM/DD/YYYY format.</small><br>"; print "<br/>"; */ if ($appt["actual_date"]=="0000-00-00") { print "<span class='boxtitle'>".LBL_DEFER_CONSULT."?</span><br/>"; print "<input type='checkbox' name='defer_consult' checked value='1'/> ".INSTR_DEFER_CONSULT."<br/><br/>"; } if ($_SESSION["priv_add"]) { if ($appt["actual_date"]=="0000-00-00") { print "<input type='submit' class='textbox' name='submitsked' value='Arrived' style='border: 1px solid black'/> "; } } if ($_SESSION["priv_delete"]) { print "<input type='submit' class='textbox' name='submitsked' value='Delete' style='border: 1px solid black'/> "; } print "<input type='hidden' name='schedule_id' value='".$get_vars["schedule_id"]."'/>"; print "<input type='hidden' name='consult_patient_id' value='".$appt["patient_id"]."'/>"; print "</td></tr></table></form>"; print "</td><td width='50%'>"; // column 2 // followup history // compute only for those who have followed up print "<b>".LBL_FOLLOW_UP_BEHAVIOR."</b><br/>"; $sql_hx = "select case when (to_days(visit_date)-to_days(actual_date)) >= 0 and actual_date <> '0000-00-00' then 'on time' ". "when (to_days(visit_date)-to_days(actual_date)) < 0 and actual_date <> '0000-00-00' then 'not on time' ". "when actual_date = '0000-00-00' then 'no follow up' ". "end status, count(schedule_id) times, round(avg(to_days(visit_date)-to_days(actual_date)),2) variance ". "from m_consult_appointments ". "where patient_id = ".$appt["patient_id"]." and ". "actual_date <> '0000-00-00' group by status"; if ($result_hx = mysql_query($sql_hx)) { if (mysql_num_rows($result_hx)) { print "<table width='300'>"; print "<tr valign='top'><td class='tinylight'><b>STATUS</b></td><td class='tinylight'><b>FREQUENCY</b></td><td class='tinylight'><b>AVE VARIANCE</b></td></tr>"; while (list($status, $times, $variance) = mysql_fetch_array($result_hx)) { print "<tr valign='top'><td class='tinylight'>$status</td><td class='tinylight'>$times</td><td class='tinylight'>$variance</td></tr>"; } print "</table><br/>"; } else { print "<font color='red'>No records to process</font><br/><br/>"; } } print "<b>".LBL_PATIENT_DETAILS."</b><br/><br/>"; print "<span class='tinylight'>"; print "<b>".FTITLE_FAMILY_INFO."</b><br/>"; $family_id = family::get_family_id($appt["patient_id"]); if ($family_id) { print "FAMILY ID: $family_id<br/>"; print "ADDRESS: ".family::get_family_address($family_id)."<br/>"; print "BARANGAY: ".family::barangay_name($family_id)."<br/>"; print "MEMBERS:<br/>".family::get_family_members($family_id)."<br/>"; } else { print "<font color='red'>No family record.</font><br/><br/>"; } print "<b>".FTITLE_PATIENT_GROUP_HX."</b><br/>"; $sql_ptgroup = "select count(c.ptgroup_id), g.ptgroup_name, g.ptgroup_module, c.ptgroup_id, c.consult_id ". "from m_consult_ptgroup c, m_lib_ptgroup g, m_consult h ". "where g.ptgroup_id = c.ptgroup_id and ". "h.consult_id = c.consult_id and ". "h.patient_id = '".$appt["patient_id"]."' ". "group by c.ptgroup_id"; if ($result = mysql_query($sql_ptgroup)) { if (mysql_num_rows($result)) { while (list($count, $name, $mod, $grp, $cid) = mysql_fetch_array($result)) { print "<img src='../images/arrow_redwhite.gif' border='0'/> "; print "$name: $count ".($count>1?" visits":"visit")."<br/> "; } } else { print "<font color='red'>No records.</font><br/>"; } } print "</span>"; print "</td></tr></table><br/>"; } } }
function process_inclusive_dates() { 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_delete = "delete from m_patient_mc_prenatal_tcl"; $result_delete = mysql_query($sql_delete) or die(mysql_error()); $sql_delete = "delete from m_patient_mc_postpartum_tcl"; $result_delete = mysql_query($sql_delete) or die(mysql_error()); list($month, $day, $year) = explode("/", $post_vars["start_date"]); $start_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT); list($month, $day, $year) = explode("/", $post_vars["end_date"]); $end_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT); // prenatal $get_prenatal = mysql_query("SELECT\n m.mc_id, \n p.registration_date,\n p.patient_id,\n concat(p.patient_lastname,', ',p.patient_firstname) patient_name,\n m.patient_lmp,\n m.obscore_gp,\n m.patient_edc,\n m.trimester1_date,\n m.trimester2_date,\n m.trimester3_date,\n date_format(m.delivery_date, '%c/%e/%y') delivery_date,\n m.outcome_id, \n m.birthweight,\n m.delivery_location,\n round((to_days(now())-to_days(p.patient_dob))/365,2) patient_age,\n m.birthmode\n FROM m_patient p, m_patient_mc m\n WHERE p.patient_id = m.patient_id AND\n to_days(p.registration_date) >= to_days('{$start_date}') AND\n to_days(p.registration_date) <= to_days('{$end_date}') AND\n m.delivery_date = '0000-00-00'") or die(mysql_error()); /*$sql = "select m.mc_id, p.registration_date, p.patient_id, concat(p.patient_lastname, ', ', p.patient_firstname) ". "patient_name, m.patient_lmp, m.obscore_gp, m.patient_edc, m.trimester1_date, m.trimester2_date, ". "m.trimester3_date, date_format(m.delivery_date, '%c/%e/%y') delivery_date, m.outcome_id, m.birthweight, ". "m.delivery_location, ". "m.breastfeeding_asap, round((to_days(now())-to_days(p.patient_dob))/365,2) patient_age, ". "adddate(m.delivery_date, interval 28 day) postpartum_wk4, ". "adddate(m.delivery_date, interval 42 day) postpartum_wk6, m.birthmode ". "from m_patient p, m_patient_mc m ". "where p.patient_id = m.patient_id and ". "to_days(p.registration_date) >= to_days('$start_date') and ". "to_days(p.registration_date) <= to_days('$end_date') "; */ if ($get_prenatal) { if (mysql_num_rows($get_prenatal)) { while ($prenatal = mysql_fetch_array($get_prenatal)) { // blank variables $family_id = ''; $patient_address = ''; $barangay_id = ''; // retrieve other data $family_id = family::get_family_id($prenatal["patient_id"]); if ($family_id != '0') { $patient_address = family::show_address($family_id); $barangay_id = family::barangay_id($family_id); } if ($prenatal[birthweight] == '0') { $birthweight = ''; } else { $birthweight = $prenatal[birthweight]; } if ($prenatal[delivery_date] == '0/0/00') { $delivery_date = ''; } else { $delivery_date = $prenatal[delivery_date]; } $fully_immunized_date = $this->get_fully_immunized_tt_date($prenatal["patient_id"]); $tt_vaccines = $this->get_tt_vaccines($prenatal["patient_id"]); $risk_id_date = $this->get_risk_id_date($prenatal["patient_id"]); $iron_date = $this->get_iron_date($prenatal["patient_id"]); /*$vita_date = $this->get_vita_date($report["patient_id"]); $home_visit_dates = $this->get_home_visit_dates($report["patient_id"]); $clinic_visit_dates = $this->get_clinic_visit_dates($report["patient_id"],$report[postpartum_wk4],$report[postpartum_wk6]);*/ $trimester1_visit_dates = $this->get_trimester1_visit_dates($prenatal["patient_id"], $prenatal["trimester1_date"], $prenatal["patient_lmp"]); $trimester2_visit_dates = $this->get_trimester2_visit_dates($prenatal["patient_id"], $prenatal["trimester2_date"], $prenatal["trimester1_date"]); $trimester3_visit_dates = $this->get_trimester3_visit_dates($prenatal["patient_id"], $prenatal["trimester3_date"], $prenatal["trimester2_date"]); //$breastfeeding_date = $this->get_breastfeeding_date($report["patient_id"]); $attendant = $this->get_attendant($prenatal[birthmode]); //insert data into prenatal tcl $sql_insert = "insert into m_patient_mc_prenatal_tcl (mc_id, patient_id, registration_date, family_id, patient_name, " . "patient_age, patient_address, barangay_name, patient_lmp, obscore_gp, patient_edc, " . "trimester1_visit_dates, trimester2_visit_dates, trimester3_visit_dates, risk_id_date, " . "fully_immunized_date, TT_vaccine_dates, IRON, delivery_date, outcome_id, birthweight, " . "delivery_location, attendant_name) values ('" . $prenatal["mc_id"] . "', " . "'" . $prenatal["patient_id"] . "', '" . $prenatal["registration_date"] . "', " . "'{$family_id}', '" . $prenatal["patient_name"] . "', '" . $prenatal["patient_age"] . "', " . "'{$patient_address}', '{$barangay_id}', '" . $prenatal["patient_lmp"] . "', " . "'" . $prenatal["obscore_gp"] . "', '" . $prenatal["patient_edc"] . "', " . "'{$trimester1_visit_dates}', '{$trimester2_visit_dates}', " . "'{$trimester3_visit_dates}', '{$risk_id_date}', '{$fully_immunized_date}', " . "'{$tt_vaccines}', '{$iron_date}', '{$delivery_date}', " . "'" . $prenatal["outcome_id"] . "', '{$birthweight}', " . "'" . $prenatal["delivery_location"] . "', '{$attendant}')"; $result_insert = mysql_query($sql_insert) or die(mysql_error()); /*$sql_insert = "insert into m_patient_mc_postpartum_tcl (mc_id, patient_id, family_id, patient_name, ". "patient_age, patient_address, barangay_name, postpartum_wk4, postpartum_wk6, ". "date_started_breastfeeding, postpartum_home_visit, postpartum_clinic_visit, ". "IRON, VITA) values ('".$report["mc_id"]."', '".$report["patient_id"]."', ". "'$family_id', '".$report["patient_name"]."', '".$report["patient_age"]."', ". "'$patient_address', '$barangay_id', '".$report["postpartum_wk4"]."', ". "'".$report["postpartum_wk6"]."', '$breastfeeding_date','$home_visit_dates', ". "'$clinic_visit_dates', '$iron_date', '$vita_date')"; $result_insert = mysql_query($sql_insert) or die(mysql_error());*/ } // while } } // get postpartum /*$get_pp = mysql_query("SELECT m.mc_id, p.registration_date, p.patient_id, concat(p.patient_lastname,', ',p.patient_firstname) patient_name, m.breastfeeding_asap, round((to_days(now())-to_days(p.patient_dob))/365,2) patient_age, adddate(m.delivery_date, interval 28 day) postpartum_wk4, adddate(m.delivery_date, interval 42 day) postpartum_wk6 FROM m_patient p, m_patient_mc m WHERE p.patient_id = m.patient_id AND to_days(p.registration_date) >= to_days('$start_date') AND to_days(p.registration_date) <= to_days('$end_date') AND m.delivery_date <> '0000-00-00' ") or die(mysql_error());*/ /*$get_pp = mysql_query("SELECT m.mc_id, p.registration_date, p.patient_id, concat(p.patient_lastname,', ',p.patient_firstname) patient_name, m.breastfeeding_asap, round((to_days(now())-to_days(p.patient_dob))/365,2) patient_age, adddate(m.delivery_date, interval 28 day) postpartum_wk4, adddate(m.delivery_date, interval 42 day) postpartum_wk6 FROM m_patient p, m_patient_mc m WHERE p.patient_id = m.patient_id AND to_days(m.postpartum_date) >= to_days('$start_date') AND to_days(m.postpartum_date) <= to_days('$end_date') ") or die(mysql_error());*/ $get_pp = mysql_query("SELECT\n m.mc_id,\n p.registration_date, pp.postpartum_date, pp.visit_sequence,\n p.patient_id,\n concat(p.patient_lastname,', ',p.patient_firstname) patient_name,\n m.breastfeeding_asap,\n round((to_days(now())-to_days(p.patient_dob))/365,2) patient_age,\n adddate(m.delivery_date, interval 28 day) postpartum_wk4,\n adddate(m.delivery_date, interval 42 day) postpartum_wk6\n FROM m_patient p, m_patient_mc m, m_consult_mc_postpartum pp\n WHERE p.patient_id = m.patient_id AND\n to_days(pp.postpartum_date) >= to_days('{$start_date}') AND\n to_days(pp.postpartum_date) <= to_days('{$end_date}') AND \n m.patient_id=pp.patient_id AND \n pp.visit_sequence='1'") or die(mysql_error()); if ($get_pp) { if (mysql_num_rows($get_pp)) { while ($pp = mysql_fetch_array($get_pp)) { // blank variables $family_id = ''; $patient_address = ''; $barangay_id = ''; // retrieve other data $family_id = family::get_family_id($pp["patient_id"]); if ($family_id != '0') { $patient_address = family::show_address($family_id); $barangay_id = family::barangay_id($family_id); } $vita_date = $this->get_vita_date($pp["patient_id"]); $iron_date = $this->get_iron_date($pp["patient_id"]); $home_visit_dates = $this->get_home_visit_dates($pp["patient_id"]); $clinic_visit_dates = $this->get_clinic_visit_dates($pp["patient_id"], $pp[postpartum_wk4], $pp[postpartum_wk6]); $breastfeeding_date = $this->get_breastfeeding_date($pp["patient_id"]); // insert into postpartum tcl $sql_insert = "insert into m_patient_mc_postpartum_tcl (mc_id, patient_id, family_id, patient_name, " . "patient_age, patient_address, barangay_name, postpartum_wk4, postpartum_wk6, " . "date_started_breastfeeding, postpartum_home_visit, postpartum_clinic_visit, " . "IRON, VITA) values ('" . $pp["mc_id"] . "', '" . $pp["patient_id"] . "', " . "'{$family_id}', '" . $pp["patient_name"] . "', '" . $pp["patient_age"] . "', " . "'{$patient_address}', '{$barangay_id}', '" . $pp["postpartum_wk4"] . "', " . "'" . $pp["postpartum_wk6"] . "', '{$breastfeeding_date}','{$home_visit_dates}', " . "'{$clinic_visit_dates}', '{$iron_date}', '{$vita_date}')"; $result_insert = mysql_query($sql_insert) or die(mysql_error()); } } } $sql = "select date_format(registration_date, '%c/%e/%y') 'REGISTRATION DATE', " . "family_id 'FAMILY ID', concat(patient_name, ' / ', patient_age) 'NAME / AGE', " . "patient_address 'ADDRESS', barangay_name 'BRGY', date_format(patient_lmp, '%c/%e/%y') 'LMP', " . "obscore_gp 'G-P', date_format(patient_edc, '%c/%e/%y') 'EDC', " . "trimester1_visit_dates '1st TRIMESTER VISITS', " . "trimester2_visit_dates '2nd TRIMESTER VISITS', " . "trimester3_visit_dates '3rd TRIMESTER VISITS', " . "risk_id_date 'RISK CODE / DATE DETECTED', fully_immunized_date " . "'FULLY IMMUNIZED DATE', TT_vaccine_dates 'TT IMMUNIZATION GIVEN', " . "IRON 'IRON', delivery_date 'DATE TERMINATED', " . "outcome_id 'OUTCOME', birthweight 'BIRTH WEIGHT', delivery_location 'PLACE OF DELIVERY', " . "attendant_name 'ATTENDED BY' " . "from m_patient_mc_prenatal_tcl order by barangay_name, registration_date "; $pdf = new PDF('L', 'pt', 'Legal'); $pdf->SetFont('Arial', '', 10); $pdf->AliasNbPages(); $pdf->connect('localhost', 'root', 'root', 'cuartero'); $attr = array('titleFontSize' => 14, 'titleText' => 'TARGET CLIENT LIST FOR PRENATAL CARE (' . $post_vars["start_date"] . ' - ' . $post_vars["end_date"] . ')'); $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/mc_prenatal_tcl.pdf"); header("location:" . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL"); $sql = "select family_id 'FAMILY ID', concat(patient_name, ' / ', patient_age) 'NAME / AGE', " . "patient_address 'ADDRESS', barangay_name 'BRGY', date_format(postpartum_wk4, '%c/%e/%y') '4TH PP WK', " . "date_format(postpartum_wk6, '%c/%e/%y') '6TH PP WK', " . "postpartum_home_visit 'DATES OF POSTPARTUM CARE HOME VISITS', " . "postpartum_clinic_visit 'DATES OF POSTPARTUM CARE CLINIC CHECK-UP BTW 4-6 WKS PP', " . "date_started_breastfeeding 'DATE STARTED BREASTFEEDING', " . "IRON 'IRON', VITA 'VITAMIN A' " . "from m_patient_mc_postpartum_tcl order by barangay_name, patient_name "; $pdf = new PDF('L', 'pt', 'Legal'); $pdf->SetFont('Arial', '', 12); $pdf->AliasNbPages(); $pdf->connect('localhost', 'root', 'root', 'chits'); $attr = array('titleFontSize' => 14, 'titleText' => 'TARGET CLIENT LIST FOR POSTPARTUM CARE (' . $post_vars["start_date"] . ' - ' . $post_vars["end_date"] . ')'); $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/mc_postpartum_tcl.pdf"); header("location:" . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL"); }
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>"; } }
exit; } } $mysql = "insert into {$family_table} set family_name='{$fFamily_name}',date_added=now(),added_by='{$user_id}'"; //echo $mysql; $fam_id = $db_object->insert_data_id($mysql); //print_r($related_pos); for ($i = 0; $i < count($related_pos); $i++) { $position_id = $related_pos[$i]; $mysql = "insert into {$fam_position_table} set family_id='{$fam_id}',position_id='{$position_id}'"; //echo $mysql; $db_object->insert($mysql); } } } $obj = new family(); while (list($kk, $vv) = @each($_POST)) { ${$kk} = $vv; $form_array["{$kk}"] = $vv; } while (list($kk, $vv) = @each($_GET)) { ${$kk} = $vv; $form_array["{$kk}"] = $vv; } // print_r($form_array); if ($fAdd_family) { $obj->addFamily($db_object, $common, $form_array, $error_msg, $default, $user_id); $message = $error_msg["cAddfamily"]; echo $message; $obj->showFamily($db_object, $common, $form_array, $default); } else {
function process_inclusive_dates() { 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_delete = "delete from m_patient_epi_tcl"; $result_delete = mysql_query($sql_delete); list($month, $day, $year) = explode("/", $post_vars["start_date"]); $start_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT); list($month, $day, $year) = explode("/", $post_vars["end_date"]); $end_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT); /*$sql = "select p.patient_id, p.patient_dob, concat(p.patient_lastname, ', ', p.patient_firstname) ". "patient_name, p.patient_mother, ". "date_format(adddate(p.patient_dob, interval 1 year), '%b %y') month_reaches_age1, m.fully_immunized_date ". "from m_patient p, m_patient_ccdev m ". "where p.patient_id = m.patient_id and ". "to_days(adddate(p.patient_dob,interval 1 year)) >= to_days('$start_date') and ". "to_days(adddate(p.patient_dob,interval 1 year)) <= to_days('$end_date') order by p.patient_dob "; */ /*$sql = "select patient_id, patient_dob, concat(patient_lastname, ', ', patient_firstname) ". "patient_name, patient_mother, ". "date_format(adddate(patient_dob, interval 1 year), '%b %y') month_reaches_age1 ". "from m_patient ". "where to_days(adddate(patient_dob,interval 1 year)) >= to_days('$start_date') and ". "to_days(adddate(patient_dob,interval 1 year)) <= to_days('$end_date') order by patient_dob ";*/ $sql = "select patient_id, patient_dob, concat(patient_lastname, ', ', patient_firstname) " . "patient_name, patient_mother, " . "date_format(adddate(patient_dob, interval 1 year), '%b %y') month_reaches_age1 " . "from m_patient " . "where to_days(registration_date) >= to_days('{$start_date}') and " . "to_days(registration_date) <= to_days('{$end_date}') order by registration_date "; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($report = mysql_fetch_array($result)) { // blank variables $patient_age = patient::get_age($report[patient_id]); if ($patient_age <= 1) { $family_id = 0; $patient_address = ''; $barangay_id = ''; // retrieve other data $family_id = family::get_family_id($report["patient_id"]); if ($family_id) { $patient_address = family::show_address($family_id); $barangay_id = family::barangay_id($family_id); } $fully_immunized_date = $this->get_fully_immunized_date($report[patient_id]); // insert data into tcl $sql_insert = "insert into m_patient_epi_tcl (patient_id, patient_dob, family_id, patient_name, " . "patient_mother, patient_address, barangay_name, month_reaches_age1, " . "fully_immunized_date) values ('" . $report["patient_id"] . "', " . "'" . $report["patient_dob"] . "', '{$family_id}', '" . $report["patient_name"] . "', " . "'" . $report["patient_mother"] . "', '{$patient_address}', '{$barangay_id}', " . "'" . $report["month_reaches_age1"] . "', '{$fully_immunized_date}')"; $result_insert = mysql_query($sql_insert) or die(mysql_error()); $this->get_vaccine_date($report["patient_id"], $start_date, $end_date); } } // while $sql = "select patient_id 'PATIENT ID', date_format(patient_dob,'%c/%e/%y') 'DATE OF BIRTH', " . "family_id 'FAMILY ID', patient_name 'NAME OF INFANT', patient_mother 'NAME OF MOTHER', " . "patient_address 'ADDRESS', barangay_name 'BRGY', month_reaches_age1 'MONTH REACHES AGE 1', " . "fully_immunized_date 'DATE FULLY IMMUNIZED', " . "BCG 'BCG', DPT1 'DPT 1', " . "DPT2 'DPT 2', DPT3 'DPT 3', " . "OPV1 'POLIO 1', OPV2 'POLIO 2', " . "OPV3 'POLIO 3', MSL 'MEASLES', " . "HEPB1 'HEPA B1', HEPB2 'HEPA B2', " . "HEPB3 'HEPA B3' " . "from m_patient_epi_tcl order by barangay_name, patient_dob "; //"where to_days(actual_vaccine_date) >= to_days('$start_date') and ". //"to_days(actual_vaccine_date) <= to_days('$end_date') ". //"order by barangay_name, patient_dob "; $pdf = new PDF('L', 'pt', 'Legal'); //$pdf->SetMargins('0.5','0.5','0.5'); $pdf->SetFont('Arial', '', 10); //$pdf->SetMargins('0.5','0.5','0.5'); $pdf->AliasNbPages(); $pdf->connect('localhost', 'root', '', 'game'); $attr = array('titleFontSize' => 14, 'titleText' => 'TARGET CLIENT LIST FOR EPI (' . $post_vars["start_date"] . ' - ' . $post_vars["end_date"] . ')'); $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/epi_tcl.pdf"); header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL"); } } }
function process_inclusive_dates() { 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); } // loop through m_consult_disease_notifiable $sql = "select p.patient_id, c.consult_id, concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, c.onset_date, ". "round((to_days(now())-to_days(p.patient_dob))/365 , 1) patient_age, p.patient_gender, c.disease_id ". "from m_consult_disease_notifiable c, m_patient p ". "where c.patient_id = p.patient_id"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($report = mysql_fetch_array($result)) { // blank variables $family_id = 0; $patient_address = ''; $barangay_name = ''; $disease_name = ''; $icd_code = ''; // retrieve other data $family_id = family::get_family_id($report["patient_id"]); if ($family_id) { $patient_address = family::show_address($family_id); $barangay_name = family::barangay_name($family_id); } $disease_name = notifiable::get_notifiable_disease_name($report["disease_id"]); $icd_code = notifiable_report::get_disease_icdcode($report["disease_id"]); // insert data into tcl $sql_insert = "insert into m_patient_notifiable_tcl (consult_id, patient_id, ". "patient_name, onset_date, patient_age, patient_gender, patient_address, ". "barangay_name, diagnosis, icd10) ". "values ('".$report["consult_id"]."', '".$report["patient_id"]."', ". "'".$report["patient_name"]."', '".$report["onset_date"]."', '".$report["patient_age"]."', ". "'".$report["patient_gender"]."', '$patient_address', '$barangay_name', ". "'$disease_name', '$icd_code')"; $result_insert = mysql_query($sql_insert); } // while print $sql = "select patient_name, onset_date, patient_age, patient_gender, ". "patient_address, barangay_name, diagnosis, icd10 ". "from m_patient_notifiable_tcl order by diagnosis"; $pdf = new PDF('P','pt','A4'); $pdf->SetFont('Arial','',10); $pdf->AliasNbPages(); $pdf->connect('localhost','root','kambing','game'); $attr=array('titleFontSize'=>14,'titleText'=>'NOTIFIABLE DISEASE REGISTER'); $pdf->mysql_report($sql,false,$attr, "../modules/_uploads/ntp_tcl.pdf"); header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=TCL"); } } }
function patient_info() { //print_r($_SESSION); 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); } if ($get_vars["consult_id"]) { $sql = "select p.patient_id, p.patient_lastname, p.patient_firstname, round((to_days(now())-to_days(p.patient_dob))/365 , 1) computed_age, p.patient_gender, p.patient_dob, c.see_doctor_flag ". "from m_patient p, m_consult c ". "where c.patient_id = p.patient_id and c.consult_id = '".$get_vars["consult_id"]."'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $ptinfo = mysql_fetch_array($result); } } } print "<table width='600' cellpadding='2' cellspacing='0' style='border: 2px solid black'>"; print "<tr><td colspan='2' bgcolor='#FFFFCC'>"; print "<span class='library'>".strtoupper($ptinfo["patient_lastname"].", ".$ptinfo["patient_firstname"])."</span> <br/>"; print LBL_FAMILY_NUMBER." <b>".family::search_family($ptinfo["patient_id"])."</b> "."AGE: <b>".($ptinfo["computed_age"]<1?($ptinfo["computed_age"]*12)."M":$ptinfo["computed_age"]."Y")."/".$ptinfo["patient_gender"]."</b> BIRTHDATE: <b>".$ptinfo["patient_dob"]."</b><br/>"; print "</td></tr>"; print "<tr valign='top' bgcolor='#FFFF99'><td>"; print LBL_PATIENT_ID.": <b>".module::pad_zero($ptinfo["patient_id"],7)."</b><br/>"; print LBL_TOTAL_VISITS.": <b>".$this->get_totalvisits($ptinfo["patient_id"])."</b> ".LBL_LAST_VISIT." <b>".$this->get_lastvisit($ptinfo["patient_id"])."</b><br/>"; print "</td><td> "; print "</td></tr>"; print "<tr><td colspan='2' bgcolor='#FFFF66'>"; print LBL_ELAPSED_TIME." <b>".$this->get_elapsedtime($get_vars["consult_id"])."</b> "; print "</td></tr>"; print "</table>"; }
function display_philhealth() { 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); } $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); $patient_name = patient::get_name($get_vars["patient_id"]); print "<table width='300'>"; print "<tr valign='top'><td>"; print "<b>".FTITLE_RELATIVE_PHILHEALTH_RECORD."</b><br>"; // does member have philhealth id? $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); $patient_name = patient::get_name($patient_id); $philhealth_id = philhealth::get_philhealth_id($patient_id); if (!$philhealth_id) { // try to see if any family member has a philhealth id $family_id = family::get_family_id($patient_id); $philhealth_info = philhealth::whois_philhealth_member($family_id); $patient_name = $philhealth_info["patient_lastname"].", ".$philhealth_info["patient_firstname"]; $philhealth_id = $philhealth_info["philhealth_id"]; } if ($philhealth_id && $patient_name) { print "BENEFICIARY: <b>$patient_name</b><br/>"; print "PHILHEALTH ID: <b>$philhealth_id</b><br/>"; print "EXPIRY: <b>".philhealth::get_expiry_date($philhealth_id)."</b><br/><br/>"; print "<input type='hidden' name='philhealth_id' value='$philhealth_id'/>"; } else { print "<font color='red'>No PHILHEALTH membership found.</font><br/>"; } print "</td></tr>"; print "<tr valign='top'><td>"; print "<b>".FTITLE_PHILHEALTH_RECORD."</b><br>"; print "</td></tr>"; $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); $sql = "select h.patient_id, ". "concat(p.patient_lastname, ', ',p.patient_firstname, ' ', p.patient_middle), philhealth_id, ". "expiry_date, to_days(sysdate()), to_days(expiry_date) ". "from m_patient_philhealth h, m_patient p ". "where h.patient_id = p.patient_id and h.patient_id = '$patient_id' ". "order by h.expiry_date desc"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { print "<tr valign='top'><td>"; while (list($pid, $name, $hid, $expiry, $days_sysdate, $days_expirydate) = mysql_fetch_array($result)) { print "<img src='../images/arrow_redwhite.gif' border='0'/> "; print "$name <a href='".$_SERVER["SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=DETAILS&module=philhealth&philhealth=CARD&pid=$hid'>$hid</a> ". "[EXP ".($days_expirydate<=$days_sysdate?"<font color='red'><b>$expiry</b></font>":"$expiry")."]<br/>"; } print "</td></tr>"; } else { print "<tr valign='top'><td><font color='red'>No records.</font></td></tr>"; } } print "</table><br>"; }