A web-based hospital/clinic queue management system built as a single-page application. It can run directly from HTML files and synchronizes queue status across browser tabs on the same machine using localStorage and BroadcastChannel.
index.html– Main control panel for staffkiosk.html– Self-service ticket issuing page for patientsdisplay.html– Queue display screenassets/index.cssandassets/index.js– Styles and logic for the main control panelassets/kiosk.cssandassets/kiosk.js– Styles and logic for the Kiosk pageassets/display.cssandassets/display.js– Styles and logic for the Display screenindex.html.bak– Backup file from the original project
Open index.html in a web browser to access the main control panel.
From there, use the system buttons to open the Kiosk and Display screens, or open the corresponding HTML files directly in the same browser or on the same machine.
When running directly from HTML files, the system stores and synchronizes queue data using the browser's local storage. If the application is started through the backend using npm start, all devices accessing the same URL will share and synchronize queue data through the server.
The project includes a basic backend in server.js.
Start the server with:
npm startThen open:
http://localhost:3000
System status page:
http://localhost:3000/status.html
- Open
index.html - Go to Settings
- Open the Promotional Images / TV Display Scrolling Message section
- Save your changes
The display.html screen will automatically update through state synchronization.
GET /api/stateReturns the complete queue state.
GET /api/healthChecks server status, storage status, and queue statistics.
GET /api/metricsReturns summarized queue metrics.
GET /api/backupDownloads the current queue state as a JSON file.
POST /api/ticketsExample request:
{
"deptId": "OPD",
"priority": "normal"
}POST /api/departments/OPD/call-nextCalls the next waiting queue in the specified department.
POST /api/tickets/A001/completeMarks the specified queue ticket as completed.
Backend data is stored in:
data/queue-state.json
The frontend synchronizes queue data through:
PUT /api/state
GET /api/stateCheck JavaScript syntax with:
node --check assets/index.js
node --check assets/kiosk.js
node --check assets/display.jsOr run:
npm run checkระบบจัดการคิวโรงพยาบาล/คลินิกแบบเว็บหน้าเดียว ใช้งานได้จากไฟล์ HTML โดยเก็บสถานะและซิงก์หน้าจอบนเครื่องเดียวกันผ่าน localStorage และ BroadcastChannel
index.htmlหน้าควบคุมหลักสำหรับเจ้าหน้าที่kiosk.htmlหน้ารับบัตรคิวสำหรับผู้รับบริการdisplay.htmlหน้าจอแสดงผลคิวassets/index.cssและassets/index.jsสไตล์และ logic ของหน้าควบคุมหลักassets/kiosk.cssและassets/kiosk.jsสไตล์และ logic ของหน้า Kioskassets/display.cssและassets/display.jsสไตล์และ logic ของหน้าจอแสดงผลindex.html.bakไฟล์สำรองจากโปรเจกต์เดิม
เปิด index.html ในเบราว์เซอร์เพื่อเข้าใช้งานหน้าควบคุมหลัก จากนั้นใช้ปุ่มในระบบเพื่อเปิดหน้าจอ Kiosk และ Display หรือเปิดไฟล์เหล่านี้โดยตรงในเบราว์เซอร์เดียวกัน/เครื่องเดียวกัน
หากเปิดไฟล์ HTML โดยตรง ระบบยังใช้ browser storage ของเครื่องนั้นเป็นหลัก แต่ถ้ารันผ่าน backend ด้วย npm start ทุกเครื่องที่เปิด URL เดียวกันจะ sync สถานะคิวผ่าน server ได้
ระบบมี backend เบื้องต้นใน server.js แล้ว รันได้ด้วย:
npm startจากนั้นเปิด http://localhost:3000
หน้าตรวจระบบ: http://localhost:3000/status.html
ตั้งค่าภาพโปรโมต/ข้อความวิ่ง: เข้า index.html → เมนู ตั้งค่า → การ์ด ภาพโปรโมต / ข้อความวิ่งหน้าจอทีวี แล้วกดบันทึก จากนั้น display.html จะอัปเดตผ่าน state sync
API หลัก:
GET /api/stateดูสถานะคิวทั้งหมดGET /api/healthตรวจ server, storage และคิวรวมGET /api/metricsดูตัวเลขคิวแบบสั้นGET /api/backupดาวน์โหลดข้อมูล state เป็นไฟล์ JSONPOST /api/ticketsสร้างคิวใหม่ เช่น{ "deptId": "OPD", "priority": "normal" }POST /api/departments/OPD/call-nextเรียกคิวถัดไปPOST /api/tickets/A001/completeปิดงานคิว
ข้อมูล backend จะถูกบันทึกที่ data/queue-state.json และ frontend จะ push/poll state ผ่าน PUT /api/state กับ GET /api/state
ใช้คำสั่งต่อไปนี้เพื่อตรวจ syntax ของ JavaScript:
node --check assets/index.js
node --check assets/kiosk.js
node --check assets/display.jsหรือใช้:
npm run check