Beispiel #1
0
 function display_ntp_record_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);
     }
     // manage Delete here
     if ($post_vars["submitntp"] && $get_vars["ntp_id"]) {
         if ($post_vars["submitntp"] == "Delete") {
             if (module::confirm_delete($menu_id, $post_vars, $get_vars)) {
                 print $sql = "delete from m_patient_ntp where ntp_id = '" . $get_vars["ntp_id"] . "'";
                 if ($result = mysql_query($sql)) {
                     header("location: " . $_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"] . "&ntp=VISIT1");
                 }
             } else {
                 if ($post_vars["confirm_delete"] == "No") {
                     header("location: " . $_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"] . "&ntp=VISIT1");
                 }
             }
         }
     }
     $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]);
     $consult_date = healthcenter::get_consult_date($get_vars["consult_id"]);
     $sql = "select patient_id, date_format(ntp_consult_date, '%a %d %b %Y, %h:%i%p') ntp_consult_date, date_format(ntp_timestamp, '%a %d %b %Y, %h:%i%p') ts, ntp_id, user_id, " . "occupation_id, household_contacts, region_id, body_weight, bcg_scar, " . "previous_treatment_flag, previous_treatment_duration, previous_treatment_drugs, " . "patient_type_id, outcome_id, treatment_partner_id, treatment_category_id, contact_person, course_end_flag, " . "intensive_start_date, maintenance_start_date, treatment_end_date, " . "sputum1_date, sputum2_date, sputum3_date, " . "intensive_projected_end_date, maintenance_projected_end_date, " . "to_days('{$consult_date}') days_consult_date, " . "to_days(intensive_projected_end_date) days_proj_int_end, " . "to_days(maintenance_projected_end_date) days_proj_maint_end, " . "to_days(sputum1_date) days_sputum1_date, " . "to_days(sputum2_date) days_sputum2_date, " . "to_days(sputum3_date) days_sputum3_date " . "from m_patient_ntp " . "where ntp_id = '" . $get_vars["ntp_id"] . "'";
     if ($result = mysql_query($sql)) {
         if (mysql_num_rows($result)) {
             while ($ntpdata = mysql_fetch_array($result)) {
                 print "<table width='250' style='border: 1px dotted black'>";
                 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=DETAILS&module=ntp&ntp=INTAKE&ntp_id=" . $get_vars["ntp_id"] . "'>";
                 print "<tr><td>";
                 print "<span class='tinylight'>";
                 print "Patient Name: " . strtoupper(patient::get_name($ntpdata["patient_id"])) . "<br/>";
                 print "Registration Date: " . $ntpdata["ntp_consult_date"] . "<br/>";
                 print "Last Update: " . $ntpdata["ts"] . "<br/>";
                 print "Updated By: " . user::get_username($ntpdata["user_id"]) . "<br/>";
                 print "<hr size='1'/>";
                 print "IMPORTANT DATES:<br/>";
                 print "Start Intensive Phase: " . ($ntpdata["intensive_start_date"] != "0000-00-00" ? $ntpdata["intensive_start_date"] : "NA") . "<br/>";
                 print "Start Maintenance Phase: " . ($ntpdata["maintenance_start_date"] != "0000-00-00" ? $ntpdata["maintenance_start_date"] : "NA") . "<br/>";
                 print "End of Treatment: " . ($ntpdata["maintenance_start_date"] != "0000-00-00" ? $ntpdata["maintenance_start_date"] : "NA") . "<br/><br/>";
                 print "PROJECTED DATES:<br/>";
                 print "Proj End Intensive Phase: " . ($ntpdata["intensive_projected_end_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_proj_int_end"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["intensive_projected_end_date"] . "</font>" : $ntpdata["intensive_projected_end_date"])) . "<br/>";
                 print "Proj End Maint Phase: " . ($ntpdata["maintenance_projected_end_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_proj_maint_end"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["maintenance_projected_end_date"] . "</font>" : $ntpdata["maintenance_projected_end_date"])) . "<br/>";
                 if ($ntpdata["treatment_category"] == 3) {
                     print "Sputum Exam #1 Date: " . ($ntpdate["sputum1_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_sputum1_date"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["sputum1_date"] . "</font>" : $ntpdata["sputum1_date"])) . "<br/>";
                 } else {
                     print "Sputum Exam #1 Date: " . ($ntpdate["sputum1_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_sputum1_date"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["sputum1_date"] . "</font>" : $ntpdata["sputum1_date"])) . "<br/>";
                     print "Sputum Exam #2 Date: " . ($ntpdate["sputum2_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_sputum2_date"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["sputum2_date"] . "</font>" : $ntpdata["sputum2_date"])) . "<br/>";
                     print "Sputum Exam #3 Date: " . ($ntpdate["sputum3_date"] == "0000-00-00" ? "NA" : ($ntpdata["days_sputum3_date"] <= $ntpdata["days_consult_date"] ? "<font color='red'>" . $ntpdata["sputum3_date"] . "</font>" : $ntpdata["sputum3_date"])) . "<br/>";
                 }
                 print "<hr size='1'/>";
                 print "Occupation: " . occupation::get_occupation_name($ntpdata["occupation_id"]) . "<br/>";
                 print "Contact Person: " . $ntpdata["contact_person"] . "<br/>";
                 print "Region: " . region::get_region_name($ntpdata["region_id"]) . "<br/>";
                 print "<hr size='1'/>";
                 print "BCG Scar: " . ($ntpdata["bcg_scar"] == "D" ? "Doubtful" : $ntpdata["bcg_scar"]) . "<br/>";
                 print "Household Contacts: " . $ntpdata["household_contacts"] . " " . ($ntpdata["household_contacts"] == 1 ? "person" : "persons") . "<br/>";
                 print "Previous Treatment? " . $ntpdata["previous_treatment_flag"] . "<br/>";
                 if ($ntpdata["previous_treatment_flag"] == "Y") {
                     print "<span class='tinylight'>";
                     print "&nbsp;&nbsp;Drugs: " . $ntpdata["previous_treatment_drugs"] . "<br/>";
                     print "&nbsp;&nbsp;Duration: " . ($ntpdata["previous_treatment_duration"] == "M1" ? ">1 month" : "<1 month") . "<br/>";
                     print "</span>";
                 }
                 print "Patient Type: " . ntp::get_patient_type($ntpdata["patient_type_id"]) . "<br/>";
                 print "Tx Category: " . ntp::get_treatment_cat($ntpdata["treatment_category_id"]) . "<br/>";
                 print "Tx Outcome: " . ntp::get_treatment_outcome($ntpdata["outcome_id"]) . "<br/>";
                 print "Tx Partner: " . ntp::get_partner_name($ntpdata["treatment_partner_id"]) . "<br/>";
                 if ($_SESSION["priv_delete"]) {
                     if ($ntpdata["course_end_flag"] != "Y") {
                         print "<input type='submit' class='tinylight' name='submitntp' value='Delete' style='border: 1px solid black'/>";
                     }
                 }
                 print "</span>";
                 print "</td></tr>";
                 print "</form>";
                 print "</table>";
             }
         }
     }
 }