function displayAllARTVisits()
 {
     global $db, $root_path, $date_format;
     $debug = false;
     $debug ? $db->debug = TRUE : ($db->debug = FALSE);
     $fields = array('pregnant', 'cotrim', 'diflucan', 'nutrition_support');
     $code = array('1' => 'yes', '2' => 'no');
     $this->getARTData();
     if (!($this->res = $this->getAllARTVisits())) {
         return false;
     }
     if (!$this->res->RecordCount()) {
         $this->error_message['db'] = "There are no visits for this patients yet!";
         $this->errors++;
         return false;
     }
     $i = 0;
     while ($this->row_elem = $this->res->FetchRow()) {
         $artVisit = new ARV_Visit(null, $this->row_elem['visit_id']);
         $visit_data[$i] = $artVisit->getVisitTableData();
         foreach ($visit_data[$i] as $index => $value) {
             if (is_array($value)) {
                 foreach ($value as $element) {
                     $temp = explode("|", $element, 3);
                     $visit_data[$i][$index] .= $temp[2] . ", ";
                 }
             } else {
                 if (strpos($value, "|")) {
                     $temp = explode("|", $value, 3);
                     $visit_data[$i][$index] = $temp[2];
                 } else {
                     $visit_data[$i][$index] = $value;
                 }
             }
         }
         if (!empty($visit_data[$i]['height'])) {
             $visit_data[$i]['weight_height'] = $visit_data[$i]['weight'] . "\\" . $visit_data[$i]['height'];
         } else {
             $visit_data[$i]['weight_height'] = $visit_data[$i]['weight'];
         }
         if (!empty($visit_data[$i]['adher_reas_code'])) {
             $visit_data[$i]['adher_combined'] = $visit_data[$i]['adher_code'] . "\\" . $visit_data[$i]['adher_reas_code'];
         } else {
             $visit_data[$i]['adher_combined'] = $visit_data[$i]['adher_code'];
         }
         foreach ($fields as $var) {
             $visit_data[$i][$var] = $code[$visit_data[$i][$var]];
         }
         if (!empty($visit_data[$i]['date_of_delivery'])) {
             $visit_data[$i]['pregnancy'] = $visit_data[$i]['pregnant'] . ", " . $visit_data[$i]['date_of_delivery'];
         } else {
             $visit_data[$i]['pregnancy'] = $visit_data[$i]['pregnant'];
         }
         if (!empty($visit_data[$i]['regimen_days'])) {
             $visit_data[$i]['regimen_combined'] = $visit_data[$i]['regimen_code'] . "\\" . $visit_data[$i]['regimen_days'];
         } else {
             $visit_data[$i]['regimen_combined'] = $visit_data[$i]['regimen_code'];
         }
         $i++;
     }
     return $visit_data;
 }
示例#2
0
//-------------------------------------------------------------------------------------------------------------------------------------
$debug = false;
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$add_breakfile = "&pid=" . $_REQUEST['pid'] . "&encounter_nr=" . $_REQUEST['encounter_nr'];
$filename = "arv_menu.php";
$breakfile = "modules/arv_2/arv_menu.php";
//------------------------------------------------------------------------------------------------------------
if (empty($_REQUEST['pid']) or empty($_REQUEST['encounter_nr'])) {
    $error_messages = "<div class=\"errorMessages\">No patient is selected! </div>";
    require "gui/gui_arv_visit.php";
    die;
}
$o_arv_patient = new ART_patient($_REQUEST['pid']);
$o_arv_patient->getARTData();
$o_arv_visit = new ARV_Visit($_REQUEST['encounter_nr'], $_REQUEST['visit_id'], $o_arv_patient->getRegistrationID());
$visit_table_rows = $o_arv_patient->displayAllARTVisits();
$art_info = $o_arv_patient->getshortARTSummary();
if (isset($_REQUEST['submit'])) {
    $o_val =& new Validator($o_arv_visit->getDefaultData(), $_REQUEST);
    $o_val->set_rule('visit_date', 'rule_required');
    $o_val->set_rule('visit_date', 'rule_date');
    $o_val->set_rule('adher_code', 'rule_required');
    $o_val->set_rule('functional_status', 'rule_required');
    $o_val->set_rule('signature', 'rule_required');
    $o_val->set_rule('visit_type', 'rule_required');
    $o_val->set_rule('clinical_stage', 'rule_required');
    $o_val->set_rule('status', 'rule_required');
    $o_val->set_rule('regimen_days', 'rule_numeric');
    $o_val->set_rule('cd4', 'rule_numeric');
    $o_val->set_rule('hb', 'rule_numeric');