Exemple #1
0
 public function index()
 {
     $this->per_page = 20;
     $row = $this->general_model->QueryAll("\n        select * from tools \n        ");
     $url = base_url() . 'manage_tools/index/';
     parent::pagination($page, $url, count($row), $this->per_page, 3);
     $data['list'] = $this->general_model->QueryAll("\n        select * from tools t1 \n        limit {$this->start_no}, {$this->per_page} \n        ");
     /*         * pagination */
     $view = 'core_' . $this->usertype . '_view';
     parent::$view('manage_tools/index', $data);
     //body
 }
Exemple #2
0
 function list_pat($page = false)
 {
     /*         * pagination */
     $row = $this->general_model->get('patients', '', '', '', '', 'count');
     $url = base_url() . 'patient/index/';
     parent::pagination($page, $url, $row, $this->per_page, 3);
     /*         * pagination */
     $data['patient'] = $this->general_model->get('patients', $this->start_no, $this->per_page, 'date', $group_by = false, '');
     //echo $this->db->last_query();die();
     $view = 'core_' . $this->usertype . '_view';
     parent::$view('doctor/list_pat', $data);
 }
Exemple #3
0
 public function list_tools_group()
 {
     $search = '';
     $txt = $this->input->post('text');
     if ($txt != '') {
         $txt = str_replace(' ', '', trim($this->input->post('text')));
         $search = " and (CONCAT(pat_name,pat_lname)  like '%{$txt}%'  or pat_id_card like '%{$txt}%' or hn like '%{$txt}%' ) ";
         // var_dump($this->input->post('text'));die();
     }
     $tool_group = $this->general_model->get_field('tool_group_id,tool_group_name', 'tools_group');
     $data['tool_group'] = $tool_group;
     // $this->per_page = 2;
     $row = $this->general_model->get('patients t1', '', '', '', '', '', "pat_id is not NULL {$search} ");
     $url = base_url() . 'tools/list_tools_group/';
     parent::pagination($page, $url, count($row), $this->per_page, 3);
     /*         * pagination */
     $pat = $this->general_model->get('patients t1', $this->start_no, $this->per_page, '', $group_by = false, '', "pat_id is not NULL {$search} ");
     $data_set = array();
     foreach ($pat as $key => $value) {
         $data_set[$value['pat_id']]['pat_name'] = $value['prefix'] . $value['pat_name'] . '  ' . $value['pat_lname'];
         foreach ($tool_group as $k => $v) {
             $sql = "SELECT count(t2.tool_group_id) as num \n                                                        FROM order_tools t1\n                                                            INNER JOIN tools_set t2\n                                                                 on t1.tool_id = t2.tool_id\n                                                            RIGHT  JOIN tools_group t3\n                                                                 on t2.tool_group_id = t3.tool_group_id\n                                                            where \n                                                                 pat_id = {$value['pat_id']}\n                                                            AND \n                                                                t3.tool_group_id = {$v['tool_group_id']}\n                        ";
             $num = $this->general_model->Query1($sql);
             $data_set[$value['pat_id']][$v['tool_group_id']] = $num[0]['num'];
         }
     }
     $data['data_set'] = $data_set;
     // var_dump( $data_set,$num);die();
     // echo $this->db->last_query();die();
     $view = 'core_' . $this->usertype . '_view';
     parent::$view('tools/list_tool_group', $data);
 }
Exemple #4
0
 public function history($id, $page = false)
 {
     $data['patient'] = $this->general_model->get_row('patients', "pat_id = {$id}");
     $data['evol'] = $this->general_model->get_all('evolution', "pat_id = {$id} ");
     ##
     //echo $this->db->last_query();die();
     //  /*         * pagination */
     $this->per_page = 20;
     $row = $this->general_model->get_all('check_pat', "pat_id = {$id} ", '', 'check_date DESC , check_id DESC');
     $url = base_url() . 'patient/history/' . $id . '/';
     parent::pagination($page, $url, count($row), $this->per_page, 4);
     /*         * pagination */
     $data['check'] = $this->general_model->get('check_pat', $this->start_no, $this->per_page, 'check_date DESC, check_id DESC', $group_by = false, '', "pat_id = {$id} ");
     // echo $this->db->last_query();die();
     $view = 'core_' . $this->usertype . '_view';
     parent::$view('pat/history', $data);
 }
