Files
2025-10-09 11:03:05 +07:00

188 lines
9.3 KiB
PHP

<?php include "header.php"; ?>
<script>
$(document).ready(function() {
var filter = document.getElementById('filter').innerHTML;
})
document.getElementById('tittlepage').innerHTML = "Input Dokumen Medik Tranfusi";
document.getElementById('linkfilter').hidden = true;
document.getElementById('tindakan').value = "tranfusi";
</script>
<!-- ================================= -->
<?php
include "./model/koneksi.php";
$id_pasien = $_GET['idx'];
$query = mysqli_query($open, "SELECT * FROM datapasien WHERE id_pasien='$id_pasien'");
while ($data = mysqli_fetch_assoc($query)) {
?>
<div class="container" style="background-color: azure;">
<div class="table-responsive">
<div class="row-mt-2">
<form id="pasienfrm" method="POST" enctype="multipart/form-data">
<div class="row mb-2">
<label for="inputregister" class="col-sm-2 col-form-label col-form-label-sm">No RM</label>
<div class="col-md-5" style="margin-bottom: 1pt;">
<input readonly type="text" required class="form-control form-control-sm" id="inputregister" placeholder="nomer rekam medis" name="register" value="<?= $data['register']; ?>">
</div>
<label class="col-sm-2 col-form-label col-form-label-sm" for="inputnik">Jam Masuk</label>
<div class="col-md-2" style="margin-bottom: 1pt;">
<input text="datetime" name="tanggal" id="tanggal" readonly class="form-control form-control-sm plaintext" value="<?= $data['tanggal'] ?>">
</div>
</div>
<div class="row mb-2">
<label for="inputnama" class="col-sm-2 col-form-label col-form-label-sm">Nama Pasien</label>
<div class="col-md-5" style="margin-bottom: 1pt;">
<input readonly type="text" required class="form-control form-control-sm" id="inputnama" placeholder="nama pasien" name="nama" value="<?= $data['nama']; ?>">
</div>
<label for="inputruang" class="col-sm-2 col-form-label col-form-label-sm">Ruang</label>
<div class="col-md-2" style="margin-bottom: 1pt;">
<input readonly type="text" class="form-control form-control-sm" id="inputruang" placeholder="ruang" name="ruang" value="<?= $data['ruang']; ?>">
</div>
</div>
<div class="row mb-2">
<label class="col-sm-2 col-form-label col-form-label-sm" for="inputkomponen">Komponen Darah</label>
<div class="col-md-2" style="margin-bottom: 1pt;">
<select type="text" Required name="komponen" id="komponen" class="form-select form-select-sm">
<option value="" selected>komponen</option>
<option value="PRC">PRC</option>
<option value="TC">TC</option>
<option value="FFP">FFP</option>
<option value="Whole Blood">Whole Blood</option>
</select>
</div>
<label for="reaksi" class="col-sm-1 col-form-label col-form-label-sm">Unit</label>
<div class="col-md-2" style="margin-bottom: 1pt;">
<input required type="number" class="form-control form-control-sm" id="unit" name="unit" value="1" placeholder="unit ke.." />
</div>
<label for="reaksi" class="col-sm-2 col-form-label col-form-label-sm">Reaksi</label>
<div class="col-md-1" style="margin-bottom: 1pt;"> Ya
<input type="radio" onclick="reaksitrue()" id="reaksi_true" name="reaksi" value="1" valuemin="0" />
</div>
<div class="col-md-1" style="margin-bottom: 1pt;"> Tidak
<input required type="radio" onclick="reaksifalse()" id="reaksi_false" name="reaksi" value="0" valuemin="0" />
</div>
</div>
<div class="row mb-2">
<label class="col-sm-2 col-form-label col-form-label-sm"></label>
<div class="col-md-3" style="margin-bottom: 1pt;">
<input hidden type="text" name="id_pasien" value="<?= $data['id_pasien']; ?>">
<input type="submit" id="inputsubmit" value="Simpan" name="tambahData" class="btn btn-primary btn-sm">
<input type="reset" name="reset" onclick="script: window.history.back();" data-bs-dismiss="modal" value="Batal" class="btn btn-secondary btn-sm">
</div>
<label for="notereaksi" class="col-sm-2 col-form-label col-form-label-sm"></label>
<div class="col-md-5" style="margin-bottom: 1pt;">
<textarea hidden="hidden" id="notereaksi" type="text" class="form-control" placeholder="catatan jika terjadi reaksi tranfusi" name="catatan" id="catatan"></textarea>
</div>
</div>
</form>
</div>
<div class="container-fluid">
<table class='table table-striped table-hover datatable' width='100%' cellspacing='0' style='font-size: 12px;'>
<thead>
<tr>
<th style='width:1%'>No</th>
<th style='width:5%'>Ruang</th>
<th style='width:10%'>Register</th>
<th style='width:25%'>Nama</th>
<th style='width:5%'>Komponen</th>
<th style='width:1%'>Unit</th>
<th style='width:2%'>Reaksi</th>
<th style='width:2%'>status</th>
</tr>
</thead>
<tbody id="datatab">
</tbody>
</table>
</div>
</div>
<script>
$(document).ready(function() {
load_data()
function load_data() {
$.ajax({
// URL file untuk proses select datanya
"url": "data_table_tranfusi.php?idx=<?= $_GET['idx']; ?>",
"type": "GET",
success: function(data) {
$('#datatab').html(data);
}
})
}
});
</script>
<?php
} ?>
<script>
function reaksitrue() {
var reaksi = document.getElementById('notereaksi');
reaksi.hidden = false
}
function reaksifalse() {
var reaksi = document.getElementById('notereaksi');
reaksi.hidden = true;
}
</script>
<?php
include "footer.php"; ?>
<?php
include "model/koneksi.php";
include "function_tanggal.php";
if ($_POST['awal'] == true) {
$printf = tanggal(date('Y-m-d', strtotime($_POST['awal']))) . ' - s/d - ' . tanggal(date('Y-m-d', strtotime($_POST['akhir'])));
echo "<div id='filter' hidden>" . $printf . "</div>";
} else {
echo "<div id='filter' hidden></div>";
}
if (isset($_POST['tambahData'])) {
$id_pasien = $_POST['id_pasien'];
$komponen = $_POST['komponen'];
$unit = $_POST['unit'];
$checkdata = mysqli_num_rows(mysqli_query($openinmut, "SELECT*FROM tb_tranfusi WHERE id_pasien='$id_pasien' AND komponen='$komponen'AND unit='$unit'"));
if ($checkdata > 0) {
?>
<script>
alert('Data sudah tersimpan , silahkan Refresh');
</script>
<?php
} else {
$id_pasien = $_POST['id_pasien'];
$tanggal = $_POST['tanggal'];
$register = $_POST['register'];
$nama = $_POST['nama'];
$ruang = $_POST['ruang'];
$komponen = $_POST['komponen'];
$unit = $_POST['unit'];
$reaksi = $_POST['reaksi'];
$catatan = $_POST['catatan'];
$survey = mysqli_query($openinmut, "INSERT INTO tb_tranfusi(id_pasien,tanggal,register,nama,ruang,komponen,unit,reaksi,catatan)VALUES('$id_pasien','$tanggal','$register','$nama', '$ruang','$komponen','$unit','$reaksi', '$catatan')");
}
?>
<script>
window.history.back();
</script>
<?php
} ?>
<script>
$(document).ready(function() {
perawat_ppa()
function perawat_ppa() {
$.ajax({
url: "model/tb_perawat.php",
method: "GET",
success: function(data) {
$('#inputppa').html(data);
}
})
}
})
</script>