



CREATE TABLE `safetycheck_business_attachment` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '文件地址',
  `size` double DEFAULT NULL COMMENT '文件大小',
  `ext` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '扩展名',
  `old_file_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '旧文件名(包括后缀)',
  `create_time` datetime DEFAULT NULL COMMENT '上传时间',
  `create_by` bigint DEFAULT NULL COMMENT '上传人',
  `user_id` bigint DEFAULT NULL COMMENT '用户id',
  `dept_id` bigint DEFAULT NULL COMMENT '部门id',
  `business_id` bigint DEFAULT NULL COMMENT '业务id',
  `attachment_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '附件类型(5:安全检查-任务附件,6:安全检查-记录合格附件,7:安全检查-问题处理附件,8:安全检查-记录不合格附件,12: 安全检查-整改分派附件(问题表),13:安全检查-主/协整改附件,  21:报平安附件,22:安全材料,23:安全月报,24:安全简报,)',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-业务附件表';



CREATE TABLE `safetycheck_inspection_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_by` bigint DEFAULT NULL COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '删除标志（0代表存在 1代表删除）',
  `task_start_time` datetime DEFAULT NULL COMMENT '检查任务开始时间',
  `task_end_time` datetime DEFAULT NULL COMMENT '检查任务结束时间',
  `task_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '检查任务标题',
  `task_content` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '检查任务简介',
  `publish_flag` int DEFAULT '0' COMMENT '任务状态,0:未发布,1:已发布,2:已取消,3:已结束',
  `task_flag` int DEFAULT '0' COMMENT '计划类型,0:周计划，1:日计划，2:临时计划',
  `ext_dept_ids` varchar(450) DEFAULT NULL COMMENT '被检查单位部门ids(中间逗号分隔)',
  `ext_dept_names` varchar(850) DEFAULT NULL COMMENT '被检查单位部门名称字符串(中间逗号分隔)',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-外勤检查任务表';


CREATE TABLE `safetycheck_inspection_task_relation` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_by` bigint DEFAULT NULL COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `task_id` bigint DEFAULT NULL COMMENT '任务id',
  `task_user_id` bigint NOT NULL COMMENT '外勤检查人员Id',
  `task_user_name` varchar(50) DEFAULT NULL COMMENT '外勤检查人员姓名',
  `status` int DEFAULT '1' COMMENT '检查状态,0:未开始,1:已开始,2:已结束',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-外勤检查任务用户关联表';

CREATE TABLE `safetycheck_inspection_task_record` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `task_id` bigint DEFAULT NULL COMMENT '任务id',
  `task_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '任务标题',
  `inspection_user` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '检查人员',
  `inspection_user_id` bigint DEFAULT NULL COMMENT '检查人员Id',
  `inspection_tel` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '检查人员联系方式',
  `inspection_time` datetime DEFAULT NULL COMMENT '检查时间',
  `inspection_unit_dept_id` bigint DEFAULT NULL COMMENT '被检查单位-部门id(safetycheck_inspection_task.ext_dept_ids 里面的一个) 【NEW】',
  `inspection_place` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '检查地点',
  `inspection_place_lng` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '检查地点坐标经度',
  `inspection_place_lat` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '检查地点坐标纬度',
  `qualified_content` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '合格内容',
  `unqualified_content` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '不合格内容',
  `qualified_flag` int DEFAULT '1' COMMENT '是否存在不合格,0:存在,1:不存在',
  `report_status` int DEFAULT '0' COMMENT '上报状态,0:否,1:是',
  `deal_status` int DEFAULT '0' COMMENT '处理状态,0:未分派,1:待处理,2:已处理,3-已退回',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `create_by` bigint DEFAULT NULL COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '删除标志（0代表存在 1代表删除）',
  `status` int DEFAULT '0' COMMENT '检查单状态(0待上报,1 已上报,2待整改,3 已整改,4 已结束,5 已退回,6 已关闭)',
  `to_corp_name` varchar(200) DEFAULT NULL COMMENT '被检查单位名称',
  `organizer_unit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '主办单位',
  `organizer_unit_id` bigint DEFAULT NULL COMMENT '主办单位id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-外勤检查任务记录表';


