-- ----------------------------
-- 审计记录表
-- ----------------------------
create table t_audit (
  id                bigint(20)    comment 'id'  not null  auto_increment,
  `year`            year          comment '年份',
  pre_audit_time    datetime      comment '预审时间',
  audit_time        datetime      comment '审计时间',
  audit_result      varchar(500)  comment '审计结果',
  remarks           varchar(500)  comment '备注',
  dept_id           varchar(255)  comment '装置id',
  primary key (id)
) engine=innodb auto_increment=100 comment = '审计记录表';

-- ----------------------------
-- 装置信息表
-- ----------------------------
create table t_dept_info (
  id                bigint(20)    comment 'id'  not null  auto_increment,
  `year`            year          comment '年份',
  dept_info         varchar(500)  comment '装置信息',
  dept_id           varchar(255)  comment '装置id',
  primary key (id)
) engine=innodb auto_increment=100 comment = '装置信息表';

-- ----------------------------
-- 章节表
-- ----------------------------
create table t_chapter (
  id                bigint(20)    comment 'id'  not null  auto_increment,
  audit_id          bigint(20)    comment '审计记录id',
  code              varchar(8)    comment '序号',
  name              varchar(500)  comment '名称',
  dept_id           varchar(255)  comment '装置id',
  primary key (id)
) engine=innodb auto_increment=100 comment = '章节表';

-- ----------------------------
-- 问卷表
-- ----------------------------
create table t_questionnaire (
  id                bigint(20)    comment 'id'  not null  auto_increment,
  audit_id          bigint(20)    comment '审计记录id',
  chapter_id        bigint(20)    comment '章节id',
  year              year          comment '年份',
  type              char(1)       comment '问卷类型',
  directory         varchar(500)  comment '目录',
  code              bigint(20)    comment '序号',
  name              varchar(500)  comment '名称',
  yes_no_na         char(1)       comment 'YES/NO/NA',
  minimum_standard  varchar(500)  comment 'MinimumStandard',
  good_practices    varchar(500)  comment 'Good Practices',
  standard         char(1)        comment '标准',
  completion_status char(1)       comment '完成情况',
  person_in_charge  bigint(20)    comment '负责人',
  reviewer          bigint(20)    comment '审核人',
  remarks           varchar(500)  comment '备注',
  dept_id           varchar(255)  comment '装置id',
  primary key (id)
) engine=innodb auto_increment=100 comment = '问卷表';


-- ----------------------------
-- 进度表
-- ----------------------------
create table t_progress (
  id                bigint(20)    comment 'id'  not null  auto_increment,
  sec_sub_chap_id   bigint(20)    comment '二级细分章节id',
  chap_name         varchar(500)  comment '章节',
  sub_chap_name     varchar(500)  comment '细分章节',
  sec_sub_chap_name varchar(500)  comment '二级细分章节',
  content           varchar(500)  comment '内容',
  person_in_charge  bigint(20)    comment '负责人',
  supporter         bigint(20)    comment '支持人',
  start_date        datetime      comment '开始日期',
  target_date       datetime      comment '目标日期',
  finish_date       datetime      comment '实际完成日期',
  preparation       char(1)       comment '准备情况',
  description          char(1)    comment '进度描述',
  apply_status      char(1)       comment '审批状态',
  remarks           varchar(500)  comment '备注',
  dept_id           varchar(255)  comment '装置id',
  primary key (id)
) engine=innodb auto_increment=100 comment = '进度表';

-- ----------------------------
-- 会议表
-- ----------------------------
create table t_meeting (
  id                bigint(20)    comment 'id'  not null  auto_increment,
  year              year          comment '年份',
  sec_sub_chap_id   bigint(20)    comment '涉及code',
  person_in_charge  bigint(20)    comment '负责人',
  remarks           varchar(500)  comment '备注',
  dept_id           varchar(255)  comment '装置id',
  primary key (id)
) engine=innodb auto_increment=100 comment = '会议表';

-- ----------------------------
-- 开项表
-- ----------------------------
create table t_open_item (
  id                bigint(20)    comment 'id'  not null  auto_increment,
  type              char(1)       comment '问题类型',
  sec_sub_chap_id   bigint(20)    comment '涉及整改code',
  description       varchar(500)  comment '存在问题描述',
  level             char(1)       comment '开项级别',
  open_time         datetime      comment '开项时间',
  close_time        datetime      comment '闭项时间',
  status            char(1)       comment '问题处理状态',
  person_in_charge  bigint(20)    comment '负责人',
  reviewer          bigint(20)    comment '审核人',
  result            char(1)       comment '责任人确认',
  deadline          datetime      comment '截至时间',
  remarks           varchar(500)  comment '备注',
  dept_id           varchar(255)  comment '装置id',
  primary key (id)
) engine=innodb auto_increment=100 comment = '开项表';