95 lines
3.8 KiB
PHP
95 lines
3.8 KiB
PHP
<?php
|
|
class M_dokter extends CI_Model {
|
|
function index() {
|
|
$this->db->join('master_tipeuser', 'master_tipeuser.mt_id = master_user.mu_tipeuser_id','left');
|
|
$this->db->join('master_spesialis', 'master_user.mu_spesialis_id = master_spesialis.ms_id','left');
|
|
$this->db->where('mu_tipeuser_id', '5');
|
|
$query = $this->db->get('master_user');
|
|
return $query->result();
|
|
}
|
|
|
|
function statusaktif() {
|
|
$this->db->join('master_tipeuser', 'master_tipeuser.mt_id = master_user.mu_tipeuser_id','left');
|
|
$this->db->join('master_spesialis', 'master_user.mu_spesialis_id = master_spesialis.ms_id','left');
|
|
$this->db->where('mu_tipeuser_id', '5');
|
|
$this->db->where('mu_status', '1');
|
|
$this->db->where('mu_dpjp_ket', '1');
|
|
$this->db->order_by("ms_nama", "asc");
|
|
$this->db->order_by("mu_nama_lengkap", "asc");
|
|
$query = $this->db->get('master_user');
|
|
return $query->result();
|
|
}
|
|
|
|
function insert() {
|
|
$insert_userlogin = array(
|
|
|
|
'mu_nama_user' => $this->input->post('namauser'),
|
|
'mu_password' => md5($this->input->post('passworduser')),
|
|
'mu_tipeuser_id' => "5",
|
|
'mu_status' => $this->input->post('status'),
|
|
'mu_nama_lengkap' => $this->input->post('namalengkap'),
|
|
'mu_jenis_kelamin' => $this->input->post('jkuser'),
|
|
'mu_spesialis_id' => $this->input->post('spesialis'),
|
|
'mu_dpjp_ket' => $this->input->post('dpjp'),
|
|
);
|
|
$insert = $this->db->insert('master_user', $insert_userlogin);
|
|
}
|
|
|
|
function edit($id) {
|
|
$this->db->where('mu_id', $id);
|
|
$query = $this->db->get('master_user');
|
|
return $query;
|
|
}
|
|
|
|
function prosesedit() {
|
|
$password = $this->input->post('passworduser');
|
|
if(empty($password)){
|
|
$update_userlogin = array(
|
|
'mu_nama_lengkap' => $this->input->post('namalengkap'),
|
|
'mu_nama_user' => $this->input->post('namauser'),
|
|
'mu_tipeuser_id' => "5",
|
|
'mu_status' => $this->input->post('status'),
|
|
'mu_jenis_kelamin' => $this->input->post('jkuser'),
|
|
'mu_spesialis_id' => $this->input->post('spesialis'),
|
|
'mu_dpjp_ket' => $this->input->post('dpjp'),
|
|
);
|
|
}else{
|
|
$update_userlogin = array(
|
|
'mu_nama_lengkap' => $this->input->post('namalengkappasien'),
|
|
'mu_nama_user' => $this->input->post('namauser'),
|
|
'mu_password' => md5($this->input->post('passworduser')),
|
|
'mu_tipeuser_id' => "5",
|
|
'mu_status' => $this->input->post('status'),
|
|
'mu_jenis_kelamin' => $this->input->post('jkuser'),
|
|
'mu_spesialis_id' => $this->input->post('spesialis'),
|
|
'mu_dpjp_ket' => $this->input->post('dpjp'),
|
|
);
|
|
}
|
|
|
|
$id = $this->input->post('id');
|
|
$this->db->where('mu_id', $id);
|
|
$this->db->update('master_user', $update_userlogin);
|
|
}
|
|
|
|
function delete($id) {
|
|
$this->db->where('mu_id', $id);
|
|
$this->db->delete('master_user');
|
|
}
|
|
|
|
function disabled($id) {
|
|
$update_data = array(
|
|
'mu_status' => 0,
|
|
);
|
|
$this->db->where('mu_id', $id);
|
|
$this->db->update('master_user', $update_data);
|
|
}
|
|
|
|
function aktif($id) {
|
|
$update_data = array(
|
|
'mu_status' => 1,
|
|
);
|
|
$this->db->where('mu_id', $id);
|
|
$this->db->update('master_user', $update_data);
|
|
}
|
|
}
|
|
?>
|