CREATE TABLE `article` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`department_id` bigint(20) unsigned NOT NULL COMMENT '科室ID',
`name` varchar(255) NOT NULL COMMENT '文章名称',
`brief` varchar(255) DEFAULT NULL COMMENT '文章简介',
`author_id` bigint(20) unsigned NOT NULL COMMENT '作者ID',
`author_type` bigint(20) unsigned NOT NULL COMMENT '作者角色,[Nurse,Admin]',
`status` bigint(20) NOT NULL DEFAULT '0' COMMENT '文章状态 [草稿,已发布]',
`content` longtext COMMENT '文章正文',
`banner_url` varchar(512) DEFAULT NULL COMMENT '文章图片路径',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `article_department_id_idx` (`department_id`),
KEY `article_name_idx` (`name`),
KEY `article_author_id_idx` (`author_id`),
KEY `article_author_type_idx` (`author_type`),
KEY `article_status_idx` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `evaluation` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`author_id` bigint(20) unsigned NOT NULL COMMENT '作者ID',
`author_type` bigint(20) unsigned NOT NULL COMMENT '作者角色,[Nurse,Admin]',
`department_id` bigint(20) unsigned NOT NULL COMMENT '科室ID',
`type` bigint(20) NOT NULL COMMENT '0:自测,1:评估',
`status` bigint(20) NOT NULL DEFAULT '0' COMMENT '评估状态 0:草稿 1:已发布',
`name` varchar(255) NOT NULL COMMENT '评估名称',
`icon` bigint(20) unsigned DEFAULT NULL COMMENT 'icon id',
`icon_color` varchar(255) DEFAULT NULL COMMENT 'icon color',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`desc` text,
PRIMARY KEY (`id`),
KEY `evaluation_department_id_idx` (`department_id`),
KEY `evaluation_author_id_idx` (`author_id`),
KEY `evaluation_author_type_idx` (`author_type`),
KEY `evaluation_name_idx` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `evaluation_submit_record` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`evaluation_id` bigint(20) unsigned NOT NULL COMMENT '评估ID',
`submitor_id` bigint(20) unsigned COMMENT '提交人Id',
`submitor_type` bigint(20) unsigned COMMENT '提交人类型',
`content` longtext COMMENT '提交的内容',
`content` longtext COMMENT '提交的内容',
`comment` longtext COMMENT '护士评价',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `mapping_evaluation_question_bundle` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`evaluation_id` bigint(20) unsigned NOT NULL COMMENT '评估ID',
`question_bundle_id` bigint(20) unsigned NOT NULL COMMENT '题组ID',
`rank` bigint(20) unsigned NOT NULL COMMENT '题组排序',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `mapping_evaluation_question_bundle_evaluation_id_idx` (`evaluation_id`),
KEY `mapping_evaluation_question_bundle_question_bundle_id_idx` (`question_bundle_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `question` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` longtext COMMENT '问题题目',
`desc` longtext COMMENT '问题题目',
`desc_pic_url` longtext COMMENT '问题题目',
`type` bigint(20) NOT NULL COMMENT '0:单选,1:多选,2:填空,3:单选矩阵',
`question_bundle_id` bigint(20) unsigned NOT NULL COMMENT '关联的题组ID',
`required` bit(1) NOT NULL DEFAULT b'0' COMMENT '0:必填,1:选填',
`rank` bigint(20) unsigned NOT NULL COMMENT '问题在问题组的顺序',
`content` longtext COMMENT '问题选项内容',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `question_type_idx` (`type`),
KEY `question_question_bundle_id_idx` (`question_bundle_id`),
KEY `question_required_idx` (`required`),
KEY `question_rank_idx` (`rank`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `question_bundle` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`author_id` bigint(20) unsigned NOT NULL COMMENT '作者ID',
`author_type` bigint(20) unsigned NOT NULL COMMENT '作者角色,[Nurse,Admin]',
`name` varchar(255) NOT NULL COMMENT '题组名称',
`desc` varchar(512) NOT NULL COMMENT '题组描述',
`type` bigint(20) NOT NULL COMMENT '0:自测,1:评估',
`department_id` bigint(20) unsigned NOT NULL COMMENT '科室ID',
`status` bigint(20) NOT NULL DEFAULT '0' COMMENT '题组状态 0:草稿 1:已发布',
`content` longtext COMMENT '结论以及 Tag Mapping',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `question_bundle_author_id_idx` (`author_id`),
KEY `question_bundle_author_type_idx` (`author_type`),
KEY `question_bundle_type_idx` (`type`),
KEY `question_bundle_department_id_idx` (`department_id`),
KEY `question_bundle_status_idx` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `user_article` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL COMMENT '作者ID',
`article_id` bigint(20) unsigned NOT NULL COMMENT '作者ID',
`is_read` bigint(20) NOT NULL DEFAULT '1' COMMENT '患者是否已读,0:未读 1:已读',
`is_useful` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '是否有用,0:未知 1无用 2:有用',
`is_collected` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '是否收藏 0:否 1:是',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `user_article_user_id_article_id_uiq` (`user_id`,`article_id`),
KEY `user_article_user_id_idx` (`user_id`),
KEY `user_article_article_id_idx` (`article_id`),
KEY `user_article_is_read_idx` (`is_read`),
KEY `user_article_is_useful_idx` (`is_useful`),
KEY `user_article_is_collected_idx` (`is_collected`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;