예제 #1
0
 function get_cal_reminders()
 {
     // Get persons reminders
     $query = prepare("SELECT * \n                        FROM reminder\n                        JOIN reminderRecipient ON reminderRecipient.reminderID = reminder.reminderID\n                       WHERE personID = %d\n                         AND (reminderRecuringInterval = 'No' OR (reminderRecuringInterval != 'No' AND reminderActive))\n                       GROUP BY reminder.reminderID", $this->person->get_id());
     $this->db->query($query);
     $reminders = array();
     while ($row = $this->db->row()) {
         $reminder = new reminder();
         $reminder->read_db_record($this->db);
         if ($reminder->is_alive()) {
             $reminderTime = format_date("U", $reminder->get_value("reminderTime"));
             // If repeating reminder
             if ($reminder->get_value('reminderRecuringInterval') != "No" && $reminder->get_value('reminderRecuringValue') != 0) {
                 $interval = $reminder->get_value('reminderRecuringValue');
                 $intervalUnit = $reminder->get_value('reminderRecuringInterval');
                 while ($reminderTime < format_date("U", $this->last_date) + 86400) {
                     $row["reminderTime"] = $reminderTime;
                     $reminders[date("Y-m-d", $reminderTime)][] = $row;
                     $reminderTime = $reminder->get_next_reminder_time($reminderTime, $interval, $intervalUnit);
                 }
                 // Else if once off reminder
             } else {
                 $row["reminderTime"] = $reminderTime;
                 $reminders[date("Y-m-d", $reminderTime)][] = $row;
             }
         }
     }
     return $reminders;
 }
