267 lines
12 KiB
PHP
267 lines
12 KiB
PHP
<?php
|
|
$sql_dokter ="SELECT kddokter,namadokter,kdsmf FROM m_dokter where aktif = 1";
|
|
$get_dokter = $db->query($sql_dokter);
|
|
$arr_smf = [''=>'Pilih SMF'];
|
|
$arr_dokter = [];
|
|
$smf_dpjp = '';
|
|
foreach($get_dokter->fetchAll() as $data) {
|
|
if($data['kdsmf'] != ''){
|
|
$arr_smf[$data['kdsmf']] = $data['kdsmf'];
|
|
}
|
|
$arr_dokter[$data['kdsmf']][$data['kddokter']] = $data['namadokter'];
|
|
if($_SESSION['KDDOKTER'] == $data['kddokter']) {
|
|
$smf_dpjp = $data['kdsmf'];
|
|
}
|
|
}
|
|
?>
|
|
<div class="container-fluid">
|
|
|
|
<form action="rajal/save_konsul.php" name="konsultasi" method="post" id="form_konsul">
|
|
<input type="hidden" name="idxdaftar" value="<?php echo $userdata['id_admission'];?>" id="idxdaftar"/>
|
|
<input type="hidden" name="nomr" value="<?php echo $nomr;?>" id="nomr"/>
|
|
<input type="hidden" name="kdpoly" value="<?php echo $userdata['noruang'];?>" />
|
|
<input type="hidden" name="kddokter" value="<?php echo $_SESSION['KDDOKTER'];?>" />
|
|
<input type="hidden" name="st_rajal" value="0" />
|
|
<?php
|
|
if($_SESSION['KDDOKTER'] == 0) { $disabled_input = 'disabled'; }
|
|
else { $disabled_input = ''; }
|
|
// if($_SESSION['KDDOKTER'] == $kddokter) { // jika dokter yang login merupakan dpjp
|
|
echo '<input type="hidden" name="form_konsul" value="1">';
|
|
echo '<input type="hidden" name="smf_dpjp" value="'.$smf_dpjp.'">';
|
|
?>
|
|
<h5 class="d-none">FORM KONSULTASI</h5>
|
|
<div class="row d-none">
|
|
<div class="col-md-12 col-lg-12 my-5">
|
|
<table class="table table-bordered table-striped table-sm" id="table_rujuk_smf">
|
|
<tr class="bg-blue">
|
|
<th width="50%">SMF</th>
|
|
<th width="50%">DPJP</th>
|
|
<th>#</th>
|
|
</tr>
|
|
<tr>
|
|
<td><?php echo form_dropdown('konsul_smf[1][smf]',$arr_smf,'','class="form-control" onchange="getKonsulSMF(this)" data-wrapper="dpjp_smf" data-idxrow="1"'); ?></td>
|
|
<td></td>
|
|
<td><button type="button" class="btn btn-primary btn-sm " onclick="addSmf(1)" id="addsmf1"><i class="fas fa-plus"></i></button></td>
|
|
</tr>
|
|
</table>
|
|
<?php
|
|
if($_SESSION['KDDOKTER'] == 0) {
|
|
echo '<div class="alert alert-error"><p>Anda tidak memiliki akses untuk mengisi form ini</p></div>';
|
|
}
|
|
else {
|
|
?>
|
|
<input type="submit" name="Submit" value="Simpan" class="btn btn-primary text" onclick="newsubmitform (document.getElementById('form_konsul'),'rajal/save_konsul.php','valid_konsul',validatetask); return false;"/>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
// }
|
|
// else {
|
|
if(!array_key_exists('jawab', $_REQUEST)) {
|
|
?>
|
|
<h5>LEMBAR KONSULTASI</h5>
|
|
<div class="row">
|
|
<div class="col-md-12 col-lg-12">
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right">Dokter</label>
|
|
<div class="col-sm-8 pt-0" style="text-align:left">
|
|
<?php echo $_SESSION['NAMA_PEGAWAI']; ?>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right">Tanggal</label>
|
|
<div class="col-sm-8 pt-0" style="text-align:left">
|
|
<input type="text" name="tanggal" cols="60" rows="5" class="form-control text" value="<?php echo date("Y-m-d"); ?>" readonly <?php echo $disabled_input; ?>>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right">Uraian Konsultasi</label>
|
|
<div class="col-sm-8 pt-0" style="text-align:left">
|
|
<textarea name="uraian_konsul" cols="60" rows="5" class="form-control text" tabindex="3" <?php echo $disabled_input; ?>></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right">Tujuan Konsultasi</label>
|
|
<div class="col-sm-4 pt-0" style="text-align:left">
|
|
<input type="hidden" name="konsul_smf[1][smf]" value="" id="konsul_smf">
|
|
<?php echo form_dropdown('tujuan_smf',$arr_smf,'','class="form-control" onchange="getKonsulSMF(this)" data-wrapper="dpjp_smf" data-idxrow="1"'); ?>
|
|
</div>
|
|
<div class="col-sm-4 pt-0" style="text-align: left" id="dpjp_smf1">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right"></label>
|
|
<div class="col-sm-8 pt-0" style="text-align:left">
|
|
<?php
|
|
if($_SESSION['KDDOKTER'] == 0) {
|
|
echo '<div class="alert alert-error"><p>Anda tidak memiliki akses untuk mengisi form ini</p></div>';
|
|
}
|
|
else {
|
|
?>
|
|
<input type="submit" name="Submit" value="Simpan" class="btn btn-primary text" onclick="newsubmitform (document.getElementById('form_konsul'),'rajal/save_konsul.php','valid_konsul',validatetask); return false;"/>
|
|
<?php
|
|
}
|
|
?>
|
|
<button type="button" class="btn btn-outline-success" id="btn_hist_konsul">History Konsul</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
elseif(array_key_exists('jawab', $_REQUEST) && array_key_exists('id', $_REQUEST) && $_REQUEST['id'] != '') {
|
|
echo '<input type="hidden" name="jawaban_konsul" value="1">';
|
|
echo '<input type="hidden" name="id_konsultasi" value="'.$_REQUEST['id'].'">';
|
|
$tmp_konsulan = $db->query("SELECT * from t_konsultasi where id_konsultasi = ".$_REQUEST['id']);
|
|
$data_konsulan = $tmp_konsulan->fetchFirst();
|
|
|
|
?>
|
|
|
|
<h5>LEMBAR JAWABAN KONSULTASI</h5>
|
|
<div class="row">
|
|
<div class="col-md-12 col-lg-12">
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right">Dokter</label>
|
|
<div class="col-sm-8 pt-0" style="text-align:left">
|
|
<?php echo $_SESSION['NAMA_PEGAWAI']; ?>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right">Tanggal</label>
|
|
<div class="col-sm-8 pt-0" style="text-align:left">
|
|
<input type="text" name="tanggal" cols="60" rows="5" class="form-control text" value="<?php echo date("Y-m-d"); ?>" readonly <?php echo $disabled_input; ?>>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right">Uraian Konsultasi</label>
|
|
<div class="col-sm-8 pt-0" style="text-align:left">
|
|
<textarea name="uraian_konsul" cols="60" rows="5" class="form-control text" tabindex="3" <?php echo $disabled_input; ?> disabled><?php echo $data_konsulan['uraian_konsul']; ?></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right">Jawaban Konsultasi</label>
|
|
<div class="col-sm-8 pt-0" style="text-align:left">
|
|
<textarea name="uraian_jawaban_konsul" cols="60" rows="5" class="form-control text" tabindex="3" <?php echo $disabled_input; ?>><?php echo ($data_konsulan['jawaban_konsul'] != '') ? $data_konsulan['jawaban_konsul'] : ''; ?></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right"></label>
|
|
<div class="col-sm-8 pt-0" style="text-align:left">
|
|
<?php
|
|
if($_SESSION['KDDOKTER'] == 0) {
|
|
echo '<div class="alert alert-error"><p>Anda tidak memiliki akses untuk mengisi form ini</p></div>';
|
|
}
|
|
else {
|
|
?>
|
|
<input type="submit" name="Submit" value="Simpan" class="btn btn-primary text" onclick="newsubmitform (document.getElementById('form_konsul'),'rajal/save_konsul.php','valid_konsul',validatetask); return false;"/>
|
|
<button type="button" class="btn btn-danger" id="btn_kembali_konsul">Kembali</button>
|
|
<?php
|
|
}
|
|
?>
|
|
<button type="button" class="btn btn-outline-success" id="btn_hist_konsul">History Konsul</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
<div id="valid_konsul" >
|
|
<?php include("rajal/save_konsul.php"); ?>
|
|
</div>
|
|
</form>
|
|
<template id="histkonsul-template">
|
|
<div class="modal fade histkonsul-modal-lg" id="histkonsul-modal" tabindex="-1" role="dialog" aria-labelledby="HistKonsultasi" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg" style="max-width: 98%">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">History Konsultasi</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body"></div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
$(document).ready(function(){
|
|
$histkonsul = $("#histkonsul-template").html();
|
|
$("body").append($histkonsul);
|
|
|
|
$('#btn_hist_konsul').click(function(){
|
|
var idx = $('#idxdaftar').val();
|
|
var nomr = $('#nomr').val();
|
|
|
|
let tbl_id = "tbl_hist_konsul";
|
|
$.post('<?php echo _BASE_;?>rajal/history_konsul.php?<?php echo http_build_query($_REQUEST); ?>',{idxdaftar:idx,nomr,tbl_id},function(data) {
|
|
$("#histkonsul-modal .modal-body").html("");
|
|
$("#histkonsul-modal .modal-body").html(data);
|
|
$("#histkonsul-modal").modal("show");
|
|
|
|
$("#"+tbl_id+" thead tr").clone(true).appendTo( "#"+tbl_id+" thead" );
|
|
$("#"+tbl_id+" thead tr:eq(1) th").each( function (i) {
|
|
if(i == 2 || i == 3 || i == 5 ) {
|
|
var title = $(this).text();
|
|
$(this).html( "<input type=\"text\" class=\"form-control form-control-sm\" placeholder=\"Cari "+title+"\" />" );
|
|
|
|
$("input",this).typing({
|
|
stop : function(e,elm) {
|
|
tbl_hist_konsul.column(i).search( elm[0].value ) .draw();
|
|
},
|
|
delay : 400
|
|
});
|
|
|
|
$("input", this).on("click", function(e) {
|
|
e.stopPropagation();
|
|
});
|
|
}
|
|
else {
|
|
var title = $(this).text();
|
|
$(this).html( " " );
|
|
return true;
|
|
}
|
|
});
|
|
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
<?php
|
|
$js_init .= '
|
|
function getKonsulSMF(elm) {
|
|
smf = $(elm).find(":selected").val();
|
|
row_id = $(elm).data("idxrow");
|
|
wrapper = $(elm).data("wrapper")+row_id;
|
|
$("#konsul_smf").val(smf);
|
|
$.get("'._BASE_.'rujukan/alasan_rujuk.php",{smf,key:row_id},function(data){
|
|
$("#"+wrapper).html(data);
|
|
});
|
|
}
|
|
function addSmf(id){
|
|
new_id = parseInt(id)+1;
|
|
$("#addSmf"+id+",#remSmf"+id).prop("disabled",true);
|
|
|
|
dropdown = \''.preg_replace("/\n/","",form_dropdown('konsul_smf[{kode}][smf]',$arr_smf,'','class="form-control" onchange="getKonsulSMF(this)" data-wrapper="dpjp_smf" data-idxrow="{kode}"')).'\';
|
|
klinik = dropdown.replace(/\{kode\}/g,new_id);
|
|
|
|
$("#table_rujuk_smf").append(\'<tr><td>\'+klinik+\'</td><td id=\"dpjp_smf\'+new_id+\'\"></td><td><button type=\"button\" class=\"btn btn-primary btn-sm\" onclick=\"addSmf(\'+new_id+\')\" id=\"addsmf\'+new_id+\'\"><i class=\"fas fa-plus\"></i></button><button type=\"button\" class=\"btn btn-danger btn-sm\" onclick=\"remSmf(\'+new_id+\')\" id=\"remsmf\'+new_id+\'\"><i class=\"fas fa-trash\"></i></button></td></tr>\');
|
|
}
|
|
function remSmf(id) {
|
|
id_before = (parseInt(id) > 1) ? parseInt(id)-1 : id;
|
|
$("#addsmf"+id_before+",#remsmf"+id_before).prop("disabled",false);
|
|
$("#remsmf"+id).parent().parent().remove();
|
|
}';
|
|
?>
|
|
|