CREATE TABLE `safetycheck_inspection_problem` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `problem_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '上报问题标题',
  `problem_content` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '上报问题描述',
  `task_id` bigint DEFAULT NULL COMMENT '任务id',
  `task_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '任务标题',
  `task_record_id` bigint DEFAULT NULL COMMENT '任务记录id',
  `deal_dept` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '处理部门',
  `deal_dept_id` bigint DEFAULT NULL COMMENT '处理部门id',
  `deal_limit_time` datetime DEFAULT NULL COMMENT '整改期限 【NEW】 ',	
  `deal_status` int DEFAULT '0' COMMENT '处理状态,0:待接收,1:未处理,2:已处理,3:已退回',
  `deal_content` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '处理描述',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '删除标志（0代表存在 1代表删除）',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `create_by` bigint DEFAULT NULL COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-外勤检查问题';


CREATE TABLE `safetycheck_inspection_problem_relation` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_by` bigint DEFAULT NULL COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `workorder_id` bigint DEFAULT NULL COMMENT '工单id(废弃）',
  `deal_dept_id` bigint NOT NULL COMMENT '处理部门id',
  `deal_dept` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '处理部门name  【NEW】 ',
  `assisting_unit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '协办单位',
  `assisting_unit_id` bigint DEFAULT NULL COMMENT '协办单位id',
  `handle_flag` tinyint DEFAULT '0' COMMENT '协办单位办理状态（3:已整改  ,2：待整改，1：已办理，0：未办理）',
  `problem_id` bigint DEFAULT NULL COMMENT '整改问题id',
  `status` tinyint DEFAULT '1' COMMENT '状态（1：有效，2：作废）（默认 1）',
  `task_id` bigint DEFAULT NULL COMMENT '任务id',
  `task_record_id` bigint NOT NULL COMMENT '任务记录id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-外勤整改-协办单位-关联表';

CREATE TABLE `safetycheck_inspection_deal` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `assisting_relation_id` bigint DEFAULT NULL COMMENT '协办单位关联id(关联表主键)',
  `task_record_id` bigint NOT NULL COMMENT '检查单id',
  `problem_id` bigint DEFAULT NULL COMMENT '整改id',
  `create_by` bigint DEFAULT NULL COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '删除标志（0代表存在 1代表删除）',
  `deal_dept` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '处理部门',
  `deal_dept_id` bigint DEFAULT NULL COMMENT '处理部门id',
  `deal_dept_type` tinyint DEFAULT NULL COMMENT '处理部门类型（1 集团 2: 主办 3 协办）',
  `deal_type` int DEFAULT NULL COMMENT '办理方式',
  `deal_time` datetime DEFAULT NULL COMMENT '办理时间',
  `deal_content` varchar(350) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '办理意见（主办单位/协办单位办理完成的时候填写）',
  `duty_dept_ids` varchar(550) DEFAULT NULL COMMENT '责任单位部门ids（多个中间逗号分隔）',
  `duty_dept_names` varchar(850) DEFAULT NULL COMMENT '责任单位部门名称字符串（多个，逗号分隔）',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-外勤整改-处理结果表';