예제 #2
0
 function generate_summary()
 {
     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);
     }
     list($month, $day, $year) = explode("/", $post_vars["report_date"]);
     //$report_date = $year."-".str_pad($month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT);
     $report_date = $year . '-' . $month . '-' . str_pad($day, 2, "0", STR_PAD_LEFT);
     list($end_month, $end_day, $end_year) = explode("/", $post_vars["end_report_date"]);
     //$end_report_date = $end_year."-".str_pad($end_month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT);
     $end_report_date = $end_year . '-' . $end_month . '-' . str_pad($end_day, 2, "0", STR_PAD_LEFT);
     $_SESSION[report_date] = $report_date;
     $_SESSION[end_report_date] = $end_report_date;
     // STEP 1. empty report tables for given date
     $sql_delete = "delete from m_consult_report_dailyservice where service_date BETWEEN '{$report_date}' AND '{$end_report_date}'";
     $result_delete = mysql_query($sql_delete);
     $sql_delete = "delete from m_consult_ccdev_report_dailyservice where service_date BETWEEN '{$report_date}' AND '{$end_report_date}'";
     $result_delete = mysql_query($sql_delete);
     $sql_delete = "delete from m_consult_mc_report_dailyservice where service_date BETWEEN '{$report_date}' AND '{$end_report_date}'";
     $result_delete = mysql_query($sql_delete);
     // STEP 2. get all consults for specified report date
     // records are unique for patient_id and service_date
     /*$sql_patient = "select c.patient_id, c.consult_id, ".
       "concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, ".
              "round((to_days(c.consult_date)-to_days(p.patient_dob))/365,2) patient_age, ".
              "p.patient_gender ".
              "from m_consult c, m_patient p ".
              "where c.patient_id = p.patient_id ".
              "and to_days(c.consult_date) = to_days('$report_date')"; */
     $sql_patient = "select c.patient_id, c.consult_id, " . "concat(p.patient_lastname, ', ', p.patient_firstname, ' ',p.patient_middle) patient_name, " . "round((to_days(c.consult_date)-to_days(p.patient_dob))/365,2) patient_age, " . "p.patient_gender,date_format(c.consult_date,'%h:%i %p') as consult_start,date_format(c.consult_end,'%h:%i %p') as consult_end, round((unix_timestamp(c.consult_end)-unix_timestamp(c.consult_date))/60,2) as consult_minutes, elapsed_time " . "from m_consult c, m_patient p " . "where c.patient_id = p.patient_id " . "and c.consult_date BETWEEN '{$report_date}' AND '{$end_report_date}'";
     $result_patient = mysql_query($sql_patient) or die("Cannot query: 305 " . mysql_error());
     if ($result_patient) {
         if (mysql_num_rows($result_patient)) {
             while ($patient = mysql_fetch_array($result_patient)) {
                 // get family and address
                 if ($family_id = family::get_family_id($patient["patient_id"])) {
                     $patient_address = family::get_family_address($family_id);
                     $barangay_id = family::barangay_id($family_id);
                 } else {
                     $family_id = 0;
                     $barangay_id = 0;
                     $patient_address = reminder::get_home_address($patient_id);
                     //$barangay_name = reminder::get_barangay($patient_id);
                 }
                 // get chief complaint and diagnosis from notes
                 $complaints = notes::get_complaints($patient["patient_id"], $report_date);
                 $diagnosis = notes::get_diagnosis_list($patient["patient_id"], $report_date);
                 $treatment = notes::get_plan($patient["patient_id"], $report_date);
                 //get vaccines
                 $vaccines = $this->get_vaccines($patient["patient_id"], $report_date, $end_report_date);
                 $services = $this->get_services($patient["consult_id"], $patient["patient_id"], $report_date, $end_report_date);
                 $ptgroup = $this->get_ptgroup($patient["consult_id"], $report_date, $end_report_date);
                 $aog = $this->get_aog($patient["patient_id"], $report_date, $end_report_date);
                 $visit_seq = healthcenter::get_total_visits($patient["patient_id"]);
                 $philhealth_id = philhealth::get_philhealth_id($patient["patient_id"]);
                 //get elapsed time and data and time started
                 $elapsed_time = $this->get_str_elapsed($patient["consult_start"], $patient["consult_end"], $patient["elapsed_time"]);
                 if ($mc_id = mc::registry_record_exists($patient["patient_id"])) {
                     $pp_weeks = mc::get_pp_weeks($mc_id, $patient["consult_id"]);
                     //$visit_sequence = mc::get_ppvisit_sequence($mc_id, $patient["consult_id"]);
                 }
                 if ($complaints != '' || $diagnosis != '' || $treatment != '') {
                     $sql_insert = "insert into m_consult_report_dailyservice (patient_id, patient_name, " . "patient_gender, patient_age, patient_address, patient_bgy, family_id, philhealth_id, " . "notes_cc, notes_dx, notes_tx, service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$patient_address}', '{$barangay_id}', '{$family_id}', '{$philhealth_id}', " . "'{$complaints}', '{$diagnosis}', '{$treatment}', '{$report_date}')";
                     $result_insert = mysql_query($sql_insert);
                 }
                 if ($vaccines != '' || $services != '') {
                     if ($ptgroup == 'CHILD') {
                         $sql_insert = "insert into m_consult_ccdev_report_dailyservice (patient_id, " . "patient_name, patient_gender, patient_age, patient_address, patient_bgy, " . "family_id, philhealth_id, service_given, vaccine_given, service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$patient_address}', '{$barangay_id}', '{$family_id}', '{$philhealth_id}', " . "'{$services}', '{$vaccines}', '{$report_date}')";
                         $result_insert = mysql_query($sql_insert);
                     }
                     if ($ptgroup == 'MATERNAL') {
                         $sql_insert = "insert into m_consult_mc_report_dailyservice (patient_id, " . "patient_name, patient_gender, patient_age, aog_weeks, postpartum_weeks, patient_address, " . "patient_bgy, family_id, philhealth_id, visit_sequence, service_given, vaccine_given, " . "service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$aog}', '{$pp_weeks}', '{$patient_address}', '{$barangay_id}', '{$family_id}', '{$philhealth_id}', " . "'{$visit_seq}', '{$services}', '{$vaccines}', '{$report_date}')";
                         $result_insert = mysql_query($sql_insert);
                     }
                 }
             }
             /*$sql = "select patient_id 'PATIENT ID', concat(patient_name,' / ',patient_gender,' / ',patient_age) ".
                                    "'NAME / SEX / AGE', patient_address 'ADDRESS', patient_bgy 'BRGY', family_id 'FAMILY ID', ".  
                                    "philhealth_id 'PHILHEALTH ID', notes_cc 'COMPLAINTS', notes_dx 'DIAGNOSIS', notes_tx 'TREATMENT' ".
                                    "from m_consult_report_dailyservice where service_date = '$report_date' order by patient_name ";
                              
                             $pdf = new PDF('L','pt','A4');
                             $pdf->SetFont('Arial','',12); 
                             $pdf->AliasNbPages();
                             $pdf->connect('localhost','$_SESSION[dbuser]','$_SESSION[dbpass]','$_SESSION[dbname]');
                             $attr=array('titleFontSize'=>14,'titleText'=>'DAILY SERVICE REGISTER - CONSULTS');
             		$pdf->mysql_report($sql,false,$attr,"../modules/_uploads/consult_reg.pdf");
             		header("location:".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=SUMMARY");
             
                             //$sql = "select patient_id 'PATIENT ID', concat(patient_name,' / ',patient_gender,' / ',patient_age) ".
                             //       "'NAME / SEX / AGE', patient_address 'ADDRESS', patient_bgy 'BRGY', family_id 'FAMILY ID', ".  
                             //       "philhealth_id 'PHILHEALTH ID', vaccine_given 'VACCINE(S) GIVEN', service_given 'SERVICE(S) GIVEN' "
                             //       "from m_consult_ccdev_report_dailyservice where service_date = '$report_date' order by patient_name ";
                     
                             //$pdf = new PDF('L','pt','A4');
                             //$pdf->SetFont('Arial','',12); 
                             //$pdf->AliasNbPages();
                             //$pdf->connect('localhost','$_SESSION[dbuser]','$_SESSION[dbpass]','$_SESSION[dbname]');
                             //$attr=array('titleFontSize'=>14,'titleText'=>'DAILY SERVICE REGISTER - CHILD CARE SERVICES');
             		//$pdf->mysql_report($sql,false,$attr,"../modules/_uploads/consult_ccdev_reg.pdf");
             		//header("location:".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=SUMMARY");
             
                             $sql = "select patient_id 'PATIENT ID', concat(patient_name,' / ',patient_gender,' / ',patient_age) ".
                                    "'NAME / SEX / AGE', aog_weeks 'AOG (wks)', postpartum_weeks 'POSTPARTUM WK', ". 
                                    "patient_address 'ADDRESS', patient_bgy 'BRGY', family_id 'FAMILY ID', ".
                                    "philhealth_id 'PHILHEALTH ID', visit_sequence 'VISIT SEQ.', vaccine_given 'VACCINE(S) GIVEN', ".
                                    "service_given 'SERVICE(S) GIVEN' ".
                                    "from m_consult_mc_report_dailyservice where service_date = '$report_date' order by patient_name ";
             
                             $pdf = new PDF('L','pt','A4');
                             $pdf->SetFont('Arial','',12); 
                             $pdf->AliasNbPages();
                             $pdf->connect('localhost','$_SESSION[dbuser]','$_SESSION[dbpass]','$_SESSION[dbname]');
                             $attr=array('titleFontSize'=>14,'titleText'=>'DAILY SERVICE REGISTER - MATERNAL CARE SERVICES');
             		$pdf->mysql_report($sql,false,$attr,"../modules/_uploads/consult_mc_reg.pdf");
             		header("location:".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=SUMMARY");
                             */
         }
     }
     //STEP 3. display daily service report
     print "<br/>";
     print "<b>DAILY SERVICE REPORT</b><br/>";
     print "REPORT DATE : <b>" . $post_vars["report_date"] . " to " . $post_vars["end_report_date"] . "</b><br/><br/>";
     print "PRINTER FRIENDLY VERSION: <a href='../chits_query/pdf_reports/dailyservice_report.php?arr=consult' target='new'>CONSULTS</a>&nbsp;&nbsp;&nbsp;";
     print "<a href='../chits_query/pdf_reports/dailyservice_report.php?arr=ccdev' target='new'>CHILD CARE</a>&nbsp;&nbsp;&nbsp;";
     print "<a href='../chits_query/pdf_reports/dailyservice_report.php?arr=mc' target='new'>MATERNAL CARE</a><br />";
     $_SESSION["arr_consult"] = $this->display_consults($report_date, "patient_id", $end_report_date);
     //pass the report_date and patient_id
     $_SESSION["arr_ccdev"] = $this->display_ccdev($report_date, $end_report_date);
     $_SESSION["arr_mc"] = $this->display_mc($report_date, $end_report_date);
     $sql = "select count(distinct(patient_id)) from m_consult where " . "to_days(consult_date) = to_days('{$report_date}') and patient_id != '0'";
     $result = mysql_result(mysql_query($sql), 0);
     print "<br/>";
     print "Total No. of Today's Patients : {$result}";
 }
예제 #3
0
	}
}
if (file_exists('../modules/region/class.region.php')) {
	include '../modules/region/class.region.php';
	$region = new region;
	if (!$module->activated('region') && $initmod) {
		$region->init_sql();
		$region->init_menu();
		$region->init_deps();
		$region->init_lang();
		$region->init_help();
	}
}
if (file_exists('../modules/reminder/class.reminder.php')) {
	include '../modules/reminder/class.reminder.php';
	$reminder = new reminder;
	if (!$module->activated('reminder') && $initmod) {
		$reminder->init_sql();
		$reminder->init_menu();
		$reminder->init_deps();
		$reminder->init_lang();
		$reminder->init_help();
	}
}
if (file_exists('../modules/smoking/class.smoking.php')) {
	include '../modules/smoking/class.smoking.php';
	$smoking = new smoking;
	if (!$module->activated('smoking') && $initmod) {
		$smoking->init_sql();
		$smoking->init_menu();
		$smoking->init_deps();
예제 #4
0
 function display_consult_reminders()
 {
     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 "<b>" . FTITLE_REMINDERS_FOR_PATIENT . "</b><br/><br/>";
     $sql = "select reminder_id, reminder_date " . "from m_consult_reminder where consult_id = '" . $get_vars["consult_id"] . "'";
     if ($result = mysql_query($sql)) {
         if (mysql_num_rows($result)) {
             while (list($id, $date) = mysql_fetch_array($result)) {
                 print "<img src='../images/arrow_redwhite.gif' border='0'/> ";
                 print "<font color='red'>" . module::pad_zero($id, 7) . "</font> ";
                 print "<a href='" . $_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&reminder_id={$id}'>{$date}</a><br/>";
                 if ($get_vars["reminder_id"] == $id) {
                     reminder::display_consult_reminder_detail($menu_id, $post_vars, $get_vars);
                 }
             }
         } else {
             print "<font color='red'>No reminders set for this consult.</font><br/>";
         }
     }
 }
예제 #5
0
                $reminder->set_value('reminderRecuringValue', $_POST["reminder_recuring_value"]);
            }
            $reminder->set_value('reminderAdvNoticeSent', '0');
            if (!$_POST["reminder_advnotice_value"]) {
                $reminder->set_value('reminderAdvNoticeInterval', 'No');
                $reminder->set_value('reminderAdvNoticeValue', '0');
            } else {
                $reminder->set_value('reminderAdvNoticeInterval', $_POST["reminder_advnotice_interval"]);
                $reminder->set_value('reminderAdvNoticeValue', $_POST["reminder_advnotice_value"]);
            }
            $reminder->set_value('reminderSubject', $_POST["reminder_subject"]);
            $reminder->set_value('reminderContent', rtrim($_POST["reminder_content"]));
            $reminder->set_value('reminderActive', sprintf("%d", $_POST["reminderActive"]));
            $reminder->save();
            $reminder->update_recipients($recipient_keys);
            $returnToParent = "reminder";
            $reminderID = $reminder->get_id();
            $TPL["message_good"][] = "Reminder saved.";
        } else {
            if ($_POST["reminder_delete"] && $_POST["reminder_id"]) {
                $reminder = new reminder();
                $reminder->set_id($_POST["reminder_id"]);
                $reminder->delete();
            }
        }
        $headers = array("client" => $TPL["url_alloc_client"] . "clientID=" . $parentID . "&sbs_link=reminders", "project" => $TPL["url_alloc_project"] . "projectID=" . $parentID . "&sbs_link=reminders", "task" => $TPL["url_alloc_task"] . "taskID=" . $parentID . "&sbs_link=reminders", "home" => $TPL["url_alloc_home"], "calendar" => $TPL["url_alloc_taskCalendar"] . "personID=" . $_POST["personID"], "list" => $TPL["url_alloc_reminderList"], "reminder" => $TPL["url_alloc_reminder"] . "reminderID=" . $reminderID . "&step=3", "" => $TPL["url_alloc_reminderList"]);
        alloc_redirect($headers[$returnToParent]);
        break;
    default:
        alloc_error("Unrecognized state");
}
예제 #6
0
 function add_notification($tokenActionID, $maxUsed, $name, $desc, $recipients, $datetime = false)
 {
     $current_user =& singleton("current_user");
     $token = new token();
     $token->set_value("tokenEntity", "task");
     $token->set_value("tokenEntityID", $this->get_id());
     $token->set_value("tokenActionID", $tokenActionID);
     $token->set_value("tokenActive", 1);
     $token->set_value("tokenMaxUsed", $maxUsed);
     $token->set_value("tokenCreatedBy", $current_user->get_id());
     $token->set_value("tokenCreatedDate", date("Y-m-d H:i:s"));
     $hash = $token->generate_hash();
     $token->set_value("tokenHash", $hash);
     $token->save();
     if ($token->get_id()) {
         $reminder = new reminder();
         $reminder->set_value("reminderType", "task");
         $reminder->set_value("reminderLinkID", $this->get_id());
         $reminder->set_value("reminderHash", $hash);
         $reminder->set_value("reminderSubject", $name);
         $reminder->set_value("reminderContent", $desc);
         if ($datetime) {
             $reminder->set_value("reminderTime", $datetime);
         }
         $reminder->save();
         if ($reminder->get_id()) {
             foreach ($recipients as $row) {
                 $reminderRecipient = new reminderRecipient();
                 $reminderRecipient->set_value("reminderID", $reminder->get_id());
                 $reminderRecipient->set_value($row["field"], $row["who"]);
                 $reminderRecipient->save();
             }
         }
     }
 }
    function generate_summary() {
        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);
        }
        list($month, $day, $year) = explode("/", $post_vars["report_date"]);
        $report_date = $year."-".str_pad($month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT);
        // STEP 1. empty report table for given date
        print $sql_delete = "delete from m_consult_report_dailyservice where service_date = '$report_date'";
        $result_delete = mysql_query($sql_delete);

        // STEP 2. get all consults for specified report date
        // records are unique for patient_id and service_date
        $sql_patient = "select c.patient_id, concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, ".
                    "round((to_days(c.consult_date)-to_days(p.patient_dob))/365,2) patient_age, ".
                    "p.patient_gender ".
                    "from m_consult c, m_patient p ".
                    "where c.patient_id = p.patient_id ".
                    "and to_days(c.consult_date) = to_days('$report_date')";
        if ($result_patient = mysql_query($sql_patient)) {
            if (mysql_num_rows($result_patient)) {
                while ($patient = mysql_fetch_array($result_patient)) {
                    // get family and address
                    if ($family_id = family::get_family_id($patient["patient_id"])) {
                        $patient_address = family::get_family_address($family_id);
                        $barangay_name = family::barangay_name($family_id);
                    } else {
                        $family_id = 0;
                        $patient_address = reminder::get_home_address($patient_id);
                        $barangay_name = reminder::get_barangay($patient_id);
                    }
                    // get chief complaint from notes
                    $complaints = notes::get_complaints($patient["patient_id"], $report_date);
                    // get notes dx list or icd10 list
                    if (!$dx_list = icd10::get_icd10_list($patient["patient_id"], $report_date)) {
                        $dx_list = notes::get_diagnosis_list($patient["patient_id"], $report_date);
                    }
                    // get treatment data from notes
                    $plans = notes::get_plan($patient["patient_id"], $report_date);

                    $sql_insert = "insert into m_consult_report_dailyservice (patient_id, patient_name, patient_gender, ".
                                  "patient_age, patient_address, patient_bgy, family_id, notes_cc, notes_dx, notes_tx, service_date) ".
                                  "values ('".$patient["patient_id"]."', '".$patient["patient_name"]."', ".
                                  "'".$patient["patient_gender"]."', '".$patient["patient_age"]."', ".
                                  "'$patient_address', '$barangay_name', '$family_id', '$complaints', ".
                                  "'$dx_list', '$plans', '$report_date')";
                    $result_insert = mysql_query($sql_insert);
                }
            }
        }
    }
 function generate_summary()
 {
     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);
     }
     list($month, $day, $year) = explode("/", $post_vars["report_date"]);
     $report_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT);
     // STEP 1. empty report tables for given date
     $sql_delete = "delete from m_consult_report_dailyservice where service_date = '{$report_date}'";
     $result_delete = mysql_query($sql_delete);
     $sql_delete = "delete from m_consult_ccdev_report_dailyservice where service_date = '{$report_date}'";
     $result_delete = mysql_query($sql_delete);
     $sql_delete = "delete from m_consult_mc_report_dailyservice where service_date = '{$report_date}'";
     $result_delete = mysql_query($sql_delete);
     // STEP 2. get all consults for specified report date
     // records are unique for patient_id and service_date
     $sql_patient = "select c.patient_id, c.consult_id, " . "concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, " . "round((to_days(c.consult_date)-to_days(p.patient_dob))/365,2) patient_age, " . "p.patient_gender " . "from m_consult c, m_patient p " . "where c.patient_id = p.patient_id " . "and to_days(c.consult_date) = to_days('{$report_date}')";
     if ($result_patient = mysql_query($sql_patient)) {
         if (mysql_num_rows($result_patient)) {
             while ($patient = mysql_fetch_array($result_patient)) {
                 // get family and address
                 if ($family_id = family::get_family_id($patient["patient_id"])) {
                     $patient_address = family::get_family_address($family_id);
                     $barangay_name = family::barangay_name($family_id);
                 } else {
                     $family_id = 0;
                     $patient_address = reminder::get_home_address($patient_id);
                     $barangay_name = reminder::get_barangay($patient_id);
                 }
                 // get chief complaint and diagnosis from notes
                 $complaints = notes::get_complaints($patient["patient_id"], $report_date);
                 $diagnosis = notes::get_diagnosis_list($patient["patient_id"], $report_date);
                 $treatment = notes::get_plan($patient["patient_id"], $report_date);
                 //get vaccines
                 $vaccines = $this->get_vaccines($patient["patient_id"], $report_date);
                 $services = $this->get_services($patient["consult_id"], $patient["patient_id"], $report_date);
                 $ptgroup = $this->get_ptgroup($patient["consult_id"], $report_date);
                 $aog = $this->get_aog($patient["patient_id"], $report_date);
                 $visit_seq = healthcenter::get_total_visits($patient["patient_id"]);
                 if ($mc_id = mc::registry_record_exists($patient["patient_id"])) {
                     $pp_weeks = mc::get_pp_weeks($mc_id, $patient["consult_id"]);
                     //$visit_sequence = mc::get_ppvisit_sequence($mc_id, $patient["consult_id"]);
                 }
                 if ($complaints != '' || $diagnosis != '' || $treatment != '') {
                     $sql_insert = "insert into m_consult_report_dailyservice (patient_id, patient_name, " . "patient_gender, patient_age, patient_address, patient_bgy, family_id, " . "notes_cc, notes_dx, notes_tx, service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$patient_address}', '{$barangay_name}', '{$family_id}', " . "'{$complaints}', '{$diagnosis}', '{$treatment}', '{$report_date}')";
                     $result_insert = mysql_query($sql_insert);
                 }
                 if ($vaccines != '' || $services != '') {
                     if ($ptgroup == 'CHILD') {
                         $sql_insert = "insert into m_consult_ccdev_report_dailyservice (patient_id, " . "patient_name, patient_gender, patient_age, patient_address, patient_bgy, " . "family_id, service_given, vaccine_given, service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$patient_address}', '{$barangay_name}', '{$family_id}', " . "'{$services}', '{$vaccines}', '{$report_date}')";
                         $result_insert = mysql_query($sql_insert);
                     }
                     if ($ptgroup == 'MATERNAL') {
                         $sql_insert = "insert into m_consult_mc_report_dailyservice (patient_id, " . "patient_name, patient_gender, patient_age, aog_weeks, postpartum_weeks, patient_address, " . "patient_bgy, family_id, visit_sequence, service_given, vaccine_given, " . "service_date) values " . "('" . $patient["patient_id"] . "', '" . $patient["patient_name"] . "', " . "'" . $patient["patient_gender"] . "', '" . $patient["patient_age"] . "', " . "'{$aog}', '{$pp_weeks}', '{$patient_address}', '{$barangay_name}', '{$family_id}', '{$visit_seq}', " . "'{$services}', '{$vaccines}', '{$report_date}')";
                         $result_insert = mysql_query($sql_insert);
                     }
                 }
             }
         }
     }
     //STEP 3. display daily service report
     print "<br/>";
     print "<b>DAILY SERVICE REPORT</b><br/>";
     print "REPORT DATE : <b>" . $post_vars["report_date"] . "</b><br/><br/>";
     $this->display_consults($report_date);
     $this->display_ccdev($report_date);
     $this->display_mc($report_date);
     $sql = "select count(distinct(patient_id)) from m_consult where " . "to_days(consult_date) = to_days('{$report_date}') and patient_id != '0'";
     $result = mysql_result(mysql_query($sql), 0);
     print "<br/>";
     print "Total No. of Today's Patients : {$result}";
 }
