Exemple #1
0
    function form_consult_lab_sputum() {
        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);
        }
        echo "<a name='sputum'></a>";
        
        print "<table width='300'>";
        print "<form action = '".$_SERVER["SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&module=sputum&request_id=".$get_vars["request_id"]."&lab_id=SPT". "&ptmenu=LABS' name='form_lab' method='post'>";
        print "<tr valign='top'><td>";
        print "<b>".FTITLE_LAB_EXAM_FORM."</b><br><br>";
        print "</td></tr>";
        print "<tr valign='top'><td>";
        print "<span class='boxtitle'>".LBL_LAB_REQUEST_DETAILS."</span><br> ";
        $sql = "select lab_id, consult_id, date_format(request_timestamp, '%a %d %b %Y, %h:%i%p') request_timestamp, request_user_id, request_done, "."date_format(done_timestamp, '%a %d %b %Y, %h:%i%p') done_timestamp, done_user_id "."from m_consult_lab "."where request_id = '".$get_vars["request_id"]."'";
        if ($result = mysql_query($sql)) {
            if (mysql_num_rows($result)) {
                $lab = mysql_fetch_array($result);
                print "<table width='250' bgcolor='#FFFF99' style='border: 1px solid black'><tr><td class='tinylight'>";
                print "<b>".LBL_LAB_EXAM.":</b> ".lab::get_lab_name($lab["lab_id"])."<br/>";
                print "<b>".LBL_DATE_REQUESTED.":</b> ".$lab["request_timestamp"]."<br/>";
                print "<b>".LBL_REQUESTED_BY.":</b> ".user::get_username($lab["request_user_id"])."<br/>";
                print "<b>".LBL_DATE_PROCESSED.":</b> ".($lab["done_timestamp"]?$lab["done_timestamp"]:"NA")."<br/>";
                print "<b>".LBL_PROCESSED_BY.":</b> ".($lab["done_user_id"]?user::get_username($lab["done_user_id"]):"NA")."<br/>";
                print "</td></tr></table>";
            }
        }
        print "</td></tr>";
        print "<tr valign='top'><td>";
        if ($get_vars["request_id"]) {
            $sql_sputum = "select sp1_collection_date, sp2_collection_date, sp3_collection_date, ".
                          "sp1_appearance, sp2_appearance, sp3_appearance, ".
                          "sp1_reading, sp2_reading, sp3_reading, lab_diag1, lab_diag2, lab_diag3, lab_diagnosis, release_flag, sputum_period ".
                          "from m_consult_lab_sputum ".
                          "where request_id = '".$get_vars["request_id"]."'";
            if ($result_sputum = mysql_query($sql_sputum)) {
                if (mysql_num_rows($result_sputum)) {
                    $sputum = mysql_fetch_array($result_sputum);
                    //print_r($sputum);
                    // set up collection dates
                    if ($sputum["sp1_collection_date"]<>"0000-00-00") {
                        list($year,$month,$day) = explode("-",$sputum["sp1_collection_date"]);
                        $sp1_collection_date = "$month/$day/$year";
                    }
                    if ($sputum["sp2_collection_date"]<>"0000-00-00") {
                        list($year,$month,$day) = explode("-",$sputum["sp2_collection_date"]);
                        $sp2_collection_date = "$month/$day/$year";
                    }
                    if ($sputum["sp3_collection_date"]<>"0000-00-00") {
                        list($year,$month,$day) = explode("-",$sputum["sp3_collection_date"]);
                        $sp3_collection_date = "$month/$day/$year";
                    }
                }
            }
        }
        print "<table width='250' style='border: 1px dotted black'>";
        print "<tr><td class='boxtitle'>".LBL_SPECIMEN."</td><td class='boxtitle'>#1</td><td class='boxtitle'>#2</td><td class='boxtitle'>#3</td></tr>";
        print "<tr><td class='boxtitle'nowrap>".LBL_COLLECTION_DATE."</td>";
        print "<td>";
        print "<input type='text' size='10' class='tinylight' name='sp1_collection_date' value='".($sp1_collection_date?$sp1_collection_date:$post_vars["sp1_collection_date"])."' style='border: 1px solid #000000'> ";
        print "<a href=\"javascript:show_calendar4('document.form_lab.sp1_collection_date', document.form_lab.sp1_collection_date.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a> ";
        print "</td><td>";
        print "<input type='text' size='10' class='tinylight' name='sp2_collection_date' value='".($sp2_collection_date?$sp2_collection_date:$post_vars["sp2_collection_date"])."' style='border: 1px solid #000000'> ";
        print "<a href=\"javascript:show_calendar4('document.form_lab.sp2_collection_date', document.form_lab.sp2_collection_date.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a> ";
        print "</td><td>";
        print "<input type='text' size='10' class='tinylight' name='sp3_collection_date' value='".($sp3_collection_date?$sp3_collection_date:$post_vars["sp3_collection_date"])."' style='border: 1px solid #000000'> ";
        print "<a href=\"javascript:show_calendar4('document.form_lab.sp3_collection_date', document.form_lab.sp3_collection_date.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a> ";
        print "</td>";
        print "</tr>";
        print "<tr><td class='boxtitle'nowrap>".LBL_VISUAL_APPEARANCE."</td>";
        print "<td>".sputum::show_sputum_appearance(($sputum["sp1_appearance"]?$sputum["sp1_appearance"]:$post_vars["sp1_appearance"]),'sp1_appearance')."</td>";
        print "<td>".sputum::show_sputum_appearance(($sputum["sp2_appearance"]?$sputum["sp2_appearance"]:$post_vars["sp2_appearance"]),'sp2_appearance')."</td>";
        print "<td>".sputum::show_sputum_appearance(($sputum["sp3_appearance"]?$sputum["sp3_appearance"]:$post_vars["sp3_appearance"]),'sp3_appearance')."</td>";
        	        
        print "</tr>";

	print "<tr><td class='boxtitle'>SPUTUM EXAM RESULT</td>";
	print sputum::show_sputum_dropdown('lab_diag1',$sputum["lab_diag1"]);
        print sputum::show_sputum_dropdown('lab_diag2',$sputum["lab_diag2"]);
        print sputum::show_sputum_dropdown('lab_diag3',$sputum["lab_diag3"]);
	print "</tr>";

        print "<tr><td class='boxtitle'>".LBL_READING."</td>";
        print "<td>".sputum::show_sputum_reading(($sputum["sp1_reading"]?$sputum["sp1_reading"]:$post_vars["sp1_reading"]),'sp1_reading')."</td>";
        print "<td>".sputum::show_sputum_reading(($sputum["sp2_reading"]?$sputum["sp2_reading"]:$post_vars["sp2_reading"]),'sp2_reading')."</td>";
        print "<td>".sputum::show_sputum_reading(($sputum["sp3_reading"]?$sputum["sp3_reading"]:$post_vars["sp3_reading"]),'sp3_reading')."</td>";
        print "</tr>";
        print "<tr><td class='boxtitle'>".LBL_SPUTUM_PERIOD."</td>";
        print "<td colspan='3'>";
        print sputum::show_sputum_period(($sputum["sputum_period"]?$sputum["sputum_period"]:$post_vars["sputum_period"]));
        print "</td>";
        print "</tr>";
        print "<tr><td class='boxtitle'>FINAL ".LBL_LAB_DIAGNOSIS."</td>";
        print "<td colspan='3'>";
        print "<select name='lab_diagnosis' class='tinylight'>";
        print "<option value=''>Select Diagnosis</option>";
        print "<option value='P' ".(($sputum["lab_diagnosis"]?$sputum["lab_diagnosis"]:$post_vars["lab_diagnosis"])=="P"?"selected":"").">Positive</option>";
        print "<option value='N' ".(($sputum["lab_diagnosis"]?$sputum["lab_diagnosis"]:$post_vars["lab_diagnosis"])=="N"?"selected":"").">Negative</option>";
        print "<option value='D' ".(($sputum["lab_diagnosis"]?$sputum["lab_diagnosis"]:$post_vars["lab_diagnosis"])=="D"?"selected":"").">Doubtful</option>";
        print "</select>";
        print "</td>";
        print "</tr>";
        print "</table>";
        print "</td></tr>";
        print "<tr valign='top'><td>";
        print "<span class='boxtitle'>".LBL_RELEASE_FLAG."</span><br> ";
        print "<input type='checkbox' name='release_flag' ".(($sputum["release_flag"]?$sputum["release_flag"]:$post_vars["release_flag"])=="Y"?"checked":"")." value='1'/> ".INSTR_RELEASE_FLAG."<br />";
        print "</td></tr>";
        print "<tr><td align='center'>";
        if ($get_vars["request_id"]) {
            print "<input type='hidden' name='request_id' value='".$get_vars["request_id"]."'>";
            if ($_SESSION["priv_update"]) {
                print "<input type='submit' value = 'Update Lab Exam' class='textbox' name='submitlab' style='border: 1px solid #000000'> ";
            }
            if ($_SESSION["priv_delete"]) {
                print "<input type='submit' value = 'Delete Lab Exam' class='textbox' name='submitlab' style='border: 1px solid #000000'> ";
            }
        }
        print "</td></tr>";
        print "</form>";
        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");
         }
     }
 }
Exemple #3
0
	}
}
if (file_exists('../modules/smoking/class.smoking.php')) {
	include '../modules/smoking/class.smoking.php';
	$smoking = new smoking;
	if (!$module->activated('smoking') && $initmod) {
		$smoking->init_sql();
		$smoking->init_menu();
		$smoking->init_deps();
		$smoking->init_lang();
		$smoking->init_help();
	}
}
if (file_exists('../modules/sputum/class.sputum.php')) {
	include '../modules/sputum/class.sputum.php';
	$sputum = new sputum;
	if (!$module->activated('sputum') && $initmod) {
		$sputum->init_sql();
		$sputum->init_menu();
		$sputum->init_deps();
		$sputum->init_lang();
		$sputum->init_help();
	}
}
if (file_exists('../modules/tcl/class.tcl.php')) {
	include '../modules/tcl/class.tcl.php';
	$tcl = new tcl;
	if (!$module->activated('tcl') && $initmod) {
		$tcl->init_sql();
		$tcl->init_menu();
		$tcl->init_deps();