-- 医院表 DROP TABLE IF EXISTS `t_hospital`; CREATE TABLE `t_hospital` ( `id` bigint(20) NOT NULL, `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '医院编码', `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '医院名', `project_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id', `operator` 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 = Dynamic; -- 康复中心 DROP TABLE IF EXISTS `t_recovery_centre`; CREATE TABLE `t_recovery_centre` ( `id` bigint(20) NOT NULL, `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '康复中心名', `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '地址', `hospital_id` bigint(20) NULL DEFAULT 0 COMMENT '所属医院的id', `project_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id', `operator` 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 `centre_hospital_index`(`hospital_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '康复中心' ROW_FORMAT = Dynamic; -- 智能机器人(竖屏) DROP TABLE IF EXISTS `t_recovery_robot`; CREATE TABLE `t_recovery_robot` ( `id` bigint(20) NOT NULL, `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '编号', `userId` bigint(20) NULL DEFAULT 0 COMMENT '关联的userId', `centre_id` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '所属康复中心的id', `operator` 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 `robot_centre_index`(`centre_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '智能机器人(竖屏)' ROW_FORMAT = Dynamic; -- 医生表 DROP TABLE IF EXISTS `t_doctor`; CREATE TABLE `t_doctor` ( `id` bigint(20) NOT NULL, `user_id` bigint(20) NULL DEFAULT 0 COMMENT ' 登录用户id', `hospital_id` bigint(20) NULL DEFAULT 0 COMMENT '医院id', `position` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '职务', `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT ' 姓名 ', `sex` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT ' 性别(0:女 1:男) ', `age` int(11) NULL DEFAULT 0 COMMENT ' 年龄 ', `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT ' 备注 ', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除', PRIMARY KEY (`id`) USING BTREE, INDEX `doctor_user_index`(`user_id`) USING BTREE, INDEX `doctor_hospital_index`(`hospital_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '医生表' ROW_FORMAT = Dynamic; -- 康复医生表 DROP TABLE IF EXISTS `t_recovery_doctor`; CREATE TABLE `t_recovery_doctor` ( `id` bigint(20) NOT NULL, `user_id` bigint(20) NULL DEFAULT 0 COMMENT ' 登录用户id', `centre_id` bigint(20) NULL DEFAULT 0 COMMENT '所属康复中心的id', `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT ' 姓名 ', `sex` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT ' 性别(0:女 1:男) ', `age` int(11) NULL DEFAULT 0 COMMENT ' 年龄 ', `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT ' 备注 ', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除', PRIMARY KEY (`id`) USING BTREE, INDEX `recovery_doctor_user_index`(`user_id`) USING BTREE, INDEX `recovery_doctor_centre_index`(`centre_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '康复医生表' ROW_FORMAT = Dynamic; -- 患者信息表 DROP TABLE IF EXISTS `t_patient`; CREATE TABLE `t_patient` ( `id` bigint(20) NOT NULL, `user_id` bigint(20) NULL DEFAULT 0 COMMENT ' 登录用户id', `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT ' 姓名 ', `sex` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT ' 性别(0:女 1:男) ', `age` int(11) NULL DEFAULT 0 COMMENT ' 年龄 ', `id_card` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '身份证号', `phone` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '联系方式', `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '家庭地址', `input_time` bigint(20) NULL DEFAULT 0 COMMENT ' 录入时间', `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT ' 备注 ', `centre_id` bigint(20) NULL DEFAULT 0 COMMENT '所属的康复中心id', `doctor_id` bigint(20) NULL DEFAULT 0 COMMENT '主治医生id', `project_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除', PRIMARY KEY (`id`) USING BTREE, INDEX `patient_user_index`(`user_id`) USING BTREE, INDEX `patient_doctor_index`(`doctor_id`) USING BTREE, INDEX `patient_centre_idndex`(`centre_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '患者表' ROW_FORMAT = Dynamic; -- 患者机器人关联表 DROP TABLE IF EXISTS `t_patient_robot`; CREATE TABLE `t_patient_robot` ( `id` bigint(20) NOT NULL, `patient_id` bigint(20) NULL DEFAULT 0 COMMENT '患者id', `robot_id` bigint(20) NULL DEFAULT 0 COMMENT '机器人id', `start_time` bigint(20) NULL DEFAULT 0 COMMENT '连接时间', `end_time` bigint(20) NULL DEFAULT 0 COMMENT '断开时间', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `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 `robot_index`(`robot_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '患者表' ROW_FORMAT = Dynamic; -- 家属信息表 DROP TABLE IF EXISTS `t_relation`; CREATE TABLE `t_relation` ( `id` bigint(20) NOT NULL, `user_id` bigint(20) NULL DEFAULT 0 COMMENT ' 登录用户id', `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT ' 姓名 ', `sex` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT ' 性别(0:女 1:男) ', `age` int(11) NULL DEFAULT 0 COMMENT ' 年龄 ', `id_card` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '身份证号', `phone` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '联系方式', `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '家庭地址', `input_time` bigint(20) NULL DEFAULT 0 COMMENT ' 录入时间', `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT ' 备注 ', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除', PRIMARY KEY (`id`) USING BTREE, INDEX `relation_user_index`(`user_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '家属信息表' ROW_FORMAT = Dynamic; -- 患者家属关联表 DROP TABLE IF EXISTS `t_patient_relation`; CREATE TABLE `t_patient_relation` ( `id` bigint(20) NOT NULL, `patient_id` bigint(20) NULL DEFAULT 0 COMMENT ' 患者id', `relation_id` bigint(20) NULL DEFAULT 0 COMMENT ' 家属id', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `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 `relation_index`(`relation_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '患者家属关联表' ROW_FORMAT = Dynamic; -- 康复训练项目表 DROP TABLE IF EXISTS `t_rec_drill`; CREATE TABLE `t_rec_drill` ( `id` bigint(20) NOT NULL, `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '名称', `video` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '标准视频地址', `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT ' 备注 ', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `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 = Dynamic; -- 康复小游戏表 DROP TABLE IF EXISTS `t_rec_game`; CREATE TABLE `t_rec_game` ( `id` bigint(20) NOT NULL, `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '名称', `game_url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '小游戏地址', `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT ' 备注 ', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `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 = Dynamic; -- 训练和小游戏对应表 DROP TABLE IF EXISTS `t_rec_drill_game`; CREATE TABLE `t_rec_drill_game` ( `id` bigint(20) NOT NULL, `drill_id` bigint(20) NULL DEFAULT 0 COMMENT '训练id', `game_id` bigint(20) NULL DEFAULT 0 COMMENT '游戏id', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除', PRIMARY KEY (`id`) USING BTREE, INDEX `drill_index`(`drill_id`) USING BTREE, INDEX `game_index`(`game_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '训练和小游戏对应表' ROW_FORMAT = Dynamic; -- 处方表 DROP TABLE IF EXISTS `t_recipe`; CREATE TABLE `t_recipe` ( `id` bigint(20) NOT NULL, `patient_id` bigint(20) NULL DEFAULT 0 COMMENT ' 患者id', `doctor_id` bigint(20) NULL DEFAULT 0 COMMENT ' 医生id', `start_time` bigint(20) NULL DEFAULT 0 COMMENT '开始时间', `end_time` bigint(20) NULL DEFAULT 0 COMMENT '结束时间', `type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '处方状态 0医生开的处方 1自由训练', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除', PRIMARY KEY (`id`) USING BTREE, INDEX `recipe_patient_index`(`patient_id`) USING BTREE, INDEX `recipe_doctor_index`(`doctor_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '处方表' ROW_FORMAT = Dynamic; -- 处方项目表 DROP TABLE IF EXISTS `t_recipe_project`; CREATE TABLE `t_recipe_project` ( `id` bigint(20) NOT NULL, `recipe_id` bigint(20) NULL DEFAULT 0 COMMENT ' 处方id', `drill_id` bigint(20) NULL DEFAULT 0 COMMENT ' 需要做的康复训练的id', `cycle` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '重复频率 例如【每天】', `times_day` int(11) NULL DEFAULT 0 COMMENT ' 每天几次 ', `group_times` int(11) NULL DEFAULT 0 COMMENT ' 每次几组 ', `several_group` int(11) NULL DEFAULT 0 COMMENT ' 每组几个 ', `task_id` bigint(20) NULL DEFAULT 0 COMMENT ' 任务id', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除', PRIMARY KEY (`id`) USING BTREE, INDEX `project_recipe_index`(`recipe_id`) USING BTREE, INDEX `project_drill_index`(`drill_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '处方项目表' ROW_FORMAT = Dynamic; -- 处方项目表 DROP TABLE IF EXISTS `t_recipe_project_decompose`; CREATE TABLE `t_recipe_project_decompose` ( `id` bigint(20) NOT NULL, `recipe_project_id` bigint(20) NULL DEFAULT 0 COMMENT ' 处方项目id', `task_id` bigint(20) NULL DEFAULT 0 COMMENT ' 任务id', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除', PRIMARY KEY (`id`) USING BTREE, INDEX `decompose_recipe_project_index`(`recipe_project_id`) USING BTREE, INDEX `decompose_task_index`(`task_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '处方项目表' ROW_FORMAT = Dynamic; -- 训练记录表 DROP TABLE IF EXISTS `t_recipe_record`; CREATE TABLE `t_recipe_record` ( `id` bigint(20) NOT NULL, `patient_id` bigint(20) NULL DEFAULT 0 COMMENT ' 患者id', `decompose_id` bigint(20) NULL DEFAULT 0 COMMENT ' 处方项目分解id', `recovery_doctor_id` bigint(20) NULL DEFAULT 0 COMMENT ' 康复中心医生id', `robot_id` bigint(20) NULL DEFAULT 0 COMMENT ' 智能机器人id', `start_time` bigint(20) NULL DEFAULT 0 COMMENT '开始时间', `end_time` bigint(20) NULL DEFAULT 0 COMMENT '结束时间', `game_id` bigint(20) NULL DEFAULT 0 COMMENT '康复时使用的小游戏的id', `remote_guidance` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否有远程指导 0否 1是', `remote_doctor_id` bigint(20) NULL DEFAULT 0 COMMENT ' 远程指导医生id', `score` int(11) NULL DEFAULT 0 COMMENT ' 分数', `sub_task_id` bigint(20) NULL DEFAULT 0 COMMENT ' 分解后的任务id', `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id', `create_time` timestamp NOT NULL DEFAULT current_timestamp COMMENT ' 创建时间 ', `update_time` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT ' 修改时间 ', `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除', PRIMARY KEY (`id`) USING BTREE, INDEX `record_decompose_index`(`decompose_id`) USING BTREE, INDEX `record_game_index`(`game_id`) USING BTREE, INDEX `record_recovery_doctor_index`(`recovery_doctor_id`) USING BTREE, INDEX `record_robot_index`(`robot_id`) USING BTREE, INDEX `record_remote_doctor_index`(`remote_doctor_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '训练记录表' ROW_FORMAT = Dynamic;