Пример #1
0
 public function edit($record_no)
 {
     $sql = "SELECT p.*,\n\t\t               rst.Name as service_name,\n\t\t               dp.child,\n\t\t               s.secondary_spouse \n\t\t               FROM patient p \n\t\t               LEFT JOIN regimen_service_type rst ON rst.id=p.service \n\t\t               LEFT JOIN dependants dp ON p.patient_number_ccc=dp.parent  \n\t\t        \t   LEFT JOIN spouses s ON p.patient_number_ccc=s.primary_spouse\n\t\t               WHERE p.id='{$record_no}'\n\t\t               GROUP BY p.id";
     $query = $this->db->query($sql);
     $results = $query->result_array();
     if ($results) {
         $results[0]['other_illnesses'] = $this->extract_illness($results[0]['other_illnesses']);
         $data['results'] = $results;
     }
     $data['record_no'] = $record_no;
     $data['districts'] = District::getPOB();
     $data['genders'] = Gender::getAll();
     $data['statuses'] = Patient_Status::getStatus();
     $data['sources'] = Patient_Source::getSources();
     $data['drug_prophylaxis'] = Drug_Prophylaxis::getAll();
     $data['service_types'] = Regimen_Service_Type::getHydratedAll();
     $data['facilities'] = Facilities::getAll();
     $data['family_planning'] = Family_Planning::getAll();
     $data['other_illnesses'] = Other_Illnesses::getAll();
     $data['pep_reasons'] = Pep_Reason::getActive();
     $data['regimens'] = Regimen::getRegimens();
     $data['drugs'] = Drugcode::getAllEnabled();
     $data['who_stages'] = Who_Stage::getAllHydrated();
     $data['content_view'] = 'edit_patients_v';
     //Hide side menus
     $data['hide_side_menu'] = '1';
     $this->base_params($data);
 }
Пример #2
0
 public function graph_patients_enrolled_in_year($year = "")
 {
     $main_array = array();
     $facility_code = $this->session->userdata('facility');
     $months = array('1' => 'Jan', '2' => 'Feb', '3' => 'Mar', '4' => 'Apr', '5' => 'May', '6' => 'Jun', '7' => 'Jul', '8' => 'Aug', '9' => 'Sep', '10' => 'Oct', '11' => 'Nov', '12' => 'Dec');
     $services_data = Regimen_Service_Type::getHydratedAll();
     foreach ($services_data as $service) {
         $services[] = $service['Name'];
     }
     //Loop through all services
     foreach ($services as $service) {
         $service_array = array();
         $month_data = array();
         $service_array['name'] = $service;
         //Loop through all months
         foreach ($months as $month => $month_name) {
             $sql = "SELECT COUNT(*) AS total\n\t\t\t\t\t    FROM patient p \n\t\t\t\t\t    LEFT JOIN regimen_service_type rst ON p.service=rst.id\n\t\t\t\t\t    WHERE YEAR(p.date_enrolled)='{$year}' \n\t\t\t\t\t    AND MONTH(p.date_enrolled)='{$month}'\n\t\t\t\t\t    AND rst.name LIKE '%{$service}%'\n\t\t\t\t\t    AND p.facility_code='{$facility_code}'";
             $query = $this->db->query($sql);
             $results = $query->result_array();
             if ($results) {
                 $month_data[] = @(int) $results[0]['total'];
             } else {
                 $month_data[] = 0;
             }
         }
         $service_array['data'] = $month_data;
         //append service data to main array
         $main_array[] = $service_array;
     }
     //chart data
     $resultArray = json_encode($main_array);
     $categories = json_encode(array_values($months));
     //chart settings
     $data['resultArraySize'] = 7;
     $data['container'] = 'chart_sales';
     $data['chartType'] = 'line';
     $data['title'] = 'Chart';
     $data['chartTitle'] = 'Listing of Patients Enrolled for the Year: ' . $year;
     $data['categories'] = $categories;
     $data['xAxix'] = 'Months of the Year';
     $data['suffix'] = '';
     $data['yAxix'] = 'Totals';
     $data['resultArray'] = $resultArray;
     $data['graphs'] = $this->load->view('graph_v', $data, TRUE);
     $data['title'] = "webADT | Reports";
     $data['hide_side_menu'] = 1;
     $data['banner_text'] = "Facility Reports";
     $data['selected_report_type_link'] = "standard_report_row";
     $data['selected_report_type'] = "Standard Reports";
     $data['report_title'] = "Graph of Number of Patients Enrolled Per Month in a Given Year";
     $data['facility_name'] = $this->session->userdata('facility_name');
     $data['content_view'] = 'reports/graphs_on_patients_v';
     $this->load->view('template', $data);
 }