Files
zyt/server/sql/tcm_diagnosis.sql
T
2026-05-11 17:49:38 +08:00

121 lines
9.6 KiB
SQL
Executable File

-- 中医辨房病因诊单表
CREATE TABLE IF NOT EXISTS `zyt_tcm_diagnosis` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`patient_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '患者ID(系统生成)',
`patient_name` varchar(50) NOT NULL DEFAULT '' COMMENT '患者姓名',
`id_card` varchar(18) DEFAULT '' COMMENT '身份证号',
`phone` varchar(11) DEFAULT '' COMMENT '手机号',
`gender` tinyint(1) NOT NULL DEFAULT '0' COMMENT '性别:0-女 1-男',
`age` int(3) NOT NULL DEFAULT '0' COMMENT '年龄',
`diagnosis_date` int(10) NOT NULL DEFAULT '0' COMMENT '诊断日期',
`diagnosis_type` varchar(50) NOT NULL DEFAULT '' COMMENT '诊断类型',
`syndrome_type` varchar(100) NOT NULL DEFAULT '' COMMENT '证型',
`past_history` text COMMENT '既往史(多选,逗号分隔)',
`symptoms` text COMMENT '症状',
`tongue_coating` varchar(50) DEFAULT '' COMMENT '舌苔',
`pulse` varchar(50) DEFAULT '' COMMENT '脉象',
`treatment_principle` text COMMENT '治则',
`prescription` text COMMENT '处方',
`doctor_advice` text COMMENT '医嘱',
`remark` text COMMENT '备注',
`current_medications` varchar(2000) NOT NULL DEFAULT '' COMMENT '在用药物',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:0-禁用 1-启用',
`create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
`delete_time` int(10) unsigned DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
KEY `idx_patient_name` (`patient_name`),
KEY `idx_phone` (`phone`),
KEY `idx_diagnosis_date` (`diagnosis_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='中医辨房病因诊单表';
-- 插入字典类型:既往史
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
VALUES ('既往史', 'past_history', 1, '中医诊断既往史选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
-- 获取刚插入的字典类型ID(需要根据实际情况调整)
SET @type_id = LAST_INSERT_ID();
-- 插入字典数据:既往史选项(共60项)
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
(@type_id, '高血压', 'hypertension', 'past_history', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '糖尿病', 'diabetes', 'past_history', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '胃溃疡', 'gastric_ulcer', 'past_history', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '高血脂', 'hyperlipidemia', 'past_history', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '甲状腺结节', 'thyroid_nodule', 'past_history', 5, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '浅表性胃炎', 'superficial_gastritis', 'past_history', 6, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '胃病', 'stomach_disease', 'past_history', 7, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '脑梗', 'cerebral_infarction', 'past_history', 8, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '乳腺结节', 'breast_nodule', 'past_history', 9, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '萎缩性胃炎', 'atrophic_gastritis', 'past_history', 10, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '心脏病', 'heart_disease', 'past_history', 11, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '脑缺血', 'cerebral_ischemia', 'past_history', 12, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '肠梗阻', 'intestinal_obstruction', 'past_history', 13, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '甲肝', 'hepatitis_a', 'past_history', 14, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '乙肝', 'hepatitis_b', 'past_history', 15, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '丙肝', 'hepatitis_c', 'past_history', 16, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '大三阳', 'big_three_positive', 'past_history', 17, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '脑血栓', 'cerebral_thrombosis', 'past_history', 18, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '冠心病', 'coronary_heart_disease', 'past_history', 19, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '心绞痛', 'angina_pectoris', 'past_history', 20, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '心悸', 'palpitation', 'past_history', 21, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '肾功能不全', 'renal_insufficiency', 'past_history', 22, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '良性肿瘤', 'benign_tumor', 'past_history', 23, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '胰腺炎', 'pancreatitis', 'past_history', 24, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '小三阳', 'small_three_positive', 'past_history', 25, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '心慌', 'palpitations', 'past_history', 26, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '水肿', 'edema', 'past_history', 27, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '传染病', 'infectious_disease', 'past_history', 28, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '眼底充血', 'fundus_congestion', 'past_history', 29, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '肺结核', 'tuberculosis', 'past_history', 30, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '肺炎', 'pneumonia', 'past_history', 31, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '肺结节', 'pulmonary_nodule', 'past_history', 32, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '心脏支架', 'cardiac_stent', 'past_history', 33, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '肾脏支架', 'renal_stent', 'past_history', 34, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '肝炎', 'hepatitis', 'past_history', 35, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '肿瘤', 'tumor', 'past_history', 36, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '肺气肿', 'emphysema', 'past_history', 37, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '中度脂肪肝', 'moderate_fatty_liver', 'past_history', 38, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '腔梗', 'lacunar_infarction', 'past_history', 39, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '酒精肝', 'alcoholic_liver', 'past_history', 40, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '脑萎缩', 'brain_atrophy', 'past_history', 41, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '肝囊肿', 'liver_cyst', 'past_history', 42, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '中风', 'stroke', 'past_history', 43, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '脑出血', 'cerebral_hemorrhage', 'past_history', 44, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '肝功能不全', 'hepatic_insufficiency', 'past_history', 45, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '动脉斑块', 'arterial_plaque', 'past_history', 46, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '子宫肌瘤', 'uterine_fibroids', 'past_history', 47, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '脾大', 'splenomegaly', 'past_history', 48, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '胃穿孔', 'gastric_perforation', 'past_history', 49, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id, '胃出血', 'gastric_bleeding', 'past_history', 50, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
-- 插入字典类型:诊断类型
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
VALUES ('诊断类型', 'diagnosis_type', 1, '中医诊断类型', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
SET @type_id2 = LAST_INSERT_ID();
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
(@type_id2, '初诊', 'first_visit', 'diagnosis_type', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id2, '复诊', 'follow_up', 'diagnosis_type', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id2, '会诊', 'consultation', 'diagnosis_type', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
-- 插入字典类型:证型
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
VALUES ('证型', 'syndrome_type', 1, '中医证型分类', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
SET @type_id3 = LAST_INSERT_ID();
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
(@type_id3, '气虚', 'qi_deficiency', 'syndrome_type', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id3, '血虚', 'blood_deficiency', 'syndrome_type', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id3, '阴虚', 'yin_deficiency', 'syndrome_type', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id3, '阳虚', 'yang_deficiency', 'syndrome_type', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id3, '气滞', 'qi_stagnation', 'syndrome_type', 5, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id3, '血瘀', 'blood_stasis', 'syndrome_type', 6, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id3, '痰湿', 'phlegm_dampness', 'syndrome_type', 7, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id3, '湿热', 'damp_heat', 'syndrome_type', 8, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id3, '寒湿', 'cold_dampness', 'syndrome_type', 9, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id3, '风寒', 'wind_cold', 'syndrome_type', 10, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@type_id3, '风热', 'wind_heat', 'syndrome_type', 11, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());