function _consult() {
    //
    // main consult API
    // executes with menu choice "Today's Patients"
    //

        static $patient;
        static $notes;
        static $lab;

        // always check dependencies
        if ($exitinfo = $this->missing_dependencies('healthcenter')) {
            return print($exitinfo);
        }
        
        mysql_query("ALTER TABLE `m_consult` DROP PRIMARY KEY , ADD PRIMARY KEY (`consult_id`)");
        
        
        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 (!isset($patient)) {
            $patient = new patient;
            $notes = new notes;
            $lab = new lab;
            $drug = new drug;
        }
        if ($get_vars["patient_id"] && $get_vars["consult_id"]) {
            print "<table>";
            print "<tr valign='top'><td>";
            $this->patient_info($menu_id, $post_vars, $get_vars);
            print "</td></tr>";
            print "</table>";
        } else {
            if ($post_vars["submitpatient"]) {
                // processes form_patient and immediately
                // starts consult
                $patient->process_patient($menu_id, $post_vars, $get_vars);
                $this->process_consult($menu_id, $post_vars, $get_vars);
                header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]);
            }
            // check if we are loading patient records or validating entry for
            //   an existing patient in today's consult list
            if ($post_vars["submitconsult"] || $get_vars["enter_consult"] || $post_vars["confirm_add_consult"]) {
                //$post_vars["consult_id"] = $get_vars["enter_consult"];
                // confirms consult for found patients		                
		$this->process_consult($menu_id, $post_vars, $get_vars);
            }
            if ($post_vars["submitsearch"]) {
                // lists down search results for patient
                $this->process_search($menu_id, $post_vars, $get_vars);
            }
            print "<table width='600'>";
            if ($get_vars["consult_id"]) {
                print "<tr valign='top'><td colspan='2'>";
                $this->patient_info($menu_id, $post_vars, $get_vars);
                print "</td></tr>";
                print "<tr valign='top'><td colspan='2'>";
                $this->patient_menu($menu_id, $post_vars, $get_vars);
                print "</td></tr>";
                print "<tr valign='top'><td>";
                // column 1
                switch ($get_vars["ptmenu"]) {
                case "APPTS":
                    appointment::_consult_appointment($menu_id, $post_vars, $get_vars);
                    break;
                case "LABS":
                    if ($post_vars["submitlab"] || $get_vars["delete_id"]) {
                        $lab->process_send_request($menu_id, $post_vars, $get_vars);
                    }
                    $lab->form_send_request($menu_id, $post_vars, $get_vars);
                    break;
                case "DETAILS":
                    if ($get_vars["module"]) {
                        $module_method = $get_vars["module"]."::_consult_".$get_vars["module"]."(\$menu_id, \$post_vars, \$get_vars);";
                        if (class_exists($get_vars["module"])) {
                            eval("$module_method");
                        }
                    } else {
                        if ($post_vars["submitdetails"]) {
                            $this->process_details($menu_id, $post_vars, $get_vars);
                        }
                        $this->form_visitdetails($menu_id, $post_vars, $get_vars);
                    }
                    break;
                case "VITALS":
                    //$this->show_vitalsigns($menu_id, $post_vars, $get_vars);
                    if ($post_vars["submitvitals"]) {
                        $this->process_vitalsigns($menu_id, $post_vars, $get_vars, $_SESSION["userid"]);
                    }
                    $this->form_vitalsigns($menu_id, $post_vars, $get_vars);
                    break;
                case "NOTES":
                    $notes->_consult_notes($menu_id, $post_vars, $get_vars);
                    break;
                case "DRUGS":
                    $drug->_consult_drug($menu_id, $post_vars, $get_vars);
                    break;
                case "CONSULT":
                    $this->_consult_housekeeping($menu_id, $post_vars, $get_vars);
                    break;
                }
                print "</td><td>";
                // column 2
                switch ($get_vars["ptmenu"]) {
                case "APPTS":
                    appointment::display_consult_appointments($menu_id, $post_vars, $get_vars);
                    break;
                case "LABS":
                    // lab requests for this consult
                    // flag if done
                    $lab->display_requests($menu_id, $post_vars, $get_vars);
                    break;
                case "VITALS":
                    $this->display_vitals($menu_id, $post_vars, $get_vars);
                    break;
                case "DETAILS":
                    if ($get_vars["module"]) {
                        // construct eval string
                        $module_method = $get_vars["module"]."::_details_".$get_vars["module"]."(\$menu_id, \$post_vars, \$get_vars);";
                        if (class_exists($get_vars["module"])) {
                            eval("$module_method");
                        }
                    } else {
                        $this->show_visitdetails($menu_id, $post_vars, $get_vars);
                        $this->display_consults($menu_id, $post_vars, $get_vars);
                    }
                    break;
                case "NOTES":
                    $notes->_details_notes($menu_id, $post_vars, $get_vars, $validuser, $isadmin);
                    break;
                case "DRUGS":
                    $drug->_details_drug($menu_id, $post_vars, $get_vars, $validuser, $isadmin);
                    break;
                }
                print "</td></tr>";
                print "<tr valign='top'><td colspan='2'>";
                // display all patients confirmed with consults
                // CONSULTS TODAY DISPLAYED AT THE BOTTOM
                $this->consult_info($menu_id, $post_vars, $get_vars);
                print "</td></tr>";
            } else {
                print "<tr valign='top'><td colspan='2'>";
                // display all patients confirmed with consults
                print "<table>";
                print "<tr><td>";
                // CONSULTS TODAY
                $this->consult_info($menu_id, $post_vars, $get_vars);
                print "</td></tr>";
                /*
                print "<tr><td>";
                // REGISTERED PATIENTS TODAY
                $patient->patient_info($menu_id, $post_vars, $get_vars);
                print "</td></tr>";
                */
                print "</table>";
                print "</td></tr>";
                print "<tr valign='top'><td>";
                $patient->newsearch($menu_id, $post_vars, $get_vars);
                print "</td><td>";
                $patient->form_patient($menu_id, $post_vars, $get_vars);
                print "</td></tr>";
            }
            print "</table>";
        }
    }
