<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Pemeriksaan Fisik

        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Vclaim</a></li>
            <li class="active">Anamnesa</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">

        <!-- Default box -->
        <div class="box">
            <div class="box-header with-border">
                <div class="box-tools pull-right">
                    <button class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse"><i class="fa fa-minus"></i></button>
                    <button class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove"><i class="fa fa-times"></i></button>
                </div>
            </div>
            <div class="box-body">
            <?php 
                    $id = $this->uri->segment(4);
                    $db = $this->db->query("SELECT c.Description,e.diagnosa_primer FROM Cases c join erm_pemeriksaan_fisik e on c.[Case ID] = e.case_id 
                    where c.PatientCode = '$id' ")->row_array();
                    ?>
                        <?php if($db['diagnosa_primer'] == 'B20') { ?>
                        <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS</div>
                        <?php }elseif($db['diagnosa_primer'] == 'B20.0'){ ?>
                        <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS</div>
                        <?php }elseif($db['diagnosa_primer'] == 'B20.1'){ ?>
                            <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS</div>
                        <?php }elseif($db['diagnosa_primer'] == 'B20.2'){ ?>
                            <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS</div>
                        <?php }elseif($db['diagnosa_primer'] == 'B20.3'){ ?>
                            <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS</div>    
                            <?php }elseif($db['diagnosa_primer'] == 'B20.4'){ ?>
                            <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS</div>
                            <?php }elseif($db['diagnosa_primer'] == 'B20.5'){ ?>
                            <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS</div>
                            <?php }elseif($db['diagnosa_primer'] == 'B20.6'){ ?>
                            <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS</div>
                            <?php }elseif($db['diagnosa_primer'] == 'B20.7'){ ?>
                            <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS</div>
                            <?php }elseif($db['diagnosa_primer'] == 'B20.8'){ ?>
                             <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS</div>
                            <?php }elseif($db['diagnosa_primer'] == 'B20.9'){ ?>  
                                <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS</div>
                            <?php }elseif($db['diagnosa_primer'] == '098.7'){ ?>  
                                <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HIV AIDS 098.7</div>
                            <?php }elseif($db['diagnosa_primer'] == '098.4'){ ?>  
                                <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis HEPATITIS 098.4</div>
                            <?php }elseif($db['diagnosa_primer'] == '098.1'){ ?>  
                                <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis Syphilis complicating 098.1</div>
                            <?php }elseif($db['diagnosa_primer'] == 'B18'){ ?>  
                                <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis Chronic viral hepatitis B.18</div>
                            <?php }elseif($db['diagnosa_primer'] == 'A16'){ ?>  
                                <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Diagnosis Respiratory tuberculosis</div>
                        <?php }else{ ?>

                        <?php } ?>

                        <?php
                            $mr = $case['PatientCode'];
                            $alergi = $this->db->query("Select alergi_obat,alergiobat from CaseDetail a JOIN Cases c on a.[Case ID] = c.[Case ID] where c.PatientCode = '$mr'  Order by c.[Case ID] DESC ")->row_array();
                        ?>
                        
                        <?php
                            if ($alergi['alergi_obat'] == 'Tidak' || $alergi['alergi_obat'] == Null) {
                         ?>
                                <div class="alert alert-info alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                    <h4>Tidak Ada Alergi</h4>Pasien Ini Tidak Memiliki Alergi
                                </div>
                        <?php } else { ?>
                                <div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                    <h4><i class="icon fa fa-ban"></i> Alert !!!</h4>Pasien Ini Memiliki Alergi <?= $alergi['alergi_obat'] . ' - ' . $alergi['alergiobat']; ?>
                                </div>
                         <?php } ?>
                <div class="row">
                    <div class="col-md-3">
                        <div class="box box-solid box-success">
                            <div class="box-header with-border">
                                <span><small><i class="fa fa-user"> Peserta</i></small> </span>
                                <div class="box-tools">
                                    <button type="button" class="btn btn-box-tool" data-widget="collapse">
                                        <i class="fa fa-minus"></i>
                                    </button>
                                </div>
                            </div>
                            <div class="box-body no-padding">
                                <ul class="nav nav-pills nav-stacked">
                                    <li>
                                        <a title="Kode MR">
                                            <small><i class="fa fa-fw fa-sort-numeric-asc"></i>
                                                <?= $case['PatientCode']; ?>
                                            </small>
                                        </a>
                                    </li>
                                    <li>
                                        <a title="Nama Pasien">
                                            <small>
                                                <i class="fa fa-fw fa-user"></i>
                                                <?= $case['Description']; ?>
                                            </small>
                                        </a>
                                    </li>

                                    <li>
                                        <a title="Tanggal Lahir Pasien">
                                            <small>
                                                <i class="fa fa-fw fa-calendar-o"></i>
                                                <?php
                                                $pass = $case['PatientCode'];
                                                $pas = $this->db->query("SELECT * FROM Patient WHERE PatientCode = '$pass'")->row_array();
                                                // tanggal lahir
                                                echo date('d F Y', strtotime($pas['DOB']));
                                                ?>
                                            </small>
                                        </a>
                                    </li>
                                    <li>
                                        <a title="Usia Pasien">
                                            <small>
                                                <i class="fa fa-fw fa-calendar-o"></i>
                                                <?php
                                                // tanggal lahir
                                                $dob = date('Y-m-d', strtotime($pas['DOB']));
                                                $tanggal = new DateTime($dob);

                                                // tanggal hari ini
                                                $today = new DateTime('today');

                                                // tahun
                                                $y = $today->diff($tanggal)->y;

                                                // bulan
                                                $m = $today->diff($tanggal)->m;

                                                // hari
                                                $d = $today->diff($tanggal)->d;
                                                echo  $y . " tahun " . $m . " bulan " . $d . " hari";
                                                ?>
                                            </small>
                                        </a>
                                    </li>

                                    <li>
                                        <a title="Tanggal Periksa">
                                            <small>
                                                <i class="fa fa-fw fa-calendar"></i>
                                                <?= $case['Intake Date']; ?>
                                            </small>
                                        </a>
                                    </li>
                                    <?php
                                    if ($case['NoSEP'] == '') {
                                    } else {
                                    ?>
                                        <li>
                                            <a title="Nomor SEP">
                                                <small>
                                                    <i class="fa fa-fw fa-book"></i>
                                                    <?= $case['NoSEP']; ?>
                                                </small>
                                            </a>
                                        </li>
                                    <?php
                                    }
                                    ?>
                                    <li>
                                        <a title="Antrian Poli">
                                            <small>
                                                <i class="fa fa-fw fa-desktop"></i>
                                                <?= $case['FRNo']; ?>
                                            </small>
                                        </a>
                                    </li>
                                    <li>
                                        <a title="NomorKartu">
                                            <small>
                                                <i class="fa fa-fw fa-desktop"></i>
                                                <?= $q['NomorKartu']; ?> 
                                            </small>
                                        </a>
                                    </li>
                                    <li>
                                        <a title="Company">
                                            <small>
                                                <i class="fa fa-fw fa-desktop"></i>
                                                <?php
                                                $cm = $case['CompanyCode'];
                                                $cc = $this->db->query("SELECT * FROM Company WHERE CompanyCode = '$cm'")->row_array();
                                                ?>
                                                <?= $cc['CompanyCode'] . ' - ' . $cc['CompanyName']; ?>
                                            </small>
                                        </a>
                                    </li>

                                </ul>
                            </div>
                            <!-- /.box-body -->
                        </div>
                    

                    </div>
                    <div class="col-md-9">
                        <form action="<?= base_url('anamnesa/prosesAnamnesisJKN'); ?>" method="post">
                            <div class="row">
                                <div class="col-md-6">
                                <input type="hidden" name="PatientCode" value="<?= $case['PatientCode']; ?>">
                                <input type="hidden" name="nama" value="<?= $case['Description']; ?>">
                                <input type="hidden" name="nomorkartu" value="<?= $q['NomorKartu']; ?>">
                                <input type="hidden" name="CompanyCode" value="<?= $cc['CompanyCode']; ?>">
                                    <label for="">Poli Tujuan <small style="color: red;">isi*</small></label>
                                    <select name="Unit" class="form-control unit" id="" required>
                                        <option value="">- Pilih -</option>
                                        <?php
                                        foreach ($antrian as $klinik) :
                                        ?>
                                            <option value="<?= $klinik['Jenis']; ?>"><?= $klinik['Jenis']; ?></option>
                                        <?php
                                        endforeach;
                                        ?>
                                    </select>
                                </div>
                                <div class="col-md-6">
                                    <label for="">Dokter Tujuan <small style="color: red;">isi*</small></label> <br>
                                    <select name="DoctorID" class="form-control" id="dokter" required>
                                    </select>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-4" style="margin-top: 10px;">
                                    <label for="">Kesadaran E <small style="color: red;">isi*</small></label>
                                 
                                    <select name="Kesadaran_E" class="form-control" required>
                                        <option value=""></option>
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                    </select>
                                </div>
                                <div class="col-md-4" style="margin-top: 10px;">
                                    <label for="">Kesadaran M <small style="color: red;">isi*</small></label>
                                    <!-- <input type="text" autocomplete="off" class="form-control" name="Kesadaran_M"> -->
                                    <select name="Kesadaran_M" class="form-control" required>
                                        <option value=""></option>
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                        <option value="5">5</option>
                                        <option value="6">6</option>
                                    </select>
                                </div>
                                <div class="col-md-4" style="margin-top: 10px;">
                                    <label for="">Kesadaran V <small style="color: red;">isi*</small></label>
                                    <!-- <input type="text" autocomplete="off" class="form-control" name="Kesadaran_V"> -->
                                    <select name="Kesadaran_V" class="form-control" required>
                                        <option value=""></option>
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                        <option value="5">5</option>
                                        <!-- <option value="6">6</option> -->
                                    </select>
                                </div>
                            </div>
                            <div class="row">
                                <?php
                                if ($y > 10) {
                                ?>
                                    <div class="col-md-4" style="margin-top: 10px;">
                                        <label for="">Tekanan Darah <small>*mmHg</small> <small style="color: red;">isi*</small></label>
                                        <input type="text" autocomplete="off" class="form-control" name="Tensi" required>
                                    </div>
                                    <div class="col-md-4" style="margin-top: 10px;">
                                        <label for="">Tekanan Darah Per /<small style="color: red;">isi*</small></label>
                                        <input type="text" autocomplete="off" class="form-control" name="TensiPer" required>
                                    </div>
                                <?php
                                } else {
                                ?>
                                    <div class="col-md-4" style="margin-top: 10px;">
                                        <label for="">Tekanan Darah <small>*mmHg</small></label>
                                        <input type="text" autocomplete="off" class="form-control" name="Tensi">
                                    </div>
                                    <div class="col-md-4" style="margin-top: 10px;">
                                        <label for="">Tekanan Darah Per /<small style="color: red;">isi*</small></label>
                                        <input type="text" autocomplete="off" class="form-control" name="TensiPer" required>
                                    </div>
                                <?php
                                }
                                ?>

                                <div class="col-md-4" style="margin-top: 10px;">
                                    <label for="">Frekuensi Nadi <small>*x/mnt</small> <small style="color: red;">isi*</small></label>
                                    <input type="text" autocomplete="off" class="form-control" name="FrekuensiNadi" required>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-6" style="margin-top: 10px;">
                                    <label for="">Frekuensi Nafas <small>*x/mnt</small> <small style="color: red;">isi*</small></label>
                                    <input type="text" autocomplete="off" class="form-control" name="FrekuensiNafas" required>
                                </div>
                                <div class="col-md-6" style="margin-top: 10px;">
                                    <label for="">Suhu <small>*<sup>o</sup>C</small> <small style="color: red;">isi*</small></label>
                                    <input type="text" autocomplete="off" class="form-control" name="Suhu" required>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-6" style="margin-top: 10px;">
                                    <label for="">Tinggi Badan <small>*m</small></label>
                                    <input type="text" placeholder="exp: 1.65" maxlength="5" autocomplete="off" class="form-control" name="TB" id="txt1" onkeyup="sum();" onkeydown="return disableKoma(event)">
                                </div>
                                <div class="col-md-6" style="margin-top: 10px;">
                                    <label for="">Berat Badan <small>*kg.</small></label>
                                    <input type="text" maxlength="3" autocomplete="off" class="form-control" name="BB" id="txt2" onkeyup="sum();" onkeydown="return disableKoma(event)">
                                </div>
                            </div>

                            <div class="row">
                            <div class="col-md-6" style="margin-top: 10px;">
                                    <label for="">IMT</label>
                                    <input type="text" name="IMT" readonly id="txt3" class="form-control">
                            </div>
                                <div class="col-md-6" style="margin-top: 10px;">

                                    <?php
                                    if ($y >= 3) {
                                    ?>
                                        <label style="display: none;" for="">Lingkar Kepala Bayi <small>*cm</small></label>
                                        <input type="text" style="display: none;" maxlength="3" name="LingkarKepala" class="form-control">
                                    <?php
                                    } else {
                                    ?>
                                        <label for="">Lingkar Kepala Bayi <small>*cm</small></label>
                                        <input type="text" maxlength="3" name="LingkarKepala" class="form-control">
                                    <?php
                                    }
                                    ?>
                                </div>
                            </div>
                            <div class="row">
                            <div class="col-md-12" style="display: block;">
                                <label for="">Status Gizi</small></label>
                                <select name="statusgizi" id="displaygizi" class="form-control" id="">
                                    <option value="">Pilih Status Gizi</option>
                                    <option value="-" selected>-</option>
                                    <option value="Balita">Balita</option>
                                    <option value="Ibu Hamil">Ibu Hamil</option>
                                </select>
                            </div>
                            </div>
                            <hr>
                            <div class="row">
                                <div class="col-md-12" style="display: none;" id="PanelGizi">
                                    <label for="">Panjang Badan Balita</label>
                                    <textarea name="panjangbalita" class="form-control"></textarea>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12" style="display: none;" id="Panelibuhamil">
                                    <label for="">Lila</label>
                                    <textarea name="lila" class="form-control"></textarea>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12" style="display: block;">
                                    <label for="">Keluhan <small style="color: red;">isi*</small></label>
                                    <textarea name="Keluhan" class="form-control" required></textarea>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12" style="display: block;">
                                    <label for="">Pisikososial <small style="color: red;">isi*</small></label>
                                    <textarea name="Pisikososial" class="form-control" required></textarea>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12" style="display: block;">
                                    <label for="">Spiritual <small style="color: red;">isi*</small></label>
                                    <textarea name="Spiritual" class="form-control" required></textarea>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12" style="display: block;">
                                    <label for="">Penilaian Tingkat Nyeri <small style="color: red;">isi*</small></label>
                                    <select class="form-control" name="tingkat_nyeri" required>
                                        <option value=""></option>
                                        <?php
                                        foreach ($tingkatnyeri as $nyeri) :
                                        ?>
                                            <option value="<?= $nyeri['nilai']; ?> - <?= $nyeri['deskripsi']; ?>"><?= $nyeri['nilai']; ?> - <?= $nyeri['deskripsi']; ?></option>
                                        <?php
                                        endforeach;
                                        ?>
                                    </select>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12" style="display: block;">
                                    <label for="">Riwayat Penyakit Pasien<small style="color: red;"> isi*</small></label>
                                    <select name="riwayatpenyakit" class="form-control Riwayatpasien" required>
                                        <?php
                                        foreach ($riwayatPenyakit as $sRiwayatPenyakit) :
                                        ?>
                                            <option value="<?= $sRiwayatPenyakit['RiwayatPenyakit']; ?>">
                                                <?= $sRiwayatPenyakit['RiwayatPenyakit']; ?></option>
                                        <?php
                                        endforeach;
                                        ?>
                                    </select>
                                    <input type="text" style="display: none; margin-top:10px" id="Riwayatlainya" name="Riwayatlainya" class="form-control" placeholder="Riwayat lainnya ...">
                                </div>
                            </div>
                            <hr>
                            <div class="row" style="margin-top: 10px;">

                                <div class="col-md-3">
                                    <b>Pernah Dirawat Sebelumnya</b>
                                </div>
                                <div class="col-md-9">
                                    <input type="radio" name="pernahDirawat" value="YA" class="pernahDirawat" id="pernahDirawat1"> <label style="font-weight: normal;cursor: pointer;" for="pernahDirawat1">YA</label> &nbsp; &nbsp;
                                    <input type="radio" name="pernahDirawat" value="TIDAK" checked class="pernahDirawat" id="pernahDirawat2">
                                    <label style="font-weight: normal;cursor: pointer;" for="pernahDirawat2">TIDAK</label>

                                    <input type="text" style="display: none; margin-top:10px" id="KapanDirawat" name="KapanDirawat" class="form-control" placeholder="Kapan dirawat ...">

                                    <input type="text" style="display: none; margin-top:10px" id="DimanaDirawat" name="DimanaDirawat" class="form-control" placeholder="Dimana dirawat ...">
                                </div>
                            </div>

                            <div class="row" style="margin-top: 10px;">

                                <div class="col-md-3">
                                    <b>Apakah dengan sakit yang sama</b>
                                </div>
                                <div class="col-md-9">
                                    <input type="radio" name="SakitYangSama" value="YA" id="SakitYangSama1">
                                    <label style="font-weight: normal;cursor: pointer;" for="SakitYangSama1">YA</label> &nbsp; &nbsp;
                                    <input type="radio" name="SakitYangSama" value="TIDAK" class="SakitYangSama" id="SakitYangSama2" checked>
                                    <label style="font-weight: normal;cursor: pointer;" for="SakitYangSama2">TIDAK</label>
                                </div>
                            </div>

                            <div class="row" style="margin-top: 10px;">

                                <div class="col-md-3">
                                    <b>Riwayat Operasi</b>
                                </div>
                                <div class="col-md-9">

                                    <input type="radio" name="Operasi" value="YA" class="RiwayatOperasi" id="RiwayatOperasi1"> <label style="font-weight: normal;cursor: pointer;" for="RiwayatOperasi1">YA</label> &nbsp; &nbsp;
                                    <input type="radio" name="Operasi" value="TIDAK" checked class="RiwayatOperasi" id="RiwayatOperasi2">
                                    <label style="font-weight: normal;cursor: pointer;" for="RiwayatOperasi2">TIDAK</label>

                                    <textarea style="display: none; margin-top:10px" id="CeritaOperasi" name="RiwayatOperasi" class="form-control" placeholder="Riwayat operasi ..."></textarea>
                                </div>
                            </div>

                            <div class="row" style="margin-top: 10px;">

                                <div class="col-md-3">
                                    <b>Riwayat Penyakit Keluarga</b>
                                </div>
                                <div class="col-md-9">
                                    <select name="PenyakitKeluarga" class="form-control riwayatKeluarga" required>
                                        <?php
                                        foreach ($riwayatPenyakit as $sRiwayatPenyakit) :
                                        ?>
                                            <option value="<?= $sRiwayatPenyakit['RiwayatPenyakit']; ?>">
                                                <?= $sRiwayatPenyakit['RiwayatPenyakit']; ?></option>
                                        <?php
                                        endforeach;
                                        ?>
                                    </select>

                                    <input type="text" style="display: none; margin-top:10px" id="RiwayatPenyakitKeluarga" name="RiwayatPenyakitKeluarga" class="form-control" placeholder="Riwayat lainnya ...">
                                </div>
                            </div>

                            <div class="row" style="margin-top: 10px;">
                                <div class="col-md-3">
                                    <b>Riwayat Obat yang diminum / Obat Rutin</b>
                                </div>
                                <div class="col-md-9">
                                    <textarea class="form-control" name="RiwayatObatDiminum" rows="3" cols="80">TIDAK ADA</textarea>
                                </div>
                            </div>

                            <!-- <hr> -->

                            <div class="row" style="margin-top: 10px;">
                                <div class="col-md-3">
                                    <b>Alergi Obat</b>
                                </div>
                                <div class="col-md-9">
                                <select name="alergi_obat" id="Alergi" class="form-control">
                                    <option value="">Pilih Alergi Obat</option>
                                    <option value="-" selected>-</option>
                                    <?php foreach($alergiObat as $alergiObat){ ?>
                                    <option value="<?php echo $alergiObat['kdAlergi'] . '-'.  $alergiObat['nmAlergi']  ?>"><?php echo $alergiObat['nmAlergi']; ?></option>
                                    <?php } ?>
                                </select>
                                </div>
                            </div>

                            <input hidden type="text" name="usia_kunjungan" value="<?= $y; ?>">

                            <div class="row">
                                <div class="col-md-3"></div>
                                <div class="col-md-9">
                                    <button type="submit" class="btn bg-green-gradient btn-info" style="outline-style: none;border-style: none;margin-top:10px"><i class="fa fa-fw fa-save"></i> Simpan</button>
                                </div>
                            </div>

                        </form>
                    </div>

                </div>
            </div><!-- /.box-body -->
            <div class="box-footer">
                <?= date('d F Y'); ?>
            </div><!-- /.box-footer-->
        </div><!-- /.box -->

    </section><!-- /.content -->
</div><!-- /.content-wrapper -->

<script src="<?= base_url('assets/'); ?>jquery-3.3.1.min.js"></script>
<script src="<?= base_url('assets/'); ?>jquery-migrate-1.4.1.min.js"></script>
<script>
    $(document).ready(function() {
        $('#tindakLanjut').change(function() {
            if ($(this).val() == "Kontrol") {
                $("#tanggalKontrol").show();
                $("#alasanrujuk").hide();
                $("#rujukke").hide();
                $("#atasdasar").hide();
                $("#meninggal").hide();
            } else if ($(this).val() == "Dirujuk") {
                $("#tanggalKontrol").hide();
                $("#alasanrujuk").show();
                $("#rujukke").show();
                $("#atasdasar").show();
                $("#meninggal").hide();
            } else if ($(this).val() == "Meninggal") {
                $("#tanggalKontrol").hide();
                $("#alasanrujuk").hide();
                $("#rujukke").hide();
                $("#atasdasar").hide();
                $("#meninggal").show();
            } else {
                $("#tanggalKontrol").hide();
                $("#alasanrujuk").hide();
                $("#rujukke").hide();
                $("#atasdasar").hide();
                $("#meninggal").hide();
            }
        });

        $('.riwayat').change(function() {
            if ($(this).val() == "Lainnya") {
                $("#RiwayatDahuluLainnya").show();
            } else {
                $("#RiwayatDahuluLainnya").hide();
            }
        });

        $('.pernahDirawat').change(function() {
            if ($(this).val() == "YA") {
                $("#KapanDirawat").show();
                $("#DimanaDirawat").show();
            } else {
                $("#KapanDirawat").hide();
                $("#DimanaDirawat").hide();
            }
        });

        $('.riwayatKeluarga').change(function() {
            if ($(this).val() == "LAINNYA") {
                $("#RiwayatPenyakitKeluarga").show();
            } else {
                $("#RiwayatPenyakitKeluarga").hide();
            }
        });

        $('.Riwayatpasien').change(function() {
            if ($(this).val() == "LAINNYA") {
                $("#Riwayatlainya").show();
            } else {
                $("#Riwayatlainya").hide();
            }
        });

        $('.RiwayatOperasi').change(function() {
            if ($(this).val() == "YA") {
                $("#CeritaOperasi").show();
            } else {
                $("#CeritaOperasi").hide();
            }
        });

        $('#displaygizi').change(function() {
            if ($(this).val() == "Balita") {
                $("#PanelGizi").show();
                $("#Panelibuhamil").hide();
            }  else if ($(this).val() == "Ibu Hamil") {
                $("#Panelibuhamil").show();
                $("#PanelGizi").hide();
            } else {
                $("#PanelGizi").hide();
                $("#Panelibuhamil").hide();
            }
        });
    });
</script>

<script>
    function disableKoma(e) {
        if (e.keyCode == 188) {
            return false;
        }
        return true;
    }

    function sum() {
        var txtFirstNumberValue = document.getElementById('txt1').value;
        var txtSecondNumberValue = document.getElementById('txt2').value;
        // var hasilBagi = txtFirstNumberValue / 100;
        var tinggibadan = txtFirstNumberValue ** 2;
        // var result = parseFloat(txtSecondNumberValue) / parseFloat(hasilBagi);
        var result = parseFloat(txtSecondNumberValue) / parseFloat(tinggibadan);
        if (!isNaN(result)) {
            document.getElementById('txt3').value = result.toFixed(2);
            // document.getElementById('txt3').value = Math.ceil(result);
        }

    }
</script>

<script>
    $('.unit').change(function() {
        var _layanan = $(this).val();
        $.ajax({
            url: "<?= base_url('rekamMedis/getDokter'); ?>",
            method: "POST",
            data: {
                layanan: _layanan
            },
            async: true,
            dataType: 'json',
            success: function(data) {
                var html = '';
                var i;

                for (i = 0; i < data.length; i++) {
                    html += '<option value=' + data[i].DoctInCharge + '>' + data[i].FirstName + '-'
                    data[i].LastName + '</option>';
                }
                $('#dokter').html(html);
            }
        });
        return false;
    });
</script>