Commit 9f79eea5 authored by Indra Raja's avatar Indra Raja

asdfa

parent dd34a5e0
......@@ -50,8 +50,71 @@ class AdminController extends \Application\Master\GlobalActionController
/* get url */
$uri = $this->getRequest()->getUri();
$baseurl = sprintf('//%s', $uri->getHost());
$getpath = explode("/",$uri->getPath());
// echo "<pre>";
$id = $getpath[3];
// echo "<pre>";
// print_r($uri);die;
// $storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
// $param = new \Application\Model\Param($storage);
// $curl = curl_init();
// curl_setopt_array($curl, array(
// CURLOPT_URL => "http://queue.indra/api/nextantrian",
// CURLOPT_RETURNTRANSFER => true,
// CURLOPT_ENCODING => "",
// CURLOPT_MAXREDIRS => 10,
// CURLOPT_TIMEOUT => 0,
// CURLOPT_FOLLOWLOCATION => true,
// CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
// CURLOPT_CUSTOMREQUEST => "POST",
// CURLOPT_POSTFIELDS => array('inoantrian' => '1','idok' => '74','istatus' => '30'),
// ));
// $response = curl_exec($curl);
// curl_close($curl);
// echo $response;
// function curl($url, $data){
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL, $url);
// curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
// curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output = curl_exec($ch);
// curl_close($ch);
// return $output;
// }
// // Data Parameter yang Dikirim oleh cURL
// $data = array("inoantrian"=>"1","idok"=>"74","istatus"=>"40");
// print_r($data);
// $send = curl("http://queue.indra/api/nextantrian/",json_encode($data));
// echo json_encode(array('respon'=>$send),JSON_UNESCAPED_SLASHES);
$arr = json_decode(file_get_contents("php://input"));
if (empty($arr->inoantrian) OR empty($arr->idok) OR empty($arr->istatus)){
echo "Submit gagal!";
} else {
echo "Submit berhasil!".$arr->inoantrian."</b><b>".$arr->idok."</b>.<b>".$arr->istatus."</b>.";
}
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendScript(' var id = "' . $id . '"');
$this->headScript->appendFile('/action-js/antrian-js/action-admin.js');
$this->layout("layout/layoutAdmin");
......
......@@ -129,6 +129,32 @@ class ApiController extends \Application\Master\GlobalActionController {
return $this->getOutput($result->toJson());
}
public function loadsisaantrianAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
//$name = $this->isFieldMandatory(@$data['name'], 'name');
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
// print_r($load);die;
$load = $test->loadsisaantrian($post->id,$post->no);
if($load->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $load->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function cekpasienAction(){
$result = new Result();
$request = $this->getRequest();
......@@ -185,6 +211,7 @@ class ApiController extends \Application\Master\GlobalActionController {
$ktp = $post->iktp;
$no_antrian = $post->ino_antrian;
$no_rekam_medis = $post->ino_rekam_medis;
$sisa_antrian = $post->isisa_antrian;
// $counter= $param->getMaxCounter();
......@@ -200,6 +227,7 @@ class ApiController extends \Application\Master\GlobalActionController {
'no_hp' => $no_hp,
'ktp' => $ktp,
'status_code' => 10,
'sisa_antrian' => $sisa_antrian,
);
$table_antrianpasien = 'antrian_pasien';
......@@ -1499,13 +1527,13 @@ class ApiController extends \Application\Master\GlobalActionController {
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$antrian = new \Application\Model\Param($storage);
$test = new \Application\Model\Param($storage);
$load = $antrian->loadAntrian();
// $id = $this->_getParam($test->loadAntrian($post->id_poli));
$load = $test->loadAntrian($post->id_poli);
if($load->code == 0){
$result->code = $result::CODE_SUCCESS;
......@@ -1555,7 +1583,7 @@ class ApiController extends \Application\Master\GlobalActionController {
$poli = new \Application\Model\Param($storage);
$load = $poli->loadPoli();
$load = $poli->loadPoli($post->$id_poli);
......@@ -1640,7 +1668,7 @@ class ApiController extends \Application\Master\GlobalActionController {
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$idokter = $post->id;
$idokter = $post->iid;
$loadAntrianAdmin = $test->loadAntrianAdmin($idokter);
// print_r( $idokter);die;
......@@ -1691,34 +1719,48 @@ class ApiController extends \Application\Master\GlobalActionController {
$post = $request->getPost();
if ($request->isPost()) {
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
try{
$noantrian = $post->inoantrian;
$iddok = $post->idok;
$status = $post->istatus;
$dataarray = array(
'status_code' => $status,
);
$loadAntrianAdmin = $test->loadAntrianAdmin($iddok);
$table = 'antrian_pasien';
$where = 'id_dokter='.$iddok.' and no_antrian='.$noantrian;
$test->updateGlobal($table, $dataarray, $where);
if($loaddokter->code == 0){
if($load->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadAntrianAdmin->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
}catch (\Exception $exc) {
$result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString());
}
}
return $this->getOutput($result->toJson());
}
public function updateantrianmissAction(){
......
......@@ -204,6 +204,7 @@ class QueueController extends \Application\Master\GlobalActionController
$view->setVariable('no_antrian', $result['no_antrian']);
$view->setVariable('no_antrian', $result['no_antrian']);
$view->setVariable('kode_dokter', $result['kode_dokter']);
$view->setVariable('sisa_antrian', $result['sisa_antrian']);
// print_r($result);die;
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
......@@ -213,6 +214,7 @@ class QueueController extends \Application\Master\GlobalActionController
$this->headScript->appendScript(' var kode_poli_cetak = "' . $result['nama_poli'] . '"');
$this->headScript->appendScript(' var no_antrian_cetak = "' . $result['no_antrian'] . '"');
$this->headScript->appendScript(' var kode_dokter_cetak = "' . $result['kode_dokter'] . '"');
$this->headScript->appendScript(' var sisa_antrian = "' . $result['sisa_antrian'] . '"');
$this->headScript->appendFile('/action-js/antrian-js/action-cetak.js');
$this->layout("layout/layoutQueue");
......
......@@ -42,33 +42,47 @@ class UmumController extends \Application\Master\GlobalActionController
$view = new ViewModel();
$result = new Result();
$today = gmdate("d M Y ", time()+60*60*7);
$view->setVariable('today', $today);
/* get url */
$uri = $this->getRequest()->getUri();
$baseurl = sprintf('//%s', $uri->getHost());
$getpath = explode("/",$uri->getPath());
// echo "<pre>";
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendFile('/action-js/antrian-js/action-umum.js');
$decodeid = base64_decode($getpath[3]);
$this->layout("layout/layoutUmum");
return $view;
}
public function tampilanantrianAction()
{
$view = new ViewModel();
$result = new Result();
// $curl = curl_init();
// curl_setopt_array($curl, array(
// CURLOPT_URL => "http://queue.indra/api/loadantrian?id_poli=$decodeid",
// CURLOPT_RETURNTRANSFER => true,
// CURLOPT_ENCODING => "",
// CURLOPT_MAXREDIRS => 10,
// CURLOPT_TIMEOUT => 0,
// CURLOPT_FOLLOWLOCATION => true,
// CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
// CURLOPT_CUSTOMREQUEST => "POST",
// CURLOPT_POSTFIELDS => array('id_poli' => $decodeid),
// ));
// $response = curl_exec($curl);
// curl_close($curl);
// // echo $response;
$uri = $this->getRequest()->getUri();
$baseurl = sprintf('//%s', $uri->getHost());
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendFile('/action-js/antrian-js/action-umum.js');
$this->headScript->appendScript(' var id_poli = "' . $decodeid . '"');
$this->headScript->appendFile('/action-js/antrian-js/action-umumtampilan.js');
$this->layout("layout/layoutUmum");
return $view;
}
}
......@@ -69,6 +69,10 @@ class Param extends Mapper {
$data = $this->_storage->loaddatapasien($id);
return $data;
}
public function loadsisaantrian($id,$no){
$data = $this->_storage->loadsisaantrian($id,$no);
return $data;
}
public function cekpasien($no_rekam_medis = null,$ktp = null ){
$data = $this->_storage->cekpasien($no_rekam_medis, $ktp);
return $data;
......@@ -126,12 +130,12 @@ class Param extends Mapper {
$data = $this->_storage->loadantrianmiss($id);
return $data;
}
public function loadantrianunregis($id){
$data = $this->_storage->loadantrianunregis($id);
public function loadPoli($id_poli = null){
$data = $this->_storage->loadPoli($id_poli);
return $data;
}
public function loadPoli($id = null){
$data = $this->_storage->loadPoli($id);
public function loadantrianunregis($id){
$data = $this->_storage->loadantrianunregis($id);
return $data;
}
public function loadPilihAntrian($iddok = null){
......@@ -155,8 +159,8 @@ class Param extends Mapper {
return $data;
}
public function loadAntrian($id = null){
$data = $this->_storage->loadAntrian($id);
public function loadAntrian($id_poli){
$data = $this->_storage->loadAntrian($id_poli);
return $data;
}
public function loadjumlahpasien(){
......
......@@ -322,7 +322,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT antrian_pasien.nama, antrian_pasien.no_antrian,antrian_pasien.no_rekam_medis, dokter_to_poli.nama_dokter, poli.nama_poli , dokter_to_poli.kode_dokter,antrian_pasien.id_pasien, dokter_to_poli.id_dokter
$sql = " SELECT antrian_pasien.nama, antrian_pasien.no_antrian,antrian_pasien.no_rekam_medis, dokter_to_poli.nama_dokter, poli.nama_poli , dokter_to_poli.kode_dokter,antrian_pasien.id_pasien, dokter_to_poli.id_dokter,antrian_pasien.sisa_antrian
FROM antrian_pasien
INNER JOIN dokter_to_poli
ON antrian_pasien.id_dokter = dokter_to_poli.id_dokter
......@@ -444,6 +444,50 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
public function loadsisaantrian($id,$no){
$result = new Result();
try {
$sql = " SELECT COUNT(id_pasien)
FROM antrian_pasien
WHERE id_pasien is not null AND
id_dokter =$id AND (status_code <> 50 and status_code <> 60) and no_antrian < $no";
// print_r($sql);die;
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
// print_r($val);die;
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
$sql = " SELECT * FROM pasien WHERE id_pasien = $id ";
......@@ -1342,9 +1386,16 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$sql = " SELECT poli.id_poli, poli.nama_poli
FROM antrian_pasien
INNER JOIN poli
ON antrian_pasien.id_poli = poli.id_poli
GROUP BY poli.id_poli
ORDER BY nama_poli asc";
ON antrian_pasien.id_poli = poli.id_poli ";
if($id){
$sql .=" WHERE poli.id_poli=$id";
}
$sql .= " GROUP BY poli.id_poli";
......@@ -1660,17 +1711,29 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
return $result;
}
public function loadAntrian($id = null){
public function loadAntrian($id_poli){
$result = new Result();
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 ,idd.status_code,idd.id_poli
FROM antrian_pasien idd
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
LEFT JOIN counter_status cs
on cs.status_code = idd.status_code
$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_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
WHERE idd.id_pasien is not null
and
(cs.status_code=30 or cs.status_code =40) and
idd.id_poli=$id_poli
WHERE idd.id_pasien is not null and status_code=20 or status_code=30 or status_code =40";
";
$stmt = $this->_db->query($sql);
......
<!-- <script type="text/javascript">
// 1 detik = 1000
window.setTimeout("waktu()",1000);
function waktu() {
var tanggal = new Date();
setTimeout("waktu()",1000);
document.getElementById("tanggalku").innerHTML
= tanggal.getHours()+":"+tanggal.getMinutes()+":"+tanggal.getSeconds();
}
</script> -->
<!-- Page header -->
<div class="row">
<div class="page-header" style="border-bottom: 0px solid #ddd0;">
<!-- Header content -->
<div class="page-header-content">
<div class="page-title">
<h4 style="font-size:25px;"><span class="text-semibold">Rumah Sakit - Mohon Antri Dengan Tertib</span></h4>
<h4 style="color: #fff;font-size:25px;"><span class="text-semibold">Rumah Sakit - Mohon Antri Dengan Tertib</span></h4>
</div>
<div class="heading-elements">
<div class="heading-btn-group">
<div style="color: #fff9ff;font-size: 50px;font-weight: 600;margin-top:-20px;">
<span id="tanggalku"></span>
</div>
<div style="color: #fff9ff;font-size: 17px;font-weight: 600;margin-top:-20px;">
<div style="color: #fff;font-size: 17px;font-weight: 600;margin-top:-20px;">
<?php echo $this->today; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="justify-content-center">
<div class="col-sm-200" >
<div class="card mb-3 alert alert-info alert-styled-left alert-arrow-left alert-component col-sm-100" style="border-color: #e94c72;background: #faebd73b;width: 1300px;margin-left: 100px;">
<div class="text-center content-group">
<div><input type="hidden" value="nomer antrian" id="text-to-speech" placeholder="Enter text to speak..."/></div>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: #fff"><span > Nomer</span></p>
<h1 class="error-title" style=" font-weight: bold;font-size:100px;font-family: Times New Roman, Times, serif;color: #fff"><span id="no_antrian"></span></h1>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: #fff"><span > Please Proceed To</span></p>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: #fff"><span id="ruang"></span></p>
<!-- <div><input type="hidden" value="no_antrian" id="no_antrian" /></div>
<div><input type="hidden" value="nama_ruang" id="nama_ruang" /><span style="visibility:hidden" id="nama_ruang"></span></div> -->
</div>
</div>
<div id="listdata" class="card-deck" style="padding-left: 100px;padding-right: 100px;width: 2000px;">
</div>
<div class="card">
<h5 class="card-header">Featured</h5>
<div class="card-body">
<h5 class="card-title">Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
<!-- <div id="box" class="wrap">
<!--
<div class="col-md-7 mt-25">
<div class="card mb-3">
<div class="text-center content-group">
<div><input type="hidden" value="nomer antrian" id="text-to-speech" placeholder="Enter text to speak..."/></div>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: grey"><span > Number</span></p>
<h1 class="error-title" style=" font-weight: bold;font-size:215px;font-family: Times New Roman, Times, serif;color: red"><span id="no_antrian"></span></h1>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: grey"><span > Please Proceed To</span></p>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: red"><span > Ruang 1.1</span></p>
<div><input type="hidden" value="no_antrian" id="no_antrian" /></div>
<div><input type="hidden" value="nama_ruang" id="nama_ruang" /><span style="visibility:hidden" id="nama_ruang"></span></div> -->
<!-- </div>
</div>
</div> -->
<!-- /navigation -->
\ No newline at end of file
......@@ -90,6 +90,18 @@
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2">
<h3>Sisa Antrian</h3>
</div>
<div class="col-sm-1">
<h3>:</h3>
</div>
<div class="col-sm-6">
<h3><?php echo $this->sisa_antrian ?></label></h3>
</div>
</div>
<br>
</div>
</div>
......
......@@ -179,6 +179,9 @@ input[type="done"] + label {
<div class="form-group ">
<input type="hidden" id="tempat_lahir" class="form-control "disabled ></input>
</div>
<div class="form-group ">
<input type="hidden" id="sisa_antrian" class="form-control "disabled ></input>
</div>
<div class="form-group">
<input type="hidden" id="tanggal_lahir" class="form-control"disabled /></input>
......
......@@ -30,8 +30,7 @@
width: 100wh;
height: 90vh;
color: #fff;
background-color: #4d5dfb;
background: linear-gradient(to right, #f05053 80%, #e1eec3);
background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
background-size: 400% 400%;
-webkit-animation: Gradient 15s ease infinite;
-moz-animation: Gradient 15s ease infinite;
......
......@@ -35,7 +35,7 @@ function textToAudioRuang() {
var res = ruang.replace(".", " ");
document.getElementById("nama_ruang").innerHTML = res;
let voice = "silahkan masuk ke " + res;
let voice = "silahkan masuk ke ruang " + res;
console.log(voice)
let speech = new SpeechSynthesisUtterance();
......@@ -92,7 +92,18 @@ $('#poli').on('change', function () {
});
});
$( '#dokter' ).on( "change", function() {
$id_dokter =$('#dokter').val();
window.location.href = ("/admin/antrianadmin/" +$id_dokter);
});
if(window.location.pathname == "/admin/antrianadmin/" +id){
$( window ).on( "load", function() {
tampilangka(id)
loadantrian(id)
});
}
function loadpoli() {
$.ajax({
type: 'POST',
......@@ -131,14 +142,15 @@ function loadpoli() {
});
}
function loadantrian() {
var iddokter = $('#dokter').val();
function loadantrian(id) {
$iddok= $('#dokter').val();
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadAntrianAdmin',
data: {
id: iddokter
iid: id,
},
......@@ -185,23 +197,17 @@ function loadantrian() {
}
$('#dokter').on('change', function () {
loadantrian();
tampilangka();
});
$('#no_antrian').html('-');
function tampilangka() {
var iddokter = $('#dokter').val();
function tampilangka(id) {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadNoAntrian',
data: {
id_dokter: iddokter,
id_dokter: id,
},
async: false,
......@@ -274,39 +280,40 @@ function tampilangka() {
$('#btnNext').on('click', function () {
actionqueue(noantrian + 1, 20);
actionqueue(noantrian + 1, 20,id);
loadantrian()
});
$('#btnCall').on('click', function () {
actionqueue(noantrian, 30);
actionqueue(noantrian, 30,id);
});
$('#btnDone').on('click', function () {
actionqueue(noantrian, 50);
actionqueue(noantrian, 50,id);
});
$('#btnMissed').on('click', function () {
actionqueue(noantrian, 60);
actionqueue(noantrian, 60,id);
});
$('#btnServed').on('click', function () {
actionqueue(noantrian, 40);
actionqueue(noantrian, 40,id);
});
function actionqueue(antrianno, status) {
function actionqueue(antrianno, status, iddok) {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/nextantrian',
data: {
inoantrian: antrianno,
istatus: status,
idok: iddok,
istatus: status
},
success: function (result) {
......@@ -319,7 +326,7 @@ function actionqueue(antrianno, status) {
html: true,
type: "warning"
});
$('#no_antrian').html('-');
return false;
}
......@@ -348,16 +355,14 @@ function actionqueue(antrianno, status) {
var flush = new Audio('../../data/tone/a1.mp3');
setTimeout(function () {
flush.play();
})
setTimeout(function() {
flush.play(); }, )
flush.onended = function () {
flush.onended = function() {
textToAudio()
setTimeout(function () {
textToAudioRuang()
}, 3000)
setTimeout(function() {
textToAudioRuang() }, 3000)
};
swal({
......
......@@ -2,17 +2,18 @@
$('#cetak').on('click', function (e) {
//alert("kepanggil");
e.preventDefault();
var w = window.open('', '', 'width=300,height=400');
w.document.write('<html><body><table border="" >' +
'<tr><th><h1>SELAMAT DATANG</h1><h2> Di Rumah Sakit</h2></th></tr></thead>' +
'<tbody><tr>' +
'<th><h3>No Rekam Medis : ' + no_rekam_medis_cetak + '</h3>' +
'<h2>ANTRIAN</h2>' +
'<th><h2>ANTRIAN</h2>' +
'<h1>' + kode_dokter_cetak + + no_antrian_cetak + '</h1>' +
'<h4>Nama Pasien : ' + nama_pasien_cetak + '</h4>' +
'<h4>Poli : ' + kode_poli_cetak + '</h4>' +
'<h5>Nama Dokter : ' + nama_dokter_cetak + '</h5>' +
'<div class="h6a" style="text-align:right;font-size: 11px;";>No rekam medis tidak boleh hilang</div>' +
'<h3>Nama Pasien : ' + nama_pasien_cetak + '</h3>' +
'<h3>Poli : ' + kode_poli_cetak + '</h3>' +
'<h3>Nama Dokter : ' + nama_dokter_cetak + '</h3>' +
'<h3>Jumlah yang sedang dalam antrian : ' + sisa_antrian + '</h3>' +
'<h4>waktu : ' + new Date().toLocaleString("en-US", {timeZone: "Asia/Jakarta"}) + '</h4>' +
'</th></tr></tbody></table></body></html>');
w.window.print();
w.document.close();
......
......@@ -40,12 +40,51 @@ function loaddatapasien(param) {
}
function loadsisaantrian() {
let dokter = $('#dokter option:selected').attr("value");
let no_antrian = $("input[name=antrian]:checked").val();
var sisa_antrian;
console.log(dokter);
console.log(no_antrian);
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadsisaantrian',
async: false,
data: {
id: dokter,
no: no_antrian,
},
success: function (result) {
// console.log(result);
// $('.loaddata').empty();
// console.log(result);
if (result.code == 0) {
let data = result.data;
console.log(data[0].count);
sisa_antrian = data[0].count;
// $('#sisa_antrian').val(data[0].count);
} else {
alert(result.info);
}
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
}
});
return sisa_antrian;
}
$('#tambah').on('click', function () {
savedataaja();
loadsisaantrian()
savedataaja()
})
......@@ -59,6 +98,7 @@ function savedataaja() {
let no_rekam_medis = $('#no_rekam_medis').val();
let poli = $("#poli option:selected").attr("value");
let dokter = $('#dokter option:selected').attr("value");
let sisa_antrian = loadsisaantrian()
let ktp = $('#ktp').val();
let no_antrian = $("input[name=antrian]:checked").val();
......@@ -81,6 +121,7 @@ function savedataaja() {
ipoli: poli,
idokter: dokter,
ino_antrian: no_antrian,
isisa_antrian :sisa_antrian,
},
success: function (response) {
......@@ -214,7 +255,7 @@ function pilihAntrian() {
// console.log($antrian);
// console.log(response);
if ($antrian) {
var hour = 0;;
var hour = 0;
var splithour = [];
splithour[0] = $antrian[0]['jam_mulai'].split(':');
......@@ -225,10 +266,10 @@ function pilihAntrian() {
minute = parseInt(splithour[0][1]);
$('.antrian').empty();
for (var i = 0; i < $antrian.length; i++) {
if ($antrian[i]['id_pasien'] === null) {
if ($antrian[i]['id_pasien'] === null) {//jika masih kosong
let y = '';
......@@ -241,6 +282,9 @@ function pilihAntrian() {
hour += Math.floor(minute / 60);
minute = minute % 60;
}
if(hour >=24){
hour=0;
}
if (minute.toString().length === 1) {
y += `<div class="col-lg-1">
......@@ -265,7 +309,7 @@ function pilihAntrian() {
minute += parseInt(splittime[i][1]);
} else if ($antrian[i]['status_code'] == 10 || $antrian[i]['status_code'] == 20 || $antrian[i]['status_code'] == 30 || $antrian[i]['status_code'] == 40) {
} else if ($antrian[i]['status_code'] == 10 || $antrian[i]['status_code'] == 20 || $antrian[i]['status_code'] == 30 || $antrian[i]['status_code'] == 40) {//jika antrian sudah terisi
var splittime = [];
splittime[i] = $antrian[i]['waktu_antrian'].split(':');
let y = '';
......@@ -274,8 +318,15 @@ function pilihAntrian() {
if (minute >= 60) {
hour += Math.floor(minute / 60);
minute = minute % 60;
}
if(hour >=24){
hour=0;
}
if (minute.toString().length === 1) {
......@@ -323,6 +374,10 @@ function pilihAntrian() {
if (minute >= 60) {
hour += Math.floor(minute / 60);
minute = minute % 60;
}
if(hour >=24){
hour=0;
}
let y = '';
......@@ -349,10 +404,11 @@ function pilihAntrian() {
if (xhr.status != 200) {
//bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) ");
} else {
bootbox.alert({ message: 'Cannot load queue', centerVertical: true });
alert('Cannot load queue');
}
}
});
}
$(document).ready(function () {
......
......@@ -16,7 +16,7 @@ $(document).ready(function () {
separator: ':',
duration: true,
minimum: '06:00',
maximum: '18:00',
maximum: '24:00',
durationNegative: true
});
});
......@@ -37,7 +37,7 @@ $(document).ready(function () {
separator: ':',
duration: true,
minimum: '00:00',
maximum: '23:00',
maximum: '24:00',
durationNegative: true
});
});
......@@ -47,8 +47,8 @@ $(document).ready(function () {
required: true,
separator: ':',
duration: true,
minimum: '00:10',
maximum: '00:20',
minimum: '00:01',
maximum: '00:59',
durationNegative: true
});
});
......
loadpoli();
$('#pilih').on('click', function () {
// let poli = $("#poli option:selected").attr("value");
window.location.href = ("tampilanantrian");
loaddatadokter()
});
function loaddatadokter() {
let poli =$("#antrian_poli option:selected").attr("value");
console.log(poli);
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpoli',
data: {
id_poli: poli,
},
success: function (response) {
if (response['code'] == 0) {
console.log(response);
let $id = poli;
console.log($id)
let $encodedId = btoa($id);
window.location.href = ("/umum/umumtampilan/" + $encodedId);
} else {
bootbox.alert({ message: ' gagal', centerVertical: true });
}
}, error: function (xhr) {
if (xhr.status != 200) {
//bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) ");
} else {
alert('data tidak ada');
}
}
});
}
function loadpoli() {
$.ajax({
type: 'POST',
dataType: 'json',
......@@ -13,7 +53,7 @@ function loadpoli() {
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
......@@ -21,21 +61,13 @@ function loadpoli() {
optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>';
}
$("select#antrian_poli").html(optionseg);
let $id = result.data[0].id_poli;
// let $id = result.data['id_poli'];
// console.log($id);
} else {
bootbox.dialog({
message: "<span class='bigger-110'>" + result['info'] + "</span>",
buttons:
{
"OK":
{
"label": "<i class='icon-ok'></i> OK ",
"className": "btn-sm btn-danger",
"callback": function () {
notifyCancel('ERROR: ' + result['info'] + '. Bila ada kesulitan dimohon untuk menghubungi Admin terkait');
}
}
}
});
}
}
});
......
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