Files
semakin-imut/perawat_roe/viewdata4.php
2025-10-09 11:03:05 +07:00

301 lines
16 KiB
PHP

<?php
header("Content-Type: application/vnd-ms-excel");
header("Content-Disposition: attachment; filename=Rekap Pasien IGD_$tanggal-jam_$jam.xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<head>
<style type="text/css">
#viewpasien {
display: block;
}
#page-nav {
display: block;
}
@media print {
#PrintTable {
display: block;
}
#viewpasien {
display: block;
}
#timemarquee {
display: none;
}
#page-nav {
display: none;
}
}
</style>
</head>
<body>
<div id="viewpasien">
<form id="view_implementasi" class="jquery">
<?php
include "model/koneksi.php";
date_default_timezone_set('Asia/Jakarta'); //Time adjust
if (isset($_POST['cetak_ruang'])) {
$ruang = $_POST['ruang'];
$awal = date('Y-m-d H:i:s', strtotime($_POST['awal']));
$akhir = date('Y-m-d H:i:s', strtotime($_POST['akhir']));
$first = date('d-m-Y H:i', strtotime($_POST['awal']));
$last = date('d-m-Y H:i', strtotime($_POST['akhir']));
$lihat = "SELECT * FROM datapasien WHERE datapasien.tanggal BETWEEN '$awal' AND '$akhir'AND NOT datapasien.status_tunggu= 'delete'";
$tampil = mysqli_query($open, $lihat);
$mrscount = mysqli_num_rows(mysqli_query($open, "$lihat AND status_keluar = 'MRS'"));
$krscount = mysqli_num_rows(mysqli_query($open, "$lihat AND status_keluar = 'KRS'"));
$meninggalcount = mysqli_num_rows(mysqli_query($open, "$lihat AND status_keluar LIKE '%meninggal%'"));
$papscount = mysqli_num_rows(mysqli_query($open, "$lihat AND status_keluar = 'paps'"));
$mdcount = mysqli_num_rows(mysqli_query($open, "$lihat AND status_keluar LIKE '%melarikan diri%'"));
$obscount = mysqli_num_rows(mysqli_query($open, "$lihat AND status_keluar = 'observasi'"));
$ugdtrcount = mysqli_num_rows(mysqli_query($open, "$lihat AND status_keluar LIKE '%pindah igd%'"));
$ugdokcount = mysqli_num_rows(mysqli_query($open, "$lihat AND status_keluar LIKE '%ok%'"));
$selected = mysqli_num_rows(mysqli_query($open, "$lihat AND status_tunggu = '' "));
$p1count = mysqli_num_rows(mysqli_query($open, "$lihat AND triage = 'P1'"));
$p2count = mysqli_num_rows(mysqli_query($open, "$lihat AND triage = 'P2'"));
$p3count = mysqli_num_rows(mysqli_query($open, "$lihat AND triage = 'P3'"));
$p0count = mysqli_num_rows(mysqli_query($open, "$lihat AND triage = 'P0'"));
$total = $selected + $ugdokcount + $ugdtrcount + $obscount + $mdcount + $papscount + $meninggalcount + $krscount + $mrscount;
} else {
$ruang = $_SESSION['nama'];
$first = false;
$last = false;
$clause = "WHERE ruang = '$ruang' AND status_tunggu= 'menunggu' AND NOT status_tunggu= 'delete'";
$lihat = "SELECT * FROM datapasien $clause";
$tampil = mysqli_query($open, $lihat);
$mrscount = "-";
$krscount = "-";
$meninggalcount = "-";
$papscount = "-";
$mdcount = "-";
$obscount = mysqli_num_rows(mysqli_query($open, "$lihat AND status_keluar = 'observasi'"));
$ugdtrcount = "-";
$ugdokcount = "-";
$selected = "-";
$p1count = mysqli_num_rows(mysqli_query($open, "$lihat AND triage = 'P1'"));
$p2count = mysqli_num_rows(mysqli_query($open, "$lihat AND triage = 'P2'"));
$p3count = mysqli_num_rows(mysqli_query($open, "$lihat AND triage = 'P3'"));
$p0count = mysqli_num_rows(mysqli_query($open, "$lihat AND triage = 'P0'"));
$total = $obscount;
}
?>
<h3 align="center">Buku Laporan Keperawatan</h3>
<h5 align="center">IGD RSSA</h5>
<h6 align="center">Tanggal <?php echo DATE('d-m-Y H:i'); ?></h6>
<h6 align="center" style="margin-top: 5px;">Terhitung mulai <?= $first; ?> &nbsp; s/d &nbsp; <?= $last; ?></h6>
<div id="PrintTable" class="container" style="margin-top: 5px;">
<table id="Tablerekap" class="table table-bordered" style="font-size: 7pt;" width="100%" align="left" cellpadding="0" cellspacing="0" style="margin-bottom:10px;">
<tr class="table-striped" align="left" height="10px">
<td style="font-weight:bold; width:10%">P1</td>
<td><?= $p1count; ?></td>
<td style="font-weight:bold; width:1%">MRS</td>
<td> <?= $mrscount; ?></td>
<td style=" font-weight:bold;width:20%">MELARIKAN DIRI</td>
<td> <?= $mdcount; ?> </td>
<tr class="table-striped" align="left" height="10px" bgcolor="DFE6EF">
<td style="font-weight:bold; width:10%">P2</td>
<td><?= $p2count; ?></td>
<td style="font-weight:bold; width:1%">KRS</td>
<td> <?= $krscount; ?> </td>
<td style="font-weight:bold;width:1%">OBSERVASI</td>
<td> <?= $obscount; ?> </td>
</tr>
<tr class="table-striped" align="left" height="10px">
<td style="font-weight:bold; width:10%">P3</td>
<td><?= $p3count; ?></td>
<td style=" font-weight:bold; width:10%">MENINGGAL</td>
<td> <?= $meninggalcount; ?> </td>
<td style="font-weight:bold;width:1%">PINDAH IGD</td>
<td> <?= $ugdtrcount; ?> </td>
</tr>
<tr class="table-striped" align="left" height="10px" bgcolor="DFE6EF">
<td style="font-weight:bold; width:10%">P0</td>
<td><?= $p0count; ?></td>
<td style="font-weight:bold;width:1%">PAPS</td>
<td> <?= $papscount; ?> </td>
<td style="font-weight:bold;width:1%">OK</td>
<td> <?= $ugdokcount; ?> </td>
</tr>
</table>
</div>
<div class="container-fluid" style="margin-top: 1px;">
<table class="table table-striped table-bordered" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr class="" align="center" height="10px" bgcolor="DFE6EF">
<th style="width:1%">No</th>
<th style="width:5%">Tgl Masuk</th>&nbsp;
<th style="width:5%">Tgl Keluar</th>&nbsp;
<th style="width:5%">Total Jam<br style="font-size: 9px;">(hr-jam-mnt-dtk)</th>&nbsp;
<th style="width:10%">Nama Pasien</th>&nbsp;
<th style="width:5%">Prioritas</th>&nbsp;
<th style="width:5%">Register</th>&nbsp;
<th style="width:1%">SMF</th>&nbsp;
<th >Status Keluar</th>&nbsp;
<th style="width:5%" align="center" >Diagnosa</th>&nbsp;
<th align="center" >Keterangan</th>&nbsp;
</tr>
<?php
$nomer = 0;
while ($lihat_pasien = mysqli_fetch_array($tampil)) {
$nama = stripslashes($lihat_pasien['nama']);
$id_pasien = stripslashes($lihat_pasien['id_pasien']);
$register = stripslashes($lihat_pasien['register']);
$tanggal = stripslashes($lihat_pasien['tanggal']);
$triage = stripslashes($lihat_pasien['triage']);
$ruang = stripslashes($lihat_pasien['ruang']);
$status_keluar = stripslashes($lihat_pasien['status_keluar']);
$keterangan = stripslashes($lihat_pasien['keterangan']);
$prolong = stripslashes($lihat_pasien['prolong']);
$jam_keluar = stripslashes($lihat_pasien['jam_keluar']);
$smf = stripslashes($lihat_pasien['smf']);
$perawat_ppa = stripslashes($lihat_pasien['history_ppa']);
$waiting = stripslashes($lihat_pasien['waiting']); {
// waktu sekarang
$end = date_create();
$start = date_create($tanggal);
$selesai = date_create($jam_keluar);
$diff = date_diff($start, $end);
$diff_lama = date_diff($start, $selesai);
$waktu = DATE('d-m-Y H:i:s', strtotime($lihat_pasien['tanggal']));
$waktu_keluar = DATE('d-m-Y H:i:s', strtotime($lihat_pasien['jam_keluar']));
$nomer++;
?>
<tr class="table table-striped" style="font-size: 12px; vertical-align:top;" align="center">
<td><?= $nomer ?><div align="left"></div>
</td>
<td><?= DATE('d-m-Y H:i', strtotime($lihat_pasien['tanggal'])); ?></td>
<td><?= DATE('d-m-Y H:i', strtotime($lihat_pasien['jam_keluar'])); ?></td>
<td>
<?php
if (strlen($jam_keluar) == 0) {
echo $diff->d . ':' . $diff->h . ':' . $diff->i . ':'.$diff->s;
} else {
echo $diff_lama->d . ':' . $diff_lama->h . ':' . $diff_lama->i . ':'.$diff_lama->s;
}
?>
</td>
<td><?= $nama ?><div align="left"></div></td>
<td><?= $triage ?><div align="center"></div></td>
<td><?= $register ?><div align="left"></div></td>
<td><?= $smf ?><div align="left"></div></td>
<td>
<?php
if (strlen($status_keluar) == 0) {
echo "";
} else {
echo $status_keluar;
}
?>
</td>
<td>
<table>
<?php
$sql_pengkajian = "SELECT * FROM tb_pengkajian WHERE id_pasien= '$id_pasien'" ;
$tampil_pengkajian = mysqli_query($open, $sql_pengkajian);
$number=0;
while ($lihat_pengkajian = mysqli_fetch_array($tampil_pengkajian)) {
$diagnosa_medis = stripslashes($lihat_pengkajian['diagnosa_medis']);{
$number++;
?>
<tr style="font-size: 12px;">
<td><div align="left"><?= $diagnosa_medis?></div>
<?php
}
}
?>
</td>
</tr>
</table>
</td>
<td align="left">
<div class="btn-sm alert-info">Perawat PPA:</div>
<?php
$cetak = (explode(" _ ", $perawat_ppa));
for ($start = 0; $start < count($cetak); $start++) {
$start < count($cetak);
print $cetak[$start] . "<BR>";
}
?>
<br>
<li class="label label-primary">Waktu tunggu:&nbsp;
<?php
if (strlen($jam_keluar) == 0) {
echo $diff->d . ' hari-' . $diff->h . ' jam-' . $diff->i . 'menit';
} else {
echo $waiting;
}
?> </li>
<li>Catatan Keluar:&nbsp;<?= $keterangan; ?></li>
<li>Catatan lama tinggal:&nbsp;</li>
<?php
$sql_tindakan = "SELECT * FROM tb_tindakan WHERE id_pasien= '$id_pasien'" ;
$tampil_pengkajian = mysqli_query($open, $sql_tindakan);
$number=0;
while ($lihat_tindakan = mysqli_fetch_array($tampil_pengkajian)) {
$timestamp = stripslashes($lihat_tindakan['timestamp']);
$tindakan = stripslashes($lihat_tindakan['tindakan']);{
?>
<div align="left"><?= $timestamp?> -
<?= $tindakan?></div>
<?php
}
}
?>
</td>
</tr>
<?php
}
}
//Tutup koneksi engine MySQL
mysqli_close($open);
?>
</table>
</div>
</form>
<table class="table" width="100%" align="left">
<tr class="table-striped" align="left">
<td style="font-weight:bold;width:15%" align="left">TOTAL :</td>
<td style="font-weight:bold;" align="left"><?= $total; ?></td>
</tr>
</table>
</div>
</body>