function check_pat($id, $type = false) { ##ตรวจ if ($id == false) { $ref = $this->input->server('HTTP_REFERER', TRUE); redirect($ref, 'location'); } $data['check'][] = $this->general_model->get_row('check_pat', "check_id = {$id} "); ## $data['check_id'] = $id; $pat_id = $data['check'][0]['pat_id']; $data['pat_id'] = $pat_id; $data['pat'] = $this->general_model->get_row('patients', "pat_id = {$pat_id}"); $data['met'] = $this->general_model->get_row('meet', "check_id = {$id} order by met_id desc limit 1"); // $tool_more = $this->general_model->get_field('*', 'tool_more', 'check_id = '.$id .' order by mr_id desc limit 1'); // $data['tool_more'] = reset($tool_more); // var_dump($data['check']);die(); if ($data['check'][0] == false) { $ref = $this->input->server('HTTP_REFERER', TRUE); ?> <meta charset="utf-8"> <script type="text/javascript"> var url = '<?php echo $ref; ?> '; if (confirm("ยังไม่ได้รับการตรวจ ในบริการนี้ !") == true) { window.location.href = url; } else { window.location.href = url; } </script> <?php } $data['pat'] = $this->general_model->get_row('patients', "pat_id = {$data['check'][0]['pat_id']}"); $data['evol'][] = $this->general_model->get_row('evolution', "pat_id = {$data['check'][0]['pat_id']} and check_id = {$data['check'][0]['check_id']}"); ##ดึงเฉพาะล่าสุด $data['order_tools'] = $this->general_model->get('order_tools', "check_id = {$data['check'][0]['check_id']}"); ##ดึงเฉพาะล่าสุด if ($type == 'check_pat_before') { parent::core_doctor_view('pat/check_pat_before', $data); } elseif ($type == 'check_pat_after') { parent::core_doctor_view('pat/check_pat_after', $data); } elseif ($type == 'evol') { parent::core_doctor_view('pat/evol', $data); } else { parent::core_doctor_view('pat/check_pat', $data); } }
function list_in_group($pat_id, $group_id) { $pat_id = $pat_id; $data['group_id'] = $group_id; $data['pat_id'] = $pat_id; $data['pat'] = $this->general_model->get_row('patients', "pat_id = {$pat_id}"); $sql = "SELECT * \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 = {$pat_id}\n AND \n t3.tool_group_id = {$group_id}\n "; $data['order_tools'] = $this->general_model->Query1($sql); // var_dump($order_tools);die(); // $data['order_tools'] = $this->general_model->get_all('order_tools', "check_id = {$check_id}"); parent::core_doctor_view('tools/list_tool_in_group', $data); }
function query_check_evol($id = false, $check_id = false) { ##id ผู้ผ่วย เลือกค่าตรวจล่าสุดมา if ($id == false) { redirect('doctor'); } $data['pat'] = $this->general_model->get_row('patients', "pat_id = {$id}"); $data['check'][] = $this->general_model->get_row('check_pat', "pat_id = {$id} order by check_id DESC limit 1"); $data['evol'][] = $this->general_model->get_row('evolution', "pat_id = {$id} and check_id = {$data['check'][0]['check_id']}"); ##ดึงเฉพาะล่าสุด $data['order_tools'] = $this->general_model->get_row('order_tools', "check_id = {$data['check'][0]['check_id']}"); ##ดึงเฉพาะล่าสุด if ($this->input->post()) { $post = $this->input->post(); $post['pat_id'] = $data['pat']['pat_id']; $post['check_id'] = $data['check'][0]['check_id']; unset($post['submit']); $this->general_model->insert('evolution', $post); $evol_id = $this->db->insert_id(); $param['check_status'] = 'ประเมิณเรียบร้อยแล้ว'; //var_dump($param['check_status']);die(); $this->general_model->update('check_pat', $param, "check_id = {$data['check'][0]['check_id']}"); redirect(base_url() . 'doctor/check_evol/' . $id, ''); exit; } parent::core_doctor_view('doctor/evol_add_edit', $data); }