Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $aksi="menu/menu_rm/aksi_rm.php";
- switch($_GET[act]){
- // Tampil rekam_medis
- default:
- echo "<h2>Data Rekam Medis</h2>
- <input type=button value='Tambah Data'
- onclick=\"window.location.href='?menu=rekam_medis&act=tambahrm';\">
- <table>
- <tr><th>No</th><th>ID RM</th><th>Kode RM</th><th>ID Pasien</th><th>Diagnosa</th><th>ID Obat</th><th>Hasil Lab</th><th>aksi</th></tr>";
- $tampil=mysql_query("SELECT * FROM rekam_medis ORDER BY id_rm ASC");
- $no=1;
- while ($r=mysql_fetch_array($tampil)){
- echo "<tr><td>$no</td>
- <td>$r[id_rm]</td>
- <td>$r[id_pasien]</td>
- <td>$r[id_dokter]</td>
- <td>$r[diagnosa]</td>
- <td>$r[id_obat]</td>
- <td>$r[hasil_lab]</td>
- <td><a href=?menu=rekam_medis&act=editrm&id=$r[id_rm]>Edit</a> |
- <a href=$aksi?menu=rekam_medis&act=hapus&id=$r[id_rm]>Hapus</a>
- </td></tr>";
- $no++;
- }
- echo "</table>";
- break;
- // Form tambah rekam_medis
- case "tambahrm":
- $sql="SELECT id_dokter,nm_dokter "
- ."FROM dokter";
- $result=mysql_query($sql);
- $dokter=array();
- while($row=mysql_fetch_object($result))
- {
- $dokter[]=$row;
- }
- mysql_free_result($result);
- $sql="SELECT id_pasien,nm_pasien "
- ."FROM pasien";
- $result=mysql_query($sql);
- $pasien=array();
- while($row=mysql_fetch_object($result))
- {
- $pasien[]=$row;
- }
- mysql_free_result($result);
- $sql="SELECT id_obat,nm_obat "
- ."FROM obat";
- $result=mysql_query($sql);
- $obat=array();
- while($row=mysql_fetch_object($result))
- {
- $obat[]=$row;
- }
- mysql_free_result($result);
- ."<form method='POST'>\n"
- ."<input type='hidden' name='act' value='save' />"
- ."<table>\n"
- ."<tr><td>Kode RM</td><td colspan='2'><input type='text' id='kd_rm' name='kd_rm' /></td></tr>\n"
- ."<tr><td>Nama Dokter</td><td colspan='2'><select id='id_dokter' name='id_dokter'>";
- foreach($dokter as $dok)
- {
- echo "<option value='".$dok->id_dokter."'>".$dok->nm_dokter."</option>";
- }
- echo "</select></td></tr>\n"
- ."<tr><td>Nama Pasien</td><td colspan='2'><select id='id_pasien' name='id_pasien'>";
- foreach($pasien as $pas)
- {
- echo "<option value='".$pas->id_pasien."'>".$pas->nm_pasien."</option>";
- }
- echo "</select></td></tr>\n"
- ."<tr valign='top'><td>Obat</td><td id='drugbox'><div class='obat'><select name='id_obat[]'>";
- foreach($obat as $dt)
- {
- echo "<option value='".$dt->id_obat."'>".$dt->nm_obat."</option>";
- }
- echo "</select></div></td><td><span class='btn_obat' id='add_obat'>add</span><span class='btn_obat' id='del_obat'>del</span></td></tr>\n"
- ."<tr><td>Diagnosa</td><td colspan='2'><input type='text' id='diagnosa' name='diagnosa' /></td></tr>\n"
- ."<tr><td>Hasil lab</td><td colspan='2'><input type='text' id='hasil_lab' name='hasil_lab' /></td></tr>\n"
- ."<tr><td colspan='3' align='center'><input type='submit' name='submit' value='simpan' class='btn'/></td></tr>\n"
- ."</table>\n"
- ."</form>\n";
- ?>
- <script>
- $(document).ready(function(){
- $('#add_obat').click(function(){
- $('.obat').first().clone().appendTo('#drugbox');
- });
- $('#del_obat').click(function(){
- $('.obat').last().remove();
- });
- });
- </script>
- <?php
- break;
- // Form Edit rekam_medis
- case "editrm":
- $edit=mysql_query("SELECT * FROM rekam_medis WHERE id_rm='$_GET[id]'");
- $r=mysql_fetch_array($edit);
- echo "<h2>Edit rekam_medis</h2>
- <form method=POST action=$aksi?menu=rekam_medis&act=update>
- <input type=hidden name=id value='$r[id_rm]'>
- <table>
- <tr><td>ID Rekam Medis</td><td> : <input type=text name='id_rm' value='$r[id_rm]'></td></tr>
- <tr><td>ID Pasien</td><td> : <select name='id_pasien'> ";
- $hasil=mysql_query('SELECT * from pasien');
- while($cetak=mysql_fetch_array($hasil)){
- echo"<option value='".$cetak ['id_pasien']."'>
- ".$cetak['id_pasien']."-".$cetak['nm_pasien']."</option>";}
- echo"</select>
- <tr><td>Diagnosa</td><td> : <input type=text name='diagnosa'value='$r[diagnosa]'></td></tr>
- <tr><td>Obat</td><td> : <select name='id_obat'> ";
- $hasil=mysql_query('SELECT * from obat');
- while($cetak=mysql_fetch_array($hasil)){
- echo"<option value='".$cetak ['id_obat']."'>
- ".$cetak['id_obat']."-".$cetak['nama_obat']."</option>";}
- echo"</select>
- <tr><td>Hasil Lab</td><td> : <input type=text name='telp'value='$r[hasil_lab]'></td></tr>
- <tr><td colspan=2><input type=submit value=Update>
- <input type=button value=Batal onclick=self.history.back()></td></tr>
- </table></form>";
- break;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement