use `qc`;

-- alter table qc_cases_entry add COLUMN `rule_type` TINYINT(4) DEFAULT '0' COMMENT '规则类型(0：无，1：空项，2：错误)' after `name`;
-- INSERT INTO `sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('286', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '12', '日常病程录', '56', '1', '286', '所属模块');
-- INSERT INTO `sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('287', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '14', '无', '0', '1', '1', '质控错误类型');
-- INSERT INTO `sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('288', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '14', '空项', '1', '1', '2', '质控错误类型');
-- INSERT INTO `sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('289', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '14', '错误', '2', '1', '3', '质控错误类型');

-- 已经在四个环境执行过并且已经和技术服务部同步
-- ALTER TABLE `med_medical_record` ADD INDEX `idx_hos_becode` ( `hospital_id`, `behospital_code` ) USING BTREE;
-- ALTER TABLE `med_medical_record` ADD INDEX `idx_mode_id` ( `mode_id` ) USING BTREE;

-- ALTER TABLE `med_qcresult_detail` ADD INDEX `idx_cases_entry_id` (`cases_entry_id`) USING BTREE;
-- ALTER TABLE `med_qcresult_detail` ADD INDEX `idx_cases_id` (`cases_id`) USING BTREE;
--
-- ALTER TABLE `qc_cases_entry_hospital` ADD INDEX `idx_cases_entry_id` (`cases_entry_id`) USING BTREE;
-- ALTER TABLE `qc_cases_entry_hospital` ADD INDEX `idx_is_reject` (`is_reject`) USING BTREE;

ALTER TABLE `med_behospital_info` ADD INDEX `idx_leave_hospital_date` (`leave_hospital_date`) USING BTREE;
ALTER TABLE `qc_cases_entry_hospital` ADD INDEX `idx_hospital_id` (`hospital_id`) USING BTREE;


ALTER TABLE `med_record_type` ADD `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除，Y:删除' AFTER `remark`;
ALTER TABLE `med_record_type` ADD `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间' AFTER `is_deleted`;
ALTER TABLE `med_record_type` ADD `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改' AFTER `gmt_create`;
ALTER TABLE `med_record_type` ADD `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人，0表示无创建人值' AFTER `gmt_modified`;
ALTER TABLE `med_record_type` ADD `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改' AFTER `creator`;


INSERT INTO `qc_mode` (`id`, `name`, `order_no`, `parent_id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `remark`) VALUES ('56', '日常病程录', '210', '37', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', NULL);

delete from sys_dictionary_info where group_type = 0 and is_deleted = 'Y';

ALTER TABLE `qc_cases_entry_hospital` MODIFY COLUMN  `is_reject` int(3) NOT NULL DEFAULT '0' COMMENT '单项否决（1-单项否决 0-非）' AFTER `is_used`;