Initial commit

This commit is contained in:
Porawit Dongwang
2026-09-16 23:20:08 +07:00
commit 0041668dbb
32577 changed files with 3687927 additions and 0 deletions
@@ -0,0 +1,303 @@
<?php
require_once 'includes/db.php';
require_once 'includes/auth.php';
requireLogin();
// Fetch users for the handover dropdown
$stmt = $pdo->prepare("SELECT id, username, full_name as name, role FROM users WHERE is_active = 1 ORDER BY full_name ASC");
$stmt->execute();
$dispatchers = $stmt->fetchAll(PDO::FETCH_ASSOC);
require_once 'includes/header.php';
?>
<div class="space-y-6 animate-fadeIn pb-10">
<!-- Top Date/Shift Selector -->
<div class="bg-white rounded-2xl p-4 md:p-5 shadow-sm border border-slate-100 flex flex-wrap gap-4 items-center">
<div class="flex items-center gap-2">
<span class="text-xs font-bold text-slate-500">วันที่คัดรายงาน:</span>
<input type="date" value="2026-07-23" class="py-1.5 px-3 border border-slate-200 rounded-xl text-xs font-bold text-slate-700 outline-none">
</div>
<div class="flex items-center gap-2">
<span class="text-xs font-bold text-slate-500">เลือกเวรรอบ:</span>
<select class="py-1.5 px-3 border border-slate-200 rounded-xl text-xs font-bold text-slate-700 bg-white outline-none cursor-pointer">
<option value="เช้า">☀️ เวรเช้า (08:00 - 16:00 น.)</option>
<option value="บ่าย">⛅ เวรบ่าย (16:00 - 00:00 น.)</option>
<option value="ดึก">🌙 เวรดึก (00:00 - 08:00 น.)</option>
</select>
</div>
</div>
<!-- Summary Textareas Container -->
<div class="bg-white rounded-2xl p-5 md:p-6 shadow-sm border border-slate-100 space-y-4">
<div class="border-b border-slate-100 pb-2">
<h3 class="text-base font-black text-slate-800">ระบุบทบันทึกสรุปและเรื่องค้างส่งมอบ</h3>
<p class="text-xs text-slate-500 mt-1">ป้อนข้อมูลข้อขัดข้องหรือความเสี่ยงที่พบในรอบเวร เพื่อนำไปลงบันทึกในเอกสารรายงานประจำวันอัตโนมัติ</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<label class="block text-xs font-bold text-slate-500 mb-1">สรุปเหตุการณ์สำคัญประจำเวร (Narrative)</label>
<textarea rows="3" placeholder="เช่น การประสานรับเคสอุบัติเหตุหมู่ สัญญาณสายแทงเข้าปกติ ไม่มีข้อติดขัดเรื่องรถ ALS..." class="w-full px-3 py-2 border border-slate-200 rounded-xl text-xs font-medium outline-none focus:ring-1 focus:ring-indigo-500"></textarea>
</div>
<div>
<label class="block text-xs font-bold text-slate-500 mb-1">ความเสี่ยงหรือปัญหาที่สืบค้นพบ</label>
<textarea rows="3" placeholder="เช่น พบปัญหาคลื่นสัญญาณวิทยุจุดบ่อผุดรับส่งเบาบาง, ฝนตกจุดเกาะพะงันคลื่นแรงสปีดโบ๊ทยกยาก..." class="w-full px-3 py-2 border border-slate-200 rounded-xl text-xs font-medium outline-none focus:ring-1 focus:ring-indigo-500"></textarea>
</div>
<div>
<label class="block text-xs font-bold text-slate-500 mb-1">เคสสำคัญที่ต้องสืบสวนและติดตามต่อ</label>
<textarea rows="3" placeholder="เช่น เคสประสานเฮลิคอปเตอร์กู้ชีพเกาะเต่า OB-2569-0012 รอสรุปผลประเมินอาการส่งต่อ ER สุราษฎร์ธานี..." class="w-full px-3 py-2 border border-slate-200 rounded-xl text-xs font-medium outline-none focus:ring-1 focus:ring-indigo-500"></textarea>
</div>
</div>
</div>
<!-- Handover & Security Panel -->
<div class="bg-gradient-to-br from-slate-900 via-slate-800 to-slate-950 text-white rounded-2xl p-5 md:p-6 shadow-xl border border-slate-700/60 flex flex-col lg:flex-row gap-6 justify-between items-start">
<div class="flex-1 space-y-2">
<div class="flex items-center gap-2 text-blue-400">
<i data-lucide="lock" class="w-5 h-5"></i>
<h3 class="font-black text-sm uppercase tracking-wider">ระบบรับ-ส่งเวรและรักษาความปลอดภัย</h3>
</div>
<p class="text-xs text-slate-300 leading-relaxed font-semibold">เจ้าหน้าที่เปลี่ยนเวร (ผู้รับเวร) ต้องยืนยันตนด้วยชื่อและรหัสผ่าน / PIN 4 หลักของตนเอง เพื่อลงลายเซ็นดิจิตอลรับมอบภาระงาน ยอดสรุปสถิติ เคสปฏิบัติการที่ค้าง และความพร้อมของขบวนรถพยาบาล</p>
<div class="grid grid-cols-2 gap-4 pt-2">
<div class="bg-slate-800/40 border border-slate-700/40 p-3 rounded-xl">
<span class="text-[10px] text-slate-400 block font-bold uppercase">ผู้ส่งมอบเวร</span>
<span class="text-xs font-bold text-slate-100">นพ.เกียรติภูมิ ภูมิใจไทย (ผู้อำนวยการศูนย์)</span>
</div>
<div class="bg-slate-800/40 border border-slate-700/40 p-3 rounded-xl">
<span class="text-[10px] text-slate-400 block font-bold uppercase">ผู้เซ็นรับมอบเวร</span>
<span class="text-xs font-bold text-amber-400 animate-pulse">⏳ รอรับมอบเวร</span>
</div>
</div>
</div>
<form class="w-full lg:w-80 bg-slate-800 p-4 rounded-xl border border-slate-700 space-y-3.5">
<h4 class="text-xs font-bold text-slate-200 uppercase tracking-widest border-b border-slate-700 pb-1">ลงชื่อรับเวรดิจิตอล</h4>
<div>
<label class="block text-[10px] text-slate-300 font-bold mb-1">เลือกเจ้าหน้าที่รับเวร</label>
<select class="w-full py-1.5 px-2 bg-slate-900 border border-slate-700 rounded-lg text-xs font-semibold text-slate-200 outline-none">
<option value="">-- เลือก Dispatcher รับเวร --</option>
<?php foreach ($dispatchers as $dispatcher): ?>
<?php if ($dispatcher['id'] !== $_SESSION['user_id']): ?>
<option value="<?php echo htmlspecialchars($dispatcher['id']); ?>">
<?php echo htmlspecialchars($dispatcher['name']); ?>
</option>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
<div>
<label class="block text-[10px] text-slate-300 font-bold mb-1">ป้อน PIN 4 หลัก ยืนยันรหัส</label>
<input type="password" maxLength="4" placeholder="••••" class="w-full py-1.5 px-2 bg-slate-900 border border-slate-700 rounded-lg text-xs font-mono text-center tracking-widest text-slate-200 outline-none">
</div>
<button type="button" class="w-full py-2 bg-blue-600 hover:bg-blue-700 text-xs font-bold text-white rounded-lg transition-all active:scale-95 cursor-pointer flex items-center justify-center gap-1.5">
<i data-lucide="lock" class="w-3.5 h-3.5"></i> ยืนยันการเซ็นรับมอบเวร
</button>
</form>
</div>
<!-- Export Actions -->
<div class="flex flex-wrap gap-2 justify-end print:hidden">
<button class="flex items-center gap-1.5 bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold text-xs px-4 py-2 rounded-xl transition-all border border-slate-200 cursor-pointer">
<i data-lucide="copy" class="w-4 h-4"></i> คัดลอกสรุปเป็นข้อความเวร
</button>
<button class="flex items-center gap-1.5 bg-blue-600 hover:bg-blue-700 text-white font-bold text-xs px-4 py-2 rounded-xl transition-all shadow-md shadow-blue-200 cursor-pointer">
<i data-lucide="printer" class="w-4 h-4"></i> พิมพ์หรือเซฟรายงาน PDF
</button>
</div>
<!-- A4 Document Preview Area -->
<div class="bg-white rounded-3xl p-6 md:p-10 shadow-lg border border-slate-100 max-w-4xl mx-auto space-y-8 print:border-none print:shadow-none print:p-0" id="print-area">
<!-- Document Header -->
<div class="border-b-4 border-blue-900 pb-5 flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
<div class="flex items-center gap-3">
<div class="p-3 bg-blue-900 rounded-2xl text-white flex items-center justify-center">
<i data-lucide="shield" class="w-8 h-8"></i>
</div>
<div>
<h2 class="text-xl md:text-2xl font-black text-slate-900 tracking-tight">รายงานสรุปผลการปฏิบัติการประจำเวร</h2>
<p class="text-xs font-bold text-slate-500 uppercase tracking-widest mt-0.5">ศูนย์รับแจ้งเหตุและสั่งการนเรนทรอ่าวไทย (เบอร์โทรฉุกเฉิน 1669)</p>
</div>
</div>
<div class="text-right sm:text-right self-stretch sm:self-auto bg-slate-50 border border-slate-100 p-3 rounded-xl font-mono text-xs">
<div class="font-bold text-slate-800">เวรปฏิบัติงาน: <span class="text-blue-700 font-sans font-black">เช้า</span></div>
<div class="mt-1">วันที่รายงาน: 2026-07-23</div>
<div class="text-[10px] text-slate-400 font-sans mt-1">Generated: 23 กรกฎาคม 2569 เวลา 13:35</div>
</div>
</div>
<!-- Section 1: Call Stats -->
<div class="space-y-3">
<h3 class="text-sm font-black text-blue-900 uppercase tracking-widest border-b border-slate-100 pb-1 flex items-center gap-2">
<i data-lucide="phone" class="w-4 h-4"></i> 1. สรุปข้อมูลสายเรียกเข้าประจำเวร
</h3>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div class="bg-slate-50 p-3 rounded-xl border border-slate-100 text-center">
<div class="text-xs text-slate-400 font-bold">สายเรียกเข้าทั้งหมด</div>
<div class="text-xl font-black text-slate-800 mt-1">0 สาย</div>
</div>
<div class="bg-blue-50/50 p-3 rounded-xl border border-blue-100 text-center">
<div class="text-xs text-blue-800 font-bold">สายปฏิบัติการ</div>
<div class="text-xl font-black text-blue-900 mt-1">0 สาย</div>
</div>
<div class="bg-amber-50/40 p-3 rounded-xl border border-amber-100/70 text-center">
<div class="text-xs text-amber-700 font-bold">สายก่อกวน</div>
<div class="text-xl font-black text-amber-800 mt-1">0 สาย</div>
</div>
<div class="bg-slate-50 p-3 rounded-xl border border-slate-100 text-center">
<div class="text-xs text-slate-400 font-bold">สายโทรผิด/สายอื่น ๆ</div>
<div class="text-xl font-black text-slate-800 mt-1">0 สาย</div>
</div>
</div>
</div>
<!-- Section 2: Case Stats -->
<div class="space-y-3">
<h3 class="text-sm font-black text-blue-900 uppercase tracking-widest border-b border-slate-100 pb-1 flex items-center gap-2">
<i data-lucide="file-text" class="w-4 h-4"></i> 2. สรุปเคสปฏิบัติการและการออกปฏิบัติการประจำเวร
</h3>
<div class="grid grid-cols-2 md:grid-cols-5 gap-4">
<div class="bg-slate-50 p-3 rounded-xl border border-slate-100 text-center">
<div class="text-[10px] text-slate-400 font-bold">เคสรวม</div>
<div class="text-lg font-bold text-slate-800 mt-1">0 เคส</div>
</div>
<div class="bg-slate-50 p-3 rounded-xl border border-slate-100 text-center">
<div class="text-[10px] text-slate-400 font-bold">เคส EMS</div>
<div class="text-lg font-bold text-slate-800 mt-1">0 เคส</div>
</div>
<div class="bg-slate-50 p-3 rounded-xl border border-slate-100 text-center">
<div class="text-[10px] text-slate-400 font-bold">เคส REFER</div>
<div class="text-lg font-bold text-slate-800 mt-1">0 เคส</div>
</div>
<div class="bg-slate-50 p-3 rounded-xl border border-slate-100 text-center">
<div class="text-[10px] text-slate-400 font-bold">ระดับ ALS (แพทย์กู้ชีพ)</div>
<div class="text-lg font-bold text-slate-800 mt-1">0 หน่วย</div>
</div>
<div class="bg-slate-50 p-3 rounded-xl border border-slate-100 text-center col-span-2 md:col-span-1">
<div class="text-[10px] text-slate-400 font-bold font-sans">ระดับ BLS/CLS (กู้ชีพมูลนิธิ)</div>
<div class="text-lg font-bold text-slate-800 mt-1">0 หน่วย</div>
</div>
</div>
</div>
<!-- Section 3: Triage Summary -->
<div class="space-y-3">
<h3 class="text-sm font-black text-blue-900 uppercase tracking-widest border-b border-slate-100 pb-1 flex items-center gap-2">
<i data-lucide="file-text" class="w-4 h-4"></i> 3. สรุปความเร่งด่วนและจำแนกคัดกรองอาการ (Triage Summary)
</h3>
<div class="overflow-x-auto">
<table class="w-full text-left text-xs border border-slate-100 rounded-xl overflow-hidden">
<thead>
<tr class="bg-slate-50 text-slate-600 font-bold border-b border-slate-100">
<th class="p-2.5">ระดับความรุนแรง / สัญญาณชีพ</th>
<th class="p-2.5 text-center">ประเมินทางสายโทรศัพท์ (Phone Triage)</th>
<th class="p-2.5 text-center">ประเมิน ณ จุดเกิดเหตุ (Scene Triage)</th>
<th class="p-2.5 text-center">ประเมิน ณ ห้องฉุกเฉิน (ER Triage)</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 text-slate-700 font-semibold text-center">
<tr>
<td class="p-2.5 text-left text-red-600 font-extrabold flex items-center gap-1.5">🔴 สีแดง (วิกฤต/ฉุกเฉินคุกคามชีพ)</td>
<td class="p-2.5">0</td>
<td class="p-2.5">0</td>
<td class="p-2.5">0</td>
</tr>
<tr>
<td class="p-2.5 text-left text-amber-600 font-extrabold flex items-center gap-1.5">🟡 สีเหลือง (เร่งด่วน/กึ่งวิกฤต)</td>
<td class="p-2.5">0</td>
<td class="p-2.5">0</td>
<td class="p-2.5">0</td>
</tr>
<tr>
<td class="p-2.5 text-left text-emerald-600 font-extrabold flex items-center gap-1.5">🟢 สีเขียว (ไม่รุนแรง/ทั่วไป)</td>
<td class="p-2.5">0</td>
<td class="p-2.5">0</td>
<td class="p-2.5">0</td>
</tr>
<tr>
<td class="p-2.5 text-left text-slate-500 font-extrabold flex items-center gap-1.5">⚪ สีขาว (ผู้ป่วยนัด/ประสานงานย้อนหลัง)</td>
<td class="p-2.5">0</td>
<td class="p-2.5">0</td>
<td class="p-2.5">0</td>
</tr>
</tbody>
</table>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 pt-2">
<div class="space-y-3">
<h4 class="text-xs font-black text-blue-900 uppercase tracking-widest border-b border-slate-100 pb-1">เคสเร่งด่วนรหัสเฉพาะ (Fast Track)</h4>
<div class="space-y-2 text-xs font-semibold text-slate-600">
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span>🧠 STROKE (หลอดเลือดสมองเฉลี่ย):</span>
<span class="font-bold text-slate-800">0 ราย</span>
</div>
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span>❤️ STEMI (โรคหัวใจเฉียบพลัน):</span>
<span class="font-bold text-slate-800">0 ราย</span>
</div>
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span>🦠 Sepsis (ติดเชื้อในกระแสโลหิต):</span>
<span class="font-bold text-slate-800">0 ราย</span>
</div>
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span>🚗 Multiple Trauma (อุบัติเหตุพหุบาดเจ็บรุนแรง):</span>
<span class="font-bold text-slate-800">0 ราย</span>
</div>
</div>
</div>
<div class="space-y-3">
<h4 class="text-xs font-black text-blue-900 uppercase tracking-widest border-b border-slate-100 pb-1">ผลการทดสอบวิทยุ ว.16 และสถานี</h4>
<div class="space-y-2 text-xs font-semibold text-slate-600 bg-slate-50 p-3 rounded-xl border border-slate-100">
<div class="flex justify-between py-1 border-b border-slate-100">
<span>ผู้ทดสอบ ว.16:</span>
<span class="font-bold text-slate-800">นายสมเกียรติ มุ่งมั่น</span>
</div>
<div class="flex justify-between py-1 border-b border-slate-100">
<span>สถานีเข้าร่วมตรวจสำเร็จ:</span>
<span class="font-bold text-emerald-600">16 สถานี</span>
</div>
<div class="flex justify-between py-1 border-b border-slate-100">
<span>สถานีที่ไม่เข้าร่วม/ติดต่อไม่ได้:</span>
<span class="font-bold text-rose-600">1 สถานี</span>
</div>
<div class="text-[10px] text-rose-500 leading-normal font-bold">
รายชื่อสถานีที่ขาดการติดต่อ: โรงพยาบาลไทยอินเตอร์เกาะพะงัน
</div>
</div>
</div>
</div>
</div>
<!-- Section 4: Narrative Summary -->
<div class="space-y-4 pt-2">
<h3 class="text-sm font-black text-blue-900 uppercase tracking-widest border-b border-slate-100 pb-1">4. สรุปเหตุการณ์สำคัญและความเสี่ยงที่ตรวจพบ</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs font-semibold">
<div class="bg-slate-50 p-4 rounded-xl border border-slate-100 space-y-1.5">
<span class="font-bold text-slate-800 block">สรุปเหตุการณ์และข้อขัดข้องสำคัญในรอบเวร:</span>
<p class="text-slate-500 leading-relaxed font-medium min-h-[40px]">ไม่มีรายงานเหตุการณ์สำคัญเป็นพิเศษ</p>
</div>
<div class="bg-slate-50 p-4 rounded-xl border border-slate-100 space-y-1.5">
<span class="font-bold text-slate-800 block">ความเสี่ยงหรือความขัดแย้งที่ต้องปรับปรุงระบบ:</span>
<p class="text-slate-500 leading-relaxed font-medium min-h-[40px]">ไม่พบปัญหาความเสี่ยงพิเศษจากการรับแจ้งเหตุหรือการประสานขบวนรถ</p>
</div>
</div>
</div>
<!-- Signatures -->
<div class="border-t border-slate-100 pt-6 flex flex-col sm:flex-row justify-between items-start sm:items-center gap-6 mt-8">
<div class="text-xs space-y-1">
<div class="font-bold text-slate-800">ผู้ส่งมอบเวร: <span class="text-slate-500 underline font-semibold">นพ.เกียรติภูมิ ภูมิใจไทย (ผู้อำนวยการศูนย์)</span></div>
<div class="text-[10px] text-slate-400">ลงชื่อเข้ารหัสดิจิตอลเรียบร้อยแล้ว</div>
</div>
<div class="text-xs space-y-1 sm:text-right">
<div class="font-bold text-slate-800">ผู้รับมอบเวร: <span class="text-blue-700 underline font-black">⏳ รอลงชื่อรับเวรดิจิตอล</span></div>
<div class="text-[10px] text-slate-400">กรุณาเซ็นชื่อเข้าระบบด้วย PIN ก่อนพิมพ์รายงาน</div>
</div>
</div>
</div>
</div>
<?php require_once 'includes/footer.php'; ?>