-- ----------------------------
-- TABLE STRUCTURE FOR BLADE_MODULE_VERSION
-- ----------------------------
CREATE TABLE IF NOT EXISTS `BLADE_MODULE_VERSION`  (
    `MODULE_NAME` VARCHAR(64) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL,
    `VERSION` VARCHAR(8) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL,
    `HISTORY` VARCHAR(300) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL,
    PRIMARY KEY (`MODULE_NAME`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_REPAIR
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_REPAIR`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `EM_CODE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '设备CODE',
    `NUMBER` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '编号',
    `COMPANY` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '单位',
    `HANDLE_STATUS` TINYINT(4) NULL DEFAULT 0 COMMENT '处理状态',
    `CHARGE` BIGINT(20) NULL DEFAULT NULL COMMENT '应急抢修负责人',
    `REPAIR_TEAM` BIGINT(20) NULL DEFAULT NULL COMMENT '应急抢修班组',
    `REPAIR_PERSONNEL` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '应急抢修人员',
    `REPAIR_TASK` VARCHAR(500) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '应急抢修任务描述',
    `ORIGINATOR` BIGINT(20) NULL DEFAULT NULL COMMENT '应急抢修发起人',
    `SAFETY_MEASURES` VARCHAR(2080) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '安全措施',
    `POINTS_ATTENTION` VARCHAR(500) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '抢修地点保留带电部分或注意事项',
    `RESERVE_MEASURES` VARCHAR(500) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '现场设备状况及保留安全措施',
    `LICENSOR` BIGINT(20) NULL DEFAULT NULL COMMENT '许可人',
    `LICENSOR_TIME` DATETIME NULL DEFAULT NULL COMMENT '许可时间',
    `LICENSOR_MEASURES` VARCHAR(2080) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '许可建议安全措施',
    `LICENSOR_MEMO` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '抢修完成许可描述',
    `LICENSOR_COMPLETE_TIME` DATETIME NULL DEFAULT NULL COMMENT '抢修完成许可时间',
    `IMPLEMENT_HOURS` VARCHAR(1024) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '抢修工时',
    `IMPLEMENT_START_TIME` DATETIME NULL DEFAULT NULL COMMENT '抢修开始时间',
    `IMPLEMENT_END_TIME` DATETIME NULL DEFAULT NULL COMMENT '抢修结束时间',
    `IMPLEMENT_DESC` VARCHAR(500) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '抢修描述',
    `PROCESS_INSTANCE_ID` VARCHAR(64) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '流程实例ID',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` TINYINT(4) NOT NULL COMMENT '是否删除',
    `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态 ',
    `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建部门',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_STANDARD_TICKET_INFO
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_STANDARD_TICKET_INFO`  (
    `ID` BIGINT(20) NOT NULL,
    `COMPANY` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '单位',
    `PROCESS_INSTANCE_ID` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作流ID',
    `CODE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '编码',
    `ISSUE_ORDER_PERSON` BIGINT(20) NOT NULL COMMENT '发令人',
    `ACCESS_ORDER_PERSON` BIGINT(20) NOT NULL COMMENT '受令人',
    `ISSUE_ORDER_TIME` DATETIME NULL DEFAULT NULL COMMENT '发令时间',
    `START_TIME` DATETIME NULL DEFAULT NULL,
    `END_TIME` DATETIME NULL DEFAULT NULL,
    `TITLE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '操作任务',
    `TASK_TYPE` VARCHAR(4) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '任务来源类型',
    `TASK_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '任务来源ID',
    `TASK_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '任务名称',
    `REMARK` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '备注',
    `OPERATOR` BIGINT(20) NULL DEFAULT NULL COMMENT '操作人',
    `OPERATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '操作时间',
    `GUARDIAN` BIGINT(20) NULL DEFAULT NULL COMMENT '监护人',
    `GUARDIANSHIP_TIME` DATETIME NULL DEFAULT NULL COMMENT '监护人确认时间',
    `PRINCIPAL` BIGINT(20) NULL DEFAULT NULL COMMENT '值班负责人',
    `PRINCIPAL_TIME` DATETIME NULL DEFAULT NULL COMMENT '值班负责人确认时间',
    `IS_EVALUATE` TINYINT(4) NULL DEFAULT 0 COMMENT '是否评价',
    `STATUS` TINYINT(4) NULL DEFAULT NULL,
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL,
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NOT NULL,
    `CREATE_TIME` DATETIME NOT NULL,
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL,
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL,
    `TICKET_TYPE` VARCHAR(4) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '票据类型',
    `SIGNAGE` VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '站点标识-两票编码',
    `SIGNAGE_CODE` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '编号（原站点ID）',
    `FLOW_USER_ID` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '用户ID',
    `FLOW_TASK_ID` VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '当前任务ID',
    `FLOW_TASK_NAME` VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '当前任务名称',
    `NEXT_STEP_OPERATOR` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '下一个审批人',
    `FLOW_STATUS` INT(11) NULL DEFAULT NULL COMMENT '流程状态',
    `FLOW_DESCRIPTION` VARCHAR(6000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '流程描述',
    `PROJECT_NAME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '项目名称',
    `CLASS_GROUP_NAME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '班组',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_STANDARD_TICKET_MEASURE
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_STANDARD_TICKET_MEASURE`  (
    `ID` BIGINT(20) NOT NULL,
    `TICKET_ID` BIGINT(20) NOT NULL COMMENT '标准票ID',
    `MEASURE_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '安全措施ID',
    `MEASURE` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '安全措施',
    `EXECUTOR` BIGINT(20) NULL DEFAULT NULL COMMENT '执行人ID',
    `EXECUTE_TIME` DATETIME NULL DEFAULT NULL COMMENT '执行时间',
    `EXECUTE_IMG_URL` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '执行图片',
    `REMARK` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '执行备注',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL,
    `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '1(执行）0（不执行）',
    `CREATE_DEPT` BIGINT(20) NOT NULL,
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NOT NULL,
    `CREATE_TIME` DATETIME NOT NULL,
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL,
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL,
    `SORT` TINYINT(4) NULL DEFAULT NULL COMMENT '排序',
    `MATTER_GROUP` BIGINT(20) NULL DEFAULT NULL COMMENT '模板',
    `OPERATION_TIME` DATETIME NULL DEFAULT NULL COMMENT '操作时间',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_TICKET_COUNT
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_TICKET_COUNT`  (
    `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `DATE_TIME` VARCHAR(20) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '日期',
    `DEPT_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '站点ID',
    `DEPT_NAME` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '站点名称',
    `TICKET_TYPE` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '票据类型',
    `TICKET_NUMBER` INT(11) NULL DEFAULT NULL COMMENT '开票数量',
    `TICKET_COMPLETE_NUM` INT(11) NULL DEFAULT NULL COMMENT '完成数量',
    `TICKET_DELAY_NUM` INT(11) NULL DEFAULT NULL COMMENT '延期数量',
    `TICKET_PROPORTION_NUM` INT(11) NULL DEFAULT NULL COMMENT '合格数量',
    `CREATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `UPDATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `IS_DELETED` TINYINT(1) NULL DEFAULT 0 COMMENT '逻辑删除',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_DEPT` VARCHAR(30) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '创建部门',
    `STATUS` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL,
    `INVALIDATED_TICKET_NUM` INT(11) NULL DEFAULT NULL COMMENT '废票数量',
    `WRONG_TICKET_NUM` INT(11) NULL DEFAULT NULL COMMENT '错票数量',
    `PERCENT_PASS_TICKET` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '合格率',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 1753594674490228738 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '两票统计分析' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_TICKET_INFO_DANGER
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_TICKET_INFO_DANGER`  (
    `ID` BIGINT(20) NULL DEFAULT NULL COMMENT '编号',
    `TICKET_ID` BIGINT(20) NULL DEFAULT NULL,
    `DANGEROUS_POINT` VARCHAR(500) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '危险点',
    `MAINTENANCE` TEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '安全措施',
    `CREATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `UPDATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT 0 COMMENT '逻辑删除'
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_TICKET_INFO_EVALUATE
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_TICKET_INFO_EVALUATE`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `TICKET_ID` BIGINT(20) NOT NULL COMMENT '票据ID',
    `EVALUATE` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '评价内容',
    `STATUS` TINYINT(4) NULL DEFAULT 1,
    `CREATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建机构',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '两票统计' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_TICKET_INFO_STATISTIC
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_TICKET_INFO_STATISTIC`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `DATE_TIME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '日期',
    `TICKET_INFO_TYPE` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '票据类型',
    `TICKET_INFO_NUMBER` INT(11) NULL DEFAULT NULL COMMENT '开票数量',
    `TICKET_INFO_COMPLETENUM` INT(11) NULL DEFAULT NULL COMMENT '本月完成开票数',
    `TICKET_INFO_START_NUM` INT(11) NULL DEFAULT NULL COMMENT '本月未完成开票数',
    `TICKET_INFO_DELAY_NUM` INT(11) NULL DEFAULT NULL COMMENT '本月延期开票数',
    `TICKET_INFO_PROPORTION` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '本月票据合格率',
    `STATUS` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建机构',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '两票统计' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_TICKET_MATTER_GROUP
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_TICKET_MATTER_GROUP`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `TICKET_TYPE` VARCHAR(4) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '票据类型',
    `NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '名称',
    `STATUS` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建机构',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '两票操作事项分组' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_TICKET_WORK_CONTENT
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_TICKET_WORK_CONTENT`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键',
    `TICKET_ID` BIGINT(20) NOT NULL COMMENT '票据ID',
    `ADDRESS` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作地点或地段',
    `CONTENT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作内容',
    `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL,
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL,
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建部门',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '第二种工作票工作任务' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_TICKET_WORK_CONTENT_TEMPLATE
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_TICKET_WORK_CONTENT_TEMPLATE`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键',
    `TEMPLATE_ID` BIGINT(20) NOT NULL COMMENT '票据ID',
    `ADDRESS` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作地点或地段',
    `CONTENT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作内容',
    `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL,
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL,
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建部门',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '第二种工作票工作任务' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_TWO_TICKET_MATTER_LIBRARY
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_TWO_TICKET_MATTER_LIBRARY`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `TYPE` VARCHAR(4) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '操作事项类型',
    `MATTER_GROUP` BIGINT(50) NULL DEFAULT NULL COMMENT '操作事项分组',
    `SAFETY_MEASURE` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '操作事项',
    `STATUS` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建机构',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    `SORT` TINYINT(4) NULL DEFAULT NULL COMMENT '排序',
    `MATTER_GROUP_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '分组名称',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '两票操作事项库' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_WORK_TICKET_DELAY
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_WORK_TICKET_DELAY`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `TICKET_ID` BIGINT(20) NOT NULL COMMENT '工作票ID',
    `FLOW_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '工作票流程ID',
    `INITIAL_TIME` DATETIME NULL DEFAULT NULL COMMENT '原时间',
    `CHANGE_TIME` DATETIME NOT NULL COMMENT '变更时间',
    `LICENSOR` BIGINT(20) NULL DEFAULT NULL COMMENT '延期许可人',
    `LICENSE_TIME` DATETIME NULL DEFAULT NULL COMMENT '延期许可人确认时间',
    `PRINCIPAL_TIME` DATETIME NULL DEFAULT NULL,
    `REMARK` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '延期说明',
    `STATUS` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建机构',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作票延期' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_WORK_TICKET_FINISH
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_WORK_TICKET_FINISH`  (
    `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
    `TICKET_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '工作票编号',
    `TEMP_GROUND_NUM` INT(11) NULL DEFAULT NULL COMMENT '临时接地线',
    `TEMP_DISMANTLE_NUM` INT(11) NULL DEFAULT NULL COMMENT '临时拆除几组',
    `GROUND_NUM` INT(11) NULL DEFAULT NULL COMMENT '接地线几组',
    `DISMANTLE_NUM` INT(11) NULL DEFAULT NULL COMMENT '拆除几组',
    `RETAIN_NUM` INT(11) NULL DEFAULT NULL COMMENT '保留几组',
    `CREATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `PRINCIPAL` BIGINT(20) NULL DEFAULT NULL COMMENT '负责人名称',
    `LICENSOR` BIGINT(20) NULL DEFAULT NULL COMMENT '许可人',
    `LICENSOR_END_TIME` DATETIME NULL DEFAULT NULL COMMENT '工作票终结时间',
    `PRINCIPAL_END_TIME` DATETIME NULL DEFAULT NULL COMMENT '负责人工作结束时间',
    `CONTENT` VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '备注',
    `TELL_CONTENT` VARCHAR(5000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '交底内容',
    `WORK_END_TIME` DATETIME NULL DEFAULT NULL COMMENT '结束时间',
    `BRAKE_NUMBER` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '刀闸编号',
    `GUARDIAN` BIGINT(20) NULL DEFAULT NULL COMMENT '监护人',
    `GUARDIAN_PLACE` VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '监护人地址',
    `OTHER_ITEMS` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '其他事项',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 6246 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作结束' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_WORK_TICKET_FLOW
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_WORK_TICKET_FLOW`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `TICKET_ID` BIGINT(20) NOT NULL COMMENT '工作票ID',
    `FLOW_CODE` VARCHAR(20) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '流程CODE',
    `EXECUTOR` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '当前流程执行人',
    `EXECUTE_TIME` DATETIME NULL DEFAULT NULL COMMENT '执行时间',
    `SIGN_IMG_PATH` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '签名路径',
    `GROUND_WIRE_CODE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '接地线编号',
    `GROUND_WIRE_COUNT` INT(11) NULL DEFAULT NULL COMMENT '接地线数量',
    `GROUND_SWITCH_COUNT` INT(11) NULL DEFAULT NULL COMMENT '接地刀闸数量',
    `REMARK` TINYTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '备注',
    `STATUS` TINYINT(4) NULL DEFAULT NULL,
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建机构',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    `PROC_TASK_ID` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作流流程任务ID',
    `FIRST_VALUE` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '各流程填入值',
    `SECOND_VALUE` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '各流程填入值',
    `THIRD_VALUE` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '各流程填入值',
    `FOURTH_VALUE` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '各流程填入值',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作票流程处理信息' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_WORK_TICKET_INFO
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_WORK_TICKET_INFO`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键',
    `EM_CODE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '设备名称',
    `EM_NAME` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '设备名称',
    `PROCESS_INSTANCE_ID` VARCHAR(64) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作流ID',
    `TYPE` VARCHAR(2) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '工作票类型',
    `COMPANY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '单位',
    `CODE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '编号',
    `TASK_TYPE` VARCHAR(2) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '关联业务类型',
    `TASK_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '关联业务ID',
    `TASK_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '关联业务名称',
    `CLASS_GROUP` BIGINT(20) NULL DEFAULT NULL COMMENT '班组',
    `CLASS_GROUP_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '班组名称',
    `CLASS_GROUP_MEMBERS` VARCHAR(500) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '班组成员',
    `CLASS_GROUP_MEMBERS_MANUAL` VARCHAR(500) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '班组成员手填',
    `CLASS_GROUP_MEMBERS_NAME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '班组成员名称',
    `ADDRESS_EQU_NAME` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作地点及设备名称',
    `WORK_CONTENT` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作任务及内容',
    `PLAN_START_TIME` DATETIME NULL DEFAULT NULL COMMENT '计划开始时间',
    `PLAN_END_TIME` DATETIME NULL DEFAULT NULL COMMENT '计划结束时间',
    `SIGNER` BIGINT(20) NULL DEFAULT NULL COMMENT '签发人',
    `SIGNER_DATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '签发人签发时间',
    `PRINCIPAL` BIGINT(20) NULL DEFAULT NULL COMMENT '负责人',
    `PRINCIPAL_MANUAL` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '负责人手填',
    `PRINCIPAL_NAME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '负责人名称',
    `LICENSOR` BIGINT(20) NULL DEFAULT NULL COMMENT '许可人',
    `LICENSE_TIME` DATETIME NULL DEFAULT NULL COMMENT '许可时间',
    `FLOW_CODE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '流程进行CODE',
    `LICENSE_END_TIME` DATETIME NULL DEFAULT NULL COMMENT '许可人确认工作结束时间',
    `IS_EVALUATE` TINYINT(4) NULL DEFAULT 0 COMMENT '是否评价',
    `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '1：未完成 2：执行中 3：已完成',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL,
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL,
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建部门',
    `CONFIRM_IMG_URLS` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作负责人确认工作完成上传图片地址',
    `CONFIRM_IMG_FILENAMES` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作负责人确认工作完成上传图片名称',
    `SORT` TINYINT(4) NULL DEFAULT NULL COMMENT '排序',
    `CONFIRM_WORK_TIME` DATETIME NULL DEFAULT NULL COMMENT '工作负责人确认工作完成时间',
    `PATTERN` VARCHAR(2) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '类型（1：值班人员添加2：许可人添加）',
    `WATCH_PRINCIPAL` BIGINT(20) NULL DEFAULT NULL COMMENT '值班负责人',
    `WATCH_PRINCIPAL_END_TIME` DATETIME NULL DEFAULT NULL COMMENT '批准工作结束时间',
    `POWER` VARCHAR(300) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT ' 工作条件（ 停电或不停电）',
    `FLOW_STATUS` INT(11) NULL DEFAULT NULL COMMENT '流程状态',
    `FLOW_DESCRIPTION` VARCHAR(6000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '流程描述',
    `FOLLOWER_NUM` INT(11) NULL DEFAULT 1 COMMENT '附页第几张',
    `SIGNAGE` VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '站点标识-两票编码',
    `SIGNAGE_CODE` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '编号（原站点ID）',
    `TICKET_TEMPLATE` VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '票据模板',
    `MAKE_DATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '开票时间',
    `TOTAL_PERSON` INT(11) NULL DEFAULT NULL COMMENT '共几人',
    `CONFIRM_DATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '负责人确认安全措施时间',
    `ISSUER_REVIEW_DATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '签发审核时间',
    `SIGN_FLAG` TINYINT(1) NULL DEFAULT NULL COMMENT '签发人签发是否通过',
    `RECIEVE_FLAG` TINYINT(1) NULL DEFAULT NULL COMMENT '运行人员是否通过',
    `INPUT` VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT 'INPUT= 延期   INPUT=转移  INPUT 通过',
    `NEXT_STEP_OPERATOR` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '下一个审批人',
    `STEP_OPERATOR` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '当前审批人',
    `FLOW_USER_ID` VARCHAR(5000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '用户ID',
    `FLOW_TASK_ID` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '当前任务ID',
    `FLOW_TASK_NAME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '当前任务名称',
    `PROJECT_NAME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '项目名称',
    `JOB_RECEIVER` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作接收人',
    `JOB_RECEIVER_TIME` DATETIME NULL DEFAULT NULL COMMENT '工作接收人时间',
    `IS_SAFETY` TINYINT(1) NULL DEFAULT 0 COMMENT '安全隔离措施附页 (TRUE,展示附件,FALSE,不展示附件)',
    `IS_HAZARD` TINYINT(1) NULL DEFAULT 0 COMMENT '危险点分析与预控措施票 (TRUE,展示附件,FALSE,不展示附件)',
    `IS_RAILWAY` TINYINT(1) NULL DEFAULT 0 COMMENT '动火工作票 (TRUE,展示附件,FALSE,不展示附件)',
    `IS_LIMITED` TINYINT(1) NULL DEFAULT 0 COMMENT ' 有限空间监测记录单(TRUE,展示附件,FALSE,不展示附件)',
    `IS_START` TINYINT(1) NULL DEFAULT 0 COMMENT '每日开工和收工时间附页',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作票' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_WORK_TICKET_MEASURE_TEMPLATE
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_WORK_TICKET_MEASURE_TEMPLATE`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `TEMPLATE_ID` BIGINT(20) NOT NULL COMMENT '工作票模板（检修计划）ID',
    `MEASURE_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '安全措施ID',
    `MATTER_GROUP` BIGINT(20) NULL DEFAULT NULL COMMENT '分组',
    `MEASURE` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '安全措施',
    `TYPE` VARCHAR(4) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '类型（1：值班人员添加2：签发人添加3：许可人添加）',
    `STATUS` TINYINT(20) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建机构',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    `SORT` TINYINT(4) NULL DEFAULT NULL COMMENT '排序',
    `IS_EXECUTE` TINYINT(1) NULL DEFAULT NULL COMMENT '执行状态 (1 执行,0 不执行 )',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '检修计划工作票安全措施模板列表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_WORK_TICKET_MEMBERS_CHANGE
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_WORK_TICKET_MEMBERS_CHANGE`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `TICKET_ID` BIGINT(20) NOT NULL COMMENT '工作票ID',
    `FLOW_CODE` VARCHAR(20) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '发生流程',
    `INITIAL_MEMBERS` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '原成员',
    `CHANGE_MEMBERS` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '变更成员',
    `STATUS` TINYINT(4) NULL DEFAULT NULL,
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建机构',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作班组成员变更' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_WORK_TICKET_OPERATE_TIME
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_WORK_TICKET_OPERATE_TIME`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `TICKET_ID` BIGINT(20) NOT NULL COMMENT '工作票ID',
    `START_TIME` DATETIME NULL DEFAULT NULL COMMENT '开始时间',
    `START_PRINCIPAL` BIGINT(20) NULL DEFAULT NULL COMMENT '开始负责人',
    `START_LICENSOR` BIGINT(20) NULL DEFAULT NULL COMMENT '开始许可人',
    `END_TIME` DATETIME NULL DEFAULT NULL COMMENT '结束时间',
    `END_PRINCIPAL` BIGINT(20) NULL DEFAULT NULL COMMENT '结束负责人',
    `END_LICENSOR` BIGINT(20) NULL DEFAULT NULL COMMENT '结束许可人',
    `STATUS` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建部门',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作票工作时间' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_WORK_TICKET_PRINCIPAL_CHANGE
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_WORK_TICKET_PRINCIPAL_CHANGE`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `TICKET_ID` BIGINT(20) NOT NULL COMMENT '工作票ID',
    `FLOW_CODE` BIGINT(255) NOT NULL COMMENT '发生流程',
    `INITIAL_PRINCIPAL` BIGINT(20) NOT NULL COMMENT '原负责人',
    `CHANGE_PRINCIPAL` BIGINT(20) NOT NULL COMMENT '变更负责人',
    `STATUS` TINYINT(4) NULL DEFAULT NULL,
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建机构',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID',
    `PRINCIPAL_CHANGE_TIME` DATETIME NULL DEFAULT NULL COMMENT '变动时间',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作票负责人变更' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_WORK_TICKET_SAFETY_MEASURE
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_WORK_TICKET_SAFETY_MEASURE`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
    `TICKET_ID` BIGINT(20) NOT NULL COMMENT '工作票ID',
    `MEASURE_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '安全措施ID',
    `MATTER_GROUP` BIGINT(20) NULL DEFAULT NULL COMMENT '分组',
    `MEASURE` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '安全措施',
    `TYPE` VARCHAR(4) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '类型（1：值班人员添加2：签发人添加3：许可人添加）',
    `EXECUTOR` BIGINT(20) NULL DEFAULT NULL COMMENT '执行人',
    `EXECUTE_TIME` DATETIME NULL DEFAULT NULL COMMENT '执行时间',
    `EXECUTE_REMARK` TINYTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '执行情况',
    `EXECUTE_IMG_URL` VARCHAR(300) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '拍照上传图片URL',
    `STATUS` TINYINT(20) NULL DEFAULT NULL,
    `COMPLETER` BIGINT(20) NULL DEFAULT NULL COMMENT '内容执行人',
    `COMPLETE_TIME` DATETIME NULL DEFAULT NULL COMMENT '内容完成时间',
    `COMPLETE_IMG_URL` VARCHAR(300) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '完成内容上传图片地址',
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建机构',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    `SORT` TINYINT(4) NULL DEFAULT NULL COMMENT '排序',
    `PATTERN` VARCHAR(2) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT '1' COMMENT '类型（1：值班人员添加2：许可人添加）',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作票安全措施列表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_WORK_TICKET_TEMPLATE
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_WORK_TICKET_TEMPLATE`  (
    `ID` BIGINT(20) NOT NULL COMMENT '主键',
    `EM_CODE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '设备名称',
    `EM_NAME` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '设备名称',
    `TYPE` VARCHAR(2) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '工作票类型',
    `COMPANY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '单位',
    `TASK_TYPE` VARCHAR(2) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '关联业务类型',
    `TASK_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '关联业务ID',
    `TASK_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '关联业务名称',
    `CLASS_GROUP` BIGINT(20) NULL DEFAULT NULL COMMENT '班组',
    `CLASS_GROUP_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '班组名称',
    `CLASS_GROUP_MEMBERS` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '班组成员',
    `CLASS_GROUP_MEMBERS_MANUAL` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '班组成员手填',
    `ADDRESS_EQU_NAME` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作地点及设备名称',
    `WORK_CONTENT` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '工作任务及内容',
    `PLAN_START_TIME` DATETIME NULL DEFAULT NULL COMMENT '计划开始时间',
    `PLAN_END_TIME` DATETIME NULL DEFAULT NULL COMMENT '计划结束时间',
    `SIGNER` BIGINT(20) NULL DEFAULT NULL COMMENT '签发人',
    `PRINCIPAL` BIGINT(20) NULL DEFAULT NULL COMMENT '负责人',
    `PRINCIPAL_MANUAL` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '负责人手填',
    `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '1：未完成 2：执行中 3：已完成',
    `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人',
    `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
    `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL,
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL,
    `IS_DELETED` TINYINT(4) NULL DEFAULT NULL,
    `CREATE_DEPT` BIGINT(20) NOT NULL COMMENT '创建部门',
    `PLAN_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '计划ID',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作票模板' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- VIEW STRUCTURE FOR V_HZIMS_TICKET_INFO
-- ----------------------------
DROP VIEW IF EXISTS `V_HZIMS_TICKET_INFO`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `V_HZIMS_TICKET_INFO` AS SELECT `HZIMS_TICKET_INFO`.`ID` AS `ID`,`HZIMS_TICKET_INFO`.`PROCESS_INSTANCE_ID` AS `PROCESS_INSTANCE_ID`,`HZIMS_TICKET_INFO`.`TYPE` AS `TYPE`,`HZIMS_TICKET_INFO`.`COMPANY` AS `COMPANY`,`HZIMS_TICKET_INFO`.`CODE` AS `CODE`,`HZIMS_TICKET_INFO`.`TASK_TYPE` AS `TASK_TYPE`,`HZIMS_TICKET_INFO`.`TASK_ID` AS `TASK_ID`,`HZIMS_TICKET_INFO`.`TASK_NAME` AS `TASK_NAME`,`HZIMS_TICKET_INFO`.`PLAN_START_TIME` AS `PLAN_START_TIME`,`HZIMS_TICKET_INFO`.`PLAN_END_TIME` AS `PLAN_END_TIME`,`HZIMS_TICKET_INFO`.`STATUS` AS `STATUS`,`HZIMS_TICKET_INFO`.`TENANT_ID` AS `TENANT_ID`,`HZIMS_TICKET_INFO`.`CREATE_USER` AS `CREATE_USER`,`HZIMS_TICKET_INFO`.`CREATE_TIME` AS `CREATE_TIME`,`HZIMS_TICKET_INFO`.`UPDATE_USER` AS `UPDATE_USER`,`HZIMS_TICKET_INFO`.`UPDATE_TIME` AS `UPDATE_TIME`,`HZIMS_TICKET_INFO`.`IS_DELETED` AS `IS_DELETED`,`HZIMS_TICKET_INFO`.`CREATE_DEPT` AS `CREATE_DEPT`,`HZIMS_TICKET_INFO`.`FLOW_DESCRIPTION` AS `FLOW_DESCRIPTION` FROM (SELECT `HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`ID` AS `ID`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`PROCESS_INSTANCE_ID` AS `PROCESS_INSTANCE_ID`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`TYPE` AS `TYPE`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`COMPANY` AS `COMPANY`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`CODE` AS `CODE`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`TASK_TYPE` AS `TASK_TYPE`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`TASK_ID` AS `TASK_ID`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`TASK_NAME` AS `TASK_NAME`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`PLAN_START_TIME` AS `PLAN_START_TIME`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`PLAN_END_TIME` AS `PLAN_END_TIME`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`STATUS` AS `STATUS`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`TENANT_ID` AS `TENANT_ID`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`CREATE_USER` AS `CREATE_USER`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`CREATE_TIME` AS `CREATE_TIME`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`UPDATE_USER` AS `UPDATE_USER`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`UPDATE_TIME` AS `UPDATE_TIME`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`IS_DELETED` AS `IS_DELETED`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`CREATE_DEPT` AS `CREATE_DEPT`,`HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO`.`FLOW_DESCRIPTION` AS `FLOW_DESCRIPTION` FROM `HZIMS-TICKET`.`HZIMS_WORK_TICKET_INFO` UNION ALL SELECT `HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`ID` AS `ID`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`PROCESS_INSTANCE_ID` AS `PROCESS_INSTANCE_ID`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`TICKET_TYPE` AS `TYPE`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`COMPANY` AS `COMPANY`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`CODE` AS `CODE`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`TASK_TYPE` AS `TASK_TYPE`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`TASK_ID` AS `TASK_ID`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`TASK_NAME` AS `TASK_NAME`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`START_TIME` AS `PLAN_START_TIME`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`END_TIME` AS `PLAN_END_TIME`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`STATUS` AS `STATUS`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`TENANT_ID` AS `TENANT_ID`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`CREATE_USER` AS `CREATE_USER`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`CREATE_TIME` AS `CREATE_TIME`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`UPDATE_USER` AS `UPDATE_USER`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`UPDATE_TIME` AS `UPDATE_TIME`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`IS_DELETED` AS `IS_DELETED`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`CREATE_DEPT` AS `CREATE_DEPT`,`HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`.`FLOW_DESCRIPTION` AS `FLOW_DESCRIPTION` FROM `HZIMS-TICKET`.`HZIMS_STANDARD_TICKET_INFO`) `HZIMS_TICKET_INFO` WHERE (`HZIMS_TICKET_INFO`.`IS_DELETED` = 0);
