Beispiel #1
0
	function simpan_tracer_check($value) {
		$cleaner = new FormCleaner;
		$cleaner->setValue($value);
		$cleaner->clean();
		$val = $cleaner->getValue();

		$objResponse = new xajaxResponse;

		if(!$val[no_rm]) {
			$objResponse->addAlert("Silakan Isi Nomor Rekam Medis");
			$objResponse->addScriptCall("fokus", "no_rm");
		} elseif(!$val[peminjam]) {
			$objResponse->addAlert("Silakan Isi Peminjam");
			$objResponse->addScriptCall("fokus", "peminjam");
		} else {
			$kon = new Konek;
			$arr_no_rm = explode("\n", $val[no_rm]);
			$str_no_rm = str_replace("\n", ", ", $val[no_rm]);
			//$objResponse->addAlert($str_no_rm);
			$kon->sql = "
				SELECT 
					CONCAT_WS('-', SUBSTRING(trc.pasien_id, 1,2), SUBSTRING(trc.pasien_id, 3,2), SUBSTRING(trc.pasien_id, 5,2), SUBSTRING(trc.pasien_id, 7,2)) as no_rm,
					kmr.nama as nama_kamar, 
					trc.peminjam as peminjam,
					DATE_FORMAT(trc.tgl_keluar, '%d/%m/%y') as tgl_keluar,
					p.nama as nama
				FROM 
					tracer trc
					LEFT JOIN kunjungan_kamar kk ON (kk.id = trc.kunjungan_kamar_id)
					LEFT JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN pasien p ON (p.id = trc.pasien_id)
				WHERE
					trc.pasien_id IN (".$str_no_rm.")
					AND trc.tgl_kembali IS NULL
			";
			$kon->execute();
			$data = $kon->getAll();
			if(!empty($data)) {
				$str = "\n";
				for($i=0;$i<sizeof($data);$i++) {
					$str .= "---------------------------------------\n";
					$str .= "No RM : " . $data[$i][no_rm] . "\n";
					$str .= "Pasien : " . $data[$i][nama] . "\n";
					$str .= "Tgl Keluar : " . $data[$i][tgl_keluar] . "\n";
					if( $data[$i][peminjam]) $str .= "Peminjam : " . $data[$i][peminjam] . "\n";
					if( $data[$i][nama_kamar]) $str .= "Pelayanan : " . $data[$i][nama_kamar] . "\n";
					$str .= "---------------------------------------\n";
				}
				$objResponse->addAlert("Data Tidak Dapat Disimpan.\nNomor Rekam Medis Berikut Belum Kembali Ke Rak Penyimpanan :\n" . $str);
				$objResponse->addScriptCall("fokus", "no_rm");
			} else {
				$objResponse->addScriptCall("xajax_simpan_tracer", $val, $arr_no_rm);
			}
		}
		return $objResponse;
	}
Beispiel #2
0
	function simpan_perujuk($value) {
		$kon = new Konek;
		if(!$value['id_perujuk'])
			$kon->sql = "INSERT INTO ref_perujuk(nama, alamat) VALUES ('".$value[nama]."', '".$value[alamat]."')";
		else 
			$kon->sql = "UPDATE ref_perujuk SET nama = '".$value[nama]."', alamat = '".$value[alamat]."' WHERE id = '".$value[id_perujuk]."'";
		$kon->execute();
		$objResponse = new xajaxResponse();
		$objResponse->addScriptCall("show_status_simpan");
		$objResponse->addScriptCall("xajax_reset_perujuk");
		$objResponse->addScriptCall("xajax_list_data");
		return $objResponse;
	}
Beispiel #3
0
	function simpan_bhp($value) {
		$kon = new Konek;
		if(!$value['id_bhp'])
			$kon->sql = "INSERT INTO bhp(nama, biaya) VALUES ('".$value[nama]."', '".$value[biaya]."')";
		else 
			$kon->sql = "UPDATE bhp SET nama = '".$value[nama]."', biaya = '".$value[biaya]."' WHERE id = '".$value[id_bhp]."'";
		$kon->execute();
		$objResponse = new xajaxResponse();
		$objResponse->addScriptCall("show_status_simpan");
		$objResponse->addScriptCall("xajax_list_data", $_SESSION[setting_bhp][hal]);
		$objResponse->addScriptCall("xajax_reset_bhp");
		return $objResponse;
	}
Beispiel #4
0
	function simpan_pendidikan($value) {
		$kon = new Konek;
		if(!$value['id_pendidikan'])
			$kon->sql = "INSERT INTO ref_pendidikan(nama) VALUES ('".$value[nama]."')";
		else 
			$kon->sql = "UPDATE ref_pendidikan SET nama = '".$value[nama]."' WHERE id = '".$value[id_pendidikan]."'";
		$kon->execute();
		$objResponse = new xajaxResponse();
		$objResponse->addScriptCall("show_status_simpan");
		$objResponse->addAssign("id_pendidikan", "value", "");
		$objResponse->addAssign("nama", "value", "");
		$objResponse->addScriptCall("xajax_list_data", $_SESSION[hal]);
		$objResponse->addScriptCall("fokus", "nama");
		return $objResponse;
	}
Beispiel #5
0
    function get_bed($inputId, $id, $id_sel = NULL) {
		$objResponse = new xajaxResponse();
		$kon = new Konek;
		$kon->sql = "SELECT id,nomor FROM ref_kamar WHERE pelayanan_id = '".$id."' AND status=0 ORDER BY nomor";
		$kon->execute();
		$data = $kon->getAll();	
		$objResponse->addAssign($inputId, "options.length", "1");
		for($i=0;$i<sizeof($data);$i++) {
			if($data[$i][id] == $id_sel)
				$objResponse->addScript("addOption('".$inputId."','".$inputId."kamar_".$data[$i][id]."','".$data[$i][nama]."','".$data[$i][id]."',false,true);");
			else
				$objResponse->addScript("addOption('".$inputId."','".$inputId."_kamar_".$data[$i][id]."','".$data[$i][nama]."','".$data[$i][id]."',false,false);");
		}
		//$objResponse->addScript("addOption('".$inputId."','".$inputId."_tidak_ada_dokter','Dokter Lain','',false,false);");
		return $objResponse;
	}    			
Beispiel #6
0
      function getKarcis($id = null) {
         if(!$id) $id = $this->id;
         $kon = new Konek;
         $kon->sql = "
				SELECT
					k.pasien_id as pasien_id,
					k.kunjungan_id as kunjungan_id,
					kk.id as kunjungan_kamar_id,
					kkk.id as kunjungan_karcis_id,
					kkk.kwitansi_id as kwitansi_id,
					kw.tgl as tgl_kwitansi,
					kar.id as karcis_id,
					kar.nama as nama,
					kkk.jumlah as jumlah,
					kkk.biaya as biaya,
					kkk.bayar as bayar
				FROM
					kunjungan_kamar_karcis kkk
					JOIN karcis kar ON (kar.id = kkk.karcis_id)
					JOIN kwitansi kw ON (kw.id = kkk.kwitansi_id)
					JOIN kunjungan_kamar kk ON (kk.id = kkk.kunjungan_kamar_id)
					JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				WHERE
					kkk.kwitansi_id = '".$id."'
				GROUP BY
					kkk.id ";
         $kon->execute();
         $data = $kon->getAll();
         $this->pasien_id = $data[0][pasien_id];
         return $data;
      }
	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 get_pasien($val) {
		$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]));
		
		$title = "Statistik Kunjungan Berdasar Keadaan Keluar";
		
		unset($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar]);

		$kon = new Konek;
		if($val[jangka_waktu] == "hari") {
			$tanggal_awal = tanggalIndo($tgl_start, "j F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "j F Y");
			$_q .= "AND DATE(kk.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 kk.tgl_daftar) BETWEEN EXTRACT(YEAR_MONTH FROM '" . $tgl_start . "') AND EXTRACT(YEAR_MONTH FROM '" . $tgl_end . "')";
		} else {
			$tanggal_awal = tanggalIndo($tgl_start, "Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "Y");
			$_q .= "AND YEAR(kk.tgl_daftar) BETWEEN YEAR('" . $tgl_start . "') AND YEAR ('" . $tgl_end . "')";
		}

		$title .= "\nPeriode " . $tanggal_awal . " s.d. " . $tanggal_akhir;
		$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][title] = $title;
		$sql = "
			SELECT
				k.keadaan_keluar as nama,
				COUNT(k.id) as jml
			FROM
				kunjungan k
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
			WHERE
				keadaan_keluar IS NOT NULL
				$_q
			GROUP BY
				1
			ORDER BY 1
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$table = new Table;
		$table->scroll = false;
		$table->addTh("No", "Keadaan Keluar", "Jumlah", "%");
		$table->addExtraTh(
			"style=\"width:50px\"",
			"style=\"width:200px\"",
			"",
			"style=\"width:70px\""
		);
		$table->addTh("1", "2", "3", "4");
		for($i=0;$i<sizeof($data);$i++) {
			$total = $total+$data[$i][jml];
		}
		for($i=0;$i<sizeof($data);$i++) {
			$persen = round($data[$i][jml]/$total * 100, 2);
			$table->addRow(($i+1), $data[$i][nama], $data[$i][jml], $persen);

			$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][no][$i] = ($i+1);
			$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][nama][$i] = $data[$i][nama];
			$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][jml][$i] = $data[$i][jml];
			$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][persen][$i] = $persen;
			$persen_total += $persen;
		}
		$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][total] = $total;
		$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][persen_total] = round($persen_total);
		$table->addRow("", "<b>Total</b>", $_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][total], $_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][persen_total]);
		$ret = $table->build();
		if(empty($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][jml])) $_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][jml][0] = 1;
		if(empty($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][nama]))	$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][nama][0] = "No Data";
		

		$objResponse->addAssign("list_data", "innerHTML", $ret);
		$objResponse->addAssign("title", "innerHTML", nl2br($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][title]));
		$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][graph] = "<img src=\"" . URL . "rekmed/statistik_kunjungan_semua_keadaan_keluar_graph_pie/?md5=".md5(date("Ymdhis"))."\" alt=\"Pasien\" />";
		$objResponse->addAssign("graph", "innerHTML", $_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][graph]);
		return $objResponse;
	}
Beispiel #9
0
	function simpan_kecamatan($value) {
		$kon = new Konek;
		if(!$value['id_kecamatan']) {
			$sql = "INSERT INTO ref_kecamatan(kabupaten_id, nama) VALUES ('".$value[kabupaten_id]."', '".$value[nama]."')";
			$kon->sql = $sql;
		} else {
			$sql = "UPDATE ref_kecamatan SET kabupaten_id = '".$value[kabupaten_id]."', nama = '".$value[nama]."' WHERE id = '".$value[id_kecamatan]."'";
			$kon->sql = $sql;
		}
		$kon->execute();
		$objResponse = new xajaxResponse();
		$objResponse->addScriptCall("show_status_simpan");
		$objResponse->addScriptCall("xajax_reset_kecamatan");
		$objResponse->addScriptCall("show_this_only", $_SESSION[setting_kecamatan][hal]);
		$objResponse->addScriptCall("fokus", "nama");
		return $objResponse;
	}
