/*
 Navicat Premium Data Transfer

 Source Server         : 测试
 Source Server Type    : MariaDB
 Source Server Version : 100318
 Source Host           : test.tall.wiki:3306
 Source Schema         : wisdomcar

 Target Server Type    : MariaDB
 Target Server Version : 100318
 File Encoding         : 65001

 Date: 13/05/2021 15:13:25
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_first_aid
-- ----------------------------
DROP TABLE IF EXISTS `t_first_aid`;
CREATE TABLE `t_first_aid`  (
  `id` bigint(20) NOT NULL,
  `car_id` bigint(20) NULL DEFAULT 0 COMMENT '平车id',
  `hospital_id` bigint(20) NULL DEFAULT 0 COMMENT '医院id',
  `begin_time` bigint(20) NULL DEFAULT 0 COMMENT '开始时间',
  `end_time` bigint(20) NULL DEFAULT 0 COMMENT '结束时间',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `aid_car_index`(`car_id`) USING BTREE,
  INDEX `aid_hospital_index`(`hospital_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '急救表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_first_aid_record
-- ----------------------------
DROP TABLE IF EXISTS `t_first_aid_record`;
CREATE TABLE `t_first_aid_record`  (
  `id` bigint(20) NOT NULL,
  `first_aid_id` bigint(20) NULL DEFAULT 0 COMMENT '急救表id',
  `type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '类型 0开始 1体重 2rfid, 3称重一 4称重二 5称重三 6称重四 7震动 8剂量',
  `value` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '该类型对应的值',
  `begin_time` bigint(20) NULL DEFAULT 0 COMMENT '开始时间',
  `step_id` bigint(20) NULL DEFAULT 0 COMMENT '环节id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `record_first_aid_index`(`first_aid_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '急救记录表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_first_aid_standard
-- ----------------------------
DROP TABLE IF EXISTS `t_first_aid_standard`;
CREATE TABLE `t_first_aid_standard`  (
  `id` bigint(20) NOT NULL,
  `type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '类型 0国际 1医院本身',
  `hospital_id` bigint(20) NULL DEFAULT 0 COMMENT '医院id',
  `step_id` bigint(20) NULL DEFAULT 0 COMMENT '环节id',
  `duration` bigint(20) NULL DEFAULT 0 COMMENT '该环节的时长',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `standard_hospital_index`(`hospital_id`) USING BTREE,
  INDEX `standard_step_index`(`step_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '急救标准表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_rfid
-- ----------------------------
DROP TABLE IF EXISTS `t_rfid`;
CREATE TABLE `t_rfid`  (
  `id` bigint(20) NOT NULL,
  `rfid` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'rfid',
  `type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '类型 0医生 1采血车 2门禁',
  `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '名字',
  `step_id` bigint(20) NULL DEFAULT 0 COMMENT '环节id',
  `hospital_id` bigint(20) NULL DEFAULT 0 COMMENT '医院id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `rfid_step_index`(`step_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'rfid表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_screen
-- ----------------------------
DROP TABLE IF EXISTS `t_screen`;
CREATE TABLE `t_screen`  (
  `id` bigint(20) NOT NULL,
  `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '名字',
  `hospital_id` bigint(20) NULL DEFAULT 0 COMMENT '医院id',
  `show_type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '大屏显示类型 0主屏 当前默认全是0',
  `user_id` bigint(20) NULL DEFAULT 0 COMMENT '用户id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '平车信息' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_statistics_month
-- ----------------------------
DROP TABLE IF EXISTS `t_statistics_month`;
CREATE TABLE `t_statistics_month`  (
  `id` bigint(20) NOT NULL,
  `name` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '月份名',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '统计月份表 1至12月' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_step
-- ----------------------------
DROP TABLE IF EXISTS `t_step`;
CREATE TABLE `t_step`  (
  `id` bigint(20) NOT NULL,
  `name` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '环节名称',
  `code` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '环节code',
  `sequence` int(11) NULL DEFAULT 0 COMMENT '顺序',
  `step_type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '环节类型。0真正的环节，1rfid的环节',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '环节表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_wisdom_car
-- ----------------------------
DROP TABLE IF EXISTS `t_wisdom_car`;
CREATE TABLE `t_wisdom_car`  (
  `id` bigint(20) NOT NULL,
  `car_number` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '平车编号',
  `time` bigint(20) NULL DEFAULT 0 COMMENT '入库时间',
  `hospital_id` bigint(20) NULL DEFAULT 0 COMMENT '医院id',
  `screen_id` bigint(20) NULL DEFAULT 0 COMMENT '大屏id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '平车信息' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_wisdom_car_record
-- ----------------------------
DROP TABLE IF EXISTS `t_wisdom_car_record`;
CREATE TABLE `t_wisdom_car_record`  (
  `id` bigint(20) NOT NULL,
  `car_id` bigint(20) NULL DEFAULT 0 COMMENT '平车id',
  `type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '类型 0开始 1体重 2rfid, 3称重一 4称重二 5称重三 6称重四 7震动 8剂量',
  `value` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '该类型对应的值',
  `time` bigint(20) NULL DEFAULT 0 COMMENT '时间',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `wisdom_car_index`(`car_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据记录表' ROW_FORMAT = Compact;

-- ----------------------------
-- Procedure structure for u_head_and_low_pro
-- ----------------------------
DROP PROCEDURE IF EXISTS `u_head_and_low_pro`;
delimiter ;;
CREATE PROCEDURE `u_head_and_low_pro`()
begin
  DECLARE n int DEFAULT 1;
  DECLARE m int DEFAULT 1;
	
  set @exesql = 'insert into t_first_aid (id,car_id,begin_time) values ';
  set @exedata = '';

WHILE m < 13 DO
	set @y = "";
	select @y:=unix_timestamp(STR_TO_DATE(concat("2020-",m,"-01"),"%Y-%m-%d")) * 1000;
	
	set @d = "";
	select @d:= RAND() * 200 + 150;
	
	  WHILE n < @d DO
			set @exedata = concat(@exedata,"(2020",if(m <10,concat("0",m),m),n,",","1,",@y,")");
			if n < @d -1
			then
				set @exedata = concat(@exedata,',');
			end if;
				set n = n + 1;
				
		END WHILE;
			set @exesql = concat(@exesql,@exedata,";");
				SELECT @exesql;
			prepare stmt from @exesql;
	
			execute stmt;
			DEALLOCATE prepare stmt;
			commit;  

			set @exesql = 'insert into t_first_aid (id,car_id,begin_time) values ';
			set @exedata = "";
			set m = m + 1;
			set n = 1;
END WHILE;

end
;;
delimiter ;

SET FOREIGN_KEY_CHECKS = 1;




-----------------------------------未更新生产-----------------------------------
-- 2021-06-01:智慧平车创建新表:
  DROP TABLE IF EXISTS `t_patient_project`;
  CREATE TABLE `t_patient_project`  (
  `id` bigint(20) NOT NULL COMMENT '患者项目id',
  `medical_record_num` varchar(20)  NULL DEFAULT '' COMMENT '病案号',
  `name` varchar(20) NULL DEFAULT '' COMMENT '患者姓名',
  `sex` tinyint(1) NULL DEFAULT 0 COMMENT '患者性别(0-女,1-男)',
  `age` int(10) NULL DEFAULT 0 COMMENT '患者年龄',
  `id_card` varchar(64)  NULL DEFAULT '' COMMENT '患者身份证号',
  `phone` varchar(20)  NULL DEFAULT '' COMMENT '患者联系电话',
  `project_id` bigint(20)  NULL DEFAULT 0 COMMENT '患者项目id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `project_index`(`project_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '患者项目表' ROW_FORMAT = Compact;


  DROP TABLE IF EXISTS `t_patient_family`;
  CREATE TABLE `t_patient_family`  (
  `id` bigint(20) NOT NULL COMMENT '患者家属id',
  `name` varchar(20)  NULL DEFAULT '' COMMENT '家属姓名',
  `phone` varchar(20) NULL DEFAULT '' COMMENT '家属联系方式',
  `patient_id` bigint(20)  NULL DEFAULT 0 COMMENT '患者id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `patient_index`(`patient_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '患者家属表' ROW_FORMAT = Compact;


  DROP TABLE IF EXISTS `t_patient_wisdom_car`;
  CREATE TABLE `t_patient_wisdom_car`  (
  `id` bigint(20) NOT NULL COMMENT '患者平车id',
  `patient_id` bigint(20)  NULL DEFAULT 0 COMMENT '患者id',
  `task_sub_id` bigint(20)  NULL DEFAULT 0 COMMENT '分解任务id',
  `car_id` bigint(20) DEFAULT 0 COMMENT '平车id',
  `start_time` bigint(20) DEFAULT 0 COMMENT '开始时间(分配即开始)',
  `end_time` bigint(20) DEFAULT 0 COMMENT '结束时间(点击结束则为结束)',
  `is_demo` tinyint(1) NULL DEFAULT 0 COMMENT '是否演示(0-否,1-是)',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,

  INDEX `task_index`(`task_sub_id`) USING BTREE,
  INDEX `car_index`(`car_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '患者平车表' ROW_FORMAT = Compact;

DROP TABLE IF EXISTS `t_patient_data`;
  CREATE TABLE `t_patient_data`  (
  `id` bigint(20) NOT NULL COMMENT '患者数据id',
  `patient_car_id` bigint(20)  NULL DEFAULT 0 COMMENT '患者平车id',
  `wisdom_car_record_id` bigint(20)  NULL DEFAULT 0 COMMENT '平车数据记录id',
  `user_id` bigint(20)  NULL DEFAULT 0 COMMENT '用户id',
  `task_sub_id` bigint(20)  NULL DEFAULT 0 COMMENT '分解任务id',
  `step_id` bigint(20)  NULL DEFAULT 0 COMMENT '节点id(环节id)',
  `step_status` tinyint(1) NULL DEFAULT 0 COMMENT '节点状态(0-开始)',
  `push_status` tinyint(2) NULL DEFAULT 0 COMMENT '推送状态(0-未推送,1-推送失败,2-推送成功)',
  `start_time` bigint(20) DEFAULT 0 COMMENT '开始时间',
  `type` tinyint(1) NULL DEFAULT 0 COMMENT '类型(0-平车,1-用户)',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `patient_car_index`(`patient_car_id`) USING BTREE,
  INDEX `wisdom_car_record_index`(`wisdom_car_record_id`) USING BTREE,
  INDEX `user_index`(`user_id`) USING BTREE,
  INDEX `task_sub_index`(`task_sub_id`) USING BTREE,
  INDEX `step_index`(`step_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '患者数据表' ROW_FORMAT = Compact;


DROP TABLE IF EXISTS `t_patient_information_record`;
  CREATE TABLE `t_patient_information_record`  (
  `id` bigint(20) NOT NULL COMMENT '患者信息记录id',
  `patient_car_id` bigint(20)  NULL DEFAULT 0 COMMENT '患者平车id',
  `task_sub_id` bigint(20)  NULL DEFAULT 0 COMMENT '分解任务id',
  `information_type` tinyint(1) NULL DEFAULT 0 COMMENT '类型(0-图片,1-文本)',
  `content` varchar(500)  NULL DEFAULT '' COMMENT '内容',

  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `patient_car_index`(`patient_car_id`) USING BTREE,
  INDEX `task_sub_index`(`task_sub_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '患者信息记录表' ROW_FORMAT = Compact;

DROP TABLE IF EXISTS `t_step_task`;
  CREATE TABLE `t_step_task`  (
  `id` bigint(20) NOT NULL COMMENT '环节任务id',
  `step_id` bigint(20)  NULL DEFAULT 0 COMMENT '环节id',
  `task_sub_id` bigint(20)  NULL DEFAULT 0 COMMENT '分解任务id',
  `patient_id` bigint(20)  NULL DEFAULT 0 COMMENT '患者id',
  `batch` int(10) NULL DEFAULT 0 COMMENT '批次',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `step_index`(`step_id`) USING BTREE,
  INDEX `task_sub_index`(`task_sub_id`) USING BTREE,
  INDEX `patient_index`(`patient_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '环节任务表' ROW_FORMAT = Compact;



DROP TABLE IF EXISTS `t_hospital_member`;
  CREATE TABLE `t_hospital_member`  (
  `id` bigint(20) NOT NULL COMMENT '医院成员id',
  `position` tinyint(1) NULL DEFAULT 0 COMMENT '职位(0-,1-)',
  `department` tinyint(1) NULL DEFAULT 0 COMMENT '部门(0-,1-)',
  `hospital_id` bigint(20)  NULL DEFAULT 0 COMMENT '医院id',
  `user_id` bigint(20)  NULL DEFAULT 0 COMMENT '用户id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `hospital_index`(`hospital_id`) USING BTREE,
  INDEX `user_index`(`user_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '医院成员表' ROW_FORMAT = Compact;

DROP TABLE IF EXISTS `t_hospital_wroking`;
  CREATE TABLE `t_hospital_wroking`  (
  `id` bigint(20) NOT NULL ,
  `start_time` bigint(20) NULL DEFAULT 0 COMMENT '值班开始时间',
  `end_time` bigint(20) NULL DEFAULT 0 COMMENT '值班结束时间',
  `hospital_member_id` bigint(20)  NULL DEFAULT 0 COMMENT '医院成员id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `hospital_member_index`(`hospital_member_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '值班表' ROW_FORMAT = Compact;

DROP TABLE IF EXISTS `t_hospital`;
  CREATE TABLE `t_hospital`  (
  `id` bigint(20) NOT NULL COMMENT '医院id',
  `hospital_code` varchar(64) NULL DEFAULT '' COMMENT '医院code',
  `hospital_name` varchar(64) NULL DEFAULT '' COMMENT '医院名称',
  `hospital_short_name` varchar(64) NULL DEFAULT '' COMMENT '医院简称',
  `hospital_intro` varchar(500) NULL DEFAULT '' COMMENT '医院简介',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '医院' ROW_FORMAT = Compact;

DROP TABLE IF EXISTS `t_patient_doctor`;
  CREATE TABLE `t_hospital`  (
  `id` bigint(20) NOT NULL COMMENT '医患id',
  `patient_id` varchar(64) NULL DEFAULT '' COMMENT '患者id',
  `doctor_id` varchar(64) NULL DEFAULT '' COMMENT '医生id',
  
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE
  INDEX `patient_index`(`patient_id`) USING BTREE
  INDEX `doctor_index`(`doctor_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '医生和患者' ROW_FORMAT = Compact;



ALTER TABLE t_step ADD task_sub_name varchar(50) NULL DEFAULT '' COMMENT '分解任务名称'

ALTER TABLE t_patient_wisdom_car ADD binding_status tinyint(1) NULL DEFAULT '' COMMENT '绑定状态(0-待完善,1-已完善)'