<?php
include ("header.php");
            if (!empty($_GET))
            {
                $id = $_GET['id'];
                $sql="SELECT * FROM `pacientes` WHERE pac_id = $id";
                $result = $mysqli->query($sql); 
                $row = $result->fetch_assoc();
                $nombre=$row['pac_nombre'];
               
            }
          
$sql="SELECT * FROM `expediente`,pacientes,tiponota WHERE `exp_pac_id`=pac_id and tip_id=exp_tip_id and exp_pac_id = $id order by `exp_id` desc";
$resultado = mysqli_query($mysqli, $sql);
?>

        <div class="content-wrapper">
            <!-- START PAGE CONTENT-->
            <div class="page-heading">
                <h1 class="page-title">Expediente Clinico</h1>
                <ol class="breadcrumb">
                    <li class="breadcrumb-item">
                    </li>
                    <li class="breadcrumb-item"></li>
                </ol>
            </div>
            <div class="page-content fade-in-up">
                <div class="ibox">
                    <div class="ibox-head">
                        <div class="ibox-title"><?echo $nombre;?></div>
                    </div>
                    <div class="ibox-body">
                        <table class="table table-striped table-bordered table-hover" id="dataTablePacientes" cellspacing="0" width="100%">
                            <thead>
                                <tr>
                                        <th> NOMBRE </th>
                                       <th> TIPO DE NOTA</th>
                                        <th> TELEFONO </th>
                                        <th> CELULAR </th>
                                        <th> FECHA</th>
                                        <th> HORA</th>
                                        <th></th>
                                    </tr>
                            </thead>
                                <tbody>          
                                    <?php while($row = mysqli_fetch_array($resultado)) {

                                        
                                        ?>
                                    <tr>
                                        <td><?php echo $row['pac_nombre']; ?></td>
                                        <td><?php echo 'Valoración '.$row['tip_nombre']; ?></td>
                                        <td><?php echo $row['pac_telefono']; ?></td>
                                        <td><?php echo $row['pac_celular']; ?></td>
                                        <td> <?php echo $row['exp_fecha']; ?></td>
                                        <td> <?php echo $row['exp_hora']; ?></td>	
                                        <td>
                                            <div class="d-grid gap-2 col-6 mx-auto">
                                                <a href="notaexpediente.php?id=<?php echo $row['exp_id'].'&tip_id='.$row['tip_id']; ?>" class="btn btn-success" tabindex="-1" role="button" aria-disabled="true">REVISAR NOTA</a>
                                            </div>
                                        </td>
                                    </tr>
                                    <?php } ?>
                                </tbody>
                        </table>
                        <a href="expediente.php" class="btn btn-primary"  role="button" data-bs-toggle="button">Regresar</a>
                </div>

                
                
 <?php               
$sql="SELECT * FROM `nadaptacion`,pacientes,tiponota WHERE `nad_pac_id`=pac_id and tip_id=nad_tip_id and nad_pac_id = $id order by `nad_id` desc";
$resultado = mysqli_query($mysqli, $sql);
?>


            <div class="page-content fade-in-up">
                <div class="ibox">
                    <div class="ibox-head">
                        <div class="ibox-title"><?echo 'ADAPTACIÓN DE AUXILIAR AUDITIVO';?></div>
                    </div>
                    <div class="ibox-body">
                        <table class="table table-striped table-bordered table-hover" id="dataTablePacientes" cellspacing="0" width="100%">
                            <thead>
                                <tr>
                                        <th> NOMBRE </th>
                                       <th> TIPO DE NOTA</th>
                                        <th> TELEFONO </th>
                                        <th> CELULAR </th>
                                        <th> FECHA</th>
                                        <th> HORA</th>
                                        <th></th>
                                    </tr>
                            </thead>
                                <tbody>          
                                    <?php while($row = mysqli_fetch_array($resultado)) {

                                        
                                        ?>
                                    <tr>
                                        <td><?php echo $row['pac_nombre']; ?></td>
                                        <td><?php echo 'Valoración '.$row['tip_nombre']; ?></td>
                                        <td><?php echo $row['pac_telefono']; ?></td>
                                        <td><?php echo $row['pac_celular']; ?></td>
                                        <td> <?php echo $row['nad_fecha']; ?></td>
                                        <td> <?php echo $row['nad_hora']; ?></td>	
                                        <td>
                                            <div class="d-grid gap-2 col-6 mx-auto">
                                                <a href="notaexpedienteadaptacion.php?id=<?php echo $row['nad_id'].'&tip_id='.$row['tip_id']; ?>" class="btn btn-success" tabindex="-1" role="button" aria-disabled="true">REVISAR NOTA</a>
                                            </div>
                                        </td>
                                    </tr>
                                    <?php } ?>
                                </tbody>
                        </table>
                        <a href="expediente.php" class="btn btn-primary"  role="button" data-bs-toggle="button">Regresar</a>
                </div>
            </div>  </div>                            
<?php 
    include ('footer.php');
?>