ALTER table wlyy_outpatient add COLUMN `plan_id` varchar(50) DEFAULT NULL COMMENT '康复执行计划关联id';
ALTER table wlyy_outpatient add COLUMN `plan_doctor` varchar(50) DEFAULT NULL COMMENT '康复执行计划负责人id';

--中山医院那套有就不加了 ALTER table base_suggestion add COLUMN `suggest_user_idcard` varchar(50) DEFAULT NULL COMMENT '投诉人身份证';
-- ALTER table base_suggestion add COLUMN `user_idcard_front` varchar(255) DEFAULT NULL COMMENT '投诉人身份证正面url';
-- ALTER table base_suggestion add COLUMN `user_idcard_bak` varchar(255) DEFAULT NULL COMMENT '投诉人身份证反面url';
-- ALTER table base_suggestion add COLUMN `vitist_type` varchar(50) DEFAULT NULL COMMENT '就诊类型 1门诊 2住院';
-- ALTER table base_suggestion add COLUMN `vitist_time` varchar(50) DEFAULT NULL COMMENT '就诊时间';
-- ALTER table base_suggestion add COLUMN `vitist_dept_code` varchar(50) DEFAULT NULL COMMENT '就诊科室编码';
-- ALTER table base_suggestion add COLUMN `vitist_detp_name` varchar(50) DEFAULT NULL COMMENT '就诊科室名称';
-- ALTER table base_suggestion add COLUMN `admission_no` varchar(50) DEFAULT NULL COMMENT '住院号';

ALTER table base_menu_dict add COLUMN `article_type` varchar(2) DEFAULT NULL COMMENT '文章类型 公告、广告、文章、帮助中心 article_menu_type';

INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('article_menu_type1', NULL, 'article_menu_type', '1', '公告', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '文章类型 公告、广告、文章、帮助中心');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('article_menu_type2', NULL, 'article_menu_type', '2', '广告', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '文章类型 公告、广告、文章、帮助中心');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('article_menu_type3', NULL, 'article_menu_type', '3', '文章', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '文章类型 公告、广告、文章、帮助中心');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('article_menu_type4', NULL, 'article_menu_type', '4', '帮助中心', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '文章类型 公告、广告、文章、帮助中心');


ALTER table wlyy_devices add COLUMN `qrcode` varchar(255) DEFAULT NULL COMMENT '二维码地址';
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('devicePriUrl', NULL, 'devicePriUrl', 'devicePriUrl', 'https://hlw.xmdsyy.cn/hlw/ims-wx/#/healthRecords/deviceBind?SN=', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '设备二维码前缀');

ALTER table base_knowledge_question add COLUMN `scene_code` varchar(50) DEFAULT NULL COMMENT '使用场景编码 逗号间隔';
ALTER table base_knowledge_question add COLUMN `scene_name` varchar(200) DEFAULT NULL COMMENT '使用场景名称 逗号间隔';
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('knowledge_question_scene1', NULL, 'knowledge_question_scene', '1', '在线导诊', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '使用场景');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('knowledge_question_scene2', NULL, 'knowledge_question_scene', '2', '专属服务导诊', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '使用场景');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('knowledge_question_scene3', NULL, 'knowledge_question_scene', '3', '在线候诊室', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '使用场景');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('knowledge_question_scene4', NULL, 'knowledge_question_scene', '4', '在线诊室', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '使用场景');


ALTER table wlyy_patient_family_member add COLUMN `medicare` varchar(50) DEFAULT NULL COMMENT '社保卡';

INSERT INTO `base`.`oauth_wlyy_config` (`id`, `app_id`, `app_secret`, `token_url`, `url`, `remark`) VALUES
    ('getDoctorList', '019bd04d-3cb2-433f-a530-03f0cdb083e5', '08cc3ec2-736b-4732-a8f0-f99eb6f9d311', 'https://www.xmtyw.cn/wlyytest/gc/accesstoken', 'https://www.xmtyw.cn/wlyytest/wlyygc/tongan/hospital/getDoctorList', '厦门I健康获取社区医生列表');

INSERT INTO `base`.`wx_wechat` (`id`, `name`, `token`, `encoding_aes_key`, `enc_type`, `status`, `type`, `app_id`, `app_secret`, `app_origin_id`, `base_url`, `user_name`, `password`, `public_type`, `create_user`, `create_user_name`, `create_time`, `update_user`, `update_user_name`, `update_time`, `remark`, `mch_id`, `cerfiticate`, `app_key`, `syn_path`, `applets`, `applets_secret`) VALUES ('xm_ihealth_wx', '厦门I健康', NULL, NULL, '1', '1', NULL, 'wx79a7f451c8c30308', 'fc96ec810e5078c0ca0f96a8fca4da95', 'gh#_a09552a72c9b', NULL, NULL, NULL, NULL, NULL, NULL, '2022-03-29 10:15:02', NULL, NULL, '1970-01-02 00:00:00', NULL, NULL, NULL, NULL, 'https://www.xmtyw.cn/wlyy/iHealth/userInfo', NULL, NULL);






