<style type="text/css">
  .in-print{display: none;}
  @media print {
  .in-print{display: block;}
  .hidden-print {
    display: none !important;
  }
  @page {
    size: auto;   /* auto is the initial value */
    margin: 0;  /* this affects the margin in the printer settings */
  }

  @media print {
  @page {
    size: A3;
  }
}


}
</style>


<div class="portlet-title in-print" style="min-height:30px">
<img src="<?=base_url()?>media/images/logo_header.jpg" style="width:350px; float: left; padding:20px; padding-top: 0px">
<div class="caption" style="float: right;">
    <span style="font-size:15px">
    <i class="fa fa-map-marker"></i> Jl. Raya Batu Bulan Anyelir 5 No. 3 A<br>
    <i class="fa fa-phone"></i> (0361) 8461172<br>
    <i class="fa fa-whatsapp"></i> 0822 3166 6767<br>
    <i class="fa fa-envelope"></i> bbmc.medic@gmail.com
    </span>
    
</div>
</div>

<?php 
$cek = $this->Content_m->get_value('bbmc_re_laboratorium_group_print','tindakan_lab',$tindakan_lab,'keterangan');
//echo $cek." ";
//echo $this->db->last_query();
?>

<div class="row" id="info-content" style="display:block">
    <div class="col-md-12">
        <div class="portlet box green-haze" style="position:relative; padding-top: 0px">
          
            <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-12">
                                <div class="row" style="padding: 25px; padding-bottom: 0px; padding-top: 0px">
                                    <table style="width: 100%">
                                      <tr>
                                        <td style="font-size:12px; width: 90px">Dokter</td>
                                        <td style="font-size:12px; width: 350px">: 
                                        <?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>";
                                        ?>  
                                        </td>
                                        <td style="font-size:12px; width: 90px">Tanggal</td>
                                        <td>:
                                        <?=$get_kunjungan->tgl_kunjungan?>
                                        </td>
                                      </tr>
                                      <tr>
                                        <td>No RM</td>
                                        <td>:
                                        BBMC-<?=$this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'nrm')?> 
                                        </td>
                                        <td>No Reg Lab</td>
                                        <td>:</td>
                                      </tr>
                                      <tr>
                                        <td>Nama Pasien</td>
                                        <td>:
                                        <?=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)?>
                                        </td>
                                        <td>Poli/HC/RS</td>
                                        <td>:
                                        <?=strtoupper($this->Content_m->get_value('bbmc_re_status_perawatan','id_status_perawatan',$get_kunjungan->status_perawatan,'status_perawatan'))?>
                                        </td>
                                      </tr>
                                      <tr>
                                        <td>Umur</td>
                                        <td>:
                                        <?=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
                                        </td>
                                        <td>Alamat</td>
                                        <td>:
                                        <?=strtoupper($this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'alamat'))?> 
                                        </td>
                                      </tr>
                                      <tr>
                                        <td>Jenis Kelamin</td>
                                        <td>:
                                        <?=strtoupper($this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'jenis_kelamin'))?> 
                                        </td>
                                        <td>Bahan</td>
                                        <?php if($cek == 'KIMIA_KLINIK' || $cek == 'kimia_klinik'){ ?>
                                        <td>: DARAH</td>
                                        <?php }else if($cek == 'NAPZA' || $cek== 'napza'){ ?>
                                        <td>: URINE</td>
                                        <?php }else{ ?>
                                        <td>: <?=strtoupper($this->Content_m->get_value('siak_re_account_chart','id',$tindakan_lab,'name'))?></td>
                                        <?php }?>
                                        
                                      </tr>

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

                            

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

                
            </div>

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