Beispiel #10
0
      function get_no_antrian($val) {
         $tgl_periksa = $val[tgl_periksa_thn]."-".$val[tgl_periksa_bln]."-".$val[tgl_periksa_tgl];
         if($val[dokter_id]) $s = " AND dokter_id = '".$val[dokter_id]."' ";
         else $s = " AND dokter_id IS NULL ";
         $kon = new Konek;
         $sql = "
				SELECT
					CASE
						WHEN (MAX(no_antrian) IS NULL) THEN '1'
						ELSE (MAX(no_antrian) + 1)
					END AS no_antrian
				FROM
					kunjungan_kamar
				WHERE
					kamar_id = '".$val[kamar_id]."'
					AND DATE(tgl_periksa) = '".$tgl_periksa."'
					$s
			";
         $kon->sql = $sql;
         $kon->execute();
         $data = $kon->getOne();
         $objResponse = new xajaxResponse;
         $objResponse->addClear("tr_no_antrian", "style.display");
         $objResponse->addAssign("div_no_antrian", "innerHTML", $data[no_antrian]);
         $objResponse->addAssign("no_antrian", "value", $data[no_antrian]);
         return $objResponse;
      }
	function get_pasien($val) {
		$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]));
		
		$title = "Distribusi Pasien Menurut Pekerjaan";
		
		unset($_SESSION[rekmed][statistik_pasien_semua_pekerjaan]);

		$kon = new Konek;
		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 EXTRACT(YEAR_MONTH FROM '" . $tgl_start . "') AND EXTRACT(YEAR_MONTH FROM '" . $tgl_end . "')";
		} else {
			$tanggal_awal = tanggalIndo($tgl_start, "Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "Y");
			$_q .= "AND YEAR(p.tgl_daftar) BETWEEN YEAR('" . $tgl_start . "') AND YEAR ('" . $tgl_end . "')";
		}

		$title .= "\nPeriode " . $tanggal_awal . " s.d. " . $tanggal_akhir;
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][title] = $title;
		$sql = "
			SELECT
				rp.id as id,
				rp.nama as nama,
				COUNT(p.id) as jml
			FROM
				ref_pekerjaan rp
				JOIN pasien p ON (p.pekerjaan_id = rp.id)
			WHERE
				1=1
				$_q
			GROUP BY
				rp.id
			ORDER BY 3 DESC
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$table = new Table;
		$table->scroll = false;
		$table->addTh("No", "Pekerjaan", "Jumlah", "%");
		$table->addExtraTh(
			"style=\"width:50px\"",
			"style=\"width:200px\"",
			"",
			"style=\"width:70px\""
		);
		$table->addTh("1", "2", "3", "4");
		for($i=0;$i<sizeof($data);$i++) {
			$total = $total+$data[$i][jml];
		}
		for($i=0;$i<sizeof($data);$i++) {
			$persen = round($data[$i][jml]/$total * 100, 2);
			$table->addRow(($i+1), $data[$i][nama], $data[$i][jml], $persen);
			$table->addOnclickTd(
				"xajax_list_pasien('0', '".$data[$i][id]."', xajax.getFormValues('statistik_pasien_semua_pekerjaan'))", 
				"xajax_list_pasien('0', '".$data[$i][id]."', xajax.getFormValues('statistik_pasien_semua_pekerjaan'))", 
				"xajax_list_pasien('0', '".$data[$i][id]."', xajax.getFormValues('statistik_pasien_semua_pekerjaan'))", 
				"xajax_list_pasien('0', '".$data[$i][id]."', xajax.getFormValues('statistik_pasien_semua_pekerjaan'))");

			$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][no][$i] = ($i+1);
			$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][nama][$i] = $data[$i][nama];
			$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][jml][$i] = $data[$i][jml];
			$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][persen][$i] = $persen;
			$persen_total += $persen;
		}
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][total] = $total;
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][persen_total] = round($persen_total);
		$table->addRow("", "<b>Total</b>", $_SESSION[rekmed][statistik_pasien_semua_pekerjaan][total], $_SESSION[rekmed][statistik_pasien_semua_pekerjaan][persen_total]);
		$ret = $table->build();
		if(empty($_SESSION[rekmed][statistik_pasien_semua_pekerjaan][jml])) $_SESSION[rekmed][statistik_pasien_semua_pekerjaan][jml][0] = 1;
		if(empty($_SESSION[rekmed][statistik_pasien_semua_pekerjaan][nama]))	$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][nama][0] = "No Data";
		

		$objResponse->addAssign("list_data", "innerHTML", $ret);
		$objResponse->addAssign("title", "innerHTML", nl2br($_SESSION[rekmed][statistik_pasien_semua_pekerjaan][title]));
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][graph] = "<img src=\"" . URL . "rekmed/statistik_pasien_semua_pekerjaan_graph_pie/?md5=".md5(date("Ymdhis"))."\" alt=\"Pasien\" />";
		$objResponse->addAssign("graph", "innerHTML", $_SESSION[rekmed][statistik_pasien_semua_pekerjaan][graph]);
		return $objResponse;
	}
Beispiel #12
0
	function list_data($val) {
		unset($_SESSION[igd][pendapatan]);
		//get data karcis dan BHP
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$title = "Laporan Pembagian Jasa IRD";
		if($val[jangka_waktu] == "tahun") {
			$q = "AND YEAR(kw.tgl) BETWEEN '".$val[thn_start]."' AND '".$val[thn_end]."'";
			$title .= "\nPeriode " . $val[thn_start] . " - " . $val[thn_end];
		} elseif($val[jangka_waktu] == "bulan") {
			$q = "AND EXTRACT(YEAR_MONTH FROM kw.tgl) BETWEEN '".$val[thn_start].$val[bln_start]."' AND '".$val[thn_end].$val[bln_end]."'";
			$title .= "\nPeriode " . bulanIndo($val[bln_start], "F") . " " . $val[thn_start] . " - " . bulanIndo($val[bln_end], "F") . " " . $val[thn_end];
		} else {
			$q = "AND DATE(kw.tgl) BETWEEN '".$val[thn_start]."-".$val[bln_start]."-".$val[tgl_start]."' AND '".$val[thn_end]."-".$val[bln_end]."-".$val[tgl_end]."'";
			$title .= "\nPeriode " . tanggalIndo($val[thn_start] . "-" . $val[bln_start] . "-" . $val[tgl_start], "j F Y") . " - " . tanggalIndo($val[thn_end] . "-" . $val[bln_end] . "-" . $val[tgl_end], "j F Y");
		}
		$sql = "
			SELECT
				kb.nama as nama,
				hak.nama as nama_hak,
				SUM(ROUND(kb.mampu_bayar_bhp * bhp_p)) as bhp_p,
				SUM(ROUND(kb.mampu_bayar_bhp * bhp_rs_adm)) as bhp_rs_adm,
				SUM(ROUND(kb.mampu_bayar_bhp * bhp_rs_op)) as bhp_rs_op,
				SUM(ROUND(kb.mampu_bayar_jasa * jasa_p)) as jasa_p,
				SUM(ROUND(kb.mampu_bayar_jasa * jasa_rs_adm)) as jasa_rs_adm,
				SUM(ROUND(kb.mampu_bayar_jasa * jasa_rs_sdm)) as jasa_rs_sdm,
				SUM(ROUND(kb.mampu_bayar_jasa * jasa_rs_kembang)) as jasa_rs_kembang,
				SUM(ROUND(kb.mampu_bayar_jasa * jasa_rs_op)) as jasa_rs_op,

				SUM(ROUND(kb.mampu_bayar_jasa * spesialis * netto)) as spesialis,
				SUM(ROUND(kb.mampu_bayar_jasa * spesialis_pendamping * netto)) as spesialis_pendamping,
				SUM(ROUND(kb.mampu_bayar_jasa * perawat_perinatologi * netto)) as perawat_perinatologi,
				SUM(ROUND(kb.mampu_bayar_jasa * dr_umum * netto)) as dr_umum,
				SUM(ROUND(kb.mampu_bayar_jasa * dr_gigi * netto)) as dr_gigi,
				SUM(ROUND(kb.mampu_bayar_jasa * assisten_non_dokter * netto)) as assisten_non_dokter,
				SUM(ROUND(kb.mampu_bayar_jasa * spesialis_anestesi * netto)) as spesialis_anestesi,
				SUM(ROUND(kb.mampu_bayar_jasa * aknest * netto)) as aknest,
				SUM(ROUND(kb.mampu_bayar_jasa * gizi * netto)) as gizi,
				SUM(ROUND(kb.mampu_bayar_jasa * fisioterapi * netto)) as fisioterapi,
				SUM(ROUND(kb.mampu_bayar_jasa * analis_pa * netto)) as analis_pa,
				SUM(ROUND(kb.mampu_bayar_jasa * bidan * netto)) as bidan,
				SUM(ROUND(kb.mampu_bayar_jasa * perawat * netto)) as perawat,
				SUM(ROUND(kb.mampu_bayar_jasa * penunjang * netto)) as penunjang,
				SUM(ROUND(kb.mampu_bayar_jasa * ugp * netto)) as ugp,
				SUM(ROUND(kb.mampu_bayar_jasa * grabaf * netto)) as grabaf,
				SUM(ROUND(kb.mampu_bayar_jasa * zakat * netto)) as zakat,
				SUM(ROUND(pajak * (kb.mampu_bayar_jasa - kb.mampu_bayar_jasa * kb.jasa_p - kb.mampu_bayar_jasa * kb.jasa_rs_op - kb.mampu_bayar_jasa * kb.jasa_rs_kembang - kb.mampu_bayar_jasa * kb.jasa_rs_adm - kb.mampu_bayar_jasa * kb.jasa_rs_sdm))) as pajak,
				SUM(kb.mampu_bayar_bhp+kb.mampu_bayar_jasa) as mampu_bayar
			FROM
				kunjungan_bayar kb
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
				JOIN hak ON (hak.id = kb.hak_id)
				JOIN kwitansi kw ON (kw.id = kb.kwid)
			WHERE
				(kb.karcis_id IS NOT NULL OR kb.bhp_id IS NOT NULL)
				AND kw.tempat_pembayaran = 'IRD'
				$q
			GROUP BY
				kb.karcis_id, kb.bhp_id, kb.hak_id
		";
		//$objResponse->addAssign("debug", "innerHTML", nl2br($sql));
		$kon->sql = $sql;
		$kon->execute();
		$data_karcis = $kon->getAll();

		$table = new Table;
		$table->anime_bg_color = false;
		$table->addTh("Jasa", "Pemilik", "BHP", "JASA RS", "Sp", "Sp1", "SpAn", "UGP", "GRABAF", "Prwt", /*"Ass Non Dokter", "Aknest", "Gizi", "Fisio", "Analis PA", "Bidan", */"Pnjg", "Zakat", "Pajak", "Sub Total");
		$table->addExtraTh("rowspan=\"2\"", "rowspan=\"2\"", "colspan=\"5\"", "colspan=\"5\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"");
		$table->addTh("Pemda", "Adm", "Op", "Rad", "Lab", "Pemda", "Adm", "Sdm", "Bang", "Op");
		for($i=0;$i<sizeof($data_karcis);$i++) {
			$table->addRow(
				$data_karcis[$i][nama], 
				$data_karcis[$i][nama_hak],
				$data_karcis[$i][bhp_p],
				$data_karcis[$i][bhp_rs_adm],
				$data_karcis[$i][bhp_rs_op],
				"?",
				"?",
				uangIndo($data_karcis[$i][jasa_p], false),
				uangIndo($data_karcis[$i][jasa_rs_adm], false),
				uangIndo($data_karcis[$i][jasa_rs_sdm], false),
				uangIndo($data_karcis[$i][jasa_rs_kembang], false),
				uangIndo($data_karcis[$i][jasa_rs_op], false),

				uangIndo($data_karcis[$i][spesialis], false),
				uangIndo($data_karcis[$i][spesialis_pendamping], false),
				uangIndo($data_karcis[$i][spesialis_anestesi], false),
				//uangIndo($data_karcis[$i][dr_umum] + $data_karcis[$i][dr_gigi] + $data_karcis[$i][ugp], false),
				uangIndo($data_karcis[$i][ugp], false),
				uangIndo($data_karcis[$i][grabaf], false),
				//uangIndo($data_karcis[$i][perawat] + $data_karcis[$i][perawat_perinatologi], false),
				uangIndo($data_karcis[$i][perawat], false),
				/*uangIndo($data_karcis[$i][assisten_non_dokter], false),
				uangIndo($data_karcis[$i][aknest], false),
				uangIndo($data_karcis[$i][gizi], false),
				uangIndo($data_karcis[$i][fisioterapi], false),
				uangIndo($data_karcis[$i][analis_pa], false),
				uangIndo($data_karcis[$i][bidan], false),*/
				uangIndo($data_karcis[$i][penunjang], false),
				uangIndo($data_karcis[$i][zakat], false),
				uangIndo($data_karcis[$i][pajak], false),
				uangIndo($data_karcis[$i][mampu_bayar], false)

				/*
				$data_karcis[$i][assisten_non_dokter],
				$data_karcis[$i][aknest],
				$data_karcis[$i][gizi],
				$data_karcis[$i][fisioterapi],
				$data_karcis[$i][analis_pa],
				$data_karcis[$i][bidan],
				*/
			);
			$table->addExtraTr("onclick=\"setBg(this);\"");

			$total[bhp_p] += $data_karcis[$i][bhp_p];
			$total[bhp_rs_adm] += $data_karcis[$i][bhp_rs_adm];
			$total[bhp_rs_op] += $data_karcis[$i][bhp_rs_op];
			$total[jasa_p] += $data_karcis[$i][jasa_p];
			$total[jasa_rs_adm] += $data_karcis[$i][jasa_rs_adm];
			$total[jasa_rs_sdm] += $data_karcis[$i][jasa_rs_sdm];
			$total[jasa_rs_kembang] += $data_karcis[$i][jasa_rs_kembang];
			$total[jasa_rs_op] += $data_karcis[$i][jasa_rs_op];
			$total[spesialis] += $data_karcis[$i][spesialis];
			$total[spesialis_pendamping] += $data_karcis[$i][spesialis_pendamping];
			$total[spesialis_anestesi] += $data_karcis[$i][spesialis_anestesi];
			//$total[ugp] += $data_karcis[$i][dr_umum] + $data_karcis[$i][dr_gigi] + $data_karcis[$i][ugp];
			$total[ugp] += $data_karcis[$i][ugp];
			$total[grabaf] += $data_karcis[$i][grabaf];
			//$total[perawat] += $data_karcis[$i][perawat]+$data_karcis[$i][perawat_perinatologi];
			$total[perawat] += $data_karcis[$i][perawat];
			/*$total[assisten_non_dokter] += $data_karcis[$i][assisten_non_dokter];
			$total[aknest] += $data_karcis[$i][aknest];
			$total[gizi] += $data_karcis[$i][gizi];
			$total[fisioterapi] += $data_karcis[$i][fisioterapi];
			$total[analis_pa] += $data_karcis[$i][analis_pa];
			$total[bidan] += $data_karcis[$i][bidan];*/
			$total[penunjang] += $data_karcis[$i][penunjang];
			$total[zakat] += $data_karcis[$i][zakat];
			$total[pajak] += $data_karcis[$i][pajak];
			$total[mampu_bayar] += $data_karcis[$i][mampu_bayar];
		}
		$table->addTfoot(
			"Total", 
			uangIndo($total[bhp_p], false), 
			uangIndo($total[bhp_rs_adm], false), 
			uangIndo($total[bhp_rs_op], false), 
			"?", 
			"?", 
			uangIndo($total[jasa_p], false), 
			uangIndo($total[jasa_rs_adm], false), 
			uangIndo($total[jasa_rs_sdm], false), 
			uangIndo($total[jasa_rs_kembang], false), 
			uangIndo($total[jasa_rs_op], false), 
			uangIndo($total[spesialis], false), 
			uangIndo($total[spesialis_pendamping], false), 
			uangIndo($total[spesialis_anestesi], false), 
			uangIndo($total[ugp], false), 
			uangIndo($total[grabaf], false), 
			uangIndo($total[perawat], false), 
			/*uangIndo($total[assisten_non_dokter], false), 
			uangIndo($total[aknest], false), 
			uangIndo($total[gizi], false), 
			uangIndo($total[fisioterapi], false), 
			uangIndo($total[analis_pa], false), 
			uangIndo($total[bidan], false), */
			uangIndo($total[penunjang], false), 
			uangIndo($total[zakat], false), 
			uangIndo($total[pajak], false), 
			uangIndo($total[mampu_bayar], false)
			);
		$table->addExtraTfoot("colspan=\"2\"");
		$content = $table->build();
		$judul = nl2br($title);
		$objResponse->addAssign("title", "innerHTML", $judul);
		$objResponse->addAssign("list_data", "innerHTML", $content);
		$_SESSION[igd][pendapatan][title] = $judul;
		$_SESSION[igd][pendapatan][content] = $content;
		return $objResponse;
	}
Beispiel #13
0
	function daftar_penunjang($val) {
		$kon = new Konek;
		$objResponse = new xajaxResponse;
		if($val[dp_lab] == "1") {
			$sql = "
			INSERT INTO lab_kunjungan(
				pasien_id, 
				kunjungan_kamar_id, 
				kelas, 
				tgl_daftar, 
				tgl_periksa, 
				pengirim, 
				cara_masuk, 
				cara_bayar, 
				jenis_askes, 
				perusahaan_id, 
				nomor, 
				pj_nama, 
				pj_alamat, 
				pj_telp, 
				pj_hubungan_keluarga) 
			SELECT 
				k.pasien_id,
				kk.id,
				kmr.kelas,
				NOW(),
				NOW(),
				'".$val[dp_pengirim]."',
				'IGD',
				kk.cara_bayar,
				kk.jenis_askes,
				kk.perusahaan_id,
				kk.nomor,
				kk.pj_nama, 
				kk.pj_alamat, 
				kk.pj_telp, 
				kk.pj_hubungan_keluarga
			FROM
				kunjungan k
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
			WHERE
				kk.id = '".$val[dp_idkk]."'
			";
			$kon->sql = $sql;
			$kon->execute();
		}
		if($val[dp_radio] == "1") {
			$sql = "
			INSERT INTO radio_kunjungan(
				pasien_id, 
				kunjungan_kamar_id, 
				kelas, 
				tgl_daftar, 
				tgl_periksa, 
				pengirim, 
				cara_masuk, 
				cara_bayar, 
				jenis_askes, 
				perusahaan_id, 
				nomor, 
				pj_nama, 
				pj_alamat, 
				pj_telp, 
				pj_hubungan_keluarga) 
			SELECT 
				k.pasien_id,
				kk.id,
				kmr.kelas,
				NOW(),
				NOW(),
				'".$val[dp_pengirim]."',
				'IGD',
				kk.cara_bayar,
				kk.jenis_askes,
				kk.perusahaan_id,
				kk.nomor,
				kk.pj_nama, 
				kk.pj_alamat, 
				kk.pj_telp, 
				kk.pj_hubungan_keluarga
			FROM
				kunjungan k
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
			WHERE
				kk.id = '".$val[dp_idkk]."'
			";
			$kon->sql = $sql;
			$kon->execute();
		}
		if($val[dp_radio] == "1") {
			$sql = "
			INSERT INTO radio_kunjungan(
				pasien_id, 
				kunjungan_kamar_id, 
				kelas, 
				tgl_daftar, 
				tgl_periksa, 
				pengirim, 
				cara_masuk, 
				cara_bayar, 
				jenis_askes, 
				perusahaan_id, 
				nomor, 
				pj_nama, 
				pj_alamat, 
				pj_telp, 
				pj_hubungan_keluarga) 
			SELECT 
				k.pasien_id,
				kk.id,
				kmr.kelas,
				NOW(),
				NOW(),
				'".$val[dp_pengirim]."',
				'IGD',
				kk.cara_bayar,
				kk.jenis_askes,
				kk.perusahaan_id,
				kk.nomor,
				kk.pj_nama, 
				kk.pj_alamat, 
				kk.pj_telp, 
				kk.pj_hubungan_keluarga
			FROM
				kunjungan k
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
			WHERE
				kk.id = '".$val[dp_idkk]."'
			";
			$kon->sql = $sql;
			$kon->execute();
		}
		if($val[dp_vk] == "1") {
			$sql = "INSERT INTO kunjungan_kamar( parent_id, kunjungan_id, kamar_id, tgl_daftar, tgl_periksa, cara_bayar, jenis_askes, perusahaan_id, nomor, pj_nama, pj_alamat, pj_telp, pj_hubungan_keluarga ) SELECT id, kunjungan_id, '61', NOW(), NOW(), cara_bayar, jenis_askes, perusahaan_id, nomor, pj_nama, pj_alamat, pj_telp, pj_hubungan_keluarga FROM kunjungan_kamar WHERE id = '".$val[dp_idkk]."' "; 
			$kon->sql = $sql; $kon->execute(); 		
		}
		if($val[dp_anestesi] == "1") {
			$sql = "INSERT INTO kunjungan_kamar( parent_id, kunjungan_id, kamar_id, tgl_daftar, tgl_periksa, cara_bayar, jenis_askes, perusahaan_id, nomor, pj_nama, pj_alamat, pj_telp, pj_hubungan_keluarga ) SELECT id, kunjungan_id, '81', NOW(), NOW(), cara_bayar, jenis_askes, perusahaan_id, nomor, pj_nama, pj_alamat, pj_telp, pj_hubungan_keluarga FROM kunjungan_kamar WHERE id = '".$val[dp_idkk]."' "; 
			$kon->sql = $sql; $kon->execute(); 		
		}
		if($val[dp_roperasi] == "1") {
			$sql = "INSERT INTO kunjungan_kamar( parent_id, kunjungan_id, kamar_id, tgl_daftar, tgl_periksa, cara_bayar, jenis_askes, perusahaan_id, nomor, pj_nama, pj_alamat, pj_telp, pj_hubungan_keluarga ) SELECT id, kunjungan_id, '71', NOW(), NOW(), cara_bayar, jenis_askes, perusahaan_id, nomor, pj_nama, pj_alamat, pj_telp, pj_hubungan_keluarga FROM kunjungan_kamar WHERE id = '".$val[dp_idkk]."' "; 
			$kon->sql = $sql; $kon->execute(); 		
		}
		//$objResponse->addAssign("debug", "innerHTML", nl2br($sql));
		$objResponse->addScriptCall("show_status_simpan");
		$objResponse->addScriptCall("tutup_daftar_penunjang");
		return $objResponse;
	}
Beispiel #14
0
	function simpan_kamar($value) {
		$kon = new Konek;
		if(!$value['id_kamar'])
			$sql = "INSERT INTO kamar(pelayanan_id, kelas, nama, jml_bed,tarif_umum,tarif_asuransi,no_kamar) VALUES ('".$value[pelayanan_id]."', '".$value[kelas]."', '".$value[nama]."', NULLIF('".$value[jml_bed]."', ''),NULLIF('".$value[tarif_umum]."', ''),NULLIF('".$value[tarif_asuransi]."', ''),NULLIF('".$value[no_kamar]."', ''))";
		else 
			$sql = "UPDATE kamar SET pelayanan_id = '".$value[pelayanan_id]."', kelas = '".$value[kelas]."', nama = '".$value[nama]."', jml_bed = NULLIF('".$value[jml_bed]."', ''), tarif_umum = NULLIF('".$value[tarif_umum]."', ''), tarif_asuransi = NULLIF('".$value[tarif_asuransi]."', ''),no_kamar=NULLIF('".$value[no_kamar]."', '') WHERE id = '".$value[id_kamar]."'";
		$kon->sql = $sql;
		$kon->execute();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign('debug', 'innerHTML', $sql);
		$objResponse->addScriptCall("show_status_simpan");
		$objResponse->addScriptCall("xajax_list_data", $_SESSION[modul_setting][kamar][hal]);
		//panggil sidebar bangsal
		$objResponse->addScriptCall("xajax_info_get_kamar_kosong");
		$objResponse->addScriptCall("xajax_reset_kamar");
		return $objResponse;
	}
Beispiel #15
0
	function hapus_kunjungan_bayar($id) {
		$kon = new Konek;
		$objResponse = new xajaxResponse;
		$kon->sql = "DELETE FROM kunjungan_bayar WHERE id = '".$id."'";
		$kon->execute();
		return $objResponse;
	}
Beispiel #16
0
	function simpan_karcis($value) {
		$kon = new Konek;
		if(!$value['id_karcis']) {
			$sql = "
			INSERT INTO 
				karcis(
					nama,
					jenis,
					kelas, 
					biaya_bhp, 
					biaya_jasa, 
					bhp_p, 
					bhp_rs, 
					bhp_rs_adm, 
					bhp_rs_op, 
					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

				) 
			VALUES (
					'".$value[nama]."',
					'".$value[jenis]."',
					'".$value[kelas]."', 
					'".$value[biaya_bhp]."', 
					'".$value[biaya_jasa]."', 
					'".$value[bhp_p]."', 
					'".$value[bhp_rs]."', 
					'".$value[bhp_rs_adm]."', 
					'".$value[bhp_rs_op]."', 
					'".$value[jasa_p]."', 
					'".$value[jasa_rs]."', 
					'".$value[jasa_rs_op]."', 
					'".$value[jasa_rs_kembang]."', 
					'".$value[jasa_rs_adm]."', 
					'".$value[jasa_rs_sdm]."', 
					'".$value[spesialis]."', 
					'".$value[spesialis_pendamping]."', 
					'".$value[ugp]."', 
					'".$value[grabaf]."', 
					'".$value[perawat]."', 
					'".$value[penunjang]."', 
					'".$value[zakat]."', 
					'".$value[pajak]."', 
					'".$value[netto]."'
			)
			";
		} else {
			$sql = "
			UPDATE 
				karcis 
			SET 
				nama = '".$value[nama]."',
				jenis =	'".$value[jenis]."',
				kelas =	'".$value[kelas]."', 
				biaya_bhp = '".$value[biaya_bhp]."', 
				biaya_jasa = '".$value[biaya_jasa]."', 
				bhp_p = '".$value[bhp_p]."', 
				bhp_rs	= '".$value[bhp_rs]."', 
				bhp_rs_adm	= '".$value[bhp_rs_adm]."', 
				bhp_rs_op	= '".$value[bhp_rs_op]."', 
				jasa_p	= '".$value[jasa_p]."', 
				jasa_rs	= '".$value[jasa_rs]."', 
				jasa_rs_op	= '".$value[jasa_rs_op]."', 
				jasa_rs_kembang	= '".$value[jasa_rs_kembang]."', 
				jasa_rs_adm	= '".$value[jasa_rs_adm]."', 
				jasa_rs_sdm	= '".$value[jasa_rs_sdm]."', 
				spesialis	= '".$value[spesialis]."', 
				spesialis_pendamping	= '".$value[spesialis_pendamping]."', 
				ugp	= '".$value[ugp]."', 
				grabaf	= '".$value[grabaf]."', 
				perawat	= '".$value[perawat]."', 
				penunjang	= '".$value[penunjang]."', 
				zakat	= '".$value[zakat]."', 
				pajak	= '".$value[pajak]."', 
				netto	= '".$value[netto]."'
			WHERE 
				id = '".$value[id_karcis]."'
			";
		}
		$kon->sql = $sql;
		$kon->execute();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$objResponse->addScriptCall("show_status_simpan");
		$objResponse->addScriptCall("xajax_list_data", $_SESSION[setting_karcis][hal]);
		$objResponse->addScriptCall("xajax_reset_karcis");
		return $objResponse;
	}
Beispiel #17
0
      function get_desa($id_kecamatan, $id_sel = null) {
         $kon = new Konek;
         $kon->sql = "
				SELECT
					id,
					nama
				FROM
					ref_desa
				WHERE
					kecamatan_id = '".$id_kecamatan."'
				ORDER BY
					nama
			";
         $kon->execute();
         $data = $kon->getAll();
         $objResponse = new xajaxResponse();
         $objResponse->addAssign("cari_desa_id", "options.length", "1");
         for($i = 0; $i < sizeof($data); $i++) {
            if($data[$i][id] == $id_sel) {
               $objResponse->addScript("addOption('cari_desa_id','desa_".$data[$i][id]."','".$data[$i][nama].
                  "','".$data[$i][id]."',false,true);");
            } else {
               $objResponse->addScript("addOption('cari_desa_id','desa_".$data[$i][id]."','".$data[$i][nama].
                  "','".$data[$i][id]."',false,false);");
            }
         }
         //$objResponse->addScript("addOption('desa_id','add_desa','--- TAMBAH KELURAHAN ---','add_desa');");
         return $objResponse;
      }
Beispiel #18
0
      function simpan_pasien($value) {
      	 global $last_id;
         $objResponse = new xajaxResponse();
         $kon = new Konek;
         if(!$value['id_pasien']) {
            if(!$value['id']) {
               $sql = "
						INSERT INTO pasien(
							nama,
							tempat_lahir,
							tgl_lahir,
							gol_darah,
							sex,
							agama,
							pendidikan_id,
							pekerjaan_id,
							status_nikah,
							alamat,
							rt,
							rw,
							desa_id,
							telp,
							tgl_daftar,
                            nama_ayah,
                            nama_ibu,
                            nama_suami,
                            nama_istri,
                            no_ktp_sim,
                            created_datetime,
                            created_user,                           
                            kode_petugas
							)
						VALUES (
							'".$value[nama]."',
							'".$value[tempat_lahir]."',
							'".$value[tgl_lahir_thn]."-".$value[tgl_lahir_bln]."-".$value[tgl_lahir_tgl].
                  "',
							NULLIF('".$value[gol_darah_id]."',''),
							'".$value[sex]."',
							'".$value[agama]."',
							'".$value[pendidikan_id]."',
							'".$value[pekerjaan_id]."',
							'".$value[status_nikah]."',
							'".$value[alamat]."',
							'".$value[rt]."',
							'".$value[rw]."',
							'".$value[desa_id]."',
							'".$value[telp]."',
							NOW(),
                            '".$value[nama_ayah]."',
                            '".$value[nama_ibu]."',
                            '".$value[nama_suami]."',
                            '".$value[nama_istri]."',
                            '".$value[no_ktp_sim]."',
                             NOW(),
                            '".$_SESSION[username]."',
                            '".$value[nama_petugas]."'
						)";
						$kon->sql = $sql;
						$kon->execute();
						$afek = $kon->affected_rows;
						$last_id = $kon->last_id;
						
						//update no rekam medis
						$sql = "
			 					SELECT p.id as 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 FROM pasien p WHERE id='".$last_id."'";
            			$kon->sql = $sql;
            			$kon->execute();
            			$data = $kon->getOne();             
            
             
            			$sql = "UPDATE pasien SET no_rm ='".$data[id_display]."' WHERE id = '".$last_id."'";
            			$kon->sql = $sql;
            			$kon->execute();

            } else {
               $sql = "
						INSERT INTO pasien(
							id,
							nama,
							tempat_lahir,
							tgl_lahir,
							gol_darah,
							sex,
							agama,
							pendidikan_id,
							pekerjaan_id,
							status_nikah,
							alamat,
							rt,
							rw,
							desa_id,
							telp,
							tgl_daftar,
                            nama_ayah,
                            nama_ibu,
                            nama_suami,
                            nama_istri,
                            no_ktp_sim,
                            created_datetime,
                            created_user,
                            kode_petugas
							)
						VALUES (
							'".$value[id]."',
							'".$value[nama]."',
							'".$value[tempat_lahir]."',
							'".$value[tgl_lahir_thn]."-".$value[tgl_lahir_bln]."-".$value[tgl_lahir_tgl].
                  "',
							NULLIF('".$value[gol_darah_id]."',''),
							'".$value[sex]."',
							'".$value[agama]."',
							'".$value[pendidikan_id]."',
							'".$value[pekerjaan_id]."',
							'".$value[status_nikah]."',
							'".$value[alamat]."',
							'".$value[rt]."',
							'".$value[rw]."',
							'".$value[desa_id]."',
							'".$value[telp]."',
							NOW(),
                            '".$value[nama_ayah]."',
                            '".$value[nama_ibu]."',
                            '".$value[nama_suami]."',
                            '".$value[nama_istri]."',
                            '".$value[no_ktp_sim]."',
                            NOW(),
                            '".$_SESSION[username]."',
                            '".$value[nama_petugas]."'
						)";
				$kon->sql = $sql;
            	$kon->execute();
            	$afek = $kon->affected_rows;
            	$last_id = $kon->last_id;
				$_SESSION[id] = $kon->last_id;
            }
            
			
			//update no rekam medis
             $sql = "
			 SELECT p.id as 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
FROM pasien p WHERE id='".$last_id."'";
            $kon->sql = $sql;
            $kon->execute();
            $data = $kon->getOne();             
            
             
            $sql = "UPDATE pasien SET no_rm ='".$data[id_display]."' WHERE id = '".$last_id."'";
            $kon->sql = $sql;
            $kon->execute();
         } else {
            $sql1 = "
					UPDATE pasien SET
						id = '".$value[id]."',
						nama= '".$value[nama]."',
						tempat_lahir = '".$value[tempat_lahir]."',
						tgl_lahir= '".$value[tgl_lahir_thn]."-".$value[tgl_lahir_bln]."-".$value[tgl_lahir_tgl].
               "',
						gol_darah = NULLIF('".$value[gol_darah_id]."', ''),
						sex= '".$value[sex]."',
						agama= '".$value[agama]."',
						pendidikan_id= '".$value[pendidikan_id]."',
						pekerjaan_id= '".$value[pekerjaan_id]."',
						status_nikah= '".$value[status_nikah]."',
						alamat= '".$value[alamat]."',
						rt= '".$value[rt]."',
						rw= '".$value[rw]."',
						desa_id= '".$value[desa_id]."',
						telp= '".$value[telp]."',
                        nama_ayah= '".$value[nama_ayah]."',
                        nama_ibu= '".$value[nama_ibu]."',
                        nama_suami= '".$value[nama_suami]."',
                        nama_istri= '".$value[nama_istri]."',
                        no_ktp_sim= '".$value[no_ktp_sim]."',
                        update_time=NOW(),
                        update_user='".$_SESSION[username]."',
                        kode_petugas='".$value[nama_petugas]."'
					WHERE
						id = '".$value[id_pasien]."'";
            $kon->sql = $sql1;
            $kon->execute();
            //$afek = $kon->affected_rows;
            $afek = $kon->getJml();
            $last_id = $value[id];
            //$last_id = $kon->last_id;
            //$_SESSION[id] = $kon->last_id;


			 //update no rekam medis
             $sql = "
			 SELECT p.id as 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
FROM pasien p WHERE id='".$value[id_pasien]."'";
            $kon->sql = $sql;
            $kon->execute();
            $data = $kon->getOne();             
            
             
            $sql = "UPDATE pasien SET no_rm ='".$data[id_display]."' WHERE id = '".$value[id_pasien]."'";
            $kon->sql = $sql;
            $kon->execute();
            $id_pasien = $last_id;
         }

         if($afek < 0) {
            $objResponse->addAlert("ewe");
            //$objResponse->addAssign("debug", "innerHTML", $sql);
            $objResponse->addScriptCall("fokus", "id");
         } else {
            //$objResponse->addAssign("debug", "innerHTML", $sql);
            /*
            tambah data kunjungan
            */
            $sql_kunjungan_ke = "
					SELECT
						CASE
							WHEN (MAX(kunjungan_ke) IS NULL) THEN '1'
							ELSE (MAX(kunjungan_ke) + 1)
						END AS kunjungan_ke
					FROM
						kunjungan
					WHERE
						pasien_id = '".$last_id."'
				";
            $kon->sql = $sql_kunjungan_ke;
            $kon->execute();
            $kunjungan_ke = $kon->getOne();
            $sql_kunjungan = "
					INSERT INTO
						kunjungan(
							kunjungan_ke,
							pasien_id,
							perujuk_id,
							cara_masuk
						) VALUES(
							'".$kunjungan_ke[kunjungan_ke]."',
							'".$last_id."',
							NULLIF('".$value[perujuk_id]."', ''),
							'".$value[cara_masuk]."'
					)";
            $kon->sql = $sql_kunjungan;
            $kon->execute();
            //$id_kunjungan = $kon->last_id;
            
            $sql_last = "SELECT * FROM kunjungan WHERE LAST_INSERT_ID(id) ORDER BY id DESC LIMIT 1";
            $kon->sql = $sql_last;
            $kon->execute();
            $idk = $kon->getOne();
            $id_kunjungan = $idk[id];
            
            //$objResponse->addAssign("debug", "innerHTML", $sql_kunjungan);
            /*
            masuk IGD
            */
            $sql_kamar = "
					INSERT INTO
						kunjungan_kamar(
							kunjungan_id,
							kamar_id,
							tgl_daftar,
							tgl_periksa,
							tgl_keluar,
							cara_bayar,
							jenis_askes,
							perusahaan_id,
							nomor,
							pj_nama,
							pj_alamat,
							pj_telp,
							pj_hubungan_keluarga
						) VALUES (
							'".$id_kunjungan."',
							1,
							NOW(),
							NOW(),
							NOW(),
							'".$value[cara_bayar]."',
							NULLIF('".$value[jenis_askes]."',''),
							NULLIF('".$value[perusahaan_id]."',''),
							NULLIF('".$value[nomor]."',''),
							'".$value[pj_nama]."',
							'".$value[pj_alamat]."',
							'".$value[pj_telp]."',
							NULLIF('".$value[pj_hubungan_keluarga]."', '')
					)
				";
            $kon->sql = $sql_kamar;
            $kon->execute();
            $objResponse->addAlert("'".$sql_kamar."'");
            //$id_kunjungan_kamar = $kon->last_id;
            $sql_last = "select * from kunjungan_kamar where LAST_INSERT_ID(id) ORDER BY id DESC LIMIT 1";
            $kon->sql = $sql_last;
            $kon->execute();
            $id_kamar = $kon->getOne();
            $id_kunjungan_kamar = $id_kamar[id];
            
            $kon->sql = "INSERT INTO tracer (kunjungan_kamar_id, pasien_id, keperluan, tgl_keluar, cetak) VALUES ('".
               $id_kunjungan_kamar."', '".$last_id."', 'PEMERIKSAAN', NOW(), 'BELUM')";
            $kon->execute();

            $afek_kunjungan = $kon->affected_rows;
            //$objResponse->addAppend("debug", "innerHTML", $sql_kamar);
            if($afek_kunjungan < 0) {
               $objResponse->addAlert("Data Kunjungan Tidak Dapat Disimpan.\nCek kembali.");
               //$objResponse->addAssign("debug", "innerHTML", $sql);
               $objResponse->addScriptCall("fokus", "id");
            } else {
               if($value[bayar_karcis] == "1") {
                  $kon->sql = "SELECT biaya_jasa FROM karcis WHERE id='34'";
                  $kon->execute();
                  $bayar = $kon->getOne();
                  //$id_kwitansi = bikinKwitansi("IRD", $bayar[biaya_jasa], "LUNAS");
                  $sql = "
							INSERT INTO
								kunjungan_bayar (
									nama,
									kunjungan_kamar_id,
									karcis_id,
									hak_id,
									biaya_bhp,
									biaya_jasa,
									jumlah,
									bayar_bhp,
									bayar_jasa,
									mampu_bayar_bhp,
									mampu_bayar_jasa,
									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,
									kwid
								) SELECT
									nama,
									'".$id_kunjungan_kamar."',
									'34',
									'25',
									biaya_bhp,
									biaya_jasa,
									'1',
									biaya_bhp,
									biaya_jasa,
									biaya_bhp,
									biaya_jasa,
									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,
									'".$id_kwitansi."'
								FROM
									karcis
								WHERE
									id = '34'
						";
                  $kon->sql = $sql;
                  //$objResponse->addAppend("debug", "innerHTML", $sql);
                  $kon->execute();
                  
				  /*$idkb = $kon->last_id;
                  $kon->sql = "INSERT INTO kwitansi_detil(kunjungan_bayar_id, kwitansi_id, angsuran_bhp, angsuran_jasa) SELECT '".
                     $idkb."', '".$id_kwitansi."', biaya_bhp, biaya_jasa FROM karcis WHERE id='34'";
                  $kon->execute();*/
               }
               $objResponse->addConfirmCommands(1, "Cetak Kartu Periksa?");
               $objResponse->addScriptCall("cetak", URL."pendaftaran/kartu_periksa_cetak/?id=".
                  $last_id, 350, 210);
               $objResponse->addScriptCall("show_status_simpan");
               $objResponse->addScriptCall("xajax_reset_pasien");
               $objResponse->addScriptCall("get_sidebar_content");
               $objResponse->addScriptCall("fokus", "id");
            }
         }
         //$objResponse->addScriptCall("xajax_list_data_dua", $_SESSION[hal], $_SESSION[val]);
         return $objResponse;
      }
    function bayar_uang_muka($val){
        $kon = new Konek;
        $objResponse= new xajaxResponse;
       	$kon->sql = "SELECT kb.id as id, kb.bayar_bhp as bayar_bhp, kb.biaya_jasa as bayar_jasa 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 kk.kunjungan_id = '".$val[lb_id_kunjungan]."' AND kwd.kwitansi_id IS NULL";
        $_SESSION[idkk] = $val[lb_id_kunjungan];
		$kon->execute();
		$data = $kon->getAll();
		if(!empty($data)) {
		  for($i=0;$i<sizeof($data);$i++){
		      $kon->sql= "update kunjungan_bayar set uang_muka = '".$data[$i][lb_uang_muka]."' WHERE id = '".$data[$i][id]."'";
              $kon->execute();
		  }
		}
        return $objResponse;
    }
Beispiel #20
0
	function buka_list_kunjungan($hal=0, $pasien_id) {
		$paging = new MyPagina;
		$paging->onclick_func = "xajax_buka_list_kunjungan";
		$paging->setOnclickValue("'".$pasien_id."'");
		$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 no_rm,
				p.nama as nama,
				p.sex as sex,
				k.id as id_kunjungan,
				kk.id as id_kunjungan_kamar,
				k.kunjungan_ke as kunjungan_ke,
				pel.jenis as jenis_pelayanan,
				pel.nama as pelayanan,
				kmr.nama as kamar,
				kk.tgl_periksa as tgl_periksa,
				CONCAT(i.kode_icd,' - ', i.nama) as diagnosa,
				d.nama as dokter
			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)
				LEFT JOIN dokter d ON (d.id = kk.dokter_id)
			WHERE
				p.id = '".$pasien_id."'
			GROUP BY
				kk.id
			ORDER BY 
				kk.id
		";
		$paging->sql = $sql;
		$paging->get_page_result();

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->tbody_height = 300;
		$table->addTh(
			"No", 
			"Kunjungan Ke/<br />Tanggal Kunjung", 
			"Pemeriksaan"
		);	
		$table->addExtraTh(
			"style=\"width:30px;\"",
			"style=\"width:90px;\"",
			""
		);
		$kon = new Konek;
		for($i=0;$i<sizeof($data);$i++) {
		
			//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 = '".$data[$i][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_bayar kkbhp
					JOIN bhp ON (bhp.id = kkbhp.bhp_id)
				WHERE
					kkbhp.kunjungan_kamar_id = '".$data[$i][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 = '".$data[$i][id_kunjungan_kamar]."'
				GROUP BY
					kki.id
			";
			$kon->execute();
			$data_im = $kon->getAll();
			*/
			$pem = "<ul>";
			
			$pem .= "<li><b>Pelayanan :</b> " . $data[$i][jenis_pelayanan] . " - " . $data[$i][kamar] . "</li>";
			$pem .= "<li><b>Dokter :</b> " . (empty($data[$i][dokter])?"-":$data[$i][dokter]) . "</li>";
			$pem .= "<li><b>Diagnosa :</b> " . (empty($data[$i][diagnosa])?"-":"<br />".$data[$i][diagnosa]) . "</li>";
			$pem .= "<li><b>Tindakan :</b> ";
				if(!empty($data_ic)) {
					$pem .= "<ol>";
					for($j=0;$j<sizeof($data_ic);$j++) {
						$pem .= "<li>" . $data_ic[$j][tindakan_nama] . "</li>";
					}
					$pem .= "</ol>";
				} else $pem .= "-";
			$pem .= "</li>";
			$pem .= "<li><b>BHP :</b> ";
				if(!empty($data_bhp)) {
					$pem .= "<ol>";
					for($j=0;$j<sizeof($data_bhp);$j++) {
						$pem .= "<li>" . $data_bhp[$j][bhp_nama] . "</li>";
					}
					$pem .= "</ol>";
				} else $pem .= "-";
			$pem .= "</li>";
			/*
			$pem .= "<li><b>Imunisasi :</b> ";
				if(!empty($data_im)) {
					$pem .= "<ol>";
					for($j=0;$j<sizeof($data_im);$j++) {
						$pem .= "<li>" . $data_im[$j][imunisasi_nama] . "</li>";
					}
					$pem .= "</ol>";
				} else $pem .= "-";
			$pem .= "</li>";
			*/
			$pem .= "</ul>";
			$table->addRow(
				($no+$i), 
				$data[$i][kunjungan_ke] . "<hr />" . tanggalIndo($data[$i][tgl_periksa], 'j M Y'),
				$pem
				);
			/*
			$table->addOnclickTd(
				"xajax_tab_buka_kunjungan('".$data[$i][id_kunjungan_kamar]."')",
				"xajax_tab_buka_kunjungan('".$data[$i][id_kunjungan_kamar]."')",
				"xajax_tab_buka_kunjungan('".$data[$i][id_kunjungan_kamar]."')"
			);
			*/
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$objResponse->addAssign("modal_list_kunjungan", "style.display", "");
		$objResponse->addAssign("tab_list_semua_kunjungan_navi", "innerHTML", $navi);
		$objResponse->addAssign("mlk_no_rm", "innerHTML", $data[0][no_rm]);
		$objResponse->addAssign("mlk_nama", "innerHTML", $data[0][nama]);
		$objResponse->addAssign("mlk_sex", "innerHTML", $data[0][sex]);
		$objResponse->addAssign("tab_list_semua_kunjungan", "innerHTML", $ret);
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		return $objResponse;
	}
Beispiel #21
0
      function ke_kunjungan($val) {
      	 $kon = new Konek;
         $objResponse = new xajaxResponse;
         
         $sql = "
		 	SELECT 
				rk.id
			FROM 
				radio_kunjungan rk
			WHERE
				rk.kunjungan_kamar_id = '".$val[dp_idkk]."'
		 ";
		 $kon->sql = $sql;
         $kon->execute();
         
         $d = $kon->getOne();
         $id_d = $d[id];
         
         $sql = "
			SELECT 
				*
			FROM 
				kunjungan_bayar
			WHERE
				radio_kunjungan_id = '$id_d' AND
				kwid IS NULL				
			";
         $kon->sql = $sql;
         $kon->execute();
         $d = $kon->getOne();
         if (!$d)
         {
         
      	 $sql = "
					INSERT INTO radio_kunjungan(
						pasien_id,
						kunjungan_kamar_id,
						kelas,
						tgl_daftar,
						tgl_periksa,
						pengirim,
						cara_masuk,
						cara_bayar,
						jenis_askes,
						perusahaan_id,
						nomor,
						pj_nama,
						pj_alamat,
						pj_telp,
						pj_hubungan_keluarga)
					SELECT
						k.pasien_id,
						kk.id,
						pel.jenis,
						NOW(),
						NOW(),
						'".$val[dp_pengirim]."',
						pel.jenis,
						kk.cara_bayar,
						kk.jenis_askes,
						kk.perusahaan_id,
						kk.nomor,
						kk.pj_nama,
						kk.pj_alamat,
						kk.pj_telp,
						kk.pj_hubungan_keluarga
					FROM
						kunjungan k
						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)
					WHERE
						kk.id = '".$val[dp_idkk]."'
				";
				
			}
			else
			{
				$sql = "
					SELECT
						k.pasien_id,
						kk.id,
						pel.jenis,
						NOW(),
						NOW(),
						'".$val[dp_pengirim]."',
						pel.jenis,
						kk.cara_bayar,
						kk.jenis_askes,
						kk.perusahaan_id,
						kk.nomor,
						kk.pj_nama,
						kk.pj_alamat,
						kk.pj_telp,
						kk.pj_hubungan_keluarga
					FROM
						kunjungan k
						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)
					WHERE
						kk.id = '".$val[dp_idkk]."'
				";
			}
			
            $kon->sql = $sql;
            $kon->execute();
            
            //for($i=0;$i<sizeof($data);$i++) {
            	$sql = "
					SELECT 
						rk.id
					FROM 
						radio_kunjungan rk
					WHERE
						rk.kunjungan_kamar_id = '".$val[dp_idkk]."'
					";
				//$objResponse->addAssign("id_kunjungan_lab", "innerHTML", $data[no_rm]);
			
		 		$kon->sql = $sql;
				$kon->execute();
				//$objResponse->addAlert($sql);
				//$id_kunjungan_lab = $kon;
				//$dp_idkk = $val[dp_idkk];
				$data = $kon->getOne();
                //$objResponse->addAssign("dp_no_rm", "innerHTML", $data[no_rm]);
                $id_kunjungan_radio = $data[id];
                //$objResponse->addAlert($id_kunjungan_lab);
			//}
			
         	$objResponse->addScriptCall("tutup_daftar_penunjang");
         	$objResponse->addScriptCall("xajax_buka_kunjungan",$id_kunjungan_radio);
         	return $objResponse;
         	
      }
	function get_kunjungan($val) {
		unset($_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar]);
		$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]));
		$title = "Rekapitulasi Jumlah Cara Pembayaran di Unit Rawat Jalan";
		
		if($val[tampilkan] == "hari") {
			$selisih = datediff('d', $tgl_start, $tgl_end);
		} elseif($val[tampilkan] == "bulan") {
			$selisih = datediff('m', $tgl_start, $tgl_end);
		} else {
			$selisih = datediff('y', $tgl_start, $tgl_end);
		}
		if($val[tampilkan] == "hari") {
			$tanggal_awal = tanggalIndo($tgl_start, "j F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "j F Y");
		} elseif($val[tampilkan] == "bulan") {
			$tanggal_awal = tanggalIndo($tgl_start, "F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "F Y");
		} else {
			$tanggal_awal = tanggalIndo($tgl_start, "Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "Y");
		}

		$title .= "\nPeriode " . $tanggal_awal . " s.d. " . $tanggal_akhir;

		$arr_tgl_start = explode("-",$tgl_start);
		$tgl_start_tgl = $arr_tgl_start[2];
		$tgl_start_bln = $arr_tgl_start[1];
		$tgl_start_thn = $arr_tgl_start[0];

		$arr_tgl_end = explode("-",$tgl_end);
		$tgl_end_tgl = $arr_tgl_end[2];
		$tgl_end_bln = $arr_tgl_end[1];
		$tgl_end_thn = $arr_tgl_end[0];

		$objResponse = new xajaxResponse();
		$kon = new Konek;
	
		for($i=0;$i<=$selisih;$i++) {
			if($val[tampilkan] == "hari") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, $tgl_start_bln, ($i+$tgl_start_tgl), $tgl_start_thn));
				$data[$i][tgl_periksa] = tanggalIndo($tgl[$i], "j M Y");
				$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_tick][$i] = @date("j", @mktime(1, 1, 1,$tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$label_x[$i] = @date("M Y", @mktime(1, 1, 1, $tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$where = " AND DATE(kk.tgl_periksa) = '" . $tgl[$i] . "'";
			} elseif($val[tampilkan] == "bulan") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$data[$i][tgl_periksa] = tanggalIndo($tgl[$i], "M Y");
				$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_tick][$i] = @date("M y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$label_x[$i] = @date("Y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$where = " AND EXTRACT(YEAR_MONTH FROM kk.tgl_periksa) = EXTRACT(YEAR_MONTH FROM '" . $tgl[$i] . "')";
			} else {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn + $i)));
				$data[$i][tgl_periksa] = tanggalIndo($tgl[$i], "Y");
				$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_tick][$i] = @date("Y", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn+$i)));
				$label_x[$i] = "Tahun";
				$where = " AND YEAR(kk.tgl_periksa) = YEAR('" . $tgl[$i] . "')";
			}
			$sql = "
				SELECT
					kk.cara_bayar as nama, 
					COUNT(kk.id) as jml
				FROM
					kunjungan_kamar kk 
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				WHERE
					pel.jenis = 'RAWAT JALAN'
					$where
				GROUP BY
					kk.cara_bayar
				ORDER BY
					kk.cara_bayar
				";
			$kon->sql = $sql;
			$kon->execute();
			$baru[$i] = $kon->getAll();
		}
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][title] = $title . "\nPeriode " . tanggalIndo($tgl_start, "j F Y") . " s.d. " . tanggalIndo($tgl_end, "j F Y");
		$labelx = @array_unique($label_x);
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_x] = @implode(", ",$labelx);
		
		$new = array();
		for($i=0;$i<sizeof($baru);$i++) {
			for($s=0;$s<sizeof($baru[$i]);$s++) {
				$new[jml][$baru[$i][$s][nama]][$i] = $baru[$i][$s][jml];
			}
		}
		$table = new Table;
		$table->scroll = false;
		$table->addExtraTh("style=\"width:300px;\"");
		$table->Th[0][] = "Cara Pembayaran/ Periode";
		$table->Th[1][] = "1";
		for($i=0;$i<=$selisih;$i++) {
			$table->Th[0][] = $data[$i][tgl_periksa];
			$table->Th[1][] = ($i+2);
		}
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][th_0] = $table->Th[0];
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][th_1] = $table->Th[1];
		$cb = array('UMUM','JAMSOSTEK','DANA REKSA DESA','KONTRAK','LAIN-LAIN','ASKES');

		for($i=0;$i<sizeof($cb);$i++) {
			$table->Row[$i][] = $cb[$i];
			$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][cb][$i] = $cb[$i];
			for($s=0;$s<=$selisih;$s++) {
				if(!$new[jml][$cb[$i]][$s]) $new[jml][$cb[$i]][$s]=0;
				$table->Row[$i][] = $new[jml][$cb[$i]][$s];
				$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][jml][$i][] = $new[jml][$cb[$i]][$s];
			}
			$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][row][$i] = $table->Row[$i];
		}

		$ret = $table->build();
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][graph] = "<img src=\"" . URL . "rekmed/rekap_kunjungan_rajal_per_cara_bayar_graph_line/?md5=".md5(date("Ymdhis"))."\" alt=\"Kunjungan\" />";
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][title] = $title;
		$objResponse->addAssign("title", "innerHTML", nl2br($_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][title]));
		$objResponse->addAssign("graph", "innerHTML", $_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][graph]);
		return $objResponse;
	}
