Exemplo n.º 1
0
	function buka_kunjungan($id_kunjungan_kamar) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$sql = "
			SELECT 
				k.kunjungan_ke as kunjungan_ke,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				p.sex as sex,
				p.tgl_lahir as tgl_lahir,
				kk.id as id_kunjungan_kamar,
				k.id as id_kunjungan,
				DATE(kk.tgl_daftar) as tgl_daftar,
				DATE(kk.tgl_periksa) as tgl_periksa,
				DATE(kk.tgl_keluar) as tgl_keluar,
				TIME(kk.tgl_keluar) as wkt_keluar,
				kk.dokter_id as id_dokter,
				kk.kelanjutan as kelanjutan,
				k.keadaan_keluar as keadaan_keluar,
				kmr.id as id_kamar,
				kmr.kelas as kelas,
				kmr.nama as spesialisasi,
				kk.diagnosa_utama_id as diagnosa_utama_id,
				IF(i.id IS NULL, ' ', CONCAT(i.kode_icd, ' - ', i.nama)) as diagnosa_utama_nama,
				CONCAT_WS(' - ', k.cara_masuk, rp.nama) as cara_masuk,
				CONCAT_WS(' - ', kk.cara_bayar, kk.jenis_askes, rper.nama) as cara_bayar
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				LEFT JOIN icd i ON (i.id = kk.diagnosa_utama_id)
				LEFT JOIN ref_perujuk rp ON (rp.id = k.perujuk_id)
				LEFT JOIN ref_perusahaan rper ON (rper.id = kk.perusahaan_id)
			WHERE
				kk.id = '".$id_kunjungan_kamar."'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getOne();

		//get data karcis
		$kon->sql = "
			SELECT
				id as kunjungan_bayar_id,
				karcis_id as karcis_id,
				nama as nama,
				hak_id as hak_id,
				jumlah as jumlah,
				biaya_bhp+biaya_jasa as biaya,
				bayar_bhp as bayar_bhp,
				bayar_jasa as bayar_jasa
			FROM
				kunjungan_bayar
			WHERE
				kunjungan_kamar_id = '".$id_kunjungan_kamar."'
				AND karcis_id IS NOT NULL
			GROUP BY 
				id
		";
		$kon->execute();
		$data_kc = $kon->getAll();
		
		//get data tindakan
		$kon->sql = "
			SELECT
				kkic.id as kunjungan_icopim_id,
				kby.id as kunjungan_bayar_id,
				kkic.nama as nama,
				kby.nama as kolom,
				kby.hak_id as hak_id,
				kby.sifat as sifat,
				kby.biaya_jasa as biaya,
				kby.jumlah as jumlah,
				kby.bayar_jasa as bayar
			FROM
				kunjungan_kamar_icopim kkic
				JOIN kunjungan_bayar kby ON (kby.kunjungan_kamar_icopim_id = kkic.id)
			WHERE
				kkic.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY 
				kby.id
			ORDER BY
				kkic.id, kby.id
		";
		$kon->execute();
		$data_ic = $kon->getAll();
		
		//get data BHP
		$kon->sql = "
			SELECT
				id as kunjungan_bayar_id,
				nama as nama,
				hak_id as hak_id,
				jumlah as jumlah,
				sifat as sifat,
				biaya_bhp as biaya,
				bayar_bhp as bayar
			FROM
				kunjungan_bayar
			WHERE
				kunjungan_kamar_id = '".$id_kunjungan_kamar."'
				AND bhp_id IS NOT NULL
			GROUP BY 
				id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();
		
		//get data kendaraan
		$sqlkd = "
			SELECT
				kkd.id as kunjungan_kendaraan_id,
				kkd.jarak_tempuh as jarak_tempuh,
				kkd.harga_bbm as harga_bbm,
				kb.id as kunjungan_bayar_id,
				kkd.nama as nama,
				kb.hak_id as hak_id,
				kb.nama as kolom,
				kb.biaya_bhp+kb.biaya_jasa as biaya,
				kb.bayar_bhp+kb.bayar_jasa as bayar
			FROM
				kunjungan_kendaraan kkd
				JOIN kunjungan_bayar kb ON (kb.kunjungan_kendaraan_id = kkd.id)
			WHERE
				kkd.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY 
				kkd.id, kb.id
			ORDER BY
				kkd.id, kb.id
		";
		$kon->sql = $sqlkd;
		$kon->execute();
		$data_kd = $kon->getAll();

         //get obat
             $kon->sql = "SELECT db_apotek.resep_head.param_no, db_apotek.resep_head.tgl FROM db_apotek.resep_head.resep_head WHERE LAST_INSERT_ID(db_apotek.resep_head.param_no) 
                        and db_apotek.resep_head.no_resep like 'RRJ%' ORDER BY db_apotek.resep_head.id DESC LIMIT 1";
             $kon->execute();
             $data_obat = $kon->getOne();
        
            $tanggal_sekarang=date("d/m/Y");
            //$month=substr($rp['tgl'],3,2);
            $date=date("m");
            
            $tgl = substr($data_obat['tgl'],3,2);
            
            
            if ($tgl == $date)
            {
            	$temp = $data_obat['param_no'];
            	$count = $temp + 1;
            }
            else
            {
            	$temp = 1;
            	$count = $temp;
            }
            
            //cek untuk ketersediaan record
            if (!$data_obat)
            {
            	$temp = 1;
            	$count = $temp;
            }
            
            
            $digit1 = (int) ($count % 10);
            $digit2 = (int) (($count % 100) / 10);
            $digit3 = (int) (($count % 1000) / 100);
            $digit4 = (int) (($count % 10000) / 1000);       
            
            
            $kd="RUGD/";
            	
            $no_resep = $kd . date("dmy")."$digit7" . "$digit6" . "$digit5" . "$digit4" . "$digit3" . "$digit2" . "$digit1";
            $param_no = $count;   


		$skr = date("Y-m-d");
		$usia = hitungUmur($data[tgl_lahir], $skr);
		$umur = empty($usia[tahun])?"":$usia[tahun] . " th  ";
		$umur .= empty($usia[bulan])?"":$usia[bulan] . " bl  ";
		$umur .= empty($usia[hari])?"":$usia[hari] . " hr  ";
		
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		//info utama
         $objResponse->addAssign("input_pasien_id", "value", $data[pasien_id]);
         $objResponse->addAssign("input_param_no", "value", $param_no);
         $objResponse->addAssign("input_no_resep", "value", $no_resep);
         $objResponse->addAssign("no_resep", "innerHTML", $no_resep);
		$objResponse->addAssign("input_no_rm", "innerHTML", $data[no_rm]);
		$objResponse->addAssign("input_pasien", "innerHTML", $data[nama]);
		$objResponse->addAssign("input_sex", "innerHTML", $data[sex]);
		$objResponse->addAssign("input_usia", "innerHTML", $umur);
		$objResponse->addAssign("input_cara_masuk", "innerHTML", $data[cara_masuk]);
		$objResponse->addAssign("input_cara_bayar", "innerHTML", $data[cara_bayar]);
		$objResponse->addAssign("input_id_kunjungan_kamar", "value", $data[id_kunjungan_kamar]);
		$objResponse->addAssign("input_id_kunjungan", "value", $data[id_kunjungan]);
		$objResponse->addAssign("icopim_kelas", "value", $data[kelas]);
		
		$objResponse->addAssign("input_kunjungan_ke", "innerHTML", $data[kunjungan_ke]);
		$objResponse->addAssign("input_spesialisasi", "innerHTML", $data[spesialisasi]);
		$objResponse->addScriptCall("xajax_ref_get_dokter_from_kamar", "input_dokter_id", $data[id_kamar], $data[id_dokter]);

		//set default
		$kelanjutan = empty($data[kelanjutan])?"PULANG":$data[kelanjutan];
		$objResponse->addAssign("input_kelanjutan", "value", $kelanjutan);
		$keadaan_keluar = empty($data[keadaan_keluar])?"SEMBUH":$data[keadaan_keluar];
		$objResponse->addAssign("input_keadaan_keluar", "value", $keadaan_keluar);

		//tanggal keluar
		$tgl_keluar = explode("-", $data[tgl_keluar]);
		$objResponse->addAssign("input_tgl_keluar_thn", "value", $tgl_keluar[2]);
		$objResponse->addAssign("input_tgl_keluar_bln", "value", $tgl_keluar[1]);
		$objResponse->addAssign("input_tgl_keluar_tgl", "value", $tgl_keluar[0]);
		$wkt_keluar = explode(":", $data[wkt_keluar]);
		$objResponse->addAssign("input_tgl_keluar_jam", "value", $wkt_keluar[0]);
		$objResponse->addAssign("input_tgl_keluar_mnt", "value", $wkt_keluar[1]);

		$objResponse->addAssign("input_tgl_daftar", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));
		$objResponse->addAssign("input_tgl_periksa", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));

		//tab diagnosa_tindakan
		$objResponse->addAssign("input_diagnosa_utama", "value", $data[diagnosa_utama_id]);
		$objResponse->addAssign("input_diagnosa_utama_nama", "innerHTML", $data[diagnosa_utama_nama]);

		if(!empty($data_kc)) $objResponse->addScriptCall("xajax_get_karcis_from_kunjungan", $data_kc);
		if(!empty($data_bhp)) $objResponse->addScriptCall("xajax_get_bhp_from_kunjungan", $data_bhp);
		if(!empty($data_ic)) $objResponse->addScriptCall("xajax_get_icopim_from_kunjungan", $data_ic);
		if(!empty($data_kd)) {
			$objResponse->addScriptCall("xajax_get_kendaraan_from_kunjungan", $data_kd);
			$objResponse->addAssign("input_harga_bbm", "value", $data_kd[0][harga_bbm]);
			$objResponse->addAssign("input_jarak_tempuh", "value", $data_kd[0][jarak_tempuh]);
		} else {
			$objResponse->addAssign("input_harga_bbm", "value", $_SESSION[setting][harga_bbm]);
			$objResponse->addClear("input_jarak_tempuh", "value");
		}

		//tampilkan modal window input kunjungan
		$objResponse->addClear("modal_kunjungan", "style.display");
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		$objResponse->addScriptCall("fokus", "input_dokter_id");
		return $objResponse;
	}
	function buka_langsung_bayar($idkw) {
		unset($_SESSION[kasir][kunjungan][jasa_cetak]);
		$kon = new Konek;
		//$kon->debug = 1;
		$objResponse = new xajaxResponse;
		//get data pasien
		$sql = "
			SELECT
				k.id as kunjungan_id,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as id_display,
				p.nama as nama,
				p.tgl_lahir as tgl_lahir,
				CONCAT(p.alamat, ' ', IF(p.rt = '','',CONCAT(' RT ', p.rt)), IF(p.rw = '','',CONCAT(' RW ', p.rw)), ', ', des.nama, ', ', kec.nama, ', ', kab.nama) as alamat,
				kk.tgl_daftar as tgl_daftar,
				kk.tgl_periksa as tgl_periksa,
				pel.nama as nama_pelayanan,
				p.sex as jk,
				CONCAT_WS(' - ', kk.cara_bayar, kk.jenis_askes, rper.nama) as cara_bayar,
				kk.nomor as nomor
			FROM
				kunjungan_kamar kk
				JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				JOIN kunjungan_bayar kb ON (kb.kunjungan_kamar_id = kk.id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
				JOIN kwitansi kw ON (kw.id = kwd.kwitansi_id)
				JOIN ref_desa des ON (des.id = p.desa_id)
				JOIN ref_kecamatan kec ON (kec.id = des.kecamatan_id)
				JOIN ref_kabupaten kab ON (kab.id = kec.kabupaten_id)
				JOIN ref_propinsi prop ON (prop.id = kab.propinsi_id)
				LEFT JOIN ref_perusahaan rper ON (rper.id = kk.perusahaan_id)
			WHERE
				kw.id = '".$idkw."'
			GROUP BY
				p.id
		";
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$kon->sql = $sql;
		$kon->execute();
		$data_pasien = $kon->getOne();
		$arr_usia = hitungUmur($data_pasien[tgl_lahir], $data_pasien[tgl_periksa]);
		$data_pasien[usia] = empty($arr_usia[tahun])?"":$arr_usia[tahun] . " thn ";
		$data_pasien[usia] .= empty($arr_usia[bulan])?"":$arr_usia[bulan] . " bln ";
		$data_pasien[usia] .= empty($arr_usia[hari])?"":$arr_usia[hari] . " hr ";
		$objResponse->addClear("modal_lb", "style.display");
		$objResponse->addAssign("lb_id_kunjungan", "value", $data_pasien[kunjungan_id]);
		$objResponse->addAssign("lb_id_kwitansi", "value", $idkw);
		$objResponse->addAssign("lb_no_rm", "innerHTML", $data_pasien[id_display]);
		$objResponse->addAssign("lb_pasien", "innerHTML", $data_pasien[nama]);
		$objResponse->addAssign("lb_sex", "innerHTML", $data_pasien[jk]);
		$objResponse->addAssign("lb_usia", "innerHTML", $data_pasien[usia]);
		$objResponse->addAssign("lb_alamat", "innerHTML", $data_pasien[alamat]);
		$objResponse->addAssign("lb_tgl_daftar", "innerHTML", tanggalIndo($data_pasien[tgl_daftar], 'j F Y'));
		$objResponse->addAssign("lb_cara_bayar", "innerHTML", $data_pasien[cara_bayar]);
		$objResponse->addAssign("lb_nomor", "innerHTML", empty($data_pasien[nomor])?"-":$data_pasien[nomor]);
	
		//BIKIN SESSION UNTUK DICETAK
		$_SESSION[igd][langsung_bayar][data_px] = $data_pasien;

		$tabel = new Table;
		$tabel->cellspacing = "0";
		$tabel->scroll = false;
		$tabel->extra_table = "style=\"width:9cm;\"";
		$tabel->addTh("No", "Jasa", "Biaya");
		$tabel->addExtraTh("style=\"width:0.7cm;\"", "style=\"width:6.5cm;\"", "");
		//get data karcis
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp+kb.bayar_jasa as bayar,
				kb.mampu_bayar_bhp+kb.mampu_bayar_jasa as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
			WHERE
				kb.karcis_id IS NOT NULL
				AND kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_karcis = $kon->getAll();
		if(!empty($data_karcis)) {
			$tabel->addRow("","<b>Karcis</b>","");
			for($i=0;$i<sizeof($data_karcis);$i++) {
				$tabel->addRow(
					($i+1),
					$data_karcis[$i][nama],
					uangIndo($data_karcis[$i][bayar])
				);
				$total += $data_karcis[$i][bayar];
				$sudah_dibayar += $data_karcis[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_karcis[$i][bayar]-$data_karcis[$i][mampu_bayar];
			}
		}

		//get data tindakan
		$kon->sql = "
			SELECT
				kki.nama as nama,
				SUM(kb.bayar_jasa) as bayar,
				SUM(kb.mampu_bayar_jasa) as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_kamar_icopim kki 
				JOIN kunjungan_bayar kb ON (kb.kunjungan_kamar_icopim_id = kki.id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
				JOIN kunjungan_kamar kk ON (kk.id = kki.kunjungan_kamar_id)
			WHERE
				kb.icopim_detil_id IS NOT NULL
				AND kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kki.id
			ORDER BY kki.id
		";
		$kon->execute();
		$data_tindakan = $kon->getAll();
		if(!empty($data_tindakan)) {
			$tabel->addRow("","<b>Tindakan</b>","");
			for($i=0;$i<sizeof($data_tindakan);$i++) {
				$tabel->addRow(
					($i+1),
					$data_tindakan[$i][nama],
					uangIndo($data_tindakan[$i][bayar])
				);
				$total += $data_tindakan[$i][bayar];
				$sudah_dibayar += $data_tindakan[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_tindakan[$i][bayar]-$data_tindakan[$i][mampu_bayar];
			}
		}

		//get data specimen
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp+kb.bayar_jasa as bayar,
				kb.mampu_bayar_bhp+kb.mampu_bayar_jasa as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN lab_kunjungan lk ON (lk.id = kb.lab_kunjungan_id)
				JOIN kunjungan_kamar kk ON (kk.id = lk.kunjungan_kamar_id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.lab_specimen_id IS NOT NULL
				AND kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_specimen = $kon->getAll();
		if(!empty($data_specimen)) {
			$tabel->addRow("","<b>Pemeriksaan Specimen</b>","");
			for($i=0;$i<sizeof($data_specimen);$i++) {
				$tabel->addRow(
					($i+1),
					$data_specimen[$i][nama],
					uangIndo($data_specimen[$i][bayar])
				);
				$total += $data_specimen[$i][bayar];
				$sudah_dibayar += $data_specimen[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_specimen[$i][bayar]-$data_specimen[$i][mampu_bayar];
			}
		}

		//get data radio
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp+kb.bayar_jasa as bayar,
				kb.mampu_bayar_bhp+kb.mampu_bayar_jasa as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN radio_kunjungan lk ON (lk.id = kb.lab_kunjungan_id)
				JOIN kunjungan_kamar kk ON (kk.id = lk.kunjungan_kamar_id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.radio_specimen_id IS NOT NULL
				AND kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_radio = $kon->getAll();
		if(!empty($data_radio)) {
			$tabel->addRow("","<b>Pemeriksaan Radiologi</b>","");
			for($i=0;$i<sizeof($data_radio);$i++) {
				$tabel->addRow(
					($i+1),
					$data_radio[$i][nama],
					uangIndo($data_radio[$i][bayar])
				);
				$total += $data_radio[$i][bayar];
				$sudah_dibayar += $data_radio[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_radio[$i][bayar]-$data_radio[$i][mampu_bayar];
			}
		}

		//get data bhp
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp as bayar,
				kb.mampu_bayar_bhp as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.bhp_id IS NOT NULL
				AND kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();
		if(!empty($data_bhp)) {
			$tabel->addRow("","<b>Bahan Habis Pakai</b>","");
			for($i=0;$i<sizeof($data_bhp);$i++) {
				$tabel->addRow(
					($i+1),
					$data_bhp[$i][nama],
					uangIndo($data_bhp[$i][bayar])
				);
				$total += $data_bhp[$i][bayar];
				$sudah_dibayar += $data_bhp[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_bhp[$i][bayar]-$data_bhp[$i][mampu_bayar];
			}
		}

		//get data kendaraan
		$kon->sql = "
			SELECT
				kkd.nama as nama,
				SUM(kb.bayar_bhp+kb.bayar_jasa) as bayar,
				SUM(kb.mampu_bayar_bhp+kb.mampu_bayar_jasa) as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_kendaraan kkd 
				JOIN kunjungan_bayar kb ON (kb.kunjungan_kendaraan_id = kkd.id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
			WHERE
				kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kkd.id
			ORDER BY kkd.id
		";
		$kon->execute();
		$data_kendaraan = $kon->getAll();
		if(!empty($data_kendaraan)) {
			$tabel->addRow("","<b>Sewa Kendaraan</b>","");
			for($i=0;$i<sizeof($data_kendaraan);$i++) {
				$tabel->addRow(
					($i+1),
					$data_kendaraan[$i][nama],
					uangIndo($data_kendaraan[$i][bayar])
				);
				$total += $data_kendaraan[$i][bayar];
				$sudah_dibayar += $data_kendaraan[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_kendaraan[$i][bayar]-$data_kendaraan[$i][mampu_bayar];
			}
		}

		$tabel->addRow("","<b>Total</b>", uangIndo($total));
		$tabel_jasa = $tabel->build();
		$objResponse->addAssign("lb_list_jasa", "innerHTML", $tabel_jasa);

		$objResponse->addAssign("lb_total_display", "value", uangIndo($total));
		$objResponse->addAssign("lb_total_display", "title", terbilang($total));
		$objResponse->addAssign("lb_sudah_dibayar", "value", $sudah_dibayar);
		$objResponse->addAssign("lb_sudah_dibayar_display", "value", uangIndo($sudah_dibayar));
		$objResponse->addAssign("lb_sudah_dibayar_display", "title", terbilang($sudah_dibayar));
		$objResponse->addAssign("lb_kurang_display", "value", uangIndo($kurang));
		$objResponse->addAssign("lb_kurang", "value", $kurang);
		$objResponse->addAssign("lb_kurang_display", "title", terbilang($kurang));
		$objResponse->addAssign("lb_mampu_bayar", "value", $kurang);
		$objResponse->addAssign("mampu_terbilang", "innerHTML", terbilang($kurang));
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		$objResponse->addScriptCall("fokus", "lb_mampu_bayar");

		//get data kwitansi :
		$kon->sql = "
			SELECT
				CONCAT_WS('-', kw.tempat_pembayaran, kw.id) as no_kwitansi,
				kw.bayar as mampu_bayar,
				kw.tgl as tgl
			FROM
				kunjungan_bayar kb
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
				JOIN kwitansi kw ON (kw.id = kwd.kwitansi_id)
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
			WHERE
				kw.id = '".$idkw."'
			GROUP BY
				kw.id
			ORDER BY 
				kw.id
		";
		$kon->execute();
		$data_kw = $kon->getAll();

		if($kurang) {
			//ada yang belum dibayar
			$objResponse->addAssign("lb_simpan", "style.display", "");
		}

		if(!empty($data_kw)) {
			//ada yang sudah dibayar
			for($i=0;$i<sizeof($data_kw);$i++) {
				$kw .= "<br /><input type=\"button\" name=\"lb_cetak\" id=\"lb_cetak\" value=\"Cetak Kwitansi ".$data_kw[$i][no_kwitansi]."\" class=\"inputan\" onclick=\"cetak_kwitansi('".$data_kw[$i][no_kwitansi]."');\" /> <br /> <em>Rp.&nbsp;".uangIndo($data_kw[$i][mampu_bayar])."&nbsp;-&nbsp;".tanggalIndo($data_kw[$i][tgl], "j F Y H:i")."</em><br />";
			}
			$objResponse->addAssign("fieldset_lb_button_kwitansi", "style.display", "");
			$objResponse->addAssign("lb_button_kwitansi", "innerHTML", $kw);
			if(!$kurang) $objResponse->addAssign("lb_simpan", "style.display", "none");
		} else {
			$objResponse->addAssign("fieldset_lb_button_kwitansi", "style.display", "none");
		}

		return $objResponse;
	}
Exemplo n.º 3
0
	function buka_kunjungan($id_kunjungan_lab) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$sql = "
			SELECT 
				lk.kunjungan_kamar_id as kunjungan_kamar_id,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				p.sex as sex,
				p.tgl_lahir as tgl_lahir,
				DATE(lk.tgl_daftar) as tgl_daftar,
				DATE(lk.tgl_periksa) as tgl_periksa,
				lk.kelas as kelas,
				lk.pengirim as pengirim,
				CONCAT_WS(' - ', lk.cara_masuk, kmr.nama) as cara_masuk,
				CONCAT_WS(' - ', lk.cara_bayar, lk.jenis_askes, rper.nama) as cara_bayar
			FROM 
				lab_kunjungan lk
				JOIN pasien p ON (p.id = lk.pasien_id)
				LEFT JOIN kunjungan_kamar kk ON (kk.id = lk.kunjungan_kamar_id)
				LEFT JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				LEFT JOIN ref_perusahaan rper ON (rper.id = lk.perusahaan_id)
			WHERE
				lk.id = '".$id_kunjungan_lab."'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getOne();

		//get data specimen
		$kon->sql = "
			SELECT
				id as kunjungan_bayar_id,
				nama as nama,
				hak_id as hak_id,
				jumlah as jumlah,
				biaya_bhp as biaya_bhp,
				biaya_jasa as biaya_jasa,
				bayar_bhp as bayar_bhp,
				bayar_jasa as bayar_jasa
			FROM
				kunjungan_bayar
			WHERE
				lab_kunjungan_id = '".$id_kunjungan_lab."'
				AND lab_specimen_id IS NOT NULL
			GROUP BY 
				id
		";
		$kon->execute();
		$data_spc = $kon->getAll();
		
		//get data BHP
		$kon->sql = "
			SELECT
				id as kunjungan_bayar_id,
				nama as nama,
				hak_id as hak_id,
				jumlah as jumlah,
				sifat as sifat,
				biaya_bhp as biaya,
				bayar_bhp as bayar
			FROM
				kunjungan_bayar
			WHERE
				lab_kunjungan_id = '".$id_kunjungan_lab."'
				AND bhp_id IS NOT NULL
			GROUP BY 
				id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();


		$skr = date("Y-m-d");
		$usia = hitungUmur($data[tgl_lahir], $skr);
		$umur = empty($usia[tahun])?"":$usia[tahun] . "&nbsp;th&nbsp;&nbsp;";
		$umur .= empty($usia[bulan])?"":$usia[bulan] . "&nbsp;bl&nbsp;&nbsp;";
		$umur .= empty($usia[hari])?"":$usia[hari] . "&nbsp;hr&nbsp;&nbsp;";
		
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		//info utama
		$objResponse->addAssign("input_no_rm", "innerHTML", $data[no_rm]);
		$objResponse->addAssign("input_pasien", "innerHTML", $data[nama]);
		$objResponse->addAssign("input_sex", "innerHTML", $data[sex]);
		$objResponse->addAssign("input_usia", "innerHTML", $umur);
		$objResponse->addAssign("input_cara_masuk", "innerHTML", $data[cara_masuk]);
		$objResponse->addAssign("input_cara_bayar", "innerHTML", $data[cara_bayar]);
		$objResponse->addAssign("input_id_kunjungan_lab", "value", $id_kunjungan_lab);
		$objResponse->addAssign("input_id_kunjungan_kamar", "value", $data[kunjungan_kamar_id]);
		$objResponse->addAssign("input_kelas", "value", $data[kelas]);
		$objResponse->addAssign("display_kelas", "innerHTML", $data[kelas]);
		$objResponse->addAssign("kelas", "value", $data[kelas]);
		
		$objResponse->addAssign("input_kunjungan_ke", "innerHTML", $data[kunjungan_ke]);
		$objResponse->addAssign("input_spesialisasi", "innerHTML", $data[spesialisasi]);
		$objResponse->addScriptCall("xajax_ref_get_dokter_from_kamar", "input_dokter_id", $data[id_kamar], $data[id_dokter]);

		$objResponse->addAssign("input_tgl_daftar", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));
		$objResponse->addAssign("input_tgl_periksa", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));
		$objResponse->addAssign("input_pengirim", "innerHTML", $data[pengirim]);


		if(!empty($data_spc)) $objResponse->addScriptCall("xajax_get_specimen_from_kunjungan", $data_spc);
		if(!empty($data_bhp)) $objResponse->addScriptCall("xajax_get_bhp_from_kunjungan", $data_bhp);

		//tampilkan modal window input kunjungan
		$objResponse->addClear("modal_kunjungan", "style.display");
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		$objResponse->addScriptCall("fokus", "input_dokter_id");
		return $objResponse;
	}
Exemplo n.º 4
0
	function buka_langsung_bayar($idkk) {
		unset($_SESSION[igd][langsung_bayar]);
		$kon = new Konek;
		//$kon->debug = 1;
		$objResponse = new xajaxResponse;
		//get data pasien
		$kon->sql = "
			SELECT
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as id_display,
				p.nama as nama,
				p.tgl_lahir as tgl_lahir,
				CONCAT(p.alamat, ' ', IF(p.rt = '','',CONCAT(' RT ', p.rt)), IF(p.rw = '','',CONCAT(' RW ', p.rw)), ', ', des.nama, ', ', kec.nama, ', ', kab.nama) as alamat,
				kk.tgl_periksa as tgl_periksa,
				CONCAT_WS(' - ', pel.jenis, pel.nama) as nama_pelayanan,
				p.sex as jk,
				CONCAT_WS(' - ', kk.cara_bayar, kk.jenis_askes, rper.nama) as cara_bayar,
				kk.nomor as nomor
			FROM
				kunjungan_kamar kk
				JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				JOIN ref_desa des ON (des.id = p.desa_id)
				JOIN ref_kecamatan kec ON (kec.id = des.kecamatan_id)
				JOIN ref_kabupaten kab ON (kab.id = kec.kabupaten_id)
				JOIN ref_propinsi prop ON (prop.id = kab.propinsi_id)
				LEFT JOIN ref_perusahaan rper ON (rper.id = kk.perusahaan_id)
			WHERE
				kk.id = '".$idkk."'
			GROUP BY
				p.id
		";
		$kon->execute();
		$data_pasien = $kon->getOne();
		$arr_usia = hitungUmur($data_pasien[tgl_lahir], $data_pasien[tgl_periksa]);
		$data_pasien[usia] = empty($arr_usia[tahun])?"":$arr_usia[tahun] . " thn ";
		$data_pasien[usia] .= empty($arr_usia[bulan])?"":$arr_usia[bulan] . " bln ";
		$data_pasien[usia] .= empty($arr_usia[hari])?"":$arr_usia[hari] . " hr ";
		$objResponse->addClear("modal_lb", "style.display");
		$objResponse->addAssign("lb_id_kunjungan_kamar", "value", $idkk);
		$objResponse->addAssign("lb_no_rm", "innerHTML", $data_pasien[id_display]);
		$objResponse->addAssign("lb_pasien", "innerHTML", $data_pasien[nama]);
		$objResponse->addAssign("lb_sex", "innerHTML", $data_pasien[jk]);
		$objResponse->addAssign("lb_usia", "innerHTML", $data_pasien[usia]);
		$objResponse->addAssign("lb_alamat", "innerHTML", $data_pasien[alamat]);
		$objResponse->addAssign("lb_tgl_periksa", "innerHTML", tanggalIndo($data_pasien[tgl_periksa], 'j F Y'));
		$objResponse->addAssign("lb_cara_bayar", "innerHTML", $data_pasien[cara_bayar]);
		$objResponse->addAssign("lb_pelayanan", "innerHTML", $data_pasien[nama_pelayanan]);
		$objResponse->addAssign("lb_nomor", "innerHTML", empty($data_pasien[nomor])?"-":$data_pasien[nomor]);

		//BIKIN SESSION UNTUK DICETAK
		$_SESSION[igd][langsung_bayar][data_px] = $data_pasien;

		$tabel = new Table;
		$tabel->cellspacing = "0";
		$tabel->scroll = false;
		$tabel->extra_table = "style=\"width:9cm;\"";
		$tabel->addTh("No", "Jasa", "Biaya");
		$tabel->addExtraTh("style=\"width:0.7cm;\"", "style=\"width:6.5cm;\"", "");
		//get data karcis
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp+kb.bayar_jasa as bayar,
				kb.mampu_bayar_bhp+kb.mampu_bayar_jasa as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
				LEFT JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.karcis_id IS NOT NULL
				AND kk.id = '".$idkk."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_karcis = $kon->getAll();
		if(!empty($data_karcis)) {
			$tabel->addRow("","<b>Karcis</b>","");
			for($i=0;$i<sizeof($data_karcis);$i++) {
				$tabel->addRow(
					($i+1),
					$data_karcis[$i][nama],
					uangIndo($data_karcis[$i][bayar])
				);
				$total += $data_karcis[$i][bayar];
				$sudah_dibayar += $data_karcis[$i][mampu_bayar];
				//belum bayar
				if(!$data_karcis[$i][kwitansi_id]) $kurang += $data_karcis[$i][bayar];
			}
		}

		//get data tindakan
		$kon->sql = "
			SELECT
				kki.nama as nama,
				SUM(kb.bayar_jasa) as bayar,
				SUM(kb.mampu_bayar_jasa) as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_kamar_icopim kki 
				JOIN kunjungan_bayar kb ON (kb.kunjungan_kamar_icopim_id = kki.id)
				LEFT JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.icopim_detil_id IS NOT NULL
				AND kki.kunjungan_kamar_id = '".$idkk."'
			GROUP BY
				kki.id
			ORDER BY kki.id
		";
		$kon->execute();
		$data_tindakan = $kon->getAll();
		if(!empty($data_tindakan)) {
			$tabel->addRow("","<b>Tindakan</b>","");
			for($i=0;$i<sizeof($data_tindakan);$i++) {
				$tabel->addRow(
					($i+1),
					$data_tindakan[$i][nama],
					uangIndo($data_tindakan[$i][bayar])
				);
				$total += $data_tindakan[$i][bayar];
				$sudah_dibayar += $data_tindakan[$i][mampu_bayar];
				//belum bayar
				if(!$data_tindakan[$i][kwitansi_id]) $kurang += $data_tindakan[$i][bayar];
			}
		}


		//get data bhp
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp as bayar,
				kb.mampu_bayar_bhp as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
				LEFT JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.bhp_id IS NOT NULL
				AND kk.id = '".$idkk."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();
		if(!empty($data_bhp)) {
			$tabel->addRow("","<b>Bahan Habis Pakai</b>","");
			for($i=0;$i<sizeof($data_bhp);$i++) {
				$tabel->addRow(
					($i+1),
					$data_bhp[$i][nama],
					uangIndo($data_bhp[$i][bayar])
				);
				$total += $data_bhp[$i][bayar];
				$sudah_dibayar += $data_bhp[$i][mampu_bayar];
				//belum bayar
				if(!$data_bhp[$i][kwitansi_id]) $kurang += $data_bhp[$i][bayar];
			}
		}
		
		$tabel->addRow("","<b>Total</b>", uangIndo($total));
		$tabel_jasa = $tabel->build();
		$tabel_jasa .= "<br />Terbilang : <i>" . terbilang($total) . "</i>";
		$objResponse->addAssign("lb_list_jasa", "innerHTML", $tabel_jasa);
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		return $objResponse;
	}
	function buka_edit_pindah_kamar($id_kunjungan_kamar, $id_kunjungan_kamar_stl_pindah) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		//get data bukan pindah_kamar
		$sql = "
			SELECT 
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.nama as nama,
				p.tgl_lahir as tgl_lahir,
				pel.nama as pelayanan_asal,
				p.sex as jenis_kelamin,
				d.nama as dokter_pengirim,
				rk.nomor as no_kamar,
				CONCAT(i.kode_icd, ' - ', i.nama) as diagnosa_klinik
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN ref_kamar rk ON (rk.id = kk.no_kamar)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				LEFT JOIN icd i ON (i.id = kk.diagnosa_utama_id)
				LEFT JOIN dokter d ON (d.id = kk.dokter_id)
			WHERE
				kk.id = '".$id_kunjungan_kamar."'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data_asal = $kon->getOne();

		$sql = "
			SELECT 
				k.id as id_kunjungan,
				pel.id as pelid,
				kmr.id as kamar_id,
				kk.id as id_kunjungan_kamar,
				d.id as dokter_id,
				kk.cara_bayar as cara_bayar,
					kk.jenis_askes as jenis_askes,
					kk.perusahaan_id as perusahaan_id,
				kk.nomor as nomor,
				kk.pj_nama as pj_nama,
				kk.pj_alamat as pj_alamat,
				kk.pj_telp as pj_telp,
				kk.pj_hubungan_keluarga as pj_hubungan_keluarga,
				rk.nomor as no_kamar
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN ref_kamar rk ON (rk.id = kk.no_kamar)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				LEFT JOIN icd i ON (i.id = kk.diagnosa_utama_id)
				LEFT JOIN dokter d ON (d.id = kk.dokter_id)
			WHERE
				kk.id = '".$id_kunjungan_kamar_stl_pindah."'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getOne();

		$skr = date("Y-m-d");
		$usia = hitungUmur($data_asal[tgl_lahir], $skr);
		$umur = empty($usia[tahun])?"":$usia[tahun] . "&nbsp;th&nbsp;&nbsp;";
		$umur .= empty($usia[bulan])?"":$usia[bulan] . "&nbsp;bl&nbsp;&nbsp;";
		$umur .= empty($usia[hari])?"":$usia[hari] . "&nbsp;hr&nbsp;&nbsp;";
		
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		//info utama
		$objResponse->addAssign("no_rm", "innerHTML", $data_asal[no_rm]);
		$objResponse->addAssign("pasien", "innerHTML", $data_asal[nama]);
		$objResponse->addAssign("jenis_kelamin", "innerHTML", $data_asal[jenis_kelamin]);
		$objResponse->addAssign("usia", "innerHTML", $umur);
		$objResponse->addAssign("pelayanan_asal", "innerHTML", $data_asal[pelayanan_asal]);
		$objResponse->addAssign("dokter_pengirim", "innerHTML", $data_asal[dokter_pengirim]);
		$objResponse->addAssign("diagnosa_klinik", "innerHTML", $data_asal[diagnosa_klinik]);
		//$objResponse->addAssign("no_kamar", "value", $data[no_kamar]);
		
		$objResponse->addAssign("id_kunjungan_kamar", "value", $data[id_kunjungan_kamar]);
		$objResponse->addAssign("id_kunjungan", "value", $data[id_kunjungan]);
		$objResponse->addAssign("is_edit", "value", "1");

		$objResponse->addAssign("cara_bayar", "value", $data[cara_bayar]);
			$objResponse->addScriptCall("xajax_ref_get_jenis_askes", "jenis_askes", $data[cara_bayar], $data[jenis_askes]);
			$objResponse->addScriptCall("xajax_ref_get_perusahaan", "perusahaan_id", $data[cara_bayar], $data[perusahaan_id]);
		//$objResponse->addAssign("jenis_askes", "value", $data[jenis_askes]);
		//$objResponse->addAssign("perusahaan_id", "value", $data[perusahaan_id]);
		$objResponse->addAssign("nomor", "value", $data[nomor]);
		$objResponse->addScriptCall("showNomor", $data[cara_bayar]);
		$objResponse->addAssign("pj_nama", "value", $data[pj_nama]);
		$objResponse->addAssign("pj_alamat", "value", $data[pj_alamat]);
		$objResponse->addAssign("pj_telp", "value", $data[pj_telp]);
		$objResponse->addAssign("pj_hubungan_keluarga", "value", $data[pj_hubungan_keluarga]);
		$objResponse->addScriptCall("xajax_ref_get_pelayanan", "pelayanan_id", "3", $data[pelid]);
		$objResponse->addScriptCall("xajax_ref_get_kamar", "kamar_id", $data[pelid], $data[kamar_id]);
		$objResponse->addScriptCall("xajax_ref_get_dokter", "dokter_id", $data[pelid], $data[dokter_id]);
		$objResponse->addScriptCall("xajax_ref_get_bed", "nomor", $data[pelid], $data[nomor]);
		
		//tampilkan modal window input pesan kamar
		$objResponse->addClear("modal_daftar_pindah_kamar", "style.display");
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		$objResponse->addScriptCall('fokus', 'cara_bayar');
		return $objResponse;
	}
Exemplo n.º 6
0
	function buka_tbi($idkk) {
		unset($_SESSION[ranap][kunjungan][jasa_cetak]);
		$kon = new Konek;
		//$kon->debug = 1;
		$objResponse = new xajaxResponse;
		//get data pasien
		$kon->sql = "
			SELECT
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as id_display,
				p.nama as nama,
				p.tgl_lahir as tgl_lahir,
				CONCAT(p.alamat, ' ', IF(p.rt = '','',CONCAT(' RT ', p.rt)), IF(p.rw = '','',CONCAT(' RW ', p.rw)), ', ', des.nama, ', ', kec.nama, ', ', kab.nama) as alamat,
				kk.tgl_periksa as tgl_periksa,
				pel.nama as nama_pelayanan,
				p.sex as jk,
				kk.cara_bayar as cara_bayar,
				kk.jenis_askes as jenis_askes, 
				kk.nomor as nomor
			FROM
				kunjungan_kamar kk
				JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				JOIN ref_desa des ON (des.id = p.desa_id)
				JOIN ref_kecamatan kec ON (kec.id = des.kecamatan_id)
				JOIN ref_kabupaten kab ON (kab.id = kec.kabupaten_id)
				JOIN ref_propinsi prop ON (prop.id = kab.propinsi_id)
			WHERE
				kk.id = '".$idkk."'
			GROUP BY
				p.id
		";
		$kon->execute();
		$data_pasien = $kon->getOne();
		$arr_usia = hitungUmur($data_pasien[tgl_lahir], $data_pasien[tgl_periksa]);
		$usia = empty($arr_usia[tahun])?"":$arr_usia[tahun] . " thn ";
		$usia .= empty($arr_usia[bulan])?"":$arr_usia[bulan] . " bln ";
		$usia .= empty($arr_usia[hari])?"":$arr_usia[hari] . " hr ";

		$tabel = new Table;
		$tabel->scroll = false;
		$tabel->css_table = "";
		$tabel->cellspacing = "5";
		$tabel->anime_bg_color = "";
		$tabel->extra_table = "style=\"width:10cm;\"";
		$tabel->addRow("Bangsal", $data_pasien[nama_pelayanan]);
		$tabel->addExtraTd("style=\"width:3cm\"");
		$tabel->addRow("No. RM", $data_pasien[id_display]);
		$tabel->addRow("Nama", $data_pasien[nama]);
		$tabel->addRow("Usia", $usia);
		$tabel->addRow("Jenis Kelamin", $data_pasien[jk]);
		$tabel->addRow("Alamat", $data_pasien[alamat]);
		$tabel->addRow("Tgl Periksa", tanggalIndo($data_pasien[tgl_periksa], 'j F Y'));
		$tabel->addRow("Cara Pembayaran", $data_pasien[cara_bayar]);
		$tabel->addRow("Jenis Askes", empty($data_pasien[jenis_askes])?"-":$data_pasien[jenis_askes]);
		$tabel->addRow("Nomor", empty($data_pasien[nomor])?"-":$data_pasien[nomor]);
		$tabel_pasien = $tabel->build();
		
		$tabel = new Table;
		$tabel->scroll = false;
		$tabel->extra_table = "style=\"width:10cm;\"";
		$tabel->addTh("No", "Jasa", "Harga");
		$tabel->addExtraTh("style=\"width:0.7cm;\"", "style=\"width:6.5cm;\"", "");
		//get data tindakan
		$kon->sql = "
			SELECT
				CONCAT(i.kode, ' - ', i.nama) as nama
			FROM
				icopim i 
				JOIN kunjungan_kamar_icopim kki ON (kki.icopim_id = i.id)
				JOIN kunjungan_kamar kk ON (kk.id = kki.kunjungan_kamar_id)
			WHERE
				kk.id = '".$idkk."'
			GROUP BY
				kki.id
		";
		$kon->execute();
		$data_tindakan = $kon->getAll();
		if(!empty($data_tindakan)) {
			$tabel->addRow("","<b>Tindakan</b>","");
			for($i=0;$i<sizeof($data_tindakan);$i++) {
				$tabel->addRow(
					($i+1),
					" - " . $data_tindakan[$i][nama],
					""
				);
			}
		}


		//get data bhp
		$kon->sql = "
			SELECT
				b.nama as nama
			FROM
				bhp b 
				JOIN kunjungan_kamar_bhp kkb ON (kkb.bhp_id = b.id)
				JOIN kunjungan_kamar kk ON (kk.id = kkb.kunjungan_kamar_id)
			WHERE
				kk.id = '".$idkk."'
			GROUP BY
				kkb.id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();
		if(!empty($data_bhp)) {
			$tabel->addRow("","<b>Bahan Habis Pakai</b>","");
			for($i=0;$i<sizeof($data_bhp);$i++) {
				$tabel->addRow(
					($i+1),
					" - " . $data_bhp[$i][nama],
					""
				);
			}
		}

		//get data imunisasi
		$kon->sql = "
			SELECT
				im.nama as nama
			FROM
				imunisasi im 
				JOIN kunjungan_kamar_imunisasi kkim ON (kkim.imunisasi_id = im.id)
				JOIN kunjungan_kamar kk ON (kk.id = kkim.kunjungan_kamar_id)
			WHERE
				kk.id = '".$idkk."'
			GROUP BY
				kkim.id
		";
		$kon->execute();
		$data_imunisasi = $kon->getAll();
		if(!empty($data_imunisasi)) {
			$tabel->addRow("","<b>Imunisasi</b>","");
			for($i=0;$i<sizeof($data_imunisasi);$i++) {
				$tabel->addRow(
					($i+1),
					" - " . $data_imunisasi[$i][nama],
					""
				);
			}
		}
		$tabel->addRow("","<b>Total</b>","");
		$tabel_jasa = $tabel->build();

		$modal = new Modal;
		$modal->cetak_lebar = 400;
		$modal->cetak_tinggi = 600;
		$modal->setTitle("Daftar Pemberian Tindakan, BHP, dan Imunisasi");
		$modal->setContent($tabel_pasien);
		$modal->setContent($tabel_jasa);
		$modal->setCloseButtonOnclick("tutup_daftar_tbi()");
		$modal->setPrintButtonUrl(URL . "ranap/kunjungan_jasa_cetak/");
		$modal_cnt = $modal->build();
		$_SESSION[ranap][kunjungan][jasa_cetak] = $tabel_pasien . $tabel_jasa;
		$objResponse->addClear("list_daftar_tbi", "style.display");
		$objResponse->addAssign("list_daftar_tbi", "innerHTML", $modal_cnt);
		return $objResponse;
	}
Exemplo n.º 7
0
	function buka_kunjungan($id_kunjungan_kamar) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$sql = "
			SELECT 
				k.kunjungan_ke as kunjungan_ke,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				p.sex as sex,
				p.tgl_lahir as tgl_lahir,
				kk.id as id_kunjungan_kamar,
				k.id as id_kunjungan,
				DATE(kk.tgl_daftar) as tgl_daftar,
				DATE(kk.tgl_periksa) as tgl_periksa,
				DATE(kk.tgl_keluar) as tgl_keluar,
				TIME(kk.tgl_keluar) as wkt_keluar,
				kk.dokter_id as id_dokter,
				kk.kelanjutan as kelanjutan,
				k.keadaan_keluar as keadaan_keluar,
				kmr.id as id_kamar,
				kmr.kelas as kelas,
				kmr.nama as spesialisasi,
                kk.kamar_id as kamar_id,
				kk.diagnosa_utama_id as diagnosa_utama_id,
				IF(i.id IS NULL, '&nbsp;', CONCAT(i.kode_icd, ' - ', i.nama)) as diagnosa_utama_nama,
				CONCAT_WS(' - ', k.cara_masuk, rp.nama) as cara_masuk,
				CONCAT_WS(' - ', kk.cara_bayar, kk.jenis_askes, rper.nama) as cara_bayar
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				LEFT JOIN icd i ON (i.id = kk.diagnosa_utama_id)
				LEFT JOIN ref_perujuk rp ON (rp.id = k.perujuk_id)
				LEFT JOIN ref_perusahaan rper ON (rper.id = kk.perusahaan_id)
			WHERE
				kk.id = '".$id_kunjungan_kamar."'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getOne();
/*
KARCIS :
jasa_p
jasa_rs
jasa_rs_op
jasa_rs_kembang
jasa_rs_adm
jasa_rs_sdm
spesialis
spesialis_pendamping
ugp
grabaf
perawat
penunjang
zakat
pajak
netto

BHP :
bhp_p
bhp_rs
bhp_rs_adm
bhp_rs_op

ICOPIM:
jasa_p
jasa_rs
jasa_rs_op
jasa_rs_kembang
jasa_rs_adm
jasa_rs_sdm
spesialis
spesialis_pendamping
perawat_perinatologi
dr_umum
dr_gigi
assisten_non_dokter
spesialis_anestesi
aknest
gizi
fisioterapi
analis_pa
bidan
perawat
penunjang
zakat
pajak

*/		
		//get data karcis
		$kon->sql = "
			SELECT
				id as kunjungan_bayar_id,
				karcis_id as karcis_id,
				nama as nama,
				hak_id as hak_id,
				jumlah as jumlah,
				biaya_bhp+biaya_jasa as biaya,
				bayar_bhp as bayar_bhp,
				bayar_jasa as bayar_jasa,
				DATE(tgl) as tgl
			FROM
				kunjungan_bayar
			WHERE
				kunjungan_kamar_id = '".$id_kunjungan_kamar."'
				AND karcis_id IS NOT NULL
			GROUP BY 
				id
		";
		$kon->execute();
		$data_kc = $kon->getAll();
		
		//get data tindakan
		$kon->sql = "
			SELECT
				kkic.id as kunjungan_icopim_id,
				kby.id as kunjungan_bayar_id,
				kkic.nama as nama,
				kby.nama as kolom,
				kby.hak_id as hak_id,
				kby.sifat as sifat,
				kby.biaya_jasa as biaya,
				kby.jumlah as jumlah,
				kby.bayar_jasa as bayar,
				DATE(kby.tgl) as tgl
			FROM
				kunjungan_kamar_icopim kkic
				JOIN kunjungan_bayar kby ON (kby.kunjungan_kamar_icopim_id = kkic.id)
			WHERE
				kkic.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY 
				kby.id
			ORDER BY
				kkic.id, kby.id
		";
		$kon->execute();
		$data_ic = $kon->getAll();
		
		//get data BHP
		$kon->sql = "
			SELECT
				id as kunjungan_bayar_id,
				nama as nama,
				hak_id as hak_id,
				jumlah as jumlah,
				sifat as sifat,
				biaya_bhp as biaya,
				bayar_bhp as bayar,
				DATE(tgl) as tgl,
                no_resep as resep,
                bhp_id as bhp_id
			FROM
				kunjungan_bayar
			WHERE
				kunjungan_kamar_id = '".$id_kunjungan_kamar."'
				AND bhp_id IS NOT NULL
			GROUP BY 
				id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();

        //get informasi kamar
        $kon->sql = "
                SELECT kk.kamar_id as kamar_id, k.nama as nama_kamar, k.kelas as kelas, p.nama as bangsal 
                FROM kunjungan_kamar kk, kamar k, pelayanan p
                WHERE kk.kamar_id = k.id AND k.pelayanan_id = p.id
                AND kk.kamar_id ='".$data[kamar_id]."'";

        $kon->execute();
		$data_kamar = $kon->getOne();


        $kon->sql = "SELECT * FROM db_apotek.resep_head WHERE LAST_INSERT_ID(param_no) and no_resep like 'RRI%' ORDER BY id DESC LIMIT 1";
        $kon->execute();
        $data_obat = $kon->getOne();
    
        $tanggal_sekarang=date("d/m/Y");
        //$month=substr($rp['tgl'],3,2);
        $date=date("m");
        
        $tgl = substr($data_obat['tgl'],3,2);
        
        
        if ($tgl == $date)
        {
        	$temp = $data_obat['param_no'];
        	$count = $temp + 1;
        }
        else
        {
        	$temp = 1;
        	$count = $temp;
        }
        
        //cek untuk ketersediaan record
        if (!$data_obat)
        {
        	$temp = 1;
        	$count = $temp;
        }
        
        
        $digit1 = (int) ($count % 10);
        $digit2 = (int) (($count % 100) / 10);
        $digit3 = (int) (($count % 1000) / 100);
        $digit4 = (int) (($count % 10000) / 1000);       
        
        
        $kd="RRI/";
        	
        $no_resep = $kd . date("dmy")."$digit7" . "$digit6" . "$digit5" . "$digit4" . "$digit3" . "$digit2" . "$digit1";
        $param_no = $count;   


		$skr = date("Y-m-d");
		$usia = hitungUmur($data[tgl_lahir], $skr);
		$umur = empty($usia[tahun])?"":$usia[tahun] . "&nbsp;th&nbsp;&nbsp;";
		$umur .= empty($usia[bulan])?"":$usia[bulan] . "&nbsp;bl&nbsp;&nbsp;";
		$umur .= empty($usia[hari])?"":$usia[hari] . "&nbsp;hr&nbsp;&nbsp;";
		
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		//info utama
        $objResponse->addAssign("input_pasien_id", "value", $data[pasien_id]);
        $objResponse->addAssign("input_param_no", "value", $param_no);
        $objResponse->addAssign("input_no_resep", "value", $no_resep);
        $objResponse->addAssign("no_resep", "innerHTML", $no_resep);
        $objResponse->addAssign("input_bangsal", "innerHTML", $data_kamar[bangsal]);
        $objResponse->addAssign("input_kamar", "innerHTML", $data_kamar[nama_kamar]);
        $objResponse->addAssign("input_kelas", "innerHTML", $data_kamar[kelas]);
		$objResponse->addAssign("input_no_rm", "innerHTML", $data[no_rm]);
		$objResponse->addAssign("input_pasien", "innerHTML", $data[nama]);
		$objResponse->addAssign("input_sex", "innerHTML", $data[sex]);
		$objResponse->addAssign("input_usia", "innerHTML", $umur);
		$objResponse->addAssign("input_cara_masuk", "innerHTML", $data[cara_masuk]);
		$objResponse->addAssign("input_cara_bayar", "innerHTML", $data[cara_bayar]);
		$objResponse->addAssign("input_id_kunjungan_kamar", "value", $data[id_kunjungan_kamar]);
		$objResponse->addAssign("input_id_kunjungan", "value", $data[id_kunjungan]);
		$objResponse->addAssign("icopim_kelas", "value", $data[kelas]);
		
		$objResponse->addAssign("input_kunjungan_ke", "innerHTML", $data[kunjungan_ke]);
		$objResponse->addAssign("input_spesialisasi", "innerHTML", $data[spesialisasi]);
		$objResponse->addScriptCall("xajax_ref_get_dokter_from_kamar", "input_dokter_id", $data[id_kamar], $data[id_dokter]);

		//set default
		$kelanjutan = empty($data[kelanjutan])?"PULANG":$data[kelanjutan];
		$objResponse->addAssign("input_kelanjutan", "value", $kelanjutan);
		$keadaan_keluar = empty($data[keadaan_keluar])?"SEMBUH":$data[keadaan_keluar];
		$objResponse->addAssign("input_keadaan_keluar", "value", $keadaan_keluar);

		//tanggal keluar
		$tgl_keluar = explode("-", $data[tgl_keluar]);
		$objResponse->addAssign("input_tgl_keluar_thn", "value", $tgl_keluar[2]);
		$objResponse->addAssign("input_tgl_keluar_bln", "value", $tgl_keluar[1]);
		$objResponse->addAssign("input_tgl_keluar_tgl", "value", $tgl_keluar[0]);
		$wkt_keluar = explode(":", $data[wkt_keluar]);
		$objResponse->addAssign("input_tgl_keluar_jam", "value", $wkt_keluar[0]);
		$objResponse->addAssign("input_tgl_keluar_mnt", "value", $wkt_keluar[1]);

		$objResponse->addAssign("input_tgl_daftar", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));
		$objResponse->addAssign("input_tgl_periksa", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));

		//tab diagnosa_tindakan
		$objResponse->addAssign("input_diagnosa_utama", "value", $data[diagnosa_utama_id]);
		$objResponse->addAssign("input_diagnosa_utama_nama", "innerHTML", $data[diagnosa_utama_nama]);

		if(!empty($data_kc)) $objResponse->addScriptCall("xajax_get_karcis_from_kunjungan", $data_kc);
		if(!empty($data_bhp)) $objResponse->addScriptCall("xajax_get_bhp_from_kunjungan", $data_bhp);
		if(!empty($data_ic)) $objResponse->addScriptCall("xajax_get_icopim_from_kunjungan", $data_ic);

		if(!empty($data_kc)) $objResponse->addScriptCall("xajax_show_data_pemberian_jasa", $data_kc, $data_ic, $data_bhp);
		//$idkk[input_id_kunjungan_kamar] = $data[id_kunjungan_kamar];
		//$objResponse->addScriptCall("xajax_get_total", $idkk);

		//tampilkan modal window input kunjungan
		$objResponse->addClear("modal_kunjungan", "style.display");
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		$objResponse->addScriptCall("fokus", "input_dokter_id");
		return $objResponse;
	}
Exemplo n.º 8
0
?>
</td></tr>
        <tr><td>No. Telepon:</td><td><?php 
echo $rows->telp;
?>
</td></tr>
    </table>
    </td>
    <td width="50%" colspan="9">
    <table width="100%" class="attribute">
        <tr><td width="50%">Jenis Kelamin:</td><td><?php 
echo $rows->kelamin;
?>
</td></tr>
        <tr><td>Umur:</td><td><?php 
echo hitungUmur($rows->tanggal_lahir);
?>
</td></tr>
        <tr><td>Gol. Darah:</td><td></td></tr>
    </table>
    </td>
</tr>
</table>
<table cellspacing="0" width="100%" class="list-data-print">
<tr>
    <th>Tanggal</th>
    <th>Status Resep</th>
    <th>Packing Barang</th>
    <th>Kekuatan Obat</th>
    <th>Dosis</th>
    <th>Sediaan</th>
Exemplo n.º 9
0
	function get_lap_rl2b1($val) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$sql = "
			SELECT
				MIN(kk.id),
				i.id as icd_id,
				i.no_dtd as no_dtd,
				i.kode_icd as kode_icd,
				i.gol_sebab_sakit as gol_sebab_sakit,
				p.tgl_lahir as tgl_lahir,
				kk.tgl_keluar as tgl_keluar,
				p.sex as sex,
				k.keadaan_keluar as keadaan_keluar,
				p.id as pasien_id
			FROM
				kunjungan_kamar kk
				JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				JOIN icd i ON (i.id = kk.diagnosa_utama_id)
			WHERE
				kk.tgl_keluar IS NOT NULL
				AND pel.jenis = 'RAWAT JALAN'
				AND kk.kelanjutan IN ('DIRUJUK', 'PULANG')
				AND EXTRACT(YEAR_MONTH FROM kk.tgl_periksa) = EXTRACT(YEAR_MONTH FROM '".$val[tahun]."-".$val[bulan]."-01')
			GROUP BY
				kk.id
			ORDER BY 
				i.id, p.id
		";
		
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();
		$baru = array();
		$s = 0;
		for($i=0;$i<sizeof($data);$i++) {
			$umur = hitungUmur($data[$i][tgl_lahir], $data[$i][tgl_keluar]);
			$umur_tahun = $umur[tahun];
			$umur_hari = $umur[hari];
			if($data[$i][no_dtd] == $data[$i-1][no_dtd]) {
				//bikin anak
				//nggabungin kode icd
				$baru[$s][jml_kjg] += 1;
				$total[jml_kjg] += 1;
				if($baru[$s][kode_icd] != $data[$i][kode_icd]) $baru[$s][kode_icd] = $baru[$s][kode_icd] . ", " . $data[$i][kode_icd];
				if($data[$s][pasien_id] != $data[$i][pasien_id]) {
					/*	kasus lama, cuma nambah jumlah kunjungan pada kolom 16 */
					if($umur[tahun] > 64) {
						$baru[$s]['nam_lima'] += 1;
						$total['nam_lima'] += 1;
					} elseif ($umur[tahun] > 44) {
						$baru[$s]['pat_lima'] += 1;
						$total['pat_lima'] += 1;
					} elseif ($umur[tahun] > 24) {
						$baru[$s]['dua_lima'] += 1;
						$total['dua_lima'] += 1;
					} elseif ($umur[tahun] > 14) {
						$baru[$s]['lima_belas'] += 1;
						$total['lima_belas'] += 1;
					} elseif ($umur[tahun] > 4) {
						$baru[$s]['lima'] += 1;
						$total['lima'] += 1;
					} elseif ($umur[tahun] >=1) {
						$baru[$s]['satu'] += 1;
						$total['satu'] += 1;
					} elseif ($umur[hari] > 27) {
						$baru[$s]['dua_lapan'] += 1;
						$total['dua_lapan'] += 1;
					} else {
						$baru[$s]['nol'] += 1;
						$total['nol'] += 1;
					}
					//sex
					if($data[$i][sex] == "LAKI-LAKI") {
						$baru[$s][sex_laki] += 1;
						$total['sex_laki'] += 1;
						$total['total'] += 1;
					} else {
						$baru[$s][sex_prp] += 1;
						$total['sex_prp'] += 1;
						$total['total'] += 1;
					}
					$baru[$s][total] = $baru[$s][sex_prp] + $baru[$s][sex_laki];
				}
			} else {
				//bikin embok
				if($i!=0) {
					$s++;
				}
				$baru[$s][pasien_id] = $data[$i][pasien_id];
				$baru[$s][no_dtd] = $data[$i][no_dtd];
				$baru[$s][kode_icd] = $data[$i][kode_icd];
				$baru[$s][gol_sebab_sakit] = $data[$i][gol_sebab_sakit];
				$baru[$s][tgl_lahir] = $data[$i][tgl_lahir];
				$baru[$s][tgl_keluar] = $data[$i][tgl_keluar];
				if($umur[tahun] > 64) {
					$baru[$s]['nam_lima'] = 1;
					$total['nam_lima'] += 1;
				} elseif ($umur[tahun] > 44) {
					$baru[$s]['pat_lima'] = 1;
					$total['pat_lima'] += 1;
				} elseif ($umur[tahun] > 24) {
					$baru[$s]['dua_lima'] = 1;
					$total['dua_lima'] += 1;
				} elseif ($umur[tahun] > 14) {
					$baru[$s]['lima_belas'] = 1;
					$total['lima_belas'] += 1;
				} elseif ($umur[tahun] > 4) {
					$baru[$s]['lima'] = 1;
					$total['lima'] += 1;
				} elseif ($umur[tahun] >=1) {
					$baru[$s]['satu'] = 1;
					$total['satu'] += 1;
				} elseif ($umur[hari] > 27) {
					$baru[$s]['dua_lapan'] = 1;
					$total['dua_lapan'] += 1;
				} else {
					$baru[$s]['nol'] = 1;
					$total['nol'] += 1;
				}

				//sex
				if($data[$i][sex] == "LAKI-LAKI") {
					$baru[$s][sex_laki] = 1;
					$total['sex_laki'] += 1;
					$total['total'] += 1;
				} else {
					$baru[$s][sex_prp] = 1;
					$total['sex_prp'] += 1;
					$total['total'] += 1;
				}
				$baru[$s][total] = $baru[$s][sex_prp] + $baru[$s][sex_laki];
				$baru[$s][jml_kjg] = 1;
				$total[jml_kjg] += 1;
			}
			
		}
		$tabel_all = new Table;
		$tabel_all->scroll = false;
		$tabel_all->extra_table = "style=\"width:27cm;margin:0\"";
		$tabel_all->cellspacing="0";
		$tabel_all->css_table="";
		$tabel_all->anime_bg_color="";
		$tabel_header = new Table;
		$tabel_header->scroll = false;
		$tabel_header->extra_tr_th = "";
		$tabel_header->cellspacing="0";
		$tabel_header->css_table="";
		$tabel_header->anime_bg_color="";
		$tabel_header->extra_table = "style=\"width:27cm;border:0;\"";
		$tabel_header->addTh("","DATA KEADAAN MORBIDITAS RAWAT JALAN SURVEILANS TERPADU RUMAH SAKIT<br />BULAN : ".bulanIndo($val[bulan], "F")."<br />TAHUN : ".$val[tahun],"");
		//$tabel_header->addExtraTh("colspan=\"3\"");
		$tabel_header->addRow("","","Formulir RL2b1");
		//$tabel_header->addExtraTh();
		$tabel_header->addRow($_SESSION[setting][rs_nama], "", "No. Kode RS : " . $_SESSION[setting][rs_kode]);
		//$tabel_header->addExtraTh("colspan=\"3\"");

		$tabel_isi = new Table;
		$tabel_isi->scroll = false;
		$tabel_isi->cellspacing="0";
		$tabel_isi->extra_table = "style=\"width:27cm;font-size:7pt;\"";
		$tabel_header->css_table="";
		$tabel_isi->addTh(
			"NO. URUT", 
			"NO. DTD", 
			"NO. DAFTAR TERPERINCI", 
			"GOLONGAN SEBAB-SEBAB SAKIT", 
			"KASUS BARU MENURUT GOLONGAN UMUR", 
			"KASUS BARU MENURUT SEX", 
			"JUMLAH KASUS BARU<br />(13 + 14)", 
			"JUMLAH KUNJUNGAN"
		);
		$tabel_isi->addExtraTh("rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "colspan=\"8\"", "colspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"");
		$tabel_isi->addTh("0-28 HR", "28 HR - &lt;1 TH", "1-4 TH", "5-14 TH", "15-24 TH", "25-44 TH", "45-64 TH", "65+ TH", "LK", "PR");
		$tabel_isi->addTh("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16");
		for($i=0;$i<sizeof($baru);$i++) {
			$tabel_isi->addRow(
				($i+1),
				$baru[$i][no_dtd],
				$baru[$i][kode_icd],
				$baru[$i][gol_sebab_sakit],
				$baru[$i][nol],
				$baru[$i][dua_lapan],
				$baru[$i][satu],
				$baru[$i][lima],
				$baru[$i][lima_belas],
				$baru[$i][dua_lima],
				$baru[$i][pat_lima],
				$baru[$i][nam_lima],
				$baru[$i][sex_laki],
				$baru[$i][sex_prp],
				$baru[$i][total],
				$baru[$i][jml_kjg]
			);
		}
		$tabel_isi->addRow(
			"","","","Total", 
			$total[nol], 
			$total[dua_lapan], 
			$total[satu], 
			$total[lima], 
			$total[lima_belas], 
			$total[dua_lima], 
			$total[pat_lima], 
			$total[nam_lima], 
			$total[sex_laki], 
			$total[sex_prp], 
			$total[total], 
			$total[jml_kjg]
		);
		$ret_tabel_header = $tabel_header->build();
		$ret_tabel_isi = $tabel_isi->build();
		$tabel_all->addRow($ret_tabel_header);
		$tabel_all->addRow($ret_tabel_isi);
		$ret = $tabel_all->build();
		unset($_SESSION[rekmed][lap_rl2b1]);
		$cetak = new Cetak;
		$tanda_tangan = $cetak->setTandaTangan();
		$ret .= $tanda_tangan;
		$_SESSION[rekmed][lap_rl2b1] = $ret;
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}
Exemplo n.º 10
0
	function buka_kunjungan($id_kunjungan_kamar) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$sql = "
			SELECT 
				k.id as id_kunjungan,
				k.kunjungan_ke as kunjungan_ke,
				k.cara_masuk as cara_masuk,
				kk.cara_bayar as cara_bayar,
				k.perujuk_id as perujuk_id,
				kk.nomor as nomor,
				kk.pj_nama as pj_nama,
				kk.pj_alamat as pj_alamat,
				kk.pj_telp as pj_telp,
				kk.pj_hubungan_keluarga as pj_hubungan_keluarga,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				p.tgl_lahir as tgl_lahir,
				p.sex as jk,
				kk.id as id_kunjungan_kamar,
				DATE_FORMAT(kk.tgl_daftar, '%Y-%m-%d-%H-%i-%s') as tgl_daftar,
				DATE_FORMAT(kk.tgl_periksa, '%Y-%m-%d-%H-%i-%s') as tgl_periksa,
				DATE_FORMAT(kk.tgl_keluar, '%Y-%m-%d-%H-%i-%s') as tgl_keluar,
				kk.dokter_id as id_dokter,
				kk.kelanjutan as kelanjutan,
				kmr.id as id_kamar,
				pel.id as id_pelayanan,
				pel.jenis as jenis,
				
				kk.diagnosa_utama_id as diagnosa_utama_id,
				IF(i.id IS NULL, '&nbsp;', CONCAT(i.kode_icd, ' - ', i.nama)) as diagnosa_utama_nama
				
				
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)

				LEFT JOIN icd i ON (i.id = kk.diagnosa_utama_id)
			WHERE
				kk.id = '".$id_kunjungan_kamar."'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getOne();
		
		//get data tindakan
		$kon->sql = "
			SELECT
				kkic.id as kunjungan_tindakan_id,
				ic.id as tindakan_id,
				ic.nama as tindakan_nama
			FROM
				kunjungan_kamar_icopim kkic
				JOIN icopim ic ON (ic.id = kkic.icopim_id)
			WHERE
				kkic.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY 
				kkic.id
		";
		$kon->execute();
		$data_ic = $kon->getAll();

		
		//get data BHP
		$kon->sql = "
			SELECT
				kkbhp.id as kunjungan_bhp_id,
				bhp.id as bhp_id,
				bhp.nama as bhp_nama
			FROM
				kunjungan_kamar_bhp kkbhp
				JOIN bhp ON (bhp.id = kkbhp.bhp_id)
			WHERE
				kkbhp.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY 
				kkbhp.id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();
/*
		//get data im
		$kon->sql = "
			SELECT
				kki.id as kunjungan_imunisasi_id,
				im.id as imunisasi_id,
				im.nama as imunisasi_nama
			FROM
				kunjungan_kamar_imunisasi kki
				JOIN imunisasi im ON (im.id = kki.imunisasi_id)
			WHERE
				kki.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY
				kki.id
		";
		$kon->execute();
		$data_im = $kon->getAll();
		//$objResponse->addAlert(print_r($data_im));
*/
		$skr = date("Y-m-d");
		$usia = hitungUmur($data[tgl_lahir], $skr);
		$umur = empty($usia[tahun])?"":$usia[tahun] . "&nbsp;th&nbsp;&nbsp;";
		$umur .= empty($usia[bulan])?"":$usia[bulan] . "&nbsp;bl&nbsp;&nbsp;";
		$umur .= empty($usia[hari])?"":$usia[hari] . "&nbsp;hr&nbsp;&nbsp;";
		
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		//info utama
		$objResponse->addAssign("input_no_rm", "innerHTML", $data[no_rm]);
		$objResponse->addAssign("input_pasien", "innerHTML", $data[nama]);
		$objResponse->addAssign("input_sex", "innerHTML", $data[jk]);
		$objResponse->addAssign("input_usia", "innerHTML", $umur);
		$objResponse->addAssign("input_id_kunjungan_kamar", "value", $data[id_kunjungan_kamar]);
		$objResponse->addAssign("input_id_kunjungan", "value", $data[id_kunjungan]);

		//tab data_kunjungan
		$objResponse->addAssign("input_jenis", "value", $data[jenis]);
		$objResponse->addScriptCall("xajax_ref_get_pelayanan", "input_pelayanan_id", $data[jenis], $data[id_pelayanan]);
		$objResponse->addScriptCall("xajax_ref_get_kamar", "input_kamar_id", $data[id_pelayanan], $data[id_kamar]);
		$objResponse->addScriptCall("xajax_ref_get_dokter", "input_dokter_id", $data[id_pelayanan], $data[id_dokter]);
		$objResponse->addAssign("input_kelanjutan", "value", $data[kelanjutan]);
		
		$tgl_daftar = explode("-", $data[tgl_daftar]);
		$objResponse->addAssign("input_tgl_daftar_tgl", "value", $tgl_daftar[2]);
		$objResponse->addAssign("input_tgl_daftar_bln", "value", $tgl_daftar[1]);
		$objResponse->addAssign("input_tgl_daftar_thn", "value", $tgl_daftar[0]);

		$objResponse->addAssign("input_tgl_daftar_jam", "value", $tgl_daftar[3]);
		$objResponse->addAssign("input_tgl_daftar_mnt", "value", $tgl_daftar[4]);
		$objResponse->addAssign("input_tgl_daftar_dtk", "value", $tgl_daftar[5]);

		$tgl_periksa = explode("-", $data[tgl_periksa]);
		$objResponse->addAssign("input_tgl_periksa_tgl", "value", $tgl_periksa[2]);
		$objResponse->addAssign("input_tgl_periksa_bln", "value", $tgl_periksa[1]);
		$objResponse->addAssign("input_tgl_periksa_thn", "value", $tgl_periksa[0]);

		$objResponse->addAssign("input_tgl_periksa_jam", "value", $tgl_periksa[3]);
		$objResponse->addAssign("input_tgl_periksa_mnt", "value", $tgl_periksa[4]);
		$objResponse->addAssign("input_tgl_periksa_dtk", "value", $tgl_periksa[5]);

		$tgl_keluar = explode("-", $data[tgl_keluar]);
		$objResponse->addAssign("input_tgl_keluar_tgl", "value", $tgl_keluar[2]);
		$objResponse->addAssign("input_tgl_keluar_bln", "value", $tgl_keluar[1]);
		$objResponse->addAssign("input_tgl_keluar_thn", "value", $tgl_keluar[0]);

		$objResponse->addAssign("input_tgl_keluar_jam", "value", $tgl_keluar[3]);
		$objResponse->addAssign("input_tgl_keluar_mnt", "value", $tgl_keluar[4]);
		$objResponse->addAssign("input_tgl_keluar_dtk", "value", $tgl_keluar[5]);


		//tab diagnosa_tindakan
		$objResponse->addAssign("input_diagnosa_utama", "value", $data[diagnosa_utama_id]);
		$objResponse->addAssign("input_diagnosa_utama_nama", "innerHTML", $data[diagnosa_utama_nama]);
		$objResponse->addScriptCall("xajax_add_button_tindakan", 1, $data_ic);
		$objResponse->addScriptCall("xajax_add_button_bhp", 1, $data_bhp);
		$objResponse->addScriptCall("xajax_add_button_imunisasi", 1, $data_im);

		//tab data_lain
		$objResponse->addAssign("input_kunjungan_ke", "value", $data[kunjungan_ke]);
		$objResponse->addAssign("input_cara_masuk", "value", $data[cara_masuk]);
		$objResponse->addScriptCall("xajax_ref_get_perujuk", "input_perujuk_id", $data[cara_masuk], $data[perujuk_id]);
		$objResponse->addAssign("input_cara_bayar", "value", $data[cara_bayar]);
		$objResponse->addScriptCall("showNomor", $data[cara_bayar]);
		$objResponse->addAssign("input_nomor", "value", $data[nomor]);
		$objResponse->addAssign("input_pj_nama", "value", $data[pj_nama]);
		$objResponse->addAssign("input_pj_alamat", "value", $data[pj_alamat]);
		$objResponse->addAssign("input_pj_telp", "value", $data[pj_telp]);
		$objResponse->addAssign("input_pj_hubungan_keluarga", "value", $data[pj_hubungan_keluarga]);

		//list kunjungan yg pernah dilakukan
		$objResponse->addScriptCall("xajax_tab_list_semua_kunjungan", '0', $data[pasien_id]);

		//tampilkan modal window input kunjungan
		$objResponse->addClear("modal_kunjungan", "style.display");
		return $objResponse;
	}
Exemplo n.º 11
0
	function buka_kunjungan($id_kunjungan_kamar, $parent_id) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		//get pelayanan asal
		$kon->sql = "
			SELECT 
				pel.nama as asal
			FROM
				pelayanan pel
				JOIN kamar kmr ON (kmr.pelayanan_id = pel.id)
				JOIN kunjungan_kamar kk ON (kk.kamar_id = kmr.id)
			WHERE
				kk.id = '".$parent_id."'
		";
		$kon->execute();
		$asal = $kon->getOne();
		$sql = "
			SELECT 
				k.kunjungan_ke as kunjungan_ke,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				p.sex as sex,
				p.tgl_lahir as tgl_lahir,
				kk.id as id_kunjungan_kamar,
				k.id as id_kunjungan,
				DATE(kk.tgl_daftar) as tgl_daftar,
				DATE(kk.tgl_periksa) as tgl_periksa,
				DATE(kk.tgl_keluar) as tgl_keluar,
				TIME(kk.tgl_keluar) as wkt_keluar,
				d.nama as dokter,
				kmr.id as id_kamar,
				kmr.nama as spesialisasi,
				k.cara_masuk as cara_masuk,
				CONCAT_WS(' - ', kk.cara_bayar, kk.jenis_askes, rper.nama) as cara_bayar,
				k.keadaan_keluar as keadaan_keluar,
				kk.kelanjutan as kelanjutan,
				IF(i.id IS NULL, '&nbsp;', CONCAT(i.kode_icd, ' - ', i.nama)) as diagnosa_utama_nama,
				CASE WHEN (kk.tgl_keluar IS NULL) THEN DATEDIFF(DATE(NOW()), kk.tgl_daftar)
				ELSE DATEDIFF(kk.tgl_keluar, kk.tgl_daftar) END as lama_dirawat
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				LEFT JOIN icd i ON (i.id = kk.diagnosa_utama_id)
				LEFT JOIN dokter d ON (d.id = kk.dokter_id)
				LEFT JOIN ref_perusahaan rper ON (rper.id = kk.perusahaan_id)
			WHERE
				kk.id = '".$id_kunjungan_kamar."'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getOne();
		

		//get data biaya kamar
		$kon->sql = "
			SELECT
				nama as nama
			FROM
				kunjungan_bayar
			WHERE
				kunjungan_kamar_id = '".$id_kunjungan_kamar."'
				AND karcis_id IS NOT NULL
			GROUP BY 
				id
		";
		$kon->execute();
		$data_karcis = $kon->getAll();

		//get data tindakan
		$kon->sql = "
			SELECT
				ic.nama as nama
			FROM
				kunjungan_kamar_icopim kkic
				JOIN icopim ic ON (ic.id = kkic.icopim_id)
			WHERE
				kkic.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY 
				kkic.id
		";
		$kon->execute();
		$data_ic = $kon->getAll();

		
		//get data BHP
		$kon->sql = "
			SELECT
				nama as nama
			FROM
				kunjungan_bayar
			WHERE
				kunjungan_kamar_id = '".$id_kunjungan_kamar."'
				AND bhp_id IS NOT NULL
			GROUP BY 
				id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();
/*
		//get data im
		$kon->sql = "
			SELECT
				im.nama as nama
			FROM
				kunjungan_bayar kki
				JOIN imunisasi im ON (im.id = kki.imunisasi_id)
			WHERE
				kki.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY
				kki.id
		";
		$kon->execute();
		$data_im = $kon->getAll();
		//$objResponse->addAlert(print_r($data_im));
*/
		$skr = date("Y-m-d");
		$usia = hitungUmur($data[tgl_lahir], $skr);
		$umur = empty($usia[tahun])?"":$usia[tahun] . "&nbsp;th&nbsp;&nbsp;";
		$umur .= empty($usia[bulan])?"":$usia[bulan] . "&nbsp;bl&nbsp;&nbsp;";
		$umur .= empty($usia[hari])?"":$usia[hari] . "&nbsp;hr&nbsp;&nbsp;";
		
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		//info utama
		$objResponse->addAssign("input_no_rm", "innerHTML", $data[no_rm]);
		$objResponse->addAssign("input_pasien", "innerHTML", $data[nama]);
		$objResponse->addAssign("input_sex", "innerHTML", $data[sex]);
		$objResponse->addAssign("input_usia", "innerHTML", $umur);
		$objResponse->addAssign("input_cara_masuk", "innerHTML", $data[cara_masuk]);
		$objResponse->addAssign("input_pelayanan_asal", "innerHTML", $asal[asal]);
		$objResponse->addAssign("input_cara_bayar", "innerHTML", $data[cara_bayar]);
		$objResponse->addAssign("input_id_kunjungan_kamar", "value", $data[id_kunjungan_kamar]);
		$objResponse->addAssign("input_id_kunjungan", "value", $data[id_kunjungan]);
		
		$objResponse->addAssign("input_kunjungan_ke", "innerHTML", $data[kunjungan_ke]);
		$objResponse->addAssign("input_spesialisasi", "innerHTML", $data[spesialisasi]);
		$objResponse->addAssign("input_lama_dirawat", "innerHTML", $data[lama_dirawat] . " hari");
		$objResponse->addAssign("input_dokter", "innerHTML", $data[dokter]);

		//set default
		$kelanjutan = empty($data[kelanjutan])?"PULANG":$data[kelanjutan];
		$objResponse->addAssign("input_kelanjutan", "value", $kelanjutan);
		$keadaan_keluar = empty($data[keadaan_keluar])?"SEMBUH":$data[keadaan_keluar];
		$objResponse->addAssign("input_keadaan_keluar", "value", $keadaan_keluar);

		//tanggal keluar
		$tgl_keluar = explode("-", $data[tgl_keluar]);
		$objResponse->addAssign("input_tgl_keluar_thn", "value", $tgl_keluar[2]);
		$objResponse->addAssign("input_tgl_keluar_bln", "value", $tgl_keluar[1]);
		$objResponse->addAssign("input_tgl_keluar_tgl", "value", $tgl_keluar[0]);
		$wkt_keluar = explode(":", $data[wkt_keluar]);
		$objResponse->addAssign("input_tgl_keluar_jam", "value", $wkt_keluar[0]);
		$objResponse->addAssign("input_tgl_keluar_mnt", "value", $wkt_keluar[1]);

		$objResponse->addAssign("input_tgl_daftar", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));

		//tab diagnosa_tindakan
		$objResponse->addAssign("input_diagnosa_utama_nama", "innerHTML", $data[diagnosa_utama_nama]);
		for($i=0;$i<sizeof($data_karcis);$i++) {
			$ret_data_karcis .= "<li>".$data_karcis[$i][nama]."</li>";
		}
		$objResponse->addAssign("tabel_input_karcis", "innerHTML", $ret_data_karcis);

		for($i=0;$i<sizeof($data_ic);$i++) {
			$ret_data_ic .= "<li>".$data_ic[$i][nama]."</li>";
		}
		$objResponse->addAssign("tabel_input_tindakan", "innerHTML", $ret_data_ic);

		for($i=0;$i<sizeof($data_bhp);$i++) {
			$ret_data_bhp .= "<li>".$data_bhp[$i][nama]."</li>";
		}
		$objResponse->addAssign("tabel_input_bhp", "innerHTML", $ret_data_bhp);
/*
		for($i=0;$i<sizeof($data_im);$i++) {
			$ret_data_im .= "<li>".$data_im[$i][nama]."</li>";
		}
		$objResponse->addAssign("tabel_input_imunisasi", "innerHTML", $ret_data_im);
*/
		//list kunjungan yg pernah dilakukan
		//$objResponse->addScriptCall("xajax_tab_list_semua_kunjungan", '0', $data[pasien_id]);

		//tampilkan modal window input kunjungan
		$objResponse->addClear("modal_kunjungan", "style.display");
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		$objResponse->addScriptCall("fokus", "input_kelanjutan");
		return $objResponse;
	}
