ON dokter_to_poli.id_dokter = antrian_pasien.id_dokter
INNER JOIN counter_status
INNER JOIN counter_status
ON counter_status.status_code = antrian_pasien.status_code
ON counter_status.status_code = antrian_pasien.status_code
";
";
if($id){
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 {
...
@@ -1079,7 +1079,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
try{
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
$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 poli pol on idd.id_poli = pol.id_poli
LEFT JOIN ruang rur on idd.id_ruang = rur.id_ruang
LEFT JOIN ruang rur on idd.id_ruang = rur.id_ruang
...
@@ -1122,15 +1122,15 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
...
@@ -1122,15 +1122,15 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
ON counter_status.status_code = antrian_pasien.status_code
ON counter_status.status_code = antrian_pasien.status_code
INNER JOIN dokter
INNER JOIN dokter_to_poli
ON dokter.id_dokter = antrian_pasien.id_dokter
ON dokter_to_poli.id_dokter = antrian_pasien.id_dokter
";
";
if($id){
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);
$stmt=$this->_db->query($sql);
...
@@ -1170,16 +1170,16 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
...
@@ -1170,16 +1170,16 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {