SET FOREIGN_KEY_CHECKS=0;

CREATE TABLE `hzims-middle`.`hzims_process_type`  (
                                                      `id` bigint(20) NOT NULL AUTO_INCREMENT,
                                                      `sequence` int(11) NOT NULL COMMENT '序号',
                                                      `deployment_id` varchar(160) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前环节流程key',
                                                      `deployment_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前流程名称',
                                                      `segment` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '一个流程图的名称',
                                                      `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
                                                      `update_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
                                                      `is_deleted` tinyint(4) NULL DEFAULT 0 COMMENT '逻辑删除',
                                                      PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工作流审批类型' ROW_FORMAT = Dynamic;

ALTER TABLE `hzims-middle`.`hzims_statistics` MODIFY COLUMN `module_name_num` int(11) NULL DEFAULT 0 COMMENT '功能模块统计' AFTER `module_name`;

ALTER TABLE `hzims-middle`.`hzims_statistics` MODIFY COLUMN `date_calculated` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '统计日期' AFTER `module_name_num`;

ALTER TABLE `hzims-middle`.`hzims_statistics` DROP COLUMN `title`;

ALTER TABLE `hzims-middle`.`hzims_statistics` DROP COLUMN `title_num`;

ALTER TABLE `hzims-middle`.`hzims_statistics` DROP COLUMN `path`;

ALTER TABLE `hzims-middle`.`hzims_statistics` DROP COLUMN `path_num`;

ALTER TABLE `hzims-middle`.`hzims_sys_log` ENGINE = MyISAM;

ALTER TABLE `hzims-middle`.`hzims_sys_log` ADD INDEX `hzims_sys_log_operation_time_index`(`operation_time`) USING BTREE;

ALTER TABLE `hzims-middle`.`hzims_sys_log` ADD INDEX `hzims_sys_log_module_name_index`(`module_name`) USING BTREE;

ALTER TABLE `hzims-middle`.`hzims_sys_log` ADD INDEX `hzims_sys_log_title_index`(`title`) USING BTREE;

CREATE TABLE `hzims-middle`.`hzims_workflow_operation_log`  (
                                                                `id` bigint(20) NOT NULL AUTO_INCREMENT,
                                                                `take_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前任务ID',
                                                                `take_name` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前任务名称',
                                                                `process_definition_key` char(160) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前环节流程ID',
                                                                `process_instance_key` char(160) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '实例key',
                                                                `next_step_operator` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '下一环节处理人',
                                                                `variables` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '表单',
                                                                `user_id` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户Id',
                                                                `handleType` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ' 根据handleType区分是用户还是候选组角色 标识 0是用户 1是角色',
                                                                `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
                                                                `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
                                                                `is_deleted` tinyint(4) NULL DEFAULT NULL COMMENT '是否逻辑删除，0 可用，1. 不可用',
                                                                PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工作流操作日志' ROW_FORMAT = Dynamic;

CREATE TABLE `hzims-middle`.`process_dict`  (
                                                `dict_code` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '票据编码',
                                                `dict_sort` int(4) NULL DEFAULT 0 COMMENT '票据排序',
                                                `dict_key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '票据字典码',
                                                `dict_value` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '票据流程标识',
                                                `dict_label` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '票据标签',
                                                `dict_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '票据类型',
                                                `is_default` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'N' COMMENT '是否默认（Y是 N否）',
                                                `status` tinyint(1) NULL DEFAULT 0 COMMENT '状态（0正常 1停用）',
                                                `create_dept` bigint(20) NULL DEFAULT NULL COMMENT '所属机构',
                                                `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
                                                `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
                                                `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '票据备注',
                                                PRIMARY KEY (`dict_code`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工作流字典表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS=1;