CREATE TABLE `safetycheck_accident` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_time` datetime DEFAULT NULL COMMENT '上传时间',
  `create_by` bigint DEFAULT NULL COMMENT '上传人',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `weather` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '天气情况',
  `accident_rank` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '事故等级(数据字典 dataType= safetycheck_accident_rank )',
  `accident_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '事故类型(1 伤亡事故 2 交通事故 3 火灾事故 ，数据字典 dataType= safetycheck_accident_type )',
  `accident_remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '事故描述',
  `accident_time` datetime DEFAULT NULL COMMENT '事故日期时间（年月日时分秒）',
  `accident_address` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '事故地点',
  `accident_place_lng` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '事故地点-经度',
  `accident_place_lat` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '事故地点-维度',
  `accident_physical_address` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '事故地点-物理地址',
  `accident_casualties` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '伤亡情况',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-事故登记表';

CREATE TABLE `safetycheck_accident_traffic` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_time` datetime DEFAULT NULL COMMENT '上传时间',
  `create_by` bigint DEFAULT NULL COMMENT '上传人',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `accident_id` bigint not null COMMENT '事故id',
  `traffic_type_code` varchar(2) DEFAULT NULL COMMENT '交通事故类型(数据字典 safetycheck_traffic_type)',
  `line_code` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '线路code',
  `line_name` varchar(28) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '线路name',
  `bus_brand_no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '车牌号',  
  `onboardid` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '车辆-自编号',
  `driver_name` varchar(26) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '驾驶员姓名',
  `driver_workid` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '驾驶员-工号',
  `driver_travel_no` varchar(26) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '驾驶员-驾驶证号',
  `driver_sex_code` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '驾驶员-性别(数据字典 sys_user_sex)',
  `driver_year` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '驾驶员-出生-年',
  `driver_age` int DEFAULT '0' COMMENT '驾驶员-岁数',
  `run_orientation_code` varchar(2) DEFAULT NULL COMMENT '行驶方向(数据字典 safetycheck_run_orientation)',
  `collision_location_code` varchar(2) DEFAULT NULL COMMENT '碰撞部位(数据字典 safetycheck_collision_location)',
  `accident_duty_code` varchar(2) DEFAULT NULL COMMENT '事故责任(数据字典 safetycheck_collision_location)',
  `insurance_corp` varchar(60) DEFAULT NULL COMMENT '保险公司',  
  `accident_remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '事故概述',  
  `other_side_travel_type_code` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '对方-出行方式(数据字典 safetycheck_travel_type)',
  `other_side_bus_type_code` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '对方-驾驶车型(数据字典 safetycheck_bus_type)',
  `other_side_bus_brand_no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '对方-车牌号',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-事故登记-交通事故信息表';

CREATE TABLE `safetycheck_accident_traffic_otherside` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_by` bigint DEFAULT NULL COMMENT '创建人用户id',
  `update_by` bigint DEFAULT NULL COMMENT '更新者用户id',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `accident_id` bigint not null COMMENT '事故id',
  `accident_traffic_id` bigint not null COMMENT '事故-交通事故id',
  `person_name` varchar(20) DEFAULT NULL COMMENT '姓名',
  `person_sex_code` varchar(2) DEFAULT NULL COMMENT '性别(数据字典 sys_user_sex)',
  `person_age` int DEFAULT '0' COMMENT '年龄',
  `person_casualties` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '伤情描述',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-事故登记-交通事故-对方信息表';

CREATE TABLE `safetycheck_accident_workinjury` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_time` datetime DEFAULT NULL COMMENT '上传时间',
  `create_by` bigint DEFAULT NULL COMMENT '上传人',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `accident_id` bigint not null COMMENT '事故id',
  `person_name` varchar(20) DEFAULT NULL COMMENT '姓名',
  `person_age` int DEFAULT '0' COMMENT '年龄',
  `work_post` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '工作岗位',
  `injured_area` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '受伤部位',  
  `person_casualties` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '伤情描述',
  `insurance_num` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '保险编号',
  `card_num` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '身份证号',  
  `start_work_date` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '参加工作时间',  
  `accident_remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '事故概述',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-事故登记-工伤事故表';

CREATE TABLE `safetycheck_accident_transgress` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_time` datetime DEFAULT NULL COMMENT '上传时间',
  `create_by` bigint DEFAULT NULL COMMENT '上传人',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `accident_id` bigint not null COMMENT '事故id',
  `cheeck_corp` varchar(50) DEFAULT NULL COMMENT '单位(开具罚单的单位?)',
  `transgress_time` datetime DEFAULT NULL COMMENT '违章时间',
  `work_post` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '岗位',
  `transgress_address` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '违章地点',  
  `transgress_type_code` varchar(3) DEFAULT NULL COMMENT '违章类型(数据字典 safetycheck_transgress_type_)',
  `transgress_bus_num` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '违章-车号',  
  `transgress_source` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '违章-来源',  
  `person_name` varchar(26) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '姓名',
  `person_sex_code` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '性别(数据字典 sys_user_sex)',
  `person_drive_year` int DEFAULT '0' COMMENT '驾龄(年)',
  `person_age` int DEFAULT '0' COMMENT '年龄(岁)',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-事故登记-工伤事故表';

CREATE TABLE `safetycheck_safetydept` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_time` datetime DEFAULT NULL COMMENT '上传时间',
  `create_by` bigint DEFAULT NULL COMMENT '上传人',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `safety_dept_id` bigint not null COMMENT '报平安-部门id',
  `safety_dept_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT  null COMMENT '报平安-部门 name',
  `manage_dept_id` bigint not null COMMENT '上级管理-部门id',
  `manage_dept_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT  null COMMENT '报平安-部门 name',
  `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注',
  `enable_flag` int DEFAULT '1' COMMENT '是否启用(1:启用,0:禁用)', 
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-报平安-上报部门表';


CREATE TABLE `safetycheck_safetydept_user` (
   `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
   `create_time` datetime DEFAULT NULL COMMENT '上传时间',
   `create_by` bigint DEFAULT NULL COMMENT '上传人',
   `safetydept_id` bigint not null COMMENT '报平安部门表_id',
   `user_id` bigint not NULL COMMENT '上报人用户id',
   `user_name` varchar(26) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '上报人用户姓名',
   PRIMARY KEY (`id`) USING BTREE,
   UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-报平安-上报部门-上报用户表';

CREATE TABLE `safetycheck_safetydept_report` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_time` datetime DEFAULT NULL COMMENT '上传时间',
  `create_by` bigint DEFAULT NULL COMMENT '上传人',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `safety_dept_id` bigint not null COMMENT '报平安-部门id',
  `report_user_id` bigint not null COMMENT '上报人用户id',
  `report_user_name` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '上报人用户姓名',
  `report_time` datetime not null COMMENT '报告日期(年月日)',
  `status` int DEFAULT '0' COMMENT '上报时限状态(1正常,2早报,3迟报,0缺报)',  
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-报平安-部门-上报表';

CREATE TABLE `safetycheck_material` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `title` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '标题',
  `remark` varchar(800) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `publish_status` tinyint DEFAULT '0' COMMENT '是否发布(0:未发布,1:已发布)',
  `material_type_code` varchar(3) DEFAULT NULL COMMENT '材料类型(数据字典 safetycheck_material_type_)',
  `material_source` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '材料来源',
  `receive_corp` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '接收单位',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-安全材料表';

CREATE TABLE `safetycheck_safety_educate` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `educate_type_code` varchar(3) DEFAULT NULL COMMENT '教育类型(数据字典 safetycheck_educate_type_)',
  `manage_user_id` bigint not NULL COMMENT '主持人-用户id',
  `dept_id` bigint default NULL COMMENT '单位id',
  `educate_time` datetime DEFAULT NULL COMMENT '教育时间(年月日时分)',
  `educate_address` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '教育地点',
  `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '标题',
  `educate_content` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '教育内容',
  `educate_user_names` text DEFAULT NULL COMMENT '受教育人员-用户姓名(中间逗号分隔)',
  `educate_user_size` int DEFAULT '0' COMMENT '人数',
  `ext_material_file_ids` text DEFAULT NULL COMMENT '安全材料-附件ids', 
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-安全教育表';

CREATE TABLE `safetycheck_safety_report` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `title` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '标题',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `create_by` bigint DEFAULT NULL COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` bigint DEFAULT NULL COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `bill_type` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '单据类型',
  `bill_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '单据编码',
  `flow_key` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '申请流程',
  `flow_ins_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '流程实例id',
  `submit_time` datetime DEFAULT NULL COMMENT '提交时间',
  `report_type_code` varchar(3) DEFAULT NULL COMMENT '教育类型(数据字典 safetycheck_report_type 1:月报 2简报)',
  `status` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '流程状态。0：未提交。1：审批中。2：已完成',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1004 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='安全检查-安全报告';







