use `qc`;

/**
med_home_page 病案首页表新增字段
 */
ALTER TABLE `med_home_page`
ADD COLUMN `medical_record_type`  varchar(32) NULL COMMENT '病例分型' AFTER `is_be_in_danger`,
ADD COLUMN `is_intensive_care`  varchar(2) NULL COMMENT '有无实施重症监护' AFTER `medical_record_type`,
ADD COLUMN `intensive_care_length`  varchar(32) NULL COMMENT '实施重症监护时长' AFTER `is_intensive_care`,
ADD COLUMN `intensive_care_day`  varchar(32) NULL COMMENT '实施重症监护天' AFTER `intensive_care_length`,
ADD COLUMN `intensive_care_hour`  varchar(32) NULL COMMENT '实施重症监护小时' AFTER `intensive_care_day`,
ADD COLUMN `drg_mange_mode`  varchar(32) NULL COMMENT '实施DRG管理方式' AFTER `intensive_care_hour`,
ADD COLUMN `is_antibiotic_use`  varchar(2) NULL COMMENT '是否抗生素使用' AFTER `drg_mange_mode`,
ADD COLUMN `is_sobcsfe`  varchar(2) NULL COMMENT '是否细菌培养标本送检' AFTER `is_antibiotic_use`,
ADD COLUMN `legalinfectious_disease_type`  varchar(32) NULL COMMENT '法定传染病类别' AFTER `is_sobcsfe`,
ADD COLUMN `tumour_t_stages`  varchar(32) NULL COMMENT '浸入的组织深度(肿瘤分期T) ' AFTER `legalinfectious_disease_type`,
ADD COLUMN `tumour_n_stages`  varchar(32) NULL COMMENT '淋巴结转移情况(肿瘤分期N)' AFTER `tumour_t_stages`,
ADD COLUMN `tumour_m_stages`  varchar(32) NULL COMMENT '远处转移情况(肿瘤分期M)' AFTER `tumour_n_stages`,
ADD COLUMN `newborn_apgar`  varchar(32) NULL COMMENT '新生儿Apgar评分' AFTER `tumour_m_stages`,
ADD COLUMN `tumour_stages`  varchar(64) NULL COMMENT '肿瘤分期' AFTER `tumour_m_stages`;


/**
med_behospital_info 病历表新增字段
 */
ALTER TABLE `med_behospital_info`
ADD COLUMN `is_daytime`  varchar(2) NOT NULL DEFAULT 0 COMMENT '是否日间病例,1:是，0:否' AFTER `is_placefile`;


/**
med_defect_feedback 新增缺陷反馈表
 */

DROP TABLE IF EXISTS `med_defect_feedback`;
CREATE TABLE `med_defect_feedback` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `hospital_id` bigint(11) DEFAULT NULL COMMENT '医院ID',
  `dept_id` varchar(16) DEFAULT NULL COMMENT '住院科室ID',
  `dept_name` varchar(64) DEFAULT NULL COMMENT '住院科室名称',
  `behospital_code` varchar(16) NOT NULL COMMENT '病人住院ID',
  `name` varchar(32) NOT NULL COMMENT '姓名',
  `cases_entry_id` bigint(20) DEFAULT NULL COMMENT '条目ID',
  `qcresult_detail_msg` varchar(255) DEFAULT NULL COMMENT '提示信息',
  `qcresult_detai_score` decimal(5,1) DEFAULT NULL COMMENT '人工修改分值',
  `mode_id` bigint(20) DEFAULT NULL COMMENT '模块id',
  `mode_name` varchar(60) DEFAULT NULL COMMENT '模块名称',
  `explain_info` varchar(1500) DEFAULT NULL COMMENT '反馈说明',
  `operation_type` char(3) NOT NULL COMMENT '操作类型 1:修改|2:删除|3:新增已有|4:新增缺失|5:恢复',
  `sender_code` varchar(20) NOT NULL COMMENT '发送人编号',
  `sender_name` varchar(32) NOT NULL COMMENT '发送人姓名',
  `receiver_code` varchar(20) NOT NULL COMMENT '接收人编号',
  `receiver_name` varchar(32) NOT NULL COMMENT '接收人姓名',
  `cc_codes` varchar(255) DEFAULT NULL COMMENT '抄送人编号集合',
  `cc_names` varchar(1024) DEFAULT NULL COMMENT '抄送人姓名集合',
  `status` char(3) NOT NULL DEFAULT '0' COMMENT '状态 0:待确认|1:已确认',
  `is_deleted` char(3) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除，Y:删除',
  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
  `creator` varchar(60) NOT NULL DEFAULT '0' COMMENT '创建人，0表示无创建人值',
  `modifier` varchar(60) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='缺陷反馈表';


/**
sys_role 新增质控科反馈人员角色
 */
INSERT INTO `sys_role` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `roleLevel`, `descritpion`, `menuItems`, `remark`) VALUES ('20', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '质控科反馈人员', '0', '', '', NULL);



/**
sys_menu 新增缺陷反馈记录菜单
 */
INSERT INTO `sys_menu` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ('110', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '缺陷反馈记录', '-1', 'YH-QXFKJL', '1', '1', '15', '用户-缺陷反馈记录');
INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('190', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '查看', 'FUNC000190', '/qc/behospitalInfo/getByBehospitalCode', 'ALL', '查看', '用户-缺陷反馈记录-查看');
INSERT INTO `sys_menu_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '110', '190', NULL, '用户-缺陷反馈记录-查看');

/**
sys_user_pageset 页面设定新增是否日间病历
 */
INSERT INTO `sys_user_pageset` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '1', '是否日间病历', 'isDaytime', '1', '26', NULL);

/**
sys_dictionary_info 系统字典表加入缺陷反馈状态及操作类型
 */
INSERT INTO `sys_dictionary_info` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '36', '缺陷反馈', '37,38', '2', '0', '缺陷反馈状态等字典数据总览');
INSERT INTO `sys_dictionary_info` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '37', '1', '修改条目', '2', '0', '操作类型');
INSERT INTO `sys_dictionary_info` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '37', '2', '删除条目', '2', '0', '操作类型');
INSERT INTO `sys_dictionary_info` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '37', '3', '新增已有条目', '2', '0', '操作类型');
INSERT INTO `sys_dictionary_info` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '37', '4', '新增缺失条目', '2', '0', '操作类型');
INSERT INTO `sys_dictionary_info` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '37', '5', '恢复条目', '2', '0', '操作类型');
INSERT INTO `sys_dictionary_info` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '38', '0', '待确认', '2', '0', '状态');
INSERT INTO `sys_dictionary_info` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '38', '1', '已确认', '2', '0', '状态');