Example #2
0
<?
// BEGIN SERVER CODE: DO NOT EDIT
// Server generated code
// Generated 2010-03-15 13:06:36
// Module: _module.php
// Author: Herman Tolentino MD
//
if (file_exists('../modules/appointment/class.appointment.php')) {
	include '../modules/appointment/class.appointment.php';
	$appointment = new appointment;
	if (!$module->activated('appointment') && $initmod) {
		$appointment->init_sql();
		$appointment->init_menu();
		$appointment->init_deps();
		$appointment->init_lang();
		$appointment->init_help();
	}
}
if (file_exists('../modules/barangay/class.barangay.php')) {
	include '../modules/barangay/class.barangay.php';
	$barangay = new barangay;
	if (!$module->activated('barangay') && $initmod) {
		$barangay->init_sql();
		$barangay->init_menu();
		$barangay->init_deps();
		$barangay->init_lang();
		$barangay->init_help();
	}
}
if (file_exists('../modules/birthday/class.birthday.php')) {
	include '../modules/birthday/class.birthday.php';
Example #3
0
    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 form_template()
 {
     //
     // called from _sms_template()
     //
     if (func_num_args()) {
         $arg_list = func_get_args();
         $menu_id = $arg_list[0];
         $post_vars = $arg_list[1];
         $get_vars = $arg_list[2];
         $isadmin = $arg_list[3];
         if ($get_vars["template_id"]) {
             $sql = "select appointment_id, template_text " . "from m_lib_reminder_sms_template where appointment_id = '" . $get_vars["template_id"] . "'";
             if ($result = mysql_query($sql)) {
                 if (mysql_num_rows($result)) {
                     $template = mysql_fetch_array($result);
                 }
             }
         }
     }
     print "<a name='form_template'>";
     print "<table width='400'>";
     print "<form action = '" . $_SERVER["SELF"] . "?page=LIBRARIES&menu_id={$menu_id}' name='form_sms_template' method='post'>";
     print "<tr valign='top'><td>";
     print "<span class='library'>" . FTITLE_SMS_TEMPLATE_FORM . "</span><br><br>";
     print "</td></tr>";
     print "<tr valign='top'><td>";
     print "<b>NOTE: This is a template for sending SMS reminders. " . "You can use the following variables: _RECEIVER_, _SENDER_, " . "_APPT_DATE_, _APPT_LOCATION_. These will be substituted with " . "actual values.</b><br/><br/>";
     print "</td></tr>";
     print "<tr valign='top'><td>";
     print "<span class='boxtitle'>" . LBL_APPT_TYPE . "</span><br> ";
     print appointment::show_appointment($template["appointment_id"]);
     print "<br/></td></tr>";
     print "<tr valign='top'><td>";
     print "<span class='boxtitle'>" . LBL_SMS_TEMPLATE_TEXT . "</span><br> ";
     print "<input type='text' class='textbox' size='40' maxlength='120' name='template_text' value='" . stripslashes($template["template_text"] ? $template["template_text"] : $post_vars["template_text"]) . "' style='border: 1px solid #000000'><br>";
     print "</td></tr>";
     print "<tr><td><br>";
     if ($get_vars["template_id"]) {
         print "<input type='hidden' name='appointment_id' value='" . $get_vars["appointment_id"] . "'>";
         print "<input type='submit' value = 'Update Template' class='textbox' name='submittemplate' style='border: 1px solid #000000'> ";
         print "<input type='submit' value = 'Delete Template' class='textbox' name='submittemplate' style='border: 1px solid #000000'> ";
     } else {
         print "<input type='submit' value = 'Add Template' class='textbox' name='submittemplate' style='border: 1px solid #000000'> ";
     }
     print "</td></tr>";
     print "</form>";
     print "</table><br>";
 }
Example #5
0
 function form_ntp_appointment()
 {
     //
     // called by _ntp_appointment()
     //
     if (func_num_args()) {
         $arg_list = func_get_args();
         $menu_id = $arg_list[0];
         $post_vars = $arg_list[1];
         $get_vars = $arg_list[2];
     }
     print "<table width='400'>";
     print "<form action = '" . $_SERVER["SELF"] . "?page=LIBRARIES&menu_id={$menu_id}' name='form_ntp_appointment' method='post'>";
     print "<tr valign='top'><td>";
     print "<span class='library'>" . FTITLE_NTP_APPOINTMENT_FORM . "</span><br><br>";
     print "</td></tr>";
     print "<tr valign='top'><td>";
     print "<span class='boxtitle'>" . LBL_APPOINTMENT_SELECTION . "</span><br> ";
     print appointment::show_appointment();
     print "</td></tr>";
     print "<tr><td><br>";
     if ($_SESSION["priv_delete"]) {
         print "<input type='submit' value = 'Delete Appointment' class='textbox' name='submitappt' style='border: 1px solid #000000'> ";
     }
     if ($_SESSION["priv_add"]) {
         print "<input type='submit' value = 'Add Appointment' class='textbox' name='submitappt' style='border: 1px solid #000000'> ";
     }
     print "</td></tr>";
     print "</form>";
     print "</table><br>";
 }