Exemplo n.º 12
0
	function buka_kunjungan($id_kunjungan_kamar) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$sql = "
			SELECT 
				k.kunjungan_ke as kunjungan_ke,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				p.sex as sex,
				p.tgl_lahir as tgl_lahir,
				kk.id as id_kunjungan_kamar,
				k.id as id_kunjungan,
				DATE(kk.tgl_daftar) as tgl_daftar,
				DATE(kk.tgl_periksa) as tgl_periksa,
				DATE(kk.tgl_keluar) as tgl_keluar,
				TIME(kk.tgl_keluar) as wkt_keluar,
				kk.dokter_id as id_dokter,
				kk.kelanjutan as kelanjutan,
				k.keadaan_keluar as keadaan_keluar,
				kmr.id as id_kamar,
				kmr.kelas as kelas,
				kmr.nama as spesialisasi,
				kk.diagnosa_utama_id as diagnosa_utama_id,
				IF(i.id IS NULL, '&nbsp;', CONCAT(i.kode_icd, ' - ', i.nama)) as diagnosa_utama_nama,
				CONCAT_WS(' - ', k.cara_masuk, rp.nama) as cara_masuk,
				CONCAT_WS(' - ', kk.cara_bayar, kk.jenis_askes, rper.nama) as cara_bayar
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				LEFT JOIN icd i ON (i.id = kk.diagnosa_utama_id)
				LEFT JOIN ref_perujuk rp ON (rp.id = k.perujuk_id)
				LEFT JOIN ref_perusahaan rper ON (rper.id = kk.perusahaan_id)
			WHERE
				kk.id = '".$id_kunjungan_kamar."'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getOne();