Exemple #5
0
 function export_list_tool()
 {
     #tech
     $search = $this->search_text();
     $search_date = $this->search_date();
     $this->pdf_list_tool();
     /*                 * pagination */
     $this->per_page = 20;
     $row = $this->general_model->QueryAll("\n                                                            select  t1.check_id,t1.tech_id,t1.tool_id,t1.order_type,t1.tool_type,t1.order_status,t1.order_id,\n                                                                    t2.tech_name,t2.tech_lname,\n                                                                    t4.prefix,t4.pat_name,t4.pat_lname,\n                                                                    t3.check_date\n                                                                            from order_tools t1 \n                                                                            left join techs t2 on t1.tech_id = t2.user_id\n                                                                            left join check_pat t3 on t1.check_id = t3.check_id\n                                                                            left join patients t4 on t3.pat_id = t4.pat_id\n                                                                            where \n                                                                                t1.order_status not in ('ยกเลิก','กำลังจัดทำอุปกรณ์')\n                                                                                {$search} {$search_date}\n                                                                            order by t1.check_id ASC\n                                                          ");
     $url = base_url() . 'admin/list_tech/';
     parent::pagination($page, $url, count($row), $this->per_page, 3);
     $list = $this->general_model->QueryAll("\n                                                             select  t1.check_id,t1.tech_id,t1.tool_id,t1.order_type,t1.tool_type,t1.order_status,t1.order_id,\n                                                                    t2.tech_name,t2.tech_lname,\n                                                                    t4.prefix,t4.pat_name,t4.pat_lname,\n                                                                    t3.check_date\n                                                                            from order_tools t1 \n                                                                            left join techs t2 on t1.tech_id = t2.user_id\n                                                                            left join check_pat t3 on t1.check_id = t3.check_id\n                                                                            left join patients t4 on t3.pat_id = t4.pat_id\n                                                                            where \n                                                                                t1.order_status not in ('ยกเลิก','กำลังจัดทำอุปกรณ์')\n                                                                                {$search} {$search_date}\n                                                                            order by t1.check_id ASC\n                                                                            limit {$this->start_no}, {$this->per_page} \n                                                          ");
     foreach ($list as $key => $value) {
         $data['list'][] = array('pat_id' => $value['pat_id'], 'tech_name' => $value['tech_name'] . '  ' . $value['tech_lname'], 'pat_name' => $value['prefix'] . $value['pat_name'] . '  ' . $value['pat_lname'], 'tool_name' => _get_tools_name($value['tool_id']), 'order_id' => $value['order_id'], 'check_status' => _get_tools_name($value['tool_id']), 'date' => _set_date($value['check_date']));
     }
     $data['type_topic'] = "รายงานการจัดทำอุปรณ์";
     // var_dump($row);die();
     $view = 'core_' . $this->usertype . '_view';
     parent::$view('admin/list_export', $data);
 }
Exemple #6
0
 public function list_tools($tool_group_id)
 {
     $data['type'] = $tool_group_id;
     $data['ref'] = base_url() . 'manage_tools_set/list_group/';
     $this->per_page = 20;
     $row = $this->general_model->QueryAll("\n        select * from tools_set \n        ");
     $url = base_url() . 'manage_tools_set/list_tools/';
     parent::pagination($page, $url, count($row), $this->per_page, 3);
     $data['list'] = $this->general_model->QueryAll("\n                                                            select * from tools_set t1 \n                                                            where\n                                                            tool_group_id = {$tool_group_id}\n                                                            limit {$this->start_no}, {$this->per_page} \n        ");
     /*         * pagination */
     $view = 'core_' . $this->usertype . '_view';
     parent::$view('manage_tools_set/list_tool', $data);
     //body
 }
Exemple #7
0
 public function list_approve($type = false)
 {
     $search = '';
     $txt = $this->input->post('text');
     if ($txt) {
         $txt = str_replace(' ', '', trim($this->input->post('text')));
         $search = " and CONCAT(t3.pat_name,t3.pat_lname)  like '%{$txt}%'  ";
         // var_dump($this->input->post('text'));die();
     }
     $search_date = $this->search_date();
     if ($type == false) {
         $check_status = "กำลังจัดทำอุปกรณ์ กรอกข้อมูลแล้ว";
         ##แล้วยืนยันการจัดทำอุปกรณื
     } elseif ($type == 'before') {
         $check_status = "ตรวจก่อนทำสวยงามแล้ว";
     } elseif ($type == 'after') {
         $check_status = "ประเมิณหลังทำสวยงามแล้ว";
     }
     /*         * pagination */
     $this->per_page = 20;
     $row = $this->general_model->QueryAll("\n            select * from order_tools t1 \n            inner join check_pat t2 on t1.check_id = t2.check_id\n            inner join patients t3 on t3.pat_id = t2.pat_id \n            where \n            t1.tech_id={$this->user_id} \n            and t2.check_status = '{$check_status}'\n            {$search} {$search_date}\n            group by t2.check_id\n            order by t2.date\n            ", 'count');
     $url = base_url() . 'admin/list_doctors/';
     parent::pagination($page, $url, count($row), $this->per_page, 3);
     $list = $this->general_model->QueryAll("\n         select * from order_tools t1 \n         inner join check_pat t2 on t1.check_id = t2.check_id\n         inner join patients t3 on t3.pat_id = t2.pat_id \n         where \n         t1.tech_id={$this->user_id} \n         and t2.check_status = '{$check_status}'\n         {$search} {$search_date}\n         group by t2.check_id\n         order by t2.date\n         limit {$this->start_no}, {$this->per_page} \n         ");
     /*         * pagination */
     foreach ($list as $key => $value) {
         $data['list'][] = array('check_id' => $value['check_id'], 'doc_id' => $value['doc_id'], 'name' => $value['pat_name'] . "  " . $value['pat_lname']);
     }
     $data['type_topic'] = "ยืนยันหลังการตรวจ";
     $view = 'core_' . $this->usertype . '_view';
     parent::core_tech_view('tech/list_approve', $data);
 }