159 lines
6.1 KiB
PHP
159 lines
6.1 KiB
PHP
<?php
|
|
session_start();
|
|
if (empty($_SESSION['sess_userid']) || $_SESSION['sess_userid'] !== session_id()) {
|
|
header("Location: index.php");
|
|
exit();
|
|
}
|
|
$login_id = $_SESSION['account'];
|
|
$account = $_SESSION['account'];
|
|
$name = $_SESSION['name'];
|
|
$position = $_SESSION['position'];
|
|
$ip = $_SESSION['ip'];
|
|
$page = "รายละเอียดข้อมูลผู้รับบริการ";
|
|
$page_link = "patient.php";
|
|
|
|
require_once("config/db.php");
|
|
mysqli_report(MYSQLI_REPORT_OFF);
|
|
mysqli_query($conn1, "SET SESSION sql_mode=''");
|
|
mysqli_query($conn2, "SET SESSION sql_mode=''");
|
|
require_once("date_format.php");
|
|
require_once("check_client.php");
|
|
|
|
$hn = isset($_GET['hn']) ? base64_decode($_GET['hn']) : '';
|
|
$nn = isset($_GET['nn']) ? base64_decode($_GET['nn']) : '';
|
|
$vdate = isset($_GET['vdate']) ? base64_decode($_GET['vdate']) : '';
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="th">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>HOSxP Web Service | <?php echo $page; ?></title>
|
|
<link rel="icon" type="image/png" sizes="16x16" href="favicon1.ico">
|
|
<link rel="stylesheet" href="css/styles.css" type="text/css" />
|
|
<style>
|
|
.app-layout {
|
|
display: flex;
|
|
min-height: 100vh;
|
|
}
|
|
.main-content {
|
|
flex: 1;
|
|
padding: 0 20px 20px 20px;
|
|
overflow-y: auto;
|
|
height: 100vh;
|
|
}
|
|
.patient-layout {
|
|
display: flex;
|
|
gap: 24px;
|
|
margin-top: 16px;
|
|
align-items: flex-start;
|
|
}
|
|
.visit-history {
|
|
width: 320px;
|
|
flex-shrink: 0;
|
|
padding: 0;
|
|
overflow: hidden;
|
|
}
|
|
.visit-list {
|
|
height: calc(100vh - 180px);
|
|
overflow-y: auto;
|
|
padding: 0;
|
|
margin: 0;
|
|
list-style: none;
|
|
}
|
|
.visit-list li a {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 12px 16px;
|
|
border-bottom: 1px solid rgba(0,0,0,0.05);
|
|
color: var(--text-dark);
|
|
text-decoration: none;
|
|
font-size: 0.95rem;
|
|
transition: background 0.2s;
|
|
}
|
|
.visit-list li a:hover {
|
|
background: rgba(2, 132, 199, 0.05);
|
|
}
|
|
.visit-list li a.active {
|
|
background: rgba(2, 132, 199, 0.1);
|
|
font-weight: 600;
|
|
border-left: 4px solid var(--primary);
|
|
}
|
|
.patient-details {
|
|
flex-grow: 1;
|
|
min-width: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="app-layout">
|
|
<?php require_once("includes/sidebar.php"); ?>
|
|
|
|
<main class="main-content">
|
|
<?php require_once("includes/header.php"); ?>
|
|
|
|
<div class="content-wrapper">
|
|
<div class="patient-layout">
|
|
<!-- Left Panel: Visit History -->
|
|
<div class="glass-panel visit-history">
|
|
<div style="padding: 16px; background: rgba(0,0,0,0.03); border-bottom: 1px solid var(--glass-border); font-weight: 600; color: var(--text-dark); display: flex; align-items: center; gap: 8px;">
|
|
<svg style="width:20px;height:20px;color:var(--primary);" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
|
ประวัติมารับบริการ
|
|
</div>
|
|
<ul class="visit-list">
|
|
<?php
|
|
if($hn) {
|
|
$sql3 = "SELECT * FROM ovst WHERE hn=? ORDER BY vstdate DESC";
|
|
$stmt3 = $conn1->prepare($sql3);
|
|
if($stmt3) {
|
|
$stmt3->bind_param("s", $hn);
|
|
$stmt3->execute();
|
|
$res3 = $stmt3->get_result();
|
|
while ($row3 = $res3->fetch_assoc()) {
|
|
$is_active = ($vdate == $row3['vstdate']) ? 'active' : '';
|
|
$nn_val = ($row3['an'] != NULL) ? $row3['an'] : $row3['vn'];
|
|
$link = "patient.php?hn=" . base64_encode($hn) . "&vdate=" . base64_encode($row3['vstdate']) . "&nn=" . base64_encode($nn_val);
|
|
|
|
echo "<li><a href='{$link}' class='{$is_active}'>";
|
|
echo "<span>" . thai_date2($row3['vstdate']) . "</span>";
|
|
echo "<div>";
|
|
if ($row3['an'] != NULL) { echo '<span class="badge badge-warning" style="margin-right:4px;">Admit</span>'; }
|
|
if ($row3['vn'] == $nn || $row3['an'] == $nn) { if ($nn != '') { echo '<span class="badge badge-info">View</span>'; } }
|
|
echo "</div>";
|
|
echo "</a></li>";
|
|
}
|
|
$stmt3->close();
|
|
}
|
|
}
|
|
?>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- Right Panel: Patient Details -->
|
|
<div class="patient-details" style="animation: slideUp 0.5s ease;">
|
|
<?php
|
|
if($hn) {
|
|
require_once("right_panel_patient.php");
|
|
} else {
|
|
echo "<div class='glass-panel flex-center' style='min-height: 400px; color: var(--text-muted); font-size: 1.1rem; flex-direction:column; gap:16px;'>
|
|
<svg style='width:64px;height:64px;color:var(--text-light);' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'></path></svg>
|
|
กรุณาเลือกประวัติการมารับบริการด้านซ้ายมือ หรือกลับไปค้นหาผู้ป่วยใหม่</div>";
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
<script src="js/app.js"></script>
|
|
<style>
|
|
@keyframes slideUp {
|
|
from { opacity: 0; transform: translateY(20px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
</style>
|
|
</body>
|
|
</html>
|