/*
KARCIS :
jasa_p
jasa_rs
jasa_rs_op
jasa_rs_kembang
jasa_rs_adm
jasa_rs_sdm
spesialis
spesialis_pendamping
ugp
grabaf
perawat
penunjang
zakat
pajak
netto

BHP :
bhp_p
bhp_rs
bhp_rs_adm
bhp_rs_op

ICOPIM:
jasa_p
jasa_rs
jasa_rs_op
jasa_rs_kembang
jasa_rs_adm
jasa_rs_sdm
spesialis
spesialis_pendamping
perawat_perinatologi
dr_umum
dr_gigi
assisten_non_dokter
spesialis_anestesi
aknest
gizi
fisioterapi
analis_pa
bidan
perawat
penunjang
zakat
pajak

*/		
		//get data karcis
		$kon->sql = "
			SELECT
				id as kunjungan_bayar_id,
				karcis_id as karcis_id,
				nama as nama,
				hak_id as hak_id,
				jumlah as jumlah,
				biaya as biaya,
				bayar as bayar
			FROM
				kunjungan_bayar
			WHERE
				kunjungan_kamar_id = '".$id_kunjungan_kamar."'
				AND karcis_id IS NOT NULL
			GROUP BY 
				id
		";
		$kon->execute();
		$data_kc = $kon->getAll();
		
		//get data tindakan
		$kon->sql = "
			SELECT
				kkic.id as kunjungan_icopim_id,
				kby.id as kunjungan_bayar_id,
				kkic.nama as nama,
				kby.nama as kolom,
				kby.hak_id as hak_id,
				kby.sifat as sifat,
				kby.biaya as biaya,
				kby.jumlah as jumlah,
				kby.bayar as bayar
			FROM
				kunjungan_kamar_icopim kkic
				JOIN kunjungan_bayar kby ON (kby.kunjungan_kamar_icopim_id = kkic.id)
			WHERE
				kkic.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY 
				kby.id
			ORDER BY
				kkic.id, kby.id
		";
		$kon->execute();
		$data_ic = $kon->getAll();
		
		//get data BHP
		$kon->sql = "
			SELECT
				id as kunjungan_bayar_id,
				nama as nama,
				hak_id as hak_id,
				jumlah as jumlah,
				sifat as sifat,
				biaya as biaya,
				bayar as bayar
			FROM
				kunjungan_bayar
			WHERE
				kunjungan_kamar_id = '".$id_kunjungan_kamar."'
				AND bhp_id IS NOT NULL
			GROUP BY 
				id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();


		$skr = date("Y-m-d");
		$usia = hitungUmur($data[tgl_lahir], $skr);
		$umur = empty($usia[tahun])?"":$usia[tahun] . "&nbsp;th&nbsp;&nbsp;";
		$umur .= empty($usia[bulan])?"":$usia[bulan] . "&nbsp;bl&nbsp;&nbsp;";
		$umur .= empty($usia[hari])?"":$usia[hari] . "&nbsp;hr&nbsp;&nbsp;";
		
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		//info utama
		$objResponse->addAssign("input_no_rm", "innerHTML", $data[no_rm]);
		$objResponse->addAssign("input_pasien", "innerHTML", $data[nama]);
		$objResponse->addAssign("input_sex", "innerHTML", $data[sex]);
		$objResponse->addAssign("input_usia", "innerHTML", $umur);
		$objResponse->addAssign("input_cara_masuk", "innerHTML", $data[cara_masuk]);
		$objResponse->addAssign("input_cara_bayar", "innerHTML", $data[cara_bayar]);
		$objResponse->addAssign("input_id_kunjungan_kamar", "value", $data[id_kunjungan_kamar]);
		$objResponse->addAssign("input_id_kunjungan", "value", $data[id_kunjungan]);
		$objResponse->addAssign("icopim_kelas", "value", $data[kelas]);
		
		$objResponse->addAssign("input_kunjungan_ke", "innerHTML", $data[kunjungan_ke]);
		$objResponse->addAssign("input_spesialisasi", "innerHTML", $data[spesialisasi]);
		$objResponse->addScriptCall("xajax_ref_get_dokter_from_kamar", "input_dokter_id", $data[id_kamar], $data[id_dokter]);

		//set default
		$kelanjutan = empty($data[kelanjutan])?"PULANG":$data[kelanjutan];
		$objResponse->addAssign("input_kelanjutan", "value", $kelanjutan);
		$keadaan_keluar = empty($data[keadaan_keluar])?"SEMBUH":$data[keadaan_keluar];
		$objResponse->addAssign("input_keadaan_keluar", "value", $keadaan_keluar);

		//tanggal keluar
		$tgl_keluar = explode("-", $data[tgl_keluar]);
		$objResponse->addAssign("input_tgl_keluar_thn", "value", $tgl_keluar[2]);
		$objResponse->addAssign("input_tgl_keluar_bln", "value", $tgl_keluar[1]);
		$objResponse->addAssign("input_tgl_keluar_tgl", "value", $tgl_keluar[0]);
		$wkt_keluar = explode(":", $data[wkt_keluar]);
		$objResponse->addAssign("input_tgl_keluar_jam", "value", $wkt_keluar[0]);
		$objResponse->addAssign("input_tgl_keluar_mnt", "value", $wkt_keluar[1]);

		$objResponse->addAssign("input_tgl_daftar", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));
		$objResponse->addAssign("input_tgl_periksa", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));

		//tab diagnosa_tindakan
		$objResponse->addAssign("input_diagnosa_utama", "value", $data[diagnosa_utama_id]);
		$objResponse->addAssign("input_diagnosa_utama_nama", "innerHTML", $data[diagnosa_utama_nama]);

		if(!empty($data_kc)) $objResponse->addScriptCall("xajax_get_karcis_from_kunjungan", $data_kc);
		if(!empty($data_bhp)) $objResponse->addScriptCall("xajax_get_bhp_from_kunjungan", $data_bhp);
		if(!empty($data_ic)) $objResponse->addScriptCall("xajax_get_icopim_from_kunjungan", $data_ic);
		//$idkk[input_id_kunjungan_kamar] = $data[id_kunjungan_kamar];
		//$objResponse->addScriptCall("xajax_get_total", $idkk);

		//tampilkan modal window input kunjungan
		$objResponse->addClear("modal_kunjungan", "style.display");
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		$objResponse->addScriptCall("fokus", "input_dokter_id");
		return $objResponse;
	}
Exemplo n.º 13
0
	function buka_kunjungan($id_kunjungan_kamar, $parent_id) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		//get pelayanan asal
		$kon->sql = "
			SELECT 
				pel.nama as asal
			FROM
				pelayanan pel
				JOIN kamar kmr ON (kmr.pelayanan_id = pel.id)
				JOIN kunjungan_kamar kk ON (kk.kamar_id = kmr.id)
			WHERE
				kk.id = '".$parent_id."'
		";
		$kon->execute();
		$asal = $kon->getOne();
		$sql = "
			SELECT 
				k.kunjungan_ke as kunjungan_ke,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				p.sex as sex,
				p.tgl_lahir as tgl_lahir,
				kk.id as id_kunjungan_kamar,
				k.id as id_kunjungan,
				DATE(kk.tgl_daftar) as tgl_daftar,
				DATE(kk.tgl_periksa) as tgl_periksa,
				kk.dokter_id as id_dokter,
				kmr.id as id_kamar,
				kmr.nama as spesialisasi,
				kk.diagnosa_utama_id as diagnosa_utama_id,
				IF(i.id IS NULL, '&nbsp;', CONCAT(i.kode_icd, ' - ', i.nama)) as diagnosa_utama_nama,
				k.cara_masuk as cara_masuk,
				kk.cara_bayar as cara_bayar
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				LEFT JOIN icd i ON (i.id = kk.diagnosa_utama_id)
			WHERE
				kk.id = '".$id_kunjungan_kamar."'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getOne();
		
		//get data tindakan
		$kon->sql = "
			SELECT
				kkic.id as kunjungan_tindakan_id,
				ic.id as tindakan_id,
				ic.nama as tindakan_nama
			FROM
				kunjungan_kamar_icopim kkic
				JOIN icopim ic ON (ic.id = kkic.icopim_id)
			WHERE
				kkic.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY 
				kkic.id
		";
		$kon->execute();
		$data_ic = $kon->getAll();

		
		//get data BHP
		$kon->sql = "
			SELECT
				kkbhp.id as kunjungan_bhp_id,
				bhp.id as bhp_id,
				bhp.nama as bhp_nama
			FROM
				kunjungan_kamar_bhp kkbhp
				JOIN bhp ON (bhp.id = kkbhp.bhp_id)
			WHERE
				kkbhp.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY 
				kkbhp.id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();

		//get data im
		$kon->sql = "
			SELECT
				kki.id as kunjungan_imunisasi_id,
				im.id as imunisasi_id,
				im.nama as imunisasi_nama
			FROM
				kunjungan_kamar_imunisasi kki
				JOIN imunisasi im ON (im.id = kki.imunisasi_id)
			WHERE
				kki.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY
				kki.id
		";
		$kon->execute();
		$data_im = $kon->getAll();
		//$objResponse->addAlert(print_r($data_im));

		$skr = date("Y-m-d");
		$usia = hitungUmur($data[tgl_lahir], $skr);
		$umur = empty($usia[tahun])?"":$usia[tahun] . "&nbsp;th&nbsp;&nbsp;";
		$umur .= empty($usia[bulan])?"":$usia[bulan] . "&nbsp;bl&nbsp;&nbsp;";
		$umur .= empty($usia[hari])?"":$usia[hari] . "&nbsp;hr&nbsp;&nbsp;";
		
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		//info utama
		$objResponse->addAssign("input_no_rm", "innerHTML", $data[no_rm]);
		$objResponse->addAssign("input_pasien", "innerHTML", $data[nama]);
		$objResponse->addAssign("input_sex", "innerHTML", $data[sex]);
		$objResponse->addAssign("input_usia", "innerHTML", $umur);
		$objResponse->addAssign("input_cara_masuk", "innerHTML", $data[cara_masuk]);
		$objResponse->addAssign("input_pelayanan_asal", "innerHTML", $asal[asal]);
		$objResponse->addAssign("input_cara_bayar", "innerHTML", $data[cara_bayar]);
		$objResponse->addAssign("input_id_kunjungan_kamar", "value", $data[id_kunjungan_kamar]);
		$objResponse->addAssign("input_id_kunjungan", "value", $data[id_kunjungan]);
		
		$objResponse->addAssign("input_kunjungan_ke", "innerHTML", $data[kunjungan_ke]);
		$objResponse->addAssign("input_spesialisasi", "innerHTML", $data[spesialisasi]);
		$objResponse->addScriptCall("xajax_ref_get_dokter_from_kamar", "input_dokter_id", $data[id_kamar], $data[id_dokter]);

		$objResponse->addAssign("input_tgl_daftar", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));

		//tab diagnosa_tindakan
		$objResponse->addAssign("input_diagnosa_utama", "value", $data[diagnosa_utama_id]);
		$objResponse->addAssign("input_diagnosa_utama_nama", "innerHTML", $data[diagnosa_utama_nama]);
		$objResponse->addScriptCall("xajax_add_button_tindakan", 1, $data_ic);
		$objResponse->addScriptCall("xajax_add_button_bhp", 1, $data_bhp);
		$objResponse->addScriptCall("xajax_add_button_imunisasi", 1, $data_im);

		//list kunjungan yg pernah dilakukan
		$objResponse->addScriptCall("xajax_tab_list_semua_kunjungan", '0', $data[pasien_id]);

		//tampilkan modal window input kunjungan
		$objResponse->addClear("modal_kunjungan", "style.display");
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		$objResponse->addScriptCall("fokus", "input_dokter_id");
		return $objResponse;
	}
Exemplo n.º 14
0
	function get_lap_rl2a($val) {
		$objResponse = new xajaxResponse;
		$dtd = array('292.0','292.2','292.4','292.6','292.8');
		$dtd_kecuali = implode("','", $dtd);
		switch($val[tw]) {
			case "IV" :
				$s = " AND kk.tgl_keluar BETWEEN '".$val[tahun]."-10-01' AND '".$val[tahun]."-12-31'";
			break;
			case "III" :
				$s = " AND kk.tgl_keluar BETWEEN '".$val[tahun]."-07-01' AND '".$val[tahun]."-09-30'";
			break;
			case "II" :
				$s = " AND kk.tgl_keluar BETWEEN '".$val[tahun]."-04-01' AND '".$val[tahun]."-06-30'";
			break;
			default :
				$s = " AND kk.tgl_keluar BETWEEN '".$val[tahun]."-01-01' AND '".$val[tahun]."-03-31'";
			break;
		}

		$kon = new Konek;
		$sql = "
			SELECT
				i.no_dtd as no_dtd,
				i.kode_icd as kode_icd,
				i.gol_sebab_sakit as gol_sebab_sakit,
				p.tgl_lahir as tgl_lahir,
				kk.tgl_keluar as tgl_keluar,
				p.sex as sex,
				k.keadaan_keluar as keadaan_keluar
			FROM
				kunjungan_kamar kk
				JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				JOIN icd i ON (i.id = kk.diagnosa_utama_id)
			WHERE
				kk.tgl_keluar IS NOT NULL
				AND pel.jenis = 'RAWAT INAP'
				AND kk.kelanjutan IN ('DIRUJUK', 'PULANG')
				AND i.no_dtd NOT IN ('" . $dtd_kecuali . "')
				$s
			ORDER BY i.no_dtd
		";
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();
		$baru = array();
		$s = 0;
		for($i=0;$i<sizeof($data);$i++) {
			$umur = hitungUmur($data[$i][tgl_lahir], $data[$i][tgl_keluar]);
			$umur_tahun = $umur[tahun];
			$umur_hari = $umur[hari];
			if($data[$i][no_dtd] == $data[$i-1][no_dtd]) {
				//bikin anak
				//nggabungin kode icd
				if($baru[$s][kode_icd] != $data[$i][kode_icd]) $baru[$s][kode_icd] = $baru[$s][kode_icd] . ", " . $data[$i][kode_icd];

				if($umur[tahun] > 64) {
					$baru[$s]['nam_lima'] += 1;
					$total['nam_lima'] += 1;
				} elseif ($umur[tahun] > 44) {
					$baru[$s]['pat_lima'] += 1;
					$total['pat_lima'] += 1;
				} elseif ($umur[tahun] > 24) {
					$baru[$s]['dua_lima'] += 1;
					$total['dua_lima'] += 1;
				} elseif ($umur[tahun] > 14) {
					$baru[$s]['lima_belas'] += 1;
					$total['lima_belas'] += 1;
				} elseif ($umur[tahun] > 4) {
					$baru[$s]['lima'] += 1;
					$total['lima'] += 1;
				} elseif ($umur[tahun] >=1) {
					$baru[$s]['satu'] += 1;
					$total['satu'] += 1;
				} elseif ($umur[hari] > 27) {
					$baru[$s]['dua_lapan'] += 1;
					$total['dua_lapan'] += 1;
				} else {
					$baru[$s]['nol'] += 1;
					$total['nol'] += 1;
				}
				//sex
				if($data[$i][sex] == "LAKI-LAKI") {
					$baru[$s][sex_laki] += 1;
					$total['sex_laki'] += 1;
					$total['total'] += 1;
				} else {
					$baru[$s][sex_prp] += 1;
					$total['sex_prp'] += 1;
					$total['total'] += 1;
				}
				if($data[$i][keadaan_keluar] == "MATI < 48 JAM" || $data[$i][keadaan_keluar] == "MATI >= 48 JAM") {
					$baru[$s][mati] += 1;
					$total['mati'] += 1;
				}
				$baru[$s][total] = $baru[$s][sex_prp] + $baru[$s][sex_laki];
			} else {
				//bikin embok
				if($i!=0) {
					$s++;
				}
				$baru[$s][no_dtd] = $data[$i][no_dtd];
				$baru[$s][kode_icd] = $data[$i][kode_icd];
				$baru[$s][gol_sebab_sakit] = $data[$i][gol_sebab_sakit];
				$baru[$s][tgl_lahir] = $data[$i][tgl_lahir];
				$baru[$s][tgl_keluar] = $data[$i][tgl_keluar];
				if($umur[tahun] > 64) {
					$baru[$s]['nam_lima'] = 1;
					$total['nam_lima'] += 1;
				} elseif ($umur[tahun] > 44) {
					$baru[$s]['pat_lima'] = 1;
					$total['pat_lima'] += 1;
				} elseif ($umur[tahun] > 24) {
					$baru[$s]['dua_lima'] = 1;
					$total['dua_lima'] += 1;
				} elseif ($umur[tahun] > 14) {
					$baru[$s]['lima_belas'] = 1;
					$total['lima_belas'] += 1;
				} elseif ($umur[tahun] > 4) {
					$baru[$s]['lima'] = 1;
					$total['lima'] += 1;
				} elseif ($umur[tahun] >=1) {
					$baru[$s]['satu'] = 1;
					$total['satu'] += 1;
				} elseif ($umur[hari] > 27) {
					$baru[$s]['dua_lapan'] = 1;
					$total['dua_lapan'] += 1;
				} else {
					$baru[$s]['nol'] = 1;
					$total['nol'] += 1;
				}

				//sex
				if($data[$i][sex] == "LAKI-LAKI") {
					$baru[$s][sex_laki] = 1;
					$total['sex_laki'] += 1;
					$total['total'] += 1;
				} else {
					$baru[$s][sex_prp] = 1;
					$total['sex_prp'] += 1;
					$total['total'] += 1;
				}
				if($data[$i][keadaan_keluar] == "MATI < 48 JAM" || $data[$i][keadaan_keluar] == "MATI >= 48 JAM") {
					$baru[$s][mati] = 1;
					$total['mati'] += 1;
				}
				$baru[$s][total] = $baru[$s][sex_prp] + $baru[$s][sex_laki];
			}
		}
		$tabel_all = new Table;
		$tabel_all->scroll = false;
		$tabel_all->extra_table = "style=\"width:21.5cm;margin:0\"";
		$tabel_all->cellspacing="0";
		$tabel_all->css_table="";
		$tabel_all->anime_bg_color="";
		$tabel_header = new Table;
		$tabel_header->scroll = false;
		$tabel_header->extra_tr_th = "";
		$tabel_header->cellspacing="0";
		$tabel_header->css_table="";
		$tabel_header->anime_bg_color="";
		$tabel_header->extra_table = "style=\"width:20cm;border:0;\"";
		$tabel_header->addTh("","DATA KEADAAN MORBIDITAS PASIEN RAWAT INAP RUMAH SAKIT<br />TRIWULAN : ".$val[tw]." TAHUN : ".$val[tahun],"");
		//$tabel_header->addExtraTh("colspan=\"3\"");
		$tabel_header->addRow("","","Formulir RL2a");
		//$tabel_header->addExtraTh();
		$tabel_header->addRow($_SESSION[setting][rs_nama], "", "No. Kode RS : " . $_SESSION[setting][rs_kode]);
		//$tabel_header->addExtraTh("colspan=\"3\"");

		$tabel_isi = new Table;
		$tabel_isi->scroll = false;
		$tabel_isi->cellspacing="0";
		$tabel_isi->extra_table = "style=\"width:20cm;font-size:7pt;\"";
		$tabel_header->css_table="";
		$tabel_isi->addTh(
			"NO. URUT", 
			"NO. DTD", 
			"NO. DAFTAR TERPERINCI", 
			"GOLONGAN SEBAB-SEBAB SAKIT", 
			"PASIEN KELUAR (HIDUP &amp; MATI) MENURUT GOLONGAN UMUR", 
			"PASIEN KELUAR (HIDUP &amp; MATI) MENURUT SEX", 
			"JUMLAH PASIEN KELUAR <br />(13 + 14)", 
			"JUMLAH PASIEN KELUAR MATI"
		);
		$tabel_isi->addExtraTh("rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "colspan=\"8\"", "colspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"");
		$tabel_isi->addTh("0-28 HR", "28 HR - &lt;1 TH", "1-4 TH", "5-14 TH", "15-24 TH", "25-44 TH", "45-64 TH", "65+ TH", "LK", "PR");
		$tabel_isi->addTh("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16");
		for($i=0;$i<sizeof($baru);$i++) {
			$tabel_isi->addRow(
				($i+1),
				$baru[$i][no_dtd],
				$baru[$i][kode_icd],
				$baru[$i][gol_sebab_sakit],
				$baru[$i][nol],
				$baru[$i][dua_lapan],
				$baru[$i][satu],
				$baru[$i][lima],
				$baru[$i][lima_belas],
				$baru[$i][dua_lima],
				$baru[$i][pat_lima],
				$baru[$i][nam_lima],
				$baru[$i][sex_laki],
				$baru[$i][sex_prp],
				$baru[$i][total],
				$baru[$i][mati]
			);
		}
		$tabel_isi->addRow(
			"","","","Total", 
			$total[nol], 
			$total[dua_lapan], 
			$total[satu], 
			$total[lima], 
			$total[lima_belas], 
			$total[dua_lima], 
			$total[pat_lima], 
			$total[nam_lima], 
			$total[sex_laki], 
			$total[sex_prp], 
			$total[total], 
			$total[mati]
		);
		$ret_tabel_header = $tabel_header->build();
		$ret_tabel_isi = $tabel_isi->build();
		$tabel_all->addRow($ret_tabel_header);
		$tabel_all->addRow($ret_tabel_isi);
		$ret = $tabel_all->build();
		unset($_SESSION[rekmed][lap_rl2a]);
		$cetak = new Cetak;
		$tanda_tangan = $cetak->setTandaTangan();
		$ret .= $tanda_tangan;
		$_SESSION[rekmed][lap_rl2a] = $ret;
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}
Exemplo n.º 15
0
	function buka_kunjungan($id_kunjungan_kamar) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$sql = "
			SELECT 
				k.id as id_kunjungan,
				k.kunjungan_ke as kunjungan_ke,
				k.cara_masuk as cara_masuk,
				kk.cara_bayar as cara_bayar,
				k.perujuk_id as perujuk_id,
					kk.jenis_askes as jenis_askes,
					kk.perusahaan_id as perusahaan_id,
				kk.nomor as nomor,
				kk.pj_nama as pj_nama,
				kk.pj_alamat as pj_alamat,
				kk.pj_telp as pj_telp,
				kk.pj_hubungan_keluarga as pj_hubungan_keluarga,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				p.tgl_lahir as tgl_lahir,
				p.sex as jk,
				kk.id as id_kunjungan_kamar,
				DATE_FORMAT(kk.tgl_daftar, '%Y-%m-%d-%H-%i') as tgl_daftar,
				DATE_FORMAT(kk.tgl_periksa, '%Y-%m-%d-%H-%i') as tgl_periksa,
				kk.dokter_id as id_dokter,
				kk.kelanjutan as kelanjutan,
				kmr.id as id_kamar,
				kk.diagnosa_utama_id as diagnosa_utama_id,
				IF(i.id IS NULL, '&nbsp;', CONCAT(i.kode_icd, ' - ', i.nama)) as diagnosa_utama_nama
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				LEFT JOIN icd i ON (i.id = kk.diagnosa_utama_id)
			WHERE
				kk.id = '".$id_kunjungan_kamar."'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getOne();

		$skr = date("Y-m-d");
		$usia = hitungUmur($data[tgl_lahir], $skr);
		$umur = empty($usia[tahun])?"":$usia[tahun] . "th&nbsp;&nbsp;";
		$umur .= empty($usia[bulan])?"":$usia[bulan] . "bl&nbsp;&nbsp;";
		$umur .= empty($usia[hari])?"":$usia[hari] . "hr&nbsp;&nbsp;";
		
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		//info utama
		$objResponse->addAssign("input_no_rm", "innerHTML", $data[no_rm]);
		$objResponse->addAssign("input_pasien", "innerHTML", $data[nama]);
		$objResponse->addAssign("input_sex", "innerHTML", $data[jk]);
		$objResponse->addAssign("input_usia", "innerHTML", $umur);
		$objResponse->addAssign("input_id_kunjungan_kamar", "value", $data[id_kunjungan_kamar]);
		$objResponse->addAssign("input_id_kunjungan", "value", $data[id_kunjungan]);

		//tab data_kunjungan
		$objResponse->addScriptCall("xajax_ref_get_dokter_from_kamar", "input_dokter_id", $data[id_kamar], $data[id_dokter]);
		$objResponse->addAssign("input_kelanjutan", "value", $data[kelanjutan]);
		
		$tgl_daftar = explode("-", $data[tgl_daftar]);
		$objResponse->addAssign("input_tgl_daftar_tgl", "value", $tgl_daftar[2]);
		$objResponse->addAssign("input_tgl_daftar_bln", "value", $tgl_daftar[1]);
		$objResponse->addAssign("input_tgl_daftar_thn", "value", $tgl_daftar[0]);

		$objResponse->addAssign("input_tgl_daftar_jam", "value", $tgl_daftar[3]);
		$objResponse->addAssign("input_tgl_daftar_mnt", "value", $tgl_daftar[4]);

		$tgl_periksa = explode("-", $data[tgl_periksa]);
		$objResponse->addAssign("input_tgl_periksa_tgl", "value", $tgl_periksa[2]);
		$objResponse->addAssign("input_tgl_periksa_bln", "value", $tgl_periksa[1]);
		$objResponse->addAssign("input_tgl_periksa_thn", "value", $tgl_periksa[0]);

		$objResponse->addAssign("input_tgl_periksa_jam", "value", $tgl_periksa[3]);
		$objResponse->addAssign("input_tgl_periksa_mnt", "value", $tgl_periksa[4]);

		//tab data_lain
		$objResponse->addAssign("input_kunjungan_ke", "value", $data[kunjungan_ke]);
		$objResponse->addAssign("input_cara_masuk", "value", $data[cara_masuk]);
		$objResponse->addScriptCall("xajax_ref_get_perujuk", "input_perujuk_id", $data[cara_masuk], $data[perujuk_id]);
		$objResponse->addAssign("input_cara_bayar", "value", $data[cara_bayar]);
		$objResponse->addScriptCall("xajax_ref_get_jenis_askes", "input_jenis_askes", $data[cara_bayar], $data[jenis_askes]);
		$objResponse->addScriptCall("xajax_ref_get_perusahaan", "input_perusahaan_id", $data[cara_bayar], $data[perusahaan_id]);
		$objResponse->addScriptCall("showNomor", $data[cara_bayar]);
		$objResponse->addAssign("input_nomor", "value", $data[nomor]);
		$objResponse->addAssign("input_pj_nama", "value", $data[pj_nama]);
		$objResponse->addAssign("input_pj_alamat", "value", $data[pj_alamat]);
		$objResponse->addAssign("input_pj_telp", "value", $data[pj_telp]);
		$objResponse->addAssign("input_pj_hubungan_keluarga", "value", $data[pj_hubungan_keluarga]);

		//list kunjungan yg pernah dilakukan
		//$objResponse->addScriptCall("xajax_tab_list_semua_kunjungan", '0', $data[pasien_id]);

		//tampilkan modal window input kunjungan
		$objResponse->addClear("modal_kunjungan", "style.display");
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		$objResponse->addScriptCall("fokus", "input_dokter_id");
		return $objResponse;
	}
	function list_pasien($hal, $id_pekerjaan, $val) {
		unset($_SESSION[rekmed][statistik_pasien_semua_pekerjaan][list_pasien]);
		/*cek tanggal untuk menghindari 2007-02-31=>mundur 1 hari atw 1 bulan*/
		$val[tgl_periksa_tgl_start] = empty($val[tgl_periksa_tgl_start])?"1":$val[tgl_periksa_tgl_start];
		$val[tgl_periksa_bln_start] = empty($val[tgl_periksa_bln_start])?"1":$val[tgl_periksa_bln_start];

		$val[tgl_periksa_tgl_end] = empty($val[tgl_periksa_tgl_end])?"1":$val[tgl_periksa_tgl_end];
		$val[tgl_periksa_bln_end] = empty($val[tgl_periksa_bln_end])?"1":$val[tgl_periksa_bln_end];

		$tgl_start = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_start], $val[tgl_periksa_tgl_start], $val[tgl_periksa_thn_start]));
		$tgl_end = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_end], $val[tgl_periksa_tgl_end], $val[tgl_periksa_thn_end]));

		if($val[jangka_waktu] == "hari") {
			$tanggal_awal = tanggalIndo($tgl_start, "j F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "j F Y");
			$_q = "AND DATE(p.tgl_daftar) BETWEEN '" . $tgl_start . "' AND '" . $tgl_end . "'";
		} elseif($val[jangka_waktu] == "bulan") {
			$tanggal_awal = tanggalIndo($tgl_start, "F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "F Y");
			$_q = "AND EXTRACT(YEAR_MONTH FROM p.tgl_daftar) BETWEEN '" . $val[tgl_periksa_thn_start] . $val[tgl_periksa_bln_start] . "' AND '" . $val[tgl_periksa_thn_end] . $val[tgl_periksa_bln_end] . "'";
		} else {
			$tanggal_awal = tanggalIndo($tgl_start, "Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "Y");
			$_q = "AND YEAR(p.tgl_daftar) BETWEEN '" . $val[tgl_periksa_thn_start] . "' AND '" . $val[tgl_periksa_thn_end] . "'";
		}

		$objResponse = new xajaxResponse();
		$paging = new MyPagina;
		$paging->rows_on_page = 5;
		$paging->hal = $hal;
		$sql = "
			SELECT
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as id_display,
				p.nama as nama,
				p.tgl_lahir as tgl_lahir,
				CONCAT(p.alamat, ' ', IF(p.rt = '','',CONCAT(' RT ', p.rt)), IF(p.rw = '','',CONCAT(' RW ', p.rw)), ', ', des.nama, ', ', kec.nama, ', ', kab.nama) as alamat,
				p.tgl_daftar as tgl_daftar,
				p.sex as jk,
				rp.nama as nama_pekerjaan
			FROM
				pasien p
				JOIN ref_desa des ON (des.id = p.desa_id)
				JOIN ref_kecamatan kec ON (kec.id = des.kecamatan_id)
				JOIN ref_kabupaten kab ON (kab.id = kec.kabupaten_id)
				JOIN ref_propinsi prop ON (prop.id = kab.propinsi_id)
				JOIN ref_pekerjaan rp ON (rp.id = p.pekerjaan_id)
			WHERE
				rp.id = '".$id_pekerjaan."'
				$_q
			GROUP BY p.id
			ORDER BY
				p.tgl_daftar
		";
		
		//echo $sql;
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$paging->onclick_func = "xajax_list_pasien";
		$paging->setOnclickValue($id_pekerjaan, "xajax.getFormValues('statistik_pasien_semua_pekerjaan')");

		$paging->sql = $sql;
		$paging->get_page_result();
		$ket_hal = $paging->ket_hal_ini();
		$no = $paging->start_number();
		$data = $paging->data;
		$navi = $paging->navi();
		$is_last_page = $paging->is_last_page();

		$title = "Daftar Pasien Pasien Dengan Pekerjaan ".$data[0][nama_pekerjaan]. "\nPeriode " . $tanggal_awal . " s.d. " . $tanggal_akhir;
		$objResponse->addClear("list_pasien", "style.display");
		$atas = "<div style=\"text-align:right;width:100%;\">";
		$atas .= "<img src=\"". IMAGES_URL . "printer.gif\" alt=\"Cetak\" onclick=\"cetak('".URL."rekmed/statistik_pasien_semua_pekerjaan_list_pasien_cetak/?hal=".$hal."');\" class=\"printer_button\" />";
		$atas .= "<img src=\"". IMAGES_URL . "close.gif\" alt=\"Tutup\" onclick=\"tutup_list_pasien();\" class=\"close_button2\" />";
		$atas .= "</div>";
		$atas .= "<h3>".nl2br($title)."</h3>";
		$atas .= "<div class=\"navi\">" . $navi . "</div>";
		$atas .= "<hr />";
		for($i=0;$i<sizeof($data);$i++) {
			$arr_usia = hitungUmur($data[$i][tgl_lahir], $data[$i][tgl_daftar]);
			$usia = empty($arr_usia[tahun])?"":$arr_usia[tahun] . " thn ";
			$usia .= empty($arr_usia[bulan])?"":$arr_usia[bulan] . " bln ";
			$usia .= empty($arr_usia[hari])?"":$arr_usia[hari] . " hr ";
			$ret .= "<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\">";
			$ret .= "<tr><td style=\"width:30px;vertical-align:top;\" rowspan=\"6\">".($no+$i).".</td><td style=\"width:150px\">No. RM</td><td>" . $data[$i][id_display] . "</td></tr>";
			$ret .= "<tr><td>Nama</td><td>" . $data[$i][nama] . "</td></tr>";
			$ret .= "<tr><td>Usia</td><td>" . (empty($usia)?"-":$usia) . "</td></tr>";
			$ret .= "<tr><td>Jenis Kelamin</td><td>" . $data[$i][jk] . "</td></tr>";
			$ret .= "<tr><td style=\"vertical-align:top;\">Alamat</td><td>" . $data[$i][alamat] . "</td></tr>";
			$ret .= "<tr><td>Tgl Daftar</td><td>" . tanggalIndo($data[$i][tgl_daftar], "j F Y") . "</td></tr>";
			$ret .= "</table>";
			$ret .= "<hr />";
		}
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][list_pasien][is_last_page] = $is_last_page;
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][list_pasien][title] = $title;
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][list_pasien][content] = $ret;
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][list_pasien][ket_hal] = $ket_hal;
		$objResponse->addAssign("list_pasien", "innerHTML", $atas.$ret);
		return $objResponse;
	}
Exemplo n.º 17
0
?>
</td> </tr>
    <tr><td>Dari Dokter: </td><td colspan="3"><?php 
echo $rows->dokter;
?>
</td> </tr>
    <tr><td>Tanggal: </td><td colspan="3" align="left"><?php 
echo datetimefmysql($rows->waktu);
?>
</td> </tr>
    <tr><td>Pro: </td><td colspan="3"><?php 
echo $rows->pasien;
?>
</td> </tr>
    <tr><td>Usia:</td><td colspan="3"><?php 
echo $rows->tanggal_lahir == '0000-00-00' ? '' : hitungUmur($rows->tanggal_lahir);
?>
</td> </tr>
</table>
<table width="100%" style="border-bottom: 1px solid #000;">
<?php 
$id_resep = "";
$jasa = "";
$no = 1;
foreach ($attr_array['data'] as $key => $data) {
    if ($jasa !== $data->r_no) {
        $then = NULL;
        if ($data->resep_r_jumlah - $data->tebus_r_jumlah === 0) {
            $then = "Detur Originale";
        } else {
            if ($data->resep_r_jumlah - $data->tebus_r_jumlah == $data->resep_r_jumlah) {
Exemplo n.º 18
0
	function hitung_umur($value) {
		$tgl_lahir = $value[tgl_lahir_thn] . "-" . $value[tgl_lahir_bln] . "-" . $value[tgl_lahir_tgl];
		$skr = date("Y-m-d");
		$usia = hitungUmur($tgl_lahir, $skr);
		
		$objResponse = new xajaxResponse();
		$objResponse->addAssign("usia_tahun", "value", $usia[tahun]);
		$objResponse->addAssign("usia_bulan", "value", $usia[bulan]);
		$objResponse->addAssign("usia_hari", "value", $usia[hari]);
		return $objResponse;
	}
Exemplo n.º 19
0
	function buka_kunjungan($id_kunjungan_kamar) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$sql = "
			SELECT 
				k.kunjungan_ke as kunjungan_ke,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				p.sex as sex,
				p.tgl_lahir as tgl_lahir,
				kk.id as id_kunjungan_kamar,
				k.id as id_kunjungan,
				DATE(kk.tgl_daftar) as tgl_daftar,
				DATE(kk.tgl_periksa) as tgl_periksa,
				DATE(kk.tgl_keluar) as tgl_keluar,
				TIME(kk.tgl_keluar) as wkt_keluar,
				d.nama as dokter,
				kk.kelanjutan as kelanjutan,
				k.keadaan_keluar as keadaan_keluar,
				kmr.id as id_kamar,
				kmr.kelas as kelas,
				kmr.nama as spesialisasi,
				kk.diagnosa_utama_id as diagnosa_utama_id,
				IF(i.id IS NULL, '&nbsp;', CONCAT(i.kode_icd, ' - ', i.nama)) as diagnosa_utama_nama,
				CONCAT_WS(' - ', k.cara_masuk, rp.nama) as cara_masuk,
				CONCAT_WS(' - ', kk.cara_bayar, kk.jenis_askes, rper.nama) as cara_bayar
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				LEFT JOIN icd i ON (i.id = kk.diagnosa_utama_id)
				LEFT JOIN ref_perujuk rp ON (rp.id = k.perujuk_id)
				LEFT JOIN ref_perusahaan rper ON (rper.id = kk.perusahaan_id)
				LEFT JOIN dokter d ON (d.id = kk.dokter_id)
			WHERE
				kk.id = '".$id_kunjungan_kamar."'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getOne();
		
		//get data kendaraan
		$sqlkd = "
			SELECT
				kkd.id as kunjungan_kendaraan_id,
				kkd.jarak_tempuh as jarak_tempuh,
				kkd.harga_bbm as harga_bbm,
				kb.id as kunjungan_bayar_id,
				kkd.nama as nama,
				kb.hak_id as hak_id,
				kb.nama as kolom,
				kb.biaya_bhp+kb.biaya_jasa as biaya,
				kb.bayar_bhp+kb.bayar_jasa as bayar
			FROM
				kunjungan_kendaraan kkd
				JOIN kunjungan_bayar kb ON (kb.kunjungan_kendaraan_id = kkd.id)
			WHERE
				kkd.kunjungan_kamar_id = '".$id_kunjungan_kamar."'
			GROUP BY 
				kkd.id, kb.id
			ORDER BY
				kkd.id, kb.id
		";
		$kon->sql = $sqlkd;
		$kon->execute();
		$data_kd = $kon->getAll();
		
		$skr = date("Y-m-d");
		$usia = hitungUmur($data[tgl_lahir], $skr);
		$umur = empty($usia[tahun])?"":$usia[tahun] . "&nbsp;th&nbsp;&nbsp;";
		$umur .= empty($usia[bulan])?"":$usia[bulan] . "&nbsp;bl&nbsp;&nbsp;";
		$umur .= empty($usia[hari])?"":$usia[hari] . "&nbsp;hr&nbsp;&nbsp;";
		
		//$objResponse->addAssign("debug", "innerHTML", $sqlkd);
		//info utama
		$objResponse->addAssign("input_no_rm", "innerHTML", $data[no_rm]);
		$objResponse->addAssign("input_pasien", "innerHTML", $data[nama]);
		$objResponse->addAssign("input_sex", "innerHTML", $data[sex]);
		$objResponse->addAssign("input_usia", "innerHTML", $umur);
		$objResponse->addAssign("input_cara_masuk", "innerHTML", $data[cara_masuk]);
		$objResponse->addAssign("input_cara_bayar", "innerHTML", $data[cara_bayar]);
		$objResponse->addAssign("input_id_kunjungan_kamar", "value", $data[id_kunjungan_kamar]);
		$objResponse->addAssign("input_id_kunjungan", "value", $data[id_kunjungan]);
		$objResponse->addAssign("icopim_kelas", "value", $data[kelas]);
		
		$objResponse->addAssign("input_kunjungan_ke", "innerHTML", $data[kunjungan_ke]);
		$objResponse->addAssign("input_spesialisasi", "innerHTML", $data[spesialisasi]);
		$objResponse->addAssign("input_dokter", "innerHTML", $data[dokter]);

		$objResponse->addAssign("input_kelanjutan", "innerHTML", $data[kelanjutan]);
		$objResponse->addAssign("input_keadaan_keluar", "innerHTML", $data[keadaan_keluar]);

		$objResponse->addAssign("input_tgl_keluar", "innerHTML", tanggalIndo($data[tgl_keluar], 'j F Y'));
		$objResponse->addAssign("input_tgl_daftar", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));
		$objResponse->addAssign("input_tgl_periksa", "innerHTML", tanggalIndo($data[tgl_daftar], 'j F Y'));

		//tab diagnosa_tindakan
		$objResponse->addAssign("input_diagnosa_utama_nama", "innerHTML", $data[diagnosa_utama_nama]);
		//$objResponse->addAssign("debug", "innerHTML", $sqlkd);
		if(!empty($data_kd)) {
			$objResponse->addScriptCall("xajax_get_kendaraan_from_kunjungan", $data_kd);
			$objResponse->addAssign("input_harga_bbm", "value", $data_kd[0][harga_bbm]);
			$objResponse->addAssign("input_jarak_tempuh", "value", $data_kd[0][jarak_tempuh]);
		} else {
			$objResponse->addAssign("input_harga_bbm", "value", $_SESSION[setting][harga_bbm]);
			$objResponse->addClear("input_jarak_tempuh", "value");
		}

		//tampilkan modal window input kunjungan
		$objResponse->addClear("modal_kunjungan", "style.display");
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		$objResponse->addScriptCall("fokus", "input_jarak_tempuh");
		return $objResponse;
	}