Beispiel #23
0
	function list_data($jenis = "BELUM", $limit = 5, $auto = "0", $tgl="") {
		if($jenis == "BELUM") $s .= " AND trc.cetak = 'BELUM' ";
		elseif($jenis == "SUDAH") $s .= " AND trc.cetak = 'SUDAH' ";
		if($tgl) $s .= "AND DATE(trc.tgl_keluar) = '".$tgl."' ";
		$kon = new Konek;
		$sql = "
			SELECT 
				k.id as id_kunjungan,
				kk.id as id_kunjungan_kamar,
				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,
				kmr.nama as kamar,
				kk.tgl_daftar as tgl_daftar,
				kk.tgl_periksa as tgl_periksa,
				d.nama as nama_dokter,
				trc.cetak as tercetak
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN tracer trc ON (trc.kunjungan_kamar_id = kk.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				LEFT JOIN dokter d ON (d.id = kk.dokter_id)
			WHERE
				trc.cetak IS NOT NULL
				$s
			ORDER BY 
				kk.id
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();

		$table = new Table;
		$table->tbody_height = 340;
		$table->addTh(
			"No", 
			"No.<br />Kjg",
			"No. RM", 
			"Pasien", 
			"Pelayanan", 
			"Dokter", 
			"Tgl<br />Daftar",
			"Tgl<br />Periksa",
			"Tracer<br />Tercetak",
			"Cetak<br />Sendiri"
		);
		$table->addExtraTh("style=\"width:50px;\"","style=\"width:50px;\"","style=\"width:80px;\"","style=\"width:200px;\"","","","","","","style=\"width:50px;\"");
		for($i=0;$i<sizeof($data);$i++) {
			$table->addRow(
				($i+1), 
				$data[$i][id_kunjungan], 
				$data[$i][no_rm], 
				$data[$i][nama], 
				$data[$i][kamar], 
				$data[$i][nama_dokter], 
				tanggalIndo($data[$i][tgl_daftar], 'j M Y'), 
				tanggalIndo($data[$i][tgl_periksa], 'j M Y'), 
				$data[$i][tercetak], 
				"<a href=\"javascript:void(0)\" title=\"Cetak ini saja\" style=\"display:block;\" onclick=\"cetak('".URL."filing/cetak_tracer_cetak/?kkid=".$data[$i][id_kunjungan_kamar]."',350,300)\"><img src=\"".IMAGES_URL."printer_hitam.png\" alt=\"Cetak\" border=\"0\" /></a>");
			$table->addOnclickTd(
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')"
			);
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $auto);
		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_data", "innerHTML", $ret);

		//jika ada pasien dan auto cetak dihidupkan, maka jalankan skrip membuka window cetak
		if(!empty($data) && $auto == "1") {
			$tgl = str_replace("-", "|", $tgl);
			$objResponse->addScriptCall("cetak_tracer", URL . "filing/cetak_tracer_cetak/?jenis=" . $jenis . "&limit=" . $limit . "&tgl=" . $tgl, 350, 600);
		}
		return $objResponse;
	}
Beispiel #24
0
	function simpan_dokter($value) {
		$kon = new Konek;
		if(!$value['id_dokter']) {
			$kon->sql = "INSERT INTO dokter(subspesialisasi_id, nama, alamat, telp, aktif) VALUES ('".$value[subspesialisasi_id]."', '".$value[nama]."', '".$value[alamat]."','".$value[telp]."','".$value[aktif]."')";
		} else {
			$kon->sql = "UPDATE dokter SET subspesialisasi_id = '".$value[subspesialisasi_id]."', nama = '".$value[nama]."', alamat = '".$value[alamat]."', telp = '".$value[telp]."', aktif='".$value[aktif]."' WHERE id = '".$value[id_dokter]."'";
		}
		$kon->execute();
		$objResponse = new xajaxResponse();
		$objResponse->addScriptCall("show_status_simpan");
		$objResponse->addScriptCall("xajax_reset_dokter");
		$objResponse->addScriptCall("xajax_list_data", $_SESSION[modul_setting][dokter][hal]);
		return $objResponse;
	}
Beispiel #25
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;
	}
