Commit 535f27c2 authored by Azy Mushofy Anwary's avatar Azy Mushofy Anwary

iNTERGRASI pertama

parent e7122f13
Pipeline #227 failed with stages
......@@ -60,56 +60,218 @@ class ApiController extends \Application\Master\GlobalActionController {
public function savedatapasienAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$table_pasien= 'pasien';
if ($request->isPost()) {
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$param = new \Application\Model\Param($storage);
if ($request->isPost()) {
$counter = $param->getMaxCounter();
try{
$idpasien = $counter->data;
$nama = $post->inama;
$tempat_lahir = $post->itempat_lahir;
$tanggal_lahir = $post->itanggal_lahir;
$alamat = $post->ialamat;
$no_hp = $post->ino_hp;
$ktp = $post->iktp;
$no_antrian = $post->ino_antrian;
$norm = $post->inorm;
$dataArrayPasien = array (
'id_pasien' => $idpasien,
'create_date' => gmdate("Y-m-d H:i:s", time()+60*60*7),
'nama' => $nama,
'tempat_lahir' => $tempat_lahir,
'tanggal_lahir' => $tanggal_lahir,
'alamat' => $alamat,
'no_hp' => $no_hp,
'ktp' => $ktp,
'no_rekam_medis' => $norm,
);
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$param = new \Application\Model\Param($storage);
// print_r($param);die;
$table_pasien= 'm_pasien';
try{
$nama = $post->inama;
$tempat_lahir = $post->itempat_lahir;
$tanggal_lahir = $post->itanggal_lahir;
$alamat = $post->ialamat;
$no_hp = $post->ino_hp;
$ktp = $post->iktp;
$no_antrian = $post->ino_antrian;
$norm = $post->inorm;
$provinsi = $post->iProvinsi;
$kota = $post->iKota;
$kecamatan = $post->ikecamatan;
$kelurahan = $post->iKelurahan;
$status_perkawinan = $post->istatus_perkawinan;
$pendidikan = $post->iPendidikan;
$pekerjaan = $post->ipekerjaan;
$jenis_kelamin = $post->ijenis_kelamin;
$agama = $post->iagama;
// print_r($jenis_kelamin);die;
$param->saveGlobal( $dataArrayPasien, $table_pasien);
$seqAfter1 = $param->getLastSeqPostgree($table_pasien, 'no_rekam_medis');
$no_rekam = $seqAfter1->data['total']+1;
if(strlen($no_rekam) == 1){
$no_rekam = $seqAfter1->data['total']+1;
$dataArrayPasien = array (
'no_rekam_medis' => '00000'.$no_rekam,
$result->code = 0;
$result->info = 'ok';
$result->data = $dataArrayPasien;
}catch (\Exception $exc) {
$result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString());
}
}
return $this->getOutput($result->toJson());
}
'nama' => $nama,
'alamat' => $alamat,
'provinsi' => $provinsi,
'kota' => $kota,
'kecamatan' => $kecamatan,
'kelurahan_id' => $kelurahan,
'jenis_kelamin' =>$jenis_kelamin,
'no_ktp' => $ktp,
'no_telepon' => $no_hp,
'tempat_lahir' => $tempat_lahir,
'tanggal_lahir' => $tanggal_lahir,
// 'umur'
'agama_id' => $agama,
'pendidikan_id' => $pendidikan,
'pekerjaan_id' => $pekerjaan,
'status_nikah_id'=> $status_perkawinan,
);
}else if(strlen($no_rekam) == 2){
$no_rekam = $seqAfter1->data['total']+1;
$dataArrayPasien = array (
'no_rekam_medis' => '0000'.$no_rekam,
'nama' => $nama,
'alamat' => $alamat,
'provinsi' => $provinsi,
'kota' => $kota,
'kecamatan' => $kecamatan,
'kelurahan_id' => $kelurahan,
'jenis_kelamin' => $jenis_kelamin,
'no_ktp' => $ktp,
'no_telepon' => $no_hp,
'tempat_lahir' => $tempat_lahir,
'tanggal_lahir' => $tanggal_lahir,
// 'umur'
'agama_id' => $agama,
'pendidikan_id' => $pendidikan,
'pekerjaan_id' => $pekerjaan,
'status_nikah_id'=> $status_perkawinan,
'is_deleted' => 0,
);
}else if(strlen($no_rekam) == 3){
$no_rekam = $seqAfter1->data['total']+1;
$dataArrayPasien = array (
'no_rekam_medis' => '000'.$no_rekam,
'nama' => $nama,
'alamat' => $alamat,
'provinsi' => $provinsi,
'kota' => $kota,
'kecamatan' => $kecamatan,
'kelurahan_id' => $kelurahan,
'jenis_kelamin' => $jenis_kelamin,
'no_ktp' => $ktp,
'no_telepon' => $no_hp,
'tempat_lahir' => $tempat_lahir,
'tanggal_lahir' => $tanggal_lahir,
// 'umur'
'agama_id' => $agama,
'pendidikan_id' => $pendidikan,
'pekerjaan_id' => $pekerjaan,
'status_nikah_id'=> $status_perkawinan,
'is_deleted' => 0,
);
}else if(strlen($no_rekam) == 4){
$no_rekam = $seqAfter1->data['total']+1;
$dataArrayPasien = array (
'no_rekam_medis' => '00'.$no_rekam,
'nama' => $nama,
'alamat' => $alamat,
'provinsi' => $provinsi,
'kota' => $kota,
'kecamatan' => $kecamatan,
'kelurahan_id' => $kelurahan,
'jenis_kelamin' => $jenis_kelamin,
'no_ktp' => $ktp,
'no_telepon' => $no_hp,
'tempat_lahir' => $tempat_lahir,
'tanggal_lahir' => $tanggal_lahir,
// 'umur'
'agama_id' => $agama,
'pendidikan_id' => $pendidikan,
'pekerjaan_id' => $pekerjaan,
'status_nikah_id'=> $status_perkawinan,
'is_deleted' => 0,
);
}else if(strlen($no_rekam) == 5){
$no_rekam = $seqAfter1->data['total']+1;
$dataArrayPasien = array (
'no_rekam_medis' => '0'.$no_rekam,
'nama' => $nama,
'alamat' => $alamat,
'provinsi' => $provinsi,
'kota' => $kota,
'kecamatan' => $kecamatan,
'kelurahan_id' => $kelurahan,
'jenis_kelamin' => $jenis_kelamin,
'no_ktp' => $ktp,
'no_telepon' => $no_hp,
'tempat_lahir' => $tempat_lahir,
'tanggal_lahir' => $tanggal_lahir,
// 'umur'
'agama_id' => $agama,
'pendidikan_id' => $pendidikan,
'pekerjaan_id' => $pekerjaan,
'status_nikah_id'=> $status_perkawinan,
'is_deleted' => 0,
);
}else{
$no_rekam = $seqAfter1->data['total']+1;
$dataArrayPasien = array (
'no_rekam_medis' => '0'.$no_rekam,
'nama' => $nama,
'alamat' => $alamat,
'provinsi' => $provinsi,
'kota' => $kota,
'kecamatan' => $kecamatan,
'kelurahan_id' => $kelurahan,
'jenis_kelamin' => $jenis_kelamin,
'no_ktp' => $ktp,
'no_telepon' => $no_hp,
'tempat_lahir' => $tempat_lahir,
'tanggal_lahir' => $tanggal_lahir,
// 'umur'
'agama_id' => $agama,
'pendidikan_id' => $pendidikan,
'pekerjaan_id' => $pekerjaan,
'status_nikah_id'=> $status_perkawinan,
'is_deleted' => 0,
);
}
// print_r($dataArrayPasien);die;
$param->saveGlobal( $dataArrayPasien, $table_pasien);
$result->code = 0;
$result->info = 'ok';
$result->data = $dataArrayPasien;
}catch (\Exception $exc) {
$result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString());
}
}
return $this->getOutput($result->toJson());
}
public function loaddatapasienAction(){
$result = new Result();
$request = $this->getRequest();
......@@ -2336,4 +2498,354 @@ class ApiController extends \Application\Master\GlobalActionController {
return $this->getOutput($result->toJson());
}
public function loadagamaAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->loadagama();
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 loadpekerjaanAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->loadpekerjaan();
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 loadpendidikanAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text-> loadpendidikan();
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 loadstatuskawinAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text-> loadstatuskawin();
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 loadprovinsiAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->loadprovinsi();
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 loadkotaAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->loadkota($post->iProvinsi);
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 loadkelurahanAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->loadkelurahan($post->ikecamatan);
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 loadkecamatanAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->loadkecamatan($post->iKota);
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 loadjeniskedatanganAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->loadjeniskedatangan();
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 loadcarabayarAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->loadcarabayar();
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 loadpenjaminAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->loadpenjamin($post->icara_bayar);
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 loadinstalasiAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->loadinstalasi();
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 laodpolibaruAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->laodpolibaru();
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 loadhubunganAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->loadhubungan();
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 laoddokterbaruAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$text = new \Application\Model\Param($storage);
$load = $text->laoddokterbaru($post->ipoli);
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());
}
}
\ No newline at end of file
......@@ -224,4 +224,64 @@ class Param extends Mapper {
$data = $this->_storage->loadUserCounter($status, $iddok);
return $data;
}
public function loadagama(){
$data = $this->_storage->loadagama();
return $data;
}
public function loadpekerjaan(){
$data = $this->_storage->loadpekerjaan();
return $data;
}
public function loadpendidikan(){
$data = $this->_storage->loadpendidikan();
return $data;
}
public function loadstatuskawin(){
$data = $this->_storage->loadstatuskawin();
return $data;
}
public function loadprovinsi(){
$data = $this->_storage->loadprovinsi();
return $data;
}
public function loadkota($iProvinsi){
$data = $this->_storage->loadkota($iProvinsi);
return $data;
}
public function loadkelurahan($kecamatan){
$data = $this->_storage->loadkelurahan($kecamatan);
return $data;
}
public function loadkecamatan($Kota){
$data = $this->_storage->loadkecamatan($Kota);
return $data;
}
public function loadjeniskedatangan(){
$data = $this->_storage->loadjeniskedatangan();
return $data;
}
public function loadcarabayar(){
$data = $this->_storage->loadcarabayar();
return $data;
}
public function loadpenjamin($cara_bayar){
$data = $this->_storage->loadpenjamin($cara_bayar);
return $data;
}
public function loadinstalasi(){
$data = $this->_storage->loadinstalasi();
return $data;
}
public function laodpolibaru(){
$data = $this->_storage->laodpolibaru();
return $data;
}
public function loadhubungan(){
$data = $this->_storage->loadhubungan();
return $data;
}
public function laoddokterbaru($poli){
$data = $this->_storage-> laoddokterbaru($poli);
return $data;
}
}
......@@ -487,7 +487,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
try {
$sql = " SELECT * FROM pasien WHERE id_pasien = $id ";
$sql = " SELECT * FROM m_pasien WHERE id = $id ";
// print_r($sql);die;
......@@ -750,7 +750,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT id_pasien, no_rekam_medis FROM pasien
$sql = " SELECT id, no_rekam_medis FROM m_pasien
WHERE no_rekam_medis = '$no_rekam_medis' ";
......@@ -1924,49 +1924,547 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
public function loadUserCounter($status = null, $iddok = null, $no_antrian = null, $id_poli = null){
public function loadpekerjaan(){
$result = new Result();
try {
$sql = "SELECT * FROM m_pekerjaan ORDER BY nama_pekerjaan ASC ";
// 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;
}
public function loadagama(){
$result = new Result();
try {
$sql = " SELECT * FROM master where kode = 'AGM'ORDER BY nama asc ";
// 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;
}
public function loadpendidikan(){
$result = new Result();
try {
$sql = " SELECT * FROM m_pendidikan ORDER BY nama_pendidikan asc ";
// 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;
}
public function loadstatuskawin(){
$result = new Result();
try {
$sql = " SELECT * FROM master where kode = 'SNP' ORDER BY nama asc ";
// 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;
}
public function loadprovinsi(){
$result = new Result();
try {
$sql = " SELECT * FROM m_provinsi ORDER BY name asc ";
// 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;
}
public function loadkota($iProvinsi){
$result = new Result();
try {
$sql = "SELECT * FROM m_kota where provinsi_id='$iProvinsi' ORDER BY name asc ";
// 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;
}
public function loadkecamatan($Kota){
$result = new Result();
try {
$sql = "SELECT * FROM m_kecamatan where kota_id = '$Kota' ORDER BY name asc ";
// 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;
}
public function loadkelurahan($kecamatan){
$result = new Result();
try {
$sql = "SELECT * FROM m_kelurahan where kecamatan_id = '$kecamatan' ORDER BY name asc";
// 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;
}
public function loadjeniskedatangan(){
$result = new Result();
try {
$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_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_to_poli.id_dokter = $iddok ORDER BY no_antrian ASC LIMIT 1 " ;
//print_r($mode);die;
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
try {
$sql = "SELECT * FROM m_jenis_kedatangan ORDER BY nama_jenis_kedatangan asc";
// 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);
}
$listdata = array();
while($resdata->next()){
$res = $resdata->current();
array_push($listdata,$res);
}
//print_r($listdata);die;
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
} else {
$result->code = 1;
$result->info = 'failed load user counter';
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;
}
public function loadcarabayar(){
$result = new Result();
try {
$sql =" SELECT * FROM m_penjamin where parent is null order by nama_penjamin asc";
// 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);
}
}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;
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;
}
public function loadpenjamin($cara_bayar){
$result = new Result();
try {
$sql ="SELECT * FROM m_penjamin where parent = $cara_bayar and status= 1 order by nama_penjamin asc";
// 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;
}
public function loadinstalasi(){
$result = new Result();
try {
$sql ="SELECT * FROM m_instalasi WHERE kode= '01'";
// 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;
}
public function laodpolibaru(){
$result = new Result();
try {
$sql ="SELECT * FROM m_unit where instalasi_id=1";
// 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;
}
public function loadhubungan(){
$result = new Result();
try {
$sql = "SELECT * FROM master where kode = 'HKL'";
// 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;
}
public function laoddokterbaru($poli){
$result = new Result();
try {
$sql =" SELECT m_pegawai.id,m_pegawai.nama,m_pegawai.unit_medis_id,m_pegawai.unit_id,m_unit.nama_ruangan FROM m_pegawai INNER JOIN m_unit ON m_pegawai.unit_id = m_unit.id
WHERE m_pegawai.instalasi_id =1 and m_unit.id =$poli AND m_pegawai.unit_medis_id=1";
// 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;
}
}
......@@ -38,42 +38,90 @@ input::-webkit-inner-spin-button {
</div>
<div class="card-body">
<form id="myForm">
<form id="myForm" class="form-row">
<input type="hidden" id="iInput" class="form-control" /></input>
<!-- <input type="text" id="Provinsi" class="form-control" /></input> -->
<div class="form-group">
<div class="form-group col-md-4">
<label><h5>No Induk Kependudukan (NIK)</h5></label>
<input type="number" id="ktp" class="form-control" placeholder="No Induk Kependudukan (NIK)" max="9999999999999999" maxlength="16"></input>
</div>
<div class="form-group">
<div class="form-group col-md-4">
<label><h5>Nama Pasien</h5></label>
<input type="text" id="nama" class="form-control" placeholder="Nama Lengkap" ></input>
</div>
<!-- <div class="form-group">
<label><h5>Jenis Kelamin</h5></label> <br>
<input type="radio" id="male" name="gender" value="male">
<label for="male"><h5>Laki-laki </h5></label>
<input type="radio" id="female" name="gender" value="female">
<label for="female"><h5>Perempuan </h5></label>
</div> -->
<div class="form-group col-md-4">
<label><h5>Tanggal Lahir</h5></label>
<input type="date" id="tanggal_lahir" class="form-control" /></input>
</div>
<div class="form-group col-md-4">
<label><h5>Jenis Kelamin</h5></label><br>
<input type="radio" id="laki_laki" name="gender" value="L">
<label for="male"><h5>Laki-Laki</h5></label>
<input type="radio" id="perempuan" name="gender" value="P">
<label for="female"><h5>Perempuan</h5></label>
</div>
<div class="form-group ">
<div class="form-group col-md-4" >
<label><h5>Tempat Lahir</h5></label>
<textarea type="text" id="tempat_lahir" class="form-control " placeholder="Tempat Lahir" ></textarea >
<input type="text" id="tempat_lahir" rows="3" class="form-control" placeholder="Alamat"/></textarea >
</div>
<div class="form-group">
<label><h5>Tanggal Lahir</h5></label>
<input type="date" id="tanggal_lahir" class="form-control" /></input>
<div class="form-group col-md-4">
<label> <h5>Agama</h5></label>
<select name="agama" id="agama" class="form-control">
<option disabled selected>Agama </option>
</select>
</div>
<div class="form-group" >
<div class="form-group col-md-4">
<label> <h5>Pekerjaan</h5></label>
<select name="pekerjaan" id="pekerjaan" class="form-control">
<option disabled selected>Pekerjaan </option>
</select>
</div>
<div class="form-group col-md-4">
<label> <h5>Pendidikan</h5></label>
<select name="Pendidikan" id="Pendidikan" class="form-control">
<option disabled selected>Pendidikan </option>
</select>
</div>
<div class="form-group col-md-4">
<label> <h5>Status Perkawinan</h5></label>
<select name="status_perkawinan" id="status_perkawinan" class="form-control">
<option disabled selected>Status Perkawinan </option>
</select>
</div>
<div class="form-group col-md-4" >
<label><h5>Alamat</h5></label>
<textarea type="text" id="alamat" rows="3" class="form-control" placeholder="Alamat"/></textarea >
<input type="text" id="alamat" rows="3" class="form-control" placeholder="Alamat"/></textarea >
</div>
<div class="form-group col-md-4">
<label> <h5>Provinsi</h5></label>
<select name="Provinsi" id="Provinsi" class="form-control">
<option disabled selected>Provinsi </option>
</select>
</div>
<div class="form-group col-md-4">
<label> <h5></h5>Kota/Kabupaten</label>
<select name="Kota" id="Kota" class="form-control">
<option disabled selected> </option>
</select>
</div>
<div class="form-group col-md-4">
<label> <h5></h5>Kecamatan</label>
<select name="kecamatan" id="kecamatan" class="form-control">
<option disabled selected> </option>
</select>
</div>
<div class="form-group col-md-4">
<label> <h5></h5>Kelurahan</label>
<select name="Kelurahan" id="Kelurahan" class="form-control">
<option disabled selected> </option>
</select>
</div>
<div class="form-group">
<div class="form-group col-md-4">
<label><h5>No HP</h5></label>
<input type="number" id="no_hp" class="form-control " placeholder="No Handphone" maxlength="13" /></input>
</div>
......
......@@ -156,68 +156,131 @@ input[type="done"] + label {
<div class="container">
<div class="card" >
<div class="card-header">
<h2> Silahkan Pilih Poli dan Dokter</h2>
<h2>Registrasi</h2>
</div>
<div class="card-body">
<form id="myForm">
<form id="myForm" class="form-row">
<input type="hidden" id="id_pasien" class="form-control" disabled/></input>
<div class="form-group">
<label> <h5>No Rekam Medis</h5></label>
<div class="form-group col-md-6">
<label> <h5>No Rekam Medis :</h5></label>
<input type="text" id="no_rekam_medis" class="form-control" disabled/></input>
</div>
<div class="form-group">
<label> <h5>KTP</h5></label>
<input type="text" id="ktp" class="form-control" disabled /></input>
<div class="form-group col-md-6">
<label> <h5>Nama :</h5></label>
<input type="text" id="nama" class="form-control" disabled/></input>
</div>
<div class="form-group">
<label> <h5>Nama pasien</h5></label>
<input type="text" id="nama" class="form-control" disabled/></input>
</div>
<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>
</div>
<div class="form-group" >
<input type="hidden" id="alamat" rows="3" class="form-control"disabled ></input>
</div>
<div class="form-group">
<input type="hidden" id="no_hp" class="form-control "disabled ></input>
</div>
<div class="form-group">
<label> <h5>Pilih Poli </h5></label>
<select name="nama_poli" id="poli" class="form-control">
<div class="form-group col-md-6">
<label> <h5>Jenis Kedatangan :</h5></label>
<select name="jenis_kedatangan" id="jenis_kedatangan" class="form-control">
<option disabled selected> Pilih </option>
</select>
</div>
<div class="form-group col-md-6">
<label> <h5>Fakses/Dokter Rujukan :</h5></label>
<input type="text" id="dokter_rujukan" class="form-control" ></input>
</div>
<div class="form-group col-md-4">
<label> <h5>Cara Bayar :</h5></label>
<select name="cara_bayar" id="cara_bayar" class="form-control">
<option disabled selected> Pilih </option>
</select>
</div>
<div class="form-group">
<label> <h5>Pilih Dokter </h5></label>
<select id="dokter" name="nama_dokter" class="form-control">
<div class="form-group col-md-4">
<label> <h5>Penjamin :</h5></label>
<select name="penjamin" id="penjamin" class="form-control">
<option disabled selected> </option>
</select>
</div>
<div class="form-group col-md-4">
<label> <h5>No Asuransi :</h5></label>
<input type="text" id="dokter_rujukan" class="form-control" /></input>
</div>
<div class="form-group col-md-4">
<label> <h5>Instalasi :</h5></label>
<select name="instalasi" id="instalasi" class="form-control">
<option disabled selected> Pilih </option>
</select>
</div>
<div class="form-group col-md-4">
<label> <h5>Poli :</h5></label>
<select name="poli" id="poli" class="form-control">
<option disabled selected> </option>
</select>
</div>
<div class="form-group col-md-4">
<label> <h5>Dokter :</h5></label>
<select id="dokter" name="dokter" class="form-control">
<option disabled selected> </option>
</select>
</div>
<!-- <div class="form-group col-md-4"> -->
<input type="hidden" id="ktp" class="form-control" disabled /></input>
<!-- </div> -->
<!-- <div class="form-group col-md-4"> -->
<input type="hidden" id="tempat_lahir" class="form-control "disabled ></input>
<!-- </div> -->
<!-- <div class="form-group col-md-4"> -->
<input type="hidden" id="sisa_antrian" class="form-control "disabled ></input>
<!-- </div> -->
<!-- <div class="form-group col-md-4"> -->
<input type="hidden" id="tanggal_lahir" class="form-control"disabled /></input>
<!-- </div> -->
<!-- <div class="form-group col-md-4" > -->
<input type="hidden" id="alamat" rows="3" class="form-control"disabled ></input>
<!-- </div> -->
<!-- <div class="form-group col-md-4"> -->
<input type="hidden" id="no_hp" class="form-control "disabled ></input>
<!-- </div> -->
</form>
</div>
<div class="card-footer" >
<p class="card-text"></p>
<button type="button" id="pilihno" class="btn btn-primary" data-toggle="modal" data-target="#pilihantrian" style="float: right;"> Daftar Antrian</button>
</div>
</div>
<br>
<div class="card" >
<div class="card-header">
<h4>Penanggung Jawab</h4>
</div>
<div class="card-body">
<form id="myForm" class="form-row">
<div class="form-group col-md-3">
<label> <h5>Nama :</h5></label>
<input type="text" id="nama_penanggung" class="form-control" ></input>
</div>
<div class="form-group col-md-3">
<label> <h5>Hubungan Keluarga :</h5></label>
<select id="hubkel" name="hubkel" class="form-control">
<option disabled selected> Pilih </option>
</select>
</div>
<div class="form-group col-md-3">
<label> <h5>Alamat :</h5></label>
<input type="text" id="alamatpen" class="form-control" ></input>
</div>
<div class="form-group col-md-3">
<label> <h5>No Telepon :</h5></label>
<input type="text" id="notelpen" class="form-control" ></input>
</div>
</form>
</div>
</div>
</div>
<br>
<div class="container">
<button type="button" id="pilihno" class="btn btn-primary" data-toggle="modal" data-target="#pilihantrian" style="float: left;width: 49%;"> Daftar Antrian</button>
<button type="button" id="pilihno" class="btn btn-danger" style="float: right;width: 49%;"> Kembali</button>
</div>
<br>
<br>
<!-- Trigger the modal with a button -->
......
......@@ -8,10 +8,10 @@ $('#cekdata').on('click', function () {
return false;
} else if (no_rekam_medis.toString().length > 8) {
} else if (no_rekam_medis.toString().length > 6) {
bootbox.alert({ message: 'No Rekam Medis tidak boleh lebih dari 8 angka', centerVertical: true });
return false;
} else if (no_rekam_medis.toString().length < 8) {
} else if (no_rekam_medis.toString().length < 6) {
bootbox.alert({ message: 'No Rekam Medis tidak boleh kurang dari 8 angka', centerVertical: true });
return false;
......@@ -43,7 +43,7 @@ function cekpasien(no_rekam_medis) {
else if (result.code == 0) {
console.log(result.data['datapasien'][0]['no_rekam_medis']);
let $id = result.data['datapasien'][0]['id_pasien'];
let $id = result.data['datapasien'][0]['id'];
let $encodedId = btoa($id);
window.location.href = ("datapasien/" + $encodedId);
......
......@@ -17,7 +17,227 @@ $(document).ready(function () {
}
});
});
loadagama()
function loadagama() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadagama',
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].nama + '</option>';
}
$("select#agama").html(optionseg);
} else {
bootbox.alert({ message: 'Agama tidak ada', centerVertical: true });
}
}
});
}
loadpekerjaan()
function loadpekerjaan() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpekerjaan',
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].nama_pekerjaan + '</option>';
}
$("select#pekerjaan").html(optionseg);
} else {
bootbox.alert({ message: 'Pekerjaan tidak ada ', centerVertical: true });
}
}
});
}
loadpendidikan()
function loadpendidikan() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpendidikan',
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].nama_pendidikan + '</option>';
}
$("select#Pendidikan").html(optionseg);
} else {
bootbox.alert({ message: 'Pendidikan tidak ada ', centerVertical: true });
}
}
});
}
loadstatuskawin()
function loadstatuskawin() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadstatuskawin',
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].nama + '</option>';
}
$("select#status_perkawinan").html(optionseg);
} else {
bootbox.alert({ message: 'Status tidak ada', centerVertical: true });
}
}
});
}
loadprovinsi()
function loadprovinsi() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadprovinsi',
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].name + '</option>';
}
$("select#Provinsi").html(optionseg);
} else {
bootbox.alert({ message: ' Provinsi tidak ada', centerVertical: true });
}
}
});
}
$('#Provinsi').on('change', function () {
var Provinsi = $('#Provinsi').val();
// console.log(idpoli);
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadkota',
data: {
iProvinsi: Provinsi
},
success: function (result) {
console.log(result)
if (result['code'] == 0) {
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].name + '</option>';
}
$("select#Kota").html(optionseg);
} else {
bootbox.alert({ message: 'Kota tidak ada ', centerVertical: true });
}
}
});
})
$('#Kota').on('change', function () {
var Kota = $('#Kota').val();
// console.log(idpoli);
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadkecamatan',
data: {
iKota: Kota
},
success: function (result) {
console.log(result)
if (result['code'] == 0) {
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].name + '</option>';
}
$("select#kecamatan").html(optionseg);
} else {
bootbox.alert({ message: 'Kecamatan tidak ada ', centerVertical: true });
}
}
});
})
$('#kecamatan').on('change', function () {
var kecamatan = $('#kecamatan').val();
// console.log(idpoli);
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadkelurahan',
data: {
ikecamatan: kecamatan
},
success: function (result) {
console.log(result)
if (result['code'] == 0) {
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].name + '</option>';
}
$("select#Kelurahan").html(optionseg);
} else {
bootbox.alert({ message: 'Kelurahan tidak ada ', centerVertical: true });
}
}
});
})
......@@ -29,9 +249,18 @@ $('#tambahdata').on('click', function () {
let tanggal_lahir = $('#tanggal_lahir').val();
let alamat = $('#alamat').val();
let no_hp = $('#no_hp').val();
let KTP = $('#ktp').val();
if (KTP == null || KTP == "") {
let ktp = $('#ktp').val();
let jenis_kelamin = $("input[name=gender]:checked").val();
let Provinsi = $("#Provinsi option:selected").attr("value");
let Kota = $("#Kota option:selected").attr("value");
let kecamatan = $("#kecamatan option:selected").attr("value");
let Kelurahan = $("#Kelurahan option:selected").attr("value");
let status_perkawinan = $("#status_perkawinan option:selected").attr("value");
let Pendidikan = $("#Pendidikan option:selected").attr("value");
let pekerjaan = $("#pekerjaan option:selected").attr("value");
let agama = $("#agama option:selected").attr("value");
if (ktp == null || ktp == "") {
bootbox.alert({ message: 'No Induk Kependudukan (NIK) tidak boleh kosong', centerVertical: true });
return false;
}
......@@ -41,85 +270,95 @@ $('#tambahdata').on('click', function () {
} else if (tempat_lahir == null || tempat_lahir == "") {
bootbox.alert({ message: 'Tempat lahir tidak boleh kosong', centerVertical: true });
return false;
} else if (jenis_kelamin == null || jenis_kelamin == "") {
bootbox.alert({ message: 'Jenis kelamin tidak boleh kosong', centerVertical: true });
return false;
} else if (tanggal_lahir == null || tanggal_lahir == "") {
bootbox.alert({ message: 'Tanggal lahir tidak boleh kosong', centerVertical: true });
return false;
} else if (agama == null || agama == "" || agama == "Pilih") {
bootbox.alert({ message: 'Agama tidak boleh kosong', centerVertical: true });
return false;
} else if (pekerjaan == null || pekerjaan == "" || pekerjaan == "Pilih") {
bootbox.alert({ message: 'Pekerjaan tidak boleh kosong', centerVertical: true });
return false;
} else if (Pendidikan == null || Pendidikan == "" || Pendidikan == "Pilih") {
bootbox.alert({ message: 'Pendidikan tidak boleh kosong', centerVertical: true });
return false;
} else if (status_perkawinan == null || status_perkawinan == "" || status_perkawinan == "Pilih") {
bootbox.alert({ message: 'Status perkawinan tidak boleh kosong', centerVertical: true });
return false;
} else if (alamat == null || alamat == "") {
bootbox.alert({ message: 'Alamat tidak boleh kosong', centerVertical: true });
return false;
} else if (Provinsi == null || Provinsi == "" || Provinsi == "Pilih") {
bootbox.alert({ message: 'Provinsi tidak boleh kosong', centerVertical: true });
return false;
} else if (Kota == null || Kota == "" || Kota == "Pilih") {
bootbox.alert({ message: 'Kota tidak boleh kosong', centerVertical: true });
return false;
} else if (kecamatan == null || kecamatan == "" || kecamatan == "Pilih") {
bootbox.alert({ message: 'Kecamatan tidak boleh kosong', centerVertical: true });
return false;
} else if (Kelurahan == null || Kelurahan == "" || Kelurahan == "Pilih") {
bootbox.alert({ message: 'Kelurahan tidak boleh kosong', centerVertical: true });
return false;
} else if (no_hp == null || no_hp == "") {
bootbox.alert({ message: 'No hp tidak boleh kosong', centerVertical: true });
return false;
} else if (KTP.toString().length > 16) {
} else if (agama == null || agama == "" || agama == "Pilih") {
bootbox.alert({ message: 'Agama tidak boleh kosong', centerVertical: true });
return false;
} else if (ktp.toString().length > 16) {
bootbox.alert({ message: 'No Induk Kependudukan (NIK) tidak boleh lebih dari 16 angka', centerVertical: true });
return false;
} else if (KTP.toString().length < 16) {
} else if (ktp.toString().length < 16) {
bootbox.alert({ message: 'No Induk Kependudukan (NIK) tidak boleh kurang dari 16 angka', centerVertical: true });
return false;
} else if (no_hp.toString().length > 13) {
bootbox.alert({ message: 'No HP tidak boleh lebih dari 13 angka', centerVertical: true });
return false;
}
else if (validasipoli(KTP) == 1) {
bootbox.alert({ message: 'KTP Sudah Digunakan!', centerVertical: true });
else if (validasipoli(ktp) == 1) {
bootbox.alert({ message: 'No Induk Kependudukan Sudah Digunakan!', centerVertical: true });
}
else {
validasinorekammedis();
SaveDataAja()
}
})
function makeid(length) {
let result = '';
let characters =
'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
let charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
function makeidnumber(length) {
let result = '';
let characters =
'1234567890';
let charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
function validasinorekammedis() {
let norekamedis = makeid(2) + makeidnumber(6);
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpasien',
data: {
no_rekam_medis: norekamedis
},
success: function (result) {
if (result.info == 'Not Found') {
SaveDataAja(norekamedis);
} else {
validasinorekammedis();
}
}
});
}
function SaveDataAja(norekamedis) {
let no_rekam_medis = norekamedis;
let id_pasien = $('#id_pasien').val();
function SaveDataAja() {
let nama = $('#nama').val();
let tempat_lahir = $('#tempat_lahir').val();
let tanggal_lahir = $('#tanggal_lahir').val();
let alamat = $('#alamat').val();
let no_hp = $('#no_hp').val();
let ktp = $('#ktp').val();
let jenis_kelamin = $("input[name=gender]:checked").val();
let Provinsi = $("#Provinsi option:selected").attr("value");
let Kota = $("#Kota option:selected").attr("value");
let kecamatan = $("#kecamatan option:selected").attr("value");
let Kelurahan = $("#Kelurahan option:selected").attr("value");
let status_perkawinan = $("#status_perkawinan option:selected").attr("value");
let Pendidikan = $("#Pendidikan option:selected").attr("value");
let pekerjaan = $("#pekerjaan option:selected").attr("value");
let agama = $("#agama option:selected").attr("value");
console.log(Kota)
let laki = $('#L').val();
let perem = $('#P').val();
$.ajax({
......@@ -127,24 +366,32 @@ function SaveDataAja(norekamedis) {
dataType: 'json',
url: baseURL + '/api/savedatapasien',
data: {
id_pasien: id_pasien,
iktp: ktp,
inama: nama,
itempat_lahir: tempat_lahir,
itanggal_lahir: tanggal_lahir,
ialamat: alamat,
ino_hp: no_hp,
inorm: no_rekam_medis
iProvinsi: Provinsi,
iKota: Kota,
ikecamatan: kecamatan,
iKelurahan: Kelurahan,
istatus_perkawinan: status_perkawinan,
iPendidikan: Pendidikan,
ipekerjaan: pekerjaan,
iagama: agama,
ijenis_kelamin: jenis_kelamin,
},
success: function (response) {
// alert("success");
// response[data];
success: function (result) {
console.log(result)
if (response['code'] == 0) {
console.log(response);
let $id = response.data['id_pasien'];
let $id = response.data['id'];
let $encodedId = btoa($id);
window.location.href = ("datapasien/" + $encodedId);
......
......@@ -11,7 +11,7 @@ function loaddatapasien(param) {
id: param,
},
success: function (result) {
// console.log(result);
console.log(result);
// $('.loaddata').empty();
// console.log(result);
......@@ -19,14 +19,14 @@ function loaddatapasien(param) {
let data = result.data;
$('#id_pasien').val(data[0].id_pasien);
$('#id_pasien').val(data[0].id);
$('#no_rekam_medis').val(data[0].no_rekam_medis);
$('#ktp').val(data[0].ktp);
$('#no_ktp').val(data[0].ktp);
$('#nama').val(data[0].nama);
$('#tempat_lahir').val(data[0].tempat_lahir);
$('#tanggal_lahir').val(data[0].tanggal_lahir);
$('#alamat').val(data[0].alamat);
$('#no_hp').val(data[0].no_hp);
$('#no_telepon').val(data[0].no_hp);
} else {
......@@ -39,51 +39,211 @@ function loaddatapasien(param) {
});
}
loadjeniskedatangan()
function loadjeniskedatangan() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadjeniskedatangan',
function loadsisaantrian() {
let dokter = $('#dokter option:selected').attr("value");
let no_antrian = $("input[name=antrian]:checked").val();
var sisa_antrian;
success: function (result) {
// console.log(dokter);
// console.log(no_antrian);
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].nama_jenis_kedatangan + '</option>';
}
$("select#jenis_kedatangan").html(optionseg);
} else {
bootbox.alert({ message: 'Jenis Kedatangan tidak ada ', centerVertical: true });
}
}
});
}
loadcarabayar()
function loadcarabayar() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadsisaantrian',
async: false,
url: baseURL + '/api/loadcarabayar',
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].nama_penjamin + '</option>';
}
$("select#cara_bayar").html(optionseg);
} else {
bootbox.alert({ message: 'Cara bayar tidak ada ', centerVertical: true });
}
}
});
}
$('#cara_bayar').on('change', function () {
var cara_bayar = $('#cara_bayar').val();
console.log(poli);
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpenjamin',
data: {
id: dokter,
no: no_antrian,
icara_bayar: cara_bayar
},
success: function (result) {
// console.log(result);
// $('.loaddata').empty();
// console.log(result);
console.log(result)
if (result.code == 0) {
if (result['code'] == 0) {
let data = result.data;
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].nama_penjamin + '</option>';
}
// console.log(data[0].count);
sisa_antrian = data[0].count;
// $('#sisa_antrian').val(data[0].count);
$("select#penjamin").html(optionseg);
} else {
bootbox.alert({ message: 'Penjamin tidak ada ', centerVertical: true });
}
}
});
})
loadpoli()
function loadpoli() {
// console.log(cara_bayar)
// console.log(idpoli);
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/laodpolibaru',
success: function (result) {
console.log(result)
if (result['code'] == 0) {
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].nama_ruangan + '</option>';
}
$("select#poli").html(optionseg);
} else {
alert(result.info);
bootbox.alert({ message: 'Poli tidak ada ', centerVertical: true });
}
}
});
}
$('#poli').on('change', function () {
var poli = $('#poli').val();
console.log(poli);
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/laoddokterbaru',
data: {
ipoli: poli
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
success: function (result) {
console.log(result)
if (result['code'] == 0) {
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].nama + '</option>';
}
$("select#dokter").html(optionseg);
} else {
bootbox.alert({ message: 'Dokter tidak ada ', centerVertical: true });
}
}
});
})
loadinstalasi()
function loadinstalasi() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadinstalasi',
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
// optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg = '<option value="' + res[i].id + '">' + res[i].nama_instalasi + '</option>';
}
$("select#instalasi").html(optionseg);
} else {
bootbox.alert({ message: 'Instalasi tidak ada ', centerVertical: true });
}
}
});
}
loadhubungan()
function loadhubungan() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadhubungan',
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>-- Pilih --</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id + '">' + res[i].nama + '</option>';
}
$("select#hubkel").html(optionseg);
} else {
bootbox.alert({ message: 'Instalasi tidak ada ', centerVertical: true });
}
}
});
return sisa_antrian;
}
$('#tambah').on('click', function () {
loadsisaantrian()
// loadsisaantrian()
savedataaja()
})
......@@ -151,62 +311,48 @@ function savedataaja() {
});
}
function loadsisaantrian() {
let dokter = $('#dokter option:selected').attr("value");
let no_antrian = $("input[name=antrian]:checked").val();
var sisa_antrian;
loadpoli();
$('#poli').on('change', function () {
var idpoli = $('#poli').val();
// console.log(idpoli);
// console.log(dokter);
// console.log(no_antrian);
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadDokterWaktu',
url: baseURL + '/api/loadsisaantrian',
async: false,
data: {
id_poli: idpoli
id: dokter,
no: no_antrian,
},
success: function (result) {
// console.log(result);
// $('.loaddata').empty();
// console.log(result);
if (result['code'] == 0) {
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id_dokter + '">' + res[i].nama_dokter + '</option>';
}
$("select#dokter").removeAttr('disabled');
$("select#dokter").html(optionseg);
} else {
bootbox.alert({ message: 'Dokter di poli ini belum ada yg didaftarkan', centerVertical: true });
}
}
});
});
if (result.code == 0) {
function loadpoli() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadregisterpoli',
let data = result.data;
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
// console.log(data[0].count);
sisa_antrian = data[0].count;
// $('#sisa_antrian').val(data[0].count);
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>';
}
$("select#poli").html(optionseg);
} else {
bootbox.alert({ message: 'Data Poli Kosong', centerVertical: true });
alert(result.info);
}
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
}
});
return sisa_antrian;
}
// validasipasien()
validasipasien()
function validasipasien(id_poli, dokter, id_pasien) {
var exist = 0;
......@@ -258,6 +404,8 @@ function validasipasien(id_poli, dokter, id_pasien) {
}
$('#pilihno').on('click', function (e) {
e.preventDefault();
var id_pasien = $('#id_pasien').val();
......@@ -302,22 +450,19 @@ function pilihAntrian(id_poli) {
splithour[0] = $antrian[0]['jam_mulai'].split(':');
hour += parseInt(splithour[0][0]);
minute = parseInt(splithour[0][1]);
$('.antrian').empty();
var d = new Date();
var newhour = d.getHours();
var newminute = d.getMinutes();
for (var i = 0; i < $antrian.length; i++) {
var A = Date.now();
if ($antrian[i]['id_pasien'] === null) {//jika masih kosong
let y = ' ';
console.log()
var splittime = [];
splittime[i] = $antrian[i]['waktu_antrian'].split(':');
......@@ -330,92 +475,25 @@ function pilihAntrian(id_poli) {
if (hour >= 24) {
hour = 0;
}
if(newhour > hour){
if (minute.toString().length === 1) {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="picked" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="display: block;text-align: center; line-height: 150%;" for="antrian` + i + `">` + hour + ':' + '0' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
}else{
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="picked" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="display: block;text-align: center; line-height: 150%;" for="antrian` + i + `">` + hour + ':' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
}
console.log("merah = "+hour+":"+minute);
}else if (newhour == hour){
if(newminute>minute){
if (minute.toString().length === 1) {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="picked" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="display: block;text-align: center; line-height: 150%;" for="antrian` + i + `">` + hour + ':' + '0' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
}else{
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="picked" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="display: block;text-align: center; line-height: 150%;" for="antrian` + i + `">` + hour + ':' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
}
}else{
if (minute.toString().length === 1) {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="display: block;text-align: center; line-height: 150%;"` + i + `">` + hour + ':' + '0' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
} else {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="display: block;text-align: center; line-height: 150%;"` + i + `">` + hour + ':' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
}
}
}else{
if (minute.toString().length === 1) {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="display: block;text-align: center; line-height: 150%;"` + i + `">` + hour + ':' + '0' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
} else {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="display: block;text-align: center; line-height: 150%;"` + i + `">` + hour + ':' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
}
if (minute.toString().length === 1) {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="display: block;text-align: center; line-height: 150%;"` + i + `">` + hour + ':' + '0' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
} else {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="display: block;text-align: center; line-height: 150%;"` + i + `">` + hour + ':' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
}
......
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