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;
            }
        }

	}
Example #2
0
 function display_patient_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];
     }
     $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]);
     $actual_weight = wtforage::get_body_weight($get_vars["consult_id"]);
     $ccdev_id = ccdev::registry_record_exists($patient_id);
     print "<span class='tinylight'>";
     print LBL_CCDEV_ID . ": <font color='red'>" . ($ccdev_id ? module::pad_zero($ccdev_id, 7) : "none") . "</font><br/>";
     print LBL_AGE_IN_WEEKS . ": " . ccdev::get_age_weeks($patient_id) . "<br/>";
     print LBL_WEIGHT . ": {$actual_weight}<br/>";
     list($min, $max, $class) = wtforage::_wtforage($get_vars["consult_id"]);
     if ($class) {
         print LBL_WT_FOR_AGE . ": <font color='red'>" . strtoupper($class) . "</font> (min: {$min}, max: {$max})<br/>";
     } else {
         print LBL_WT_FOR_AGE . ": <font color='red'>" . LBL_NO_WEIGHT_AVAILABLE . "</font><br/>";
     }
     print LBL_IMMUNIZATION_STATUS . ": ";
     $vacc_status = ccdev::determine_vacc_status($patient_id);
     if ($vacc_status == 'Incomplete') {
         echo "<font color='red'><b>{$vacc_status}</b></font><br>";
     } else {
         echo "<b>{$vacc_status}</b><br>";
     }
     print "CHILD PROTECTECTED AT BIRTH" . ": ";
     echo ccdev::get_cpab_status($ccdev_id, $patient_id) . "<br>";
     print "LOW BIRTH WEIGHT" . ": ";
     echo ccdev::check_low_birth_wt($ccdev_id, $patient_id) . '<br>';
     print "</span>";
 }
    function display_patient_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];
        }
        $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]);
		$actual_weight = wtforage::get_body_weight($get_vars["consult_id"]);
        $ccdev_id = ccdev::registry_record_exists($patient_id);
        print "<span class='tinylight'>";
        print LBL_CCDEV_ID.": <font color='red'>".($ccdev_id?module::pad_zero($ccdev_id,7):"none")."</font><br/>";
        print LBL_AGE_IN_WEEKS.": ".ccdev::get_age_weeks($patient_id)."<br/>";
        print LBL_WEIGHT.": $actual_weight<br/>";
        list($min, $max, $class) = wtforage::_wtforage($get_vars["consult_id"]);
        if ($class) {
            print LBL_WT_FOR_AGE.": <font color='red'>".strtoupper($class)."</font> (min: $min, max: $max)<br/>";
        } else {
            print LBL_WT_FOR_AGE.": <font color='red'>".LBL_NO_WEIGHT_AVAILABLE."</font><br/>";
        }
        print LBL_IMMUNIZATION_STATUS.": ".ccdev::get_immunization_status($patient_id)."<br/>";
        print "</span>";
    }