-- ============================================================
-- HealthLink-HIS 三甲医院全流程测试数据
-- 版本: v2.0 (JDK 25 + Spring Boot 4.0.6 + Vue 3)
-- 日期: 2026-06-07
-- 说明: 覆盖门诊/住院/药房/检验/影像/手术/麻醉/护理/院感/质控/中医/会诊全流程
-- 注意: 仅插入测试数据，不删除现有数据
-- ============================================================

SET search_path TO healthlink_his;

-- ============================
-- 一、基础数据（科室/人员/组织）
-- ============================

-- 1.1 测试科室（使用现有科室，补充缺失科室）
INSERT INTO sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time)
VALUES 
  (1001, 0, '0', '门诊内科', 10, '张主任', '13800000001', 'mnk@hospital.com', '0', '0', 'admin', NOW()),
  (1002, 0, '0', '门诊外科', 11, '李主任', '13800000002', 'mwk@hospital.com', '0', '0', 'admin', NOW()),
  (1003, 0, '0', '儿科门诊', 12, '王主任', '13800000003', 'ek@hospital.com', '0', '0', 'admin', NOW()),
  (1004, 0, '0', '妇产科', 13, '赵主任', '13800000004', 'fck@hospital.com', '0', '0', 'admin', NOW()),
  (1005, 0, '0', 'ICU', 14, '刘主任', '13800000005', 'icu@hospital.com', '0', '0', 'admin', NOW()),
  (1006, 0, '0', '急诊科', 15, '陈主任', '13800000006', 'jzk@hospital.com', '0', '0', 'admin', NOW()),
  (1007, 0, '0', '手术室', 16, '孙主任', '13800000007', 'ss@hospital.com', '0', '0', 'admin', NOW()),
  (1008, 0, '0', '药房', 17, '周主任', '13800000008', 'yf@hospital.com', '0', '0', 'admin', NOW()),
  (1009, 0, '0', '检验科', 18, '吴主任', '13800000009', 'jyk@hospital.com', '0', '0', 'admin', NOW()),
  (1010, 0, '0', '影像科', 19, '郑主任', '13800000010', 'yxk@hospital.com', '0', '0', 'admin', NOW()),
  (1011, 0, '0', '门诊部', 20, '黄院长', '13800000011', 'mzb@hospital.com', '0', '0', 'admin', NOW()),
  (1012, 0, '0', '住院部', 21, '杨院长', '13800000012', 'zyb@hospital.com', '0', '0', 'admin', NOW())
ON CONFLICT (dept_id) DO NOTHING;

-- 1.2 测试医生
INSERT INTO sys_user (user_id, user_name, nick_name, dept_id, email, phonenumber, sex, status, del_flag, create_by, create_time)
VALUES 
  (2001, 'doctor_zhang', '张三医生', 1001, 'zhangsan@hospital.com', '13900000001', '1', '0', '0', 'admin', NOW()),
  (2002, 'doctor_li', '李四医生', 1002, 'lisi@hospital.com', '13900000002', '1', '0', '0', 'admin', NOW()),
  (2003, 'doctor_wang', '王五医生', 1003, 'wangwu@hospital.com', '13900000003', '1', '0', '0', 'admin', NOW()),
  (2004, 'doctor_zhao', '赵六医生', 1004, 'zhaoliu@hospital.com', '13900000004', '1', '0', '0', 'admin', NOW()),
  (2005, 'doctor_liu', '刘七医生', 1005, 'liuqi@hospital.com', '13900000005', '1', '0', '0', 'admin', NOW()),
  (2006, 'doctor_chen', '陈八医生', 1006, 'chenba@hospital.com', '13900000006', '1', '0', '0', 'admin', NOW()),
  (2007, 'doctor_sun', '孙九医生', 1007, 'sunjiu@hospital.com', '13900000007', '1', '0', '0', 'admin', NOW()),
  (2008, 'doctor_zhou', '周十医生', 1008, 'zhoushi@hospital.com', '13900000008', '1', '0', '0', 'admin', NOW()),
  (2009, 'doctor_wu', '吴十一医生', 1009, 'wushiyi@hospital.com', '13900000009', '1', '0', '0', 'admin', NOW()),
  (2010, 'doctor_zheng', '郑十二医生', 1010, 'zhengershi@hospital.com', '13900000010', '1', '0', '0', 'admin', NOW())
ON CONFLICT (user_id) DO NOTHING;

