first commit
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,871 @@
|
||||
<?php
|
||||
class M_anjungan extends CI_Model {
|
||||
|
||||
function cekanjungan(){
|
||||
$tanggalsekarang = date("Y-m-d");
|
||||
$hari = date ("D");
|
||||
$query = $this->db->get('master_klinik');
|
||||
foreach ($query->result() as $datklinik){
|
||||
$reset_klinik = array(
|
||||
'mk_status_shift' => 1,
|
||||
'mk_aktif' => 0,
|
||||
);
|
||||
$this->db->where('mk_id', $datklinik->mk_id);
|
||||
$this->db->update('master_klinik', $reset_klinik);
|
||||
|
||||
$aktif=0;//----------aktif 0 maka klinik tutup
|
||||
$setaktifdb=0;//----------setaktif 0 maka klinik buka
|
||||
$setpenuh=0;//----------setpenuh 1 maka klinik penuh
|
||||
$shiftcek = $datklinik->mk_shift;
|
||||
//----------------start cek hari sekarang klinik buka atau tidak----------------//
|
||||
switch($hari){
|
||||
case 'Sun':$hari_ini = "minggu";break;case 'Mon':$hari_ini = "senin";break;case 'Tue':$hari_ini = "selasa";break;
|
||||
case 'Wed':$hari_ini = "rabu";break;case 'Thu':$hari_ini = "kamis";break;case 'Fri':$hari_ini = "jumat";break;
|
||||
case 'Sat':$hari_ini = "sabtu";break;default:$hari_ini = "Tidak di ketahui";break;
|
||||
}
|
||||
$pecahjadwal = explode("|",$datklinik->mk_jadwal);
|
||||
$jumdat = count($pecahjadwal);
|
||||
for ($x = 0; $x <= $jumdat; $x++){
|
||||
if(isset($pecahjadwal[$x])){
|
||||
if($pecahjadwal[$x]==$hari_ini){$aktif=$aktif+1;}
|
||||
}
|
||||
}
|
||||
if($aktif==0){$setaktifdb=1;}
|
||||
//----------------end cek hari sekarang klinik buka atau tidak----------------//
|
||||
//----------------start cek quota pasien per shift----------------//
|
||||
for ($i = 1; $i <= $datklinik->mk_shift; $i++){
|
||||
$this->db->where('pp_klinik_id', $datklinik->mk_id);
|
||||
$this->db->where('pp_shift', $i);
|
||||
$this->db->where('pp_tanggal_periksa', $tanggalsekarang);
|
||||
$query_pp = $this->db->get('proses_pengunjung');
|
||||
$jum_row = $query_pp->num_rows();
|
||||
$next_shift = $i+1;
|
||||
//-----------start cek quota shift jika penuh ke shift selanjutnya---------//
|
||||
if($datklinik->mk_quota<=$jum_row){
|
||||
//-----------start cek klinik tidak bisa lebih dari jumlah shift klinik---------//
|
||||
if($next_shift<=$shiftcek){
|
||||
$update_klinik = array(
|
||||
'mk_status_shift' => $next_shift,
|
||||
);
|
||||
$this->db->where('mk_id', $datklinik->mk_id);
|
||||
$this->db->update('master_klinik', $update_klinik);
|
||||
}else{
|
||||
// $update_klinik = array();
|
||||
$setaktifdb=1;
|
||||
$setpenuh=1;
|
||||
}
|
||||
// $this->db->where('mk_id', $datklinik->mk_id);
|
||||
// $this->db->update('master_klinik', $update_klinik);
|
||||
//-----------end cek klinik tidak bisa lebih dari jumlah shift klinik---------//
|
||||
}
|
||||
//-----------start cek quota shift jika penuh ke shift selanjutnya---------//
|
||||
}
|
||||
//----------------end cek quota pasien per shift----------------//
|
||||
$update_mk = array(
|
||||
'mk_tanggal_sekarang' => $tanggalsekarang,
|
||||
'mk_aktif' => $setaktifdb,
|
||||
'mk_shift_penuh' => $setpenuh,
|
||||
);
|
||||
$this->db->where('mk_id', $datklinik->mk_id);
|
||||
$this->db->update('master_klinik', $update_mk);
|
||||
}
|
||||
|
||||
$this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
$this->db->where('pp_pendaftaran_online is NOT NULL', NULL, FALSE);
|
||||
$this->db->where('pp_loket is NULL', NULL, TRUE);
|
||||
$query_pp = $this->db->get('proses_pengunjung');
|
||||
foreach ($query_pp->result() as $datapp){
|
||||
$loket = null;
|
||||
$this->db->order_by("ml_id", "RANDOM");
|
||||
$this->db->where('ml_pembayaran', $datapp->pp_pembayaran);
|
||||
$query_loket = $this->db->get('master_loket');
|
||||
foreach ($query_loket->result() as $datloket){
|
||||
$loketexplode = explode(",",$datloket->ml_pelayanan);
|
||||
$count = count($loketexplode);
|
||||
for ($x = 0; $x <= $count; $x++) {
|
||||
if(isset($loketexplode[$x])){
|
||||
if($datapp->pp_klinik_id==$loketexplode[$x]){
|
||||
$update_pp = array(
|
||||
'pp_loket' => $datloket->ml_id,
|
||||
);
|
||||
$this->db->where('pp_id', $datapp->pp_id);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
//$loket = $datloket->ml_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------digunakan untuk cek buka shift apabila sudah jam nya....(jika autoshift)
|
||||
function cek_shift_jam(){
|
||||
$jamnow = date("H");
|
||||
$menitnow = date("m");
|
||||
$this->db->where('mk_aktif', '0');
|
||||
$query = $this->db->get('master_klinik');
|
||||
foreach ($query->result() as $datklinik){
|
||||
if($datklinik->mk_auto_shift==1){
|
||||
$jumwaktu=0;
|
||||
$pecahwaktu = explode("|",$datklinik->mk_jam_shift);
|
||||
$jumwaktu = count($pecahwaktu);
|
||||
$ketshift = 1;
|
||||
for ($x = 0; $x < $jumwaktu; $x++){
|
||||
$waktu_awal =strtotime(date("Y-m-d ").$pecahwaktu[$x]);
|
||||
$waktu_akhir =strtotime(date("Y-m-d H:i"));
|
||||
$diff =$waktu_akhir-$waktu_awal;
|
||||
$hasil = number_format($diff,0,",",".");
|
||||
if($hasil>=0){
|
||||
if($pecahwaktu[$x]!=0){
|
||||
$update_mk = array(
|
||||
'mk_shift_buka' => $ketshift,
|
||||
);
|
||||
$this->db->where('mk_id', $datklinik->mk_id);
|
||||
$this->db->update('master_klinik', $update_mk);
|
||||
}
|
||||
}else{
|
||||
if($ketshift==1){
|
||||
$update_mk = array(
|
||||
'mk_shift_buka' => 1,
|
||||
);
|
||||
$this->db->where('mk_id', $datklinik->mk_id);
|
||||
$this->db->update('master_klinik', $update_mk);
|
||||
}
|
||||
}
|
||||
|
||||
$ketshift++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function insert_sekarang($idk, $shift, $ket , $pembayaran){
|
||||
//--------start get kode master klinik-----------//
|
||||
$kodeklinik="";
|
||||
$barcode="";$urutanbar=0;
|
||||
$this->db->where('mk_id', $idk);
|
||||
$query = $this->db->get('master_klinik');
|
||||
foreach ($query->result() as $datklinik){
|
||||
if($pembayaran==1){
|
||||
$kodeklinik="UM";
|
||||
}else{
|
||||
$kodeklinik= $datklinik->mk_kode;
|
||||
}
|
||||
}
|
||||
//--------end get kode master klinik-----------//
|
||||
//--------start nomor antrian------------------//
|
||||
$no_antrian;
|
||||
$hasil_nomor = "";
|
||||
$query_pengunjung = $this->db->query("select MAX(pp_nomor_antrian) AS maxnomorantrian from proses_pengunjung WHERE pp_tanggal_periksa = '".date("Y-m-d")."' AND pp_nomor_antrian LIKE '".$kodeklinik."%' ");
|
||||
// $this->db->like('pp_nomor_antrian', $kodeklinik, 'after');
|
||||
// $this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
// $query_pengunjung = $this->db->get('proses_pengunjung');
|
||||
foreach ($query_pengunjung->result() as $datpengunjung){
|
||||
$no_antrian = $datpengunjung->maxnomorantrian;
|
||||
}
|
||||
|
||||
if(isset($no_antrian)){
|
||||
$urutan = (int) substr($no_antrian, 3, 3);
|
||||
$urutan++;
|
||||
$hasil_nomor = $kodeklinik.$shift.sprintf("%03s", $urutan);
|
||||
}else {
|
||||
$hasil_nomor=$kodeklinik.$shift."001";
|
||||
|
||||
}
|
||||
//--------end nomor antrian--------------------//
|
||||
//-------start nomor barcode------------------//
|
||||
$no_barcode;
|
||||
$hasil_barcode = "";
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$query_barcode = $this->db->get('proses_pengunjung');
|
||||
foreach ($query_barcode->result() as $datbarcode){
|
||||
$no_barcode = $datbarcode->pp_barcode;
|
||||
}
|
||||
if(isset($no_barcode)){
|
||||
$urutan = (int) substr($no_barcode, 7, 5);
|
||||
$urutan++;
|
||||
$barcode=date("ymd").$shift.sprintf("%05s", $urutan);
|
||||
$urutanbar=$urutan;
|
||||
}else {
|
||||
$barcode=date("ymd").$shift."00001";
|
||||
$urutanbar=1;
|
||||
}
|
||||
//-------end nomor barcode-------------------//
|
||||
if($ket==4){
|
||||
$this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
$this->db->where('pp_nomor_antrian', $hasil_nomor);
|
||||
$query_cek_nomor = $this->db->get('proses_pengunjung');
|
||||
if($query_cek_nomor->num_rows()!=0){
|
||||
return FALSE;
|
||||
}else{
|
||||
//----------------------start untuk pasien fasttrack----------------------------//
|
||||
$pj = $this->input->post('penanggungjawab');
|
||||
$rm = $this->input->post('norek');
|
||||
$np = $this->input->post('namapas');
|
||||
$ke = $this->input->post('ket');
|
||||
|
||||
$rafast = $pj."|".$np."|".$ke."|";
|
||||
|
||||
$insert_pp = array(
|
||||
'pp_nomor_antrian' => $hasil_nomor,
|
||||
'pp_shift' => $shift,
|
||||
'pp_tanggal_periksa' => date("Y-m-d"),
|
||||
'pp_tanggal_datang' => date("Y-m-d H:i:s"),
|
||||
'pp_posisi_status' => 1,
|
||||
'pp_pendaftaran_online' => null,
|
||||
'pp_rekamedik' => $rm,
|
||||
'pp_status' => 1,
|
||||
'pp_aktif' => null,
|
||||
'pp_klinik_id' => $idk,
|
||||
'pp_barcode' => $barcode,
|
||||
'pp_pembayaran' => $pembayaran,
|
||||
'pp_fasttrack' => $rafast,
|
||||
);
|
||||
$insert = $this->db->insert('proses_pengunjung', $insert_pp);
|
||||
$last_insert_id = $this->db->insert_id();
|
||||
|
||||
$insert_prt = array(
|
||||
'prt_status' => 1,
|
||||
'prt_tanggal' => date("Y-m-d H:i:s"),
|
||||
'prt_aktif' => 0,
|
||||
'prt_pengunjung_id' => $last_insert_id,
|
||||
);
|
||||
$prt = $this->db->insert('proses_ruang_tunggu', $insert_prt);
|
||||
//----------------------end untuk pasien fasttrack----------------------------//
|
||||
}
|
||||
}else{
|
||||
$this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
$this->db->where('pp_nomor_antrian', $hasil_nomor);
|
||||
$query_cek_nomor = $this->db->get('proses_pengunjung');
|
||||
if($query_cek_nomor->num_rows()!=0){
|
||||
return FALSE;
|
||||
}else{
|
||||
$insert_pp = array(
|
||||
'pp_nomor_antrian' => $hasil_nomor,
|
||||
'pp_shift' => $shift,
|
||||
'pp_tanggal_periksa' => date("Y-m-d"),
|
||||
'pp_tanggal_datang' => date("Y-m-d H:i:s"),
|
||||
'pp_posisi_status' => 1,
|
||||
'pp_pendaftaran_online' => null,
|
||||
'pp_rekamedik' => null,
|
||||
'pp_status' => null,
|
||||
'pp_aktif' => null,
|
||||
'pp_klinik_id' => $idk,
|
||||
'pp_barcode' => $barcode,
|
||||
'pp_pembayaran' => $pembayaran,
|
||||
);
|
||||
$insert = $this->db->insert('proses_pengunjung', $insert_pp);
|
||||
$pp_last_id = $this->db->insert_id();
|
||||
//-----------start langsung masuk-------------------//
|
||||
if($urutanbar<=70){
|
||||
|
||||
$loket = null;
|
||||
$this->db->order_by("ml_id", "RANDOM");
|
||||
$this->db->where('ml_pembayaran', $pembayaran);
|
||||
$query_loket = $this->db->get('master_loket');
|
||||
foreach ($query_loket->result() as $datloket){
|
||||
$loketexplode = explode(",",$datloket->ml_pelayanan);
|
||||
$count = count($loketexplode);
|
||||
for ($x = 0; $x <= $count; $x++) {
|
||||
if(isset($loketexplode[$x])){
|
||||
if($idk==$loketexplode[$x]){
|
||||
$loket = $datloket->ml_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$autoinsert_prt = array(
|
||||
'prt_status' => 0,
|
||||
'prt_tanggal' => date("Y-m-d H:i:s"),
|
||||
'prt_aktif' => 0,
|
||||
'prt_pengunjung_id' => $pp_last_id,
|
||||
);
|
||||
$prt = $this->db->insert('proses_ruang_tunggu', $autoinsert_prt);
|
||||
|
||||
$update_pp = array(
|
||||
'pp_status' => 1,
|
||||
'pp_panggil_anjungan' => date("Y-m-d H:i:s"),
|
||||
'pp_loket' => $loket,
|
||||
);
|
||||
$this->db->where('pp_id', $pp_last_id);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
}
|
||||
//-----------end langsung masuk-------------------//
|
||||
}
|
||||
}
|
||||
//--------for cek data quota shift
|
||||
$date=date("Y-m-d");
|
||||
$this->cek_quota_shift($idk, $shift,$date);
|
||||
}
|
||||
|
||||
function insert_pesan(){
|
||||
$urutanbar=0;
|
||||
$pembayaran=$this->input->post('pembayaran');
|
||||
$idk = $this->input->post('idklinikpesan');
|
||||
$shift = $this->input->post('shiftpesan');
|
||||
$originalDate = $this->input->post('tanggalpesan');
|
||||
$newDate = date("Y-m-d", strtotime($originalDate));
|
||||
$newDate2 = date("ymd", strtotime($originalDate));
|
||||
//--------start get kode master klinik-----------//
|
||||
$kodeklinik="";
|
||||
$barcode="";
|
||||
$this->db->where('mk_id', $idk);
|
||||
$query = $this->db->get('master_klinik');
|
||||
foreach ($query->result() as $datklinik){
|
||||
if($pembayaran==1){
|
||||
$kodeklinik="UM";
|
||||
}else{
|
||||
$kodeklinik= $datklinik->mk_kode;
|
||||
}
|
||||
}
|
||||
//--------end get kode master klinik-----------//
|
||||
//--------start nomor antrian------------------//
|
||||
$no_antrian;
|
||||
$hasil_nomor = "";
|
||||
$query_pengunjung = $this->db->query("select * from proses_pengunjung WHERE pp_tanggal_periksa = '".$newDate."' AND pp_nomor_antrian LIKE '".$kodeklinik."%' ");
|
||||
//$this->db->like('pp_nomor_antrian', $kodeklinik, 'after');
|
||||
//$this->db->where('pp_tanggal_periksa', $newDate);
|
||||
//$query_pengunjung = $this->db->get('proses_pengunjung');
|
||||
foreach ($query_pengunjung->result() as $datpengunjung){
|
||||
$no_antrian = $datpengunjung->pp_nomor_antrian;
|
||||
}
|
||||
|
||||
if(isset($no_antrian)){
|
||||
$urutan = (int) substr($no_antrian, 3, 3);
|
||||
$urutan++;
|
||||
$hasil_nomor = $kodeklinik.$shift.sprintf("%03s", $urutan);
|
||||
|
||||
}else {
|
||||
$hasil_nomor=$kodeklinik.$shift."001";
|
||||
}
|
||||
|
||||
//--------end nomor antrian--------------------//
|
||||
//-------start nomor barcode------------------//
|
||||
$no_barcode;
|
||||
$hasil_barcode = "";
|
||||
$this->db->where('pp_tanggal_periksa', $newDate);
|
||||
$query_barcode = $this->db->get('proses_pengunjung');
|
||||
foreach ($query_barcode->result() as $datbarcode){
|
||||
$no_barcode = $datbarcode->pp_barcode;
|
||||
}
|
||||
if(isset($no_barcode)){
|
||||
$urutan = (int) substr($no_barcode, 7, 5);
|
||||
$urutan++;
|
||||
$barcode=$newDate2.$shift.sprintf("%05s", $urutan);
|
||||
$urutanbar=$urutan;
|
||||
}else {
|
||||
$barcode=$newDate2.$shift."00001";
|
||||
$urutanbar=1;
|
||||
}
|
||||
|
||||
//-------end nomor barcode-------------------//
|
||||
// $this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
// $this->db->where('pp_nomor_antrian', $hasil_nomor);
|
||||
// $query_cek_nomor = $this->db->get('proses_pengunjung');
|
||||
// // var_dump($query_cek_nomor->num_rows());
|
||||
// // exit();
|
||||
// if($query_cek_nomor->num_rows()!=0){
|
||||
// return FALSE;
|
||||
// }else{
|
||||
$insert_pp = array(
|
||||
'pp_nomor_antrian' => $hasil_nomor,
|
||||
'pp_shift' => $shift,
|
||||
'pp_tanggal_periksa' => $newDate,
|
||||
'pp_tanggal_datang' => date("Y-m-d H:i:s"),
|
||||
'pp_posisi_status' => 1,
|
||||
'pp_pendaftaran_online' => null,
|
||||
'pp_rekamedik' => null,
|
||||
'pp_status' => null,
|
||||
'pp_aktif' => null,
|
||||
'pp_klinik_id' => $idk,
|
||||
'pp_barcode' => $barcode,
|
||||
'pp_pembayaran' => $pembayaran,
|
||||
);
|
||||
$insert = $this->db->insert('proses_pengunjung', $insert_pp);
|
||||
$pp_last_id = $this->db->insert_id();
|
||||
// var_dump($pp_last_id);
|
||||
// exit();
|
||||
//-----------start langsung masuk-------------------//
|
||||
if($urutanbar<=70){
|
||||
$loket = null;
|
||||
$this->db->order_by("ml_id", "RANDOM");
|
||||
$this->db->where('ml_pembayaran', $pembayaran);
|
||||
$query_loket = $this->db->get('master_loket');
|
||||
foreach ($query_loket->result() as $datloket){
|
||||
$loketexplode = explode(",",$datloket->ml_pelayanan);
|
||||
$count = count($loketexplode);
|
||||
for ($x = 0; $x <= $count; $x++) {
|
||||
if(isset($loketexplode[$x])){
|
||||
if($idk==$loketexplode[$x]){
|
||||
$loket = $datloket->ml_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$autoinsert_prt = array(
|
||||
'prt_status' => 0,
|
||||
'prt_tanggal' => $newDate.date(" 05:00:00"),
|
||||
'prt_aktif' => 0,
|
||||
'prt_pengunjung_id' => $pp_last_id,
|
||||
);
|
||||
$prt = $this->db->insert('proses_ruang_tunggu', $autoinsert_prt);
|
||||
|
||||
$update_pp = array(
|
||||
'pp_status' => 1,
|
||||
'pp_panggil_anjungan' => $newDate.date(" 05:10:00"),
|
||||
'pp_loket' => $loket,
|
||||
);
|
||||
$this->db->where('pp_id', $pp_last_id);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
}
|
||||
//-----------end langsung masuk-------------------//
|
||||
//}
|
||||
|
||||
$date=$newDate;
|
||||
$this->cek_quota_shift($idk, $shift,$date);
|
||||
}
|
||||
|
||||
function insert_daftar_online(){
|
||||
$urutanbar=0;
|
||||
$pembayaran=$this->input->post('pembayaran');
|
||||
$idk = $this->input->post('klinik');
|
||||
$shift = $this->input->post('shiftonline');
|
||||
//--------start get kode master klinik-----------//
|
||||
$kodeklinik="";
|
||||
$barcode="";
|
||||
$this->db->where('mk_id', $idk);
|
||||
$query = $this->db->get('master_klinik');
|
||||
foreach ($query->result() as $datklinik){
|
||||
if($pembayaran==1){
|
||||
$kodeklinik="UM";
|
||||
}else{
|
||||
$kodeklinik= $datklinik->mk_kode;
|
||||
}
|
||||
}
|
||||
//--------end get kode master klinik-----------//
|
||||
//--------start nomor antrian------------------//
|
||||
$no_antrian;
|
||||
$hasil_nomor = "";
|
||||
$query_pengunjung = $this->db->query("select * from proses_pengunjung WHERE pp_tanggal_periksa = '".date("Y-m-d")."' AND pp_nomor_antrian LIKE '".$kodeklinik."%' ");
|
||||
// $this->db->like('pp_nomor_antrian', $kodeklinik, 'after');
|
||||
// $this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
// $query_pengunjung = $this->db->get('proses_pengunjung');
|
||||
foreach ($query_pengunjung->result() as $datpengunjung){
|
||||
$no_antrian = $datpengunjung->pp_nomor_antrian;
|
||||
}
|
||||
if(isset($no_antrian)){
|
||||
$urutan = (int) substr($no_antrian, 3, 3);
|
||||
$urutan++;
|
||||
$hasil_nomor = $kodeklinik.$shift.sprintf("%03s", $urutan);
|
||||
}else {
|
||||
$hasil_nomor=$kodeklinik.$shift."001";
|
||||
}
|
||||
//--------end nomor antrian--------------------//
|
||||
//-------start nomor barcode------------------//
|
||||
$no_barcode;
|
||||
$hasil_barcode = "";
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$query_barcode = $this->db->get('proses_pengunjung');
|
||||
foreach ($query_barcode->result() as $datbarcode){
|
||||
$no_barcode = $datbarcode->pp_barcode;
|
||||
}
|
||||
if(isset($no_barcode)){
|
||||
$urutan = (int) substr($no_barcode, 7, 5);
|
||||
$urutan++;
|
||||
$barcode=date("ymd").$shift.sprintf("%05s", $urutan);
|
||||
$urutanbar=$urutan;
|
||||
}else {
|
||||
$barcode=date("ymd").$shift."00001";
|
||||
$urutanbar=1;
|
||||
}
|
||||
|
||||
//-------end nomor barcode-------------------//
|
||||
$loket = null;
|
||||
$this->db->order_by("ml_id", "RANDOM");
|
||||
$this->db->where('ml_pembayaran', $pembayaran);
|
||||
$query_loket = $this->db->get('master_loket');
|
||||
foreach ($query_loket->result() as $datloket){
|
||||
$loketexplode = explode(",",$datloket->ml_pelayanan);
|
||||
$count = count($loketexplode);
|
||||
for ($x = 0; $x <= $count; $x++) {
|
||||
if(isset($loketexplode[$x])){
|
||||
if($idk==$loketexplode[$x]){
|
||||
$loket = $datloket->ml_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->where('pp_nomor_antrian', $hasil_nomor);
|
||||
$query_cek_nomor = $this->db->get('proses_pengunjung');
|
||||
if($query_cek_nomor->num_rows()!=0){
|
||||
return FALSE;
|
||||
}else{
|
||||
$insert_pp = array(
|
||||
'pp_nomor_antrian' => $hasil_nomor,
|
||||
'pp_shift' => $shift,
|
||||
'pp_tanggal_periksa' => date("Y-m-d"),
|
||||
'pp_tanggal_datang' => date("Y-m-d H:i:s"),
|
||||
'pp_posisi_status' => 1,
|
||||
'pp_pendaftaran_online' => $this->input->post('nopendaftaran'),
|
||||
'pp_rekamedik' => $this->input->post('norm'),
|
||||
'pp_status' => 1,
|
||||
'pp_aktif' => null,
|
||||
'pp_klinik_id' => $idk,
|
||||
'pp_barcode' => $barcode,
|
||||
'pp_pembayaran' => $pembayaran,
|
||||
'pp_loket' => $loket,
|
||||
);
|
||||
$insert = $this->db->insert('proses_pengunjung', $insert_pp);
|
||||
|
||||
$last_insert_id = $this->db->insert_id();
|
||||
$insert_prt = array(
|
||||
'prt_status' => 1,
|
||||
'prt_tanggal' => date("Y-m-d H:i:s"),
|
||||
'prt_aktif' => 0,
|
||||
'prt_pengunjung_id' => $last_insert_id,
|
||||
);
|
||||
$insert_prt = $this->db->insert('proses_ruang_tunggu', $insert_prt);
|
||||
}
|
||||
//--------for cek data quota shift
|
||||
$date=date("Y-m-d");
|
||||
$this->cek_quota_shift($idk, $shift,$date);
|
||||
}
|
||||
|
||||
function cek_quota_shift($idk,$shift,$date){
|
||||
$quota_shift;
|
||||
$jum_pp;
|
||||
$shiftcek;
|
||||
|
||||
$this->db->where('mk_id', $idk);
|
||||
$query = $this->db->get('master_klinik');
|
||||
foreach ($query->result() as $datklinik){
|
||||
$quota_shift = $datklinik->mk_quota;
|
||||
$shiftcek = $datklinik->mk_shift;
|
||||
}
|
||||
|
||||
for($i=1;$i<=$shiftcek;$i++){
|
||||
$this->db->where('pp_klinik_id', $idk);
|
||||
$this->db->where('pp_shift', $i);
|
||||
$this->db->where('pp_tanggal_periksa', $date);
|
||||
$query_pp = $this->db->get('proses_pengunjung');
|
||||
$jum_row = $query_pp->num_rows();
|
||||
$next_shift = $i+1;
|
||||
//-----------start cek quota shift jika penuh ke shift selanjutnya---------//
|
||||
if($quota_shift<=$jum_row){
|
||||
//-----------start cek klinik tidak bisa lebih dari jumlah shift klinik---------//
|
||||
if($next_shift<=$shiftcek){
|
||||
$update_klinik = array(
|
||||
'mk_status_shift' => $next_shift,
|
||||
);
|
||||
}else{
|
||||
$update_klinik = array(
|
||||
'mk_aktif' => 1,
|
||||
'mk_shift_penuh'=> 1,
|
||||
);
|
||||
}
|
||||
$this->db->where('mk_id', $idk);
|
||||
$this->db->update('master_klinik', $update_klinik);
|
||||
//-----------end cek klinik tidak bisa lebih dari jumlah shift klinik---------//
|
||||
}
|
||||
//-----------start cek quota shift jika penuh ke shift selanjutnya---------//
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function info_pengunjung(){
|
||||
$this->db->order_by('pp_panggil_anjungan', 'ASC');
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('prt_status', 0);
|
||||
$this->db->where('prt_aktif', 0);
|
||||
$query = $this->db->get('proses_ruang_tunggu');
|
||||
return $query->result();
|
||||
|
||||
$this->cekanjungan();
|
||||
}
|
||||
|
||||
function info_pengunjung2(){
|
||||
$this->db->order_by('mk_nama', 'ASC');
|
||||
$this->db->order_by('pp_panggil_anjungan', 'ASC');
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('prt_status', 0);
|
||||
$this->db->where('prt_aktif', 0);
|
||||
$query = $this->db->get('proses_ruang_tunggu');
|
||||
return $query->result();
|
||||
|
||||
$this->cekanjungan();
|
||||
}
|
||||
|
||||
function barcode($barcode){
|
||||
$barcode = date("y").substr($barcode,2);
|
||||
$this->db->join('proses_ruang_tunggu', 'prt_pengunjung_id = pp_id', 'LEFT');
|
||||
$this->db->where('pp_barcode', $barcode);
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
//$this->db->where('prt_status', 0);
|
||||
$querypp = $this->db->get('proses_pengunjung');
|
||||
$rowcount = $querypp->num_rows();
|
||||
|
||||
if($rowcount!=0){
|
||||
foreach ($querypp->result() as $datpp){
|
||||
|
||||
if($datpp->pp_status!=null){
|
||||
if($datpp->prt_aktif!=2){
|
||||
if($datpp->prt_aktif==0){
|
||||
if($datpp->prt_status==0){
|
||||
$update_prt = array(
|
||||
'prt_status' => 1,
|
||||
);
|
||||
$this->db->where('prt_id', $datpp->prt_id);
|
||||
$this->db->update('proses_ruang_tunggu', $update_prt);
|
||||
|
||||
$update_pp = array(
|
||||
'pp_panggil_anjungan' => null,
|
||||
// 'pp_panggil_loket' => null,
|
||||
// 'pp_panggil' => null,
|
||||
);
|
||||
$this->db->where('pp_id', $datpp->pp_id);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
|
||||
$this->checkin($datpp->prt_id, $datpp->pp_id);
|
||||
|
||||
$this->session->set_flashdata('message', 'Anda berhasil input barcode, Silahkan Masuk');
|
||||
}else{
|
||||
|
||||
$this->checkin($datpp->prt_id, $datpp->pp_id);
|
||||
|
||||
$this->session->set_flashdata('message', 'Pengunjung Ditemukan, Silahkan Masuk');
|
||||
}
|
||||
}else{
|
||||
$this->datang($datpp->prt_id);
|
||||
$this->session->set_flashdata('messageblue', 'Anda dinyatakan terlambat, tunggu panggilan selanjutnya diruang tunggu');
|
||||
}
|
||||
}else{
|
||||
$this->session->set_flashdata('messagewarning', 'Anda belum di panggil!!!');
|
||||
}
|
||||
}else{
|
||||
$this->session->set_flashdata('messagewarning', 'Anda belum di panggil!!!');
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
$this->session->set_flashdata('messagefail', 'Barcode Tidak Ditemukan!!');
|
||||
}
|
||||
}
|
||||
|
||||
function anjunganterlambat(){
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('prt_status', 0);
|
||||
$this->db->where('prt_aktif', 1);
|
||||
$query = $this->db->get('proses_ruang_tunggu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function datang($id){
|
||||
$update_prt = array(
|
||||
'prt_aktif' => 2,
|
||||
);
|
||||
$this->db->where('prt_id', $id);
|
||||
$this->db->update('proses_ruang_tunggu', $update_prt);
|
||||
|
||||
//$this->session->set_flashdata('message', 'Anda berhasil input pasien terlambat');
|
||||
}
|
||||
|
||||
function bypass($id){
|
||||
$autoinsert_prt = array(
|
||||
'prt_status' => 1,
|
||||
'prt_tanggal' => date("Y-m-d H:i:s"),
|
||||
'prt_aktif' => 0,
|
||||
'prt_pengunjung_id' => $id,
|
||||
);
|
||||
$prt = $this->db->insert('proses_ruang_tunggu', $autoinsert_prt);
|
||||
|
||||
$update_pp = array(
|
||||
'pp_status' => 1,
|
||||
);
|
||||
$this->db->where('pp_id', $id);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
|
||||
$this->session->set_flashdata('message', 'Anda berhasil proses pasien bypass');
|
||||
}
|
||||
|
||||
function info_klinik(){
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('prt_status', 5);
|
||||
$this->db->where('prt_aktif', 0);
|
||||
$query = $this->db->get('proses_ruang_tunggu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function datapengunjung($idklinik){
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('pp_klinik_id', $idklinik);
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function datapengunjungthis($idpp){
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
//$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('pp_id', $idpp);
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function datapengunjungpesan($idklinik,$tgl,$shift){
|
||||
$newDate = date("Y-m-d", strtotime($tgl));
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$this->db->where('pp_tanggal_periksa', $newDate);
|
||||
$this->db->where('pp_klinik_id', $idklinik);
|
||||
$this->db->where('pp_shift', $shift);
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function panggilpasien(){
|
||||
$this->db->order_by('pp_panggil', 'desc');
|
||||
$this->db->like('pp_panggil', date("Y-m-d"), 'both');// %a%
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function cetakulang($id) {
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$this->db->where('pp_id', $id);
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function allpasien() {
|
||||
$this->db->order_by('pp_tanggal_datang', 'desc');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
//$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function batasallpasien() {
|
||||
$this->db->order_by('pp_tanggal_datang', 'desc');
|
||||
$this->db->join('proses_ruang_tunggu', 'prt_pengunjung_id = pp_id','LEFT');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function checkin($idprt, $idpp){
|
||||
$this->load->model('m_loket');
|
||||
$this->m_loket->proses_checkin($idprt,$idpp);
|
||||
|
||||
$this->db->join('proses_ruang_tunggu', 'prt_pengunjung_id = pp_id');
|
||||
$this->db->where('pp_id', $idpp);
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
//var_dump("ij");
|
||||
//exit();
|
||||
foreach($query->result() as $dat){
|
||||
$dataObj = new stdClass();
|
||||
$dataObj->jenislayanan = 'antrian'; //// JENIS LAYANAN 1: simrs 2: antrian
|
||||
$dataObj->norm = ''; //// Nomor Rekam Medik
|
||||
$dataObj->instalasi = 'rajal';
|
||||
$dataObj->kodebooking = $dat->pp_barcode;//'230119100001'; //// Nomor Booking / Barcode
|
||||
$dataObj->nomorpendaftaran = ''; //// Nomor Billing Atau idx Pendaftaran
|
||||
$dataObj->waktu = strtotime(date('Y-m-d H:i:s'));// strtotime('Ymdhis'); //// INstalasi Medik 1:rajal 2:ranap
|
||||
$dataObj->tasktime = strtotime(date('Y-m-d H:i:s')); //'1674178500'; //// Time by sortime
|
||||
$dataObj->taskid = '1'; //// Task Id Proses
|
||||
$dataJSON = json_encode($dataObj);
|
||||
//var_dump($dataJSON);
|
||||
$response_array = array(
|
||||
'url' => "http://10.10.150.170:8080/gomed-api/restapi/taskid",
|
||||
'action' => "proses",
|
||||
'method' => "POST",
|
||||
'data' => $dataJSON,
|
||||
'header' => array(
|
||||
'X-Username: antrian@onsite',
|
||||
'X-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjp7InJvbGUiOiJ1c2VyIiwidXNlcm5hbWUiOiJhbnRyaWFuQG9uc2l0ZSIsInBhc3N3b3JkIjoiYW50cmlhbkAyMDIzIn0sImV4cCI6MTY4MzUxNzcyMywiaWF0IjoxNjc0NzkxMzIzfQ.KAjJTxDkC6cP8KqQJQUzwgJLlU5gWNLdHSj-43TcVfA',
|
||||
'Content-Type: application/json'
|
||||
)
|
||||
);
|
||||
//var_dump($dataJSON);
|
||||
// //var_dump($response_array);
|
||||
$respose_data = $this->sendRequest($response_array);
|
||||
//var_dump($respose_data);
|
||||
|
||||
}
|
||||
|
||||
// redirect('index.php/ps_loket_admin');
|
||||
}
|
||||
|
||||
protected function sendRequest($options = []){
|
||||
$curl = curl_init();
|
||||
|
||||
$action = isset($options["action"]) ? (trim($options["action"]) != "" ? "/" . $options["action"] : "") : "";
|
||||
$headers = array(
|
||||
"Content-type: application/json"
|
||||
);
|
||||
|
||||
$data = isset($options["data"]) ? $options["data"] : "";
|
||||
|
||||
//var_dump($data);
|
||||
$headers = $options["header"];
|
||||
|
||||
// if (isset($options["header"])) {
|
||||
// $headers = array_merge($headers, $options["header"]);
|
||||
// }
|
||||
//var_dump($headers);
|
||||
/** GET URL ACCES IP REST API */
|
||||
// $id = $this->writeBridgeLog([
|
||||
// "URL" => $options["url"] . $action,
|
||||
// "REQUEST" => $data,
|
||||
// "ACCESS_FROM_IP" => $_SERVER['REMOTE_ADDR']
|
||||
// ]);
|
||||
curl_setopt($curl, CURLOPT_URL, $options["url"] . $action);
|
||||
curl_setopt($curl, CURLOPT_HEADER, false);
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $options["method"]);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||
$result = curl_exec($curl);
|
||||
|
||||
var_dump($result);
|
||||
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
|
||||
|
||||
// /** GET URL ACCES IP REST API */
|
||||
// // $this->writeBridgeLog([
|
||||
// // "ID" => $id,
|
||||
// // "RESPONSE" => $result
|
||||
// // ]);
|
||||
|
||||
//return json_decode($result);
|
||||
|
||||
$result = json_decode($result);
|
||||
// var_dump($result);
|
||||
//exit();
|
||||
// if($result['metadata']['code']=='200'){
|
||||
// $this->session->set_flashdata('message', 'Anda berhasil check in pasien M-JKN');
|
||||
// redirect('index.php/ps_loket_admin');
|
||||
// }else{
|
||||
// $this->session->set_flashdata('message', 'Anda gagal check in pasien M-JKN');
|
||||
// redirect('index.php/ps_loket_admin');
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
class M_fasttrack extends CI_Model {
|
||||
|
||||
function index() {
|
||||
//$this->db->order_by("mk_nama", "asc");
|
||||
$this->db->order_by('pp_fasttrack', 'DESC');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$this->db->join('proses_ruang_tunggu', 'prt_pengunjung_id = pp_id', 'left');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function selectpasien($id) {
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$this->db->where('pp_id', $id);
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function setfastrack(){
|
||||
$id = $this->input->post('idpengunjung');
|
||||
$pj = $this->input->post('penanggungjawab');
|
||||
$rm = $this->input->post('norek');
|
||||
$np = $this->input->post('namapas');
|
||||
$ke = $this->input->post('ket');
|
||||
|
||||
$rafast = $pj."|".$np."|".$ke."|";
|
||||
|
||||
$update_fastrack = array(
|
||||
'pp_fasttrack' => $rafast,
|
||||
'pp_rekamedik' => $rm,
|
||||
);
|
||||
$this->db->where('pp_id', $id);
|
||||
$this->db->update('proses_pengunjung', $update_fastrack);
|
||||
|
||||
if($this->input->post('ppstatus')==1){
|
||||
$update_prt = array(
|
||||
'prt_status' => 1,
|
||||
);
|
||||
$this->db->where('prt_pengunjung_id', $id);
|
||||
$this->db->update('proses_ruang_tunggu', $update_prt);
|
||||
}else{
|
||||
$update_pp = array(
|
||||
'pp_status' => 1,
|
||||
);
|
||||
$this->db->where('pp_id', $id);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
|
||||
$insert_prt = array(
|
||||
'prt_status' => 1,
|
||||
'prt_tanggal' => date("Y-m-d H:i:s"),
|
||||
'prt_aktif' => 0,
|
||||
'prt_pengunjung_id' => $id,
|
||||
);
|
||||
$insert = $this->db->insert('proses_ruang_tunggu', $insert_prt);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
class M_hakakses extends CI_Model {
|
||||
|
||||
function prosesedithakakses() {
|
||||
$this->db->where('mum_tipeuser_id', $this->input->post('id'));
|
||||
$this->db->delete('master_user_menu');
|
||||
|
||||
if(isset($_POST['akses'])){
|
||||
$postakses= $_POST['akses'];
|
||||
foreach($postakses as $key1 =>$valueakses)
|
||||
{
|
||||
$tambahaction=null;
|
||||
$editaction=null;
|
||||
$deleteaction=null;
|
||||
$dataakses= explode ("-",$valueakses);
|
||||
|
||||
if(isset($_POST['tambah'])){
|
||||
$posttambah= $_POST['tambah'];
|
||||
foreach($posttambah as $key2 =>$valuetambah)
|
||||
{
|
||||
if($dataakses[1]==$valuetambah){
|
||||
$tambahaction="tambah";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($_POST['edit'])){
|
||||
$postedit= $_POST['edit'];
|
||||
foreach($postedit as $key3 =>$valueedit)
|
||||
{
|
||||
if($dataakses[1]==$valueedit){
|
||||
$editaction="ubah";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($_POST['delete'])){
|
||||
$postdelete= $_POST['delete'];
|
||||
foreach($postdelete as $key4 =>$valuedelete)
|
||||
{
|
||||
if($dataakses[1]==$valuedelete){
|
||||
$deleteaction="hapus";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($_POST['view'])){
|
||||
$postview= $_POST['view'];
|
||||
foreach($postview as $key5 =>$valueview)
|
||||
{
|
||||
if($dataakses[1]==$valueview){
|
||||
$viewaction="lihat";
|
||||
}
|
||||
}
|
||||
}
|
||||
$insert_hakakses = array(
|
||||
'mum_tipeuser_id' => $this->input->post('id'),
|
||||
'mum_menu_id' => $dataakses[1],
|
||||
'mum_lihat' => $viewaction,
|
||||
'mum_tambah' => $tambahaction,
|
||||
'mum_ubah' => $editaction,
|
||||
'mum_hapus' => $deleteaction,
|
||||
);
|
||||
|
||||
$insert = $this->db->insert('master_user_menu', $insert_hakakses);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
class M_klinik extends CI_Model {
|
||||
|
||||
function index() {
|
||||
$this->db->order_by('mk_nama', 'asc');
|
||||
$query = $this->db->get('master_klinik');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function klinikasc(){
|
||||
$this->db->order_by("mk_nama", "asc");
|
||||
$query = $this->db->get('master_klinik');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function insert() {
|
||||
$datjadwal="";
|
||||
$setautoshift="";
|
||||
$waktu="";
|
||||
|
||||
if($this->input->post('autoshift')=="on"){$setautoshift="1";}else{ $setautoshift="0";}
|
||||
|
||||
if(isset($_POST['senin'])){$datjadwal = $datjadwal."senin|";}
|
||||
if(isset($_POST['selasa'])){$datjadwal = $datjadwal."selasa|";}
|
||||
if(isset($_POST['rabu'])){$datjadwal = $datjadwal."rabu|";}
|
||||
if(isset($_POST['kamis'])){$datjadwal = $datjadwal."kamis|";}
|
||||
if(isset($_POST['jumat'])){$datjadwal = $datjadwal."jumat|";}
|
||||
|
||||
if(isset($_POST['jam'])){
|
||||
$jam = $_POST['jam'];
|
||||
$menit = $_POST['menit'];
|
||||
$count = count($jam);
|
||||
for($i=0;$i<$count;$i++){
|
||||
$waktu = $waktu.$jam[$i].":".$menit[$i]."|";
|
||||
}
|
||||
}
|
||||
|
||||
$insert_klinik = array(
|
||||
'mk_nama' => $this->input->post('nama'),
|
||||
'mk_kode' => $this->input->post('kode'),
|
||||
'mk_shift' => $this->input->post('shift'),
|
||||
//'mk_menit' => $this->input->post('menit'),
|
||||
'mk_quota' => $this->input->post('quota'),
|
||||
'mk_quota_bangku' => $this->input->post('quotabangku'),
|
||||
//'mk_status_shift' => $this->input->post('statusshift'),
|
||||
//'mk_aktif' => $this->input->post('aktif'),
|
||||
'mk_jadwal' => $datjadwal,
|
||||
'mk_auto_shift' => $setautoshift,
|
||||
'mk_jam_shift' => $waktu,
|
||||
);
|
||||
$insert = $this->db->insert('master_klinik', $insert_klinik);
|
||||
}
|
||||
|
||||
function edit($id) {
|
||||
$this->db->where('mk_id', $id);
|
||||
$query = $this->db->get('master_klinik');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function prosesedit() {
|
||||
$datjadwal="";
|
||||
$setautoshift="";
|
||||
|
||||
if($this->input->post('autoshift')=="on"){$setautoshift="1";}else{ $setautoshift="0";}
|
||||
|
||||
if(isset($_POST['senin'])){$datjadwal = $datjadwal."senin|";}
|
||||
if(isset($_POST['selasa'])){$datjadwal = $datjadwal."selasa|";}
|
||||
if(isset($_POST['rabu'])){$datjadwal = $datjadwal."rabu|";}
|
||||
if(isset($_POST['kamis'])){$datjadwal = $datjadwal."kamis|";}
|
||||
if(isset($_POST['jumat'])){$datjadwal = $datjadwal."jumat|";}
|
||||
|
||||
if(isset($_POST['jam'])){
|
||||
$jam = $_POST['jam'];
|
||||
$menit = $_POST['menit'];
|
||||
$count = count($jam);
|
||||
for($i=0;$i<$count;$i++){
|
||||
$waktu = $waktu.$jam[$i].":".$menit[$i]."|";
|
||||
}
|
||||
}
|
||||
|
||||
$update_klinik = array(
|
||||
'mk_nama' => $this->input->post('nama'),
|
||||
'mk_kode' => $this->input->post('kode'),
|
||||
'mk_shift' => $this->input->post('shift'),
|
||||
'mk_menit' => 0,
|
||||
'mk_quota' => $this->input->post('quota'),
|
||||
'mk_quota_bangku' => $this->input->post('quotabangku'),
|
||||
//'mk_status_shift' => $this->input->post('statusshift'),
|
||||
//'mk_aktif' => $this->input->post('aktif'),
|
||||
'mk_jadwal' => $datjadwal,
|
||||
'mk_auto_shift' => $setautoshift,
|
||||
'mk_jam_shift' => $waktu,
|
||||
);
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('mk_id', $id);
|
||||
$this->db->update('master_klinik', $update_klinik);
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->db->where('mk_id', $id);
|
||||
$query = $this->db->get('master_klinik');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('mk_id', $id);
|
||||
$this->db->delete('master_klinik');
|
||||
}
|
||||
|
||||
//-------------------------------------Klinik Admin--------------------------------//
|
||||
|
||||
function pengunjungklinik($klinik) {
|
||||
$this->db->order_by('pp_fasttrack', 'desc');
|
||||
$this->db->order_by('pp_konsul', 'desc');
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id', 'left');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id', 'left');
|
||||
$this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
$this->db->where('prt_aktif ', '0');
|
||||
$this->db->where('prt_status >=', '5');
|
||||
$this->db->where('prt_status <=', '8');
|
||||
$this->db->where('pp_klinik_id', $klinik);
|
||||
$this->db->order_by('pp_nomor_antrian_klinik', 'asc');
|
||||
$query = $this->db->get('proses_ruang_tunggu');
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
function infopengunjung($idklinik){
|
||||
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id', 'left');
|
||||
$this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
$this->db->where('prt_aktif ', '0');
|
||||
$this->db->where('pp_klinik_id ', $idklinik);
|
||||
$this->db->where('prt_status =', '4');
|
||||
$query = $this->db->get('proses_ruang_tunggu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function panggil($jumlah,$klinik){
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id', 'left');
|
||||
$this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
$this->db->where('prt_aktif ', '0');
|
||||
$this->db->where('prt_status', '4');
|
||||
$this->db->where('pp_klinik_id', $klinik);
|
||||
$prt = $this->db->get('proses_ruang_tunggu');
|
||||
$nomor=1;
|
||||
foreach ($prt->result() as $datpengunjung){
|
||||
if($nomor<=$jumlah){$nomor++;
|
||||
$update_prt = array(
|
||||
'prt_status' => 5,
|
||||
);
|
||||
$this->db->where('prt_id', $datpengunjung->prt_id);
|
||||
$this->db->update('proses_ruang_tunggu', $update_prt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function proses($pengunjung,$kode){
|
||||
$update_rt = array(
|
||||
'prt_status' => $kode,
|
||||
);
|
||||
$this->db->where('prt_id', $pengunjung);
|
||||
$this->db->update('proses_ruang_tunggu', $update_rt);
|
||||
}
|
||||
|
||||
function ubahklinik(){
|
||||
$update_pp = array(
|
||||
'pp_klinik_id' => $this->input->post('klinik'),
|
||||
'pp_konsul' => null,
|
||||
);
|
||||
$this->db->where('pp_id', $this->input->post('idpengunjung'));
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
|
||||
$update_prt = array(
|
||||
'prt_status' =>5,
|
||||
);
|
||||
$this->db->where('prt_id', $this->input->post('idprt'));
|
||||
$this->db->update('proses_ruang_tunggu', $update_prt);
|
||||
|
||||
}
|
||||
|
||||
function konsul(){
|
||||
$update_pp = array(
|
||||
'pp_klinik_id' => $this->input->post('klinik'),
|
||||
'pp_konsul' => 1,
|
||||
);
|
||||
$this->db->where('pp_id', $this->input->post('idpengunjung'));
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
|
||||
$update_prt = array(
|
||||
'prt_status' => 7,
|
||||
);
|
||||
$this->db->where('prt_id', $this->input->post('idprt'));
|
||||
$this->db->update('proses_ruang_tunggu', $update_prt);
|
||||
}
|
||||
|
||||
function autoshift($klinik,$kode){
|
||||
$update_autoshift = array(
|
||||
'mk_auto_shift' => $kode,
|
||||
);
|
||||
$this->db->where('mk_id', $klinik);
|
||||
$this->db->update('master_klinik', $update_autoshift);
|
||||
}
|
||||
|
||||
function datapengunjung($idklinik){
|
||||
$this->db->join('proses_ruang_tunggu', 'prt_pengunjung_id = pp_id', 'left');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$this->db->order_by('prt_tanggal', 'asc');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('pp_klinik_id', $idklinik);
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function aktif($idprt){
|
||||
$update_prt = array(
|
||||
'prt_status' => '7',
|
||||
);
|
||||
$this->db->where('prt_id', $idprt);
|
||||
$this->db->update('proses_ruang_tunggu', $update_prt);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
class M_listpasien extends CI_Model {
|
||||
|
||||
function index() {
|
||||
$this->db->join('proses_ruang_tunggu', 'proses_pengunjung.pp_id = proses_ruang_tunggu.prt_pengunjung_id', 'left ');
|
||||
$this->db->join('m_pasien', 'proses_pengunjung.pp_pasien_id = m_pasien.int_pasien_id', 'left ');
|
||||
$this->db->join('master_klinik', 'proses_pengunjung.pp_klinik_id = master_klinik.mk_id');
|
||||
$this->db->order_by("pp_tanggal_periksa", "asc");
|
||||
$this->db->where('pp_tanggal_periksa >=', date("Y-m-d") );
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function search() {
|
||||
$tglperiksa=$this->input->post('tglperiksa');
|
||||
$date = str_replace('/', '-', $tglperiksa);
|
||||
$newDate= date('Y-m-d', strtotime($date));
|
||||
|
||||
$ketkunjungan=$this->input->post('ketkunjungan');
|
||||
|
||||
$this->db->join('proses_ruang_tunggu', 'proses_pengunjung.pp_id = proses_ruang_tunggu.prt_pengunjung_id', 'left ');
|
||||
$this->db->join('m_pasien', 'proses_pengunjung.pp_pasien_id = m_pasien.int_pasien_id', 'left ');
|
||||
$this->db->join('master_klinik', 'proses_pengunjung.pp_klinik_id = master_klinik.mk_id');
|
||||
$this->db->where('pp_tanggal_periksa ', $newDate );
|
||||
|
||||
if($ketkunjungan=="online"){
|
||||
$this->db->where('pp_pendaftaran_online is NOT NULL', NULL, FALSE);
|
||||
}elseif($ketkunjungan=="offline"){
|
||||
$this->db->where('pp_pendaftaran_online', NULL);
|
||||
}
|
||||
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->db->where('mt_id', $id);
|
||||
$query = $this->db->get('master_tipeuser');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function datenow(){
|
||||
$this->db->where('pp_tanggal_periksa >=', date("Y-m-d") );
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function minsatunow(){
|
||||
$tglend= date('Y-m', strtotime('-1 month', strtotime( date("Y-m") )));
|
||||
$this->db->like('pp_tanggal_periksa', $tglend , 'after');
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function laporanpasien() {
|
||||
//$bulan=$this->input->post('bulankunjungan');
|
||||
//$tahun=$this->input->post('tahunkunjungan');
|
||||
|
||||
//$this->db->join('proses_ruang_tunggu', 'proses_pengunjung.pp_id = proses_ruang_tunggu.prt_pengunjung_id', 'left ');
|
||||
//$this->db->join('m_pasien', 'proses_pengunjung.pp_pasien_id = m_pasien.int_pasien_id', 'left ');
|
||||
//$this->db->join('master_klinik', 'proses_pengunjung.pp_klinik_id = master_klinik.mk_id');
|
||||
//$this->db->where('pp_tanggal_periksa >=', date("Y-m-d") );
|
||||
//$this->db->like('pp_tanggal_periksa', "2023-05");
|
||||
//$this->db->group_by('day(pp_tanggal_periksa)');
|
||||
//$this->db->group_by('DATE(pp_tanggal_periksa)');
|
||||
//$this->db->group_by('date');
|
||||
//$this->db->where('pp_tanggal_periksa ', $newDate );
|
||||
|
||||
// if($ketkunjungan=="online"){
|
||||
// $this->db->where('pp_pendaftaran_online is NOT NULL', NULL, FALSE);
|
||||
// }elseif($ketkunjungan=="offline"){
|
||||
// $this->db->where('pp_pendaftaran_online', NULL);
|
||||
// }
|
||||
|
||||
// $query = $this->db->get('proses_pengunjung');
|
||||
// return $query->result();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class M_login extends CI_Model{
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
}
|
||||
public function validate(){
|
||||
$username = $this->security->xss_clean($this->input->post('username'));
|
||||
$password = md5($this->security->xss_clean($this->input->post('password')));
|
||||
$this->db->where('mu_nama_user', $username);
|
||||
$this->db->where('mu_password', $password);
|
||||
$query = $this->db->get('master_user');
|
||||
if($query->num_rows() == 1)
|
||||
{
|
||||
if (date('H') < 7) {
|
||||
//-----------------start untuk cek jam shift, jam shift, dan aktif klinik------------------//
|
||||
$this->load->model('m_anjungan');
|
||||
$info_pengunjung = $this->m_anjungan->cek_shift_jam();
|
||||
|
||||
$this->load->model('m_anjungan');
|
||||
$cekanjungan = $this->m_anjungan->cekanjungan();
|
||||
//-----------------end untuk cek jam shift, jam shift, dan aktif klinik------------------//
|
||||
}
|
||||
|
||||
$row = $query->row();
|
||||
$data = array(
|
||||
's_ID_User' => $row->mu_id,
|
||||
's_NamaUser_User' => $row->mu_nama_user,
|
||||
's_FK_TipeUser' => $row->mu_tipeuser_id,
|
||||
's_loket' => $row->mu_loket_id,
|
||||
's_klinik' => $row->mu_klinik_id,
|
||||
'validated' => true
|
||||
);
|
||||
$this->session->set_userdata($data);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,350 @@
|
||||
<?php
|
||||
class M_loket extends CI_Model {
|
||||
|
||||
function index() {
|
||||
$query = $this->db->get('master_loket');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function insert() {
|
||||
$datpelayanan = "";
|
||||
if(isset($_POST['klinik'])){
|
||||
$dataklinik=$this->input->post('klinik');
|
||||
$jumlahklinik = count($this->input->post('klinik'));
|
||||
for($x = 0; $x <= $jumlahklinik; $x++){
|
||||
if(isset($dataklinik[$x])){
|
||||
$datpelayanan = $datpelayanan.$dataklinik[$x].",";
|
||||
}
|
||||
}
|
||||
}
|
||||
$insert_loket = array(
|
||||
'ml_nama' => $this->input->post('nama'),
|
||||
'ml_pelayanan' => $datpelayanan,
|
||||
'ml_quota_bangku' => $this->input->post('quota'),
|
||||
'ml_pembayaran' => $this->input->post('pembayaran'),
|
||||
'ml_online' => $this->input->post('online'),
|
||||
'ml_statuspelayanan'=> $this->input->post('statuspelayanan'),
|
||||
);
|
||||
$insert = $this->db->insert('master_loket', $insert_loket);
|
||||
}
|
||||
|
||||
function edit($id) {
|
||||
$this->db->where('ml_id', $id);
|
||||
$query = $this->db->get('master_loket');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function prosesedit() {
|
||||
$datpelayanan = "";
|
||||
if(isset($_POST['klinik'])){
|
||||
$dataklinik=$this->input->post('klinik');
|
||||
$jumlahklinik = count($this->input->post('klinik'));
|
||||
for($x = 0; $x <= $jumlahklinik; $x++){
|
||||
if(isset($dataklinik[$x])){
|
||||
$datpelayanan = $datpelayanan.$dataklinik[$x].",";
|
||||
}
|
||||
}
|
||||
}
|
||||
$update_loket = array(
|
||||
'ml_nama' => $this->input->post('nama'),
|
||||
'ml_pelayanan' => $datpelayanan,
|
||||
'ml_quota_bangku' => $this->input->post('quota'),
|
||||
'ml_pembayaran' => $this->input->post('pembayaran'),
|
||||
'ml_online' => $this->input->post('online'),
|
||||
'ml_statuspelayanan'=> $this->input->post('statuspelayanan'),
|
||||
);
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('ml_id', $id);
|
||||
$this->db->update('master_loket', $update_loket);
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->db->where('ml_id', $id);
|
||||
$query = $this->db->get('master_loket');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('ml_id', $id);
|
||||
$this->db->delete('master_loket');
|
||||
}
|
||||
|
||||
//-------------------------------------Loket Admin--------------------------------//
|
||||
|
||||
function pengunjung() {
|
||||
$this->db->order_by('pp_fasttrack', 'desc');
|
||||
$this->db->order_by('pp_tanggal_datang', 'asc');
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id', 'left');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id', 'left');
|
||||
$this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
$this->db->where('pp_loket', $this->session->userdata('s_loket'));
|
||||
$this->db->where('prt_aktif ', '0');
|
||||
$this->db->where('prt_status <', '5');
|
||||
$query = $this->db->get('proses_ruang_tunggu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function pengunjungklinik() {
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id', 'left');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id', 'left');
|
||||
$this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
$this->db->where('prt_aktif ', '0');
|
||||
$this->db->where('prt_status >', '3');
|
||||
$this->db->where('prt_status <', '6');
|
||||
$query = $this->db->get('proses_ruang_tunggu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function panggil($jumlah){
|
||||
$iduser = $this->session->userdata('s_ID_User');
|
||||
$dataklinik="";
|
||||
$datapembayaran="";
|
||||
$this->db->join('master_loket', 'ml_id = mu_loket_id');
|
||||
$this->db->where('mu_id', $iduser);
|
||||
$user = $this->db->get('master_user');
|
||||
foreach ($user->result() as $datuser){
|
||||
$dataklinik = $datuser->ml_pelayanan;
|
||||
$datapembayaran = $datuser->ml_pembayaran;
|
||||
}
|
||||
|
||||
$klinikpecah = explode(",",$dataklinik);
|
||||
//$this->db->join('proses_ruang_tunggu', 'prt_pengunjung_id = pp_id','LEFT');
|
||||
$this->db->order_by('pp_tanggal_datang', 'asc');
|
||||
$this->db->or_where_in('pp_klinik_id', $klinikpecah);
|
||||
$this->db->where('pp_status', null);
|
||||
$this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
$this->db->where('pp_pembayaran', $datapembayaran);
|
||||
$pengunjung = $this->db->get('proses_pengunjung');
|
||||
$nomor=1;
|
||||
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('prt_aktif', 2);
|
||||
$rt = $this->db->get('proses_ruang_tunggu');
|
||||
foreach ($rt->result() as $datruangtunggu){
|
||||
if($nomor<=$jumlah){$nomor++;
|
||||
$update_ruangtunggu = array(
|
||||
'prt_aktif' => 0,
|
||||
);
|
||||
$this->db->where('prt_id', $datruangtunggu->prt_id);
|
||||
$this->db->update('proses_ruang_tunggu', $update_ruangtunggu);
|
||||
|
||||
$updatepengunjung = array('pp_status'=> 1,'pp_panggil_anjungan'=> date("Y-m-d H:i:s"));
|
||||
$this->db->where('pp_id', $datruangtunggu->pp_id);
|
||||
$this->db->update('proses_pengunjung', $updatepengunjung);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pengunjung->result() as $datpengunjung){
|
||||
$this->db->where('mk_id', $datpengunjung->pp_klinik_id);
|
||||
$kl = $this->db->get('master_klinik');
|
||||
foreach ($kl->result() as $datklinik){
|
||||
//-------------cek shift buka----------//
|
||||
if($datpengunjung->pp_shift <= $datklinik->mk_shift_buka){
|
||||
//echo $datpengunjung->pp_id; echo $nomor;
|
||||
if($nomor<=$jumlah){$nomor++;
|
||||
|
||||
$input_ruangtunggu = array(
|
||||
'prt_status' => 0,
|
||||
'prt_tanggal' => date("Y-m-d H:i:s"),
|
||||
'prt_aktif' => 0,
|
||||
'prt_pengunjung_id' => $datpengunjung->pp_id,
|
||||
);
|
||||
$insert = $this->db->insert('proses_ruang_tunggu', $input_ruangtunggu);
|
||||
|
||||
$updatepengunjung = array('pp_status'=> 1,'pp_panggil_anjungan'=> date("Y-m-d H:i:s"),'pp_loket'=>$this->session->userdata('s_loket'));
|
||||
//$updatepengunjung = array('pp_status'=> 1,'pp_panggil_anjungan'=> date("Y-m-d H:i:s"));
|
||||
$this->db->where('pp_id', $datpengunjung->pp_id);
|
||||
$this->db->update('proses_pengunjung', $updatepengunjung);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function proses($pengunjung,$kode){
|
||||
$update_rt = array(
|
||||
'prt_status' => $kode,
|
||||
);
|
||||
$this->db->where('prt_id', $pengunjung);
|
||||
$this->db->update('proses_ruang_tunggu', $update_rt);
|
||||
}
|
||||
|
||||
function barcode($pengunjung){
|
||||
$update_prt = array(
|
||||
'prt_status' =>1,
|
||||
);
|
||||
$this->db->where('prt_id', $pengunjung);
|
||||
$this->db->update('proses_ruang_tunggu', $update_prt);
|
||||
}
|
||||
|
||||
function terlambat($pengunjung){
|
||||
$update_prt = array(
|
||||
'prt_aktif' =>1,
|
||||
'prt_status' =>0,
|
||||
);
|
||||
$this->db->where('prt_id', $pengunjung);
|
||||
$this->db->update('proses_ruang_tunggu', $update_prt);
|
||||
}
|
||||
|
||||
function aktif($pengunjung){
|
||||
$update_prt = array(
|
||||
'prt_aktif' =>0,
|
||||
'prt_status' =>1,
|
||||
);
|
||||
$this->db->where('prt_id', $pengunjung);
|
||||
$this->db->update('proses_ruang_tunggu', $update_prt);
|
||||
}
|
||||
|
||||
function infopengunjung(){
|
||||
$this->db->join('proses_ruang_tunggu', 'prt_pengunjung_id = pp_id','LEFT');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function ubahklinik(){
|
||||
$update_pp = array(
|
||||
'pp_klinik_id' => $this->input->post('klinik'),
|
||||
'pp_pembayaran' => $this->input->post('pembayaran'),
|
||||
'pp_loket' => null,
|
||||
);
|
||||
$this->db->where('pp_id', $this->input->post('idpengunjung'));
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
|
||||
$update_prt = array(
|
||||
'prt_status' =>1,
|
||||
);
|
||||
$this->db->where('prt_id', $this->input->post('idprt'));
|
||||
$this->db->update('proses_ruang_tunggu', $update_prt);
|
||||
|
||||
}
|
||||
|
||||
function kunjunganterlambat(){
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('prt_status', 0);
|
||||
$this->db->where('prt_aktif', 1);
|
||||
$query = $this->db->get('proses_ruang_tunggu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function proses_pengunjung(){
|
||||
$idprt = $this->input->post('idprt_proses');
|
||||
$idpp = $this->input->post('idpp_proses');
|
||||
$idkl = $this->input->post('idklinik_proses');
|
||||
$kodekl = $this->input->post('kodeklinik_proses');
|
||||
$rm = $this->input->post('norm');
|
||||
$fasttr = $this->input->post('data_fastrack');
|
||||
|
||||
$kode = 4;
|
||||
|
||||
$no_klinik="";
|
||||
$i=0;
|
||||
$hasil_nomor = "";
|
||||
$this->db->order_by('pp_nomor_antrian_klinik', "asc");
|
||||
$this->db->where('pp_klinik_id', $idkl);
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->like('pp_nomor_antrian_klinik', 'KL'.$kodekl);
|
||||
$query_pengunjung = $this->db->get('proses_pengunjung');
|
||||
foreach ($query_pengunjung->result() as $datpengunjung){
|
||||
if(isset($datpengunjung->pp_nomor_antrian_klinik)){
|
||||
$no_klinik = $datpengunjung->pp_nomor_antrian_klinik;
|
||||
}
|
||||
}
|
||||
|
||||
if($fasttr!=null){$kode=5;}
|
||||
|
||||
if(isset($no_klinik)){
|
||||
$urutan = (int) substr($no_klinik, 4, 3);
|
||||
$urutan++;
|
||||
$hasil_nomor = "KL".$kodekl.sprintf("%03s", $urutan);
|
||||
}else {
|
||||
$hasil_nomor="KL".$kodekl."001";
|
||||
}
|
||||
|
||||
$this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
$this->db->where('pp_nomor_antrian_klinik', $hasil_nomor);
|
||||
$query_cek_nomor = $this->db->get('proses_pengunjung');
|
||||
if($query_cek_nomor->num_rows()!=0){
|
||||
return FALSE;
|
||||
}else{
|
||||
$update_pp = array(
|
||||
'pp_nomor_antrian_klinik' => $hasil_nomor,
|
||||
'pp_rekamedik' => $rm,
|
||||
);
|
||||
$this->db->where('pp_id', $idpp);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
|
||||
$update_rt = array(
|
||||
'prt_status' => $kode,
|
||||
);
|
||||
$this->db->where('prt_id', $idprt);
|
||||
$this->db->update('proses_ruang_tunggu', $update_rt);
|
||||
}
|
||||
}
|
||||
|
||||
function proses_panggil($idpp, $idloket){
|
||||
$namaloket = "";
|
||||
$this->db->where('ml_id', $idloket);
|
||||
$query_loket = $this->db->get('master_loket');
|
||||
foreach ($query_loket->result() as $datloket){
|
||||
$namaloket = $datloket->ml_nama;
|
||||
}
|
||||
|
||||
$update_pp = array(
|
||||
'pp_panggil' => date("Y-m-d H:i:s"),
|
||||
'pp_panggil_loket' => $namaloket,
|
||||
);
|
||||
$this->db->where('pp_id', $idpp);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
}
|
||||
|
||||
function proses_panggil_anjungan($idpp){
|
||||
$update_pp = array(
|
||||
'pp_panggil_anjungan' => date("Y-m-d H:i:s"),
|
||||
);
|
||||
$this->db->where('pp_id', $idpp);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
}
|
||||
|
||||
function proses_panggil_null($idpp){
|
||||
|
||||
$update_pp = array(
|
||||
'pp_panggil' => null,
|
||||
'pp_panggil_loket' => null,
|
||||
//'pp_panggil_anjungan' => null,
|
||||
);
|
||||
$this->db->where('pp_id', $idpp);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
}
|
||||
|
||||
function proses_panggil_anjungan_null($idpp){
|
||||
|
||||
$update_pp = array(
|
||||
'pp_panggil_anjungan' => null,
|
||||
);
|
||||
$this->db->where('pp_id', $idpp);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
}
|
||||
|
||||
function data_pengunjung($idpp){
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$this->db->where('pp_id', $idpp);
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function proses_checkin($idprt, $idpp){
|
||||
$update_pp = array(
|
||||
'pp_tanggal_datang' => date("Y-m-d H:i:s"),
|
||||
);
|
||||
$this->db->where('pp_id', $idpp);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
class M_loketranap extends CI_Model {
|
||||
|
||||
function index() {
|
||||
$this->db->join('master_loket', 'ml_id = ppr_loket', 'LEFT');
|
||||
$this->db->where('ppr_status <=', "2");
|
||||
$this->db->like('ppr_tanggal_periksa', date("Y-m-d"));
|
||||
|
||||
$this->db->order_by('ppr_tanggal_periksa', 'ASC');
|
||||
$this->db->order_by('ppr_status', 'ASC');
|
||||
$query = $this->db->get('proses_pengunjung_ranap');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function datapengunjung($id) {
|
||||
$this->db->where('ppr_id', $id);
|
||||
$query = $this->db->get('proses_pengunjung_ranap');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function searchloket() {
|
||||
$this->db->like('ppr_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('ppr_status', "1");
|
||||
$this->db->where('ppr_loket', $this->session->userdata('s_loket'));
|
||||
$query = $this->db->get('proses_pengunjung_ranap');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function datapanggil() {
|
||||
$this->db->join('master_loket', 'ml_id = ppr_loket', 'LEFT');
|
||||
$this->db->like('ppr_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('ppr_status <=', "2");
|
||||
$this->db->where('ppr_loket is NULL', NULL, TRUE);
|
||||
$this->db->where('ppr_callsound is NULL', NULL, FALSE);
|
||||
$this->db->order_by('ppr_callsound', 'ASC');
|
||||
$query = $this->db->get('proses_pengunjung_ranap');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function datapanggilsuara() {
|
||||
$this->db->join('master_loket', 'ml_id = ppr_loket', 'LEFT');
|
||||
$this->db->like('ppr_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->where('ppr_loket is NOT NULL', NULL, FALSE);
|
||||
$this->db->where('ppr_callsound is NOT NULL', NULL, FALSE);
|
||||
$this->db->order_by('ppr_callsound', 'DESC');
|
||||
$query = $this->db->get('proses_pengunjung_ranap');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function dataloket() {
|
||||
$this->db->join('master_loket', 'ml_id = mu_loket_id', 'LEFT');
|
||||
$this->db->where('mu_tipeuser_id', "7");
|
||||
$query = $this->db->get('master_user');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
// function insertpengunjung() {
|
||||
//
|
||||
// $no_antrian;
|
||||
// $hasil_nomor = "";
|
||||
// $this->db->order_by('ppr_nomor_antrian', 'ASC');
|
||||
// $this->db->where('ppr_tanggal_periksa', date("Y-m-d"));
|
||||
// $query = $this->db->get('proses_pengunjung_ranap');
|
||||
// foreach ($query->result() as $datpengunjung){
|
||||
// $no_antrian = $datpengunjung->ppr_nomor_antrian;
|
||||
// }
|
||||
//
|
||||
// if(isset($no_antrian)){
|
||||
// $hasil_nomor = $no_antrian+1;
|
||||
// $nomjum = strlen($hasil_nomor);$nol="";
|
||||
// if($nomjum=="1"){$nol="00";}
|
||||
// elseif($nomjum=="2"){$nol="0";}
|
||||
// $hasil_nomor=$nol.$hasil_nomor;
|
||||
// }else {
|
||||
// $hasil_nomor="001";
|
||||
// }
|
||||
//
|
||||
// $insert = array(
|
||||
// 'ppr_nomor_antrian' => $hasil_nomor,
|
||||
// 'ppr_tanggal_periksa' => date("Y-m-d"),
|
||||
// 'ppr_status' => "0",
|
||||
// );
|
||||
// $this->db->insert('proses_pengunjung_ranap', $insert);
|
||||
// }
|
||||
//
|
||||
// function edit($id) {
|
||||
// $this->db->where('mt_id', $id);
|
||||
// $query = $this->db->get('master_tipeuser');
|
||||
// return $query;
|
||||
// }
|
||||
//
|
||||
// function prosesedit() {
|
||||
// $update_tipeuser = array(
|
||||
// 'mt_nama' => $this->input->post('namatipeuser'),
|
||||
// );
|
||||
// $id = $this->input->post('id');
|
||||
// $this->db->where('mt_id', $id);
|
||||
// $this->db->update('master_tipeuser', $update_tipeuser);
|
||||
// }
|
||||
//
|
||||
// function view($id) {
|
||||
// $this->db->where('mt_id', $id);
|
||||
// $query = $this->db->get('master_tipeuser');
|
||||
// return $query;
|
||||
// }
|
||||
//
|
||||
// function delete($id) {
|
||||
// $this->db->where('mt_id', $id);
|
||||
// $this->db->delete('master_tipeuser');
|
||||
// }
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
class M_masteruser extends CI_Model {
|
||||
function index() {
|
||||
$this->db->select('user.*,tipeuser.Nama_TipeUser');
|
||||
$this->db->from('user')->join('tipeuser', 'user.FK_TipeUser = tipeuser.ID_TipeUser', 'left');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function insert() {
|
||||
$insert_masteruser = array(
|
||||
'FK_TipeUser' => $this->input->post('tipeuser'),
|
||||
'NamaUser_User' => $this->input->post('namauser'),
|
||||
'Password_User' => "simkoprasiBMB",
|
||||
'NamaLengkap_User' => $this->input->post('namalengkapuser'),
|
||||
'Telepon_User' => $this->input->post('teleponuser'),
|
||||
'Email_User' => $this->input->post('emailuser'),
|
||||
'TanggalLahir_User' => $this->input->post('tanggallahiruser'),
|
||||
'TempatLahir_User' => $this->input->post('tempatlahiruser'),
|
||||
'Alamat_User' => $this->input->post('alamatuser'),
|
||||
'JenisKelamin_User' => $this->input->post('jeniskelaminuser'),
|
||||
'Agama_User' => $this->input->post('agamauser'),
|
||||
'TanggalBuat_User' => date('Y-m-d H:i:s'),
|
||||
'TanggalEdit_User' => date('Y-m-d H:i:s'),
|
||||
'Provinsi_ID' => $this->input->post('provinsi'),
|
||||
'Kabupaten_ID' => $this->input->post('kabupaten'),
|
||||
'Kecamatan_ID' => $this->input->post('kecamatan'),
|
||||
'Desa_ID' => $this->input->post('desa'),
|
||||
|
||||
);
|
||||
|
||||
$insert = $this->db->insert('user', $insert_masteruser);
|
||||
return $insert;
|
||||
}
|
||||
|
||||
function edit($id) {
|
||||
$this->db->where('ID_User', $id);
|
||||
$query = $this->db->get('user');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function prosesedit() {
|
||||
$update_masteruser = array(
|
||||
'FK_TipeUser' => $this->input->post('tipeuser'),
|
||||
'NamaUser_User' => $this->input->post('namauser'),
|
||||
//'Password_User' => $this->input->post('passworduser'),
|
||||
'NamaLengkap_User' => $this->input->post('namalengkapuser'),
|
||||
'Telepon_User' => $this->input->post('teleponuser'),
|
||||
'Email_User' => $this->input->post('emailuser'),
|
||||
'TanggalLahir_User' => $this->input->post('tanggallahiruser'),
|
||||
'TempatLahir_User' => $this->input->post('tempatlahiruser'),
|
||||
'Alamat_User' => $this->input->post('alamatuser'),
|
||||
'JenisKelamin_User' => $this->input->post('jeniskelaminuser'),
|
||||
'Agama_User' => $this->input->post('agamauser'),
|
||||
'TanggalEdit_User' => date('Y-m-d H:i:s'),
|
||||
'Provinsi_ID' => $this->input->post('provinsi'),
|
||||
'Kabupaten_ID' => $this->input->post('kabupaten'),
|
||||
'Kecamatan_ID' => $this->input->post('kecamatan'),
|
||||
'Desa_ID' => $this->input->post('desa'),
|
||||
);
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('ID_User', $id);
|
||||
$this->db->update('user', $update_masteruser);
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->db->where('ID_User', $id);
|
||||
$query = $this->db->get('user');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('ID_User', $id);
|
||||
$this->db->delete('user');
|
||||
}
|
||||
|
||||
function editfoto() {
|
||||
$config = array(
|
||||
'upload_path' => "./img/",
|
||||
'allowed_types' => "jpg|jpeg",
|
||||
'overwrite' => TRUE,
|
||||
'max_size' => "2048000", // Can be set to particular file size , here it is 2 MB(2048 Kb)
|
||||
'max_height' => "768",
|
||||
'max_width' => "1024"
|
||||
);
|
||||
$this->load->library('upload', $config);
|
||||
$upload_data = $this->upload->data();
|
||||
$file_name = $upload_data['file_name'];
|
||||
|
||||
$update_user = array(
|
||||
'Foto_User' => $file_name,
|
||||
'TanggalEdit_User' => date('Y-m-d H:i:s'),
|
||||
);
|
||||
$id = $this->session->userdata('s_ID_User');
|
||||
$this->db->where('ID_User', $id);
|
||||
$this->db->update('user', $update_user);
|
||||
}
|
||||
|
||||
function resetpass($id) {
|
||||
$update_user = array(
|
||||
'Password_User' => "simkoprasiBMB",
|
||||
'TanggalEdit_User' => date('Y-m-d H:i:s'),
|
||||
);
|
||||
$this->db->where('ID_User', $id);
|
||||
$this->db->update('user', $update_user);
|
||||
}
|
||||
|
||||
function editpass($id) {
|
||||
$update_user = array(
|
||||
'Password_User' => $this->input->post('renewpass'),
|
||||
'TanggalEdit_User' => date('Y-m-d H:i:s'),
|
||||
);
|
||||
$this->db->where('ID_User', $id);
|
||||
$this->db->update('user', $update_user);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
class M_menu extends CI_Model {
|
||||
|
||||
function index() {
|
||||
//$this->db->order_by('mm_urutan', 'ASC');
|
||||
$query = $this->db->get('master_menu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function urutan() {
|
||||
$this->db->order_by('mm_urutan', 'ASC');
|
||||
$query = $this->db->get('master_menu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function hakakses($id) {
|
||||
$this->db->where('mum_tipeuser_id', $id);
|
||||
$query = $this->db->get('master_user_menu');
|
||||
return $query->result();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
class M_pasien extends CI_Model {
|
||||
function index() {
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->join('proses_ruang_tunggu', 'prt_pengunjung_id = pp_id', 'LEFT');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function edit($id) {
|
||||
$this->db->where('pp_id', $id);
|
||||
$this->db->join('proses_ruang_tunggu', 'prt_pengunjung_id = pp_id', 'LEFT');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id');
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function prosesedit() {
|
||||
$update_pp = array(
|
||||
'pp_rekamedik' => $this->input->post('norek'),
|
||||
//'pp_klinik_id' => $this->input->post('klinik'),
|
||||
//'pp_shift' => $this->input->post('shift'),
|
||||
//'pp_pembayaran' => $this->input->post('pembayaran'),
|
||||
);
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('pp_id', $id);
|
||||
$this->db->update('proses_pengunjung', $update_pp);
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->db->where('mu_id', $id);
|
||||
$query = $this->db->get('master_user');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('mu_id', $id);
|
||||
$this->db->delete('master_user');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
class M_screen extends CI_Model {
|
||||
function index() {
|
||||
$query = $this->db->get('master_klinik');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function info_pp($mlscreen) {
|
||||
$this->db->join('proses_ruang_tunggu', 'prt_pengunjung_id = pp_id', 'LEFT');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id','LEFT');
|
||||
$this->db->where('mk_screen', $mlscreen);
|
||||
$this->db->where('prt_status', '5');
|
||||
$this->db->where('pp_tanggal_periksa', date("Y-m-d"));
|
||||
$query = $this->db->get('proses_pengunjung');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function master_klinik($mlscreen) {
|
||||
$this->db->where('mk_screen', $mlscreen);
|
||||
$this->db->order_by('mk_nama', 'asc');
|
||||
$query = $this->db->get('master_klinik');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function edit($ketscr) {
|
||||
$this->db->where('mk_screen', $ketscr);
|
||||
$query = $this->db->get('master_klinik');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function prosesedit() {
|
||||
$totnum = $this->input->post('lastnumber');
|
||||
for($i=1;$i<=$totnum;$i++){
|
||||
$update_kl = array(
|
||||
'mk_screen' => $this->input->post('sc'.$i),
|
||||
);
|
||||
$id = $this->input->post('idk'.$i);
|
||||
$this->db->where('mk_id', $id);
|
||||
$this->db->update('master_klinik', $update_kl);
|
||||
}
|
||||
}
|
||||
|
||||
function pengunjung($idloket) {
|
||||
$this->db->order_by('pp_fasttrack', 'desc');
|
||||
$this->db->order_by('pp_tanggal_datang', 'DESC');
|
||||
$this->db->join('proses_pengunjung', 'pp_id = prt_pengunjung_id', 'left');
|
||||
$this->db->join('master_klinik', 'mk_id = pp_klinik_id', 'left');
|
||||
$this->db->where('pp_tanggal_periksa', date('Y-m-d'));
|
||||
$this->db->where('pp_loket', $idloket);
|
||||
//$this->db->where('pp_loket', $this->session->userdata('s_loket'));
|
||||
$this->db->where('prt_aktif ', '0');
|
||||
$this->db->where('prt_status <', '5');
|
||||
$query = $this->db->get('proses_ruang_tunggu');
|
||||
return $query->result();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
class M_tipeuser extends CI_Model {
|
||||
|
||||
function index() {
|
||||
$query = $this->db->get('master_tipeuser');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function insert() {
|
||||
$insert_tipeuser = array(
|
||||
'mt_nama' => $this->input->post('namatipeuser'),
|
||||
);
|
||||
$insert = $this->db->insert('master_tipeuser', $insert_tipeuser);
|
||||
}
|
||||
|
||||
function edit($id) {
|
||||
$this->db->where('mt_id', $id);
|
||||
$query = $this->db->get('master_tipeuser');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function prosesedit() {
|
||||
$update_tipeuser = array(
|
||||
'mt_nama' => $this->input->post('namatipeuser'),
|
||||
);
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('mt_id', $id);
|
||||
$this->db->update('master_tipeuser', $update_tipeuser);
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->db->where('mt_id', $id);
|
||||
$query = $this->db->get('master_tipeuser');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('mt_id', $id);
|
||||
$this->db->delete('master_tipeuser');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
class M_userlogin extends CI_Model {
|
||||
function index() {
|
||||
$this->db->join('master_tipeuser', 'master_tipeuser.mt_id = master_user.mu_tipeuser_id','left');
|
||||
$this->db->join('master_klinik', 'master_klinik.mk_id = master_user.mu_klinik_id','left');
|
||||
$this->db->join('master_loket', 'master_loket.ml_id = master_user.mu_loket_id','left');
|
||||
$query = $this->db->get('master_user');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function insert() {
|
||||
$loketdat = $this->input->post('loket');if(empty($loketdat)){$loketdat=null;}
|
||||
$klinik = $this->input->post('klinik');if(empty($klinik)){$klinik=null;}
|
||||
$insert_userlogin = array(
|
||||
'mu_nama_lengkap' => $this->input->post('namalengkapuser'),
|
||||
'mu_nama_user' => $this->input->post('namauser'),
|
||||
'mu_password' => md5($this->input->post('passworduser')),
|
||||
'mu_klinik_id' => $klinik,
|
||||
'mu_loket_id' => $loketdat,
|
||||
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
||||
);
|
||||
$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() {
|
||||
$loketdat = $this->input->post('loket');if(empty($loketdat)){$loketdat=null;}
|
||||
$klinik = $this->input->post('klinik');if(empty($klinik)){$klinik=null;}
|
||||
$password = $this->input->post('passworduser');
|
||||
if(empty($password)){
|
||||
$update_userlogin = array(
|
||||
'mu_nama_lengkap' => $this->input->post('namalengkapuser'),
|
||||
'mu_nama_user' => $this->input->post('namauser'),
|
||||
'mu_klinik_id' => $klinik,
|
||||
'mu_loket_id' => $loketdat,
|
||||
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
||||
);
|
||||
}else{
|
||||
$update_userlogin = array(
|
||||
'mu_nama_lengkap' => $this->input->post('namalengkapuser'),
|
||||
'mu_nama_user' => $this->input->post('namauser'),
|
||||
'mu_password' => md5($this->input->post('passworduser')),
|
||||
'mu_klinik_id' => $klinik,
|
||||
'mu_loket_id' => $loketdat,
|
||||
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
||||
);
|
||||
}
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('mu_id', $id);
|
||||
$this->db->update('master_user', $update_userlogin);
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->db->where('mu_id', $id);
|
||||
$query = $this->db->get('master_user');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('mu_id', $id);
|
||||
$this->db->delete('master_user');
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user