siang semuanya, saya sudah buat autocomplete, dan jalan kalau menggunakan text, tapi kalau radio button tidak bisa nampil sesuai yang di pilih, solusinya bagaimana ya?
  1. <?php
  2. include "../../koneksi.php";
  3. $term = $_GET['term'];
  4. $sql = "SELECT * FROM tb_pasien WHERE nomor_rekam_medis LIKE '%".$term."%'";
  5. $hs = mysql_query($sql);
  6. $json = array();
  7. while($data = mysql_fetch_array($hs)){
  8. $json[] = array(
  9. 'label' => $data['nomor_rekam_medis'] ." - ". $data['nama_pasien'],
  10. 'value' => $data['nomor_rekam_medis'],
  11. 'nama_pasien' => $data['nama_pasien'],
  12. 'jenis_kelamin_pasien' => $data['jenis_kelamin_pasien']
  13.  
  14. );
  15. }
  16. header("Content-Type: application/json");
  17. echo json_encode($json);
  18. ?>
  19.  
  1. <?php
  2.  
  3. $aksi="module/transaksi_pasien/transaksi_pasien_aksi.php";
  4.  
  5.  
  6. switch(isset($_GET["aksi"]) ? $_GET["aksi"] :'"'){
  7. default:
  8.  
  9. ?>
  10. <hr/>
  11.  
  12. <div class="box box-solid box-primary">
  13. <div class="box-header">
  14. <h3 class="btn btn disabled box-title">
  15. <i class="fa fa-user-md"></i>
  16. Data Pasien </h3>
  17. <a class="btn btn-primary pull-right" href="?module=transaksi_pasien&aksi=tambah">
  18. <i class="fa fa-plus"></i> Tambah Data</a>
  19. </div>
  20. <div class="box-body">
  21. <table id="example1" class="table table-bordered table-striped">
  22. <thead>
  23. <tr class="text-blue">
  24. <th>TGL/JAM INPUT</th>
  25. <th>MR</th>
  26. <th>NAMA PASIEN</th>
  27. <th>JK</th>
  28. <th>NAMA POLI</th>
  29. <th>NAMA BAGIAN</th>
  30. <th>AKSI</th>
  31. </tr>
  32. </thead>
  33.  
  34. <tbody>
  35. <?php
  36. $sql = "SELECT * FROM tb_pasien a, tb_distribusi b, tb_poli c, tb_bagian d where a.id_pasien=b.id_pasien AND b.id_poli=c.id_poli AND b.id_bagian=d.id_bagian AND status_distribusi='TERIMA' order by tanggal_input DESC";
  37. $tampil = mysql_query($sql);
  38. $no=1;
  39. while ($data = mysql_fetch_array($tampil)) {
  40. $Kode = $data['nomor_rekam_medis'];?>
  41.  
  42. <tr>
  43. <td><?php echo date('d-m-Y', strtotime($data['tanggal_input'])) .", ". $data['jam_input']; ?></td>
  44. <td><?php echo $data['nomor_rekam_medis']; ?></td>
  45. <td><?php echo $data['nama_pasien']; ?></td>
  46. <td><?php echo $data['jenis_kelamin_pasien']; ?></td>
  47. <td><?php echo $data['poli']; ?></td>
  48. <td><?php echo $data['bagian']; ?></td>
  49.  
  50. <td align="center">&nbsp;&nbsp;|
  51. <a class="fa fa-pencil-square-o edit" data-toggle="tooltip" title="Edit Data <?php echo $data['id_pasien'];?>" href="?module=transaksi_pasien&aksi=edit&id_pasien=<?php echo $data['id_pasien'];?>"></a> &nbsp;&nbsp;|
  52. <a class="fa fa-trash hapus" data-toggle="tooltip" title="Hapus Semua Data pasien" href="<?php echo $aksi ?>?module=transaksi_pasien&aksi=hapus&id_distribusi=<?php echo $data['id_distribusi'];?>"></a>&nbsp;&nbsp;|
  53. <a class="fa fa-motorcycle beset" data-toggle="tooltip" title="Antar <?php echo $data['id_pasien'];?>" href="?module=transaksi_antar&aksi=edit&id_pasien=<?php echo $data['id_pasien'];?>"></i></a>&nbsp;&nbsp;|
  54. <a class="fa fa-undo kembali" data-toggle="tooltip" title="Kembali <?php echo $data['id_pasien'];?>" href="?module=transaksi_kembali&aksi=edit&id_pasien=<?php echo $data['id_pasien'];?>"></i></a>&nbsp;&nbsp;|
  55. <a class="fa fa-bed beset" data-toggle="tooltip" title="Rawat <?php echo $data['id_pasien'];?>" href="?module=transaksi_rawat&aksi=edit1&id_pasien=<?php echo $data['id_pasien'];?>"></i></a>&nbsp;&nbsp;|
  56. </td>
  57. <?php
  58. }
  59. ?>
  60. </tr>
  61. </tbody>
  62. </table>
  63. </div>
  64. </div>
  65. <?php
  66. break;
  67. case "tambah":
  68. ?>
  69. <form class="form-horizontal" role="form" method="post" action="<?php echo $aksi?>?module=transaksi_pasien&aksi=tambah" >
  70. <div class="row">
  71. <div class="col-md-12">
  72. <div class="box box-success">
  73. <div class="box-header with-border">
  74. <h3 class="box-title">DATA PASIEN</h3>
  75. <div class="box-tools pull-right">
  76. <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
  77. <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
  78. </div>
  79. </div>
  80. <div class="box-body">
  81. <form class="form-horizontal" action="<?php echo $aksi?>?module=kelas&aksi=tambah" role="form" method="post">
  82. <div class="form-group">
  83. <label class="col-sm-4 control-label">Tanggal Register</label>
  84. <div><div class="col-sm-2">
  85. <?php
  86. date_default_timezone_set("Asia/Jakarta");
  87. $jam_input = date("H:i:s");
  88. $tanggal_input = date("d-m-Y");
  89. ?>
  90. <input type="text" class="form-control" readonly name="jam_input" value="<?php echo"$jam_input";?>">
  91. </div>
  92. <div class="col-sm-2">
  93. <div class="input-group">
  94. <div class="input-group-addon">
  95. <i class="fa fa-calendar"> </i>
  96. </div>
  97. <input type="text" class="form-control" readonly name="tanggal_input" value="<?php echo date('d-m-Y');?>">
  98. </div><!-- /.input group -->
  99. </div></div>
  100. </div>
  101.  
  102. <div class="form-group">
  103. <label class="col-sm-4 control-label">Rekam Medis</label>
  104. <div class="col-sm-2">
  105. <input type="text" autofocus required class="form-control" data-toggle="tooltip" title="Nomor Rekam Medis" onkeypress="return hanyaAngka(event)" required="required" name="nomor_rekam_medis" id="nomor_rekam_medis" placeholder="Nomor Rekam Medis" maxlength="6">
  106. </div>
  107. </div>
  108.  
  109. <div class="form-group">
  110. <label class="col-sm-4 control-label">Nama Pasien</label>
  111. <div class="col-sm-4">
  112. <input type="text" class="form-control" data-toggle="tooltip" title="Nama Pasien" required="required" name="nama_pasien" id="nama_pasien" placeholder="Nama Pasien">
  113. <input type="text" class="form-control" data-toggle="tooltip" title="Nama Pasien" required="required" name="jenis_kelamin_pasien" id="jenis_kelamin_pasien" placeholder="Nama Pasien">
  114. </div>
  115. </div>
  116. <div class="form-group">
  117. <label class="col-sm-4 control-label">Jenis Kelamin</label>
  118. <div class="col-sm-4">
  119. <input name="jenis_kelamin_pasien" type="radio" value="LAKI-LAKI" checked id="jenis_kelamin_pasien"> LAKI-LAKI &nbsp;&nbsp;
  120. <input name="jenis_kelamin_pasien" type="radio" value="PEREMPUAN" id="jenis_kelamin_pasien"> PEREMPUAN
  121. </div>
  122. </div>
  123. <div class="form-group">
  124. <label class="col-sm-4 control-label">Nama Poli</label>
  125. <div class="col-sm-3">
  126. <select name="id_poli" id="poli" class="form-control">
  127. <option value=" "> -- Pilih Poli -- </option>
  128. <?php
  129. $sondang=mysql_query("select * from tb_poli");
  130. while($b=mysql_fetch_array($sondang)){
  131. ?>
  132. <option value="<?php echo $b['id_poli']; ?>"><?php echo $b['poli'] ?></option>
  133. <?php
  134. }
  135. ?>
  136. </select>
  137. </div>
  138. </div>
  139. <div class="form-group">
  140. <label class="col-sm-4 control-label">Nama Bagian</label>
  141. <div class="col-sm-3">
  142. <select name="id_bagian" id="bagian" class="form-control">
  143. <option value=" "> -- Pilih Bagian -- </option>
  144. <?php
  145. $sondang=mysql_query("select * from tb_bagian");
  146. while($b=mysql_fetch_array($sondang)){
  147. ?>
  148. <option value="<?php echo $b['id_bagian']; ?>"><?php echo $b['bagian'] ?></option>
  149. <?php
  150. }
  151. ?>
  152. </select>
  153. </div>
  154. </div>
  155. <div class="form-group">
  156. <label class="col-sm-4"></label>
  157. <div class="col-sm-5">
  158. <button type="submit"name="submit" class="btn btn-primary" onclick="sweet()"><i class="glyphicon glyphicon-floppy-disk"></i> Simpan</button>
  159. <button type="reset" class="btn btn-danger"><i class="fa fa-refresh"></i><i> Batal</i></button>
  160. <button type="button" class="btn btn-danger" onclick="history.back(-1)"><i class="glyphicon glyphicon-arrow-left"></i> Back</button>
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. </div>
  166.  
  167.  
  168. <?php
  169. break;
  170. case "edit":
  171. $data=mysql_query("SELECT * FROM tb_pasien a, tb_distribusi b, tb_poli c, tb_bagian d where a.id_pasien=b.id_pasien AND b.id_poli=c.id_poli AND b.id_bagian=d.id_bagian AND a.id_pasien='$_GET[id_pasien]'");
  172. $edit=mysql_fetch_array($data);
  173.  
  174. ?>
  175.  
  176. <form class="form-horizontal" action="<?php echo $aksi?>?module=transaksi_pasien&aksi=edit" role="form" method="post">
  177.  
  178. <div class="row">
  179. <div class="col-md-12">
  180. <div class="box box-success">
  181. <div class="box-header with-border">
  182. <h3 class="box-title">Data Pasien</h3>
  183. <div class="box-tools pull-right">
  184. <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
  185. <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
  186. </div>
  187. </div>
  188. <div class="box-body">
  189. <form class="form-horizontal" action="<?php echo $aksi?>?module=transaksi_pasien&aksi=edit" role="form" method="post">
  190. <div class="form-group">
  191. <label class="col-sm-3 control-label">Tanggal Register</label>
  192. <div><div class="col-sm-3">
  193. <?php
  194. date_default_timezone_set("Asia/Jakarta");
  195. $jam_input = date("H:i:s");
  196. ?>
  197. <input type="text" class="form-control" readonly name="jam_input" value="<?php echo"$jam_input";?>">
  198. </div>
  199. <div class="col-sm-5">
  200. <div class="input-group">
  201. <div class="input-group-addon">
  202. <i class="fa fa-calendar"> </i>
  203. </div>
  204. <input type="text" class="form-control" required="required" data-toggle="tooltip" name="tanggal_input" id="tanggal_input" value="<?php echo $edit['tanggal_input'];?>">
  205.  
  206. </div><!-- /.input group -->
  207. </div></div>
  208. </div>
  209. <div class="form-group">
  210. <label class="col-sm-3 control-label">Rekam Medis</label>
  211. <div class="col-sm-8">
  212. <input type="hidden" class="form-control" readonly name="id_pasien" value="<?php echo $_GET['id_pasien']; ?>">
  213. <input type="text" class="form-control" required="required" name="nomor_rekam_medis"value="<?php echo $edit['nomor_rekam_medis']; ?>">
  214. </div>
  215. </div>
  216. <div class="form-group">
  217. <label class="col-sm-3 control-label">Nama Pasien</label>
  218. <div class="col-sm-8">
  219. <input type="text" class="form-control" required="required" name="nama_pasien"value="<?php echo $edit['nama_pasien']; ?>">
  220. </div>
  221. </div>
  222.  
  223. <div class="form-group">
  224. <label class="col-sm-3 control-label">Jenis Kelamin</label>
  225. <div class="col-sm-8">
  226. <input class="minimal" name="jenis_kelamin_pasien" type="radio" value="LAKI-LAKI" <?php if(($edit['jenis_kelamin_pasien'])== "LAKI-LAKI")
  227. {echo "checked=\"checked\"";};?>/> LAKI-LAKI &nbsp;&nbsp;
  228. <input class="minimal" name="jenis_kelamin_pasien" type="radio" value="PEREMPUAN" <?php if(($edit['jenis_kelamin_pasien'])== "PEREMPUAN")
  229. {echo "checked=\"checked\"";};?>/> PEREMPUAN
  230. </div></div>
  231. <div class="form-group">
  232. <label class="col-sm-3 control-label">Poli</label>
  233. <div class="col-sm-8">
  234. <select name="id_poli" id="poli" class="form-control">
  235. <?php
  236. $cur_poli=$edit['id_poli'];
  237. $q=mysql_query("select * from tb_poli");
  238. while($row=mysql_fetch_array($q)){
  239. $selected='';
  240. if($row['id_poli']==$cur_poli){$selected='selected';}else{$selected='';}
  241. echo "<option value='".$row['id_poli']."' ".$selected.">". $row['id_poli']." / ".$row['poli']."</option>";
  242. ?>
  243. <?php }?>
  244. </select>
  245. </div>
  246. </div>
  247. <div class="form-group">
  248. <label class="col-sm-3 control-label">Bagian</label>
  249. <div class="col-sm-8">
  250. <select name="id_bagian" id="bagian" class="form-control">
  251. <?php
  252. $cur_bagian=$edit['id_bagian'];
  253. $q=mysql_query("select * from tb_bagian");
  254. while($row=mysql_fetch_array($q)){
  255. $selected='';
  256. if($row['id_bagian']==$cur_bagian){$selected='selected';}else{$selected='';}
  257. echo "<option value='".$row['id_bagian']."' ".$selected.">". $row['id_bagian']." / ".$row['bagian']."</option>";
  258. ?>
  259. <?php }?>
  260. </select>
  261. </div>
  262. </div>
  263.  
  264.  
  265.  
  266. <div class="form-group">
  267. <label class="col-sm-4"></label>
  268. <div class="col-sm-7">
  269. <button type="submit"name="submit" class="btn btn-primary" onclick="sweet()"><i class="glyphicon glyphicon-floppy-disk"></i> Simpan</button>
  270. <input type="reset" class="btn btn-warning" value="Batal" onclick="window.history.back();">
  271. </div>
  272. </div>
  273. </div>
  274.  
  275. <div id="yyy" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
  276. </div></div>
  277. </div></div>
  278.  
  279. <?php
  280. break;
  281. }
  282. ?>
  283. <!--<script src="../aset/plugins/jQuery/jq.js"></script> -->
  284. <link rel="stylesheet" href="../aset/plugins/jQuery/jquery-ui-1.10.3.custom.css" type="text/css" media="" />
  285. <script src="../aset/plugins/jquery/jquery-2.2.4.min.js" type="text/javascript"></script>
  286. <script src="../aset/plugins/jQuery/jquery-ui-1.10.3.custom.min.js"></script>
  287. <script src="../aset/dist/js/bootstrap.min.js" type="text/javascript"></script>
  288.  
  289.  
  290. <script>
  291. function hanyaAngka(evt) {
  292. var charCode = (evt.which) ? evt.which : event.keyCode
  293. if (charCode > 31 && (charCode < 48 || charCode > 57))
  294.  
  295. return false;
  296. return true;
  297. }
  298. </script>
  299.  
  300. <script>
  301. $(document).ready(function () {
  302. $("#poli").select2({
  303. placeholder: "--Pilih Poli--",
  304. theme: "bootstrap"
  305.  
  306. });
  307. });
  308.  
  309. $(document).ready(function () {
  310. $("#id_unit").select2({
  311. placeholder: "Pilih Bagian",
  312. theme: "bootstrap"
  313.  
  314. });
  315. });
  316.  
  317. $(document).ready(function () {
  318. $("#bagian").select2({
  319. placeholder: "--Pilih Bagian--",
  320. theme: "bootstrap"
  321.  
  322. });
  323. });
  324.  
  325. $(document).ready(function () {
  326. $("#pendidikan").select2({
  327. placeholder: "Please Select",
  328. theme: "bootstrap"
  329.  
  330. });
  331. });
  332.  
  333. $(document).ready(function () {
  334. $("#pekerjaan").select2({
  335. placeholder: "Please Select",
  336. theme: "bootstrap"
  337.  
  338. });
  339. });
  340.  
  341. $(document).ready(function () {
  342. $("#status_nikah").select2({
  343. placeholder: "Please Select",
  344. theme: "bootstrap"
  345.  
  346. });
  347. });
  348.  
  349. $(document).ready(function () {
  350. $("#unit").select2({
  351. placeholder: "Please Select",
  352. theme: "bootstrap"
  353.  
  354. });
  355. });
  356.  
  357. $(document).ready(function () {
  358. $("#agama").select2({
  359. placeholder: "Please Select",
  360. theme: "bootstrap"
  361.  
  362. });
  363. });
  364. </script>
  365.  
  366. <script>
  367. var $jnoc = jQuery.noConflict();
  368. $jnoc(function() {
  369. $jnoc( "#nomor_rekam_medis" ).autocomplete({
  370. source: "module/transaksi_pasien/load_data.php",
  371. minLength: 2,
  372. select: function( event, ui ) {
  373.  
  374. $jnoc('#nama_pasien').val(ui.item.nama_pasien);
  375. $jnoc('#jenis_kelamin_pasien').val(ui.item.jenis_kelamin_pasien);
  376.  
  377.  
  378. }
  379. });
  380. });
  381. </script>
  382.  
  383.  
14650
Please login to answer!
/sangkep/answer/add-json/nogzip/1
/sangkep/answer/send-notification
User Paling Aktif Bulan Lalu

Asrianor

Point Bulan Lalu: 6