-- 2023-05-05 ysj
-- xmiot 库
CREATE TABLE `iot_statistics_realtime` (
                                           `id` varchar(50) NOT NULL,
                                           `type` varchar(50) DEFAULT NULL,
                                           `device_num` varchar(20) DEFAULT NULL COMMENT '设备数据',
                                           `sign_num` varchar(20) DEFAULT NULL COMMENT '体征数据',
                                           `abnormal_num` varchar(20) DEFAULT NULL COMMENT '异常数据',
                                           `create_time` datetime DEFAULT NULL,
                                           PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='大屏-统计-实时数据';



-- 数据库 device
ALTER TABLE wlyy_patient_device_location ADD city varchar(20) COMMENT '城市' ;
ALTER TABLE wlyy_patient_device_location ADD city_name varchar(20) COMMENT '城市名称' ;
ALTER TABLE wlyy_patient_device_location ADD town varchar(20) COMMENT '地区' ;
ALTER TABLE wlyy_patient_device_location ADD town_name varchar(20) COMMENT '地区名称' ;

ALTER TABLE wlyy_knowledge_article_dict ADD url varchar(500) COMMENT '外链地址' ;



---宣教
ALTER TABLE base_doctor_role ADD del tinyint(1) DEFAULT '1' COMMENT '是否生效 1生效 0失效' ;
ALTER TABLE base_menu_dict ADD  type tinyint(2) DEFAULT NULL COMMENT '类型 1 官网菜单 2app文章菜单' ;
ALTER TABLE wlyy_knowledge_article_dict ADD type tinyint(1) DEFAULT '1' COMMENT '类型 1官网 2app文章';
ALTER TABLE wlyy_knowledge_article_dict ADD comment int(11) DEFAULT NULL COMMENT '评论数量';
ALTER TABLE wlyy_knowledge_article_dict ADD puplish_type int(11) DEFAULT NULL COMMENT '1、图文2、视频3、音频';
ALTER TABLE wlyy_knowledge_article_dict ADD recommend_doctor varchar(1000) DEFAULT NULL;
ALTER TABLE wlyy_knowledge_article_dict ADD puplish_type_name varchar(255) DEFAULT NULL COMMENT '发布类型名称：1、图文2、视频3、音频';
ALTER TABLE wlyy_knowledge_article_dict ADD recommend_doctor_name varchar(1000) CHARACTER SET utf8 DEFAULT NULL COMMENT '推荐医生名字';

-- 2023-10-23 ysj
ALTER TABLE `base`.`base_service_package`
ADD COLUMN `leased_code` varchar(50) NULL COMMENT '租户code' AFTER `org_name`,
ADD COLUMN `leased_name` varchar(50) NULL COMMENT '租户name' AFTER `leased_code`,
ADD COLUMN `server_time_type` varchar(20) NULL COMMENT '服务时间类型' AFTER `leased_name`,
ADD COLUMN `server_time` varchar(50) NULL COMMENT '服务期限' AFTER `server_time_type`,
ADD COLUMN `server_time_description` varchar(255) NULL COMMENT '服务时间说明' AFTER `server_time`,
ADD COLUMN `create_user` varchar(50) NULL COMMENT '创建人code' AFTER `server_time_description`,
ADD COLUMN `create_user_name` varchar(20) NULL COMMENT '创建人name' AFTER `create_user`,
ADD COLUMN `update_user` varchar(50) NULL COMMENT '更新人code' AFTER `create_user_name`,
ADD COLUMN `update_user_name` varchar(50) NULL COMMENT '更新人name' AFTER `update_user`,
ADD COLUMN `update_time` datetime NULL COMMENT '更新时间' AFTER `create_time`;

ALTER TABLE `base`.`base_service_package`
ADD COLUMN `check_doctor` varchar(50) NULL COMMENT '服务包审核人code',
ADD COLUMN `check_doctor_name` varchar(50) NULL COMMENT '服务包审核人name',

ADD COLUMN `is_check` varchar(1) NULL COMMENT '是否开启审核 1是0否',
ADD COLUMN `fee_after` varchar(1) NULL COMMENT '服务后收费标识（1是0否）';

CREATE TABLE `base_service_package_sub_item` (
      `id` varchar(100) NOT NULL COMMENT '主键',
      `dict_item_id` varchar(100) DEFAULT NULL COMMENT '字典配置的服务项的id',
      `name` varchar(100) DEFAULT NULL COMMENT '名称',
      `introduce` varchar(255) DEFAULT NULL COMMENT '说明',
      `status` varchar(10) DEFAULT NULL COMMENT '状态',
      `sort` varchar(10) DEFAULT NULL,
      `leased_code` varchar(100) DEFAULT NULL,
      `leased_name` varchar(100) DEFAULT NULL,
      `org_code` varchar(100) DEFAULT NULL COMMENT '机构code',
      `org_name` varchar(100) DEFAULT NULL COMMENT '机构name',
      `photo` varchar(100) DEFAULT NULL COMMENT '照片',
      `create_time` datetime DEFAULT NULL,
      `price` decimal(10,2) DEFAULT NULL COMMENT '服务子项价格',
      PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `base_service_package_item_relational` (
    `id` varchar(100) NOT NULL COMMENT '主键',
    `item_id` varchar(100) DEFAULT NULL COMMENT '项目id',
    `sub_item_id` varchar(100) DEFAULT NULL COMMENT '子项目id',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `base_service_item_config` (
     `id` varchar(100) NOT NULL COMMENT '主键',
     `package_id` varchar(100) DEFAULT NULL COMMENT '服务包id',
     `server_item_id` varchar(100) DEFAULT NULL COMMENT '服务项id',
     `assess_type` varchar(100) DEFAULT NULL COMMENT '项目评价',
     `booking_type` varchar(100) DEFAULT NULL COMMENT '是否预约',
     `late_serve_type` varchar(100) DEFAULT NULL COMMENT '是否运行逾期服务',
     `plan_start_time_type` varchar(100) DEFAULT NULL COMMENT '计划开始时间类型',
     `server_time_type` varchar(100) DEFAULT NULL COMMENT '服务方法',
     `server_count` varchar(100) DEFAULT NULL COMMENT '服务次数',
     `template_type` varchar(100) DEFAULT NULL COMMENT '模板的类型-目前是随访为1',
     `template_code` varchar(100) DEFAULT NULL COMMENT '对应模板的id',
     `pricing_units_code` varchar(100) DEFAULT NULL COMMENT '计价单位',
     `pricing_units_name` varchar(100) DEFAULT NULL COMMENT '计价单位名称',
     `frequency_code` varchar(100) DEFAULT NULL COMMENT '频次',
     PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

ALTER TABLE `base`.`base_service_package_item`
    ADD COLUMN `leased_code` varchar(100) NULL COMMENT '租户code' AFTER `topic_item`,
ADD COLUMN `leased_name` varchar(50) NULL COMMENT '租户name' AFTER `leased_code`,
ADD COLUMN `sub_item_type` varchar(10) NULL COMMENT '是否包含子项目' AFTER `leased_name`;
ALTER TABLE `base`.`base_service_package_item`
    ADD COLUMN `template_type` varchar(20) NULL COMMENT '模板的类型-目前是随访为1' AFTER `sub_item_type`,
ADD COLUMN `template_code` varchar(255) NULL COMMENT '对应模板的id' AFTER `template_type`;
ALTER TABLE `base`.`base_service_package_item`
    ADD COLUMN `service_package_item_id` varchar(50) NULL COMMENT '创建服务项的id。也是本表的id。system那些数据' AFTER `service_package_id`;



CREATE TABLE `base_followup_template` (
    `id` varchar(100) NOT NULL,
    `template_name` varchar(255) DEFAULT NULL,
    `followup_statrt_time_type` varchar(100) DEFAULT NULL,
    `followup_count` varchar(10) DEFAULT NULL,
    `description` varchar(255) DEFAULT NULL,
    `template_detail_json` text,
    `status` varchar(10) DEFAULT NULL,
    `leased_code` varchar(100) DEFAULT NULL,
    `leased_name` varchar(100) DEFAULT NULL,
    `org_code` varchar(100) DEFAULT NULL,
    `org_name` varchar(255) DEFAULT NULL,
    `create_time` datetime DEFAULT NULL,
    `update_time` datetime DEFAULT NULL,
    `create_user` varchar(100) DEFAULT NULL,
    `create_user_name` varchar(100) DEFAULT NULL,
    `update_user` varchar(100) DEFAULT NULL,
    `update_user_name` varchar(100) DEFAULT NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

ALTER TABLE `base`.`base_service_package_sign_record`
ADD COLUMN `lost_reason` varchar(400) NULL COMMENT '失效原因',
ADD COLUMN `address` varchar(200) NULL COMMENT '详细地址',
ADD COLUMN `price` decimal(10,2) NULL COMMENT '价格',
ADD COLUMN `payment_time` datetime NULL COMMENT '付款时间',
ADD COLUMN `pay_status` tinyint(1) NULL COMMENT '支付状态 0待扣费 1已扣费 2已退费',
ADD COLUMN `pay_way` tinyint(1) NULL COMMENT '付款方式：1-微信支付，2-线下支付（居民自己向医院支付，具体怎么支付由医院来定）',
ADD COLUMN `revoker` varchar(50) NULL COMMENT '撤销人code',
ADD COLUMN `revoker_name` varchar(50) NULL COMMENT '撤销人姓名',
ADD COLUMN `revoke_time` varchar(50) NULL COMMENT '撤销时间',
ADD COLUMN `check_doctor` varchar(50) NULL COMMENT '审核人code',
ADD COLUMN `check_doctor_name` varchar(50) NULL COMMENT '审核人姓名',
ADD COLUMN `check_time` varchar(50) NULL COMMENT '审核时间',
ADD COLUMN `refuse_type` varchar(1) NULL COMMENT '拒绝原因',
ADD COLUMN `refuse_reason` varchar(500) NULL COMMENT '拒绝说明',
ADD COLUMN `pay_time` varchar(50) NULL COMMENT '剩余付款时间（审核后3天 无需审核的10分钟）',
ADD COLUMN `update_time` datetime NULL COMMENT '更新时间',
ADD COLUMN `service_package_id` varchar(50) NULL COMMENT '服务包id',
ADD COLUMN `proxy_patient` varchar(50) NULL COMMENT '代理人code',
ADD COLUMN `proxy_patient_name` varchar(50) NULL COMMENT '代理人',
ADD COLUMN `mobile` varchar(50) NULL COMMENT '联系方式',
ADD COLUMN `service_address` varchar(200) NULL COMMENT '服务地址',
ADD COLUMN `serve_lat` varchar(50) NULL COMMENT '服务地址纬度',
ADD COLUMN `serve_lon` varchar(50) NULL COMMENT '服务地址经度',
ADD COLUMN `remark` varchar(2000) NULL COMMENT '备注说明',
ADD COLUMN `type` varchar(1) NULL COMMENT '类型（1本人发起 2家人代 3医生代）';

ALTER TABLE `base`.`base_service_package_record`
ADD COLUMN `package_item_id` varchar(50) NULL COMMENT '服务项id ',
ADD COLUMN `type` varchar(1) NULL COMMENT '类型 1预约后分配 2直接分配服务者 ',
ADD COLUMN `doctor` varchar(50) NULL COMMENT '服务者',
ADD COLUMN `doctor_name` varchar(50) NULL COMMENT '服务者姓名';

-- 数据处理
SELECT s.service_package_id,r.service_package_id from base_service_package_sign_record s,base_service_package_record r
WHERE s.id =r.sign_id;
update base_service_package_sign_record s,base_service_package_record r set s.service_package_id=r.service_package_id
WHERE s.id =r.sign_id;

UPDATE base_service_package_item set leased_code = 'system' WHERE leased_code is null and service_package_id = 'system';

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 ('109827', NULL, 'plan_start_type', '0', '签约后生效', 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 ('109828', NULL, 'plan_start_type', '1', '签约后1天', 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 ('109829', NULL, 'plan_start_type', '2', '签约后2天', 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 ('plan_start_type3', NULL, 'plan_start_type', '3', '签约后3天', NULL, '4', 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 ('plan_start_type4', NULL, 'plan_start_type', '7', '签约后1周', NULL, '5', 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 ('plan_start_type5', NULL, 'plan_start_type', '30', '签约后30天', NULL, '6', 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 ('sign_status1', NULL, 'sign_status', '0', '待审核', 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 ('sign_status0', NULL, 'sign_status', '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 ('sign_status2', NULL, 'sign_status', '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 ('sign_status3', NULL, 'sign_status', '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 ('sign_status4', NULL, 'sign_status', '-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 ('sign_status5', NULL, 'sign_status', '-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 ('sign_status6', NULL, 'sign_status', '-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 ('sign_refuse_type1', NULL, 'sign_refuse_type', '0', '其他', 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 ('sign_refuse_type2', NULL, 'sign_refuse_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 ('sign_refuse_type3', NULL, 'sign_refuse_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 ('sign_refuse_type4', NULL, 'sign_refuse_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 ('wxPayNotify', NULL, 'notifyUrl', 'wxpay', 'https://zhyzh.gongshu.gov.cn/cloudCare/pay/open/wxPayNotify', '微信支付回调', 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 ('cloudPayNotify', NULL, 'notifyUrl', 'cloudWxPay', 'https://zhyzh.gongshu.gov.cn/cloudCare/pay/open/cloudPayNotify', '云照护支付回调', 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 ('sms_captcha_white1', NULL, 'sms_captcha_white', '13559485270', 'ysj', 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 ('plan_frequency1', NULL, 'plan_frequency', '0 0 10 ? * *', '每天10点执行', 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 ('plan_frequency2', NULL, 'plan_frequency', '0 0 10,14 ? * *', '每天10点,14点执行', 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 ('plan_frequency3', NULL, 'plan_frequency', '0 0 0/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 ('plan_frequency4', NULL, 'plan_frequency', '0 0 10 1/3 * ?', '每3天10点执行', 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 ('plan_frequency5', NULL, 'plan_frequency', '0 0 10 1 * ?', '每月1号10点执行', 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 ('doctor_sign_status1', NULL, 'doctor_sign_status', '0', '待审核', 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 ('doctor_sign_status2', NULL, 'doctor_sign_status', '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 ('doctor_sign_status3', NULL, 'doctor_sign_status', '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 ('doctor_sign_status4', NULL, 'doctor_sign_status', '-1', '已过期', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '居民签约状态');

CREATE TABLE `base_service_item_plan` (
    `id` varchar(50) NOT NULL,
    `patient` varchar(50) DEFAULT NULL COMMENT '居民id',
    `status` varchar(4) DEFAULT NULL COMMENT '状态0未完成 1已完成',
    `plan_time` varchar(50) DEFAULT NULL COMMENT '计划时间',
    `complete_time` varchar(50) DEFAULT NULL COMMENT '完成时间',
    `sign_id` varchar(50) DEFAULT NULL COMMENT '签约id',
    `service_pack_id` varchar(50) DEFAULT NULL COMMENT '服务包id',
    `service_item_id` varchar(50) DEFAULT NULL COMMENT '服务项id',
    `item_config_id` varchar(50) DEFAULT NULL COMMENT '服务项配置id',
    `name` varchar(50) DEFAULT NULL COMMENT '服务项名称',
    `relation_code` varchar(50) DEFAULT NULL COMMENT '关联业务id',
    `relation_type` varchar(4) DEFAULT NULL COMMENT '关联业务类型 doorService上门服务',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='服务项执行计划';



===========================20231024上门服务开始====================================
ALTER TABLE `base`.`wlyy_door_service_order`
    ADD COLUMN `fee_after` varchar(10) NULL COMMENT '服务后收费标识（1是0否）' AFTER `nursing_staff_type`,
ADD COLUMN `package_id` varchar(50) NULL COMMENT '服务包id' AFTER `fee_after`;

ALTER TABLE `base`.`wlyy_door_order_item`
    ADD COLUMN `order_id` varchar(50) NULL COMMENT '订单id' AFTER `create_time`;

ALTER TABLE `base`.`base_service_package_item`
ADD COLUMN `assign_status` varchar(10) NULL COMMENT '是否分配服务者【1是0否】' AFTER `template_code`,
ADD COLUMN `server_user_id` varchar(50) NULL COMMENT '服务者id' AFTER `assign_status`,
ADD COLUMN `server_user_name` varchar(50) NULL COMMENT '服务者name' AFTER `server_user_id`,
ADD COLUMN `server_user_type` varchar(10) NULL COMMENT '服务者类型' AFTER `server_user_name`;

ALTER TABLE `base`.`wlyy_door_service_order`
ADD COLUMN `sign_id` varchar(50) NULL COMMENT '签约id' AFTER `package_id`;

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 ('1000000001', NULL, 'PROFESSIONAL_STATE', '0', '国家机关、党群组织、企业、事业单位负责人', NULL, 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 ('1000000002', NULL, 'PROFESSIONAL_STATE', '1', '专业技术人员', NULL, 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 ('1000000003', NULL, 'PROFESSIONAL_STATE', '2', '办事人员和有关人员', NULL, 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 ('1000000004', NULL, 'PROFESSIONAL_STATE', '3', '商业、服务业人员', NULL, 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 ('1000000005', NULL, 'PROFESSIONAL_STATE', '4', '农、林、牧、渔、水利业生产人员', NULL, 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 ('1000000006', NULL, 'PROFESSIONAL_STATE', '5', '生产、运输设备操作人员及有关人员', NULL, 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 ('1000000007', NULL, 'PROFESSIONAL_STATE', '6', '军人', NULL, 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 ('1000000008', NULL, 'PROFESSIONAL_STATE', '7', '不便分类的其他从业人员', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

===========================20231024上门服务结束====================================

ALTER TABLE `base`.`base_service_package_item`
MODIFY COLUMN `service_package_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'system' COMMENT '服务包id' AFTER `name`,
MODIFY COLUMN `service_package_item_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建服务项的id。也是本表的id。system那些数据' AFTER `service_package_id`;