예제 #9
0
$query = prepare("SELECT *\n                    FROM reminder\n                   WHERE reminderActive = 1\n                     AND reminderAdvNoticeSent = 0\n                     AND NOW() > \n                         CASE\n                           WHEN reminderAdvNoticeInterval = 'Minute' THEN DATE_SUB(reminderTime, INTERVAL reminderAdvNoticeValue MINUTE)\n                           WHEN reminderAdvNoticeInterval = 'Hour'   THEN DATE_SUB(reminderTime, INTERVAL reminderAdvNoticeValue HOUR)\n                           WHEN reminderAdvNoticeInterval = 'Day'    THEN DATE_SUB(reminderTime, INTERVAL reminderAdvNoticeValue DAY)\n                           WHEN reminderAdvNoticeInterval = 'Week'   THEN DATE_SUB(reminderTime, INTERVAL reminderAdvNoticeValue WEEK)\n                           WHEN reminderAdvNoticeInterval = 'No'     THEN NULL\n                         END\n                 ");
$db->query($query);
while ($db->next_record()) {
    $reminder = new reminder();
    $reminder->read_db_record($db);
    //echo "<br>Adv: ".$reminder->get_id();
    $current_user = new person();
    $current_user->load_current_user($db->f('reminderCreatedUser'));
    singleton("current_user", $current_user);
    if (!$reminder->is_alive()) {
        $reminder->deactivate();
    } else {
        $reminder->mail_advnotice();
    }
}
// do reminders
$query = prepare("SELECT *\n                    FROM reminder\n                   WHERE reminderActive = 1\n                     AND (reminderTime IS NULL OR NOW() > reminderTime)\n                 ");
$db->query($query);
while ($db->next_record()) {
    $reminder = new reminder();
    $reminder->read_db_record($db);
    //echo "<br>Rem: ".$reminder->get_id();
    $current_user = new person();
    $current_user->load_current_user($db->f('reminderCreatedUser'));
    singleton("current_user", $current_user);
    if (!$reminder->is_alive()) {
        $reminder->deactivate();
    } else {
        $reminder->mail_reminder();
    }
}
예제 #10
0
 function edit_reminder($commands)
 {
     $id = $commands["reminder"];
     $options = $commands;
     $reminder = new reminder();
     if ($id and $id != "new") {
         $reminder->set_id($id);
         $reminder->select();
     } else {
         if ($id == "new") {
             // extra sanity checks, partially filled in reminder isn't much good
             if (!$options['date'] || !$options['subject'] || !$options['recipients']) {
                 $status[] = "err";
                 $message[] = "Missing one of date, subject or recipients.";
                 return array($status, $message);
             }
             if ($options['task']) {
                 $reminder->set_value('reminderType', 'task');
                 $reminder->set_value('reminderLinkID', $options['task']);
             } else {
                 if ($options['project']) {
                     $reminder->set_value('reminderType', 'project');
                     $reminder->set_value('reminderLinkID', $options['project']);
                 } else {
                     if ($options['client']) {
                         $reminder->set_value('reminderLinkID', $options['client']);
                         $reminder->set_value('reminderType', 'client');
                     }
                 }
             }
         }
     }
     // Tear apart the frequency bits
     if ($options['frequency']) {
         list($freq, $units) = sscanf($options['frequency'], "%d%c");
         $freq_units = array('h' => 'Hour', 'd' => 'Day', 'w' => 'Week', 'm' => 'Month', 'y' => 'Year');
         $options['frequency'] = $freq;
         $options['frequency_units'] = $freq_units[strtolower($units)];
     }
     if ($options['notice']) {
         list($freq, $units) = sscanf($options['notice'], "%d%c");
         $freq_units = array('h' => 'Hour', 'd' => 'Day', 'w' => 'Week', 'm' => 'Month', 'y' => 'Year');
         $options['notice'] = $freq;
         $options['notice_units'] = $freq_units[strtolower($units)];
     }
     $fields = $this->get_fields("reminder");
     foreach ($fields as $s => $d) {
         if ($options[$s]) {
             $reminder->set_value($d[0], $options[$s]);
         }
     }
     if (!$reminder->get_value("reminderRecuringInterval")) {
         $reminder->set_value("reminderRecuringInterval", "No");
     }
     if (!$reminder->get_value("reminderAdvNoticeInterval")) {
         $reminder->set_value("reminderAdvNoticeInterval", "No");
     }
     $reminder->save();
     // Deal with recipients
     if ($options['recipients']) {
         list($_x, $recipients) = $reminder->get_recipient_options();
         if ($options['recipients']) {
             $recipients = array_unique(array_merge($recipients, $options['recipients']));
         }
         if ($options['recipients_remove']) {
             $recipients = array_diff($recipients, $options['recipients_remove']);
         }
         $reminder->update_recipients($recipients);
     }
     if (is_object($reminder) && $reminder->get_id()) {
         $status[] = "yay";
         $message[] = "Reminder " . $reminder->get_id() . " saved.";
     } else {
         $status[] = "err";
         $message[] = "Reminder not saved.";
     }
     return array($status, $message);
 }
예제 #11
0
 function get_list_html($type = null, $id = null)
 {
     global $TPL;
     $_REQUEST["type"] = $type;
     $_REQUEST["id"] = $id;
     $TPL["reminderRows"] = reminder::get_list($_REQUEST);
     $type and $TPL["returnToParent"] = $type;
     $type or $TPL["returnToParent"] = "list";
     include_template(dirname(__FILE__) . "/../templates/reminderListS.tpl");
 }