function _graph_form() { $pxid = healthcenter::get_patient_id($_GET["consult_id"]); $this->form_graph(); if ($_POST["submit_graph"]) { $_SESSION["graph_details"] = $this->arr_graph[$_POST["sel_graph"]]; $_SESSION["indicator"] = $_POST["sel_graph"]; unset($_SESSION["ydata"]); $this->process_graph($_POST["sel_graph"], $pxid); echo "<img src='../site/draw_graph.php?consult_id={$_GET['consult_id']}' alt=''></img><br>"; } }
function _consult_lab_urinalysis() { 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]; } if ($exitinfo = $this->missing_dependencies('urinalysis')) { return print $exitinfo; } $u = new urinalysis(); if ($_POST["submitlab"]) { //print_r($_POST); $q_request = mysql_query("SELECT request_id FROM m_consult_lab_urinalysis WHERE request_id='{$_POST['request_id']}'") or die("Cannot query 94:" . mysql_error()); if ($_POST["release_flag"] == 1) { $release = 'Y'; $release_date = date('Y-m-d H:i:s'); $q_update_lab = mysql_query("UPDATE m_consult_lab SET request_done='{$release}',done_timestamp='{$release_date}',done_user_id='{$_SESSION['userid']}' WHERE request_id='{$_POST['request_id']}' AND lab_id='{$_GET['lab_id']}'") or die("Cannot query 99" . mysql_error()); } else { $release = 'N'; $release_date = ''; } $pxid = healthcenter::get_patient_id($_GET[consult_id]); list($m, $d, $y) = explode('/', $_POST[urinalysis_date]); $date_lab_exam = $y . '-' . $m . '-' . $d; if (mysql_num_rows($q_request) != 0) { $update_urinalysis = mysql_query("UPDATE m_consult_lab_urinalysis SET consult_id='{$_GET['consult_id']}',patient_id='{$pxid}',date_lab_exam='{$date_lab_exam}',physical_color='{$_POST['sel_color']}',physical_reaction='{$_POST['sel_reaction']}',physical_transparency='{$_POST['sel_transparency']}',physical_gravity='{$_POST['sel_gravity']}',physical_ph='{$_POST['sel_ph']}',chem_albumin='{$_POST['sel_albumin']}',chem_sugar='{$_POST['sel_sugar']}',chem_pregnancy='{$_POST['sel_pregnancy']}',sediments_rbc='{$_POST['txt_red']}',sediments_pus='{$_POST['txt_pus']}',sediments_epithelial='{$_POST['txt_epithelial']}',sediments_urates='{$_POST['txt_amorphous']}',sediments_calcium='{$_POST['txt_calcium_oxelates']}',sediments_fat='{$_POST['txt_fat']}',sediments_phosphate='{$_POST['txt_triple']}',sediments_uric='{$_POST['txt_uric']}',sediments_amorphous='{$_POST['txt_amorphouse_phosphate']}',sediments_carbonates='{$_POST['txt_calcium_carb']}',sediments_bacteria='{$_POST['txt_bacteria']}',sediments_mucus='{$_POST['txt_mucus']}',cast_coarsely='{$_POST['txt_granular']}',cast_pus='{$_POST['txt_pus_cast']}',cast_hyaline='{$_POST['txt_hyaline']}',cast_finely='{$_POST['txt_finely_cast']}',cast_redcell='{$_POST['txt_red_cell']}',cast_waxy='{$_POST['txt_wax']}',release_flag='{$release}',release_date='{$release_date}',user_id='{$_SESSION['userid']}' WHERE request_id='{$_POST['request_id']}'") or die("Cannot query 114" . mysql_error()); //update the db contents of urinalysis form } else { $update_urinalysis = mysql_query("INSERT INTO m_consult_lab_urinalysis SET consult_id='{$_GET['consult_id']}',request_id='{$_POST['request_id']}',patient_id='{$pxid}',date_lab_exam='{$date_lab_exam}',physical_color='{$_POST['sel_color']}',physical_reaction='{$_POST['sel_reaction']}',physical_transparency='{$_POST['sel_transparency']}',physical_gravity='{$_POST['sel_gravity']}',physical_ph='{$_POST['sel_ph']}',chem_albumin='{$_POST['sel_albumin']}',chem_sugar='{$_POST['sel_sugar']}',chem_pregnancy='{$_POST['sel_pregnancy']}',sediments_rbc='{$_POST['txt_red']}',sediments_pus='{$_POST['txt_pus']}',sediments_epithelial='{$_POST['txt_epithelial']}',sediments_urates='{$_POST['txt_amorphous']}',sediments_calcium='{$_POST['txt_calcium_oxelates']}',sediments_fat='{$_POST['txt_fat']}',sediments_phosphate='{$_POST['txt_triple']}',sediments_uric='{$_POST['txt_uric']}',sediments_amorphous='{$_POST['txt_amorphouse_phosphate']}',sediments_carbonates='{$_POST['txt_calcium_carb']}',sediments_bacteria='{$_POST['txt_bacteria']}',sediments_mucus='{$_POST['txt_mucus']}',cast_coarsely='{$_POST['txt_granular']}',cast_pus='{$_POST['txt_pus_cast']}',cast_hyaline='{$_POST['txt_hyaline']}',cast_finely='{$_POST['txt_finely_cast']}',cast_redcell='{$_POST['txt_red_cell']}',cast_waxy='{$_POST['txt_wax']}',release_flag='{$release}',release_date='{$release_date}',user_id='{$_SESSION['userid']}'") or die("Cannot query 116" . mysql_error()); //insert into the db the contents of urinalysis form } if ($update_urinalysis) { echo "<script language='Javascript'>"; echo "window.alert('Urinalysis data was successfully been saved.')"; echo "</script>"; } } $u->form_consult_lab_urinalysis($menu_id, $post_vars, $get_vars); }
function _consult_lab_hematology() { 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]; } if ($exitinfo = $this->missing_dependencies('hematology')) { return print $exitinfo; } //print_r($); $h = new hematology(); if ($_POST["submitlab"] == 'Update Lab Exam') { $q_request = mysql_query("SELECT request_id FROM m_consult_lab_hematology WHERE request_id='{$_POST['request_id']}'") or die("Cannot query 94:" . mysql_error()); if ($_POST["release_flag"] == 1) { $release = 'Y'; $release_date = date('Y-m-d H:i:s'); $q_update_lab = mysql_query("UPDATE m_consult_lab SET request_done='{$release}',done_timestamp='{$release_date}',done_user_id='{$_SESSION['userid']}' WHERE request_id='{$_POST['request_id']}'") or die("Cannot query 99" . mysql_error()); } else { $release = 'N'; $release_date = ''; } $pxid = healthcenter::get_patient_id($_GET[consult_id]); list($m, $d, $y) = explode('/', $_POST[hematology_date]); $date_lab_exam = $y . '-' . $m . '-' . $d; if (mysql_num_rows($q_request) != 0) { $update_hematology = mysql_query("UPDATE m_consult_lab_hematology SET consult_id='{$_GET['consult_id']}',request_id='{$_POST['request_id']}',patient_id='{$pxid}',date_lab_exam='{$date_lab_exam}',hemoglobin='{$_POST['txt_hemoglobin']}',hematocrit='{$_POST['txt_hemocrit']}',rbc='{$_POST['txt_rbc']}',rbc_mcv='{$_POST['txt_mcv']}',rbc_mchc='{$_POST['txt_mchc']}',rbc_mch='{$_POST['txt_mch']}',wbc='{$_POST['txt_wbc']}',wbc_polys='{$_POST['txt_polys']}',wbc_lympho='{$_POST['txt_lympho']}',wbc_mxd='{$_POST['txt_mxd']}',wbc_mono='{$_POST['txt_mono']}',wbc_eosin='{$_POST['txt_eosin']}',wbc_baso='{$_POST['txt_baso']}',platelet='{$_POST['txt_platelet']}',reticulocytes='{$_POST['txt_reticulocytes']}',esr='{$_POST['txt_esr']}',clotting_time='{$_POST['txt_clot']}',bleeding_time='{$_POST['txt_bleeding']}',malaria='{$_POST['txt_malaria']}',slit_smear='{$_POST['txt_slit_smear']}',fbs='{$_POST['txt_fbs']}',blood_type='{$_POST['sel_bloodtype']}',release_flag='{$release}',release_date='{$release_date}',user_id='{$_SESSION['userid']}',others='{$_POST['txt_others']}',rh='{$_POST['sel_rh']}',stabs='{$_POST['txt_stabs']}' WHERE request_id='{$_GET['request_id']}'") or die("Cannot query 99: " . mysql_error()); } else { $update_hematology = mysql_query("INSERT INTO m_consult_lab_hematology SET consult_id='{$_GET['consult_id']}',request_id='{$_POST['request_id']}',patient_id='{$pxid}',date_lab_exam='{$date_lab_exam}',hemoglobin='{$_POST['txt_hemoglobin']}',hematocrit='{$_POST['txt_hemocrit']}',rbc='{$_POST['txt_rbc']}',rbc_mcv='{$_POST['txt_mcv']}',rbc_mchc='{$_POST['txt_mchc']}',rbc_mch='{$_POST['txt_mch']}',wbc='{$_POST['txt_wbc']}',wbc_polys='{$_POST['txt_polys']}',wbc_lympho='{$_POST['txt_lympho']}',wbc_mxd='{$_POST['txt_mxd']}',wbc_mono='{$_POST['txt_mono']}',wbc_eosin='{$_POST['txt_eosin']}',wbc_baso='{$_POST['txt_baso']}',platelet='{$_POST['txt_platelet']}',reticulocytes='{$_POST['txt_reticulocytes']}',esr='{$_POST['txt_esr']}',clotting_time='{$_POST['txt_clot']}',bleeding_time='{$_POST['txt_bleeding']}',malaria='{$_POST['txt_malaria']}',slit_smear='{$_POST['txt_slit_smear']}',fbs='{$_POST['txt_fbs']}',blood_type='{$_POST['sel_bloodtype']}',release_flag='{$release}',release_date='{$release_date}',user_id='{$_SESSION['userid']}',others='{$_POST['txt_others']}',rh='{$_POST['sel_rh']}',stabs='{$_POST['txt_stabs']}'") or die("Cannot query 102: " . mysql_error()); } //print_r($_POST); if ($update_hematology) { echo "<script language='Javascript'>"; echo "window.alert('Hematology data was successfully been saved.')"; echo "</script>"; } } $h->form_consult_lab_hematology($menu_id, $post_vars, $get_vars); }
function form_ntp_import() { if (func_num_args() > 0) { $arg_list = func_num_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; } $pxid = healthcenter::get_patient_id($_GET["consult_id"]); $q_ntp = mysql_query("SELECT request_id,sp1_collection_date,sp2_collection_date,sp3_collection_date,sp1_reading,sp2_reading,sp3_reading FROM m_consult_lab_sputum WHERE patient_id='{$pxid}' ORDER by sp1_collection_date DESC") or die("Cannot query: 3366 " . mysql_error()); //$q_ntp = mysql_query("SELECT DISTINCT a.request_id,a.sp1_collection_date,a.sp2_collection_date,a.sp3_collection_date,a.sp1_reading,a.sp2_reading,a.sp3_reading FROM m_consult_lab_sputum a, m_consult_ntp_labs_request b WHERE a.patient_id='$pxid' AND a.request_id<>b.request_id ORDER by sp1_collection_date DESC") or die("Cannot query: 3366 ".mysql_error()); if (mysql_num_rows($q_ntp) != 0) { echo "<form action='{$_SERVER['PHP_SELF']}?page={$_GET['page']}&menu_id={$_GET['menu_id']}&consult_id={$_GET['consult_id']}&ptmenu={$_GET['ptmenu']}&module={$_GET['module']}&ntp={$_GET['ntp']}&ntp_id={$_GET['ntp_id']}' method='POST'>"; echo "<table bgcolor='#5CB3FF'><tr><td class='tb_table_header'><b>IMPORT SPUTUM TEST</b></td></tr>"; echo "<tr><td>"; echo "<p class='boxtitle'>The following are sputum tests done for the patient yet need to be imported</p>"; echo "<select name='sel_import_ntp' size='1'>"; echo "<option value=''>Select Sputum Test</option>"; while (list($request_id, $sp1, $sp2, $sp3, $sp1_read, $sp2_read, $sp3_read) = mysql_fetch_array($q_ntp)) { $q_ntp_req = mysql_query("SELECT ntp_id, request_id FROM m_consult_ntp_labs_request WHERE request_id ='{$request_id}'") or die("Cannot query 3373: " . mysql_error()); if (mysql_num_rows($q_ntp_req) == 0) { $q_symp = mysql_query("SELECT symptomatic_id FROM m_consult_ntp_symptomatics WHERE sputum_diag1='{$request_id}' AND patient_id='{$pxid}'") or die("Cannot query 3393 " . mysql_error()); $q_symp2 = mysql_query("SELECT symptomatic_id FROM m_consult_ntp_symptomatics WHERE sputum_diag2='{$request_id}' AND patient_id='{$pxid}'") or die("Cannot query 3393 " . mysql_error()); if (mysql_num_rows($q_symp) == 0 && mysql_num_rows($q_symp2) == 0) { echo "<option value='{$request_id}'>(1){$sp1}({$sp1_read}), (2){$sp2}({$sp2_read}), (3){$sp3}({$sp3_read})</option>"; } } } echo "</select>"; echo "<input type='submit' name='submitntp' value='Import Sputum Test' style='border: 1px solid #000000'></input>"; echo "</form>"; echo "</td></tr>"; echo "</table>"; echo "<br>"; } else { } }
function show_visitdetails() { // // data shown on the right side when DETAILS is clicked // 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"]); print "<b>".FTITLE_PATIENT_GROUP."</b><br/>"; if ($get_vars["deletets"] && $get_vars["deletegroup"]) { if (module::confirm_delete($menu_id, $post_vars, $get_vars)) { $sql_delete = "delete from m_consult_ptgroup where consult_id = '".$get_vars["consult_id"]."' and ptgroup_timestamp = '".$get_vars["deletets"]."' and ptgroup_id = '".$get_vars["deletegroup"]."'"; if ($result_delete = mysql_query($sql_delete)) { header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=DETAILS"); } } 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=DETAILS"); } } } $sql_ptgroup = "select g.ptgroup_name, g.ptgroup_module, c.ptgroup_timestamp, c.ptgroup_id from m_consult_ptgroup c, m_lib_ptgroup g ". "where g.ptgroup_id = c.ptgroup_id and c.consult_id = '".$get_vars["consult_id"]."'"; if ($result = mysql_query($sql_ptgroup)) { if (mysql_num_rows($result)) { while (list($name, $mod, $ts, $grp) = mysql_fetch_array($result)) { print "<img src='../images/arrow_redwhite.gif' border='0'/> <a href='".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=".$get_vars["ptmenu"]."&module=$mod'>$name</a> "; print "<a href='".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=DETAILS&deletets=$ts&deletegroup=$grp'><img src='../images/delete.png' border='0'/></a><br/>"; } } else { print "<font color='red'>none</font><br/>"; } } print "<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 = '$patient_id' ". "group by c.ptgroup_id"; if ($result = mysql_query($sql_ptgroup)) { if (mysql_num_rows($result)) { print "<span class='tinylight'>"; 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/> "; } print "</span>"; } else { print "<font color='red'>No records.</font><br/>"; } } /* print "<br/>"; print "<b>".FTITLE_CONSULT_COMPLAINTS."</b><br/>"; // process delete here if ($get_vars["deletets"] && $get_vars["deletecomplaint"]) { if (module::confirm_delete($menu_id, $post_vars, $get_vars)) { $sql_delete = "delete from m_consult_complaint where consult_id = '".$get_vars["consult_id"]."' and complaint_timestamp = '".$get_vars["deletets"]."' and complaint_id = '".$get_vars["deletecomplaint"]."'"; if ($result_delete = mysql_query($sql_delete)) { header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=DETAILS"); } } 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=DETAILS"); } } } $sql_complaint = "select l.complaint_name, l.complaint_module, c.complaint_timestamp, c.complaint_id from m_consult_complaint c, m_lib_complaint l ". "where l.complaint_id = c.complaint_id and c.consult_id = '".$get_vars["consult_id"]."'"; if ($result = mysql_query($sql_complaint)) { if (mysql_num_rows($result)) { while (list($name, $mod, $ts, $comp) = mysql_fetch_array($result)) { print "<img src='../images/arrow_redwhite.gif' border='0'/> <a href='".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=".$get_vars["ptmenu"]."&module=$mod'>$name</a> "; print "<a href='".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=DETAILS&deletets=$ts&deletecomplaint=$comp'><img src='../images/delete.png' border='0'/></a><br/>"; } } else { print "<font color='red'>none</font><br/>"; } } */ print "<br/>"; print "<b>".FTITLE_CONSULT_MODULES."</b><br/>"; $sql_modules = "select m.module_desc, h.module_id ". "from m_healthcenter_modules h, modules m ". "where h.module_id = m.module_id"; if ($result = mysql_query($sql_modules)) { if (mysql_num_rows($result)) { while (list($desc, $mod) = mysql_fetch_array($result)) { // remove the CHITS prefix $desc = ereg_replace("CHITS ","", $desc); print "<img src='../images/arrow_redwhite.gif' border='0'/> <a href='".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=DETAILS&module=$mod'>$desc</a><br/> "; } } else { print "<font color='red'>none</font><br/>"; } } print "<br/>"; }
function process_consult_notes() { 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"]); $consult_date = healthcenter::get_consult_date($get_vars["consult_id"]); switch($post_vars["submitnotes"]) { case "Create Notes": $sql = "insert into m_consult_notes (consult_id, patient_id, user_id, notes_timestamp) ". "values ('".$get_vars["consult_id"]."', '$patient_id', '".$_SESSION["userid"]."', sysdate())"; if ($result = mysql_query($sql)) { $insert_id = mysql_insert_id(); header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=NOTES&module=notes¬es=NOTES¬es_id=$insert_id"); } break; case "Save Complaint": if ($post_vars["complaintcat"]) { foreach ($post_vars["complaintcat"] as $key=>$value) { $sql = "insert into m_consult_notes_complaint (notes_id, consult_id, patient_id, complaint_id, complaint_date, user_id, complaint_timestamp) ". "values ('".$get_vars["notes_id"]."', '".$get_vars["consult_id"]."', '$patient_id', '$value', '$consult_date', '".$_SESSION["userid"]."', sysdate())"; $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=NOTES&module=notes¬es=CC¬es_id=".$get_vars["notes_id"]); } break; case "Save History": if ($post_vars["history_text"]) { $sql = "update m_consult_notes set ". "notes_history = '".addslashes($post_vars["history_text"])."' ". "where notes_id = '".$get_vars["notes_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=NOTES&module=notes¬es=HX¬es_id=".$get_vars["notes_id"]); } } break; case "Save PE": if ($post_vars["pe_text"]) { $sql = "update m_consult_notes set ". "notes_physicalexam = '".addslashes($post_vars["pe_text"])."' ". "where notes_id = '".$get_vars["notes_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=NOTES&module=notes¬es=PE¬es_id=".$get_vars["notes_id"]); } } break; case "Save Diagnosis Class": if ($post_vars["dxclass"]) { foreach($post_vars["dxclass"] as $key=>$value) { $sql = "insert into m_consult_notes_dxclass (notes_id, consult_id, patient_id, class_id, diagnosis_date, user_id, diagnosis_timestamp) ". "values ('".$get_vars["notes_id"]."', '".$get_vars["consult_id"]."', '$patient_id', '$value', '$consult_date', '".$_SESSION["userid"]."', sysdate())"; $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=NOTES&module=notes¬es=DX¬es_id=".$get_vars["notes_id"]); } break; case "Save Plan": if ($post_vars["plan_text"]) { $sql = "update m_consult_notes set ". "notes_plan = '".addslashes($post_vars["plan_text"])."' ". "where notes_id = '".$get_vars["notes_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=NOTES&module=notes¬es=TX¬es_id=".$get_vars["notes_id"]); } } break; } }
function process_send_request() { 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"]); switch ($post_vars["submitlab"]) { case "Send Request": mysql_query("ALTER TABLE `m_consult_lab` DROP PRIMARY KEY, ADD PRIMARY KEY(`request_id`)"); if ($post_vars["lab_exam"]) { foreach ($post_vars["lab_exam"] as $key => $value) { $sql = "insert into m_consult_lab (consult_id, patient_id, lab_id, request_timestamp, request_user_id) " . "values ('" . $get_vars["consult_id"] . "', '{$patient_id}', '{$value}', sysdate(), '" . $_SESSION["userid"] . "')"; 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"]); } } } break; case "Print Referral": break; case "Edit Lab Exam": $q_lab = mysql_query("UPDATE m_consult_lab SET request_done='N' WHERE request_id='{$_GET['request_id']}'") or die("Cannot query: 362 " . mysql_error()); break; case "Print Lab Result": header("Location: ../chits_query/pdf_reports/lab_result.php"); break; default: break; } }
function process_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); } //print_r($arg_list); if ($post_vars["submitlab"]) { $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); switch($post_vars["submitlab"]) { case "Update Lab Exam": // enforce transaction // specimen 1 if ($post_vars["sp1_collection_date"]) { list($month,$day,$year) = explode("/", $post_vars["sp1_collection_date"]); $sp1_collection_date = $year."-".str_pad($month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT); } // specimen 2 if ($post_vars["sp2_collection_date"]) { list($month,$day,$year) = explode("/", $post_vars["sp2_collection_date"]); $sp2_collection_date = $year."-".str_pad($month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT); } // specimen 3 if ($post_vars["sp3_collection_date"]) { list($month,$day,$year) = explode("/", $post_vars["sp3_collection_date"]); $sp3_collection_date = $year."-".str_pad($month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT); } $release_flag = ($post_vars["release_flag"]?"Y":"N"); mysql_query("SET autocommit=0;") or die(mysql_error()); mysql_query("START TRANSACTION;") or die(mysql_error()); if ($release_flag=="Y") { if(empty($_POST["lab_diagnosis"])): echo "<script language='Javascript'>"; echo "window.alert('Cannot close / release sputum exam yet. Please indicate LAB DIAGNOSIS!')"; echo "</script>"; elseif(empty($_POST["sputum_period"])): echo "<script language='Javascript'>"; echo "window.alert('Cannot close / release sputum exam yet. Please indicate PERIOD OF SPUTUM EXAMS!')"; echo "</script>"; else: $sql = "update m_consult_lab set ". "done_timestamp = sysdate(), ". "request_done = 'Y', ". "done_user_id = '".$_SESSION["userid"]."' ". "where request_id = '".$post_vars["request_id"]."'"; if ($result = mysql_query($sql)) { // successful.. so just go to next SQL statement in // transaction set } else { mysql_query("ROLLBACK;") or die(mysql_error()); mysql_query("SET autocommit=1;") or die(mysql_error()); header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&module=".$get_vars["module"]."&request_id=".$post_vars["request_id"]."&lab_id=".$get_vars["lab_id"]."&ptmenu=LABS"); } endif; } // try insert first, will fail if previous request has been inserted // because of primary key constraint - then it will cascade to update below... $sql_sputum = "insert into m_consult_lab_sputum (consult_id, request_id, patient_id, ". "lab_timestamp, 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, sputum_period, ". "user_id, release_flag) values ('".$get_vars["consult_id"]."', '".$post_vars["request_id"]."', ". "'$patient_id', sysdate(), '$sp1_collection_date', '$sp2_collection_date', '$sp3_collection_date', ". "'".$post_vars["sp1_appearance"]."', '".$post_vars["sp2_appearance"]."', '".$post_vars["sp3_appearance"]."', ". "'".$post_vars["sp1_reading"]."', '".$post_vars["sp2_reading"]."', '".$post_vars["sp3_reading"]."', ". "'".$post_vars["lab_diag1"]."', '".$post_vars["lab_diag2"]."', '".$post_vars["lab_diag3"]."', ". "'".$post_vars["lab_diagnosis"]."', '".$post_vars["sputum_period"]."', '".$_SESSION["userid"]."', '$release_flag')"; if ($result_sputum = mysql_query($sql_sputum)) { mysql_query("COMMIT;") or die(mysql_error()); mysql_query("SET autocommit=1;") or die(mysql_error()); //header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&module=".$get_vars["module"]."&request_id=".$get_vars["request_id"]."&lab_id=".$get_vars["lab_id"]."&ptmenu=LABS"); } else { $sql_update = "update m_consult_lab_sputum set ". "lab_timestamp = sysdate(), ". "sp1_collection_date = '$sp1_collection_date', ". "sp2_collection_date = '$sp2_collection_date', ". "sp3_collection_date = '$sp3_collection_date', ". "sp1_appearance = '".$post_vars["sp1_appearance"]."', ". "sp2_appearance = '".$post_vars["sp2_appearance"]."', ". "sp3_appearance = '".$post_vars["sp3_appearance"]."', ". "sp1_reading = '".$post_vars["sp1_reading"]."', ". "sp2_reading = '".$post_vars["sp2_reading"]."', ". "sp3_reading = '".$post_vars["sp3_reading"]."', ". "lab_diag1 = '".$post_vars["lab_diag1"]."', ". "lab_diag2 = '".$post_vars["lab_diag2"]."', ". "lab_diag3 = '".$post_vars["lab_diag3"]."', ". "lab_diagnosis = '".$post_vars["lab_diagnosis"]."', ". "sputum_period = '".$post_vars["sputum_period"]."', ". "user_id = '".$_SESSION["userid"]."', ". "release_flag = '$release_flag' ". "where request_id = '".$post_vars["request_id"]."'"; if ($result_update = mysql_query($sql_update)) { mysql_query("COMMIT;") or die(mysql_error()); mysql_query("SET autocommit=1;") or die(mysql_error()); header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&module=".$get_vars["module"]."&ptmenu=LABS"."&module=sputum"."&request_id=".$get_vars["request_id"]."#sputum"); } else { mysql_query("ROLLBACK;") or die(mysql_error()); mysql_query("SET autocommit=1;") or die(mysql_error()); header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&module=".$get_vars["module"]."&ptmenu=LABS"."&module=sputum"."&request_id=".$get_vars["request_id"]."#sputum"); } } break; case "Delete Lab Exam": if (module::confirm_delete($menu_id, $post_vars, $get_vars)) { $sql = "delete from m_consult_lab where request_id = '".$post_vars["request_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"]."&module=".$get_vars["module"]."&ptmenu=LABS"); } } 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"]."&module=".$get_vars["module"]."&ptmenu=LABS"); } } break; } } }
function _consult_leprosy() { echo "<form name='form_leprosy' action='{$_POST['PHP_SELF']}' method='POST'>"; $leprosy = new leprosy(); $leprosy->consult_id = $_GET['consult_id']; $leprosy->patient_id = healthcenter::get_patient_id($_GET['consult_id']); //$leprosy->patient_age = healthcenter::get_patient_age($_GET['consult_id']); $leprosy->userid = $_SESSION['userid']; //The following codes will initialize hidden textboxes and their values echo "<input type='hidden' name='h_consult_id' value='{$leprosy->consult_id}'></input>"; echo "<input type='hidden' name='h_patient_id' value='{$leprosy->patient_id}'></input>"; echo "<input type='hidden' name='h_userid' value='{$leprosy->userid}'></input>"; if (@$_POST['h_save_flag'] == 'GO') { print " "; $leprosy->new_leprosy_record(); // test wether it still needed to initialize primary keys after a POST. //$leprosy->init_primary_keys(); print " "; $leprosy->show_NLCPForm1(); } else { print " "; $leprosy->init_primary_keys(); print " "; $leprosy->show_NLCPForm1(); } echo "<input type='hidden' name='h_save_flag' value='GO'></input>"; echo "</form>"; }
function _details_imci() { 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); } // check if age correct $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); if (!ptgroup::is_child(patient::get_age($patient_id))) { return print "<font color='red'>Module inappropriate for age.</font><br/>"; } }
function _wtforage() { // // main method for wtforage // caution -> use only for age 5 and below // call method: // $wt_class = wtforage ($age_month, $gender, $actual_weight); // where $age_month = age of patient // can be obtained from m_patient // $gender = patient gender (M or F) // can be obtained from m_patient // $weight = actual patient weight // can be obtained from m_consult_vitals // $wt_class: BELOW NORMAL (Very Low), BELOW NORMAL (Low), NORMAL, ABOVE NORMAL // // always check dependencies if ($exitinfo = $this->missing_dependencies('wtforage')) { return print($exitinfo); } if (func_num_args()>0) { $arg_list = func_get_args(); $consult_id = $arg_list[0]; } $patient_id = healthcenter::get_patient_id($consult_id); $age_month = round((ccdev::get_age_weeks($patient_id))/4.33,0); $gender = patient::get_gender($patient_id); $actual_weight = wtforage::get_body_weight($consult_id); /* print $sql = "select wt_class from m_lib_wtforage where age_month='$age_month' AND gender='$gender' ". "AND weight_min <= '$actual_weight' AND weight_max >= '$actual_weight'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { list($wt_class) = mysql_fetch_array($result); return $wt_class; } */ $sql = "select weight_min, weight_max, wt_class ". "from m_lib_wtforage ". "where age_month = '$age_month' and gender = '$gender'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while (list($min, $max, $class) = mysql_fetch_array($result)) { if ($max > $min) { if ($actual_weight >= $min && $actual_weight <= $max) { //print "Min $min<br/>"; //print "Max $max<br/>"; //print "Class $class<br/>"; $ret_val = array ($min, $max, $class); } } if ($min === $max) { if ($actual_weight >= $max) { //print "Min $min<br/>"; //print "Max $max<br/>"; //print "Class $class<br/>"; $ret_val = array ($min, $max, $class); } } } return $ret_val; } } }
function display_notifiable_diseases_hx() { // // displays notifiable diseases // entered for all consults // 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_NOTIFIABLE_DISEASES_CONSULT_HX . "</b><br>"; print "</td></tr>"; $sql = "select distinct h.consult_id, h.disease_id, l.disease_name, h.onset_date " . "from m_lib_disease_notifiable l, m_consult_disease_notifiable h " . "where l.disease_id = h.disease_id and h.patient_id = '{$patient_id}'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { print "<tr valign='top'><td>"; while (list($cid, $did, $name, $onset) = mysql_fetch_array($result)) { print "<img src='../images/arrow_redwhite.gif' border='0'/> "; print "<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=LABS&pid={$hid}'>{$hid}</a> {$name} ({$onset}) <br/>"; } print "</td></tr>"; } else { print "<tr valign='top'><td><font color='red'>No records.</font></td></tr>"; } } print "</table><br>"; }
function display_service_record() { 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]; } $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); $sql = "select ccdev_id, service_id, date_format(ccdev_timestamp,'%a %d %b %Y') service_date, ccdev_timestamp ". "from m_consult_ccdev_services ". "where patient_id = '$patient_id' order by service_id, ccdev_timestamp desc"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while (list($cid, $service, $sdate, $ts) = mysql_fetch_array($result)) { print "<img src='../images/arrow_redwhite.gif' border='0'/> "; print "<a href='".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=".$get_vars["ptmenu"]."&module=ccdev&ccdev=SVC&service_id=$service&sts=$ts&ccdev_id=$cid#detail'>".ccdev::get_service_name($service)."</a> $sdate<br/>"; if ($get_vars["service_id"]==$service && $get_vars["ts"]=$ts && $get_vars["ccdev_id"] = $cid) { ccdev::show_service_details($menu_id, $post_vars, $get_vars); } } } else { print "<font color='red'>No records</font><br/>"; } } }
function display_consult_icd10_hx() { 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); } // process delete here $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_CONSULT_ICD10_HX . "</b><br>"; print "</td></tr>"; $sql = "select h.consult_id, h.diagnosis_code, l.description " . "from m_lib_icd10_en l, m_consult_icd10 h " . "where l.diagnosis_code = h.diagnosis_code and h.patient_id = '{$patient_id}' " . "order by h.diagnosis_code"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { print "<tr valign='top'><td>"; while (list($cid, $icd, $name) = mysql_fetch_array($result)) { print "<img src='../images/arrow_redwhite.gif' border='0'/> "; print "<b>{$icd}</b> {$name} "; print "<br/>"; } print "</td></tr>"; } else { print "<tr valign='top'><td><font color='red'>No records.</font></td></tr>"; } } print "</table><br>"; }
function form_consult_appointment() { 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]; if ($get_vars["cid"] && $get_vars["injury_ts"]) { $sql = "select injury_id, mechanism_code, location_code, injury_date, injury_time, location_detail ". "from m_consult_injury ". "where consult_id = '".$get_vars["cid"]."' and injury_timestamp = '".$get_vars["injury_ts"]."'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $injury = mysql_fetch_array($result); } } } } $pxid = healthcenter::get_patient_id($get_vars[consult_id]); $cp = $this->get_patient_cellphone($pxid); $this->process_consult_appointment($menu_id,$post_vars,$get_vars,$validuser,$isadmin); $consult_date = healthcenter::get_consult_date($get_vars[consult_id]); $cons_date = $this->parse_date($consult_date); 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"]."&ptmenu=".$get_vars["ptmenu"]."' name='form_consult_appointment' method='post'>"; print "<tr valign='top'><td>"; print "<b>".FTITLE_APPOINTMENT_SCHEDULER."</b><br/><br/>"; print "</td></tr>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>".LBL_APPOINTMENT_DATE."</span><br> "; if ($appointment["visit_date"]) { list($year, $month, $day) = explode("-", $appointment["visit_date"]); $appointment_date = "$month/$day/$year"; } print "<input type='text' size='15' maxlength='10' class='textbox' name='appointment_date' value='".($appointment_date?$appointment_date:$post_vars["appointment_date"])."' style='border: 1px solid #000000'> "; print "<a href=\"javascript:show_calendar4('document.form_consult_appointment.appointment_date', document.form_consult_appointment.appointment_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/></td></tr>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>".LBL_APPOINTMENT_CODE."</span><br> "; print appointment::checkbox_appointment($injury["injury_id"]?$injury["injury_id"]:$post_vars["injury_id"]); print "<br/></td></tr>"; print "<tr valign='top'><td>"; print "<span class='boxtitle'>".LBL_REMINDER_FLAG."</span><br> "; print "<input type='checkbox' name='reminder_flag' value='1'/> Check to send reminder<br/>"; print "<br/></td></tr>"; print "<tr>"; print "<td><span class='boxtitle'>PATIENT CELLPHONE NUMBER</span>"; print "<input type='textbox' name='patient_cp' size='10' maxlength='11' value='$cp'></input>"; print "<input type='hidden' name='valid' value='0'></input>"; print "<input type='hidden' name='action_button' value=''>"; print "<input type='hidden' name='hidden_cp' value='$cp'>"; if(empty($cp)): print "<br><b><font color='red' size='2'>(patient no cellphone, please indicate)</font></b>"; endif; print "</td>"; print "</tr>"; print "<tr valign='top'><td>"; print "<tr><td>"; if ($get_vars["cid"] && $get_vars["injury_ts"]) { print "<input type='hidden' name='cid' value='".$get_vars["cid"]."'>"; print "<input type='hidden' name='injury_ts' value='".$get_vars["injury_ts"]."'>"; if ($_SESSION["priv_update"]) { print "<input type='button' value = 'Update Schedule' class='textbox' name='submitsked' style='border: 1px solid #000000' onclick='check_appt_info()'> "; } if ($_SESSION["priv_delete"]) { print "<input type='submit' value = 'Delete Schedule' class='textbox' name='submitsked' style='border: 1px solid #000000'> "; } } else { if ($_SESSION["priv_add"]) { print "<br><input type='button' value = 'Save Schedule' class='textbox' name='submitsked' style='border: 1px solid #000000' onclick='check_appt_info()'><br> "; } } print "</td></tr>"; print "</form>"; print "</table><br>"; }
function display_reminder_data() { 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 "<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=reminder&reminder=DATA'>"; print "<table width='300' cellpadding='2' style='border: 1px dotted black'><tr><td>"; $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); print "<b>NAME: " . strtoupper(patient::get_name($patient_id)) . "</b><br/>"; $sql = "select patient_id, cellular_phone, home_phone, " . "office_phone, email_address, home_address, " . "barangay, reg_timestamp, user_id " . "from m_patient_reminder_data " . "where patient_id = {$patient_id}"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $reminder = mysql_fetch_array($result); print "<span class='tinylight'>"; if (strlen($reminder["cellular_phone"]) > 0) { print "CELLULAR PHONE: " . $reminder["cellular_phone"] . "<br/>"; } if (strlen($reminder["home_phone"]) > 0) { print "HOME PHONE: " . $reminder["home_phone"] . "<br/>"; } if (strlen($reminder["office_phone"]) > 0) { print "OFFICE PHONE: " . $reminder["office_phone"] . "<br/>"; } if (strlen($reminder["email_address"]) > 0) { print "EMAIL ADDRESS: " . $reminder["email_address"] . "<br/>"; } if (strlen($reminder["home_address"]) > 0) { print "HOME ADDRESS: " . $reminder["home_address"] . "<br/>"; } if ($reminder["barangay"]) { print "BARANGAY: " . barangay::barangay_name($reminder["barangay"]) . "<br/>"; } print "<br/></span>"; print "<input type='hidden' name='patient_id' value='" . $reminder["patient_id"] . "' />"; if ($_SESSION["priv_update"] || $_SESSION["priv_delete"]) { print "<input type='submit' name='submitdetail' value='Edit Reminder Data' class='tinylight' style='border: 1px solid black' />"; } } else { print "<font color='red'>No reminder data</font><br/>"; } } print "</td></tr></table>"; print "</form>"; }
function process_send_request() { 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"]); switch ($post_vars["submitlab"]) { case "Send Request": if ($post_vars["lab_exam"]) { foreach ($post_vars["lab_exam"] as $key => $value) { $sql = "insert into m_consult_lab (consult_id, patient_id, lab_id, request_timestamp, request_user_id) " . "values ('" . $get_vars["consult_id"] . "', '{$patient_id}', '{$value}', sysdate(), '" . $_SESSION["userid"] . "')"; 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"]); } } } break; case "Print Referral": break; } }
function process_consult_lab_fecalysis() { 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 ($post_vars["submitlab"]) { $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); switch($post_vars["submitlab"]) { case "Update Lab Exam": // enforce transaction // specimen 1 if ($post_vars["fec_collection_date"]) { list($month,$day,$year) = explode("/", $post_vars["fec_collection_date"]); $sp1_collection_date = $year."-".str_pad($month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT); } $release_flag = ($post_vars["release_flag"]?"Y":"N"); mysql_query("SET autocommit=0;") or die(mysql_error()); mysql_query("START TRANSACTION;") or die(mysql_error()); if ($release_flag=="Y") { $sql = "update m_consult_lab set ". "done_timestamp = sysdate(), ". "request_done = 'Y', ". "done_user_id = '".$_SESSION["userid"]."' ". "where request_id = '".$post_vars["request_id"]."'"; if ($result = mysql_query($sql)) { // successful.. so just go to next SQL statement in // transaction set } else { mysql_query("ROLLBACK;") or die(mysql_error()); mysql_query("SET autocommit=1;") or die(mysql_error()); header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&module=".$get_vars["module"]."&request_id=".$post_vars["request_id"]."&lab_id=".$get_vars["lab_id"]); } } // try insert first, will fail if previous request has been inserted // because of primary key constraint - then it will cascade to update below... $sql_fecalysis = "insert into m_consult_lab_fecalysis (consult_id, request_id, patient_id, ". "lab_timestamp, fec_collection_date, ". "fec_macro_findings, ". "fec_micro_findings, ". "user_id, release_flag) values ('".$get_vars["consult_id"]."', '".$post_vars["request_id"]."', ". "'$patient_id', sysdate(), '$fec_collection_date', ". "'".$post_vars["fec_macro_findings"]."', ". "'".$post_vars["fec_micro_findings"]."', ". "'".$_SESSION["userid"]."', '$release_flag')"; if ($result_fecalysis = mysql_query($sql_fecalysis)) { mysql_query("COMMIT;") or die(mysql_error()); mysql_query("SET autocommit=1;") or die(mysql_error()); header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&module=".$get_vars["module"]."&request_id=".$get_vars["request_id"]."&lab_id=".$get_vars["lab_id"]); } else { $sql_update = "update m_consult_lab_fecalysis set ". "lab_timestamp = sysdate(), ". "fec_collection_date = '$fec_collection_date', ". "fec_macro_findings = '".$post_vars["fec_macro_findings"]."', ". "fec_micro_findings = '".$post_vars["fec_micro_findings"]."', ". "user_id = '".$_SESSION["userid"]."', ". "release_flag = '$release_flag' ". "where request_id = '".$post_vars["request_id"]."'"; if ($result_update = mysql_query($sql_update)) { mysql_query("COMMIT;") or die(mysql_error()); mysql_query("SET autocommit=1;") or die(mysql_error()); //header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&module=".$get_vars["module"]); } else { mysql_query("ROLLBACK;") or die(mysql_error()); mysql_query("SET autocommit=1;") or die(mysql_error()); header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&module=".$get_vars["module"]); } } break; case "Delete Lab Exam": if (module::confirm_delete($menu_id, $post_vars, $get_vars)) { $sql = "delete from m_consult_lab where request_id = '".$post_vars["request_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"]."&module=".$get_vars["module"]); } } 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"]."&module=".$get_vars["module"]); } } break; } } }
function check_if_vacc_exist() { $arr_old_vacc = array('DPT1', 'DPT2', 'DPT3', 'HEPB1', 'HEPB2', 'HEPB3'); $arr_new_vacc = array('PENTA1', 'PENTA2', 'PENTA3'); $patient_id = healthcenter::get_patient_id($_GET["consult_id"]); $type = ''; foreach ($_POST["vaccine"] as $key => $value) { if (in_array($value, $arr_old_vacc)) { $type = 'old'; } elseif (in_array($value, $arr_new_vacc)) { $type = 'new'; } else { } } if ($type != '') { if ($type == 'old') { $arr_new = array(); foreach ($arr_new_vacc as $key => $value) { array_push($arr_new, "'" . $value . "'"); } $str_new = implode(",", $arr_new); $q_vacc = mysql_query("SELECT consult_id FROM m_consult_vaccine WHERE patient_id='{$patient_id}' AND vaccine_id IN ( {$str_new} )") or die("Cannot query 1976: " . mysql_error()); if (mysql_num_rows($q_vacc) != 0) { echo "<script language=\"Javascript\">"; echo "alert('The client was vaccinated with pentavalent (5 in 1) vaccines already. Please record the succeeding pentavalent vaccine rounds instead.')"; echo "</script>"; return 0; } else { return 1; } } elseif ($type == 'new') { $arr_old = array(); foreach ($arr_old_vacc as $key => $value) { array_push($arr_old, "'" . $value . "'"); } $str_old = implode(",", $arr_old); $q_vacc = mysql_query("SELECT consult_id FROM m_consult_vaccine WHERE patient_id='{$patient_id}' AND vaccine_id IN ( {$str_old} )") or die("Cannot query 1980: " . mysql_error()); if (mysql_num_rows($q_vacc) != 0) { echo "<script language=\"Javascript\">"; echo "alert('The client was vaccinated with the traditional set of vaccines (non-pentavalent) already. Please record the succeeding vaccinations (non-pentavalent) according to the regular sequence.')"; echo "</script>"; return 0; } else { return 1; } } } else { return 1; } }
function edit_surgical_history() { if (func_num_args() > 0) { $arg_list = func_get_args(); $post_vars = $arg_list[0]; $get_vars = $arg_list[1]; } print "<script>\n\t\t\t\tfunction change(value)\n\t\t\t\t{\n\t\t\t\t\tdocument.getElementById(\"operation\").value= value.operation;\n\t\t\t\t\tdocument.getElementById(\"operationdate\").value= value.date;\n\t\t\t\t\tdocument.getElementById(\"save\").value= value.text;\n\t\t\t\t\tdocument.getElementById(\"recordID\").value= value.id;\n\t\t\t\t}\n\t\t\t\t</script>"; $patient_id = healthcenter::get_patient_id($_GET["consult_id"]); $sql = "select record_id, operation, operation_date from m_patient_history_surgical where patient_id = '{$patient_id}' order by operation_date desc"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { print "<br/><br/>"; print "<table width='320px' style='border: 1px solid black;border-collapse:collapse'>"; print "<tr class='tinylight'>"; print "<th width='170px' style='border: 1px solid black'>Operation</th>"; print "<th width='70px' style='border: 1px solid black'>Date</th>"; print "<th width='50px' style='border: 1px solid black'>Action</th>"; print "</tr>"; while (list($id, $operation, $operation_date) = mysql_fetch_array($result)) { $date = date("m/d/Y", strtotime($operation_date)); print "<tr>"; print "<td style='border: 1px solid black'>{$operation}</td>"; print "<td style='border: 1px solid black; text-align:center;'>{$operation_date}</td>"; print "<td style='border: 1px solid black; text-align:center;'><input id='edit' type='button' name='edit' value='Edit' onclick=\"change({operation:'{$operation}',date:'{$date}',text:'Update Surgical History',id:'{$id}'})\"></td>"; print "</tr>"; } print "</table>"; } } }
function unenroll_fp_px() { $pxid = healthcenter::get_patient_id($_GET[consult_id]); $delete_fp_method = mysql_query("DELETE FROM m_patient_fp_method WHERE fp_px_id='{$_POST['fp_px_id']}' AND patient_id='{$pxid}'") or die("Cannot query 1781 " . mysql_error()); $delete_fp_method_services = mysql_query("DELETE FROM m_patient_fp_method_service WHERE fp_px_id='{$_POST['fp_px_id']}' and patient_id='{$pxid}'") or die("Cannot query 1782 " . mysql_error()); if ($delete_fp_method && $delete_fp_method_services) { echo "<script language='Javascript'>"; echo "window.alert('Patient was unenrolled from this FP method.')"; echo "</script>"; } }
function display_service_record() { 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($get_vars); echo "<br>";*/ $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); $sql = "select ccdev_id, service_id, date_format(ccdev_timestamp,'%a %d %b %Y') service_date, ccdev_timestamp,date_format(ccdev_service_date,'%a %d %b %Y') actual_service_date,ccdev_service_date " . "from m_consult_ccdev_services " . "where patient_id = '{$patient_id}' order by service_id, ccdev_timestamp desc"; $result = mysql_query($sql) or die(mysql_error()); if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while (list($cid, $service, $sdate, $ts, $actual_service_date, $serv_date) = mysql_fetch_array($result)) { print "<img src='../images/arrow_redwhite.gif' border='0'/> "; print "<a href='" . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&consult_id=" . $get_vars["consult_id"] . "&ptmenu=" . $get_vars["ptmenu"] . "&module=ccdev&ccdev=SVC&service_id={$service}&sts={$ts}&ccdev_id={$cid}#detail'>" . ccdev::get_service_name($service) . "</a> "; echo $serv_date == '0000-00-00' ? $sdate . " <font color='red' size='2'><b>(pls update actual service date)</b></font>" : $actual_service_date; echo "<br/>"; if ($get_vars["service_id"] == $service && $get_vars["sts"] == $ts && $get_vars["ccdev_id"] == $cid) { //this was '=' instead of '==' before ccdev::show_service_details($menu_id, $post_vars, $get_vars); } } } else { print "<font color='red'>No records</font><br/>"; } } }
function _consult_fp() { // // main submodule for family planning consults // // always check dependencies if ($exitinfo = $this->missing_dependencies('fp')) { 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); } $fp = new fp(); $fp->fp_menu($menu_id, $post_vars, $get_vars); if ($post_vars[submitfp]) { $fp->process_fp($menu_id, $post_vars, $get_vars); } $patient_id = healthcenter::get_patient_id($get_vars[consult_id]); switch ($get_vars[fp]) { case "VISIT1": if (!$fp->registry_record_exists($patient_id) || $post_vars[submitfp] == 'Update Visit 1') { $fp->form_fp_firstvisit($menu_id, $post_vars, $get_vars, $validuser, $isadmin); } break; case "HX": $fp->form_fp_medhx($menu_id, $post_vars, $get_vars); break; case "PE": $fp->form_fp_pe($menu_id, $post_vars, $get_vars); break; case "PELVIC": $fp->form_fp_pe($menu_id, $post_vars, $get_vars); break; case "SVC": default: $fp->form_fp_services($menu_id, $post_vars, $get_vars, $validuser, $isadmin); break; } }
function _consult_dental() { echo "<form name='form_dental' action='$_POST[PHP_SELF]' method='POST'>"; $dental = new dental; $dental->toothnumber = 0; $dental->condition[$dental->toothnumber] = 'Y'; $dental->consult_id = $_GET['consult_id']; $dental->patient_id = healthcenter::get_patient_id($_GET['consult_id']); $dental->patient_age = healthcenter::get_patient_age($_GET['consult_id']); $dental->dentist = $_SESSION['userid']; // The following codes will initialize hidden textboxes and their values echo "<input type='hidden' name='h_patient_id' value='{$dental->patient_id}'></input>"; echo "<input type='hidden' name='h_consult_id' value='{$dental->consult_id}'></input>"; echo "<input type='hidden' name='h_dentist' value='{$dental->dentist}'></input>"; if (@$_POST['h_save_flag'] == 'GO') { $dental->new_dental_record(); print " "; $dental->show_message_if_patient_is_pregnant($dental->patient_id, date("Y-m-d")); echo " "; $dental->show_date_of_oral(); $dental->get_teeth_conditions($dental->patient_age); //echo " "; //$dental->select_tooth_and_condition($dental->patient_age); //echo " "; //$dental->show_teeth_conditions($dental->patient_age); print " "; $dental->show_teeth_conditions_v02(); echo " "; $dental->show_ohc_table_a($dental->patient_id); echo " "; $dental->show_ohc_table_b($dental->patient_id); echo " "; $dental->show_services_monitoring_chart($dental->patient_id); print " "; $dental->show_other_dental_services($dental->patient_id); echo " "; $dental->show_tooth_legends($dental->patient_age); } else { $dental->init_primary_keys(); print " "; $dental->show_message_if_patient_is_pregnant($dental->patient_id, date("Y-m-d")); echo " "; $dental->show_date_of_oral(); $dental->get_teeth_conditions($dental->patient_age); //echo " "; //$dental->select_tooth_and_condition($dental->patient_age); //echo " "; //$dental->show_teeth_conditions($dental->patient_age); print " "; $dental->show_teeth_conditions_v02(); echo " "; $dental->show_ohc_table_a($dental->patient_id); echo " "; $dental->show_ohc_table_b($dental->patient_id); echo " "; $dental->show_services_monitoring_chart($dental->patient_id); print " "; $dental->show_other_dental_services($dental->patient_id); echo " "; $dental->show_tooth_legends($dental->patient_age); } echo "<input type='hidden' name='h_save_flag' value='GO'></input>"; echo "</form>"; }
function disp_form_diag(){ 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]; $disease = $arg_list[5]; endif; $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); switch($disease){ case "anemia": if($post_vars["submit_diagdetails"]=="Save Anemia Tx Info"): $anemia_tx_sdate = (!empty($post_vars["txt_iron_started"]))?$this->convert_date($post_vars["txt_iron_started"]):'0000-00-00'; $anemia_tx_cdate = (!empty($post_vars["txt_iron_completed"]))?$this->convert_date($post_vars["txt_iron_completed"]):'0000-00-00'; $anemia_sdate_ok = $this->get_age_diff($anemia_tx_sdate,$get_vars,$patient_id); $anemia_edate_ok = $this->get_age_diff($anemia_tx_cdate,$get_vars,$patient_id); if($anemia_sdate_ok==1 && $anemia_edate_ok==1): $update_anemia = mysql_query("UPDATE m_consult_notes SET anemia_start_date='$anemia_tx_sdate',anemia_completed_date='$anemia_tx_cdate' WHERE consult_id='$get_vars[consult_id]'") or die("Cannot query: 1378"); else: echo "<font color='red' size='2'>Anemia Tx Info not saved.One of the date of intakes should occur on or after this consultation.</font>"; endif; endif; $q_anemia = mysql_query("SELECT anemia_start_date,anemia_completed_date FROM m_consult_notes WHERE consult_id='$get_vars[consult_id]'") or die("Cannot query: 1386"); list($anemia_sdate,$anemia_cdate) = mysql_fetch_array($q_anemia); $anemia_sdate = ($anemia_sdate!='0000-00-00')?$this->convert_date_cal($anemia_sdate):''; $anemia_cdate = ($anemia_cdate!='0000-00-00')?$this->convert_date_cal($anemia_cdate):''; echo "<form method='post' name='form_anemia'>"; echo "<span class='boxtitle'>ANEMIC CHILDREN GIVEN IRON SUPPLEMENTATION</span>"; echo "<table>"; echo "<tr><td class='tinylight'><b>DATE STARTED</b></td><td><input type='text' size='7' name='txt_iron_started' value='$anemia_sdate'></input>"; echo " <a href=\"javascript:show_calendar4('document.form_anemia.txt_iron_started', document.form_anemia.txt_iron_started.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a>"; echo "<td></tr>"; echo "<tr><td class='tinylight'><b>DATE COMPLETED</b></td><td><input type='text' size='7' name='txt_iron_completed' value='$anemia_cdate'></input>"; echo " <a href=\"javascript:show_calendar4('document.form_anemia.txt_iron_completed', document.form_anemia.txt_iron_completed.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a>"; echo "<td></tr>"; echo "<tr align='center'><td colspan='2'>"; echo "<input type='submit' name='submit_diagdetails' value='Save Anemia Tx Info' class='tinylight' style='border: 1px solid black'></input>"; echo "</td></tr>"; echo "</table>"; echo "</form>"; break; case "diarrhea": if($post_vars["submit_diagdetails"]=="Save Diarrhea Tx Info"): $ort = (!empty($post_vars["date_ort_given"]))?$this->convert_date($post_vars["date_ort_given"]):'0000-00-00'; $ors = (!empty($post_vars["date_ors_given"]))?$this->convert_date($post_vars["date_ors_given"]):'0000-00-00'; $orswz = (!empty($post_vars["date_orswz_given"]))?$this->convert_date($post_vars["date_orswz_given"]):'0000-00-00'; $ort_ok = $this->get_age_diff($ort,$get_vars,$patient_id); $ors_ok = $this->get_age_diff($ors,$get_vars,$patient_id); $orswz_ok = $this->get_age_diff($orswz,$get_vars,$patient_id); if($ort_ok==1 && $ors_ok==1 && $orswz_ok==1): $update_diarrhea_tx = mysql_query("UPDATE m_consult_notes SET diarrhea_ort='$ort',diarrhea_ors='$ors',diarrhea_orswz='$orswz' WHERE consult_id='$get_vars[consult_id]'") or die("Cannot query: 1445"); else: echo "<font color='red' size='2'>Diarrhea Tx Info cannot be saved. One of the dates occured before this consultation.</font>"; endif; endif; $q_diarrhea = mysql_query("SELECT diarrhea_ort,diarrhea_ors,diarrhea_orswz FROM m_consult_notes WHERE consult_id='$get_vars[consult_id]'") or die("Cannot query: 1406"); list($date_ort,$date_ors,$date_orswz) = mysql_fetch_array($q_diarrhea); $date_ort = ($date_ort!='0000-00-00')?$this->convert_date_cal($date_ort):''; $date_ors = ($date_ors!='0000-00-00')?$this->convert_date_cal($date_ors):''; $date_orswz = ($date_orswz!='0000-00-00')?$this->convert_date_cal($date_orswz):''; echo "<form method='post' name='form_diarrhea'>"; echo "<span class='boxtitle'>DIARRHEA TREAMENT INFORMATION</span>"; echo "<table>"; echo "<tr><td class='tinylight'><b>DATE ORT WAS GIVEN</b></td><td><input type='text' size='7' name='date_ort_given' value='$date_ort'></input>"; echo " <a href=\"javascript:show_calendar4('document.form_diarrhea.date_ort_given', document.form_diarrhea.date_ort_given.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a>"; echo "</td></tr>"; echo "<tr><td class='tinylight'><b>DATE ORS WAS GIVEN</b></td><td><input type='text' size='7' name='date_ors_given' value='$date_ors'></input>"; echo " <a href=\"javascript:show_calendar4('document.form_diarrhea.date_ors_given', document.form_diarrhea.date_ors_given.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a>"; echo "</td></tr>"; echo "<tr><td class='tinylight'><b>DATE ORS WITH ZINC WAS GIVEN</b></td><td><input type='text' size='7' name='date_orswz_given' value='$date_orswz'></input>"; echo " <a href=\"javascript:show_calendar4('document.form_diarrhea.date_orswz_given', document.form_diarrhea.date_orswz_given.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a>"; echo "</td></tr>"; echo "<tr align='center'><td colspan='2'><input type='submit' name='submit_diagdetails' value='Save Diarrhea Tx Info' class='tinylight' style='border: 1px solid black'></input></td></tr>"; echo "</table>"; echo "</form>"; break; case "pneumonia": if($post_vars["submit_diagdetails"]=="Save Pneumonia Tx Info"): $pneumonia_tx = (!empty($post_vars["date_pneu_given"]))?$this->convert_date($post_vars["date_pneu_given"]):'0000-00-00'; $pneumonia_ok = $this->get_age_diff($pneumonia_tx,$get_vars,$patient_id); if($pneumonia_ok==1): $update_pneumonia = mysql_query("UPDATE m_consult_notes SET pneumonia_date_given='$pneumonia_tx' WHERE consult_id='$get_vars[consult_id]'") or die(mysql_error()); else: echo "<font color='red'>Pneumonia Tx Info cannot be saved. Date of treatment should occur on or after this consultation.</font>"; endif; endif; $q_pneumonia = mysql_query("SELECT pneumonia_date_given FROM m_consult_notes WHERE consult_id='$get_vars[consult_id]'") or die("Cannot query: 1477"); list($pneu_date) = mysql_fetch_array($q_pneumonia); $pneu_date = ($pneu_date!='0000-00-00')?$this->convert_date_cal($pneu_date):''; echo "<form method='post' name='form_pneumonia'>"; echo "<span class='boxtitle'>PNEUMONIA TREATMENT INFORMATION</span>"; echo "<table>"; echo "<tr><td class='tinylight'><b>DATE TREATMENT GIVEN</b></td><td><input type='text' size='7' name='date_pneu_given' value='$pneu_date'></input>"; echo " <a href=\"javascript:show_calendar4('document.form_pneumonia.date_pneu_given', document.form_pneumonia.date_pneu_given.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a>"; echo "</td></tr>"; echo "<tr align='center'><td colspan='2'><input type='submit' name='submit_diagdetails' value='Save Pneumonia Tx Info' class='tinylight' style='border: 1px solid black'></input></td></tr>"; echo "</table>"; echo "</form>"; break; default: break; } }
function display_vaccine_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); } $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); $sql = "select consult_id, user_id, patient_id, vaccine_timestamp, date_format(vaccine_timestamp, '%a %d %b %Y, %h:%i%p'), " . "vaccine_id, adr_flag, actual_vaccine_date, source_module " . "from m_consult_vaccine where " . "vaccine_id = '" . $get_vars["vaccine"] . "' and patient_id = '{$patient_id}' and " . "vaccine_timestamp = '" . $get_vars["ts"] . "'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { list($cid, $uid, $pid, $vstamp, $vdate, $vid, $adr, $actual_date, $source) = mysql_fetch_array($result); print "<a name='detail'>"; print "<table width='250' cellpadding='3' style='border:1px dashed black'><tr><td>"; print "<form name='form_vaccine_detail' 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=vaccine&vaccine={$vid}&ts={$vstamp}&actual={$actual_vdate}'>"; print "<span class='tinylight'>"; print "PATIENT: " . patient::get_name($pid) . "<br/>"; print "DATA SOURCE: " . strtoupper($source) . "<br/>"; print "VACCINE: " . vaccine::get_vaccine_name($vid) . "<br/>"; print "REPORT DATE: {$vdate}<br/>"; print "RECORDED BY: " . user::get_username($uid) . "<br/>"; print "ACTUAL VACCINE DATE:<br/>"; if ($actual_date != "0000-00-00") { list($year, $month, $day) = explode("-", $actual_date); $conv_date = "{$month}/{$day}/{$year}"; } print "<input type='text' size='10' maxlength='10' class='tinylight' name='actual_vaccine_date' value='" . ($conv_date ? $conv_date : $post_vars["actual_vaccine_date"]) . "' style='border: 1px solid #000000'> "; print "<a href=\"javascript:show_calendar4('document.form_vaccine_detail.actual_vaccine_date', document.form_vaccine_detail.actual_vaccine_date.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a><br>"; print "<input type='checkbox' name='adr_flag' " . ($adr == "Y" ? "checked" : "") . " value='1'/> " . INSTR_ADVERSE_VACCINE_REACTION . "<br/>"; print "<input type='hidden' name='vaccine' value='" . $get_vars["vaccine"] . "'/>"; print "<input type='hidden' name='vaccine_consult_id' value='{$cid}'/>"; print "<input type='hidden' name='ts' value='" . $get_vars["ts"] . "'/>"; if ($_SESSION["priv_delete"]) { print "<input type='submit' name='submitdetail' value='Delete Record' class='tinylight' style='border: 1px solid black'/> "; } if ($_SESSION["priv_update"]) { print "<input type='submit' name='submitdetail' value='Update Record' class='tinylight' style='border: 1px solid black'/> "; } print "</span>"; print "</form>"; print "</td></tr></table>"; } } }
function display_service_record() { 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 "<br/>"; print "<b>".FTITLE_SERVICE_RECORD."</b><br/>"; $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); $sql = "select mc_id, service_id, date_format(mc_timestamp,'%a %d %b %Y') service_date, mc_timestamp,actual_service_date, date_format(actual_service_date,'%a %d %b %Y') actual_sdate, service_qty ". "from m_consult_mc_services ". "where patient_id = '$patient_id' order by service_id, actual_service_date desc"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while (list($cid, $service, $sdate, $ts, $actual_service_date, $actual_sdate, $qty) = mysql_fetch_array($result)) { print "<img src='../images/arrow_redwhite.gif' border='0'/> "; $disp_date = ($actual_service_date=='0000-00-00')?$sdate:$actual_sdate; print "<a href='".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&consult_id=".$get_vars["consult_id"]."&ptmenu=".$get_vars["ptmenu"]."&module=mc&mc=SVC&service_id=$service&sts=$ts&mc_id=$cid&actual_vdate=$actual_service_date#service' name='service'>".mc::get_service_name($service)." ($qty)</a> $disp_date<br/>"; if ($get_vars["service_id"]==$service && $get_vars["actual_vdate"]==$actual_service_date && $get_vars["sts"]==$ts) { mc::display_service_record_details($menu_id, $post_vars, $get_vars); } } } else { print "<font color='red'>No records</font><br/>"; } } }
function _consult_lab_fecalysis() { 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]; } if ($exitinfo = $this->missing_dependencies('fecalysis')) { return print $exitinfo; } $f = new fecalysis(); if ($_POST["submitlab"] == 'Update Lab Exam') { //print_r($_POST); $q_request = mysql_query("SELECT request_id FROM m_consult_lab_fecalysis WHERE request_id='{$_POST['request_id']}'") or die("Cannot query 101 " . mysql_error()); if ($_POST[release_flag] == 1) { $release = 'Y'; $release_date = date('Y-m-d H:i:s'); $q_update_lab = mysql_query("UPDATE m_consult_lab SET request_done='{$release}',done_timestamp='{$release_date}',done_user_id='{$_SESSION['userid']}' WHERE request_id='{$_POST['request_id']}' AND lab_id='{$_GET['lab_id']}'") or die("Cannot query 107 " . mysql_error()); } else { $release = 'N'; $release_date = ''; } $pxid = healthcenter::get_patient_id($_GET[consult_id]); list($m, $d, $y) = explode('/', $_POST[fecal_date]); $date_lab_exam = $y . '-' . $m . '-' . $d; if (mysql_num_rows($q_request) != 0) { $update_fecal = mysql_query("UPDATE m_consult_lab_fecalysis SET date_lab_exam='{$date_lab_exam}',fecal_color='{$_POST['fecal_color']}',fecal_consistency='{$_POST['fecal_consistency']}',fecal_occultblood='{$_POST['fecal_blood']}',fecal_ova='{$_POST['fecal_ova']}',fecal_wbc='{$_POST['fecal_wbc']}',fecal_rbc='{$_POST['fecal_rbc']}',fecal_bacteria='{$_POST['fecal_bacteria']}',fecal_fat='{$_POST['fecal_fat']}',fecal_starch='{$_POST['fecal_starch']}',fecal_others='{$_POST['fecal_others']}',release_flag='{$release}',release_date='{$release_date}' WHERE request_id='{$_GET['request_id']}'") or die("Cannot query 120 " . mysql_error()); } else { $insert_fecal = mysql_query("INSERT INTO m_consult_lab_fecalysis SET consult_id='{$_GET['consult_id']}', request_id='{$_POST['request_id']}', patient_id='{$pxid}', date_lab_exam='{$date_lab_exam}', fecal_color='{$_POST['fecal_color']}', fecal_consistency='{$_POST['fecal_consistency']}', fecal_occultblood='{$_POST['fecal_blood']}',fecal_ova='{$_POST['fecal_ova']}',fecal_wbc='{$_POST['fecal_wbc']}',fecal_rbc='{$_POST['fecal_rbc']}',fecal_bacteria='{$_POST['fecal_bacteria']}', fecal_fat='{$_POST['fecal_fat']}',fecal_starch='{$_POST['fecal_starch']}',fecal_others='{$_POST['fecal_others']}',user_id='{$_SESSION['userid']}',release_flag='{$release}',release_date='{$release_date}'") or die("Cannot query 106" . mysql_error()); } if ($update_fecal || $insert_fecal) { echo "<script language='Javascript'>"; echo "window.alert('Fecalysis data was successfully been saved.')"; echo "</script>"; } } $f->form_consult_lab_fecalysis($menu_id, $post_vars, $get_vars); }
function check_fprec() { //function shall check if there exists an FP Service Record $pxid = healthcenter::get_patient_id($_GET[consult_id]); $q_fp = mysql_query("SELECT fp_id, plan_more_children, no_of_living_children_actual, no_of_living_children_desired, birth_interval_desired,educ_id, occup_id, spouse_name, spouse_educ_id, spouse_occup_id, ave_monthly_income FROM m_patient_fp WHERE patient_id='{$pxid}'") or die("Cannot query in form_fp_visit1: line 625"); return $q_fp; //returns a resource identifier }
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 " Drugs: ".$ntpdata["previous_treatment_drugs"]."<br/>"; print " 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>"; } } } }