新增功能
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
-- 添加病史相关字段和血糖血压记录表
|
||||
-- 执行此SQL前请备份数据
|
||||
|
||||
-- 1. 添加病史字段到诊单表
|
||||
ALTER TABLE `zyt_tcm_diagnosis`
|
||||
ADD COLUMN `trauma_history` tinyint(1) DEFAULT 0 COMMENT '外伤史:0-无 1-有' AFTER `fatty_liver_degree`,
|
||||
ADD COLUMN `surgery_history` tinyint(1) DEFAULT 0 COMMENT '手术史:0-无 1-有' AFTER `trauma_history`,
|
||||
ADD COLUMN `allergy_history` tinyint(1) DEFAULT 0 COMMENT '过敏史:0-无 1-有' AFTER `surgery_history`,
|
||||
ADD COLUMN `family_history` tinyint(1) DEFAULT 0 COMMENT '家族病史:0-无 1-有' AFTER `allergy_history`,
|
||||
ADD COLUMN `pregnancy_history` tinyint(1) DEFAULT 0 COMMENT '妊娠哺乳史:0-无 1-有' AFTER `family_history`,
|
||||
ADD COLUMN `tongue_images` text COMMENT '舌苔照片(JSON数组)' AFTER `pregnancy_history`,
|
||||
ADD COLUMN `report_files` text COMMENT '检查报告(JSON数组)' AFTER `tongue_images`;
|
||||
|
||||
-- 2. 创建每日血糖血压记录表
|
||||
CREATE TABLE IF NOT EXISTS `zyt_tcm_blood_record` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`diagnosis_id` int(11) unsigned NOT NULL COMMENT '诊单ID',
|
||||
`patient_id` int(11) unsigned NOT NULL COMMENT '患者ID',
|
||||
`record_date` int(10) NOT NULL COMMENT '记录日期',
|
||||
`record_time` varchar(10) DEFAULT '' COMMENT '记录时间(如:08:00)',
|
||||
`blood_sugar` decimal(5,2) DEFAULT NULL COMMENT '血糖值(mmol/L)',
|
||||
`systolic_pressure` int(3) DEFAULT NULL COMMENT '收缩压(高压)mmHg',
|
||||
`diastolic_pressure` int(3) DEFAULT NULL COMMENT '舒张压(低压)mmHg',
|
||||
`remark` varchar(255) DEFAULT '' COMMENT '备注',
|
||||
`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_diagnosis_id` (`diagnosis_id`),
|
||||
KEY `idx_patient_id` (`patient_id`),
|
||||
KEY `idx_record_date` (`record_date`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='每日血糖血压记录表';
|
||||
|
||||
-- 验证字段添加
|
||||
DESC zyt_tcm_diagnosis;
|
||||
DESC zyt_tcm_blood_record;
|
||||
@@ -0,0 +1,21 @@
|
||||
-- 添加现病史相关字段到诊单表
|
||||
-- 执行此SQL前请备份数据
|
||||
|
||||
ALTER TABLE `zyt_tcm_diagnosis`
|
||||
ADD COLUMN `appetite` varchar(50) DEFAULT '' COMMENT '口腔感觉:干/苦/腻' AFTER `past_history`,
|
||||
ADD COLUMN `water_intake` varchar(50) DEFAULT '' COMMENT '每日饮水量:1瓶/1.5瓶/3瓶/4瓶' AFTER `appetite`,
|
||||
ADD COLUMN `diet_condition` varchar(100) DEFAULT '' COMMENT '饮食情况:多食/纳呆/胃胀/胃痛/反酸/食欲减退' AFTER `water_intake`,
|
||||
ADD COLUMN `weight_change` varchar(50) DEFAULT '' COMMENT '近一个月内体重变化:瘦5斤/瘦10斤/瘦10斤以上' AFTER `diet_condition`,
|
||||
ADD COLUMN `body_feeling` varchar(100) DEFAULT '' COMMENT '肢体感觉:麻木/乏力/疼痛/畏寒/烧热' AFTER `weight_change`,
|
||||
ADD COLUMN `sleep_condition` varchar(100) DEFAULT '' COMMENT '睡眠情况:入睡难/容易醒/早醒/多梦' AFTER `body_feeling`,
|
||||
ADD COLUMN `eye_condition` varchar(100) DEFAULT '' COMMENT '眼睛情况:模糊/干涩/流泪/飞蚊症/出血' AFTER `sleep_condition`,
|
||||
ADD COLUMN `head_feeling` varchar(100) DEFAULT '' COMMENT '头部感觉:疲劳困倦/头晕/头痛/耳鸣' AFTER `eye_condition`,
|
||||
ADD COLUMN `sweat_condition` varchar(100) DEFAULT '' COMMENT '出汗情况:日间出汗/夜间出汗/汗粘/多汗' AFTER `head_feeling`,
|
||||
ADD COLUMN `skin_condition` varchar(100) DEFAULT '' COMMENT '皮肤情况:干燥/瘙痒/脱皮/水肿/湿疹' AFTER `sweat_condition`,
|
||||
ADD COLUMN `urine_condition` varchar(100) DEFAULT '' COMMENT '小便情况:尿急/尿黄/有泡/尿频/尿痛/夜尿多' AFTER `skin_condition`,
|
||||
ADD COLUMN `stool_condition` varchar(100) DEFAULT '' COMMENT '大便情况:干燥/便秘/粘腻/腹泻' AFTER `urine_condition`,
|
||||
ADD COLUMN `kidney_condition` varchar(100) DEFAULT '' COMMENT '腰肾情况:酸胀/疼痛/腰痛/性功能下降' AFTER `stool_condition`,
|
||||
ADD COLUMN `fatty_liver_degree` varchar(50) DEFAULT '' COMMENT '脂肪肝程度:轻度/中度/重度' AFTER `kidney_condition`;
|
||||
|
||||
-- 验证字段添加
|
||||
DESC zyt_tcm_diagnosis;
|
||||
@@ -0,0 +1,20 @@
|
||||
-- 医生预约表
|
||||
CREATE TABLE IF NOT EXISTS `zyt_doctor_appointment` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`patient_id` int(11) NOT NULL COMMENT '患者ID',
|
||||
`doctor_id` int(11) NOT NULL COMMENT '医生ID',
|
||||
`roster_id` int(11) NOT NULL COMMENT '排班ID',
|
||||
`appointment_date` date NOT NULL COMMENT '预约日期',
|
||||
`period` enum('morning','afternoon') NOT NULL COMMENT '时段:morning=上午,afternoon=下午',
|
||||
`appointment_time` time NOT NULL COMMENT '预约时间',
|
||||
`appointment_type` varchar(20) DEFAULT 'video' COMMENT '预约类型:video=视频问诊,text=图文问诊,phone=电话问诊',
|
||||
`status` tinyint(1) DEFAULT '1' COMMENT '状态:1=已预约,2=已取消,3=已完成',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_time` int(10) unsigned DEFAULT NULL COMMENT '创建时间',
|
||||
`update_time` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `unique_appointment` (`doctor_id`,`appointment_date`,`appointment_time`,`status`) USING BTREE,
|
||||
KEY `idx_patient` (`patient_id`) USING BTREE,
|
||||
KEY `idx_doctor_date` (`doctor_id`,`appointment_date`) USING BTREE,
|
||||
KEY `idx_roster` (`roster_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生预约表';
|
||||
@@ -0,0 +1,20 @@
|
||||
-- 修复时间戳字段类型,解决 Data truncated 警告
|
||||
-- 修复患者ID字段(移除AUTO_INCREMENT,改为系统生成)
|
||||
-- 执行此SQL后,时间戳警告应该消失
|
||||
|
||||
-- 1. 修复时间戳字段类型
|
||||
ALTER TABLE zyt_tcm_diagnosis
|
||||
MODIFY COLUMN `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
MODIFY COLUMN `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
|
||||
MODIFY COLUMN `delete_time` int(10) unsigned DEFAULT NULL COMMENT '删除时间';
|
||||
|
||||
-- 2. 修复患者ID字段(如果表已存在且有AUTO_INCREMENT问题)
|
||||
-- 先删除唯一索引(如果存在)
|
||||
ALTER TABLE zyt_tcm_diagnosis DROP INDEX IF EXISTS `uk_patient_id`;
|
||||
|
||||
-- 修改patient_id字段,移除AUTO_INCREMENT
|
||||
ALTER TABLE zyt_tcm_diagnosis
|
||||
MODIFY COLUMN `patient_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '患者ID(系统生成)';
|
||||
|
||||
-- 验证修改结果
|
||||
DESC zyt_tcm_diagnosis;
|
||||
@@ -0,0 +1,184 @@
|
||||
-- 现病史字典数据
|
||||
-- 共14个字典类型,包含所有现病史相关选项
|
||||
|
||||
-- 1. 口腔感觉
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('口腔感觉', 'appetite', 1, '口腔感觉选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_appetite = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_appetite, '干', 'dry', 'appetite', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_appetite, '苦', 'bitter', 'appetite', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_appetite, '腻', 'greasy', 'appetite', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 2. 每日饮水量
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('每日饮水量', 'water_intake', 1, '每日饮水量选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_water = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_water, '1瓶矿泉水', 'one_bottle', 'water_intake', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_water, '1.5瓶矿泉水', 'one_half_bottle', 'water_intake', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_water, '3瓶矿泉水', 'three_bottles', 'water_intake', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_water, '4瓶矿泉水', 'four_bottles', 'water_intake', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 3. 饮食情况
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('饮食情况', 'diet_condition', 1, '饮食情况选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_diet = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_diet, '多食', 'overeating', 'diet_condition', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_diet, '纳呆', 'poor_appetite', 'diet_condition', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_diet, '胃胀', 'stomach_bloating', 'diet_condition', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_diet, '胃痛', 'stomach_pain', 'diet_condition', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_diet, '反酸', 'acid_reflux', 'diet_condition', 5, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_diet, '食欲减退', 'loss_of_appetite', 'diet_condition', 6, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 4. 近一个月内体重变化
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('体重变化', 'weight_change', 1, '近一个月内体重变化', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_weight = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_weight, '瘦5斤', 'lose_5_jin', 'weight_change', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_weight, '瘦10斤', 'lose_10_jin', 'weight_change', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_weight, '瘦10斤以上', 'lose_over_10_jin', 'weight_change', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 5. 肢体感觉
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('肢体感觉', 'body_feeling', 1, '肢体感觉选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_body = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_body, '麻木', 'numbness', 'body_feeling', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_body, '乏力', 'weakness', 'body_feeling', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_body, '疼痛', 'pain', 'body_feeling', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_body, '畏寒', 'cold_aversion', 'body_feeling', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_body, '烧热', 'fever', 'body_feeling', 5, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 6. 睡眠情况
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('睡眠情况', 'sleep_condition', 1, '睡眠情况选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_sleep = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_sleep, '入睡难', 'difficulty_falling_asleep', 'sleep_condition', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_sleep, '容易醒', 'easy_to_wake', 'sleep_condition', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_sleep, '早醒', 'early_waking', 'sleep_condition', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_sleep, '多梦', 'many_dreams', 'sleep_condition', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 7. 眼睛情况
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('眼睛情况', 'eye_condition', 1, '眼睛情况选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_eye = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_eye, '模糊', 'blurred', 'eye_condition', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_eye, '干涩', 'dry', 'eye_condition', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_eye, '流泪', 'tearing', 'eye_condition', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_eye, '飞蚊症', 'floaters', 'eye_condition', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_eye, '出血', 'bleeding', 'eye_condition', 5, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 8. 头部感觉
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('头部感觉', 'head_feeling', 1, '头部感觉选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_head = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_head, '疲劳困倦', 'fatigue', 'head_feeling', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_head, '头晕', 'dizziness', 'head_feeling', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_head, '头痛', 'headache', 'head_feeling', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_head, '耳鸣', 'tinnitus', 'head_feeling', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 9. 出汗情况
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('出汗情况', 'sweat_condition', 1, '出汗情况选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_sweat = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_sweat, '日间出汗', 'daytime_sweating', 'sweat_condition', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_sweat, '夜间出汗', 'night_sweating', 'sweat_condition', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_sweat, '汗粘', 'sticky_sweat', 'sweat_condition', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_sweat, '多汗', 'excessive_sweating', 'sweat_condition', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 10. 皮肤情况
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('皮肤情况', 'skin_condition', 1, '皮肤情况选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_skin = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_skin, '干燥', 'dry', 'skin_condition', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_skin, '瘙痒', 'itching', 'skin_condition', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_skin, '脱皮', 'peeling', 'skin_condition', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_skin, '水肿', 'edema', 'skin_condition', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_skin, '湿疹', 'eczema', 'skin_condition', 5, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 11. 小便情况
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('小便情况', 'urine_condition', 1, '小便情况选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_urine = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_urine, '尿急', 'urgency', 'urine_condition', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_urine, '尿黄', 'yellow_urine', 'urine_condition', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_urine, '有泡', 'foamy', 'urine_condition', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_urine, '尿频', 'frequency', 'urine_condition', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_urine, '尿痛', 'painful', 'urine_condition', 5, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_urine, '夜尿多', 'nocturia', 'urine_condition', 6, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 12. 大便情况
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('大便情况', 'stool_condition', 1, '大便情况选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_stool = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_stool, '干燥', 'dry', 'stool_condition', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_stool, '便秘', 'constipation', 'stool_condition', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_stool, '粘腻', 'sticky', 'stool_condition', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_stool, '腹泻', 'diarrhea', 'stool_condition', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 13. 腰肾情况
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('腰肾情况', 'kidney_condition', 1, '腰肾情况选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_kidney = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_kidney, '酸胀', 'soreness', 'kidney_condition', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_kidney, '疼痛', 'pain', 'kidney_condition', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_kidney, '腰痛', 'lower_back_pain', 'kidney_condition', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_kidney, '性功能下降', 'sexual_dysfunction', 'kidney_condition', 4, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 14. 脂肪肝程度
|
||||
INSERT INTO `zyt_dict_type` (`name`, `type`, `status`, `remark`, `create_time`, `update_time`)
|
||||
VALUES ('脂肪肝程度', 'fatty_liver_degree', 1, '脂肪肝程度选项', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
SET @type_id_fatty = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO `zyt_dict_data` (`type_id`, `name`, `value`, `type_value`, `sort`, `status`, `remark`, `create_time`, `update_time`) VALUES
|
||||
(@type_id_fatty, '轻度', 'mild', 'fatty_liver_degree', 1, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_fatty, '中度', 'moderate', 'fatty_liver_degree', 2, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(@type_id_fatty, '重度', 'severe', 'fatty_liver_degree', 3, 1, '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 验证插入结果
|
||||
SELECT dt.name as '字典类型', COUNT(dd.id) as '选项数量'
|
||||
FROM zyt_dict_type dt
|
||||
LEFT JOIN zyt_dict_data dd ON dt.id = dd.type_id
|
||||
WHERE dt.type IN ('appetite', 'water_intake', 'diet_condition', 'weight_change', 'body_feeling',
|
||||
'sleep_condition', 'eye_condition', 'head_feeling', 'sweat_condition', 'skin_condition',
|
||||
'urine_condition', 'stool_condition', 'kidney_condition', 'fatty_liver_degree')
|
||||
GROUP BY dt.name
|
||||
ORDER BY dt.id;
|
||||
@@ -0,0 +1,23 @@
|
||||
-- 通话记录表
|
||||
CREATE TABLE IF NOT EXISTS `la_tcm_call_record` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`diagnosis_id` int(11) NOT NULL DEFAULT '0' COMMENT '诊单ID',
|
||||
`caller_id` int(11) NOT NULL DEFAULT '0' COMMENT '呼叫方ID',
|
||||
`caller_type` varchar(20) NOT NULL DEFAULT '' COMMENT '呼叫方类型:doctor-医生 patient-患者',
|
||||
`callee_id` int(11) NOT NULL DEFAULT '0' COMMENT '被叫方ID',
|
||||
`callee_type` varchar(20) NOT NULL DEFAULT '' COMMENT '被叫方类型:doctor-医生 patient-患者',
|
||||
`call_type` tinyint(1) NOT NULL DEFAULT '2' COMMENT '通话类型:1-语音通话 2-视频通话',
|
||||
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:1-进行中 2-已结束 3-未接听 4-已取消',
|
||||
`start_time` int(11) NOT NULL DEFAULT '0' COMMENT '开始时间',
|
||||
`end_time` int(11) NOT NULL DEFAULT '0' COMMENT '结束时间',
|
||||
`duration` int(11) NOT NULL DEFAULT '0' COMMENT '通话时长(秒)',
|
||||
`room_id` varchar(100) NOT NULL DEFAULT '' COMMENT '房间ID',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
|
||||
`delete_time` int(11) DEFAULT NULL COMMENT '删除时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_diagnosis_id` (`diagnosis_id`),
|
||||
KEY `idx_caller_id` (`caller_id`),
|
||||
KEY `idx_callee_id` (`callee_id`),
|
||||
KEY `idx_create_time` (`create_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='通话记录表';
|
||||
@@ -0,0 +1,119 @@
|
||||
-- 中医辨房病因诊单表
|
||||
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 '备注',
|
||||
`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());
|
||||
@@ -0,0 +1,40 @@
|
||||
-- 中医诊单菜单和权限配置
|
||||
-- 注意:需要根据实际的菜单表结构调整字段名称
|
||||
|
||||
-- 1. 添加一级菜单:中医管理
|
||||
INSERT INTO `zyt_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
|
||||
VALUES (0, 'M', '中医管理', 'el-icon-Memo', 100, '', '/tcm', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 获取刚插入的一级菜单ID
|
||||
SET @pid = LAST_INSERT_ID();
|
||||
|
||||
-- 2. 添加二级菜单:中医诊单
|
||||
INSERT INTO `zyt_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
|
||||
VALUES (@pid, 'C', '中医诊单', '', 1, 'tcm.diagnosis/lists', '/tcm/diagnosis', '/tcm/diagnosis/index', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 获取二级菜单ID
|
||||
SET @menu_id = LAST_INSERT_ID();
|
||||
|
||||
-- 3. 添加按钮权限:查看
|
||||
INSERT INTO `zyt_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
|
||||
VALUES (@menu_id, 'A', '查看', '', 1, 'tcm.diagnosis/detail', '', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 4. 添加按钮权限:新增
|
||||
INSERT INTO `zyt_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
|
||||
VALUES (@menu_id, 'A', '新增', '', 2, 'tcm.diagnosis/add', '', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 5. 添加按钮权限:编辑
|
||||
INSERT INTO `zyt_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
|
||||
VALUES (@menu_id, 'A', '编辑', '', 3, 'tcm.diagnosis/edit', '', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 6. 添加按钮权限:删除
|
||||
INSERT INTO `zyt_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
|
||||
VALUES (@menu_id, 'A', '删除', '', 4, 'tcm.diagnosis/delete', '', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 说明:
|
||||
-- type: M-目录 C-菜单 A-按钮
|
||||
-- perms: 权限标识,对应后端控制器方法
|
||||
-- paths: 前端路由路径
|
||||
-- component: 前端组件路径
|
||||
-- is_show: 是否显示在菜单中
|
||||
-- is_disable: 是否禁用
|
||||
@@ -0,0 +1,18 @@
|
||||
-- 患者 TRTC 账号表
|
||||
CREATE TABLE IF NOT EXISTS `la_tcm_patient_trtc` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`patient_id` int(11) NOT NULL DEFAULT '0' COMMENT '患者ID',
|
||||
`user_id` varchar(100) NOT NULL DEFAULT '' COMMENT 'TRTC用户ID',
|
||||
`user_sig` text COMMENT 'UserSig签名',
|
||||
`sdk_app_id` int(11) NOT NULL DEFAULT '0' COMMENT 'SDKAppID',
|
||||
`expire_time` int(11) NOT NULL DEFAULT '0' COMMENT '过期时间',
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否激活:0-未激活 1-已激活',
|
||||
`last_login_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后登录时间',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
|
||||
`delete_time` int(11) DEFAULT NULL COMMENT '删除时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_patient_id` (`patient_id`),
|
||||
KEY `idx_user_id` (`user_id`),
|
||||
KEY `idx_create_time` (`create_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='患者TRTC账号表';
|
||||
@@ -0,0 +1,52 @@
|
||||
-- 测试数据:创建医生排班
|
||||
-- 请根据实际情况修改 doctor_id
|
||||
|
||||
-- 为医生ID=1创建未来7天的排班数据
|
||||
INSERT INTO `la_doctor_roster` (`doctor_id`, `date`, `period`, `status`, `quota`, `max_patients`, `create_time`, `update_time`)
|
||||
VALUES
|
||||
-- 今天
|
||||
(1, CURDATE(), 'morning', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(1, CURDATE(), 'afternoon', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
|
||||
-- 明天
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 1 DAY), 'morning', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 1 DAY), 'afternoon', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
|
||||
-- 后天
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 2 DAY), 'morning', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 2 DAY), 'afternoon', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
|
||||
-- 第4天
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 3 DAY), 'morning', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 3 DAY), 'afternoon', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
|
||||
-- 第5天
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 4 DAY), 'morning', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 4 DAY), 'afternoon', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
|
||||
-- 第6天
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 5 DAY), 'morning', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 5 DAY), 'afternoon', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
|
||||
-- 第7天
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 6 DAY), 'morning', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
||||
(1, DATE_ADD(CURDATE(), INTERVAL 6 DAY), 'afternoon', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||
|
||||
-- 查询验证
|
||||
SELECT
|
||||
id,
|
||||
doctor_id,
|
||||
date,
|
||||
period,
|
||||
CASE
|
||||
WHEN status = 1 THEN '出诊'
|
||||
WHEN status = 2 THEN '停诊'
|
||||
WHEN status = 3 THEN '休息'
|
||||
WHEN status = 4 THEN '请假'
|
||||
END as status_text,
|
||||
quota,
|
||||
max_patients
|
||||
FROM la_doctor_roster
|
||||
WHERE doctor_id = 1
|
||||
AND date >= CURDATE()
|
||||
ORDER BY date, period;
|
||||
@@ -0,0 +1,8 @@
|
||||
-- 修改预约表的 period 字段,允许存储 'all' 值
|
||||
-- 将 ENUM 改为 VARCHAR 以支持更灵活的时段类型
|
||||
|
||||
ALTER TABLE `la_doctor_appointment`
|
||||
MODIFY COLUMN `period` varchar(20) NOT NULL DEFAULT 'all' COMMENT '时段:morning=上午,afternoon=下午,all=全天';
|
||||
|
||||
-- 更新现有数据(如果需要)
|
||||
-- UPDATE `la_doctor_appointment` SET `period` = 'all' WHERE `period` = '';
|
||||
@@ -0,0 +1,70 @@
|
||||
-- 更新既往史字典数据
|
||||
-- 添加50种常见疾病选项
|
||||
-- 执行前请确保已有 past_history 字典类型
|
||||
|
||||
-- 获取既往史字典类型ID
|
||||
SET @type_id = (SELECT id FROM zyt_dict_type WHERE type = 'past_history' LIMIT 1);
|
||||
|
||||
-- 先删除旧的既往史数据(如果需要)
|
||||
-- DELETE FROM zyt_dict_data WHERE type_value = 'past_history';
|
||||
|
||||
-- 插入新的既往史选项(共50项)
|
||||
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())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`name` = VALUES(`name`),
|
||||
`sort` = VALUES(`sort`),
|
||||
`update_time` = UNIX_TIMESTAMP();
|
||||
|
||||
-- 验证插入结果
|
||||
SELECT COUNT(*) as total_count FROM zyt_dict_data WHERE type_value = 'past_history';
|
||||
SELECT * FROM zyt_dict_data WHERE type_value = 'past_history' ORDER BY sort;
|
||||
Reference in New Issue
Block a user