Data Flow Diagram (DFD)
ระบบเวชระเบียนหลัก (Core Medical Record System)
เวอร์ชัน: 2.1 (ปรับปรุงให้สอดคล้องกับ Schema, ERD, SRS และ TOR)
วันที่: 7 ตุลาคม 2568
สอดคล้องกับ: SRS ระบบเวชระเบียน v2.0, TOR ระบบเวชระเบียน, ERD v2.0, และ Schema v2.0
สารบัญ
- ภาพรวมระบบ
- Context Diagram
- Level 0 DFD
- Level 1 DFD - การลงทะเบียนผู้ป่วย
- Level 1 DFD - การส่งตรวจผู้ป่วย
- Level 1 DFD - การจัดการแฟ้มเวชระเบียน
- Data Dictionary
- API Integration Flow
1. ภาพรวมระบบ
ระบบเวชระเบียนหลักทำหน้าที่เป็น Hub System ที่เชื่อมโยงการทำงานของระบบย่อยต่างๆ ในโรงพยาบาล โดยมีการไหลของข้อมูลหลักดังนี้:
- Input: ข้อมูลผู้ป่วย, การส่งตรวจ, การจัดการแฟ้ม
- Processing: ตรวจสอบข้อมูล, บันทึกประวัติ, จัดการสิทธิ์
- Output: เอกสารต่างๆ, คิว, สถานะแฟ้ม
- Integration: เชื่อมต่อกับระบบอื่นผ่าน API
2. Context Diagram
graph TD
%% External Entities
REG["👤 เจ้าหน้าที่ลงทะเบียน"]
MED["👨⚕️ เจ้าหน้าที่เวชระเบียน"]
NURSE["👩⚕️ พยาบาล"]
DOC["👨⚕️ แพทย์"]
PAT["👤 ผู้ป่วย"]
%% Central System
MRS["🏥 ระบบเวชระเบียนหลัก<br/>(Core Medical Record System)"]
%% External Systems
INS["💳 ระบบตรวจสอบสิทธิ<br/>(1.2.15)"]
FIN["💰 ระบบการเงิน<br/>(1.2.14)"]
PHARM["💊 ระบบเภสัชกรรม<br/>(1.2.13)"]
EXAM["🏥 ระบบห้องตรวจ<br/>(1.2.3)"]
HIST["📋 ระบบซักประวัติ<br/>(1.2.2)"]
%% Data flows from external entities to system
REG -->|"ข้อมูลผู้ป่วยใหม่<br/>การส่งตรวจ"| MRS
MED -->|"การยืม-คืนแฟ้ม<br/>การจัดการ Chart"| MRS
NURSE -->|"ข้อมูลผู้ป่วย<br/>สถานะการรักษา"| MRS
DOC -->|"คำขอข้อมูลประวัติ<br/>การนัดหมาย"| MRS
PAT -->|"ข้อมูลส่วนตัว<br/>ลายนิ้วมือ/Barcode"| MRS
%% Data flows from system to external entities
MRS -->|"บัตรผู้ป่วย<br/>ใบคิว<br/>เอกสารต่างๆ"| REG
MRS -->|"สถานะแฟ้ม<br/>รายงาน Chart"| MED
MRS -->|"ข้อมูลผู้ป่วย<br/>ประวัติการรักษา"| NURSE
MRS -->|"ประวัติผู้ป่วย<br/>ผลการตรวจ"| DOC
MRS -->|"บัตรประจำตัว<br/>ใบนัดหมาย"| PAT
%% API Integration flows
MRS <-->|"ตรวจสอบสิทธิ<br/>ข้อมูลความคุ้มครอง"| INS
MRS <-->|"ข้อมูลการเงิน<br/>ค่าบริการ"| FIN
MRS <-->|"ข้อมูลผู้ป่วย<br/>การแพ้ยา"| PHARM
MRS <-->|"คิวผู้ป่วย<br/>สถานะการตรวจ"| EXAM
MRS <-->|"ประวัติการแพ้ยา<br/>อาการผู้ป่วย"| HIST
%% Styling
style MRS fill:#e1f5fe,stroke:#01579b,stroke-width:4px
style REG fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style MED 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 PAT fill:#fff3e0,stroke:#e65100,stroke-width:2px
style INS fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
style FIN fill:#fce4ec,stroke:#880e4f,stroke-width:2px
style PHARM fill:#f1f8e9,stroke:#33691e,stroke-width:2px
style EXAM fill:#fff8e1,stroke:#f57f17,stroke-width:2px
style HIST fill:#fafafa,stroke:#424242,stroke-width:2px
3. Level 0 DFD
graph TD
%% External Entities
USER["👤 ผู้ใช้งาน"]
PATIENT["👤 ผู้ป่วย"]
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/>ข้อมูลพิเศษ<br/>(HN Merge, Notes, Mass Casualty)"]
%% Data Stores
DS1[("D1 | 👤 ข้อมูลผู้ป่วย<br/>(Patient_Master)")]
DS2[("D2 | 🏥 ข้อมูลการส่งตรวจ<br/>(Visit_Records)")]
DS3[("D3 | 📂 ข้อมูลแฟ้มเวชระเบียน<br/>(Chart_Management)")]
DS4[("D4 | 📅 ข้อมูลนัดหมาย<br/>(Appointments)")]
DS5[("D5 | 👥 ข้อมูลผู้ใช้งาน<br/>(User_Accounts)")]
DS6[("D6 | 📊 ข้อมูลมาตรฐาน<br/>(Master_Data)")]
DS8[("D8 | 📋 ประวัติการเปลี่ยน HN<br/>(HN_History)")]
DS9[("D9 | 📝 หมายเหตุผู้ป่วย<br/>(Patient_Notes)")]
DS10[("D10 | 🆔 ข้อมูลพิเศษ<br/>(Alien_Officer_Info)")]
%% Data flows from external entities
USER -->|"ข้อมูลผู้ป่วยใหม่"| P1
USER -->|"ข้อมูลการส่งตรวจ"| P2
USER -->|"คำขอยืม-คืนแฟ้ม"| P3
USER -->|"ข้อมูลการนัดหมาย"| P4
USER -->|"คำขอพิมพ์เอกสาร"| P5
USER -->|"คำขอจัดการข้อมูล"| P6
PATIENT -->|"ข้อมูลส่วนตัว<br/>ลายนิ้วมือ"| P1
PATIENT -->|"ข้อมูลประจำตัว<br/>Barcode"| P2
EXT_SYS -->|"ข้อมูลสิทธิการรักษา"| P2
EXT_SYS -->|"ข้อมูลการเงิน"| P5
%% Data flows to external entities
P1 -->|"บัตรประจำตัวผู้ป่วย"| PATIENT
P2 -->|"ใบคิว<br/>ข้อมูลการส่งตรวจ"| USER
P3 -->|"สถานะแฟ้ม<br/>รายงาน"| USER
P4 -->|"ใบนัดหมาย"| PATIENT
P5 -->|"เอกสารต่างๆ"| USER
P6 -->|"รายงานผลการดำเนินการ"| USER
P2 -->|"ข้อมูลคิวผู้ป่วย"| EXT_SYS
P1 -->|"ข้อมูลผู้ป่วยใหม่"| EXT_SYS
%% Data flows between processes and data stores
P1 <-->|"ข้อมูลผู้ป่วย"| DS1
P1 <-->|"ข้อมูลผู้ใช้งาน"| DS5
P1 <-->|"ข้อมูลมาตรฐาน"| DS6
P2 <-->|"ข้อมูลผู้ป่วย"| DS1
P2 <-->|"ข้อมูลการส่งตรวจ"| DS2
P2 <-->|"ข้อมูลแฟ้ม"| DS3
P2 <-->|"ข้อมูลมาตรฐาน"| DS6
P3 <-->|"ข้อมูลแฟ้ม"| DS3
P3 <-->|"ข้อมูลผู้ป่วย"| DS1
P3 <-->|"ข้อมูลการส่งตรวจ"| DS2
P4 <-->|"ข้อมูลนัดหมาย"| DS4
P4 <-->|"ข้อมูลผู้ป่วย"| DS1
P5 <-->|"ข้อมูลสำหรับพิมพ์"| DS1
P5 <-->|"ข้อมูลการส่งตรวจ"| DS2
P5 <-->|"ข้อมูลแฟ้ม"| DS3
P5 <-->|"ข้อมูลนัดหมาย"| DS4
P6 <-->|"ข้อมูลผู้ป่วย"| DS1
P6 <-->|"ข้อมูลการส่งตรวจ"| DS2
P6 <-->|"ประวัติการเปลี่ยน HN"| DS8
P6 <-->|"หมายเหตุผู้ป่วย"| DS9
P6 <-->|"ข้อมูลพิเศษ"| DS10
%% Inter-process data flows
P1 -->|"HN ใหม่"| P2
P2 -->|"คำขอยืมแฟ้ม"| P3
P2 -->|"ข้อมูลการนัดหมาย"| P4
P3 -->|"สถานะแฟ้ม"| P2
%% Styling
style P1 fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
style P2 fill:#e8f5e8,stroke:#388e3c,stroke-width:2px
style P3 fill:#fff3e0,stroke:#f57c00,stroke-width:2px
style P4 fill:#fce4ec,stroke:#c2185b,stroke-width:2px
style P5 fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
style P6 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
style DS1 fill:#ffebee,stroke:#d32f2f,stroke-width:2px
style DS2 fill:#e8f5e8,stroke:#388e3c,stroke-width:2px
style DS3 fill:#fff3e0,stroke:#f57c00,stroke-width:2px
style DS4 fill:#fce4ec,stroke:#c2185b,stroke-width:2px
style DS5 fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
style DS6 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
4. Level 1 DFD - การลงทะเบียนผู้ป่วย
graph TD
%% External Entities
REG_STAFF["👤 เจ้าหน้าที่ลงทะเบียน"]
PATIENT["👤 ผู้ป่วย"]
CAMERA["📷 กล้องถ่ายรูป"]
FINGER["👆 เครื่องสแกนลายนิ้วมือ"]
%% Sub-processes
P11["1.1<br/>🔍 ตรวจสอบ<br/>ข้อมูลซ้ำซ้อน<br/>(เลขบัตร/ชื่อ-นามสกุล)"]
P12["1.2<br/>📝 บันทึก<br/>ข้อมูลส่วนตัว<br/>(รวมข้อมูลพิเศษ)"]
P13["1.3<br/>🏠 บันทึก<br/>ข้อมูลที่อยู่<br/>(ปัจจุบัน/ทะเบียนบ้าน)"]
P14["1.4<br/>👨👩👧👦 บันทึก<br/>ข้อมูลครอบครัว<br/>และผู้ติดต่อ"]
P15["1.5<br/>🏥 บันทึก<br/>ข้อมูลทางการแพทย์<br/>(โรคเรื้อรัง/ประวัติครอบครัว)"]
P16["1.6<br/>📷 จัดการ<br/>รูปภาพและลายนิ้วมือ"]
P17["1.7<br/>🆔 สร้าง<br/>HN อัตโนมัติ"]
P18["1.8<br/>✅ ตรวจสอบ<br/>ความถูกต้อง<br/>และสร้าง Note เตือน"]
%% Data Stores
DS1[("D1 | 👤 ข้อมูลผู้ป่วย")]
DS5[("D5 | 👥 ข้อมูลผู้ใช้งาน")]
DS6[("D6 | 📊 ข้อมูลมาตรฐาน")]
DS7[("D7 | 🔄 Log การทำงาน")]
%% Input flows
REG_STAFF -->|"ข้อมูลผู้ป่วยใหม่"| P11
PATIENT -->|"ข้อมูลส่วนตัว"| P12
PATIENT -->|"ข้อมูลที่อยู่"| P13
PATIENT -->|"ข้อมูลครอบครัว"| P14
PATIENT -->|"ประวัติการรักษา"| P15
CAMERA -->|"รูปภาพผู้ป่วย"| P16
FINGER -->|"ลายนิ้วมือ"| P16
%% Process flows
P11 -->|"ผลการตรวจสอบ"| P12
P12 -->|"ข้อมูลพื้นฐาน"| P13
P13 -->|"ข้อมูลที่อยู่"| P14
P14 -->|"ข้อมูลครอบครัว"| P15
P15 -->|"ข้อมูลทางการแพทย์"| P16
P16 -->|"ข้อมูลสมบูรณ์"| P17
P17 -->|"HN ใหม่"| P18
%% Data store interactions
P11 <-->|"ตรวจสอบข้อมูลซ้ำ"| DS1
P11 <-->|"ข้อมูลมาตรฐาน"| DS6
P12 <-->|"บันทึกข้อมูลส่วนตัว"| DS1
P12 <-->|"ข้อมูลผู้ใช้งาน"| DS5
P12 -->|"Log การบันทึก"| DS7
P13 <-->|"บันทึกข้อมูลที่อยู่"| DS1
P13 <-->|"รหัสภูมิศาสตร์"| DS6
P14 <-->|"บันทึกข้อมูลครอบครัว"| DS1
P15 <-->|"บันทึกประวัติการรักษา"| DS1
P15 <-->|"รหัสโรค ICD-10"| DS6
P16 <-->|"บันทึกไฟล์มัลติมีเดีย"| DS1
P17 <-->|"สร้างและบันทึก HN"| DS1
P17 <-->|"ตรวจสอบ HN ซ้ำ"| DS1
P18 <-->|"ตรวจสอบข้อมูล"| DS1
P18 <-->|"สร้าง Note เตือน"| DS9
P18 <-->|"บันทึกข้อมูลพิเศษ"| DS10
P18 -->|"Log การตรวจสอบ"| DS7
%% Output flows
P18 -->|"บัตรประจำตัวผู้ป่วย"| PATIENT
P18 -->|"ยืนยันการลงทะเบียน"| REG_STAFF
P18 -->|"HN และข้อมูลผู้ป่วย"| REG_STAFF
%% Styling
style P11 fill:#ffebee,stroke:#c62828,stroke-width:2px
style P12 fill:#e3f2fd,stroke:#1565c0,stroke-width:2px
style P13 fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px
style P14 fill:#fff3e0,stroke:#ef6c00,stroke-width:2px
style P15 fill:#fce4ec,stroke:#ad1457,stroke-width:2px
style P16 fill:#f3e5f5,stroke:#6a1b9a,stroke-width:2px
style P17 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
style P18 fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
5. Level 1 DFD - การส่งตรวจผู้ป่วย
graph TD
%% External Entities
REG_STAFF["👤 เจ้าหน้าที่ลงทะเบียน"]
PATIENT["👤 ผู้ป่วย"]
FINGER["👆 เครื่องสแกนลายนิ้วมือ"]
BARCODE["📊 เครื่องอ่าน Barcode"]
EXT_INS["💳 ระบบตรวจสอบสิทธิ"]
EXT_EXAM["🏥 ระบบห้องตรวจ"]
%% Sub-processes
P21["2.1<br/>🔍 ค้นหา<br/>ผู้ป่วย<br/>(HN/ชื่อ/เลขบัตร/ลายนิ้วมือ/Barcode)"]
P22["2.2<br/>✅ ตรวจสอบ<br/>สถานะผู้ป่วย<br/>(เสียชีวิต/คำนำหน้าชื่อ)"]
P23["2.3<br/>💳 เลือก<br/>สิทธิการรักษา"]
P24["2.4<br/>📝 บันทึก<br/>ข้อมูลการส่งตรวจ<br/>(รวมถึงรูปภาพ)"]
P25["2.5<br/>🏥 จัดการ<br/>คิวและห้องตรวจ"]
P26["2.6<br/>📂 ยืมแฟ้ม<br/>อัตโนมัติ"]
P27["2.7<br/>📄 สร้าง<br/>เอกสาร"]
%% Data Stores
DS1[("D1 | 👤 ข้อมูลผู้ป่วย")]
DS2[("D2 | 🏥 ข้อมูลการส่งตรวจ")]
DS3[("D3 | 📂 ข้อมูลแฟ้มเวชระเบียน")]
DS6[("D6 | 📊 ข้อมูลมาตรฐาน")]
DS7[("D7 | 🔄 Log การทำงาน")]
%% Input flows
REG_STAFF -->|"HN/ชื่อ/เลขบัตรประชาชน"| P21
PATIENT -->|"ลายนิ้วมือ"| FINGER
PATIENT -->|"Barcode"| BARCODE
FINGER -->|"ข้อมูลลายนิ้วมือ"| P21
BARCODE -->|"ข้อมูล Barcode"| P21
REG_STAFF -->|"เลือกสิทธิการรักษา"| P23
REG_STAFF -->|"ข้อมูลการส่งตรวจ"| P24
REG_STAFF -->|"เลือกห้องตรวจ"| P25
%% External system interactions
P23 <-->|"ตรวจสอบสิทธิ"| EXT_INS
P25 <-->|"ส่งข้อมูลคิว"| EXT_EXAM
%% Process flows
P21 -->|"ข้อมูลผู้ป่วย"| P22
P22 -->|"สถานะผู้ป่วยถูกต้อง"| P23
P23 -->|"สิทธิที่เลือก"| P24
P24 -->|"ข้อมูลการส่งตรวจ"| P25
P25 -->|"คำขอยืมแฟ้ม"| P26
P24 -->|"ข้อมูลสำหรับพิมพ์"| P27
P26 -->|"สถานะการยืมแฟ้ม"| P25
%% Data store interactions
P21 <-->|"ค้นหาข้อมูลผู้ป่วย"| DS1
P21 -->|"Log การค้นหา"| DS7
P22 <-->|"ตรวจสอบสถานะ"| DS1
P22 <-->|"ประวัติการส่งตรวจ"| DS2
P23 <-->|"ข้อมูลสิทธิผู้ป่วย"| DS1
P23 <-->|"ข้อมูลสิทธิมาตรฐาน"| DS6
P24 <-->|"บันทึกการส่งตรวจ"| DS2
P24 <-->|"อัพเดตข้อมูลผู้ป่วย"| DS1
P24 -->|"Log การส่งตรวจ"| DS7
P25 <-->|"ข้อมูลห้องตรวจ"| DS6
P25 <-->|"อัพเดตสถานะคิว"| DS2
P26 <-->|"จัดการแฟ้มเวชระเบียน"| DS3
P26 <-->|"เชื่อมโยง HN"| DS1
P27 <-->|"ข้อมูลสำหรับพิมพ์"| DS1
P27 <-->|"ข้อมูลการส่งตรวจ"| DS2
%% Output flows
P22 -->|"ประวัติการรักษา"| REG_STAFF
P25 -->|"หมายเลขคิว"| PATIENT
P26 -->|"สถานะการยืมแฟ้ม"| REG_STAFF
P27 -->|"ใบคิว/ใบสั่งยา"| PATIENT
P27 -->|"ใบยืมแฟ้ม"| REG_STAFF
%% Styling
style P21 fill:#e3f2fd,stroke:#1565c0,stroke-width:2px
style P22 fill:#ffebee,stroke:#c62828,stroke-width:2px
style P23 fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px
style P24 fill:#fff3e0,stroke:#ef6c00,stroke-width:2px
style P25 fill:#fce4ec,stroke:#ad1457,stroke-width:2px
style P26 fill:#f3e5f5,stroke:#6a1b9a,stroke-width:2px
style P27 fill:#e0f2f1,stroke:#00695c,stroke-width:2px
6. Level 1 DFD - การจัดการแฟ้มเวชระเบียน
graph TD
%% External Entities
MED_STAFF["👤 เจ้าหน้าที่เวชระเบียน"]
NURSE["👩⚕️ พยาบาล"]
BARCODE_READER["📊 เครื่องอ่าน Barcode"]
PRINTER["🖨️ เครื่องพิมพ์"]
%% Sub-processes for OPD
P31["3.1<br/>📋 จัดการ<br/>แฟ้มผู้ป่วยนอก (OPD)"]
P311["3.1.1<br/>📤 ยืมแฟ้ม OPD"]
P312["3.1.2<br/>📥 คืนแฟ้ม OPD"]
P313["3.1.3<br/>🔍 ตรวจสอบ<br/>สถานะแฟ้ม OPD"]
P314["3.1.4<br/>📅 จัดการ<br/>แฟ้มนัดล่วงหน้า"]
%% Sub-processes for IPD
P32["3.2<br/>🏥 จัดการ<br/>Chart ผู้ป่วยใน (IPD)"]
P321["3.2.1<br/>📤 ยืม Chart IPD"]
P322["3.2.2<br/>📥 คืน Chart IPD"]
P323["3.2.3<br/>📊 ตรวจสอบ<br/>Chart ค้างส่ง"]
P324["3.2.4<br/>📋 รายงาน<br/>สถานะ Chart"]
%% Data Stores
DS1[("D1 | 👤 ข้อมูลผู้ป่วย")]
DS2[("D2 | 🏥 ข้อมูลการส่งตรวจ")]
DS3[("D3 | 📂 ข้อมูลแฟ้มเวชระเบียน")]
DS4[("D4 | 📅 ข้อมูลนัดหมาย")]
DS5[("D5 | 👥 ข้อมูลผู้ใช้งาน")]
DS6[("D6 | 📊 ข้อมูลมาตรฐาน")]
DS7[("D7 | 🔄 Log การทำงาน")]
%% Input flows
MED_STAFF -->|"คำขอยืมแฟ้ม OPD"| P311
MED_STAFF -->|"คำขอคืนแฟ้ม OPD"| P312
MED_STAFF -->|"คำขอตรวจสอบสถานะ"| P313
MED_STAFF -->|"คำขอจัดการแฟ้มนัด"| P314
NURSE -->|"คำขอยืม Chart IPD"| P321
NURSE -->|"คำขอคืน Chart IPD"| P322
MED_STAFF -->|"คำขอตรวจสอบ Chart"| P323
MED_STAFF -->|"คำขอรายงาน"| P324
BARCODE_READER -->|"Barcode แฟ้ม"| P311
BARCODE_READER -->|"Barcode แฟ้ม"| P312
BARCODE_READER -->|"Barcode Chart"| P321
BARCODE_READER -->|"Barcode Chart"| P322
%% Process relationships
P31 --> P311
P31 --> P312
P31 --> P313
P31 --> P314
P32 --> P321
P32 --> P322
P32 --> P323
P32 --> P324
%% Data store interactions for OPD processes
P311 <-->|"ข้อมูลผู้ป่วย"| DS1
P311 <-->|"บันทึกการยืม"| DS3
P311 <-->|"ข้อมูลการส่งตรวจ"| DS2
P311 <-->|"ข้อมูลผู้ยืม"| DS5
P311 -->|"Log การยืม"| DS7
P312 <-->|"อัพเดตการคืน"| DS3
P312 <-->|"ข้อมูลผู้คืน"| DS5
P312 -->|"Log การคืน"| DS7
P313 <-->|"สถานะแฟ้ม"| DS3
P313 <-->|"ข้อมูลผู้ป่วย"| DS1
P314 <-->|"ข้อมูลนัดหมาย"| DS4
P314 <-->|"ข้อมูลแฟ้ม"| DS3
P314 <-->|"ข้อมูลผู้ป่วย"| DS1
%% Data store interactions for IPD processes
P321 <-->|"ข้อมูล AN"| DS2
P321 <-->|"บันทึกการยืม Chart"| DS3
P321 <-->|"ข้อมูลผู้ยืม"| DS5
P321 -->|"Log การยืม Chart"| DS7
P322 <-->|"อัพเดตการคืน Chart"| DS3
P322 <-->|"ข้อมูลผู้คืน"| DS5
P322 -->|"Log การคืน Chart"| DS7
P323 <-->|"ข้อมูล Chart ค้างส่ง"| DS3
P323 <-->|"ข้อมูลหอผู้ป่วย"| DS6
P324 <-->|"รายงานสถานะ Chart"| DS3
P324 <-->|"ข้อมูลผู้ป่วยใน"| DS1
%% Output flows
P311 -->|"ใบยืมแฟ้ม"| PRINTER
P312 -->|"ยืนยันการคืน"| MED_STAFF
P313 -->|"รายงานสถานะแฟ้ม"| MED_STAFF
P314 -->|"รายชื่อผู้ป่วยนัด"| PRINTER
P321 -->|"ใบยืม Chart"| PRINTER
P322 -->|"ยืนยันการคืน Chart"| NURSE
P323 -->|"รายงาน Chart ค้างส่ง"| MED_STAFF
P324 -->|"รายงานสถานะ Chart"| PRINTER
%% Inter-process flows
P311 -->|"การยืมแฟ้มสำเร็จ"| P313
P312 -->|"การคืนแฟ้มสำเร็จ"| P313
P321 -->|"การยืม Chart สำเร็จ"| P324
P322 -->|"การคืน Chart สำเร็จ"| P324
%% Styling
style P31 fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style P32 fill:#e8f5e8,stroke:#2e7d32,stroke-width:3px
style P311 fill:#bbdefb,stroke:#1976d2,stroke-width:2px
style P312 fill:#c5cae9,stroke:#3f51b5,stroke-width:2px
style P313 fill:#d1c4e9,stroke:#673ab7,stroke-width:2px
style P314 fill:#f8bbd9,stroke:#e91e63,stroke-width:2px
style P321 fill:#c8e6c9,stroke:#4caf50,stroke-width:2px
style P322 fill:#dcedc8,stroke:#8bc34a,stroke-width:2px
style P323 fill:#fff9c4,stroke:#fbc02d,stroke-width:2px
style P324 fill:#ffccbc,stroke:#ff9800,stroke-width:2px
7. Level 1 DFD - การจัดการข้อมูลพิเศษ (Process 6.0)
graph TD
%% External Entities
ADMIN["👤 ผู้ดูแลระบบ"]
MED_STAFF["👨⚕️ เจ้าหน้าที่เวชระเบียน"]
EMERGENCY["🚨 หน่วยงานฉุกเฉิน"]
APPROVER["👨💼 ผู้อนุมัติ"]
%% Sub-processes
P61["6.1<br/>🔗 การรวม HN<br/>(HN Merge)"]
P62["6.2<br/>🔄 การเปลี่ยน HN<br/>(HN Change)"]
P63["6.3<br/>📝 การจัดการ<br/>Note เตือน"]
P64["6.4<br/>🚨 การจัดการ<br/>ภาวะประสบภัยหมู่<br/>(Mass Casualty)"]
%% Data Stores
DS1[("D1 | 👤 ข้อมูลผู้ป่วย")]
DS2[("D2 | 🏥 ข้อมูลการส่งตรวจ")]
DS5[("D5 | 👥 ข้อมูลผู้ใช้งาน")]
DS7[("D7 | 🔄 Log การทำงาน")]
DS8[("D8 | 📋 ประวัติการเปลี่ยน HN")]
DS9[("D9 | 📝 หมายเหตุผู้ป่วย")]
DS10[("D10 | 🆔 ข้อมูลพิเศษ")]
%% Input flows
ADMIN -->|"คำขอรวม HN"| P61
ADMIN -->|"คำขอเปลี่ยน HN"| P62
MED_STAFF -->|"สร้าง Note เตือน"| P63
EMERGENCY -->|"ข้อมูลภาวะฉุกเฉิน"| P64
%% Process flows
P61 -->|"คำขออนุมัติ"| APPROVER
APPROVER -->|"การอนุมัติ"| P61
P62 -->|"คำขออนุมัติ"| APPROVER
APPROVER -->|"การอนุมัติ"| P62
%% Data store interactions
P61 <-->|"ตรวจสอบ HN ที่ซ้ำ"| DS1
P61 <-->|"รวมประวัติการรักษา"| DS2
P61 -->|"บันทึกการรวม HN"| DS8
P61 -->|"Log การรวม HN"| DS7
P62 <-->|"เปลี่ยน HN ผู้ป่วย"| DS1
P62 <-->|"อัพเดต Visit Records"| DS2
P62 -->|"บันทึกการเปลี่ยน HN"| DS8
P62 -->|"Log การเปลี่ยน HN"| DS7
P63 <-->|"สร้าง/แก้ไข Note"| DS9
P63 <-->|"เชื่อมโยง HN"| DS1
P63 <-->|"ข้อมูลผู้สร้าง"| DS5
P63 -->|"Log การจัดการ Note"| DS7
P64 <-->|"ลงทะเบียนผู้ป่วยฉุกเฉิน"| DS1
P64 <-->|"สร้าง Visit ฉุกเฉิน"| DS2
P64 <-->|"บันทึกข้อมูลพิเศษ"| DS10
P64 -->|"Log ภาวะฉุกเฉิน"| DS7
%% Output flows
P61 -->|"ผลการรวม HN"| ADMIN
P62 -->|"ผลการเปลี่ยน HN"| ADMIN
P63 -->|"Note เตือนที่สร้าง"| MED_STAFF
P64 -->|"รายงานสถานการณ์"| EMERGENCY
P64 -->|"สถิติผู้ป่วยฉุกเฉิน"| ADMIN
%% Styling
style P61 fill:#ffebee,stroke:#c62828,stroke-width:2px
style P62 fill:#e3f2fd,stroke:#1565c0,stroke-width:2px
style P63 fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px
style P64 fill:#fff3e0,stroke:#ef6c00,stroke-width:2px
8. Data Dictionary
7.1 Data Elements
| Element Name |
Description |
Type |
Length |
Format |
| HN |
หมายเลขประจำตัวผู้ป่วย |
String |
10 |
XXXXXXXXXX |
| CitizenID |
เลขบัตรประจำตัวประชาชน |
String |
13 |
XXXXXXXXXXXXX |
| PassportNumber |
เลขที่หนังสือเดินทาง |
String |
20 |
Text |
| AlienID |
เลขที่บัตรแรงงานต่างด้าว |
String |
20 |
Text |
| OfficerID |
เลขที่บัตรข้าราชการ |
String |
20 |
Text |
| PatientName |
ชื่อ-นามสกุลผู้ป่วย |
String |
100 |
Text |
| DOB |
วันเดือนปีเกิด |
Date |
10 |
DD/MM/YYYY |
| Age |
อายุ |
Integer |
3 |
XXX |
| AgeInDays |
อายุเป็นวัน (สำหรับทารก) |
Integer |
5 |
XXXXX |
| Gender |
เพศ |
Char |
1 |
M/F |
| BloodGroup |
หมู่เลือด |
String |
5 |
A+/A-/B+/B-/AB+/AB-/O+/O- |
| FingerprintData |
ข้อมูลลายนิ้วมือ |
Binary |
MAX |
Binary Data |
| PhotoPath |
path รูปถ่าย |
String |
255 |
File Path |
| Address |
ที่อยู่ |
Text |
500 |
Text |
| Phone |
หมายเลขโทรศัพท์ |
String |
15 |
XXX-XXX-XXXX |
| InsuranceType |
ประเภทสิทธิการรักษา |
String |
10 |
Code |
| VisitDate |
วันที่มารับบริการ |
DateTime |
19 |
DD/MM/YYYY HH:MM:SS |
| QueueNumber |
หมายเลขคิว |
String |
10 |
XXX-XXX |
| ChartStatus |
สถานะแฟ้มเวชระเบียน |
String |
20 |
Available/Borrowed/Lost |
| UserID |
รหัสผู้ใช้งาน |
String |
20 |
Username |
7.2 Data Flows
| Flow Name |
Description |
Composition |
| patient_registration_data |
ข้อมูลการลงทะเบียนผู้ป่วย |
HN + PatientName + DOB + CitizenID + Address + Phone + Gender + BloodGroup |
| visit_data |
ข้อมูลการส่งตรวจ |
HN + VisitDate + InsuranceType + QueueNumber + DepartmentCode + UrgencyLevel |
| chart_request |
คำขอยืมแฟ้ม |
HN + BorrowerID + DepartmentCode + BorrowDate + Purpose |
| appointment_data |
ข้อมูลการนัดหมาย |
HN + AppointmentDate + DepartmentCode + DoctorCode + Note |
| insurance_validation |
ข้อมูลตรวจสอบสิทธิ |
CitizenID + InsuranceType + ValidityDate + CoverageAmount |
| hn_merge_request |
คำขอรวม HN |
OldHN + NewHN + MergeReason + ApprovalRequired |
| patient_note |
หมายเหตุผู้ป่วย |
HN + NoteText + NoteType + DisplayPeriod + Priority |
| mass_casualty_data |
ข้อมูลภาวะประสบภัยหมู่ |
IncidentID + PatientBatch + UrgencyClassification + TriageLevel |
| biometric_data |
ข้อมูลชีวมิติ |
HN + FingerprintData + PhotoData + BiometricType |
7.3 Data Stores
| Store Name |
Description |
Key Fields |
Related Entities |
| D1: Patient_Master |
ข้อมูลหลักผู้ป่วย |
HN (PK) |
ผู้ป่วย, ครอบครัว, ที่อยู่ |
| D2: Visit_Records |
บันทึกการส่งตรวจ |
VisitID (PK), HN (FK) |
การส่งตรวจ, คิว, ห้องตรวจ |
| D3: Chart_Management |
การจัดการแฟ้มเวชระเบียน |
ChartID (PK), HN (FK) |
การยืม-คืน, สถานะแฟ้ม |
| D4: Appointments |
ข้อมูลการนัดหมาย |
AppointmentID (PK), HN (FK) |
การนัดหมาย, แพทย์ |
| D5: User_Accounts |
บัญชีผู้ใช้งาน |
UserID (PK) |
ผู้ใช้งาน, สิทธิ์ |
| D6: Master_Data |
ข้อมูลมาตรฐาน |
Code (PK), Type |
รหัสต่างๆ, ค่าคงที่ |
| D7: Activity_Logs |
บันทึกการทำงาน |
LogID (PK) |
การทำงาน, ผู้ใช้ |
| D8: HN_History |
ประวัติการเปลี่ยน HN |
HNHistoryID (PK), CurrentHN (FK) |
การรวม HN, การเปลี่ยน HN |
| D9: Patient_Notes |
หมายเหตุผู้ป่วย |
NoteID (PK), HN (FK) |
Note เตือน, ข้อความสำคัญ |
| D10: Alien_Officer_Info |
ข้อมูลพิเศษ |
InfoID (PK), HN (FK) |
ข้อมูลต่างด้าว, ข้าราชการ |
8. API Integration Flow
8.1 การเชื่อมต่อกับระบบตรวจสอบสิทธิ
sequenceDiagram
participant R as Registration System
participant API as API Gateway
participant IS as Insurance System
participant DB as Database
Note over R,DB: Insurance Verification Flow
R->>API: 1. POST /api/v1/insurance/verify<br/>{HN, CitizenID, VisitDate}
API->>IS: 2. Validate insurance rights
IS->>IS: 3. Check with external services<br/>(NHSO, SSO, etc.)
IS-->>API: 4. Insurance validation result<br/>{ValidRights[], Coverage}
API-->>R: 5. Return validated rights
R->>API: 6. POST /api/v1/insurance/select<br/>{SelectedRights, BillingModifiers}
API->>DB: 7. Save selected insurance
DB-->>API: 8. Confirmation
API-->>R: 9. Selection confirmed
Note over R,DB: Error Handling
IS-->>API: 10. Service unavailable (timeout)
API-->>R: 11. Fallback: Use default rights<br/>Manual verification later
8.2 การส่งข้อมูลไปยังระบบห้องตรวจ
sequenceDiagram
participant R as Registration System
participant API as API Gateway
participant ES as Exam Room System
participant QM as Queue Management
Note over R,QM: Queue Creation Flow
R->>API: 1. POST /api/v1/queue/create<br/>{HN, PatientData, UrgencyLevel, Departments[]}
API->>QM: 2. Generate queue numbers
QM->>QM: 3. Calculate queue position<br/>based on urgency & time
QM-->>API: 4. Queue numbers assigned<br/>{QueueData[]}
loop For each department
API->>ES: 5. POST /api/v1/examroom/notify<br/>{QueueNumber, PatientInfo}
ES-->>API: 6. Queue registered
end
API-->>R: 7. Return queue information<br/>{QueueNumbers[], EstimatedTime}
Note over R,QM: Real-time Updates
ES->>API: 8. Queue status update<br/>{QueueNumber, Status: "Called"}
API->>R: 9. Notify queue status change
8.3 การซิงค์ข้อมูลกับระบบการเงิน
sequenceDiagram
participant MR as Medical Record System
participant API as API Gateway
participant FS as Finance System
participant DB as Database
Note over MR,DB: Visit Creation & Billing Setup
MR->>API: 1. POST /api/v1/finance/visit/create<br/>{VisitData, SelectedRights, ServiceCodes}
API->>FS: 2. Initialize billing record
FS->>FS: 3. Calculate base charges<br/>Apply insurance coverage
FS-->>API: 4. Billing initialized<br/>{BillingID, EstimatedCharges}
API->>DB: 5. Link visit to billing
API-->>MR: 6. Visit created with billing link
Note over MR,DB: Real-time Billing Updates
MR->>API: 7. POST /api/v1/finance/service/add<br/>{VisitID, NewServiceCodes}
API->>FS: 8. Add services to bill
FS-->>API: 9. Updated charges
API-->>MR: 10. Billing updated
Note over MR,DB: Batch Reconciliation
FS->>API: 11. Daily reconciliation request
API->>DB: 12. Fetch visit summaries
DB-->>API: 13. Visit data
API-->>FS: 14. Reconciliation data
9. การจัดการข้อผิดพลาดและ Fallback
9.1 Error Handling Matrix
| Error Type |
System Impact |
Fallback Strategy |
Manual Process |
| Network Timeout |
API calls fail |
Retry with exponential backoff |
Continue with cached data |
| Database Unavailable |
Core functions stop |
Use read-only replica |
Manual record keeping |
| Insurance System Down |
Rights verification fails |
Use default rights, verify later |
Paper-based verification |
| Exam Room System Down |
Queue management fails |
Manual queue management |
Paper queue cards |
| Finance System Down |
Billing not updated |
Queue billing updates |
Manual billing later |
9.2 Data Integrity Checks
graph TD
START["🔄 Start Data Integrity Check"]
CHECK1["📊 Check Patient Data Consistency"]
CHECK2["🔍 Validate HN Uniqueness"]
CHECK3["💳 Verify Insurance Links"]
CHECK4["📂 Audit Chart Status"]
CHECK5["📅 Validate Appointments"]
FIX1["🔧 Fix Data Inconsistencies"]
FIX2["🆔 Resolve HN Conflicts"]
FIX3["💳 Reconcile Insurance Data"]
FIX4["📂 Update Chart Status"]
FIX5["📅 Clean Invalid Appointments"]
REPORT["📋 Generate Integrity Report"]
END["✅ Data Integrity Verified"]
START --> CHECK1
CHECK1 --> CHECK2
CHECK2 --> CHECK3
CHECK3 --> CHECK4
CHECK4 --> CHECK5
CHECK1 -.->|"Issues Found"| FIX1
CHECK2 -.->|"Duplicates Found"| FIX2
CHECK3 -.->|"Mismatches Found"| FIX3
CHECK4 -.->|"Status Errors"| FIX4
CHECK5 -.->|"Invalid Data"| FIX5
FIX1 --> CHECK2
FIX2 --> CHECK3
FIX3 --> CHECK4
FIX4 --> CHECK5
FIX5 --> REPORT
CHECK5 -->|"All Clear"| REPORT
REPORT --> END
style START fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px
style END fill:#c8e6c9,stroke:#388e3c,stroke-width:2px
style REPORT fill:#fff3e0,stroke:#f57c00,stroke-width:2px
10. การตรวจสอบและ Validation
10.1 Business Rules Validation
| Rule ID |
Description |
Implementation |
| BR001 |
HN ต้องไม่ซ้ำกันในระบบ |
Database unique constraint + application check |
| BR002 |
ผู้ป่วยที่เสียชีวิตไม่สามารถส่งตรวจได้ |
Status check before visit creation |
| BR003 |
บัตรประชาชนต้องไม่ซ้ำกัน (ยกเว้น 0000000000000) |
Conditional unique constraint |
| BR004 |
การยืมแฟ้มต้องมีการคืนภายใน 30 วัน |
Automated reminder system |
| BR005 |
สิทธิการรักษาต้องตรวจสอบความถูกต้อง |
Real-time validation with external systems |
graph LR
M1["📊 Response Time<br/>Monitoring"]
M2["👥 Concurrent User<br/>Tracking"]
M3["💾 Database<br/>Performance"]
M4["🔗 API<br/>Latency"]
M5["📈 System<br/>Resources"]
DASH["📋 Performance<br/>Dashboard"]
ALERT["🚨 Alert<br/>System"]
M1 --> DASH
M2 --> DASH
M3 --> DASH
M4 --> DASH
M5 --> DASH
DASH --> ALERT
THRESH1["⚠️ Response > 3s"]
THRESH2["⚠️ Users > 100"]
THRESH3["⚠️ DB CPU > 80%"]
THRESH4["⚠️ API Timeout > 5%"]
THRESH5["⚠️ Memory > 85%"]
M1 -.->|"Threshold Exceeded"| THRESH1
M2 -.->|"Threshold Exceeded"| THRESH2
M3 -.->|"Threshold Exceeded"| THRESH3
M4 -.->|"Threshold Exceeded"| THRESH4
M5 -.->|"Threshold Exceeded"| THRESH5
THRESH1 --> ALERT
THRESH2 --> ALERT
THRESH3 --> ALERT
THRESH4 --> ALERT
THRESH5 --> ALERT
ภาคผนวก
ภาคผนวก A: Notation และ Symbol
| Symbol |
Description |
| 🟦 Process |
กระบวนการประมวลผลข้อมูล |
| 🟫 External Entity |
หน่วยงานหรือระบบภายนอก |
| 🗂️ Data Store |
ที่เก็บข้อมูล |
| ➡️ Data Flow |
การไหลของข้อมูล |
| 🔄 Bidirectional Flow |
การไหลของข้อมูลสองทิศทาง |
ภาคผนวก B: การอ้างอิงเอกสาร
- SRS ระบบเวชระเบียน v2.0 - Software Requirements Specification
- TOR ระบบเวชระเบียน - Terms of Reference
- ER Diagram ระบบเวชระเบียน - Entity Relationship Diagram
- Schema ระบบเวชระเบียน - Database Schema Design
ภาคผนวก C: Version History
| Version |
Date |
Changes |
Author |
| 1.0 |
04/10/2568 |
Initial version based on SRS |
System Analyst |
| 2.0 |
07/10/2568 |
Added API integration flows and error handling |
System Analyst |
หมายเหตุ: เอกสาร DFD นี้จัดทำขึ้นให้สอดคล้องกับ SRS และ TOR ระบบเวชระเบียน และจะมีการปรับปรุงตามการเปลี่ยนแปลงของความต้องการ