<style type="text/css">
    a:visited{text-decoration: none;}

</style>
<div class="row" id="info-content" style="display:block">
    <div class="col-md-12">
        <div class="portlet box green-haze" style="position:relative">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-user"></i> Informasi Pasien
                </div>
            </div>
            <div class="portlet-body form">
                <form class="form-horizontal form-bordered form-row-stripped" role="form">
                    <div class="form-body">
                        <div class="form-group">
                            <div class="col-md-6">
                                <div class="row">
                                    <label class="form-control-static col-md-4">Nomor Rekam Medis </label>
                                    <p class="form-control-static col-md-8">
                                        : &nbsp; BBMC-<?=$this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'nrm')?> 
                                    </p>
                                </div>
                                <div class="row">
                                    <label class="form-control-static col-md-4">Nama Pasien </label>
                                    <p class="form-control-static col-md-8">
                                        : &nbsp; <?=strtoupper($this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'nama_pasien'))?>  / <?=$this->Content_m->get_tipe_pasien($id_re_pasien)?>
                                    </p>
                                </div>
                                <div class="row">
                                    <label class="form-control-static col-md-4">Umur  </label>
                                    <p class="form-control-static col-md-8">
                                        : &nbsp; <?=strtoupper($this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'umur_tahun'))?> TAHUN <?=strtoupper($this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'umur_bulan'))?> BULAN
                                    </p>
                                </div>
                                <div class="row">
                                     <div style="padding:0px; <?=$get_kunjungan->id_dokter_jaga!='-1'?'display: block':'display: none'?>">
                                          <label class="form-control-static col-md-4">Dokter </label>
                                          <p class="form-control-static col-md-8">
                                              : &nbsp; 
                                              <?php 
                                              $id_dokter_jaga = $this->Content_m->get_value('bbmc_tr_kunjungan','id_re_kunjungan',$id_re_kunjungan,'id_dokter_jaga');
                                              echo "<b>".$this->Content_m->get_value('bbmc_re_staff_medis','id_staff_medis',$id_dokter_jaga,'staff_medis')."</b>";
                                              ?>  
                                          </p>
                                      </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="row">
                                    <label class="form-control-static col-md-4">Pendidikan  </label>
                                    <p class="form-control-static col-md-8">
                                        <?php $id_pendidikan = $this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'id_pendidikan');
                                        $pendidikan = $this->Content_m->get_value('bbmc_re_jenjang_pendidikan','id_jenj_didik',$id_pendidikan,'nm_jenj_didik');
                                        ?>
                                        : &nbsp; <?=strtoupper($pendidikan)?> 
                                    </p>
                                </div>
                                <div class="row">
                                    <label class="form-control-static col-md-4">Pekerjaan  </label>
                                    <p class="form-control-static col-md-8">
                                        <?php $id_pekerjaan = $this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'id_pekerjaan');
                                        $pendidikan = $this->Content_m->get_value('bbmc_re_pekerjaan','id_pekerjaan',$id_pekerjaan,'nm_pekerjaan');
                                        ?>
                                        : &nbsp; <?=strtoupper($pendidikan)?> 
                                    </p>
                                </div>
                                <div class="row">
                                    <label class="form-control-static col-md-4">Alamat  </label>
                                    <p class="form-control-static col-md-8">
                                        : &nbsp; <?=strtoupper($this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'alamat'))?> 
                                    </p>
                                </div>
                            </div>
                        </div>                                    
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<div class="row" id="info-content" style="display:block">
    <div class="col-md-12">
   
        <div class="portlet-body">
            <div class="panel-group accordion scrollable" id="accordion2">
                
                
                

                <?php 
                $i=1;
                //$this->db->where('id_re_kunjungan !=',$id_re_kunjungan);
                $this->db->order_by('tgl_kunjungan','asc');
                $this->db->where('id_re_pasien',$id_re_pasien);
                foreach ($this->Content_m->select_db('bbmc_tr_kunjungan')->result() as $key ) { ?>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                        <a style="text-decoration: underline;" class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse_2_<?=$i?>">
                        <b>Kunjungan <?=date('d F Y',strtotime($key->tgl_kunjungan))?> (<?=$this->Content_m->get_value('bbmc_re_status_perawatan','id_status_perawatan',$key->status_perawatan,'status_perawatan')?>)</b>   </a></a>

                        
                        </h4>

                        <div style="padding-left: 20px">
                        <?php 
                        echo "Diagnosa<br>";
                        $this->db->where('id_re_kunjungan',$key->id_re_kunjungan);
                        foreach ($this->Content_m->select_db('bbmc_tr_icd')->result() as $keyb) {
                           echo "- ".$this->Content_m->get_value('bbmc_re_icd','id_icd',$keyb->id_icd,'icd')." ".$this->Content_m->get_value('bbmc_re_icd','id_icd',$keyb->id_icd,'diagnosa')." ".$keyb->gigi_icd."<br>";
                        }


                        if($active == 'gigi'){
                            echo "Tindakan<br>";
                            $this->db->where('id_re_kunjungan',$key->id_re_kunjungan);
                            foreach ($this->Content_m->select_db('bbmc_tr_tindakan')->result() as $keyb) {
                               echo "- ";
                               if($active == 'gigi'){
                                    echo $this->Content_m->get_value('siak_re_account_chart','id', $keyb->tindakan,'name').", keterangan: $keyb->keterangan ,gigi: $keyb->gigi<br>";
                               }else{
                                    echo $this->Content_m->get_value('siak_re_account_chart','id', $keyb->tindakan,'name')."<br>";
                               }
                               
                            }
                        }

                        echo "Obat<br>";
                        $this->db->where('id_re_kunjungan',$key->id_re_kunjungan);
                        foreach ($this->Content_m->select_db('bbmc_tr_pengobatan')->result() as $keyb) {
                           echo "- ";
                           $this->db->where('id_pengobatan',$keyb->id_re_pengobatan);
                           $a=0;
                           foreach ($this->Content_m->select_db('bbmc_tr_pengobatan_pasien')->result() as $keyc ) {
                                if($a > 0){echo "&nbsp;&nbsp;";}
                               echo $this->Content_m->get_value('bbmc_re_apotik_obat','id_re_apotik_obat',$keyc->id_obat,'nama_obat')." Jmlh @".$keyc->qty."<br>";
                            $a++;
                           }
                          
                        }
                        echo "<br>";
                        ?>
                        </div>
                    </div>
                    <div id="collapse_2_<?=$i?>" class="panel-collapse <?=($key->id_re_kunjungan==$get_kunjungan->id_re_kunjungan)?'in':'collapse'?>">
                        
                        <div class="panel-body" style="">
                            <div class="portlet box" style="position:relative; background: silver !important">
                                <div class="portlet-title">
                                    <div class="caption">
                                        <i class="fa fa-stethoscope" style="color:#fff"></i> Pemeriksaan Dasar
                                    </div>
                                </div>
                           
                                <div class="portlet-body form">
                                    <form class="form-horizontal form-bordered form-row-stripped" role="form">
                                        <div class="form-body">
                                            <div class="form-group">

                                                <?php if($active == 'gigi'){ ?>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Keluhan Utama </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->keluhan_utama?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Alergi </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->alergi?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <?php if($get_kunjungan->deskripsi_alergi != ''){ ?>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Deskripsi Alergi </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->deskripsi_alergi?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <?php }?>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Tensi </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->tensi?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Temperature </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->temperature?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Pulse </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->pulse?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Tinggi Badan </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->tinggi_badan?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Berat Badan </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->berat_badan?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Riwayat Pengobatan </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->riwayat_pengobatan?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <?php if($get_kunjungan->deskripsi_riwayat_pengobatan != ''){ ?>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Deskripsi Riwayat Pengobatan </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->deskripsi_riwayat_pengobatan?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <?php }?>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Tekanan Darah  </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->tekanan_darah_tinggi?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <?php if($get_kunjungan->terakhir_check != ''){ ?>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Terakhir Check </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->terakhir_check?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <?php }?>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Hamil </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->hamil?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Hemofilia </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->hemofilia?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Penyakit Jantung </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->penyakit_jantung?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">HIV / AIDS </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->hiv_aids?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Epilepsi </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->epilepsi?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Diabetes </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->diabetes?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Asma </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->asma?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Stroke </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->stroke?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Gangguan Ginjal </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->gangguan_ginjal?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Keluhan Rahang </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->keluhan_rahang?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Penyakin Sistematik Lain </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->penyakit_sistematik_lain?>
                                                        </p>
                                                    </div>
                                                </div>
                                                
                                                <?php if($get_kunjungan->deskripsi_penyakit_sistematik_lainnya != ''){ ?>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Deskripsi Penyakit Sistematik Lainnya </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$get_kunjungan->deskripsi_penyakit_sistematik_lainnya?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <?php }?>

                                                <?php }else{ ?>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Keadaan Saat Tiba </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$this->Content_m->get_value('bbmc_re_keadaan_saat_tiba','id_keadaan_saat_tiba',$key->id_keadaan_saat_tiba,'keadaan_saat_tiba')?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Kesadaran </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$this->Content_m->get_value('bbmc_re_kesadaran','id_kesadaran',$key->id_kesadaran,'kesadaran')?> 
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Tekanan Darah </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->tekanan_darah?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Respirasi </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->respirasi?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Nadi </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->nadi?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Temperature </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->temperature?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Berat Badan </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->berat_badan?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Jenis Pelayanan </label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$this->Content_m->get_value('bbmc_re_jenis_pelayanan','id_jenis_pelayanan',$key->id_jenis_pelayanan,'jenis_pelayanan')?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Riwayat Singkat</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->anamnesa?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <!--
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Pemeriksaan Fisik</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->pemeriksaan_fisik=='st_lokalis'?$key->detail_lokalis:'ST General'?>
                                                        </p>
                                                    </div>
                                                </div>
                                                -->
                                                
                                                <div class="st_general" style="padding:0px; <?=$key->pemeriksaan_fisik=='st_general'?'display: block':'display: none'?>">
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Mata</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->cek_fisik_mata?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">THT</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->cek_fisik_tht?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Abdomen</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->cek_fisik_abdomen?>
                                                        </p>
                                                    </div>
                                                </div>

                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Ekstrimitas</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->cek_fisik_ekstrimitas?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Thorax Cor</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->thorax_cor?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Thorax pulmo</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->thorax_pulmo?>
                                                        </p>
                                                    </div>
                                                </div>
                                                </div>

                                                <div class="st_lokalis" style="padding:0px; <?=$key->pemeriksaan_fisik=='st_lokalis'?'display: block':'display: none'?>">
                                                    <div class="col-md-12">
                                                        <div class="row">
                                                            <label class="form-control-static col-md-2">Lokalis</label>
                                                            <p class="form-control-static col-md-10">
                                                                : &nbsp; <?=$key->detail_lokalis?>
                                                            </p>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Alergi Makanan</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->alergi_makanan?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Riwayat Pengobatan</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->riwayat_pengobatan?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <?php }?>
                                                
                                                <div style="padding:0px; <?=$key->id_dokter_jaga!='-1'?'display: block':'display: none'?>">
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Dokter</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; 
                                                            <?=$this->Content_m->get_value('bbmc_re_staff_medis','id_staff_medis',$key->id_dokter_jaga,'staff_medis')?> 
                                                        </p>
                                                    </div>
                                                </div>
                                                </div>
                        

                                                <div style="padding:0px; <?=$key->id_dokter_jaga=='-1'?'display: block':'display: none'?>">
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Dokter Tidak Tetap</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->nama_dokter_tidak_tetap?>
                                                        </p>
                                                    </div>
                                                </div>
                                                </div>

                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Perawat / Bidan</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$this->Content_m->get_value('bbmc_re_staff_medis','id_staff_medis',$key->id_perawat_bidan_jaga,'staff_medis')?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Pemeriksaan Lain</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=ucwords(strtolower(str_replace("_", " ", $key->pemeriksaan_khusus)))?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Keluar Poli</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->tgl_keluar_ugd=='0000-00-00'?date('Y-m-d'):$key->tgl_keluar_ugd?>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Alasan Keluar</label>
                                                        <p class="form-control-static col-md-8">
                                                        
                                                            <?php $alasan_keluar = $this->Content_m->get_value('bbmc_re_alasan_keluar','id_alasan_keluar',$key->id_alasan_keluar,'alasan_keluar');?>
                                                            <?php if($active == 'gigi'){ ?>
                                                           
                                                            : &nbsp; <?=$alasan_keluar=='Konsul Poli Gigi'?'Konsul Poli Umum':$alasan_keluar?>
                                                            <?php }else{ ?>
                                                            : &nbsp; <?=$alasan_keluar?>
                                                            <?php }?>
                                                            
                                                        </p>
                                                    </div>
                                                </div>
                                               
                                                <div class="st_general" style="padding:0px; <?=$key->id_alasan_keluar=='2'?'display: block':'display: none'?>">
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Kamar</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$this->Content_m->get_value('bbmc_re_tipe_kamar','id_tipe_kamar',$key->id_tipe_kamar,'tipe_kamar')?> 
                                                        </p>
                                                    </div>
                                                </div>
                                                </div>
                                                <div class="st_general" style="padding:0px; <?=$key->id_alasan_keluar=='4'?'display: block':'display: none'?>">
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Rumah Sakit</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$key->rumah_sakit?>
                                                        </p>
                                                    </div>
                                                </div>
                                                </div>
                                                <div class="st_general" style="padding:0px; <?=$key->id_alasan_keluar=='3'?'display: block':'display: none'?>">
                                                <div class="col-md-6">
                                                    <div class="row">
                                                        <label class="form-control-static col-md-4">Dokter Spesialis</label>
                                                        <p class="form-control-static col-md-8">
                                                            : &nbsp; <?=$this->Content_m->get_value('bbmc_re_staff_medis','id_staff_medis',$key->id_dokter_spesialis,'staff_medis')?> 
                                                        </p>
                                                    </div>
                                                </div>
                                                </div>                    
                                            </div>                                    
                                        </div>
                                    </form>
                                </div>
                            </div>


                            <?php 
                            $this->db->where('id_re_kunjungan',$key->id_re_kunjungan);
                            $q = $this->Content_m->select_db('bbmc_tr_laboratorium');
                            if($q->num_rows() != 0){ ?>
                            <div class="row" id="info-content" style="display:block">
                                <div class="col-md-12">
                 

                                    <div class="portlet box" style="position:relative; background: silver !important">
                                        <div class="portlet-title">
                                            <div class="caption">
                                                <i class="fa fa-flask" style="color:#fff"></i> Pemeriksaan Laboratorium
                                            </div>
                                        </div>
                           
                                        <div class="portlet-body form">
                                            <form class="form-horizontal form-bordered form-row-stripped" role="form">
                                                <div class="form-body">
                                                   <div class="row">
                                                      <div class="col-md-12">
                                                        <div class="form-group" id="icd">
                                                          <div class="table-responsive">
                                                            <table id="<?= $controller ?>_table" class="table table-bordered table-striped table-hover" style="margin-bottom:0px; width:100%; font-size:11px !important">
                                                                <thead>
                                                                  <tr>
                                                                    <?php if($q->num_rows() == 0){ ?>
                                                                    <th colspan="3" class="text-right col-md-4" style="font-size:10px !important">Tgl Periksa&nbsp;&nbsp;</th>
                                                                    <?php }else{ ?>
                                                                    <th class="text-center col-md-1" style="font-size:10px !important">No</th>
                                                                    <th class="text-left col-md-2" style="font-size:10px !important">Tgl Periksa</th>
                                                                    <th class="text-left col-md-1" style="font-size:10px !important">No. Periksa</th>
                                                                    <?php }?>
                                                                    <th class="text-left col-md-1" style="font-size:10px !important">No. Lab</th>
                                                                    <th class="text-left col-md-4" style="font-size:10px !important">Tindakan Lab</th>
                                                                    <th class="text-left col-md-2" style="font-size:10px !important">Hasil Lab</th>
                                                                  </tr>
                                                                </thead>
                                                                <tbody>
                                                                  <?php 
                                                                  $i=1;
                                                                  foreach ($q->result() as $keyb ) { ?>
                                                                  <tr style="" class="pemeriksaan_lab<?=$i?>">   
                                                                    <input type="hidden" name="id_re_laboratorium[]" value="<?=$keyb->id_re_laboratorium?>">
                                                                    <td align="center"><?=$i?></td>
                                                                    <td align="left">
                                                                        <?=$keyb->tgl_periksa?>
                                                                        <input type="hidden" name="tgl_periksa[]" value="<?=$keyb->tgl_periksa?>">
                                                                    </td>
                                                                    <td align="left">
                                                                        LAB-<?=$keyb->id_re_laboratorium?>
                                                                    </td>
                                                                    <td align="left">
                                                                        <?=$keyb->no_lab?>
                                                                        <input type="hidden" name="no_lab[]" value="<?=$keyb->no_lab?>">    
                                                                    </td>
                                                                    <td align="left">
                                                                        <?=$this->Content_m->get_value('siak_re_account_chart','id',$keyb->tindakan_lab,'name')?>
                                                                        <input type="hidden" name="tindakan_lab[]" value="<?=$keyb->tindakan_lab?>">        
                                                                    </td>
                                                                    <td align="left">
                                                                        <?=$keyb->hasil_lab?>
                                                                        <input type="hidden" name="hasil_lab[]" value="<?=$keyb->hasil_lab?>">      
                                                                    </td>
                                                                  </tr>
                                                                  <?php $i++; $id_lab = $keyb->id_re_laboratorium; }?>
                                                                </tbody>
                                                              </table>       
                                                          </div>
                                                        </div> 
                                                      </div>
                                                    </div>                    
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php }?>


                            <?php 
                            $this->db->where('id_re_kunjungan',$key->id_re_kunjungan);
                            $q = $this->Content_m->select_db('bbmc_tr_radiologi');
                            if($q->num_rows() != 0){ ?>
                            <div class="row" id="info-content" style="display:block">
                                <div class="col-md-12">

                                    <div class="portlet box" style="position:relative; background: silver !important">
                                        <div class="portlet-title">
                                            <div class="caption">
                                                <i class="fa fa-desktop" style="color:#fff"></i> Pemeriksaan Radiologi
                                            </div>
                                        </div>
                           

                                        <div class="portlet-body form">
                                            <form class="form-horizontal form-bordered form-row-stripped" role="form">
                                                <div class="form-body">
                                                   <div class="row">
                                                      <div class="col-md-12">
                                                        <div class="form-group" id="icd">
                                                          <div class="table-responsive">
                                                            <table id="<?= $controller ?>_table" class="table table-bordered table-striped table-hover" style="margin-bottom:0px; width:100%; font-size:11px !important">
                                                                <thead>
                                                                  <tr>
                                                                    <?php if($q->num_rows() == 0){ ?>
                                                                    <th colspan="3" class="text-right col-md-4" style="font-size:10px !important">Tgl Periksa&nbsp;&nbsp;</th>
                                                                    <?php }else{ ?>
                                                                    <th class="text-center col-md-1" style="font-size:10px !important">No</th>
                                                                    <th class="text-left col-md-2" style="font-size:10px !important">Tgl Periksa</th>
                                                                    <th class="text-left col-md-1" style="font-size:10px !important">No. Periksa</th>
                                                                    <?php }?>
                                                                    
                                                                    <th class="text-left col-md-5" style="font-size:10px !important">Tindakan Radiologi</th>
                                                                    <th class="text-left col-md-2" style="font-size:10px !important">Hasil Radiologi</th>
                                                                   
                                                                  </tr>
                                                                </thead>
                                                                <tbody>
                                                                  <?php 
                                                                  $i=1;
                                                                  foreach ($q->result() as $keyb ) { ?>
                                                                  <tr style="" class="pemeriksaan_rad<?=$i?>">   
                                                                    <input type="hidden" name="id_re_radiologi[]" value="<?=$keyb->id_re_radiologi?>">
                                                                    <td align="center"><?=$i?></td>
                                                                    <td align="left">
                                                                        <?=$keyb->tgl_periksa?>
                                                                        <input type="hidden" name="tgl_periksa[]" value="<?=$keyb->tgl_periksa?>">
                                                                    </td>
                                                                    <td align="left">
                                                                        RAD-<?=$keyb->id_re_radiologi?>
                                                                    </td>
                                                                   
                                                                    <td align="left">
                                                                        <?=$this->Content_m->get_value('siak_re_account_chart','id',$keyb->tindakan_radiologi,'name')?>
                                                                        <input type="hidden" name="tindakan_radiologi[]" value="<?=$keyb->tindakan_radiologi?>">        
                                                                    </td>
                                                                    <td align="left">
                                                                        <?=$keyb->hasil_radiologi?>
                                                                        <input type="hidden" name="hasil_radiologi[]" value="<?=$keyb->hasil_radiologi?>">      
                                                                    </td>
                                                                    
                                                                  </tr>
                                                                  <?php $i++; $id_radiologi = $keyb->id_re_radiologi; }?>


                                                                </tbody>
                                                              </table>    
                                                          </div>
                                                        </div> 
                                                      </div>
                                                    </div>                    
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php }?>


                            <?php 
                            $this->db->where('id_re_kunjungan',$key->id_re_kunjungan);
                            $q = $this->Content_m->select_db('bbmc_tr_icd'); 
                            if($q->num_rows() != 0){ ?>
                            <div class="row" id="info-content" style="display:block">
                                <div class="col-md-12">

                                    <div class="portlet box" style="position:relative; background: silver !important">
                                        <div class="portlet-title">
                                            <div class="caption">
                                                <i class="fa fa-eyedropper" style="color:#fff"></i> ICD
                                            </div>
                                        </div>

                                        <div class="portlet-body form">
                                            <form class="form-horizontal form-bordered form-row-stripped" role="form">
                                                <div class="form-body">
                                                   <div class="row">
                                                      <div class="col-md-12">
                                                        <div class="form-group" id="icd">
                                                          <div class="table-responsive">
                                                            <table id="<?= $controller ?>_table" class="table table-bordered table-striped table-hover" style="margin-bottom:0px; width:100%; font-size:11px !important">
                                                                <thead>
                                                                  <tr>
                                                                    <th class="text-center col-md-1" style="font-size:10px !important">No</th>
                                                                    <th class="text-left col-md-3" style="font-size:10px !important">ICD</th>
                                                                    <th class="text-left col-md-7" style="font-size:10px !important">Nama ICD</th>
                                                                    
                                                                  </tr>
                                                                </thead>
                                                                <tbody>
                                                                  <?php 
                                                                  $i=1;
                                                                  foreach ($q->result() as $keyb ) { ?>
                                                                  <tr style="" class="icd<?=$i?>">   
                                                                    <input type="hidden" name="id_re_icd[]" value="<?=$keyb->id_re_icd?>">
                                                                    <td align="center"><?=$i?></td>
                                                                    <td align="left">
                                                                        <?=$this->Content_m->get_value('bbmc_re_icd','id_icd',$keyb->id_icd,'icd')?>
                                                                        <input type="hidden" name="id_icd[]" value="<?=$keyb->id_icd?>">        
                                                                    </td>
                                                                    <td align="left">
                                                                       <?=$this->Content_m->get_value('bbmc_re_icd','id_icd',$keyb->id_icd,'diagnosa')?> <?=$keyb->gigi_icd?>
                                                                    </td>
                                                                  </tr>
                                                                  <?php $i++; $id_lab = $keyb->id_re_icd; }?>
                                                                  
                                                                </tbody>
                                                              </table>
                                                          </div>
                                                        </div> 
                                                      </div>
                                                    </div>                    
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php }?>

                            
                              <?php 
                            $this->db->where('id_re_kunjungan',$key->id_re_kunjungan);
                            $q = $this->Content_m->select_db('bbmc_tr_tindakan'); 
                            if($q->num_rows() != 0){ ?>
                            <div class="row" id="info-content" style="display:block">
                                <div class="col-md-12">
                                    <div class="portlet box" style="position:relative; background: silver !important">
                                        <div class="portlet-title">
                                            <div class="caption">
                                                <i class="fa fa-eyedropper" style="color:#fff"></i> Tindakan
                                            </div>
                                        </div>

                               
                                        <div class="portlet-body form">
                                            <form class="form-horizontal form-bordered form-row-stripped" role="form">
                                                <div class="form-body">
                                                   <div class="row">
                                                      <div class="col-md-12">
                                                        <div class="form-group" id="icd">
                                                          <div class="table-responsive">
                                                            <table id="<?= $controller ?>_table" class="table table-bordered table-striped table-hover" style="margin-bottom:0px; width:100%; font-size:11px !important">
                                                                <thead>
                                                                  <tr>
                                                                    <th class="text-center col-md-1" style="font-size:10px !important">No</th>
                                                                    <th class="text-left col-md-6" style="font-size:10px !important">Tindakan</th>
                                                                    <?php if($active == 'gigi'){ ?>
                                                                    <th class="text-left col-md-2" style="font-size:10px !important">Keterangan</th>
                                                                    <th class="text-left col-md-2" style="font-size:10px !important">Gigi</th>
                                                                    <?php }?>
                                                                  </tr>
                                                                </thead>
                                                                <tbody>
                                                                  <?php 
                                                                  $i=1;
                                                                  foreach ($q->result() as $keyb ) { ?>
                                                                  <tr style="" class="tindakan<?=$i?>">   
                                                                    <input type="hidden" name="id_re_tindakan[]" value="<?=$keyb->id_re_tindakan?>">
                                                                    <td align="center"><?=$i?></td>
                                                                    <td align="left">
                                                                        <?=$this->Content_m->get_value('siak_re_account_chart','id',$keyb->tindakan,'name')?> 
                                                                        <input type="hidden" class="form-control" name="tindakan[]" value="<?=$keyb->tindakan?>">
                                                                    </td>
                                                                    <?php if($active == 'gigi'){ ?>
                                                                    <td align="left">
                                                                        <?=$keyb->gigi?>
                                                                    </td>
                                                                    <td align="left">
                                                                        <?=$keyb->keterangan?>
                                                                    </td>
                                                                    <?php }?>
                                                                  </tr>
                                                                  <?php $i++; $id_tindakan = $keyb->id_re_tindakan; }?>
                                                                 
                                                                </tbody>
                                                              </table>
                                                          </div>
                                                        </div> 
                                                      </div>
                                                    </div>                    
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php }?>



                            <?php 
                            $this->db->where('id_re_kunjungan',$key->id_re_kunjungan);
                            $q = $this->Content_m->select_db('bbmc_tr_pengobatan'); 
                            //echo $this->db->last_query();
                            if($q->num_rows() != 0){ ?>
                            <div class="row" id="info-content" style="display:block">
                                <div class="col-md-12">

                                    <div class="portlet box" style="position:relative; background: silver !important">
                                        <div class="portlet-title">
                                            <div class="caption">
                                                <i class="fa fa-file-text-o" style="color:#fff"></i> Obat
                                            </div>
                                        </div>


                                        <div class="portlet-body form">
                                            <form class="form-horizontal form-bordered form-row-stripped" role="form">
                                                <div class="form-body">
                                                   <div class="row">
                                                      <div class="col-md-12">
                                                        <div class="form-group" id="icd">
                                                          <div class="table-responsive">
                                                            
                                                            <table id="<?= $controller ?>_table" class="table table-bordered table-striped table-hover" style="margin-bottom:0px; width:100%; font-size:11px !important">
                                                              <thead>
                                                                <tr>
                                                                  <?php if($q->num_rows() == 0){ ?>
                                                                  <th colspan="5" class="text-left col-md-4" style="font-size:10px !important">Obat
                                                                  </th>
                                                                  <?php }else{ ?>
                                                                  <th class="text-center col-md-1" style="font-size:10px !important">No</th>
                                                                  <th class="text-left col-md-2" style="font-size:10px !important">Nama Obat</th>
                                                                  <th class="text-left col-md-1" style="font-size:10px !important">Sediaan</th>
                                                                  <th class="text-left col-md-1" style="font-size:10px !important">Jenis Obat</th>
                                                                  
                                                                  <?php }?>
                                                                  <th class="text-left col-md-1" style="font-size:10px !important">Jumlah</th>
                                                                  <th class="text-left col-md-4" style="font-size:10px !important">Dosis dan cara pemakaian</th>
                                                                  
                                                                  <th class="text-center col-md-1" style="font-size:10px !important">Aksi</th>
                                                                </tr>
                                                              </thead>
                                                              <tbody>
                                                                <?php 
                                                                $i=1;
                                                                foreach ($q->result() as $key ) { ?>
                                                                <tr style="" class="pengobatan<?=$i?>">   
                                                                  <input type="hidden" name="id_re_pengobatan[]" value="<?=$key->id_re_pengobatan?>">
                                                                  <td align="center"><?=$i?></td>
                                                                  <td align="left">
                                                                      <?php 
                                                                      $this->db->where('id_pengobatan',$key->id_re_pengobatan);
                                                                      foreach ($this->Content_m->select_db('bbmc_tr_pengobatan_pasien')->result() as $keyb ) { ?>
                                                                        <input type="hidden" class="form-control " name="id_obat[<?=$i?>][]" value="<?=$keyb->id_obat?>" placeholder="">
                                                                        <?=$this->Content_m->get_value('bbmc_re_apotik_obat','id_re_apotik_obat',$keyb->id_obat,'nama_obat')."<br>"?>
                                                                      <?php }?>
                                                                      
                                                                  </td>
                                                                  <td align="left">
                                                                      <?php 
                                                                      $this->db->where('id_pengobatan',$key->id_re_pengobatan);
                                                                      foreach ($this->Content_m->select_db('bbmc_tr_pengobatan_pasien')->result() as $keyb ) { ?>
                                                                        <?=$this->Content_m->get_value('bbmc_re_apotik_obat','id_re_apotik_obat',$keyb->id_obat,'sediaan')."<br>"?>
                                                                      <?php }?>
                                                                  </td>
                                                                  <td align="left">
                                                                      <?php 
                                                                      $this->db->where('id_pengobatan',$key->id_re_pengobatan);
                                                                      foreach ($this->Content_m->select_db('bbmc_tr_pengobatan_pasien')->result() as $keyb ) { ?>
                                                                        <?=$this->Content_m->get_value('bbmc_re_apotik_obat','id_re_apotik_obat',$keyb->id_obat,'jenis_obat')."<br>"?>
                                                                      <?php }?>
                                                                  </td>
                                                                 
                                                                  <td align="left">
                                                                      <?php 
                                                                      $this->db->where('id_pengobatan',$key->id_re_pengobatan);
                                                                      foreach ($this->Content_m->select_db('bbmc_tr_pengobatan_pasien')->result() as $keyb ) { ?>
                                                                        <input type="hidden" class="form-control " name="qty[<?=$i?>][]" value="<?=$keyb->qty?>" placeholder="">
                                                                        <?=$keyb->qty."<br>"?>
                                                                      <?php }?>
                                                                  </td>
                                                                  <td align="left">
                                                                      <?php 
                                                                      $this->db->where('id_pengobatan',$key->id_re_pengobatan);
                                                                      foreach ($this->Content_m->select_db('bbmc_tr_pengobatan_pasien')->result() as $keyb ) { ?>
                                                                        <input type="hidden" class="form-control " name="cara_pemakaian[<?=$i?>][]" value="<?=$keyb->cara_pemakaian?>" placeholder="">
                                                                        <?=$keyb->cara_pemakaian."<br>"?>
                                                                      <?php }?>
                                                                  </td>
                                                                  <td align="center"><a data-toggle="tooltip" data-placement="top" title="Hapus Obat" href="<?=site_url()?>/front_office/ugd_dir/ugd/del_pengobatan/<?=$key->id_re_pengobatan?>/<?=$id_re_kunjungan?>" onclick="return confirm('Apakah anda yakin menghapus entry ini?')" data-id="<?=$i?>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a></td>
                                                                </tr>
                                                                <?php $i++; $id_pengobatan = $key->id_re_pengobatan; }?>
                                                                
                                                               
                                                              </tbody>
                                                            </table>


                                                          </div>
                                                        </div> 
                                                      </div>
                                                    </div>                    
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php }?>
                        </div>


                    </div>
                </div>
                <?php $i++;}?>
                

                


            </div>
        </div>
    </div>
    
</div>
        






<script type="text/javascript">
	$(document).ready(function() {
     /*-------------Datepicker-------------*/
    
    $(".sel2").select2({
      placeholder: "Pilih .. ",
      language: "id"
    });

    $("#loading-content,#loading").fadeOut("fast", function() {
      $("#page-content").fadeIn("fast");
    });

  });
</script>
<?php $this->load->view('front_office/script/form_data'); ?>