<div class="row" id="portlet-content">
    <div class="col-md-12">
        <div class="portlet light" style="position:relative; padding: 0px;">           
            <div class="portlet-body form" id="page-content" style="display:nonee">
              <a href="javascript:;" class="hidden-print" onclick="window.print()" style="float: right; text-decoration: underline;">Print</a><br>

              <form action="<?= site_url('front_office/'.$controller_dir.$controller.'/update_hasil_pemeriksaan') ?>" method="post" id="<?=$controller?>" enctype="multipart/form-data" class="horizontal-form">

                <div class="form-body" style="padding-top: 0px">
                  <div class="alert alert-danger display-hide" style="display:nonee;" id="error">
                    <button class="close" data-close="alert"></button>
                    <span id="error-text"></span>
                  </div>

                  <center>
                  <?php if($cek == 'KIMIA_KLINIK' || $cek == 'kimia_klinik'){ ?>
                  <H4 style="margin: 0px">HASIL PEMERIKSAAN KIMIA KLINIK</H4>
                  <?php }else if($cek == 'NAPZA' || $cek == 'napza'){ ?>
                  <H4 style="margin: 0px">HASIL PEMERIKSAAN NAPZA</H4>
                  <?php }else { ?>
     
                  
                  <?php if($keterangan == 'darah_lengkap'){ ?>
                  <H4 style="margin: 0px">HASIL PEMERIKSAAN DARAH LENGKAP</H4>
                  <?php }?>

                  <?php if($keterangan == 'hbs_ag'){ ?>
                  <H4 style="margin: 0px">HASIL PEMERIKSAAN IMMUNOSEROLOGY</H4>
                  <?php }?>

                  <?php if($keterangan == 'golongan_darah'){ ?>
                  <H4 style="margin: 0px">HASIL PEMERIKSAAN GOLONGAN DARAH</H4>
                  <?php }?>

                  <?php if($keterangan == 'widal'){ ?>
                  <H4 style="margin: 0px">HASIL PEMERIKSAAN WIDAL</H4>
                  <?php }?>

                  <?php if($keterangan == 'urine_rutin' || $keterangan == 'glukosa_stik' || $keterangan == 'glukosa_alat'){ ?>
                  <H4 style="margin: 0px">HASIL PEMERIKSAAN URINALISA</H4>
                  <?php }?>

                  <?php if($keterangan == 'faeces_rutin'){ ?>
                  <H4 style="margin: 0px">HASIL PEMERIKSAAN FAECES LENGKAP</H4>
                  <?php }?>

                  <?php if($keterangan == 'hiv'){ ?>
                  <H4 style="margin: 0px">HASIL PEMERIKSAAN IMMUNOSEROLOGY</H4>
                  <?php }?>
                  
                  <?php }?>
                  
                  
                  
                  


                  </center>
                  <br>

                  

                   <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:13px !important">
                              
                              <tbody>
                                  <?php 
                                  $aa_paket = array();
                                      $this->db->where('template_set',$keterangan);
                                      foreach ($this->Content_m->select_db('bbmc_re_laboratorium_template')->result() as $key ) {
                                        $aa_paket[] = $key->tindakan_lab;
                                      }
                                    //var_dump($aa_paket);

                                  $i=0;
                                  if($cek == 'kimia_klinik' || $cek == 'KIMIA_KLINIK' || $cek =='napza' || $cek =='NAPZA'){
                                    $get_tindakan_kimia_klinik = array();
                                    $this->db->where('keterangan',$cek);
                                    foreach ($this->Content_m->select_db('bbmc_re_laboratorium_group_print')->result() as $key ) {
                                      $get_tindakan_kimia_klinik[] = $key->tindakan_lab;
                                    }
                                    
                                    $get_id_lab_kimia_klinik = array();
                                    $this->db->where('id_re_kunjungan',$id_re_kunjungan);
                                    $this->db->where_in('tindakan_lab',$get_tindakan_kimia_klinik);
                                    $qq = $this->Content_m->select_db('bbmc_tr_laboratorium');
                                    foreach ($qq->result() as $key ) {
                                      $get_id_lab_kimia_klinik[] = $key->id_re_laboratorium;
                                    }

                                    $this->db->order_by('id_re_laboratorium_hasil');
                                    
                                    if(@$get_id_lab_kimia_klinik){
                                      $this->db->where_in('id_re_laboratorium',$get_id_lab_kimia_klinik);
                                    }else{
                                      //ini harus diperbaiki klo get data dari pemeriksaan lab paket

                                       $this->db->where('id_re_laboratorium',$id_re_laboratorium);
                                      $this->db->where_in('tindakan_lab',$aa_paket);

                                      //get yang grup keterangan

                                    }
                                    

                                  }else{
                                    $this->db->order_by('id_re_laboratorium_hasil');
                                    $this->db->where('id_re_laboratorium',$id_re_laboratorium);
                                    $this->db->where('tindakan_lab',$tindakan_lab);
                                  }
                                 
                                  $q = $this->Content_m->select_db('bbmc_tr_laboratorium_hasil');
                                  //echo $this->db->last_query();
                                  //var_dump($get_id_lab_kimia_klinik);
                                  foreach ($q->result() as $key ) { ?>
                                    <?php 
                                    if( ( $key->text1 == 'PARAMETER' || $key->text1 == 'Parameter' ) && $i != 0){}
                                    else if($key->text1 == 'JENIS PEMERIKSAAN' && $i != 0){}else{ ?>
                                    
                                    <tr style="<?=$i==0?'background: grey; color:#fff;':''?> <?=($key->text1=='Makroskopis' || $key->text1 == 'Mikroskopis')?'background: grey; color:#fff;':''?>">
                                      <?php if($key->text1 != ''){ ?>
                                      <td><?=$key->text1?></td>
                                      <?php }?>
                                      <?php if($key->text2 != ''){ ?>
                                      <td><?=$key->text2?></td>
                                      <?php }?>
                                      <?php if($key->text3 != ''){ ?>
                                      <td><?=$key->text3?></td>
                                      <?php }?>
                                      <?php if($key->text4 != ''){ ?>
                                      <td><?=$key->text4?></td>
                                      <?php }?>
                                      <?php if($key->text5 != ''){ ?>
                                      <td><?=$key->text5?></td>
                                      <?php }?>
                                    </tr>

                                    <?php }?>
                                  <?php $i++;}?>
                                
                              </tbody>
                              
                            </table>            
                        </div>
                      </div> 
                    </div>
                  </div>
                  <br>
                  

                  <div style="">

                  <table style="width: 100%">
                    <tr style=" border: 0px solid black">
                      <td style="width: 30%; border: 0px solid black"></td>
                      <td style="width: 30%; border: 0px solid black"></td>
                      <td style="width: 30%; border: 0px solid black; text-align: center;">

                        Analis 
                        <br><br><br><br>
                        <?=$this->session->userdata('name')?>

                      </td>
                    </tr>
                  </table>


                  </div>

                <div class="form-actions right">

                  <!--
                  <a type="button" class="btn default" href="<?= site_url('front_office/ugd_dir/ugd/tmbh_pemeriksaan/'.$id_re_pasien.'/'.$id_re_kunjungan.'/laboratorium') ?>">Kembali</a>
                  -->

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

<script type="text/javascript">
  $(document).ready(function() {
     /*-------------Datepicker-------------*/
     $('#datepicker_keluar_ugd').datepicker({
      format: "yyyy-mm-dd",
      clearBtn: true,
      language: 'id',
      autoclose: true,
      todayHighlight: true
    });


    $(".sel2").select2({
      placeholder: "Pilih ..",
      language: "id"
    });


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

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

