public function map_process() { //Clear all regimen mappings $sql = "update regimen SET map='0'"; $this->db->query($sql); //Map Regimens $regimens = Regimen::getRegimens(); foreach ($regimens as $regimen) { $regimen_id = $regimen['id']; $code = $regimen['Regimen_Code']; $name = $regimen['Regimen_Desc']; $map_id = $this->getMainRegimen($code, $name); if ($map_id != null) { $new_array = array('map' => $map_id); $this->db->where('id', $regimen_id); $this->db->update('regimen', $new_array); unset($new_array); } } }
public function getFilteredRegiments() { $age = $this->input->post("age"); $regimens = ""; if ($age == '') { $regimens = Regimen::getRegimens(); } else { if ($age >= 15) { //adult regimens $regimens = Regimen::getAdultRegimens(); } else { if ($age < 15) { //paediatric regimens $regimens = Regimen::getChildRegimens(); } } } echo json_encode($regimens); }
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); }
public function edit($record_no) { $facility_code = $this->session->userdata('facility'); $ccc_id = '2'; $sql = "select pv.*,p.first_name,p.other_name,p.last_name,p.id as p_id " . "from patient_visit pv," . "patient p " . "where pv.id='{$record_no}' " . "and pv.patient_id=p.patient_number_ccc " . "and facility='{$facility_code}'"; $query = $this->db->query($sql); $results = $query->result_array(); //print_r($results); if ($results) { $data['results'] = $results; //Get expriry date the batch foreach ($results as $value) { $batch_number = $value['batch_number']; $drug_ig = $value['drug_id']; $ccc_id = $value['ccc_store_sp']; $sql = "select expiry_date FROM drug_stock_balance WHERE batch_number='{$batch_number}' AND drug_id='{$drug_ig}' AND stock_type='{$ccc_id}' AND facility_code='{$facility_code}' LIMIT 1"; $expiry_sql = $this->db->query($sql); $expiry_array = $expiry_sql->result_array(); $expiry_date = ""; $data['expiries'] = $expiry_array; foreach ($expiry_array as $row) { $expiry_date = $row['expiry_date']; //print_r($expiry_date); $data['original_expiry_date'] = $expiry_date; } } } else { $data['results'] = ""; } $data['purposes'] = Visit_Purpose::getAll(); $data['record'] = $record_no; $data['ccc_id'] = $ccc_id; $data['regimens'] = Regimen::getRegimens(); $data['non_adherence_reasons'] = Non_Adherence_Reasons::getAllHydrated(); $data['regimen_changes'] = Regimen_Change_Purpose::getAllHydrated(); $data['doses'] = Dose::getAllActive(); $data['indications'] = Opportunistic_Infection::getAllHydrated(); $data['content_view'] = 'edit_dispensing_v'; $data['hide_side_menu'] = 1; $this->base_params($data); }