-------------------------------------------------------------------------------------------------------------------------

-- 20240220 新增
ALTER TABLE `base`.`wlyy_outpatient`
ADD COLUMN `is_positive` varchar(255) NULL COMMENT '是否新冠阳性 1是0否' AFTER `plan_doctor`,
ADD COLUMN `inquiry_sign` varchar(255) NULL COMMENT '问诊标识1发热咨询0普通门诊' AFTER `is_positive`,
ADD COLUMN `visit_type` varchar(255) NULL COMMENT '就诊类型：1首诊2复诊' AFTER `inquiry_sign`,
ADD COLUMN `virus_flag` varchar(255) NULL COMMENT '新冠病毒：1阴性、2阳性、0无' AFTER `visit_type`,
ADD COLUMN `is_disease` varchar(255) NULL COMMENT '特殊病种1是0否' AFTER `virus_flag`;

-- 2024-02-26
ALTER TABLE `base`.`wlyy_knowledge_category`
    ADD COLUMN `is_check` tinyint(1) NULL COMMENT '是否开启审核1开启 0关闭， 默认开启' ;




INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_custom1', NULL, 'patient_lable_custom', '1', '儿童', NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签自定义');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_custom2', NULL, 'patient_lable_custom', '2', '孕妇女', NULL, '2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签自定义');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_custom3', NULL, 'patient_lable_custom', '3', '65岁以上', NULL, '3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签自定义');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_health1', NULL, 'patient_lable_health', '1', '健康人群', NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '健康情况标签');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_health2', NULL, 'patient_lable_health', '2', '高危人群', NULL, '2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '健康情况标签');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_health3', NULL, 'patient_lable_health', '3', '患病人群', NULL, '3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '健康情况标签');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_health4', NULL, 'patient_lable_health', '4', '恢复期人群', NULL, '4', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '健康情况标签');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_disease_type1', NULL, 'patient_lable_disease_type', '1', '高血压', NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签_疾病类型');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_disease_type2', NULL, 'patient_lable_disease_type', '2', '糖尿病', NULL, '2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签_疾病类型');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_disease_type3', NULL, 'patient_lable_disease_type', '3', '慢性支气管炎', NULL, '3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签_疾病类型');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_disease_type4', NULL, 'patient_lable_disease_type', '4', '脑梗塞', NULL, '4', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签_疾病类型');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_disease_type5', NULL, 'patient_lable_disease_type', '5', '冠心病', NULL, '5', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签_疾病类型');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_disease_type6', NULL, 'patient_lable_disease_type', '6', '呼吸系统疾病', NULL, '6', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签_疾病类型');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_disease_type7', NULL, 'patient_lable_disease_type', '7', '骨性关节疾病', NULL, '7', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签_疾病类型');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_disease_type8', NULL, 'patient_lable_disease_type', '8', '结核病', NULL, '8', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签_疾病类型');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_disease_type9', NULL, 'patient_lable_disease_type', '9', '残疾', NULL, '9', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签_疾病类型');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_disease_type10', NULL, 'patient_lable_disease_type', '10', '重性精神疾病', NULL, '10', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签_疾病类型');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('patient_lable_disease_type11', NULL, 'patient_lable_disease_type', '11', '其他疾病', NULL, '11', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民标签_疾病类型');

CREATE TABLE `wlyy_patient_label_log` (
     `id` int NOT NULL AUTO_INCREMENT,,
     `patient` varchar(50) DEFAULT NULL,
     `doctor` varchar(50) DEFAULT NULL,
     `doctor_name` varchar(50) DEFAULT NULL,
     `label_code` varchar(50) DEFAULT NULL,
     `label_name` varchar(50) DEFAULT NULL,
     `label_type` varchar(50) DEFAULT NULL,
     `job_title` varchar(50) DEFAULT NULL,
     `create_time` datetime DEFAULT NULL,
     PRIMARY KEY (`id`),
     KEY `index` (`patient`,`doctor`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;


-------- 慢病管理------
CREATE TABLE `wlyy_doctor_switch` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `doctor` varchar(50) DEFAULT NULL COMMENT '关联医生',
  `alert_patient_switch` varchar(2) DEFAULT '0' COMMENT '0不自动跟踪居民，1自动跟踪预警居民',
  `dispatch_order_switch` varchar(2) DEFAULT '0' COMMENT '0关闭分派订单功能，1开启分派订单功能',
  `create_time` timestamp NULL DEFAULT NULL,
  `update_time` timestamp NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=870 DEFAULT CHARSET=utf8;

CREATE TABLE `wlyy_doctor_scheme_blood_sugger` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '数据库主键，与业务主键无关',
  `name` varchar(20) DEFAULT NULL COMMENT '方案名称',
  `code` varchar(50) NOT NULL COMMENT '业务主键UUID',
  `doctorcode` varchar(50) DEFAULT NULL COMMENT '医生CODE',
  `dayofweek` tinyint(4) NOT NULL COMMENT '1到7递增，1为星期日，7为星期六',
  `before_breakfast` tinyint(4) DEFAULT '0' COMMENT '早餐前：0为否，1为是',
  `before_breakfast_time` time DEFAULT NULL COMMENT '早餐前测量时间',
  `after_breakfast` tinyint(4) DEFAULT '0' COMMENT '早餐后：0为否，1为是',
  `after_breakfast_time` time DEFAULT NULL COMMENT '早餐后测量时间',
  `before_lunch` tinyint(4) DEFAULT '0' COMMENT '午餐前：0为否，1为是',
  `before_lunch_time` time DEFAULT NULL COMMENT '午餐前测量时间',
  `after_lunch` tinyint(4) DEFAULT '0' COMMENT '午餐后：0为否，1为是',
  `after_lunch_time` time DEFAULT NULL COMMENT '午餐后测量时间',
  `before_dinner` tinyint(4) DEFAULT '0' COMMENT '晚餐前：0为否，1为是',
  `before_dinner_time` time DEFAULT NULL COMMENT '晚餐前测量时间',
  `after_dinner` tinyint(4) DEFAULT '0' COMMENT '晚餐后：0为否，1为是',
  `after_dinner_time` time DEFAULT NULL COMMENT '晚餐后测量时间',
  `before_sleep` tinyint(4) DEFAULT '0' COMMENT '睡前：0为否，1为是',
  `before_sleep_time` time DEFAULT NULL COMMENT '睡前测量时间',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `alert_tag` tinyint(4) DEFAULT '0' COMMENT '是否提醒居民：0为否，1为是',
  `content` varchar(30) DEFAULT NULL COMMENT '方案说明',
  `del` tinyint(4) DEFAULT '0' COMMENT '0为正常，1为被删除',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=113 DEFAULT CHARSET=utf8mb4 COMMENT='医生-血糖监测方案表';


INSERT INTO `base`.`oauth_wlyy_config`(`id`, `app_id`, `app_secret`, `token_url`, `url`, `remark`)
VALUES ('getChronicDiseaseData', '019bd04d-3cb2-433f-a530-03f0cdb083e5', '08cc3ec2-736b-4732-a8f0-f99eb6f9d311', 'https://ehr.yihu.com/wlyy/gc/accesstoken', 'https://ehr.yihu.com/wlyy/wlyygc/tongan/hospital/getChronicDiseaseData', '获取同安签约慢病数据');

CREATE TABLE `base_patient_doctor_relation` (
  `id` int NOT NULL AUTO_INCREMENT,
  `patient_id` varchar(100) DEFAULT NULL COMMENT '患者id',
  `doctor_id` varchar(100) DEFAULT NULL COMMENT '医生id',
  `source_type` varchar(10) DEFAULT NULL COMMENT '来源类型，1线上就诊 ， 2i健康签约',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;


CREATE TABLE `wlyy_track_patient` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `patient_code` varchar(50) DEFAULT NULL COMMENT '关联居民code，医生的重点关注对象',
  `patient_name` varchar(50) DEFAULT NULL COMMENT '患者姓名',
  `doctor_code` varchar(50) DEFAULT NULL COMMENT '所属医生',
  `doctor_name` varchar(50) DEFAULT NULL COMMENT '所属医生名',
  `team_code` int(11) DEFAULT NULL COMMENT '居民签约团队',
  `idcard` varchar(50) DEFAULT NULL COMMENT '身份证号',
  `ssc` varchar(50) DEFAULT NULL COMMENT '社保卡号',
  `del` varchar(1) DEFAULT NULL COMMENT '1正常，0删除',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uk_patient_doctor` (`patient_code`,`doctor_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1946 DEFAULT CHARSET=utf8mb4;

CREATE TABLE `wlyy_doctor_health_standard` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '业务无关主键',
  `doctor` varchar(50) NOT NULL COMMENT '患者标识',
  `type` int(11) NOT NULL COMMENT '健康指标类型：1血糖，2血压，3体重，4腰围',
  `min_value_1` double DEFAULT NULL COMMENT '最低安全值(血糖餐前收缩压体重腰围)',
  `max_value_1` double DEFAULT NULL COMMENT '最高安全值(血糖餐前收缩压体重腰围)',
  `min_value_2` double DEFAULT NULL COMMENT '最低安全值(血糖餐后舒张压)',
  `max_value_2` double DEFAULT NULL COMMENT '最高安全值(血糖餐后舒张压)',
  `czrq` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '设置时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `idx_wlyy_doctor_health_standard_1` (`doctor`,`type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=359 DEFAULT CHARSET=utf8mb4 COMMENT='医生健康指标预警值方案';


CREATE TABLE `wlyy_doctor_scheme_blood_pressure` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id主键，与业务主键CODE无关',
  `name` varchar(20) DEFAULT NULL COMMENT '方案名称',
  `code` varchar(50) DEFAULT NULL COMMENT '业务主键CODE，UUID',
  `doctorcode` varchar(50) DEFAULT NULL COMMENT '医生CODE',
  `dayofweek` tinyint(4) NOT NULL COMMENT '1至7递增，1为星期日，7位星期六',
  `early_morning` tinyint(4) DEFAULT '0' COMMENT '清晨：0为否，1为是',
  `early_morning_time` time DEFAULT NULL COMMENT '清晨测量时间',
  `morning` tinyint(4) DEFAULT '0' COMMENT '上午：0为否，1为是',
  `morning_time` time DEFAULT NULL COMMENT '上午测量时间',
  `noon` tinyint(4) DEFAULT '0' COMMENT '中午：0为否，1为是',
  `noon_time` time DEFAULT NULL COMMENT '中午测量时间',
  `after_noon` tinyint(4) DEFAULT '0' COMMENT '下午：0为否，1为是',
  `after_noon_time` time DEFAULT NULL COMMENT '下午测量时间',
  `night` tinyint(4) DEFAULT '0' COMMENT '晚上：0为否，1为是',
  `night_time` time DEFAULT NULL COMMENT '晚上测量时间',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `alert_tag` tinyint(4) DEFAULT NULL COMMENT '是否提醒居民：0为否，1为是',
  `content` varchar(20) DEFAULT NULL COMMENT '方案说明',
  `del` tinyint(4) DEFAULT '0' COMMENT '0为正常，1为被删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=78 DEFAULT CHARSET=utf8mb4 COMMENT='医生-血压监测方案';


CREATE TABLE `wlyy_patient_scheme_list` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id主键，与业务逻辑无关',
  `code` varchar(50) NOT NULL COMMENT '业务逻辑主键UUID',
  `patientcode` varchar(50) NOT NULL COMMENT '患者CODE',
  `schemecode` varchar(50) NOT NULL COMMENT '监测方案CODE',
  `type` tinyint(4) NOT NULL COMMENT '方案类型：1为血糖,2为血压',
  `doctorcode` varchar(50) DEFAULT NULL COMMENT '医生CODE',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COMMENT='患者-监测方案关联关系表';

INSERT INTO `base`.`oauth_wlyy_config` (`id`, `app_id`, `app_secret`, `token_url`, `url`, `remark`) VALUES ('commonGet', '019bd04d-3cb2-433f-a530-03f0cdb083e5', '08cc3ec2-736b-4732-a8f0-f99eb6f9d311', 'https://www.xmtyw.cn/wlyytest/gc/accesstoken', 'https://www.xmtyw.cn/wlyytest/wlyygc/tongan/hospital/', '通用接口');
INSERT INTO `base`.`oauth_wlyy_config` (`id`, `app_id`, `app_secret`, `token_url`, `url`, `remark`) VALUES ('uploadImg', '019bd04d-3cb2-433f-a530-03f0cdb083e5', '08cc3ec2-736b-4732-a8f0-f99eb6f9d311', 'https://www.xmtyw.cn/wlyytest/gc/accesstoken', 'https://www.xmtyw.cn/wlyytest/wlyygc/upload/file', '图片上传');

CREATE TABLE `wlyy_sign` (
   `id` int NOT NULL AUTO_INCREMENT,
   `idcard` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '身份证',
   `admin_team_id` int DEFAULT NULL COMMENT '签约团队',
   `name` varchar(50) DEFAULT NULL COMMENT '姓名',
   `address` varchar(50) DEFAULT NULL COMMENT '地址',
   `hospital_name` varchar(50) DEFAULT NULL COMMENT '签约社区',
   `doctor_name` varchar(50) DEFAULT NULL COMMENT '全科医生',
   `health_doctor_name` varchar(50) DEFAULT NULL COMMENT '健管师',
   `begin` varchar(10) DEFAULT NULL COMMENT '签约开始时间',
   `end` varchar(10) DEFAULT NULL COMMENT '签约结束时间',
   `sign_year` varchar(1) DEFAULT NULL COMMENT '签约年限',
   `status` varchar(4) DEFAULT NULL COMMENT '状态',
   `sign_source` varchar(1) DEFAULT NULL COMMENT '签约类型',
   `disease_condition` varchar(5) DEFAULT NULL COMMENT '病情',
   `sys_time` varchar(30) DEFAULT NULL COMMENT '同步时间',
   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
   PRIMARY KEY (`id`),
   KEY `index2` (`admin_team_id`),
   KEY `index3` (`sys_time`),
   KEY `index4` (`hospital_name`,`doctor_name`,`health_doctor_name`),
   KEY `index1` (`patient`,`idcard`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;



CREATE TABLE `wlyy_patient_aim_blood_pressure` (
      `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id主键，与业务逻辑无关',
      `code` varchar(50) NOT NULL COMMENT '业务主键UUID',
      `patientcode` varchar(50) DEFAULT NULL COMMENT '患者CODE',
      `sbp` varchar(10) DEFAULT NULL COMMENT '血压收缩压',
      `dbp` varchar(10) DEFAULT NULL COMMENT '血压舒张压',
      `sbp_min` varchar(10) DEFAULT NULL COMMENT '血压收缩压低限',
      `dbp_min` varchar(10) DEFAULT NULL COMMENT '血压舒张压低限',
      `unit` varchar(10) DEFAULT NULL COMMENT '单位',
      `create_time` datetime DEFAULT NULL COMMENT '创建时间',
      PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='患者-血压目标';

CREATE TABLE `wlyy_patient_aim_blood_sugger` (
   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id主键，与业务主键无关',
   `code` varchar(50) NOT NULL COMMENT '业务主键UUID',
   `patientcode` varchar(50) DEFAULT NULL COMMENT '患者CODE',
   `fbg` varchar(10) DEFAULT NULL COMMENT 'FBG(fasting blood-glucose)空腹血糖',
   `hpg` varchar(10) DEFAULT NULL COMMENT '餐后两小时血糖(2h Plasma Glucose,2Hpg)',
   `fbg_min` varchar(10) DEFAULT NULL COMMENT '空腹血糖低限',
   `hpg_min` varchar(255) DEFAULT NULL COMMENT '餐后血糖低限',
   `unit` varchar(10) DEFAULT NULL COMMENT '血糖单位',
   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
   PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='患者-血糖目标';


INSERT INTO `wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`,
  `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES
('ijk_sign_source1', NULL, 'ijk_sign_source', '1', '线下', NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '签约类型');
INSERT INTO `wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`,
                                      `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES
  ('ijk_sign_source2', NULL, 'ijk_sign_source', '2', '线上', NULL, '2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '签约类型');


INSERT INTO `wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`,
                                      `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES
    ('ijk_sign_status1', NULL, 'ijk_sign_status', '-1', '患者已取消', NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '签约状态');
INSERT INTO `wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`,
                                      `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES
    ('ijk_sign_status2', NULL, 'ijk_sign_status', '-2', '已拒绝', NULL, '2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '签约状态');
INSERT INTO `wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`,
                                      `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES
    ('ijk_sign_status3', NULL, 'ijk_sign_status', '-3', '已解约', NULL, '3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '签约状态');
INSERT INTO `wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`,
                                      `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES
    ('ijk_sign_status4', NULL, 'ijk_sign_status', '-4', '已到期', NULL, '4', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '签约状态');
INSERT INTO `wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`,
                                      `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES
    ('ijk_sign_status5', NULL, 'ijk_sign_status', '0', '待签约', NULL, '5', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '签约状态');
INSERT INTO `wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`,
                                      `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES
    ('ijk_sign_status6', NULL, 'ijk_sign_status', '1', '已签约', NULL, '6', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '签约状态');
INSERT INTO `wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`,
                                      `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES
    ('ijk_sign_status7', NULL, 'ijk_sign_status', '2', '患者申请取消签约', NULL, '7', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '签约状态');
INSERT INTO `wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`,
                                      `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES
    ('ijk_sign_status8', NULL, 'ijk_sign_status', '3', '医生申请取消签约', NULL, '8', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '签约状态');