Commit 17518758 authored by Indra Raja's avatar Indra Raja

mengubah mapping table pada database

parent eb3c1e11
......@@ -138,7 +138,7 @@ class ApiController extends \Application\Master\GlobalActionController {
$tb_register_antrian ='register_antrian';
$tb_register_dokter ='register_dokter';
$tb_dokter ='dokter';
$tb_dokter ='dokter_to_poli';
$tb_ruang ='ruang';
$tb_antrian ='antrian';
$tb_antrian_pasien ='antrian_pasien';
......@@ -380,7 +380,7 @@ class ApiController extends \Application\Master\GlobalActionController {
$request = $this->getRequest();
$post = $request->getPost();
$tb_dokter ='dokter';
$tb_dokter ='dokter_to_poli';
$tb_ruang ='ruang';
......@@ -621,7 +621,7 @@ class ApiController extends \Application\Master\GlobalActionController {
$test = new \Application\Model\Param($storage);
$tabel = 'dokter';
$tabel = 'dokter_to_poli';
$where = 'id_poli='.$post->id;
$res = $test->deleteGlobal($tabel, $where);
$tabel = 'ruang';
......@@ -673,6 +673,7 @@ class ApiController extends \Application\Master\GlobalActionController {
$request = $this->getRequest();
$post = $request->getPost();
$table_dokter_to_poli= 'dokter_to_poli';
$table_dokter= 'dokter';
if ($request->isPost()) {
......@@ -689,18 +690,28 @@ class ApiController extends \Application\Master\GlobalActionController {
//print_r($poli);die;
$dataArraydokter = array (
$DokterPoli = array (
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
'id_poli' =>$poli,
'id_condition' => 1,
'create_date' => gmdate("Y-m-d H:i:s", time()+60*60*7),
);
$Dokter = array (
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
'id_poli' =>$poli,
'id_condition' => 1
);
// print_r($dataArraydokter);die;
$param->saveGlobal($dataArraydokter, $table_dokter);
$param->saveGlobal($DokterPoli, $table_dokter_to_poli);
$param->saveGlobal($Dokter, $table_dokter);
$result->code = 0;
......@@ -737,21 +748,36 @@ class ApiController extends \Application\Master\GlobalActionController {
$poli = $post->ipoli;
$condition = $post->icondition;
$dataArraydokter = array (
$DokterPoli = array (
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
'id_poli' =>$poli,
'id_condition' =>$condition,
);
$Dokter = array (
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
);
$load = $param->loadkeloladokter($post->id);
// print_r($dataArraydokter);die;
$table_dokter= 'dokter';
$table_dokter_to_poli= 'dokter_to_poli';
$where = 'id_dokter='.$id_dokter;
// print_r ($where);die;
$param->updateGlobal($table_dokter, $dataArraydokter, $where);
$param->updateGlobal($table_dokter_to_poli, $DokterPoli, $where);
// print_r($dataArraydokter);die;
$table_dokter= 'dokter';
$where = 'id_dokter='.$id_dokter;
// print_r ($where);die;
$param->updateGlobal($table_dokter, $Dokter, $where);
$result->code = 0;
$result->info = 'ok';
......@@ -778,10 +804,14 @@ class ApiController extends \Application\Master\GlobalActionController {
$test = new \Application\Model\Param($storage);
$tabel = 'dokter';
$tabel_dokter_to_poli = 'dokter_to_poli';
$where = 'id_dokter='.$post->id;
$res = $test->deleteGlobal($tabel, $where);
$tabel_dokter = 'dokter';
$res_tabel_dokter_to_poli = $test->deleteGlobal($tabel_dokter_to_poli, $where);
$res_tabel_dokter = $test->deleteGlobal($tabel_dokter, $where);
if($load->code == 0){
$result->code = $result::CODE_SUCCESS;
......
......@@ -322,12 +322,12 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT antrian_pasien.nama, antrian_pasien.no_antrian, dokter.nama_dokter, poli.nama_poli , dokter.kode_dokter
$sql = " SELECT antrian_pasien.nama, antrian_pasien.no_antrian, dokter_to_poli.nama_dokter, poli.nama_poli , dokter_to_poli.kode_dokter
FROM antrian_pasien
-- INNER JOIN pasien
-- ON pasien.id_pasien = pasien.id_pasien
INNER JOIN dokter
ON antrian_pasien.id_dokter = dokter.id_dokter
INNER JOIN dokter_to_poli
ON antrian_pasien.id_dokter = dokter_to_poli.id_dokter
INNER JOIN poli
ON antrian_pasien.id_poli = poli.id_poli";
......@@ -440,7 +440,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT * FROM dokter";
$sql = " SELECT * FROM dokter_to_poli";
if ($id){
$sql .= " WHERE id_poli=$id AND id_condition='1'";
......@@ -559,12 +559,12 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT register_dokter.id_register, dokter.nama_dokter, poli.nama_poli, ruang.nama_ruang,register_dokter.antrian_all,register_dokter.antrian_awal,register_dokter.antrian_akhir,register_dokter.waktu_antrian, register_dokter.create_date,register_dokter.jam_mulai
$sql = " SELECT register_dokter.id_register, dokter_to_poli.nama_dokter, poli.nama_poli, ruang.nama_ruang,register_dokter.antrian_all,register_dokter.antrian_awal,register_dokter.antrian_akhir,register_dokter.waktu_antrian, register_dokter.create_date,register_dokter.jam_mulai
FROM register_dokter
INNER JOIN poli
ON register_dokter.id_poli = poli.id_poli
INNER JOIN dokter
ON register_dokter.id_dokter = dokter.id_dokter
INNER JOIN dokter_to_poli
ON register_dokter.id_dokter = dokter_to_poli.id_dokter
INNER JOIN ruang
ON register_dokter.id_ruang = ruang.id_ruang
";
......@@ -652,16 +652,16 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT dokter.id_dokter, dokter.nama_dokter, dokter.kode_dokter , poli.id_poli, poli.nama_poli, condition.condition,condition.id_condition
FROM dokter
$sql = " SELECT dokter_to_poli.id_dokter, dokter_to_poli.nama_dokter, dokter_to_poli.kode_dokter , poli.id_poli, poli.nama_poli, condition.condition,condition.id_condition
FROM dokter_to_poli
INNER JOIN poli
ON dokter.id_poli = poli.id_poli
ON dokter_to_poli.id_poli = poli.id_poli
INNER JOIN condition
ON condition.id_condition = dokter.id_condition
ON condition.id_condition = dokter_to_poli.id_condition
";
if($id){
$sql .= " Where dokter.id_dokter = $id";
$sql .= " Where dokter_to_poli.id_dokter = $id";
}
$sql .= " ORDER BY nama_poli ASC";
......@@ -751,12 +751,12 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = "SELECT antrian_pasien.no_antrian,antrian_pasien.id_pasien, antrian_pasien.nama, dokter.kode_dokter , dokter.nama_dokter, dokter.id_dokter,poli.kode_poli, poli.nama_poli ,counter_status.status_code, counter_status.status_name
$sql = "SELECT antrian_pasien.no_antrian,antrian_pasien.id_pasien, antrian_pasien.nama, dokter_to_poli.kode_dokter , dokter_to_poli.nama_dokter, dokter_to_poli.id_dokter,poli.kode_poli, poli.nama_poli ,counter_status.status_code, counter_status.status_name
FROM antrian_pasien
INNER JOIN poli
ON poli.id_poli = antrian_pasien.id_poli
INNER JOIN dokter
ON dokter.id_dokter = antrian_pasien.id_dokter
INNER JOIN dokter_to_poli
ON dokter_to_poli.id_dokter = antrian_pasien.id_dokter
INNER JOIN counter_status
ON counter_status.status_code = antrian_pasien.status_code
WHERE antrian_pasien.id_pasien IS NOT NULL AND antrian_pasien.status_code=60
......@@ -802,12 +802,12 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = "SELECT antrian_pasien.no_antrian,antrian_pasien.id_pasien, antrian_pasien.nama, dokter.kode_dokter , dokter.nama_dokter, dokter.id_dokter,poli.kode_poli, poli.nama_poli , counter_status.status_name
$sql = "SELECT antrian_pasien.no_antrian,antrian_pasien.id_pasien, antrian_pasien.nama, dokter_to_poli.kode_dokter , dokter_to_poli.nama_dokter, dokter_to_poli.id_dokter,poli.kode_poli, poli.nama_poli , counter_status.status_name
FROM antrian_pasien
INNER JOIN poli
ON poli.id_poli = antrian_pasien.id_poli
INNER JOIN dokter
ON dokter.id_dokter = antrian_pasien.id_dokter
INNER JOIN dokter_to_poli
ON dokter_to_poli.id_dokter = antrian_pasien.id_dokter
INNER JOIN counter_status
ON counter_status.status_code = antrian_pasien.status_code
WHERE antrian_pasien.id_dokter=$iddok and antrian_pasien.id_pasien=$idpasien "
......@@ -896,7 +896,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT * FROM dokter ";
$sql = " SELECT * FROM dokter_to_poli ";
if ($id){
$sql .= " where id_poli=$id and id_condition='2' ";
......@@ -936,8 +936,8 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = "SELECT dokter.id_dokter,dokter.image, dokter.nama_dokter , poli.nama_poli
FROM dokter
$sql = "SELECT dokter_to_poli.id_dokter,dokter_to_poli.image, dokter_to_poli.nama_dokter , poli.nama_poli
FROM dokter_to_poli
INNER JOIN poli
ON dokter.id_poli = poli.id_poli
ORDER BY nama_poli ASC ";
......@@ -1025,18 +1025,18 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = "SELECT antrian_pasien.no_antrian, antrian_pasien.nama, dokter.kode_dokter , dokter.nama_dokter, dokter.id_dokter,poli.kode_poli, poli.nama_poli , counter_status.status_name
$sql = "SELECT antrian_pasien.no_antrian, antrian_pasien.nama, dokter_to_poli.kode_dokter , dokter_to_poli.nama_dokter, dokter_to_poli.id_dokter,poli.kode_poli, poli.nama_poli , counter_status.status_name
FROM antrian_pasien
INNER JOIN poli
ON poli.id_poli = antrian_pasien.id_poli
INNER JOIN dokter
ON dokter.id_dokter = antrian_pasien.id_dokter
INNER JOIN dokter_to_poli
ON dokter_to_poli.id_dokter = antrian_pasien.id_dokter
INNER JOIN counter_status
ON counter_status.status_code = antrian_pasien.status_code
" ;
if ($id){
$sql .= "WHERE antrian_pasien.id_pasien IS NOT NULL AND dokter.id_dokter = $id AND antrian_pasien.status_code=10 ORDER BY no_antrian ASC ";
$sql .= "WHERE antrian_pasien.id_pasien IS NOT NULL AND dokter_to_poli.id_dokter = $id AND antrian_pasien.status_code=10 ORDER BY no_antrian ASC ";
}
......@@ -1079,7 +1079,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
try {
$sql = " SELECT DISTINCT on (idd.id_dokter) idd.id_dokter,idd.no_antrian,dok.nama_dokter,pol.nama_poli,dok.kode_dokter,rur.nama_ruang FROM antrian_pasien idd
LEFT JOIN dokter dok on idd.id_dokter = dok.id_dokter
LEFT JOIN dokter_to_poli dok on idd.id_dokter = dok.id_dokter
LEFT JOIN poli pol on idd.id_poli = pol.id_poli
LEFT JOIN ruang rur on idd.id_ruang = rur.id_ruang
......@@ -1122,15 +1122,15 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = "SELECT antrian_pasien.no_antrian, antrian_pasien.id_dokter, dokter.kode_dokter, counter_status.status_name,counter_status.status_code
$sql = "SELECT antrian_pasien.no_antrian, antrian_pasien.id_dokter, dokter_to_poli.kode_dokter, counter_status.status_name,counter_status.status_code
FROM antrian_pasien
INNER JOIN counter_status
ON counter_status.status_code = antrian_pasien.status_code
INNER JOIN dokter
ON dokter.id_dokter = antrian_pasien.id_dokter
INNER JOIN dokter_to_poli
ON dokter_to_poli.id_dokter = antrian_pasien.id_dokter
" ;
if ($id){
$sql .= "WHERE antrian_pasien.id_pasien IS NOT NULL AND dokter.id_dokter = $id AND antrian_pasien.status_code=10 or dokter.id_dokter = $id and antrian_pasien.status_code=30 or dokter.id_dokter = $id and antrian_pasien.status_code=40 ORDER BY no_antrian ASC";
$sql .= "WHERE antrian_pasien.id_pasien IS NOT NULL AND dokter_to_poli.id_dokter = $id AND antrian_pasien.status_code=10 or dokter_to_poli.id_dokter = $id and antrian_pasien.status_code=30 or dokter_to_poli.id_dokter = $id and antrian_pasien.status_code=40 ORDER BY no_antrian ASC";
}
$stmt = $this->_db->query($sql);
......@@ -1170,16 +1170,16 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
public function loadUserCounter($status = null, $iddok = null, $no_antrian = null, $id_poli = null){
$result = new Result();
try {
$sql = " SELECT antrian_pasien.no_antrian, dokter.nama_dokter , poli.nama_poli , counter_status.status_name
$sql = " SELECT antrian_pasien.no_antrian, dokter_to_poli.nama_dokter , poli.nama_poli , counter_status.status_name
FROM antrian_pasien
INNER JOIN poli
ON poli.id_poli = antrian_pasien.id_poli
INNER JOIN dokter
ON dokter.id_dokter = antrian_pasien.id_dokter
INNER JOIN dokter_to_poli
ON dokter_to_poli.id_dokter = antrian_pasien.id_dokter
INNER JOIN counter_status
ON counter_status.status_code = antrian_pasien.status_code ";
$sql .= " WHERE antrian_pasien.id_pasien IS NOT NULL AND dokter.id_dokter = $iddok ORDER BY no_antrian ASC LIMIT 1 " ;
$sql .= " WHERE antrian_pasien.id_pasien IS NOT NULL AND dokter_to_poli.id_dokter = $iddok ORDER BY no_antrian ASC LIMIT 1 " ;
//print_r($mode);die;
......
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">Dashboard</h1>
<a href="#" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Generate Report</a>
</div>
<!-- Content Row -->
<div class="row">
<!-- Earnings (Monthly) Card Example -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-primary shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Earnings (Monthly)</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">$40,000</div>
</div>
<div class="col-auto">
<i class="fas fa-calendar fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
<!-- Earnings (Monthly) Card Example -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-success shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-success text-uppercase mb-1">Earnings (Annual)</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">$215,000</div>
</div>
<div class="col-auto">
<i class="fas fa-dollar-sign fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
<!-- Pending Requests Card Example -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-warning shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-warning text-uppercase mb-1">Pending Requests</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">18</div>
</div>
<div class="col-auto">
<i class="fas fa-comments fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Content Row -->
<div class="row">
<!-- Area Chart -->
<div class="col-xl-8 col-lg-7">
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Earnings Overview</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Dropdown Header:</div>
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="chart-area">
<canvas id="myAreaChart"></canvas>
</div>
</div>
</div>
</div>
<!-- Pie Chart -->
<div class="col-xl-4 col-lg-5">
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Revenue Sources</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Dropdown Header:</div>
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="chart-pie pt-4 pb-2">
<canvas id="myPieChart"></canvas>
</div>
<div class="mt-4 text-center small">
<span class="mr-2">
<i class="fas fa-circle text-primary"></i> Direct
</span>
<span class="mr-2">
<i class="fas fa-circle text-success"></i> Social
</span>
<span class="mr-2">
<i class="fas fa-circle text-info"></i> Referral
</span>
</div>
</div>
</div>
</div>
<p class="mb-0">Before working with this theme, you should become familiar with the Bootstrap framework, especially the utility classes.</p>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
......@@ -189,7 +189,7 @@ function tampilangka() {
$('#btnNext').prop('disabled', true);
$('#btnCall').prop('disabled', true);
$('#btnServed').prop('disabled', true);
$('#btnMissed').prop('disabled', false);
$('#btnMissed').prop('disabled', true);
$('#btnDone').prop('disabled', false);
} else if (res['status_code'] == 10) {
$('#no_antrian').empty();
......
......@@ -168,12 +168,6 @@ function editdatapoli(id_poli) {
location.reload();
});
//
//window.onload
//location.reload()
} else {
swal({
title: "",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment