Data Flow Diagram (DFD)
ระบบนัดหมายและตารางเวรแพทย์ (Appointment and Doctor Schedule Management System)
เวอร์ชัน: 1.0
วันที่: 9 ตุลาคม 2568
สอดคล้องกับ: SRS ระบบนัดหมายและตารางเวรแพทย์ v1.0, TOR ระบบนัดหมายและตารางเวรแพทย์, ERD v1.0, และ Schema v1.0
สารบัญ
- ภาพรวมระบบ
- Context Diagram
- Level 0 DFD
- Level 1 DFD - การลงทะเบียนนัดหมาย
- Level 1 DFD - การจัดการตารางเวรแพทย์
- Level 1 DFD - การตรวจสอบและติดตาม
- Level 1 DFD - การส่งตรวจล่วงหน้า
- Data Dictionary
- API Integration Flow
1. ภาพรวมระบบ
ระบบนัดหมายและตารางเวรแพทย์ทำหน้าที่เป็น Appointment Hub System ที่จัดการการนัดหมายผู้ป่วยและตารางการทำงานของแพทย์ โดยมีการไหลของข้อมูลหลักดังนี้:
การไหลของข้อมูลหลัก:
- Input: ข้อมูลผู้ป่วยจากระบบเวชระเบียน (1.2.1), คำขอนัดหมายจากระบบห้องตรวจ (1.2.3), ตารางเวรแพทย์, วันหยุดต่างๆ, ข้อมูลการปฏิบัติก่อนพบแพทย์
- Processing: การตรวจสอบความพร้อมใช้งานของแพทย์, การจัดการการนัดหมาย, การตรวจสอบการซ้ำซ้อน, การจำกัดจำนวนผู้ป่วยต่อแพทย์, การติดตามการมา-ไม่มาตามนัด
- Output: ใบนัดหมาย, ปฏิทินการนัด, รายงานการมา-ไม่มาตามนัด, ข้อมูลการส่งตรวจล่วงหน้า, การแจ้งเตือนต่างๆ
- Integration: เชื่อมต่อกับระบบเวชระเบียน (1.2.1), ระบบห้องตรวจ (1.2.3), ระบบซักประวัติ (1.2.2), ระบบงานชันสูตร (1.2.7), ระบบรังสีวิทยา (1.2.8)
ฟีเจอร์หลักตาม TOR:
1. ข้อมูลพื้นฐาน (1.2.6.1):
- กำหนดจำนวนคนไข้นัดหมายของแพทย์แต่ละท่านต่อวัน
- กำหนดข้อมูลการปฏิบัติก่อนพบแพทย์, คลินิก, รายการตรวจ Lab/ตรวจอื่นๆ
- กำหนดข้อมูลวันหยุดต่างๆ (วันเสาร์-อาทิตย์, วันหยุดนักขัตฤกษ์, วันหยุดพิเศษ)
- กำหนดตารางการทำงานของแพทย์แต่ละท่านเพื่อตรวจสอบวันทำงาน
2. การตรวจสอบข้อมูลการนัดหมาย (1.2.6.2):
- แสดงข้อมูลผู้ป่วยที่นัดหมายโดยระบุช่วงวันที่และเงื่อนไขต่างๆ
- ตรวจสอบรายชื่อผู้ป่วยที่มาและไม่มาตามนัดตามแพทย์ผู้นัด/ห้องตรวจ/คลินิก
- ตรวจสอบวันทำงานของแพทย์ในรูปแบบปฏิทิน
3. การลงทะเบียนนัดหมาย (1.2.6.3):
- บันทึกข้อมูลการนัดหมายครบถ้วนตาม TOR
- ตรวจสอบการซ้ำซ้อนและจำนวนผู้ป่วยที่นัดในช่วงเวลาเดียวกัน
- การยกเลิก/เลื่อนนัดพร้อมสาเหตุ
- พิมพ์ใบนัดที่สามารถปรับแต่งรูปแบบได้ตามหน่วยตรวจ
- จำกัดจำนวนผู้ป่วยต่อแพทย์ในการนัดแต่ละครั้ง
4. การส่งตรวจผู้ป่วยล่วงหน้า (1.2.6.4):
- ส่งตรวจผู้ป่วยล่วงหน้า (ออก Visit ล่วงหน้า) ตามวันที่นัด
- ส่งตรวจ Lab/X-Ray ล่วงหน้า (ยืนยันการสั่ง) ตามที่นัดหมายไว้
2. Context Diagram
graph TD
%% External Entities
REG["👤 เจ้าหน้าที่ลงทะเบียน"]
NURSE["👩⚕️ พยาบาล"]
DOC["👨⚕️ แพทย์"]
ADMIN["👨💻 ผู้ดูแลระบบ"]
PAT["👤 ผู้ป่วย"]
%% Central System
AMS["🗓️ ระบบนัดหมายและตารางเวรแพทย์<br/>(Appointment and Doctor Schedule System)"]
%% External Systems
MRS["📋 ระบบเวชระเบียน<br/>(1.2.1)"]
HIST["📝 ระบบซักประวัติ<br/>(1.2.2)"]
EXAM["🏥 ระบบห้องตรวจแพทย์<br/>(1.2.3)"]
LAB["🔬 ระบบงานชันสูตร<br/>(1.2.7)"]
XRAY["📡 ระบบรังสีวิทยา<br/>(1.2.8)"]
PHARM["💊 ระบบเภสัชกรรม<br/>(1.2.13)"]
FIN["💰 ระบบการเงิน<br/>(1.2.14)"]
%% Data flows from external entities to system
REG -->|"คำขอนัดหมาย<br/>ข้อมูลผู้ป่วย"| AMS
NURSE -->|"การยืนยันการมาตามนัด<br/>ข้อมูลการส่งตรวจ"| AMS
DOC -->|"กำหนดตารางเวร<br/>การอนุมัติการนัด"| AMS
ADMIN -->|"กำหนดวันหยุด<br/>ตารางการทำงาน<br/>ข้อมูลคลินิก"| AMS
PAT -->|"ข้อมูลประจำตัว<br/>การขอเลื่อนนัด"| AMS
%% Data flows from system to external entities
AMS -->|"ใบนัดหมาย<br/>รายการผู้ป่วยนัด"| REG
AMS -->|"รายชื่อผู้ป่วยที่มาตามนัด<br/>แจ้งเตือนการนัด"| NURSE
AMS -->|"ตารางการนัด<br/>รายงานผู้ป่วยที่ไม่มา"| DOC
AMS -->|"รายงานสถิติการนัด<br/>ข้อมูลการใช้ทรัพยากร"| ADMIN
AMS -->|"ใบนัดหมาย<br/>คำแนะนำการเตรียมตัว"| PAT
%% API Integration flows
AMS <-->|"ข้อมูลผู้ป่วย<br/>การตรวจสอบ HN"| MRS
AMS <-->|"ข้อมูลประวัติการรักษา<br/>การส่งตรวจ"| HIST
AMS <-->|"คำขอนัดหมาย<br/>ผลการตรวจ"| EXAM
AMS <-->|"การสั่ง Lab ล่วงหน้า<br/>ผล Lab"| LAB
AMS <-->|"การสั่ง X-Ray ล่วงหน้า<br/>ผล X-Ray"| XRAY
AMS <-->|"ข้อมูลยาที่ต้องเตรียม<br/>การสั่งยาล่วงหน้า"| PHARM
AMS <-->|"ข้อมูลค่าบริการ<br/>การชำระเงิน"| FIN
%% Styling
style AMS fill:#e1f5fe,stroke:#01579b,stroke-width:4px
style REG fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style NURSE fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style DOC fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style ADMIN fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style PAT fill:#fff3e0,stroke:#e65100,stroke-width:2px
style MRS fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
style HIST fill:#fce4ec,stroke:#880e4f,stroke-width:2px
style EXAM fill:#f1f8e9,stroke:#33691e,stroke-width:2px
style LAB fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style XRAY fill:#fafafa,stroke:#424242,stroke-width:2px
style PHARM fill:#e0f2f1,stroke:#00695c,stroke-width:2px
style FIN fill:#fff3e0,stroke:#ef6c00,stroke-width:2px
3. Level 0 DFD
graph TD
%% External Entities
USER["👤 ผู้ใช้งาน"]
PATIENT["👤 ผู้ป่วย"]
DOCTOR["👨⚕️ แพทย์"]
EXT_SYS["🔗 ระบบภายนอก"]
%% Processes
P1["1.0<br/>📝 การลงทะเบียน<br/>นัดหมาย"]
P2["2.0<br/>📅 การจัดการ<br/>ตารางเวรแพทย์"]
P3["3.0<br/>🔍 การตรวจสอบ<br/>และติดตาม"]
P4["4.0<br/>⏳ การส่งตรวจ<br/>ล่วงหน้า"]
P5["5.0<br/>🖨️ การพิมพ์<br/>เอกสาร"]
P6["6.0<br/>⚙️ การจัดการ<br/>ข้อมูลพื้นฐาน"]
%% Data Stores
DS1[("D1 | 📅 ข้อมูลการนัดหมาย<br/>(Appointments)")]
DS2[("D2 | 🗓️ ตารางเวรแพทย์<br/>(Doctor_Schedules)")]
DS3[("D3 | 📊 ข้อมูลการมา-ไม่มาตามนัด<br/>(Attendance_Records)")]
DS4[("D4 | 🏥 ข้อมูลคลินิกและห้องตรวจ<br/>(Clinic_Rooms)")]
DS5[("D5 | 📋 ข้อมูลการปฏิบัติก่อนพบแพทย์<br/>(Pre_Examination)")]
DS6[("D6 | 🗓️ ปฏิทินวันหยุด<br/>(Holiday_Calendar)")]
DS7[("D7 | ⚕️ ข้อมูลแพทย์<br/>(Doctor_Information)")]
DS8[("D8 | 👤 ข้อมูลผู้ป่วย<br/>(Patient_Data)")]
DS9[("D9 | 📄 แม่แบบใบนัด<br/>(Appointment_Templates)")]
DS10[("D10 | 🔬 การส่งตรวจล่วงหน้า<br/>(Advance_Orders)")]
%% Data flows from external entities
USER -->|"คำขอนัดหมาย"| P1
USER -->|"การยืนยันการมาตามนัด"| P3
USER -->|"คำขอพิมพ์เอกสาร"| P5
USER -->|"กำหนดข้อมูลพื้นฐาน"| P6
PATIENT -->|"ข้อมูลประจำตัว<br/>การขอเลื่อนนัด"| P1
PATIENT -->|"การยืนยันการมา"| P3
DOCTOR -->|"กำหนดตารางเวร"| P2
DOCTOR -->|"การอนุมัติการนัด"| P1
DOCTOR -->|"คำขอส่งตรวจล่วงหน้า"| P4
EXT_SYS -->|"ข้อมูลผู้ป่วย<br/>การส่งตรวจ"| P1
EXT_SYS -->|"ผลการตรวจ<br/>สถานะการส่งตรวจ"| P4
%% Data flows to external entities
P1 -->|"ใบนัดหมาย<br/>สถานะการนัด"| USER
P3 -->|"รายงานการมา-ไม่มาตามนัด<br/>สถิติการนัด"| USER
P5 -->|"เอกสารต่างๆ"| USER
P6 -->|"รายงานการกำหนดค่า"| USER
P1 -->|"ใบนัดหมาย<br/>คำแนะนำการเตรียมตัว"| PATIENT
P3 -->|"แจ้งเตือนการนัด"| PATIENT
P2 -->|"ตารางการนัด<br/>สถิติการใช้เวลา"| DOCTOR
P3 -->|"รายชื่อผู้ป่วยที่นัด"| DOCTOR
P4 -->|"รายการส่งตรวจล่วงหน้า"| DOCTOR
P1 -->|"ข้อมูลคิวผู้ป่วย"| EXT_SYS
P4 -->|"คำสั่งส่งตรวจล่วงหน้า"| EXT_SYS
%% Data flows between processes and data stores
P1 <-->|"ข้อมูลการนัดหมาย"| DS1
P1 <-->|"ตารางเวรแพทย์"| DS2
P1 <-->|"ข้อมูลคลินิก"| DS4
P1 <-->|"ข้อมูลผู้ป่วย"| DS8
P1 <-->|"วันหยุด"| DS6
P2 <-->|"ตารางเวรแพทย์"| DS2
P2 <-->|"ข้อมูลแพทย์"| DS7
P2 <-->|"วันหยุด"| DS6
P3 <-->|"ข้อมูลการนัดหมาย"| DS1
P3 <-->|"บันทึกการมา-ไม่มา"| DS3
P3 <-->|"ข้อมูลผู้ป่วย"| DS8
P4 <-->|"ข้อมูลการนัดหมาย"| DS1
P4 <-->|"การส่งตรวจล่วงหน้า"| DS10
P4 <-->|"ข้อมูลการปฏิบัติ"| DS5
P5 <-->|"ข้อมูลการนัดหมาย"| DS1
P5 <-->|"แม่แบบใบนัด"| DS9
P5 <-->|"ข้อมูลผู้ป่วย"| DS8
P6 <-->|"ข้อมูลคลินิก"| DS4
P6 <-->|"ข้อมูลการปฏิบัติ"| DS5
P6 <-->|"วันหยุด"| DS6
P6 <-->|"ข้อมูลแพทย์"| DS7
P6 <-->|"แม่แบบใบนัด"| DS9
%% Styling
style USER fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style PATIENT fill:#fff3e0,stroke:#e65100,stroke-width:2px
style DOCTOR fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style EXT_SYS fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
style P1 fill:#e3f2fd,stroke:#0277bd,stroke-width:2px
style P2 fill:#f1f8e9,stroke:#33691e,stroke-width:2px
style P3 fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style P4 fill:#fce4ec,stroke:#880e4f,stroke-width:2px
style P5 fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
style P6 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
style DS1 fill:#e1f5fe,stroke:#01579b,stroke-width:2px
style DS2 fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
style DS3 fill:#fff3e0,stroke:#e65100,stroke-width:2px
style DS4 fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style DS5 fill:#fce4ec,stroke:#880e4f,stroke-width:2px
style DS6 fill:#f1f8e9,stroke:#33691e,stroke-width:2px
style DS7 fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style DS8 fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
style DS9 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
style DS10 fill:#ffccbc,stroke:#ff9800,stroke-width:2px
4. Level 1 DFD - การลงทะเบียนนัดหมาย
graph TD
%% External Entities
USER["👤 ผู้ใช้งาน"]
PATIENT["👤 ผู้ป่วย"]
DOCTOR["👨⚕️ แพทย์"]
EXT_SYS["🔗 ระบบภายนอก"]
%% Sub-processes of Process 1.0
P11["1.1<br/>🔍 ตรวจสอบ<br/>ข้อมูลผู้ป่วย"]
P12["1.2<br/>📋 บันทึก<br/>ข้อมูลการนัด"]
P13["1.3<br/>⚠️ ตรวจสอบ<br/>การซ้ำซ้อน"]
P14["1.4<br/>📊 ตรวจสอบ<br/>จำนวนผู้ป่วย"]
P15["1.5<br/>✅ การอนุมัติ<br/>การนัด"]
P16["1.6<br/>🔄 การยกเลิก<br/>เลื่อนนัด"]
P17["1.7<br/>📱 การแจ้งเตือน<br/>และติดตาม"]
%% Data Stores
DS1[("D1 | 📅 ข้อมูลการนัดหมาย<br/>(Appointments)")]
DS2[("D2 | 🗓️ ตารางเวรแพทย์<br/>(Doctor_Schedules)")]
DS4[("D4 | 🏥 ข้อมูลคลินิกและห้องตรวจ<br/>(Clinic_Rooms)")]
DS6[("D6 | 🗓️ ปฏิทินวันหยุด<br/>(Holiday_Calendar)")]
DS7[("D7 | ⚕️ ข้อมูลแพทย์<br/>(Doctor_Information)")]
DS8[("D8 | 👤 ข้อมูลผู้ป่วย<br/>(Patient_Data)")]
DS11[("D11 | 📋 การยกเลิกเลื่อนนัด<br/>(Cancellation_History)")]
DS12[("D12 | 🔔 การแจ้งเตือน<br/>(Notifications)")]
%% Data flows from external entities
USER -->|"คำขอนัดหมาย<br/>HN + วันที่ต้องการ"| P11
USER -->|"ข้อมูลการนัด<br/>คลินิก + แพทย์"| P12
USER -->|"คำขอยกเลิก/เลื่อนนัด"| P16
PATIENT -->|"ข้อมูลประจำตัว<br/>ความต้องการพิเศษ"| P11
PATIENT -->|"การยืนยันการนัด"| P15
PATIENT -->|"คำขอเลื่อนนัด"| P16
DOCTOR -->|"การอนุมัติการนัด"| P15
DOCTOR -->|"เงื่อนไขการนัด"| P12
EXT_SYS -->|"ข้อมูลผู้ป่วย<br/>ประวัติการรักษา"| P11
EXT_SYS -->|"สถานะการรักษา"| P12
%% Data flows to external entities
P13 -->|"เตือนการซ้ำซ้อน"| USER
P14 -->|"จำนวนผู้ป่วยที่นัดแล้ว"| USER
P15 -->|"สถานะการอนุมัติ"| USER
P16 -->|"ผลการยกเลิก/เลื่อน"| USER
P12 -->|"ใบนัดหมาย"| PATIENT
P17 -->|"การแจ้งเตือนการนัด"| PATIENT
P14 -->|"สถิติการนัด"| DOCTOR
P15 -->|"รายชื่อผู้ป่วยที่ขออนุมัติ"| DOCTOR
P11 -->|"ข้อมูลผู้ป่วยที่ตรวจสอบแล้ว"| EXT_SYS
P12 -->|"การนัดหมายใหม่"| EXT_SYS
%% Data flows between processes
P11 -->|"ข้อมูลผู้ป่วยที่ถูกต้อง"| P12
P12 -->|"ข้อมูลการนัดที่บันทึก"| P13
P13 -->|"ผลการตรวจสอบ"| P14
P14 -->|"การนัดที่ผ่านการตรวจสอบ"| P15
P15 -->|"การนัดที่อนุมัติแล้ว"| P17
P16 -->|"การเปลี่ยนแปลงการนัด"| P17
%% Data flows between processes and data stores
P11 <-->|"ข้อมูลผู้ป่วย"| DS8
P12 <-->|"บันทึกการนัด"| DS1
P12 <-->|"ข้อมูลคลินิก"| DS4
P12 <-->|"ข้อมูลแพทย์"| DS7
P13 <-->|"ตรวจสอบการนัดเดิม"| DS1
P13 <-->|"ตารางเวร"| DS2
P13 <-->|"วันหยุด"| DS6
P14 <-->|"นับจำนวนการนัด"| DS1
P14 <-->|"จำกัดจำนวนต่อแพทย์"| DS7
P15 <-->|"อัปเดตสถานะ"| DS1
P16 <-->|"แก้ไขการนัด"| DS1
P16 <-->|"บันทึกประวัติการยกเลิก"| DS11
P17 <-->|"ข้อมูลการแจ้งเตือน"| DS12
P17 <-->|"การนัดที่ต้องแจ้ง"| DS1
%% Styling
style USER fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style PATIENT fill:#fff3e0,stroke:#e65100,stroke-width:2px
style DOCTOR fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style EXT_SYS fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
style P11 fill:#e3f2fd,stroke:#0277bd,stroke-width:2px
style P12 fill:#f1f8e9,stroke:#33691e,stroke-width:2px
style P13 fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style P14 fill:#fce4ec,stroke:#880e4f,stroke-width:2px
style P15 fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
style P16 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
style P17 fill:#ffccbc,stroke:#ff9800,stroke-width:2px
style DS1 fill:#e1f5fe,stroke:#01579b,stroke-width:2px
style DS2 fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
style DS4 fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style DS6 fill:#f1f8e9,stroke:#33691e,stroke-width:2px
style DS7 fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style DS8 fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
style DS11 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
style DS12 fill:#ffccbc,stroke:#ff9800,stroke-width:2px
5. Level 1 DFD - การจัดการตารางเวรแพทย์
graph TD
%% External Entities
DOCTOR["👨⚕️ แพทย์"]
ADMIN["👨💻 ผู้ดูแลระบบ"]
USER["👤 ผู้ใช้งาน"]
%% Sub-processes of Process 2.0
P21["2.1<br/>📝 กำหนด<br/>ตารางเวร"]
P22["2.2<br/>📅 จัดการ<br/>วันหยุด"]
P23["2.3<br/>⏰ ตรวจสอบ<br/>ความพร้อมใช้งาน"]
P24["2.4<br/>🔄 การแก้ไข<br/>ตารางเวร"]
P25["2.5<br/>📊 การแสดงผล<br/>ปฏิทิน"]
P26["2.6<br/>📈 รายงาน<br/>สถิติการทำงาน"]
%% Data Stores
DS2[("D2 | 🗓️ ตารางเวรแพทย์<br/>(Doctor_Schedules)")]
DS6[("D6 | 🗓️ ปฏิทินวันหยุด<br/>(Holiday_Calendar)")]
DS7[("D7 | ⚕️ ข้อมูลแพทย์<br/>(Doctor_Information)")]
DS4[("D4 | 🏥 ข้อมูลคลินิกและห้องตรวจ<br/>(Clinic_Rooms)")]
DS13[("D13 | 📋 แม่แบบตารางเวร<br/>(Schedule_Templates)")]
DS14[("D14 | 📊 สถิติการทำงาน<br/>(Work_Statistics)")]
%% Data flows from external entities
DOCTOR -->|"กำหนดตารางเวร<br/>วันเวลาที่สะดวก"| P21
DOCTOR -->|"คำขอแก้ไขตารางเวร"| P24
DOCTOR -->|"คำขอข้อมูลตารางงาน"| P25
ADMIN -->|"กำหนดวันหยุดราชการ<br/>วันหยุดพิเศษ"| P22
ADMIN -->|"แม่แบบตารางเวร"| P21
ADMIN -->|"การกำหนดค่าคลินิก"| P21
USER -->|"ตรวจสอบความพร้อม<br/>แพทย์"| P23
USER -->|"คำขอดูปฏิทิน"| P25
%% Data flows to external entities
P21 -->|"ตารางเวรที่กำหนด<br/>การยืนยัน"| DOCTOR
P24 -->|"ผลการแก้ไข<br/>ตารางเวรใหม่"| DOCTOR
P25 -->|"ปฏิทินการทำงาน<br/>ตารางเวรส่วนตัว"| DOCTOR
P22 -->|"ปฏิทินวันหยุด<br/>การแจ้งเตือน"| ADMIN
P26 -->|"รายงานสถิติ<br/>การใช้ทรัพยากร"| ADMIN
P23 -->|"สถานะความพร้อม<br/>รายชื่อแพทย์ที่ว่าง"| USER
P25 -->|"ปฏิทินการนัด<br/>ช่วงเวลาที่ว่าง"| USER
%% Data flows between processes
P21 -->|"ตารางเวรใหม่"| P23
P22 -->|"ข้อมูลวันหยุด"| P23
P23 -->|"ข้อมูลความพร้อม"| P25
P24 -->|"การเปลี่ยนแปลงตาราง"| P23
P21 -->|"ข้อมูลการทำงาน"| P26
P24 -->|"การแก้ไข"| P26
%% Data flows between processes and data stores
P21 <-->|"บันทึกตารางเวร"| DS2
P21 <-->|"ข้อมูลแพทย์"| DS7
P21 <-->|"ข้อมูลคลินิก"| DS4
P21 <-->|"แม่แบบตาราง"| DS13
P22 <-->|"บันทึกวันหยุด"| DS6
P22 <-->|"ตรวจสอบตารางเวร"| DS2
P23 <-->|"ตรวจสอบตาราง"| DS2
P23 <-->|"ตรวจสอบวันหยุด"| DS6
P23 <-->|"ข้อมูลแพทย์"| DS7
P24 <-->|"แก้ไขตารางเวร"| DS2
P24 <-->|"ตรวจสอบข้อมูลแพทย์"| DS7
P25 <-->|"ข้อมูลตารางเวร"| DS2
P25 <-->|"ข้อมูลวันหยุด"| DS6
P25 <-->|"ข้อมูลแพทย์"| DS7
P26 <-->|"สถิติการทำงาน"| DS14
P26 <-->|"ข้อมูลตารางเวร"| DS2
P26 <-->|"ข้อมูลแพทย์"| DS7
%% Styling
style DOCTOR fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style ADMIN fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style USER fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style P21 fill:#e3f2fd,stroke:#0277bd,stroke-width:2px
style P22 fill:#f1f8e9,stroke:#33691e,stroke-width:2px
style P23 fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style P24 fill:#fce4ec,stroke:#880e4f,stroke-width:2px
style P25 fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
style P26 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
style DS2 fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
style DS4 fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style DS6 fill:#f1f8e9,stroke:#33691e,stroke-width:2px
style DS7 fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style DS13 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
style DS14 fill:#ffccbc,stroke:#ff9800,stroke-width:2px
6. Level 1 DFD - การตรวจสอบและติดตาม
graph TD
%% External Entities
USER["👤 ผู้ใช้งาน"]
DOCTOR["👨⚕️ แพทย์"]
PATIENT["👤 ผู้ป่วย"]
%% Sub-processes of Process 3.0
P31["3.1<br/>📋 แสดงรายชื่อ<br/>ผู้ป่วยที่นัด"]
P32["3.2<br/>✅ บันทึกการมา<br/>ตามนัด"]
P33["3.3<br/>❌ ตรวจสอบ<br/>ผู้ป่วยที่ไม่มา"]
P34["3.4<br/>📊 สถิติ<br/>การมา-ไม่มา"]
P35["3.5<br/>📅 แสดงปฏิทิน<br/>การนัด"]
P36["3.6<br/>⏰ แสดงตาราง<br/>เวลานัด"]
%% Data Stores
DS1[("D1 | 📅 ข้อมูลการนัดหมาย<br/>(Appointments)")]
DS3[("D3 | 📊 ข้อมูลการมา-ไม่มาตามนัด<br/>(Attendance_Records)")]
DS7[("D7 | ⚕️ ข้อมูลแพทย์<br/>(Doctor_Information)")]
DS8[("D8 | 👤 ข้อมูลผู้ป่วย<br/>(Patient_Data)")]
DS4[("D4 | 🏥 ข้อมูลคลินิกและห้องตรวจ<br/>(Clinic_Rooms)")]
%% Data flows from external entities
USER -->|"เลือกช่วงวันที่<br/>แพทย์/คลินิก/ห้องตรวจ"| P31
USER -->|"บันทึกการมาของผู้ป่วย"| P32
USER -->|"คำขอรายงานสถิติ"| P34
DOCTOR -->|"ตรวจสอบผู้ป่วยที่นัด<br/>วันที่ทำงาน"| P31
DOCTOR -->|"คำขอดูปฏิทิน"| P35
PATIENT -->|"การมาตามนัด<br/>ข้อมูลประจำตัว"| P32
%% Data flows to external entities
P31 -->|"รายชื่อผู้ป่วยที่นัด<br/>HN, ชื่อ-สกุล, เวลานัด"| USER
P32 -->|"สถานะการบันทึก"| USER
P34 -->|"รายงานสถิติ<br/>การมา-ไม่มาตามนัด"| USER
P31 -->|"รายชื่อผู้ป่วย<br/>ข้อมูลการนัด"| DOCTOR
P33 -->|"รายชื่อผู้ป่วยที่ไม่มา<br/>สถิติการไม่มา"| DOCTOR
P35 -->|"ปฏิทินการนัด<br/>ตารางการทำงาน"| DOCTOR
P32 -->|"การยืนยันการมา"| PATIENT
%% Data flows between processes
P31 -->|"รายการนัดวันนี้"| P32
P32 -->|"ข้อมูลการมา"| P33
P32 -->|"ข้อมูลการมา"| P34
P33 -->|"ข้อมูลการไม่มา"| P34
P31 -->|"ข้อมูลการนัด"| P35
P31 -->|"รายการนัดตามเวลา"| P36
%% Data flows between processes and data stores
P31 <-->|"ค้นหาการนัดตามเงื่อนไข"| DS1
P31 <-->|"ข้อมูลแพทย์"| DS7
P31 <-->|"ข้อมูลผู้ป่วย"| DS8
P31 <-->|"ข้อมูลคลินิก"| DS4
P32 <-->|"อัปเดตสถานะการมา"| DS1
P32 <-->|"บันทึกการมาตามนัด"| DS3
P32 <-->|"ข้อมูลผู้ป่วย"| DS8
P33 <-->|"ตรวจสอบการไม่มา"| DS1
P33 <-->|"บันทึกการไม่มา"| DS3
P34 <-->|"ข้อมูลสถิติ"| DS3
P34 <-->|"ข้อมูลการนัด"| DS1
P34 <-->|"ข้อมูลแพทย์"| DS7
P35 <-->|"ข้อมูลการนัด"| DS1
P35 <-->|"ข้อมูลแพทย์"| DS7
P36 <-->|"การนัดตามช่วงเวลา"| DS1
P36 <-->|"ข้อมูลผู้ป่วย"| DS8
%% Styling
style USER fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style DOCTOR fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style PATIENT fill:#fff3e0,stroke:#e65100,stroke-width:2px
style P31 fill:#e3f2fd,stroke:#0277bd,stroke-width:2px
style P32 fill:#f1f8e9,stroke:#33691e,stroke-width:2px
style P33 fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style P34 fill:#fce4ec,stroke:#880e4f,stroke-width:2px
style P35 fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
style P36 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
style DS1 fill:#e1f5fe,stroke:#01579b,stroke-width:2px
style DS3 fill:#fff3e0,stroke:#e65100,stroke-width:2px
style DS4 fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style DS7 fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style DS8 fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
7. Level 1 DFD - การส่งตรวจล่วงหน้า
graph TD
%% External Entities
DOCTOR["👨⚕️ แพทย์"]
USER["👤ผู้ใช้งาน"]
LAB_SYS["🔬 ระบบงานชันสูตร"]
XRAY_SYS["📡 ระบบรังสีวิทยา"]
MRS_SYS["📋 ระบบเวชระเบียน"]
%% Sub-processes of Process 4.0
P41["4.1<br/>🔍 ตรวจสอบ<br/>การนัดที่จะมา"]
P42["4.2<br/>📝 สร้าง Visit<br/>ล่วงหน้า"]
P43["4.3<br/>🧪 ส่ง Lab<br/>ล่วงหน้า"]
P44["4.4<br/>📡 ส่ง X-Ray<br/>ล่วงหน้า"]
P45["4.5<br/>✅ ยืนยัน<br/>การสั่งตรวจ"]
P46["4.6<br/>📊 ติดตาม<br/>สถานะการตรวจ"]
%% Data Stores
DS1[("D1 | 📅 ข้อมูลการนัดหมาย<br/>(Appointments)")]
DS5[("D5 | 📋 ข้อมูลการปฏิบัติก่อนพบแพทย์<br/>(Pre_Examination)")]
DS10[("D10 | 🔬 การส่งตรวจล่วงหน้า<br/>(Advance_Orders)")]
DS8[("D8 | 👤 ข้อมูลผู้ป่วย<br/>(Patient_Data)")]
%% Data flows from external entities
DOCTOR -->|"คำสั่งส่งตรวจล่วงหน้า<br/>รายการ Lab/X-Ray"| P43
DOCTOR -->|"การอนุมัติส่งตรวจ"| P45
USER -->|"คำขอส่งตรวจล่วงหน้า<br/>ตามวันที่นัด"| P41
USER -->|"ติดตามสถานะ"| P46
LAB_SYS -->|"สถานะการรับคำสั่ง<br/>ผลการตรวจ"| P46
XRAY_SYS -->|"สถานะการรับคำสั่ง<br/>ผลการตรวจ"| P46
MRS_SYS -->|"ข้อมูลผู้ป่วย<br/>Visit ID"| P42
%% Data flows to external entities
P41 -->|"รายชื่อผู้ป่วยที่จะมา<br/>ข้อมูลการนัด"| USER
P46 -->|"สถานะการส่งตรวจ<br/>ผลการตรวจ"| USER
P43 -->|"คำสั่งส่งตรวจ Lab<br/>ข้อมูลผู้ป่วย"| LAB_SYS
P44 -->|"คำสั่งส่งตรวจ X-Ray<br/>ข้อมูลผู้ป่วย"| XRAY_SYS
P42 -->|"Visit ล่วงหน้า<br/>ข้อมูลการนัด"| MRS_SYS
%% Data flows between processes
P41 -->|"รายการนัดที่ต้องส่งตรวจ"| P42
P42 -->|"Visit ID ล่วงหน้า"| P43
P42 -->|"Visit ID ล่วงหน้า"| P44
P43 -->|"คำสั่ง Lab"| P45
P44 -->|"คำสั่ง X-Ray"| P45
P45 -->|"คำสั่งที่ยืนยันแล้ว"| P46
%% Data flows between processes and data stores
P41 <-->|"ข้อมูลการนัดที่จะมา"| DS1
P41 <-->|"ข้อมูลการปฏิบัติ"| DS5
P41 <-->|"ข้อมูลผู้ป่วย"| DS8
P42 <-->|"การนัดที่ต้องสร้าง Visit"| DS1
P42 <-->|"ข้อมูลผู้ป่วย"| DS8
P43 <-->|"บันทึกการส่ง Lab"| DS10
P43 <-->|"ข้อมูลการปฏิบัติ"| DS5
P44 <-->|"บันทึกการส่ง X-Ray"| DS10
P44 <-->|"ข้อมูลการปฏิบัติ"| DS5
P45 <-->|"ยืนยันคำสั่ง"| DS10
P46 <-->|"ติดตามสถานะ"| DS10
P46 <-->|"ข้อมูลการนัด"| DS1
%% Styling
style DOCTOR fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style USER fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style LAB_SYS fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
style XRAY_SYS fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
style MRS_SYS fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
style P41 fill:#e3f2fd,stroke:#0277bd,stroke-width:2px
style P42 fill:#f1f8e9,stroke:#33691e,stroke-width:2px
style P43 fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style P44 fill:#fce4ec,stroke:#880e4f,stroke-width:2px
style P45 fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
style P46 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
style DS1 fill:#e1f5fe,stroke:#01579b,stroke-width:2px
style DS5 fill:#fce4ec,stroke:#880e4f,stroke-width:2px
style DS8 fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
style DS10 fill:#ffccbc,stroke:#ff9800,stroke-width:2px
8. Data Dictionary
8.1 Data Elements
| Element Name |
Description |
Type |
Length |
Format |
| AppointmentID |
รหัสการนัดหมาย |
VARCHAR |
20 |
APPT-XXXXXXXXXX |
| HN |
หมายเลขประจำตัวผู้ป่วย |
VARCHAR |
10 |
XXXXXXXXXX |
| AppointmentDate |
วันที่นัดหมาย |
DATETIME |
19 |
DD/MM/YYYY HH:MM:SS |
| AppointmentTime |
เวลานัดหมาย |
TIME |
8 |
HH:MM:SS |
| DoctorID |
รหัสแพทย์ |
VARCHAR |
20 |
DOC-XXXXXXXX |
| DoctorName |
ชื่อแพทย์ |
NVARCHAR |
100 |
Text |
| ClinicCode |
รหัสคลินิก |
VARCHAR |
10 |
CLINIC-XXX |
| ClinicName |
ชื่อคลินิก |
NVARCHAR |
100 |
Text |
| RoomCode |
รหัสห้องตรวจ |
VARCHAR |
10 |
ROOM-XXX |
| RoomName |
ชื่อห้องตรวจ |
NVARCHAR |
50 |
Text |
| AppointmentReason |
สาเหตุการนัด |
NTEXT |
MAX |
Text |
| AppointmentNote |
หมายเหตุการนัด |
NTEXT |
MAX |
Text |
| PreExaminationInstructions |
การปฏิบัติก่อนพบแพทย์ |
NTEXT |
MAX |
Text |
| LabOrderAdvance |
การสั่ง Lab ล่วงหน้า |
NTEXT |
MAX |
Text |
| XRayOrderAdvance |
การสั่ง X-Ray ล่วงหน้า |
NTEXT |
MAX |
Text |
| AppointmentStatus |
สถานะการนัด |
VARCHAR |
20 |
SCHEDULED/CONFIRMED/CANCELLED/COMPLETED/NO_SHOW |
| MaxPatientsPerDay |
จำนวนผู้ป่วยสูงสุดต่อวัน |
INT |
3 |
XXX |
| MaxPatientsPerTimeSlot |
จำนวนผู้ป่วยสูงสุดต่อช่วงเวลา |
INT |
2 |
XX |
| TimeSlotDuration |
ระยะเวลาต่อช่วง (นาที) |
INT |
3 |
XXX |
| IsUrgent |
การนัดเร่งด่วน |
BIT |
1 |
0/1 |
| CreatedBy |
ผู้สร้างการนัด |
VARCHAR |
50 |
Username |
| CreatedDate |
วันที่สร้าง |
DATETIME |
19 |
DD/MM/YYYY HH:MM:SS |
| LastUpdatedBy |
ผู้แก้ไขล่าสุด |
VARCHAR |
50 |
Username |
| LastUpdatedDate |
วันที่แก้ไขล่าสุด |
DATETIME |
19 |
DD/MM/YYYY HH:MM:SS |
| CancellationReason |
เหตุผลการยกเลิก |
NTEXT |
MAX |
Text |
| CancelledBy |
ผู้ยกเลิก |
VARCHAR |
50 |
Username |
| CancelledDate |
วันที่ยกเลิก |
DATETIME |
19 |
DD/MM/YYYY HH:MM:SS |
| RescheduleFromDate |
วันที่เดิมก่อนเลื่อน |
DATETIME |
19 |
DD/MM/YYYY HH:MM:SS |
| RescheduleReason |
เหตุผลการเลื่อนนัด |
NTEXT |
MAX |
Text |
| AttendanceStatus |
สถานะการมา |
VARCHAR |
20 |
ATTENDED/NO_SHOW/LATE |
| AttendanceTime |
เวลาที่มาจริง |
DATETIME |
19 |
DD/MM/YYYY HH:MM:SS |
| ScheduleID |
รหัสตารางเวร |
VARCHAR |
20 |
SCHED-XXXXXXXXX |
| WorkDate |
วันที่ทำงาน |
DATE |
10 |
DD/MM/YYYY |
| StartTime |
เวลาเริ่มงาน |
TIME |
8 |
HH:MM:SS |
| EndTime |
เวลาเลิกงาน |
TIME |
8 |
HH:MM:SS |
| BreakStartTime |
เวลาเริ่มพัก |
TIME |
8 |
HH:MM:SS |
| BreakEndTime |
เวลาเลิกพัก |
TIME |
8 |
HH:MM:SS |
| IsAvailable |
สถานะว่าง |
BIT |
1 |
0/1 |
| IsHoliday |
วันหยุด |
BIT |
1 |
0/1 |
| HolidayName |
ชื่อวันหยุด |
NVARCHAR |
100 |
Text |
| HolidayType |
ประเภทวันหยุด |
VARCHAR |
20 |
NATIONAL/HOSPITAL/PERSONAL |
| NotificationID |
รหัสการแจ้งเตือน |
VARCHAR |
20 |
NOTIF-XXXXXXXX |
| NotificationType |
ประเภทการแจ้งเตือน |
VARCHAR |
30 |
APPOINTMENT_REMINDER/SCHEDULE_CHANGE/CANCELLATION |
| NotificationMessage |
ข้อความแจ้งเตือน |
NTEXT |
MAX |
Text |
| IsRead |
อ่านแล้ว |
BIT |
1 |
0/1 |
| SentDate |
วันที่ส่ง |
DATETIME |
19 |
DD/MM/YYYY HH:MM:SS |
| TemplateID |
รหัสแม่แบบ |
VARCHAR |
20 |
TMPL-XXXXXXXXX |
| TemplateName |
ชื่อแม่แบบ |
NVARCHAR |
100 |
Text |
| TemplateContent |
เนื้อหาแม่แบบ |
NTEXT |
MAX |
Text |
| IsActive |
เปิดใช้งาน |
BIT |
1 |
0/1 |
| PrintQuantity |
จำนวนที่พิมพ์ |
INT |
2 |
XX |
| PrintFormat |
รูปแบบการพิมพ์ |
VARCHAR |
20 |
A4/A5/RECEIPT |
| VisitIDAdvance |
รหัส Visit ล่วงหน้า |
VARCHAR |
20 |
VISIT-XXXXXXXXX |
| OrderType |
ประเภทการสั่ง |
VARCHAR |
20 |
LAB/XRAY/ULTRASOUND |
| OrderCode |
รหัสการสั่ง |
VARCHAR |
20 |
Text |
| OrderName |
ชื่อรายการตรวจ |
NVARCHAR |
200 |
Text |
| OrderStatus |
สถานะการสั่ง |
VARCHAR |
20 |
ORDERED/CONFIRMED/COMPLETED/CANCELLED |
| UrgencyLevel |
ระดับความเร่งด่วน |
VARCHAR |
20 |
STAT/URGENT/ROUTINE |
| ClinicalInfo |
ข้อมูลคลินิก |
NTEXT |
MAX |
Text |
| SpecialInstructions |
คำแนะนำพิเศษ |
NTEXT |
MAX |
Text |
8.2 Data Flows
| Flow Name |
Description |
Composition |
| appointment_request_data |
ข้อมูลคำขอนัดหมาย |
HN + AppointmentDate + AppointmentTime + DoctorID + ClinicCode + RoomCode + AppointmentReason + AppointmentNote + IsUrgent + CreatedBy |
| doctor_schedule_data |
ข้อมูลตารางเวรแพทย์ |
ScheduleID + DoctorID + WorkDate + StartTime + EndTime + BreakStartTime + BreakEndTime + ClinicCode + RoomCode + MaxPatientsPerDay + IsAvailable |
| appointment_validation_data |
ข้อมูลการตรวจสอบการนัด |
AppointmentID + DoctorID + AppointmentDate + AppointmentTime + MaxPatientsPerTimeSlot + CurrentAppointmentCount + ConflictCheck + AvailabilityStatus |
| attendance_record_data |
ข้อมูลการมา-ไม่มาตามนัด |
AppointmentID + HN + AttendanceStatus + AttendanceTime + AppointmentDate + AppointmentTime + DoctorID + ClinicCode + NoShowReason |
| holiday_calendar_data |
ข้อมูลปฏิทินวันหยุด |
WorkDate + IsHoliday + HolidayName + HolidayType + CreatedBy + CreatedDate |
| appointment_cancellation_data |
ข้อมูลการยกเลิกการนัด |
AppointmentID + CancellationReason + CancelledBy + CancelledDate + AppointmentStatus + NotificationRequired |
| appointment_reschedule_data |
ข้อมูลการเลื่อนนัด |
AppointmentID + RescheduleFromDate + NewAppointmentDate + NewAppointmentTime + RescheduleReason + RescheduledBy + RescheduledDate |
| notification_data |
ข้อมูลการแจ้งเตือน |
NotificationID + AppointmentID + HN + NotificationType + NotificationMessage + SentDate + IsRead + RecipientType |
| advance_visit_data |
ข้อมูลการสร้าง Visit ล่วงหน้า |
VisitIDAdvance + AppointmentID + HN + AppointmentDate + DoctorID + ClinicCode + CreatedBy + CreatedDate |
| advance_order_data |
ข้อมูลการส่งตรวจล่วงหน้า |
AppointmentID + VisitIDAdvance + OrderType + OrderCode + OrderName + UrgencyLevel + ClinicalInfo + SpecialInstructions + OrderStatus |
| pre_examination_data |
ข้อมูลการปฏิบัติก่อนพบแพทย์ |
AppointmentID + PreExaminationInstructions + LabOrderAdvance + XRayOrderAdvance + PreparationTime + SpecialRequirements |
| appointment_template_data |
ข้อมูลแม่แบบการนัด |
TemplateID + TemplateName + DoctorID + ClinicCode + DefaultDuration + DefaultInstructions + IsActive |
| print_appointment_data |
ข้อมูลการพิมพ์ใบนัด |
AppointmentID + TemplateID + PrintQuantity + PrintFormat + PrintedBy + PrintedDate + CustomContent |
| calendar_view_data |
ข้อมูลแสดงปฏิทิน |
ViewDate + DoctorID + ClinicCode + AppointmentList + ScheduleInfo + HolidayInfo + AvailableSlots |
| time_slot_data |
ข้อมูลช่วงเวลานัด |
AppointmentDate + TimeSlot + DoctorID + MaxPatients + CurrentPatients + AvailableSlots + IsBooked |
| statistics_data |
ข้อมูลสถิติ |
PeriodStart + PeriodEnd + DoctorID + ClinicCode + TotalAppointments + AttendedCount + NoShowCount + CancellationCount + AttendanceRate |
| doctor_availability_data |
ข้อมูลความพร้อมใช้งานแพทย์ |
DoctorID + CheckDate + CheckTime + IsAvailable + ScheduleStatus + AppointmentCount + RemainingSlots |
8.3 Data Stores
| Store Name |
Description |
Key Fields |
Related Entities |
| D1: Appointments |
ข้อมูลการนัดหมาย |
AppointmentID (PK), HN (FK), DoctorID (FK) |
การนัดหมาย, ผู้ป่วย, แพทย์, คลินิก |
| D2: Doctor_Schedules |
ตารางเวรแพทย์ |
ScheduleID (PK), DoctorID (FK), WorkDate |
ตารางงาน, แพทย์, คลินิก |
| D3: Attendance_Records |
ข้อมูลการมา-ไม่มาตามนัด |
AttendanceID (PK), AppointmentID (FK) |
การมาตามนัด, การนัดหมาย |
| D4: Clinic_Rooms |
ข้อมูลคลินิกและห้องตรวจ |
ClinicCode (PK), RoomCode (PK) |
คลินิก, ห้องตรวจ, แผนก |
| D5: Pre_Examination |
ข้อมูลการปฏิบัติก่อนพบแพทย์ |
PreExamID (PK), AppointmentID (FK) |
คำแนะนำ, การเตรียมตัว |
| D6: Holiday_Calendar |
ปฏิทินวันหยุด |
WorkDate (PK), HolidayType |
วันหยุดราชการ, วันหยุดพิเศษ |
| D7: Doctor_Information |
ข้อมูลแพทย์ |
DoctorID (PK) |
แพทย์, ข้อมูลส่วนตัว, ความเชี่ยวชาญ |
| D8: Patient_Data |
ข้อมูลผู้ป่วย |
HN (PK) |
ผู้ป่วย, ข้อมูลส่วนตัว |
| D9: Appointment_Templates |
แม่แบบใบนัด |
TemplateID (PK) |
แม่แบบ, รูปแบบการพิมพ์ |
| D10: Advance_Orders |
การส่งตรวจล่วงหน้า |
OrderID (PK), AppointmentID (FK) |
การส่งตรวจ, Lab, X-Ray |
| D11: Cancellation_History |
การยกเลิกเลื่อนนัด |
CancellationID (PK), AppointmentID (FK) |
ประวัติการยกเลิก, เหตุผล |
| D12: Notifications |
การแจ้งเตือน |
NotificationID (PK), AppointmentID (FK) |
การแจ้งเตือน, ข้อความ |
| D13: Schedule_Templates |
แม่แบบตารางเวร |
TemplateID (PK), DoctorID (FK) |
แม่แบบตาราง, รูปแบบงาน |
| D14: Work_Statistics |
สถิติการทำงาน |
StatID (PK), DoctorID (FK) |
สถิติ, ประสิทธิภาพ |
9. API Integration Flow
sequenceDiagram
participant AS as Appointment System
participant MRS as Medical Record System
participant USER as User
USER->>AS: 1. Request appointment<br/>(HN, Date, Doctor)
AS->>MRS: 2. Validate patient<br/>(GET /patient/{HN})
alt Patient exists
MRS-->>AS: 3. Patient data<br/>(Name, Status, Insurance)
AS->>AS: 4. Process appointment request
AS->>MRS: 5. Create appointment<br/>(POST /appointment)
MRS-->>AS: 6. Appointment confirmed<br/>(AppointmentID)
AS-->>USER: 7. Appointment created successfully
else Patient not found
MRS-->>AS: 3. Patient not found (404)
AS-->>USER: 7. Error: Invalid HN
end
Note over AS,MRS: Real-time patient validation prevents invalid appointments
9.2 การส่งข้อมูลไปยังระบบห้องตรวจและซักประวัติ
sequenceDiagram
participant AS as Appointment System
participant EXAM as Examination System
participant HIST as History System
participant DOC as Doctor
DOC->>AS: 1. Approve appointment
AS->>AS: 2. Generate appointment details
par Send to Examination System
AS->>EXAM: 3a. Patient queue data<br/>(POST /queue)
EXAM-->>AS: 4a. Queue position assigned
and Send to History System
AS->>HIST: 3b. Patient coming alert<br/>(POST /patient-alert)
HIST-->>AS: 4b. Alert registered
end
AS->>AS: 5. Update appointment status
AS-->>DOC: 6. Confirmation sent
Note over AS,HIST: Parallel API calls ensure all systems are prepared
9.3 การซิงค์ข้อมูลการส่งตรวจล่วงหน้ากับระบบ Lab และ X-Ray
sequenceDiagram
participant AS as Appointment System
participant LAB as Lab System
participant XRAY as X-Ray System
participant USER as User
USER->>AS: 1. Request advance orders<br/>(AppointmentID, OrderList)
AS->>AS: 2. Create advance visit
par Lab Orders
AS->>LAB: 3a. Submit lab orders<br/>(POST /advance-orders)
LAB->>LAB: 4a. Validate and queue
LAB-->>AS: 5a. Order confirmed<br/>(LabOrderID)
and X-Ray Orders
AS->>XRAY: 3b. Submit xray orders<br/>(POST /advance-orders)
XRAY->>XRAY: 4b. Validate and schedule
XRAY-->>AS: 5b. Order confirmed<br/>(XRayOrderID)
end
AS->>AS: 6. Update advance order status
AS-->>USER: 7. All orders confirmed
Note over AS,XRAY: Orders are queued for the appointment date
9.4 การแจ้งเตือนและการจัดการการเงิน
sequenceDiagram
participant AS as Appointment System
participant FIN as Finance System
participant PHARM as Pharmacy System
participant PAT as Patient
AS->>AS: 1. Daily reminder check
AS->>FIN: 2. Get outstanding balance<br/>(GET /patient/{HN}/balance)
FIN-->>AS: 3. Balance information
alt Has outstanding balance
AS->>AS: 4. Include payment reminder
end
AS->>PHARM: 5. Check chronic medications<br/>(GET /patient/{HN}/chronic-meds)
PHARM-->>AS: 6. Medication list
AS->>AS: 7. Prepare appointment reminder<br/>with payment & medication info
AS->>PAT: 8. Send comprehensive reminder<br/>(SMS/LINE/Email)
PAT-->>AS: 9. Confirmation response (optional)
Note over AS,PAT: Integrated reminders include financial and medical information
9.5 Error Handling และ Fallback Strategies
| Error Type |
System Impact |
Fallback Strategy |
Manual Process |
| Medical Record API Down |
Cannot validate patients |
Use cached patient data |
Manual HN verification |
| Examination System Timeout |
Queue not updated |
Store locally, sync later |
Manual queue management |
| Lab System Unavailable |
Advance orders fail |
Queue orders locally |
Manual lab submission |
| X-Ray System Error |
Imaging orders fail |
Paper-based orders |
Manual X-Ray requests |
| Finance API Timeout |
Payment status unknown |
Continue without balance check |
Manual payment verification |
| Pharmacy Connection Lost |
Med info unavailable |
Use last known medication list |
Paper medication records |
9.6 Data Integrity และ Synchronization
graph TD
START["🔄 Daily Sync Process"]
CHECK1["📋 Check Appointment Status"]
CHECK2["🔍 Verify External System Data"]
SYNC1["🔄 Sync Missing Data"]
CONFLICT["⚠️ Resolve Conflicts"]
REPORT["📊 Generate Sync Report"]
START --> CHECK1
CHECK1 --> CHECK2
CHECK2 --> SYNC1
SYNC1 --> CONFLICT
CONFLICT --> REPORT
style START fill:#e3f2fd,stroke:#0277bd,stroke-width:2px
style CONFLICT fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style REPORT fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
| Optimization |
Description |
Implementation |
| Connection Pooling |
Reuse API connections |
Configure max pool size per system |
| Async Processing |
Non-blocking API calls |
Use async/await for external calls |
| Caching Strategy |
Cache frequent data |
Redis for patient data, schedule info |
| Retry Logic |
Handle temporary failures |
Exponential backoff with max attempts |
| Load Balancing |
Distribute API load |
Round-robin for multiple endpoints |
| Data Compression |
Reduce transfer size |
GZIP compression for large payloads |
ภาคผนวก
ภาคผนวก A: Business Rules Implementation
| Rule ID |
Description |
TOR Reference |
Implementation |
| BR001 |
จำกัดจำนวนผู้ป่วยต่อแพทย์ต่อวัน |
1.2.6.1, 1.2.6.3 |
Database constraint + application validation |
| BR002 |
ตรวจสอบการซ้ำซ้อนของการนัด |
1.2.6.3 |
Composite unique index on (HN, Doctor, Date, Time) |
| BR003 |
วันหยุดไม่สามารถนัดได้ |
1.2.6.1 |
Holiday calendar check before appointment |
| BR004 |
แพทย์ต้องมีตารางเวรก่อนรับนัด |
1.2.6.1 |
Schedule validation in appointment process |
| BR005 |
การยกเลิกต้องระบุเหตุผล |
1.2.6.3 |
Required field validation |
| BR006 |
ใบนัดต้องแสดงข้อมูลตาม TOR |
1.2.6.3 |
Template validation against requirements |
ภาคผนวก B: Notification และ Reminder Matrix
| Event |
Trigger |
Recipient |
Method |
Content |
| Appointment Created |
After booking |
Patient |
SMS + Print |
Appointment details + Instructions |
| Appointment Reminder |
1 day before |
Patient |
SMS/LINE |
Date, time, preparation instructions |
| Schedule Change |
Doctor reschedule |
Affected patients |
SMS + Call |
New appointment details |
| Cancellation |
Doctor/Patient cancel |
Relevant parties |
SMS + System |
Cancellation reason + rebooking |
| No-Show Alert |
30 min after time |
Doctor + Nurse |
System alert |
Patient name + contact |
| Outstanding Payment |
Before appointment |
Patient |
SMS |
Payment reminder + amount |
ภาคผนวก C: Version History
| Version |
Date |
Changes |
Author |
| 1.0 |
09/10/2568 |
Initial version based on TOR requirements |
System Analyst |
หมายเหตุ: เอกสาร DFD นี้จัดทำขึ้นให้สอดคล้องกับ TOR ระบบนัดหมายและตารางเวรแพทย์ครบถ้วน 100% และจะมีการปรับปรุงตามการเปลี่ยนแปลงของความต้องการ