-- 1.3 测试护士
INSERT INTO sys_user (user_id, user_name, nick_name, dept_id, email, phonenumber, sex, status, del_flag, create_by, create_time)
VALUES 
  (3001, 'nurse_a', '护士A', 1001, 'nursea@hospital.com', '13700000001', '2', '0', '0', 'admin', NOW()),
  (3002, 'nurse_b', '护士B', 1005, 'nurseb@hospital.com', '13700000002', '2', '0', '0', 'admin', NOW()),
  (3003, 'nurse_c', '护士C', 1006, 'nursec@hospital.com', '13700000003', '2', '0', '0', 'admin', NOW()),
  (3004, 'nurse_d', '护士D', 1007, 'nursed@hospital.com', '13700000004', '2', '0', '0', 'admin', NOW())
ON CONFLICT (user_id) DO NOTHING;

-- ============================
-- 二、测试患者数据
-- ============================

-- 2.1 门诊患者
INSERT INTO adm_patient (id, name, gender_enum, birth_date, phone, id_card, address, organization_id, tenant_id, delete_flag, create_by, create_time)
VALUES 
  (5001, '测试患者甲', 1, '1990-01-15 00:00:00+08', '13800138001', '450102199001011234', '广西南宁市青秀区民族大道100号', 1, 1, '0', 'admin', NOW()),
  (5002, '测试患者乙', 2, '1985-05-20 00:00:00+08', '13800138002', '450102198505052345', '广西南宁市兴宁区朝阳路200号', 1, 1, '0', 'admin', NOW()),
  (5003, '测试患者丙', 1, '2000-10-08 00:00:00+08', '13800138003', '450102200010103456', '广西南宁市西乡塘区大学路300号', 1, 1, '0', 'admin', NOW()),
  (5004, '测试患者丁', 2, '1975-12-25 00:00:00+08', '13800138004', '450102197512124567', '广西南宁市良庆区银海大道400号', 1, 1, '0', 'admin', NOW()),
  (5005, '测试患者戊', 1, '1965-03-10 00:00:00+08', '13800138005', '450102196503101234', '广西南宁市邕宁区蒲庙镇500号', 1, 1, '0', 'admin', NOW()),
  (5006, '测试患者己', 2, '2015-08-18 00:00:00+08', '13800138006', '450102201508186789', '广西南宁市江南区星光大道600号', 1, 1, '0', 'admin', NOW()),
  (5007, '急诊患者庚', 1, '1988-07-07 00:00:00+08', '13800138007', '450102198807071111', '广西南宁市青秀区东葛路700号', 1, 1, '0', 'admin', NOW()),
  (5008, '急诊患者辛', 2, '1992-11-11 00:00:00+08', '13800138008', '450102199211112222', '广西南宁市青秀区凤岭北路800号', 1, 1, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 三、就诊记录（门诊+住院）
-- ============================

-- 3.1 门诊就诊记录 (class_enum=1门诊, class_enum=2住院)
INSERT INTO adm_encounter (id, patient_id, status_enum, class_enum, type_enum, start_time, organization_id, tenant_id, delete_flag, create_by, create_time)
VALUES 
  -- 门诊就诊
  (6001, 5001, 2, 1, 1, '2026-06-07 09:00:00+08', 1, 1, '0', 'admin', NOW()),
  (6002, 5002, 2, 1, 1, '2026-06-07 09:30:00+08', 1, 1, '0', 'admin', NOW()),
  (6003, 5003, 2, 1, 1, '2026-06-07 10:00:00+08', 1, 1, '0', 'admin', NOW()),
  (6004, 5004, 2, 1, 1, '2026-06-07 10:30:00+08', 1, 1, '0', 'admin', NOW()),
  (6005, 5005, 2, 1, 1, '2026-06-07 11:00:00+08', 1, 1, '0', 'admin', NOW()),
  -- 住院就诊
  (6006, 5001, 2, 2, 1, '2026-06-01 14:00:00+08', 1, 1, '0', 'admin', NOW()),
  (6007, 5002, 2, 2, 1, '2026-06-02 08:00:00+08', 1, 1, '0', 'admin', NOW()),
  (6008, 5004, 2, 2, 1, '2026-06-03 10:00:00+08', 1, 1, '0', 'admin', NOW()),
  (6009, 5005, 4, 2, 1, '2026-06-04 09:00:00+08', 1, 1, '0', 'admin', NOW()),
  (6010, 5006, 2, 1, 1, '2026-06-07 14:00:00+08', 1, 1, '0', 'admin', NOW()),
  -- 急诊就诊
  (6011, 5007, 2, 1, 1, '2026-06-07 02:30:00+08', 1, 1, '0', 'admin', NOW()),
  (6012, 5008, 2, 1, 1, '2026-06-07 03:15:00+08', 1, 1, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 四、诊断数据
-- ============================

INSERT INTO adm_encounter_diagnosis (id, encounter_id, patient_id, diagnosis_type_enum, delete_flag, create_by, create_time)
VALUES 
  (7001, 6001, 5001, 1, '0', 'admin', NOW()),
  (7002, 6002, 5002, 1, '0', 'admin', NOW()),
  (7003, 6006, 5001, 1, '0', 'admin', NOW()),
  (7004, 6007, 5002, 1, '0', 'admin', NOW()),
  (7005, 6008, 5004, 1, '0', 'admin', NOW()),
  (7006, 6009, 5005, 1, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 五、检查检验数据
-- ============================

-- 5.1 检查申请
INSERT INTO check_apply (id, apply_no, encounter_id, patient_id, patient_name, id_card, fee_type, apply_date, apply_dept_id, apply_doctor_id, diagnosis_desc, check_purpose, status, total_amount, create_time)
VALUES 
  (8001, 'CK20260607001', 6001, 5001, '测试患者甲', '450102199001011234', '1', '2026-06-07 09:15:00+08', 1010, 2001, '咳嗽咳痰3天', '排除肺炎', 1, 280.00, NOW()),
  (8002, 'CK20260607002', 6002, 5002, '测试患者乙', '450102198505052345', '1', '2026-06-07 09:45:00+08', 1010, 2002, '头痛头晕1周', '排除颅内病变', 1, 560.00, NOW()),
  (8003, 'CK20260607003', 6011, 5007, '急诊患者庚', '450102198807071111', '1', '2026-06-07 02:45:00+08', 1010, 2006, '外伤后腹痛2小时', '排除脏器损伤', 1, 420.00, NOW())
ON CONFLICT (id) DO NOTHING;

-- 5.2 检查项目明细
INSERT INTO check_apply_detail (id, apply_id, check_item_name, check_part, check_method, create_time)
VALUES 
  (9001, 8001, '胸部CT平扫', '胸部', 'CT', NOW()),
  (9002, 8001, '血常规', '静脉血', '检验', NOW()),
  (9003, 8002, '头颅MRI', '头部', 'MRI', NOW()),
  (9004, 8002, '经颅多普勒', '头部', '超声', NOW()),
  (9005, 8003, '腹部CT增强', '腹部', 'CT', NOW()),
  (9006, 8003, '全血细胞计数', '静脉血', '检验', NOW())
ON CONFLICT (id) DO NOTHING;

-- 5.3 检验申请
INSERT INTO lab_apply (id, apply_no, patient_id, patient_name, apply_dept_code, apply_doc_code, apply_doc_name, apply_time, apply_status, delete_flag, create_by, create_time)
VALUES 
  (10001, 'LAB20260607001', 5001, '测试患者甲', '1009', '2009', '吴十一医生', '2026-06-07 09:20:00+08', '1', '0', 'admin', NOW()),
  (10002, 'LAB20260607002', 5002, '测试患者乙', '1009', '2009', '吴十一医生', '2026-06-07 09:50:00+08', '1', '0', 'admin', NOW()),
  (10003, 'LAB20260607003', 5006, '测试患者己', '1009', '2009', '吴十一医生', '2026-06-07 14:10:00+08', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 六、影像数据
-- ============================

INSERT INTO radiology_image_report (id, apply_no, patient_id, patient_name, report_status, create_time)
VALUES 
  (11001, 'CK20260607001', 5001, '测试患者甲', '1', NOW()),
  (11002, 'CK20260607002', 5002, '测试患者乙', '1', NOW()),
  (11003, 'CK20260607003', 5007, '急诊患者庚', '1', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 七、手术数据
-- ============================

INSERT INTO cli_surgery (id, patient_id, encounter_id, delete_flag, create_by, create_time)
VALUES 
  (12001, 5001, 6006, '0', 'admin', NOW()),
  (12002, 5004, 6008, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 八、麻醉数据
-- ============================

INSERT INTO anes_record (id, patient_id, encounter_id, delete_flag, create_by, create_time)
VALUES 
  (13001, 5001, 6006, '0', 'admin', NOW()),
  (13002, 5004, 6008, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 九、护理数据
-- ============================

-- 9.1 护理评估
INSERT INTO nursing_assessment (id, patient_id, encounter_id, assessment_type, assessment_score, risk_level, delete_flag, create_by, create_time)
VALUES 
  (14001, 5001, 6006, 'braden', 12, 'high', '0', 'admin', NOW()),
  (14002, 5002, 6007, 'morse', 45, 'high', '0', 'admin', NOW()),
  (14003, 5004, 6008, 'nrs2002', 4, 'at_risk', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- 9.2 护理记录
INSERT INTO nursing_vital_signs_chart (id, patient_id, encounter_id, temperature, pulse, respiration, blood_pressure_systolic, blood_pressure_diastolic, oxygen_saturation, delete_flag, create_by, create_time)
VALUES 
  (15001, 5001, 6006, 37.2, 78, 18, 125, 82, 98.5, '0', 'admin', NOW()),
  (15002, 5002, 6007, 36.8, 72, 16, 130, 85, 99.0, '0', 'admin', NOW()),
  (15003, 5004, 6008, 37.5, 85, 20, 140, 90, 97.5, '0', 'admin', NOW()),
  (15004, 5005, 6009, 38.2, 92, 22, 150, 95, 96.0, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 十、院感数据
-- ============================

INSERT INTO hir_infection_case (id, patient_id, encounter_id, infection_type, pathogen, report_date, delete_flag, create_by, create_time)
VALUES 
  (16001, 5001, 6006, '医院获得性肺炎', '铜绿假单胞菌', '2026-06-03 10:00:00+08', '0', 'admin', NOW()),
  (16002, 5002, 6007, '导管相关血流感染', '金黄色葡萄球菌', '2026-06-05 14:00:00+08', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

INSERT INTO hir_hand_hygiene (id, dept_id, dept_name, month, total_opportunities, compliant_count, compliance_rate, delete_flag, create_by, create_time)
VALUES 
  (17001, 1005, 'ICU', '2026-06', 1200, 1140, 95.0, '0', 'admin', NOW()),
  (17002, 1001, '门诊内科', '2026-06', 800, 720, 90.0, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 十一、质控数据
-- ============================

INSERT INTO emr_quality_score (id, encounter_id, patient_id, quality_type, score, delete_flag, create_by, create_time)
VALUES 
  (18001, 6006, 5001, '运行质控', 92.5, '0', 'admin', NOW()),
  (18002, 6007, 5002, '终末质控', 88.0, '0', 'admin', NOW()),
  (18003, 6008, 5004, '运行质控', 95.0, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 十二、中医数据
-- ============================

INSERT INTO tcm_constitution_assessment (id, patient_id, encounter_id, constitution_type, assessment_score, delete_flag, create_by, create_time)
VALUES 
  (19001, 5001, 6006, '气虚质', 65, '0', 'admin', NOW()),
  (19002, 5002, 6007, '阳虚质', 70, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

INSERT INTO tcm_prescription (id, prescription_name, prescription_type, composition, usage_method, delete_flag, create_by, create_time)
VALUES 
  (20001, '四君子汤', '补益剂', '人参、白术、茯苓、甘草', '水煎服，日一剂', '0', 'admin', NOW()),
  (20002, '六味地黄丸', '补益剂', '熟地黄、山药、泽泻、牡丹皮、茯苓、山茱萸', '口服，一次8丸，一日3次', '0', 'admin', NOW()),
  (20003, '小柴胡汤', '和解剂', '柴胡、黄芩、人参、半夏、甘草、生姜、大枣', '水煎服，日一剂', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 十三、会诊数据
-- ============================

INSERT INTO consultation_record (id, patient_id, encounter_id, consultation_type, requesting_dept, requested_dept, status, delete_flag, create_by, create_time)
VALUES 
  (21001, 5001, 6006, '科间会诊', 'ICU', '呼吸内科', '1', '0', 'admin', NOW()),
  (21002, 5002, 6007, '全院会诊', 'ICU', '心内科', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 十四、临床路径数据
-- ============================

INSERT INTO clinical_pathway (id, pathway_name, disease_name, pathway_type, status, delete_flag, create_by, create_time)
VALUES 
  (22001, '社区获得性肺炎', '社区获得性肺炎', '内科', '1', '0', 'admin', NOW()),
  (22002, '急性阑尾炎', '急性阑尾炎', '外科', '1', '0', 'admin', NOW()),
  (22003, '2型糖尿病', '2型糖尿病', '内科', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 十五、危急值数据
-- ============================

INSERT INTO critical_value (id, patient_id, encounter_id, critical_item, critical_value, report_time, status, delete_flag, create_by, create_time)
VALUES 
  (23001, 5001, 6006, '血钾', '6.8mmol/L', '2026-06-03 15:30:00+08', '1', '0', 'admin', NOW()),
  (23002, 5002, 6007, '血红蛋白', '52g/L', '2026-06-05 08:00:00+08', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 十六、电子病历数据
-- ============================

INSERT INTO doc_emr (id, encounter_id, patient_id, emr_type, emr_status, delete_flag, create_by, create_time)
VALUES 
  (24001, 6006, 5001, '入院记录', '1', '0', 'admin', NOW()),
  (24002, 6007, 5002, '入院记录', '1', '0', 'admin', NOW()),
  (24003, 6008, 5004, '入院记录', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 十七、处方数据
-- ============================

INSERT INTO med_medication_request (id, patient_id, encounter_id, request_type, status, delete_flag, create_by, create_time)
VALUES 
  (25001, 5001, 6006, '1', '1', '0', 'admin', NOW()),
  (25002, 5002, 6007, '1', '1', '0', 'admin', NOW()),
  (25003, 5004, 6008, '1', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 十八、药品库存数据
-- ============================

INSERT INTO pharmacy_stock_alert (id, medication_id, current_stock, minimum_stock, alert_level, delete_flag, create_by, create_time)
VALUES 
  (26001, 2037002083193978881, 50, 100, 'warning', '0', 'admin', NOW()),
  (26002, 1983813501487038465, 10, 50, 'critical', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 十九、抗生素管理数据
-- ============================

INSERT INTO antibiotic_approval (id, patient_id, encounter_id, antibiotic_name, approval_status, delete_flag, create_by, create_time)
VALUES 
  (27001, 5001, 6006, '头孢曲松', '1', '0', 'admin', NOW()),
  (27002, 5002, 6007, '万古霉素', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 二十、药品追溯数据
-- ============================

INSERT INTO drug_trace_code (id, drug_code, drug_name, batch_no, production_date, expiry_date, delete_flag, create_by, create_time)
VALUES 
  (28001, 'DRG001', '阿莫西林胶囊', 'B20260101', '2026-01-01', '2028-01-01', '0', 'admin', NOW()),
  (28002, 'DRG002', '布洛芬缓释胶囊', 'B20260201', '2026-02-01', '2028-02-01', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 二十一、处方点评数据
-- ============================

INSERT INTO review_plan (id, plan_name, plan_type, review_period, status, delete_flag, create_by, create_time)
VALUES 
  (29001, '2026年6月处方点评', '月度', '2026-06', '1', '0', 'admin', NOW()),
  (29002, '2026年第二季度处方点评', '季度', '2026-Q2', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 二十二、DRG分析数据
-- ============================

INSERT INTO drg_analysis_stats (id, encounter_id, drg_group, cost_weight, los_weight, delete_flag, create_by, create_time)
VALUES 
  (30001, 6006, 'ER1', 1.2, 1.0, '0', 'admin', NOW()),
  (30002, 6007, 'FR1', 0.8, 0.9, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 二十三、随访数据
-- ============================

INSERT INTO followup_plan (id, patient_id, encounter_id, followup_type, followup_date, status, delete_flag, create_by, create_time)
VALUES 
  (31001, 5001, 6006, '电话随访', '2026-06-14', '1', '0', 'admin', NOW()),
  (31002, 5002, 6007, '门诊复查', '2026-06-20', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 二十四、知情同意数据
-- ============================

INSERT INTO sys_informed_consent (id, patient_id, encounter_id, consent_type, status, delete_flag, create_by, create_time)
VALUES 
  (32001, 5001, 6006, '手术知情同意书', '1', '0', 'admin', NOW()),
  (32002, 5002, 6007, '麻醉知情同意书', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 二十五、消毒供应中心数据
-- ============================

INSERT INTO cssd_sterilize_batch (id, batch_no, sterilize_type, status, delete_flag, create_by, create_time)
VALUES 
  (33001, 'CSSD20260607001', '高压蒸汽', '1', '0', 'admin', NOW()),
  (33002, 'CSSD20260607002', '低温等离子', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 二十六、EMPI主索引数据
-- ============================

INSERT INTO empi_person (id, name, gender_enum, birth_date, id_card, phone, delete_flag, create_by, create_time)
VALUES 
  (34001, '测试患者甲', 1, '1990-01-15', '450102199001011234', '13800138001', '0', 'admin', NOW()),
  (34002, '测试患者乙', 2, '1985-05-20', '450102198505052345', '13800138002', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 二十七、ESB数据集成数据
-- ============================

INSERT INTO sys_esb_service_registry (id, service_name, service_code, service_type, status, delete_flag, create_by, create_time)
VALUES 
  (35001, '患者信息查询', 'PATIENT_QUERY', 'FHIR', '1', '0', 'admin', NOW()),
  (35002, '检验结果查询', 'LAB_RESULT_QUERY', 'HL7', '1', '0', 'admin', NOW()),
  (35003, '医嘱查询', 'ORDER_QUERY', 'FHIR', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 二十八、急诊绿色通道数据
-- ============================

INSERT INTO emergency_green_channel (id, patient_id, encounter_id, channel_type, status, delete_flag, create_by, create_time)
VALUES 
  (36001, 5007, 6011, '胸痛中心', '1', '0', 'admin', NOW()),
  (36002, 5008, 6012, '卒中中心', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 二十九、病案首页数据
-- ============================

INSERT INTO mr_homepage (id, encounter_id, patient_id, homepage_status, delete_flag, create_by, create_time)
VALUES 
  (37001, 6009, 5005, '1', '0', 'admin', NOW()),
  (37002, 6008, 5004, '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 三十、医嘱闭环数据
-- ============================

INSERT INTO order_main (id, encounter_id, patient_id, order_type, order_status, delete_flag, create_by, create_time)
VALUES 
  (38001, 6006, 5001, '1', '1', '0', 'admin', NOW()),
  (38002, 6007, 5002, '1', '1', '0', 'admin', NOW()),
  (38003, 6008, 5004, '2', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 三十一、护理质量指标数据
-- ============================

INSERT INTO nursing_quality_indicator (id, indicator_name, indicator_code, target_value, actual_value, indicator_period, delete_flag, create_by, create_time)
VALUES 
  (39001, '压疮发生率', 'NQ001', '0.5', '0.3', '2026-06', '0', 'admin', NOW()),
  (39002, '跌倒发生率', 'NQ002', '1.0', '0.8', '2026-06', '0', 'admin', NOW()),
  (39003, '导管滑脱率', 'NQ003', '0.5', '0.2', '2026-06', '0', 'admin', NOW()),
  (39004, '给药差错率', 'NQ004', '0.1', '0.05', '2026-06', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 三十二、抗菌药物使用数据
-- ============================

INSERT INTO hir_antibiotic_usage (id, patient_id, encounter_id, antibiotic_name, usage_days, ddd_value, delete_flag, create_by, create_time)
VALUES 
  (40001, 5001, 6006, '头孢曲松', 7, 2.0, '0', 'admin', NOW()),
  (40002, 5002, 6007, '万古霉素', 10, 1.5, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 三十三、病案编码(DRG)数据
-- ============================

INSERT INTO mr_drg_grouping (id, encounter_id, drg_code, drg_name, cost_weight, delete_flag, create_by, create_time)
VALUES 
  (41001, 6009, 'ER1', '呼吸系统感染', 1.2, '0', 'admin', NOW()),
  (41002, 6008, 'FR1', '急性阑尾炎', 0.8, '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 三十四、满意度调查数据
-- ============================

INSERT INTO satisfaction_survey (id, patient_id, encounter_id, survey_score, survey_type, delete_flag, create_by, create_time)
VALUES 
  (42001, 5005, 6009, 92, '出院患者', '0', 'admin', NOW()),
  (42002, 5001, 6006, 88, '住院患者', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 三十五、交接班数据
-- ============================

INSERT INTO nursing_handoff (id, from_nurse_id, to_nurse_id, handoff_time, handoff_type, status, delete_flag, create_by, create_time)
VALUES 
  (43001, 3001, 3002, '2026-06-07 08:00:00+08', '白班转夜班', '1', '0', 'admin', NOW())
ON CONFLICT (id) DO NOTHING;

-- ============================
-- 完成！
-- ============================
