Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tambah_rm($id)
- {
- $this->load->helper('form');
- $this->load->library('form_validation');
- $data['title'] = 'Tambah Detail Rekam Medis';
- $this->form_validation->set_rules('tgl_berobat', 'tgl_berobat', 'required');
- $this->form_validation->set_rules('anamnesa', 'anamnesa', 'required');
- $this->form_validation->set_rules('diagnosa', 'diagnosa', 'required');
- $this->form_validation->set_rules('therapi', 'therapi', 'required');
- $this->form_validation->set_rules('keterangan', 'keterangan', 'required');
- if ($this->form_validation->run() === FALSE)
- {
- $data['obat']=$this->m_pasien->get_obat();
- $data['header']=$this->m_pasien->header_pasien($id)->row_array();
- $this->template->load('template','v_tambahRM',$data);
- }
- else
- {
- $this->m_pasien->tambahrm($data);
- redirect('pasien');
- }
- }
- function tambahrm()
- {
- $this->load->helper('url');
- $username = trim($this->session->userdata('id_user'));
- $data = array(
- 'tgl_berobat' => $this->input->post('tgl_berobat'),
- 'anamnesa' => $this->input->post('anamnesa'),
- 'diagnosa' => $this->input->post('diagnosa'),
- 'therapi' => $this->input->post('therapi'),
- 'keterangan' => $this->input->post('keterangan'),
- 'id_user' => $username,
- 'id_pasien' => $this->input->post('id_pasien'),
- );
- if ($id == 0) {
- return $this->db->insert('tbl_riwayat', $data);
- } else {
- $this->db->where('id', $id);
- return $this->db->update('tbl_riwayat', $data);
- }
- }
- function get_obat()
- {
- $data_obat = array();
- $this->db->select('nama_obat');
- $this->db->from('tbl_obat');
- $query = $this->db->get();
- if ($query->num_rows() > 0) {
- foreach ($query->result_array() as $row) {
- $data_obat[] = $row;
- }
- }
- return $data_obat;
- }
- <div class="form-group m-b-20">
- <div class="col-xs-12">
- <label for="therapi">Therapi</label>
- <select class=" form-control js-example-basic-multiple" multiple="multiple" name="diagnosa">
- <?php
- foreach($obat as $option)
- {
- ?>
- <option value="<?=$option['nama_obat']?>"><?=$option['nama_obat']?></option>
- <?php
- }
- ?>
- </select>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement