119 lines
5.9 KiB
PHP
119 lines
5.9 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 href="https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/style.css" type="text/css" />
|
|
<style>
|
|
.patient-layout { display: flex; gap: 1.5rem; margin-top: 1rem; align-items: flex-start; }
|
|
.visit-history { width: 300px; flex-shrink: 0; background: #fff; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; }
|
|
.visit-list { height: 600px; overflow-y: auto; padding: 0; margin: 0; list-style: none; }
|
|
.visit-list li a { display: block; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); color: var(--text-main); text-decoration: none; font-size: 0.9rem; }
|
|
.visit-list li a:hover { background: rgba(37,99,235,0.05); }
|
|
.visit-list li a.active { background: rgba(37,99,235,0.1); font-weight: 600; border-left: 3px solid var(--primary); }
|
|
.patient-details { flex-grow: 1; min-width: 0; }
|
|
|
|
.info-card { background: #fff; border-radius: 8px; border: 1px solid var(--border); padding: 1.5rem; margin-bottom: 1.5rem; }
|
|
.info-card h4.widgettitle { font-size: 1.1rem; color: var(--primary); margin-top:0; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
|
|
|
|
.data-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: 0.9rem; }
|
|
.data-table th, .data-table td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; vertical-align: top; }
|
|
.data-table th { background: rgba(0,0,0,0.02); text-align: center; font-weight: 600; }
|
|
|
|
.table-invoice th { text-align: right; background: rgba(0,0,0,0.02); width: 30%; }
|
|
|
|
.badge { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
|
|
.badge-info { background: #e0f2fe; color: #0284c7; }
|
|
.badge-warning { background: #fef08a; color: #a16207; }
|
|
|
|
/* Layout for top section */
|
|
.top-info { display: flex; gap: 1.5rem; }
|
|
.top-info-left { width: 120px; flex-shrink: 0; }
|
|
.top-info-left img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); }
|
|
.top-info-right { flex-grow: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="app-container">
|
|
<?php require_once("includes/sidebar.php"); ?>
|
|
<main class="main-content">
|
|
<?php require_once("includes/header.php"); ?>
|
|
|
|
<div class="content-wrapper animate-fade-in">
|
|
<div class="patient-layout">
|
|
<!-- Left Panel: Visit History -->
|
|
<div class="visit-history">
|
|
<div style="padding: 1rem; background: rgba(0,0,0,0.02); border-bottom: 1px solid var(--border); font-weight: 600;">
|
|
ประวัติรับบริการ
|
|
</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 thai_date2($row3['vstdate']) . " ";
|
|
if ($row3['an'] != NULL) { echo '<span class="badge badge-warning">Admit</span> '; }
|
|
if ($row3['vn'] == $nn || $row3['an'] == $nn) { if ($nn != '') { echo '<span class="badge badge-info">View</span>'; } }
|
|
echo "</a></li>";
|
|
}
|
|
$stmt3->close();
|
|
}
|
|
}
|
|
?>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- Right Panel: Patient Details -->
|
|
<div class="patient-details">
|
|
<?php
|
|
if($hn) {
|
|
require_once("right_panel_patient.php");
|
|
} else {
|
|
echo "<div class='info-card' style='text-align:center; padding: 3rem; color: var(--text-muted);'>กรุณาเลือกประวัติการมารับบริการด้านซ้ายมือ หรือกลับไปค้นหาผู้ป่วยใหม่</div>";
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</body>
|
|
</html>
|