{ "openapi": "3.0.3", "info": { "title": "TTMQMS Enterprise REST API Specification", "description": "API Specification สำหรับระบบบริหารจัดการคิวนวดแผนไทย (Thai Traditional Massage Queue Management System) เชื่อมต่อ AI, Smart Card, ESC/POS Printer และ HIS FHIR R4", "version": "1.0.0", "contact": { "name": "Antigravity AI Engineering Team", "email": "support@ttmqms.hospital.go.th" } }, "servers": [ { "url": "https://ttmqms.hospital.go.th/api/v1", "description": "Production Server (Hospital DMZ)" }, { "url": "http://localhost:8000/api/v1", "description": "Local Development Server" } ], "components": { "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } } }, "security": [ { "BearerAuth": [] } ], "paths": { "/auth/login": { "post": { "summary": "เข้าสู่ระบบและรับ JWT Token", "security": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "username": { "type": "string", "example": "1100000000001" }, "password": { "type": "string", "example": "SecurePassword@2026" }, "totp_code": { "type": "string", "example": "123456" } } } } } }, "responses": { "200": { "description": "เข้าสู่ระบบสำเร็จ คืนค่า JWT Token" }, "401": { "description": "รหัสผ่านหรือรหัส 2FA ไม่ถูกต้อง" } } } }, "/queues/walkin": { "post": { "summary": "ลงทะเบียนคิวใหม่และจัดสรรหมอนวดด้วย Smart Queue AI", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "branch_id": { "type": "integer", "example": 1 }, "patient_id": { "type": "integer", "example": 1 }, "service_id": { "type": "integer", "example": 2 }, "priority": { "type": "string", "enum": ["Normal", "VIP", "Emergency"], "example": "Normal" } } } } } }, "responses": { "200": { "description": "จัดสรรคิวสำเร็จ พร้อมระบุห้องและหมอนวด" } } } }, "/queues": { "get": { "summary": "ดึงรายการคิวประจำวัน (สำหรับ Queue Board / Smart TV)", "parameters": [ { "name": "branch_id", "in": "query", "required": false, "schema": { "type": "integer", "default": 1 } }, { "name": "status", "in": "query", "required": false, "schema": { "type": "string", "example": "Waiting,Assigned,In_Progress" } } ], "responses": { "200": { "description": "ดึงรายการคิวสำเร็จ" } } } }, "/clinical/soap": { "post": { "summary": "บันทึกเวชระเบียน SOAP Note พร้อมลายเซ็นและส่ง Sync HIS FHIR", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "queue_id": { "type": "integer", "example": 15 }, "patient_id": { "type": "integer", "example": 1 }, "subjective": { "type": "string", "example": "ปวดหลังและต้นคอมา 3 วัน" }, "objective_vas_pre": { "type": "integer", "example": 7 }, "objective_vas_post": { "type": "integer", "example": 2 }, "assessment": { "type": "string", "example": "โรคลมปลายปัตฆาตสัญญาณ 4 หลัง" }, "plan_treatment": { "type": "string", "example": "นวดไทยราชสำนักและประคบสมุนไพร" }, "signature_base64": { "type": "string", "example": "data:image/png;base64,iVBORw0K..." } } } } } }, "responses": { "200": { "description": "บันทึกเวชระเบียนสำเร็จ" } } } }, "/billing/checkout": { "post": { "summary": "คิดเงิน ชำระค่าบริการ และสั่งพิมพ์ใบเสร็จ ESC/POS", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "queue_id": { "type": "integer", "example": 15 }, "payment_method": { "type": "string", "enum": ["Cash", "PromptPay", "Credit"], "example": "PromptPay" }, "subtotal": { "type": "number", "example": 750.00 }, "discount": { "type": "number", "example": 50.00 }, "vat": { "type": "number", "example": 49.00 }, "grand_total": { "type": "number", "example": 749.00 } } } } } }, "responses": { "200": { "description": "ชำระเงินสำเร็จ ออกเลขใบเสร็จและคำสั่งพิมพ์" } } } } } }