/*
 Navicat Premium Data Transfer

 Source Server         : 172.16.6.60
 Source Server Type    : MySQL
 Source Server Version : 50722
 Source Host           : 172.16.6.60:3306
 Source Schema         : amos-jcs-biz

 Target Server Type    : MySQL
 Target Server Version : 50722
 File Encoding         : 65001

 Date: 18/09/2021 11:18:50
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for cb_latent_danger
-- ----------------------------
DROP TABLE IF EXISTS `cb_latent_danger`;
CREATE TABLE `cb_latent_danger`  (
                                     `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增',
                                     `biz_type` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '业务类型（不同业务创建的隐患以此区分）',
                                     `business_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '业务唯一标识',
                                     `org_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '公司',
                                     `danger_name` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '隐患名称',
                                     `current_flow_record_id` bigint(20) NULL DEFAULT NULL COMMENT '当前工作流记录编号',
                                     `instance_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流实例编号',
                                     `danger_level` tinyint(4) NOT NULL DEFAULT 1 COMMENT '隐患等级（1：一般隐患；2：重大隐患；0：安全问题）',
                                     `danger_position` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '隐患地点',
                                     `longitude` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '隐患地址经度',
                                     `latitude` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '隐患地址纬度',
                                     `danger_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '隐患类型（1：无码无计划隐患；2：巡检隐患；3：有码无计划隐患；4：随手拍）',
                                     `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
                                     `overtime_state` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否逾期（0：否；1：是）',
                                     `reform_type` tinyint(4) NULL DEFAULT NULL COMMENT '整改类型（1：常规整改；2：安措计划；3：延期治理）',
                                     `reform_limit_date` datetime NULL DEFAULT NULL COMMENT '整改限制时间',
                                     `reform_json` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '整改对象',
                                     `danger_state` tinyint(4) NOT NULL DEFAULT 1 COMMENT '隐患状态（1：待评审；2：待治理；3：安措计划中；4：待验证；5：治理完毕；6：已撤销；7：延期治理中；8：延期治理待车间部门审核；9：延期治理待公司审核',
                                     `discoverer_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '发现人',
                                     `discoverer_department_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发现人部门编号',
                                     `photo_urls` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '图片',
                                     `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否删除（0：否；1：是）',
                                     `create_date` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '记录创建时间',
                                     `update_date` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '记录修改时间',
                                     `delay_limit_date` datetime NULL DEFAULT NULL COMMENT '延期治理时间',
                                     `problem_description` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '问题描述',
                                     `reason_analysis` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '原因分析',
                                     `infer_other_things` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '举一反三',
                                     `check_input_id` bigint(20) NULL DEFAULT NULL COMMENT '检查记录创建隐患对应check_input_id',
                                     `structure_id` bigint(20) NULL DEFAULT NULL COMMENT '建筑ID',
                                     `structure_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '建筑名称',
                                     `instance_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流程实例key',
                                     PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 321 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '隐患表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;


/*
 Navicat Premium Data Transfer

 Source Server         : 172.16.6.60
 Source Server Type    : MySQL
 Source Server Version : 50722
 Source Host           : 172.16.6.60:3306
 Source Schema         : amos-jcs-biz

 Target Server Type    : MySQL
 Target Server Version : 50722
 File Encoding         : 65001

 Date: 18/09/2021 11:18:58
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for cb_latent_danger_flow_record
-- ----------------------------
DROP TABLE IF EXISTS `cb_latent_danger_flow_record`;
CREATE TABLE `cb_latent_danger_flow_record`  (
                                                 `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增',
                                                 `danger_id` bigint(20) NOT NULL COMMENT '隐患编号',
                                                 `action_flag` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '执行标志',
                                                 `flow_task_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前节点名称',
                                                 `flow_task_user_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '当前节点可执行人（多个逗号分开）',
                                                 `flow_task_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前节点编号',
                                                 `excute_state` tinyint(4) NOT NULL DEFAULT 1 COMMENT '执行状态（1：未执行；2：通过；3：驳回）',
                                                 `excute_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '执行人',
                                                 `excute_department_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '执行部门编号',
                                                 `excute_result` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '执行结果',
                                                 `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
                                                 `flow_json` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '上传数据',
                                                 `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否删除（0：否；1：是）',
                                                 `create_date` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '记录创建时间',
                                                 `update_date` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '记录修改时间',
                                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 449 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '隐患工作流记录表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