Beispiel #26
0
	function infobar_cari_px_cari($objId, $val) {
		$kon = new Konek;
		$objResponse = new xajaxResponse;
		$sql = "
			SELECT
				p.nama as nama,
				CONCAT(p.alamat, ', ', d.nama, ', ', kec.nama, ', ', kab.nama) as alamat,
				kmr.nama as ruang,
				CASE 
					WHEN kk.tgl_keluar IS NULL THEN 'Masih Dirawat'
				ELSE 'Sudah Pulang'
				END as status
			FROM
				pasien p
				JOIN kunjungan k ON (k.pasien_id = p.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)
				JOIN ref_desa d ON (d.id = p.desa_id)
				JOIN ref_kecamatan kec ON (kec.id = d.kecamatan_id)
				JOIN ref_kabupaten kab ON (kab.id = kec.kabupaten_id)
			WHERE
				p.nama LIKE '%".$val."%' 
				AND pel.jenis = 'RAWAT INAP'
				AND (kk.tgl_keluar IS NULL OR DATE(kk.tgl_keluar) = DATE(NOW()))
			ORDER BY p.nama
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();
		$table = new Table;
		$table->scroll = false;
		$table->addTh("Nama", "Alamat", "Ruang", "Status");
		for($i=0;$i<sizeof($data);$i++) {
			$table->addRow($data[$i][nama], $data[$i][alamat], $data[$i][ruang], $data[$i][status]);
		}
		$ret = $table->build();
		$objResponse->addAssign($objId, "innerHTML", $ret);
		return $objResponse;
	}
	function get_kunjungan($val) {
		unset($_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk]);
		$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]));
		$title = "Statistik Kunjungan Radiologi Berdasar Cara Masuk";
		
		if($val[tampilkan] == "hari") {
			$selisih = datediff('d', $tgl_start, $tgl_end);
			$tanggal_awal = tanggalIndo($tgl_start, "j F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "j F Y");
		} elseif($val[tampilkan] == "bulan") {
			$selisih = datediff('m', $tgl_start, $tgl_end);
			$tanggal_awal = tanggalIndo($tgl_start, "F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "F Y");
		} else {
			$selisih = datediff('y', $tgl_start, $tgl_end);
			$tanggal_awal = tanggalIndo($tgl_start, "Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "Y");
		}

		$title .= "\nPeriode " . $tanggal_awal . " s.d. " . $tanggal_akhir;

		$arr_tgl_start = explode("-",$tgl_start);
		$tgl_start_tgl = $arr_tgl_start[2];
		$tgl_start_bln = $arr_tgl_start[1];
		$tgl_start_thn = $arr_tgl_start[0];

		$arr_tgl_end = explode("-",$tgl_end);
		$tgl_end_tgl = $arr_tgl_end[2];
		$tgl_end_bln = $arr_tgl_end[1];
		$tgl_end_thn = $arr_tgl_end[0];

		$objResponse = new xajaxResponse();
		$kon = new Konek;

		for($i=0;$i<=$selisih;$i++) {
			if($val[tampilkan] == "hari") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, $tgl_start_bln, ($i+$tgl_start_tgl), $tgl_start_thn));
				$tgl_periksa[$i] = tanggalIndo($tgl[$i], "j M\nY");
				$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][radioel_tick][$i] = @date("j", @mktime(1, 1, 1,$tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$radioel_x[$i] = @date("M Y", @mktime(1, 1, 1, $tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$where = " AND DATE(lk.tgl_periksa) = '" . $tgl[$i] . "' ";
			} elseif($val[tampilkan] == "bulan") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$tgl_periksa[$i] = tanggalIndo($tgl[$i], "M\nY");
				$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][radioel_tick][$i] = @date("M y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$radioel_x[$i] = @date("Y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$where = " AND EXTRACT(YEAR_MONTH FROM lk.tgl_periksa) = EXTRACT(YEAR_MONTH FROM '" . $tgl[$i] . "') ";
			} else {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn + $i)));
				$tgl_periksa[$i] = tanggalIndo($tgl[$i], "Y");
				$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][radioel_tick][$i] = @date("Y", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn+$i)));
				$radioel_x[$i] = "Tahun";
				$where = " AND YEAR(lk.tgl_periksa) = YEAR('" . $tgl[$i] . "') ";
			}
			//dari IRD
			$kon->sql = "
				SELECT
					COUNT(lk.id) as jml_igd
				FROM
					radio_kunjungan lk 
					JOIN pasien p ON (p.id = lk.pasien_id)
				WHERE
					lk.cara_masuk = 'IGD'
					$where
			";
			$kon->execute();
			$igd[$i] = $kon->getOne();
			if(!$igd[$i][jml_igd]) $igd[$i][jml_igd] = "-";


			//dari RAWAT JALAN
			$kon->sql = "
				SELECT
					COUNT(lk.id) as jml_rajal
				FROM
					radio_kunjungan lk 
					JOIN pasien p ON (p.id = lk.pasien_id)
				WHERE
					lk.cara_masuk = 'RAWAT JALAN'
					$where
			";
			$kon->execute();
			$rajal[$i] = $kon->getOne();
			if(!$rajal[$i][jml_rajal]) $rajal[$i][jml_rajal] = "-";


			//dari RAWAT INAP
			$kon->sql = "
				SELECT
					COUNT(lk.id) as jml_ranap
				FROM
					radio_kunjungan lk 
					JOIN pasien p ON (p.id = lk.pasien_id)
				WHERE
					lk.cara_masuk = 'RAWAT INAP'
					$where
			";
			$kon->execute();
			$ranap[$i] = $kon->getOne();
			if(!$ranap[$i][jml_ranap]) $ranap[$i][jml_ranap] = "-";


			//dari RAWAT INAP
			$kon->sql = "
				SELECT
					COUNT(lk.id) as jml_luar
				FROM
					radio_kunjungan lk 
					JOIN pasien p ON (p.id = lk.pasien_id)
				WHERE
					lk.cara_masuk = 'PASIEN LUAR'
					$where
			";
			$kon->execute();
			$luar[$i] = $kon->getOne();
			if(!$luar[$i][jml_luar]) $luar[$i][jml_luar] = "-";

			$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][jml_igd][$i] = $igd[$i][jml_igd];
			$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][jml_rajal][$i] = $rajal[$i][jml_rajal];
			$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][jml_ranap][$i] = $ranap[$i][jml_ranap];
			$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][jml_luar][$i] = $luar[$i][jml_luar];

			$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][tgl_periksa][$i] = $tgl_periksa[$i];
		}
		//$objResponse->addAlert(print_r($lama));
		$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][title] = $title . "\nPeriode " . tanggalIndo($tgl_start, "j F Y") . " s.d. " . tanggalIndo($tgl_end, "j F Y");
		$radioelx = @array_unique($radioel_x);
		$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][radioel_x] = @implode(", ",$radioelx);

		$table = new Table;
		$table->scroll = false;
		//$table->Th[0][] = "Pelayanan";
		//$table->extra_th[0][] = "rowspan=\"2\"";
		for($i=0;$i<=$selisih;$i++) {
			$table->Th[0][] = $tgl_periksa[$i];
			$table->extra_th[0][] = "colspan=\"4\"";
		}
		$table->Th[0][] = "Jumlah";
		$table->extra_th[0][] = "colspan=\"4\"";
		$kolom = $selisih*4+3;
		for($i=0;$i<=$selisih;$i++) {
			$table->Th[1][] = "IRD";
			$table->Th[1][] = "Rajal";
			$table->Th[1][] = "Ranap";
			$table->Th[1][] = "Px Luar";
			$table->Th[2][] = $i*4+1;
			$table->Th[2][] = $i*4+2;
			$table->Th[2][] = $i*4+3;
			$table->Th[2][] = $i*4+4;
		}
		$table->Th[2][] = $i*4+1;
		$table->Th[2][] = $i*4+2;
		$table->Th[2][] = $i*4+3;
		$table->Th[2][] = $i*4+4;
		//kolom jumlah
		$table->Th[1][] = "IRD";
		$table->Th[1][] = "Rajal";
		$table->Th[1][] = "Ranap";
		$table->Th[1][] = "Px Luar";

		//isinya
		//$table->Row[0][0] = "IGD";
		for($i=0;$i<=$selisih;$i++) {
			$table->Row[0][] = $igd[$i][jml_igd];
			$table->Row[0][] = $rajal[$i][jml_rajal];
			$table->Row[0][] = $ranap[$i][jml_ranap];
			$table->Row[0][] = $luar[$i][jml_luar];
			$jumlah[igd] += $igd[$i][jml_igd];
			$jumlah[rajal] += $rajal[$i][jml_rajal];
			$jumlah[ranap] += $ranap[$i][jml_ranap];
			$jumlah[luar] += $luar[$i][jml_luar];
		}

		//kolom terakhir
		$table->Row[0][] = $jumlah[igd];
		$table->Row[0][] = $jumlah[rajal];
		$table->Row[0][] = $jumlah[ranap];
		$table->Row[0][] = $jumlah[luar];
		$ret = $table->build();

		$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][th_0] = $table->Th[0];
		$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][th_1] = $table->Th[1];
		$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][extra_th_0] = $table->extra_th[0];
		$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][row] = $table->Row[0];
		
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][graph] = "<img src=\"" . URL . "rekmed/statistik_kunjungan_radio_semua_cara_masuk_graph_line/?md5=".md5(date("Ymdhis"))."\" alt=\"Kunjungan\" />";
		$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][title] = $title;
		$objResponse->addAssign("title", "innerHTML", nl2br($_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][title]));
		$objResponse->addAssign("graph", "innerHTML", $_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][graph]);
		return $objResponse;
	}
Beispiel #28
0
<?
/* tampilan tracer yg dicetak*/
$kon = new Konek;
if($_GET[kkid]) {
/* cuma 1 pasien */
	$sql = "
		SELECT 
			kk.id as kkid,
			k.kunjungan_ke as kunjungan_ke,
			kk.no_antrian as no_antrian,
			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,
			kmr.id as kmrid,
			kmr.nama as klinik,
			kk.tgl_periksa as tgl_periksa,
			d.nama as dokter,
			trc.id as trcid,
			trc.keperluan as keperluan
		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 tracer trc ON (trc.kunjungan_kamar_id = kk.id)
			LEFT JOIN dokter d ON (d.id = kk.dokter_id)
		WHERE
			kk.id = '".$_GET[kkid]."'
	";
} elseif($_GET[trcid]) {
	$trcid = str_replace("|", ",", $_GET[trcid]);
	$sql = "
Beispiel #29
0
	function simpan_pasien($value) {
		$objResponse = new xajaxResponse();
		$kon = new Konek;
		if(!$value['id_pasien']) {
			if(!$value['id']) {
				$sql = "
					INSERT INTO pasien(
						nama,
						tempat_lahir,
						tgl_lahir,
						gol_darah,
						sex,
						agama,
						pendidikan_id,
						pekerjaan_id,
						status_nikah,
						alamat,
						rt,
						rw,
						desa_id,
						telp,
						tgl_daftar
						) 
					VALUES (
						'".$value[nama]."', 
						'".$value[tempat_lahir]."', 
						'".$value[tgl_lahir_thn]."-".$value[tgl_lahir_bln]."-".$value[tgl_lahir_tgl]."',
						NULLIF('".$value[gol_darah]."',''), 
						'".$value[sex]."',
						'".$value[agama]."',
						'".$value[pendidikan_id]."',
						'".$value[pekerjaan_id]."',
						'".$value[status_nikah]."',
						'".$value[alamat]."',
						'".$value[rt]."',
						'".$value[rw]."',
						'".$value[desa_id]."',
						'".$value[telp]."',
						NOW()
					)";
			} else {
				$sql = "
					INSERT INTO pasien(
						id,
						nama,
						tempat_lahir,
						tgl_lahir,
						gol_darah,
						sex,
						agama,
						pendidikan_id,
						pekerjaan_id,
						status_nikah,
						alamat,
						rt,
						rw,
						desa_id,
						telp,
						tgl_daftar
						) 
					VALUES (
						'".$value[id]."',
						'".$value[nama]."', 
						'".$value[tempat_lahir]."', 
						'".$value[tgl_lahir_thn]."-".$value[tgl_lahir_bln]."-".$value[tgl_lahir_tgl]."',
						NULLIF('".$value[gol_darah]."',''), 
						'".$value[sex]."',
						'".$value[agama]."',
						'".$value[pendidikan_id]."',
						'".$value[pekerjaan_id]."',
						'".$value[status_nikah]."',
						'".$value[alamat]."',
						'".$value[rt]."',
						'".$value[rw]."',
						'".$value[desa_id]."',
						'".$value[telp]."',
						NOW()
					)";
			}
			$kon->sql = $sql;
			$kon->execute();
			$afek = $kon->affected_rows;
			$last_id = $kon->last_id;
		} else {
			$sql = "
				UPDATE pasien SET 
					id = '".$value[id]."',
					nama= '".$value[nama]."', 
					tempat_lahir = '".$value[tempat_lahir]."',
					tgl_lahir= '".$value[tgl_lahir_thn]."-".$value[tgl_lahir_bln]."-".$value[tgl_lahir_tgl]."',
					gol_darah = NULLIF('".$value[gol_darah]."', ''),
					sex= '".$value[sex]."',
					agama= '".$value[agama]."',
					pendidikan_id= '".$value[pendidikan_id]."',
					pekerjaan_id= '".$value[pekerjaan_id]."',
					status_nikah= '".$value[status_nikah]."',
					alamat= '".$value[alamat]."', 
					rt= '".$value[rt]."',
					rw= '".$value[rw]."',
					desa_id= '".$value[desa_id]."',
					telp= '".$value[telp]."'
				WHERE 
					id = '".$value[id_pasien]."'";
			$kon->sql = $sql;
			$kon->execute();
			$afek = $kon->affected_rows;
			$last_id = $value[id];
		}
		
		if($afek < 0) {
			$objResponse->addAlert("Data Tidak Dapat Disimpan.\nCek kembali Nomor Rekam Medis.");
			$objResponse->addScriptCall("fokus", "id");
		} else {
			$objResponse->addConfirmCommands(1, "Cetak Kartu Periksa?");
			$objResponse->addScriptCall("cetak", URL . "setting/kartu_periksa_cetak/?id=" . $last_id, 350, 210);
			$objResponse->addScriptCall("show_status_simpan");
			$objResponse->addScriptCall("xajax_reset_pasien");
			$objResponse->addScriptCall("fokus", "id");
		}
		return $objResponse;
	}
Beispiel #30
0
	function get_lap_rl1($val) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$sql = "
			SELECT
				id,
				nama as nama_lain
			FROM
				pelayanan
			WHERE
				jenis = 'RAWAT INAP'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();
		$baru = array();
		$s = 0;
		
		/*
			I : 1 januari - 31 maret
			II : 1 april - 30 juni
			III : 1 juli - 30 september
			IV : 1 oktober - 31 desember
		*/

		switch($val[tw]) {
			case "I" : 
				$tgl_awal = $val[tahun] . "-01-01";
				$tgl_akhir = $val[tahun] . "-03-31";
				$tgl_start_bln = 1;
			break;
			case "II" : 
				$tgl_awal = $val[tahun] . "-04-01";
				$tgl_akhir = $val[tahun] . "-06-30";
				$tgl_start_bln = 4;
			break;
			case "III" : 
				$tgl_awal = $val[tahun] . "-07-01";
				$tgl_akhir = $val[tahun] . "-09-30";
				$tgl_start_bln = 7;
			break;
			default : 
				$tgl_awal = $val[tahun] . "-10-01";
				$tgl_akhir = $val[tahun] . "-12-31";
				$tgl_start_bln = 10;
			break;
		}
		$selisih_hari = datediff("d", $tgl_awal, $tgl_akhir);
		for($i=0;$i<sizeof($data);$i++) {
			$baru[$i][nama] = $data[$i][nama_lain];
			/* 
			get px awal triwulan ~ pasien sisa / pasien yg masih dirawat
			syarat : tgl masuk < tgl_awal 
					 tgl_keluar > tgl_awal
			*/
			$kon->sql = "
				SELECT 
					COUNT(kk.id) as jml
				FROM
					kunjungan_kamar kk
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				WHERE
					kmr.pelayanan_id = '".$data[$i][id]."'
					AND (DATE(kk.tgl_daftar) < '".$tgl_awal."' AND (DATE(kk.tgl_keluar) >= '".$tgl_awal."' OR kk.tgl_keluar IS NULL))
			";
			$kon->execute();
			$px_awal = $kon->getOne();
			$baru[$i][px_awal] = $px_awal[jml];
			$total[px_awal] += $baru[$i][px_awal];

			/* 
			get px masuk
			ASUMSI SEMENTARA : PASIEN PINDAHAN DIHITUNG
			syarat : tgl masuk diantara tgl_awal dan tgl_keluar
			*/
			$kon->sql = "
				SELECT 
					COUNT(kk.id) as jml
				FROM
					kunjungan_kamar kk
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				WHERE
					kmr.pelayanan_id = '".$data[$i][id]."'
					AND (DATE(kk.tgl_daftar) BETWEEN '".$tgl_awal."' AND '".$tgl_akhir."')
			";
			$kon->execute();
			$px_masuk = $kon->getOne();
			$baru[$i][px_masuk] = $px_masuk[jml];
			$total[px_masuk] += $baru[$i][px_masuk];

			/* 
			get px keluar 
			syarat : tgl keluar diantara tgl_awal dan tgl_keluar dan keadaan keluar = sembuh, belum sembuh
			*/
			$kon->sql = "
				SELECT 
					COUNT(kk.id) as jml,
					k.keadaan_keluar as keadaan_keluar
				FROM
					kunjungan_kamar kk
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				WHERE
					kmr.pelayanan_id = '".$data[$i][id]."'
					AND (DATE(kk.tgl_keluar) BETWEEN '".$tgl_awal."' AND '".$tgl_akhir."')
				GROUP BY kk.id
			";
			$kon->execute();
			$px_keluar = $kon->getAll();
			for($j=0;$j<sizeof($px_keluar);$j++) {
				switch($px_keluar[$j][keadaan_keluar]) {
					case "MATI < 48 JAM" :
						$baru[$i][px_keluar_mati_kurang_dari] += $px_keluar[$j][jml];
					break;
					case "MATI >= 48 JAM" :
						$baru[$i][px_keluar_mati_lebih_dari] += $px_keluar[$j][jml];
					break;
					default :
						$baru[$i][px_keluar_hidup] += $px_keluar[$j][jml];
					break;
				}
			}
			$total[px_keluar_mati_kurang_dari] += $baru[$i][px_keluar_mati_kurang_dari];
			$total[px_keluar_mati_lebih_dari] += $baru[$i][px_keluar_mati_lebih_dari];
			$total[px_keluar_hidup] += $baru[$i][px_keluar_hidup];
			$baru[$i][px_keluar_mati] = $baru[$i][px_keluar_mati_kurang_dari] + $baru[$i][px_keluar_mati_lebih_dari];
			$total[px_keluar_mati] += $baru[$i][px_keluar_mati];

			/* 
			get jumlah lama dirawat ~ lamanya seorang pasien dirawat
			syarat : tgl keluar diantara tgl_awal dan tgl_keluar 
					 hitung tgl_keluar-tanggal_daftar
					 
			cara : cari dulu px yg keluar pada tw tsb
				   hitung tgl_keluar-tanggal_daftar
				   jika tgl_keluar = tgl_daftar -> dihitung 1 hari lama dirawat
			*/
			$kon->sql = "
				SELECT 
					kk.id as kkid,
					CASE
						WHEN (DATE(kk.tgl_daftar) = DATE(kk.tgl_keluar)) THEN 1
						ELSE DATEDIFF(kk.tgl_keluar, kk.tgl_daftar)
					END as jml
				FROM
					kunjungan_kamar kk
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				WHERE
					kmr.pelayanan_id = '".$data[$i][id]."'
					AND (DATE(kk.tgl_keluar) BETWEEN '".$tgl_awal."' AND '".$tgl_akhir."')
				GROUP BY kk.id
			";
			$kon->execute();
			$ld = $kon->getAll();
			for($j=0;$j<sizeof($ld);$j++) {
				$baru[$i][lama_dirawat] += $ld[$j][jml];
			}
			$total[lama_dirawat] += $baru[$i][lama_dirawat];

			/* 
			get px akhir triwulan ~ pasien sisa / pasien yg masih dirawat
			syarat : tgl masuk < tgl_akhir 
					 tgl_keluar > tgl_akhir
			*/
			$kon->sql = "
				SELECT 
					COUNT(kk.id) as jml
				FROM
					kunjungan_kamar kk
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				WHERE
					kmr.pelayanan_id = '".$data[$i][id]."'
					AND (DATE(kk.tgl_daftar) < '".$tgl_akhir."' AND (DATE(kk.tgl_keluar) > '".$tgl_akhir."' OR kk.tgl_keluar IS NULL))
			";
			$kon->execute();
			$px_akhir = $kon->getOne();
			$baru[$i][px_akhir] = $px_akhir[jml];
			$total[px_akhir] += $baru[$i][px_akhir];

			/* 
			get jumlah hari perawatan ~ pasien sisa per hari
			sampe sini
			*/
			//sampe sini 7/4/2007 
			for($j=0;$j<=$selisih_hari;$j++) {
				$tgl = @date("Y-m-d", @mktime(1, 1, 1, $tgl_start_bln, ($j+1), $val[tahun]));
				$kon->sql = "
					SELECT 
						COUNT(kk.id) as jml,
						kmr.kelas as kelas
					FROM
						kunjungan_kamar kk
						JOIN kamar kmr ON (kmr.id = kk.kamar_id)
						JOIN kunjungan k ON (k.id = kk.kunjungan_id)
					WHERE
						kmr.pelayanan_id = '".$data[$i][id]."'
						AND (DATE(kk.tgl_daftar) <= '".$tgl."' AND (DATE(kk.tgl_keluar) > '".$tgl."' OR kk.tgl_keluar IS NULL))
					GROUP BY kmr.kelas
				";
				$kon->execute();
				$px_hari_ini[$j] = $kon->getAll();
				for($k=0;$k<sizeof($px_hari_ini[$j]);$k++) {
					switch($px_hari_ini[$j][$k][kelas]) {
						case "I" :
							$baru[$i][hp_kelas_i] += $px_hari_ini[$j][$k][jml];
						break;
						case "II" :
							$baru[$i][hp_kelas_ii] += $px_hari_ini[$j][$k][jml];
						break;
						case "III" :
							$baru[$i][hp_kelas_iii] += $px_hari_ini[$j][$k][jml];
						break;
						case "VIP" :
							$baru[$i][hp_kelas_vip] += $px_hari_ini[$j][$k][jml];
						break;
						default :
							$baru[$i][hp_kelas_tanpa_kelas] += $px_hari_ini[$j][$k][jml];
						break;
					}
				}
			}
			$total[hp_kelas_i] += $baru[$i][hp_kelas_i];
			$total[hp_kelas_ii] += $baru[$i][hp_kelas_ii];
			$total[hp_kelas_iii] += $baru[$i][hp_kelas_iii];
			$total[hp_kelas_vip] += $baru[$i][hp_kelas_vip];
			$total[hp_kelas_tanpa_kelas] += $baru[$i][hp_kelas_tanpa_kelas];
			$baru[$i][hp_total] +=$baru[$i][hp_kelas_i] + $baru[$i][hp_kelas_ii] + $baru[$i][hp_kelas_iii] + $baru[$i][hp_kelas_vip] + $baru[$i][hp_kelas_tanpa_kelas];
			$total[hp_total] += $baru[$i][hp_total];
		}
		$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 KEGIATAN RUMAH SAKIT<br />TRIWULAN : ".$val[tw]."<br />TAHUN : ".$val[tahun]."");
		//$tabel_header->addExtraTh("colspan=\"3\"");
		$tabel_header->addRow("","","Formulir RL1");
		//$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.", 
			"JENIS PELAYANAN", 
			"Pasien<br />Awal<br />Triwulan", 
			"Pasien<br />Masuk", 
			"Pasien<br />Keluar<br />Hidup", 
			"Pasien Keluar Mati", 
			"Jumlah<br />Lama<br />Dirawat", 
			"Pasien<br />Akhir<br />Triwulan",
			"Jumlah<br />Hari Pe-<br />rawatan",
			"Rincian Hari Perawatan per Kelas",
			"No."
		);
		$tabel_isi->addExtraTh(
			"rowspan=\"2\"", 
			"rowspan=\"2\"", 
			"rowspan=\"2\"", 
			"rowspan=\"2\"", 
			"rowspan=\"2\"", 
			"colspan=\"3\"", 
			"rowspan=\"2\"", 
			"rowspan=\"2\"",
			"rowspan=\"2\"", 
			"colspan=\"5\"", 
			"rowspan=\"2\""
		);
		$tabel_isi->addTh("&lt; 48 jam", "&ge; 48 jam", "jumlah", "Kelas<br />Utama", "Kelas I", "Kelas II", "Kelas III", "Tanpa<br />Kelas");
		$tabel_isi->addTh("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17");
		for($i=0;$i<sizeof($baru);$i++) {
			$tabel_isi->addRow(
				($i+1),
				$baru[$i][nama],
				$baru[$i][px_awal],
				$baru[$i][px_masuk],
				$baru[$i][px_keluar_hidup],
				$baru[$i][px_keluar_mati_kurang_dari],
				$baru[$i][px_keluar_mati_lebih_dari],
				$baru[$i][px_keluar_mati],
				$baru[$i][lama_dirawat],
				$baru[$i][px_akhir],
				$baru[$i][hp_total],
				$baru[$i][hp_kelas_vip],
				$baru[$i][hp_kelas_i],
				$baru[$i][hp_kelas_ii],
				$baru[$i][hp_kelas_iii],
				$baru[$i][hp_kelas_tanpa_kelas],
				($i+1)
			);
		}
		$tabel_isi->addRow(
			99,
			"TOTAL",
			$total[px_awal],
			$total[px_masuk],
			$total[px_keluar_hidup],
			$total[px_keluar_mati_kurang_dari],
			$total[px_keluar_mati_lebih_dari],
			$total[px_keluar_mati],
			$total[lama_dirawat],
			$total[px_akhir],
			$total[hp_total],
			$total[hp_kelas_vip],
			$total[hp_kelas_i],
			$total[hp_kelas_ii],
			$total[hp_kelas_iii],
			$total[hp_kelas_tanpa_kelas],
			99
		);
		$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_rl1]);
		$cetak = new Cetak;
		$tanda_tangan = $cetak->setTandaTangan();
		$ret .= $tanda_tangan;
		$_SESSION[rekmed][lap_rl1] = $ret;
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}