-- ----------------------------
-- 1、非洲猪瘟检测表
-- ----------------------------
drop table if exists hb_check_asf;
create table hb_check_asf (
  id                bigint(20)      not null auto_increment    comment '自增id',
  record_id         varchar(60)     default null               comment '检测报告编号',
  mark_no_group     varchar(300)    default null               comment '采样编号，可以是一个或多个编号，多个用逗号分隔',
  quantity          Integer         default 0                  comment '检测生猪数',
  sample_no_group   varchar(300)    default null               comment '样品编号',
  animal_cert_no    varchar(300)    default null               comment '对应检疫证号码',
  drug_name         varchar(60)     default null               comment '试剂名称',
  producer_name     varchar(50)     default null               comment '生产厂家',
  expire_time       datetime                                   comment '有效期至',
  mixed_record      varchar(30)     default null               comment '混样记录',
  check_method      varchar(30)     default null               comment '检测方法',
  check_result      varchar(255)    default null               comment '检测结果',
  examiner_name     varchar(30)     default null               comment '屠宰厂检测人（签名）',
  owner_name        varchar(30)     default null               comment '屠宰厂负责人（签名）',
  charge_time       datetime                                   comment '屠宰厂签名日期',
  veterinary_name   varchar(30)     default null               comment '官方兽医确认（签名）',
  veterinary_time   datetime                                   comment '兽医签名日期',
  is_deleted        tinyint(1)      default 0                  comment '是否删除标志，0否1是',
  create_by         varchar(64)     default ''                 comment '创建者',
  create_time 	    datetime                                   comment '创建时间',
  update_by         varchar(64)     default ''                 comment '更新者',
  update_time       datetime                                   comment '更新时间',
  primary key (id)
) engine=innodb auto_increment=1 comment = '非洲猪瘟检测表';


-- 无害化处理登记表
CREATE TABLE `hb_harmless_treatment` (
                                         `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                         `cargo_owner_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '货主姓名',
                                         `dispose_time` DATETIME DEFAULT NULL COMMENT '处理时间',
                                         `death_reason` VARCHAR ( 255 ) DEFAULT NULL COMMENT '待宰前死亡畜禽.死亡原因',
                                         `pre_dispose_quantity` INT ( 11 ) DEFAULT NULL COMMENT '待宰前死亡畜禽.处理数量',
                                         `pre_dispose_method` VARCHAR ( 255 ) DEFAULT NULL COMMENT '待宰前死亡畜禽.处理方式',
                                         `dispose_reason` VARCHAR ( 255 ) DEFAULT NULL COMMENT '病害畜禽.处理原因',
                                         `dispose_quantity` INT ( 11 ) DEFAULT NULL COMMENT '病害畜禽.处理数量',
                                         `dispose_method` VARCHAR ( 255 ) DEFAULT NULL COMMENT '病害畜禽.处理方式',
                                         `unfit_part_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '肉品检验不合格产品.产品（部位）名称',
                                         `unfit_process_reason` VARCHAR ( 255 ) DEFAULT NULL COMMENT '肉品检验不合格产品.处理原因',
                                         `unfit_process_quantity` INT ( 11 ) DEFAULT NULL COMMENT '肉品检验不合格产品.处理数量（公斤）',
                                         `unfit_process_method` VARCHAR ( 255 ) DEFAULT NULL COMMENT '肉品检验不合格产品.处理方式',
                                         `examiner_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '无害化处理人员签字',
                                         `veterinary_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '兽医卫生检验人员签字',
                                         `supervisor_confirm` VARCHAR ( 30 ) DEFAULT NULL COMMENT '农业农村部门监管人员签字',
                                         `cargo_owner_confirm` VARCHAR ( 30 ) DEFAULT NULL COMMENT '货主签字',
                                         `clerk_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '填表人',
                                         `director_confirm` VARCHAR ( 30 ) DEFAULT NULL COMMENT '屠宰企业负责人签字',
                                         `remarks` VARCHAR ( 255 ) DEFAULT NULL COMMENT '备注',
                                         `org_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '企业名称',
                                         `archive_duration` VARCHAR ( 60 ) DEFAULT NULL COMMENT '建档日期范围',
                                         `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                         `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                         `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                         `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                         `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                         PRIMARY KEY ( `id` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '无害化处理登记表';

-- 出厂情况登记
CREATE TABLE `hb_release_record` (
                                     `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                     `record_time` DATETIME NOT NULL COMMENT '记录日期时间',
                                     `product_name` VARCHAR ( 60 ) DEFAULT NULL COMMENT '畜禽产品名称',
                                     `cargo_owner_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '购货人姓名',
                                     `contact_mobile` VARCHAR ( 30 ) DEFAULT NULL COMMENT '联系方式',
                                     `sell_address` VARCHAR ( 90 ) DEFAULT NULL COMMENT '销售地详细地址',
                                     `sell_quantity` INT ( 11 ) DEFAULT NULL COMMENT '销售数量',
                                     `animal_cert_no_b` VARCHAR ( 90 ) DEFAULT NULL COMMENT '动物检疫证明编号(产品B)',
                                     `animal_cert_no_a` VARCHAR ( 90 ) DEFAULT NULL COMMENT '动物检疫证明编号(产品A)',
                                     `meat_quality_cert_no` VARCHAR ( 90 ) DEFAULT NULL COMMENT '肉品品质检验证号',
                                     `return_quantity` INT ( 11 ) DEFAULT NULL COMMENT '退回数量(公斤)',
                                     `return_reason` VARCHAR ( 255 ) DEFAULT NULL COMMENT '退回原因',
                                     `org_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '企业名称',
                                     `archive_duration` VARCHAR ( 60 ) DEFAULT NULL COMMENT '建档日期',
                                     `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                     `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                     `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                     `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                     `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                     PRIMARY KEY ( `id` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '出厂情况登记表';

-- 肉品品质检验登记
CREATE TABLE `hb_check_meat_qualified` (
                                               `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                               `record_date` DATETIME NOT NULL COMMENT '记录日期',
                                               `slaughter_permit_no` VARCHAR ( 60 ) NOT NULL COMMENT '准宰证号',
                                               `start_time` VARCHAR ( 30 ) DEFAULT NULL COMMENT '屠宰开始时间（格式：HH:mm:ss）',
                                               `end_time` VARCHAR ( 30 ) DEFAULT NULL COMMENT '屠宰结束时间（格式：HH:mm:ss）',
                                               `slaughter_quantity` INT UNSIGNED DEFAULT 0 COMMENT '屠宰数量（头/只/羽）',
                                               `qualified_quantity` INT UNSIGNED DEFAULT 0 COMMENT '肉品品质检验合格数',
                                               `unqualified_quantity` INT UNSIGNED DEFAULT 0 COMMENT '肉品品质检验不合格数',
                                               `unqualified_reason` VARCHAR ( 255 ) DEFAULT NULL COMMENT '不合格原因说明',
                                               `waste_weight` INT UNSIGNED DEFAULT 0 COMMENT '三腺等不可食用废弃物重量（公斤）',
                                               `veterinary_confirm` VARCHAR ( 30 ) DEFAULT NULL COMMENT '兽医卫生检验人员签字',
                                               `remarks` VARCHAR ( 255 ) DEFAULT NULL COMMENT '备注信息',
                                               `org_name` VARCHAR ( 30 ) NOT NULL COMMENT '企业名称',
                                               `archive_duration` VARCHAR ( 60 ) DEFAULT NULL COMMENT '建档日期（建议格式：YYYY-MM）',
                                               `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                               `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                               `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                               `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                               `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                               PRIMARY KEY ( `id` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '肉品品质检验登记';

-- 瘦肉精检测登记
CREATE TABLE `hb_check_clenbuterol` (
                                      `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                      `record_time` DATETIME NOT NULL COMMENT '记录时间',
                                      `cargo_owner_name` VARCHAR(30) DEFAULT NULL COMMENT '货主名称',
                                      `animal_cert_no` VARCHAR(30) NOT NULL COMMENT '动物检疫证明编号',
                                      `trace_record_no` VARCHAR(30) NOT NULL COMMENT '溯源单编号',
                                      `livestock_quantity` INT NOT NULL COMMENT '畜禽数量（头/只/羽）',
                                      `spotcheck_quantity` INT NOT NULL COMMENT '抽检数量',
                                      `clenbuterol` VARCHAR(10) DEFAULT NULL COMMENT '盐酸克伦特罗检测结果',
                                      `ractopamine` VARCHAR(10) DEFAULT NULL COMMENT '莱克多巴胺检测结果',
                                      `salbutamol` VARCHAR(10) DEFAULT NULL COMMENT '沙丁胺醇检测结果',
                                      `process_method` VARCHAR(255) DEFAULT NULL COMMENT '处理方式',
                                      `examiner_confirm` VARCHAR(30) DEFAULT NULL COMMENT '检测人员（签字）',
                                      `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                      `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                      `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                      `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                      `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                      PRIMARY KEY ( `id` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '瘦肉精检测登记';

-- 进场查验登记
CREATE TABLE `hb_entrance_check` (
                                             `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                             `entrance_time` DATETIME NOT NULL COMMENT '入厂（场点）时间',
                                             `quarantine_unit_name` VARCHAR(30) DEFAULT NULL COMMENT '动物检疫证明标注单位或名称',
                                             `origin_region` VARCHAR(90) DEFAULT NULL COMMENT '畜禽产地',
                                             `animal_cert_no` VARCHAR(30) NOT NULL COMMENT '动物检疫证明编号',
                                             `contact_mobile` VARCHAR(30) DEFAULT NULL COMMENT '联系电话',
                                             `entrance_quantity` INT NOT NULL DEFAULT 0 COMMENT '数量',
                                             `qualified_quantity` INT NOT NULL DEFAULT 0 COMMENT '合格数',
                                             `pigpen_name` VARCHAR(30) DEFAULT NULL COMMENT '圈编（烫号）',
                                             `quarantine_quantity` INT NOT NULL DEFAULT 0 COMMENT '隔离数',
                                             `emergency_slaughter_quantity` INT NOT NULL DEFAULT 0 COMMENT '急宰数',
                                             `dispose_quantity` INT NOT NULL DEFAULT 0 COMMENT '无害化处理数',
                                             `examiner_confirm` VARCHAR(30) DEFAULT NULL COMMENT '查验接收人（签字）',
                                             `remarks` VARCHAR(255) DEFAULT NULL COMMENT '备注',
                                             `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                             `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                             `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                             `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                             `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                             PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='进场查验登记表';

-- 屠宰情况月汇总
CREATE TABLE `hb_slaughter_summary_monthly` (
                                                `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                                `summary_date` DATETIME NOT NULL  COMMENT '汇总日期（年月日）',
                                                `entrance_quantity` INT DEFAULT 0 COMMENT '进厂数量（头/只/羽）',
                                                `qualified_quantity` INT DEFAULT 0 COMMENT '合格数量（头/只/羽）',
                                                `emergency_slaughter_quantity` INT DEFAULT 0 COMMENT '急宰数量（头/只/羽）',
                                                `quarantine_quantity` INT DEFAULT 0 COMMENT '检出病害数（头/只/羽）',
                                                `unqualified_quantity` INT DEFAULT 0 COMMENT '宰前不合格数（头/只/羽）',
                                                `meat_unqualified_kilograms` INT DEFAULT 0 COMMENT '肉品检验不合格公斤数',
                                                `release_quantity` INT DEFAULT 0 COMMENT '出场数量（头/只/羽）',
                                                `transfer_next_month_quantity` INT DEFAULT 0 COMMENT '结转下月数（头/只/羽）',
                                                `veterinary_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '兽医卫生检验负责人',
                                                `director_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '畜禽定点屠宰企业负责人',
                                                `clerk_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '填表人',
                                                `remarks` VARCHAR ( 255 ) DEFAULT NULL COMMENT '备注信息',
                                                `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                                `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                                `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                                `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                                `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                                PRIMARY KEY ( `id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = '屠宰情况月汇总';

-- 药物残留检测登记
CREATE TABLE hb_check_residue (
                                 `id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
                                 `record_date` DATETIME NOT NULL COMMENT '记录时间',
                                 `provider_unit_name` VARCHAR(30)  DEFAULT NULL COMMENT '供货单位名称或供货人名称',
                                 `supply_quantity` INTEGER DEFAULT 0 COMMENT '数量（头/只/羽）',
                                 `sampling_quantity` INTEGER DEFAULT 0 COMMENT '抽检数量',
                                 `trace_record_no` VARCHAR(30)  DEFAULT NULL COMMENT '溯源单编号',
                                 `sulfonamides` VARCHAR(10)  DEFAULT NULL COMMENT '磺胺类检测结果',
                                 `fluoroquinolones` VARCHAR(10)  DEFAULT NULL COMMENT '氟喹诺酮类检测结果',
                                 `tetracyclines` VARCHAR(10)  DEFAULT NULL COMMENT '四环素类检测结果',
                                 `process_method` VARCHAR(255)  DEFAULT NULL COMMENT '处理方法说明',
                                 `examiner_confirm` VARCHAR(30)  DEFAULT NULL COMMENT '检测人员（签字）',
                                 `cargo_owner_confirm` VARCHAR(30) DEFAULT NULL  COMMENT '货主（签字）',
                                 `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                 `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                 `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                 `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                 `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='药物残留检测登记';

-- 旋毛虫检测登记
CREATE TABLE `hb_check_trichinella` (
                                        `id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
                                        `record_date` DATETIME DEFAULT NULL COMMENT '日期',
                                        `spot_check_no` VARCHAR(60) DEFAULT NULL COMMENT '抽检批次',
                                        `sampling_quantity` INTEGER DEFAULT 0 COMMENT '采样头数',
                                        `mirror_exam_quantity` INTEGER DEFAULT 0 COMMENT '镜检份数',
                                        `examine_result` VARCHAR(10) DEFAULT NULL COMMENT '化验结果',
                                        `examiner_name` VARCHAR(30) DEFAULT NULL COMMENT '检疫员',
                                        `remarks` VARCHAR(255) DEFAULT NULL COMMENT '备注',
                                        `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                        `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                        `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                        `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                        `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='旋毛虫检查记录表';

-- 留样记录
CREATE TABLE hb_sampling_retained (
                                    `id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
                                    `sequence_no` INTEGER DEFAULT 0 COMMENT '序号',
                                    `sampling_no` VARCHAR ( 60 ) DEFAULT NULL COMMENT '留样编号',
                                    `production_date` DATETIME DEFAULT NULL COMMENT '生产日期',
                                    `sampling_date` DATETIME DEFAULT NULL COMMENT '留样时间',
                                    `sampling_quantity` INTEGER DEFAULT 0 COMMENT '留样数量',
                                    `charge_person` VARCHAR ( 30 ) DEFAULT NULL COMMENT '留样人',
                                    `examine_item` VARCHAR ( 30 ) DEFAULT NULL COMMENT '检测项目',
                                    `moisture` VARCHAR ( 30 ) DEFAULT NULL COMMENT '水分值',
                                    `clear_date` DATETIME DEFAULT NULL COMMENT '清除时间',
                                    `clear_person` VARCHAR ( 30 ) DEFAULT NULL COMMENT '清除人',
                                    `sampling_destination` VARCHAR ( 255 ) DEFAULT NULL COMMENT '留样去向',
                                    `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                    `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                    `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                    `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                    `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = '留样记录表';

-- 宰前检验记录
CREATE TABLE hb_ante_mortem_inspection (
                                        `id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
                                        `batch_series_no` VARCHAR ( 60 ) DEFAULT NULL COMMENT '生猪批次',
                                        `divide_time` DATETIME DEFAULT NULL COMMENT '入圈时间',
                                        `examine_quantity` INTEGER DEFAULT 0 COMMENT '检验数量',
                                        `permission_slaughter_quantity` INTEGER DEFAULT 0 COMMENT '准宰数量',
                                        `emergency_slaughter_quantity` INTEGER DEFAULT 0 COMMENT '急宰数量',
                                        `dead_quantity` INTEGER DEFAULT 0 COMMENT '死亡数量',
                                        `process_detail` VARCHAR ( 255 ) DEFAULT NULL COMMENT '处理情况',
                                        `examiner_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '检验人',
                                        `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                        `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                        `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                        `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                        `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = '宰前检验记录';

-- 消毒记录
CREATE TABLE hb_disinfect (
                             `id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
                             `record_date` DATETIME DEFAULT NULL COMMENT '消毒日期',
                             `vehicle_plat_no` VARCHAR ( 30 ) DEFAULT NULL COMMENT '车辆车牌号',
                             `disinfect_method` VARCHAR ( 30 ) DEFAULT NULL COMMENT '消毒方法',
                             `disinfect_drug` VARCHAR ( 30 ) DEFAULT NULL COMMENT '消毒药品',
                             `dose_concentration` VARCHAR ( 30 ) DEFAULT NULL COMMENT '溶液浓度',
                             `disinfect_user` VARCHAR ( 30 ) DEFAULT NULL COMMENT '消毒工(签字)',
                             `remarks` VARCHAR ( 255 ) DEFAULT NULL COMMENT '备注',
                             `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                             `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                             `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                             `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                             `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = '消毒记录';

-- 无害化暂存记录
CREATE TABLE hb_harmless_staging (
                                   `id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
                                   `record_date` DATETIME DEFAULT NULL COMMENT '日期',
                                   `cut_of_glands` VARCHAR ( 30 ) DEFAULT NULL COMMENT '修割三腺',
                                   `unqualified_part_name` VARCHAR ( 60 ) DEFAULT NULL COMMENT '生猪不合格产品',
                                   `weight_quantity` INTEGER DEFAULT 0 COMMENT '重量/数量',
                                   `charge_person` VARCHAR ( 30 ) DEFAULT NULL COMMENT '负责人',
                                   `remarks` VARCHAR ( 255 ) DEFAULT NULL COMMENT '备注',
                                   `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                   `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                   `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                   `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                   `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = '无害化暂存记录';


-- ---------------------------------------------------------------------------------------------------------------------
-- 隐患风险点检记录（季次）
CREATE TABLE `hb_risk_check_quarter` (
                                        `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                        `job_title` VARCHAR ( 30 ) DEFAULT NULL COMMENT '岗位名称',
                                        `record_no` VARCHAR ( 30 ) DEFAULT NULL COMMENT '编号',
                                        `check_date` DATETIME DEFAULT NULL COMMENT '排查日期',
                                        `check_quarter` VARCHAR ( 30 ) DEFAULT NULL COMMENT '排查季度',
                                        `is_checked` TINYINT ( 1 ) DEFAULT '1' COMMENT '排查结果(0:未通过 1:已通过)',
                                        `inspector_confirm` VARCHAR ( 30 ) DEFAULT NULL COMMENT '检查人(签字)',
                                        `unusual_case_detail` VARCHAR ( 255 ) DEFAULT NULL COMMENT '异常情况记录',
                                        `remarks` VARCHAR ( 255 ) DEFAULT NULL COMMENT '备注',
                                        `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                        `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                        `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                        `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                        `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
	                                    PRIMARY KEY ( `id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '隐患风险点检记录（季次）';

-- 隐患排查治理台账
CREATE TABLE `hb_risk_check_ledger` (
                                        `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '自增主键',
                                        `sequence_no` INT DEFAULT NULL COMMENT '序号',
                                        `check_date` DATETIME DEFAULT NULL COMMENT '检查时间',
                                        `inspector_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '检查人',
                                        `dept` VARCHAR ( 30 ) DEFAULT NULL COMMENT '责任部门',
                                        `potential_detail` VARCHAR ( 60 ) DEFAULT NULL COMMENT '事故隐患',
                                        `potential_level` VARCHAR ( 30 ) DEFAULT NULL COMMENT '隐患等级',
                                        `solution_detail` VARCHAR ( 60 ) DEFAULT NULL COMMENT '治理措施',
                                        `deadline` VARCHAR ( 30 ) DEFAULT NULL COMMENT '完成时限',
                                        `upgrade_owner` VARCHAR ( 30 ) DEFAULT NULL COMMENT '整改责任人',
                                        `reviewer_name` VARCHAR ( 30 ) DEFAULT NULL COMMENT '复查人',
                                        `review_time` DATETIME DEFAULT NULL COMMENT '复查时间',
                                        `is_reviewed` TINYINT ( 1 ) DEFAULT '1' COMMENT '复查结果(0未通过/1已通过)',
                                        `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                        `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                        `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                        `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                        `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
	                                    PRIMARY KEY ( `id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = '隐患排查治理台账';
-- 隐患风险点检记录（日次）
CREATE TABLE `hb_risk_check_daily` (
                                        `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                        `job_title` VARCHAR ( 30 ) DEFAULT NULL COMMENT '岗位名称',
                                        `record_no` VARCHAR ( 30 ) DEFAULT NULL COMMENT '编号',
                                        `check_date` DATETIME DEFAULT NULL COMMENT '排查日期',
                                        `is_checked` TINYINT ( 1 ) DEFAULT '1' COMMENT '排查结果(0:未通过 1:已通过)',
                                        `inspector_confirm` VARCHAR ( 30 ) DEFAULT NULL COMMENT '检查人(签字)',
                                        `unusual_case_detail` VARCHAR ( 255 ) DEFAULT NULL COMMENT '异常情况记录',
                                        `remarks` VARCHAR ( 255 ) DEFAULT NULL COMMENT '备注',
                                        `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                        `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                        `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                        `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                        `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
	                                    PRIMARY KEY ( `id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '隐患风险点检记录（日次）';
-- 隐患风险点检记录（月次）
CREATE TABLE `hb_risk_check_monthly` (
                                        `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                        `job_title` VARCHAR ( 30 ) DEFAULT NULL COMMENT '岗位名称',
                                        `record_no` VARCHAR ( 30 ) DEFAULT NULL COMMENT '编号',
                                        `check_date` DATETIME DEFAULT NULL COMMENT '排查日期',
                                        `month_section` VARCHAR ( 30 ) DEFAULT NULL COMMENT '月份区间',
                                        `is_checked` TINYINT ( 1 ) DEFAULT '1' COMMENT '排查结果(0:未通过 1:已通过)',
                                        `inspector_confirm` VARCHAR ( 30 ) DEFAULT NULL COMMENT '检查人(签字)',
                                        `unusual_case_detail` VARCHAR ( 255 ) DEFAULT NULL COMMENT '异常情况记录',
                                        `remarks` VARCHAR ( 255 ) DEFAULT NULL COMMENT '备注',
                                        `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                        `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                        `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                        `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                        `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
	                                    PRIMARY KEY ( `id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '隐患风险点检记录（月次）';

-- 设备维保记录（日次）
CREATE TABLE `hb_equip_maintenance_daily` (
                                            `id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
                                            `record_date` DATETIME DEFAULT NULL COMMENT '日期',
                                            `equip_name_group` VARCHAR(60) DEFAULT NULL COMMENT '屠宰设备名称',
                                            `record_no` VARCHAR(30) DEFAULT NULL COMMENT '编号',
                                            `specification_no_group` VARCHAR(90) DEFAULT NULL COMMENT '规格型号',
                                            `maintenance_detail` VARCHAR(255) DEFAULT NULL COMMENT '维护记录',
                                            `maintenance_employee` VARCHAR(30) DEFAULT NULL COMMENT '维护人',
                                            `maintenance_date` DATETIME DEFAULT NULL COMMENT '维护日期',
                                            `fault_detail` VARCHAR(255) DEFAULT NULL COMMENT '故障描述',
                                            `repair_detail` VARCHAR(255) DEFAULT NULL COMMENT '维修结果',
                                            `repair_employee` VARCHAR(30) DEFAULT NULL COMMENT '维修人',
                                            `repair_date` DATETIME DEFAULT NULL COMMENT '维修日期',
                                            `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                            `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                            `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                            `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                            `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='设备维保记录（日次）';

-- 设备维保记录（周次）
CREATE TABLE `hb_equip_maintenance_weekly` (
                                            `id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
                                            `record_date` DATETIME DEFAULT NULL COMMENT '日期',
                                            `equip_name_group` VARCHAR(60) DEFAULT NULL COMMENT '屠宰设备名称',
                                            `record_no` VARCHAR(30) DEFAULT NULL COMMENT '编号',
                                            `specification_no_group` VARCHAR(90) DEFAULT NULL COMMENT '规格型号',
                                            `maintenance_detail` VARCHAR(255) DEFAULT NULL COMMENT '维护记录',
                                            `maintenance_employee` VARCHAR(30) DEFAULT NULL COMMENT '维护人',
                                            `maintenance_date` DATETIME DEFAULT NULL COMMENT '维护日期',
                                            `fault_detail` VARCHAR(255) DEFAULT NULL COMMENT '故障描述',
                                            `repair_detail` VARCHAR(255) DEFAULT NULL COMMENT '维修结果',
                                            `repair_employee` VARCHAR(30) DEFAULT NULL COMMENT '维修人',
                                            `repair_date` DATETIME DEFAULT NULL COMMENT '维修日期',
                                            `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                            `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                            `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                            `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                            `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='设备维保记录（周次）';

-- 设备维保记录（月次）
CREATE TABLE `hb_equip_maintenance_monthly` (
                                            `id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
                                            `record_date` DATETIME DEFAULT NULL COMMENT '日期',
                                            `equip_name_group` VARCHAR(60) DEFAULT NULL COMMENT '屠宰设备名称',
                                            `record_no` VARCHAR(30) DEFAULT NULL COMMENT '编号',
                                            `specification_no_group` VARCHAR(90) DEFAULT NULL COMMENT '规格型号',
                                            `maintenance_detail` VARCHAR(255) DEFAULT NULL COMMENT '维护记录',
                                            `maintenance_employee` VARCHAR(30) DEFAULT NULL COMMENT '维护人',
                                            `maintenance_date` DATETIME DEFAULT NULL COMMENT '维护日期',
                                            `fault_detail` VARCHAR(255) DEFAULT NULL COMMENT '故障描述',
                                            `repair_detail` VARCHAR(255) DEFAULT NULL COMMENT '维修结果',
                                            `repair_employee` VARCHAR(30) DEFAULT NULL COMMENT '维修人',
                                            `repair_date` DATETIME DEFAULT NULL COMMENT '维修日期',
                                            `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                            `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                            `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                            `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                            `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='设备维保记录（月次）';


-- 修改已有表结构
ALTER TABLE harmless_treatment ADD COLUMN examiner_name VARCHAR ( 30 ) COMMENT '无害化处理人员签字',
    ADD COLUMN veterinary_name VARCHAR ( 30 ) COMMENT '兽医卫生检验人员签字',
    ADD COLUMN supervisor_confirm VARCHAR ( 30 ) COMMENT '农业农村部门监管人员签字',
    ADD COLUMN cargo_owner_confirm VARCHAR ( 30 ) COMMENT '货主签字',
    ADD COLUMN clerk_name VARCHAR ( 30 ) COMMENT '填表人',
    ADD COLUMN director_confirm VARCHAR ( 30 ) COMMENT '屠宰企业负责人签字';
-- 溯源单号，检测人员
ALTER TABLE js_drug_check  ADD COLUMN trace_record_no VARCHAR(30) COMMENT '溯源单编号',
    ADD COLUMN examiner_confirm VARCHAR(30) NOT NULL DEFAULT '' COMMENT '检测人员';
-- 水份检测值
ALTER TABLE js_produce_check MODIFY COLUMN id BIGINT AUTO_INCREMENT  ;
ALTER TABLE js_produce_check  ADD COLUMN `detection_value` VARCHAR(30) COMMENT '水份检测值',
    ADD COLUMN `is_deleted` TINYINT(1) DEFAULT 0 COMMENT '是否删除标志，0否1是',
    ADD COLUMN `create_by` VARCHAR(255) DEFAULT NULL COMMENT '创建者',
    ADD COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    ADD COLUMN `update_by` VARCHAR(255) DEFAULT NULL COMMENT '更新者',
    ADD COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

-- 新增库管字段
ALTER TABLE `js_out_stock` ADD COLUMN `keeper` VARCHAR(30) DEFAULT NULL COMMENT '库管',
    ADD COLUMN `is_deleted` TINYINT(1) DEFAULT 0 COMMENT '是否删除标志，0否1是',
    ADD COLUMN `create_by` VARCHAR(255) DEFAULT NULL COMMENT '创建者',
    ADD COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    ADD COLUMN `update_by` VARCHAR(255) DEFAULT NULL COMMENT '更新者',
    ADD COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

-- 留样登记新增多个字段
ALTER TABLE `js_sample` MODIFY COLUMN id BIGINT AUTO_INCREMENT  ;
ALTER TABLE `js_sample`  ADD COLUMN `examine_item` VARCHAR(30) COMMENT '检测项目',
    ADD COLUMN `moisture` VARCHAR(30) DEFAULT NULL COMMENT '水分值',
    ADD COLUMN `clear_date` DATETIME DEFAULT NULL COMMENT '清除时间',
    ADD COLUMN `clear_person` VARCHAR(30) DEFAULT NULL COMMENT '清除人',
    ADD COLUMN `is_deleted` TINYINT(1) DEFAULT 0 COMMENT '是否删除标志，0否1是',
    ADD COLUMN `create_by` VARCHAR(255) DEFAULT NULL COMMENT '创建者',
    ADD COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    ADD COLUMN `update_by` VARCHAR(255) DEFAULT NULL COMMENT '更新者',
    ADD COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

-- 设备维护保养
ALTER TABLE `js_device_maintenance` MODIFY COLUMN id BIGINT AUTO_INCREMENT  ;
ALTER TABLE `js_device_maintenance`  ADD COLUMN `specification_no_group` VARCHAR(90) COMMENT '规格型号',
    ADD COLUMN `fault_detail` VARCHAR(255) DEFAULT NULL COMMENT '故障描述',
    ADD COLUMN `repair_detail` VARCHAR(255) DEFAULT NULL COMMENT '维修结果',
    ADD COLUMN `is_deleted` TINYINT(1) DEFAULT 0 COMMENT '是否删除标志，0否1是',
    ADD COLUMN `create_by` VARCHAR(255) DEFAULT NULL COMMENT '创建者',
    ADD COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    ADD COLUMN `update_by` VARCHAR(255) DEFAULT NULL COMMENT '更新者',
    ADD COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

-- 仪器维护保养
ALTER TABLE `js_instrument_maintenance` MODIFY COLUMN id BIGINT AUTO_INCREMENT  ;
ALTER TABLE `js_instrument_maintenance`  ADD COLUMN `specification_no_group` VARCHAR(90) COMMENT '规格型号',
    ADD COLUMN `fault_detail` VARCHAR(255) DEFAULT NULL COMMENT '故障描述',
    ADD COLUMN `repair_detail` VARCHAR(255) DEFAULT NULL COMMENT '维修结果',
    ADD COLUMN `is_deleted` TINYINT(1) DEFAULT 0 COMMENT '是否删除标志，0否1是',
    ADD COLUMN `create_by` VARCHAR(255) DEFAULT NULL COMMENT '创建者',
    ADD COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    ADD COLUMN `update_by` VARCHAR(255) DEFAULT NULL COMMENT '更新者',
    ADD COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

-- 生猪品种管理新增品种的默认重量
ALTER TABLE `pig_category`  ADD COLUMN `default_weight` INT (7) DEFAULT 0 COMMENT '默认重量';

-- 物料入库记录新增关联的物料编号字段
ALTER TABLE `js_in_stock`  ADD COLUMN `material_num` VARCHAR(30) DEFAULT NULL COMMENT '物料编号';
-- 物料领用记录新增关联的物料编号字段
ALTER TABLE `js_out_stock`  ADD COLUMN `material_num` VARCHAR(30) DEFAULT NULL COMMENT '物料编号';
-- 物料库存记录新增关联的物料编号字段
ALTER TABLE `js_stock`  ADD COLUMN `material_num` VARCHAR(30) DEFAULT NULL COMMENT '物料编号';


-- 新增隐患排查字典表 用于查询自动填充的安全选项
CREATE TABLE `hb_risk_strategy_dictionary` (
                                        `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                        `risk_position` VARCHAR ( 900 ) DEFAULT NULL COMMENT '隐患位置',
                                        `risk` VARCHAR ( 900 ) DEFAULT NULL COMMENT '事故隐患',
                                        `strategy` VARCHAR ( 900 ) DEFAULT NULL COMMENT '安全措施',
                                        `remarks` VARCHAR ( 255 ) DEFAULT NULL COMMENT '备注',
                                        `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                        `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                        `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                        `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                        `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
	                                    PRIMARY KEY ( `id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '隐患与治理字典表';
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'部分制度未上墙','制度上墙',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'部分灭火器不到位','灭火器到位',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'灭火器未及时更换','及时更换灭火器',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'电箱围栏不牢固','重新加固',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'电箱警示牌脱落','及时安装警示牌',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'污水池检验口盖子关闭不严','立即恢复原位',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'无害化冷冻库制冷剂外露','增设围栏',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'污水处理池缺少操作规程','及时安装操作规程',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'生产区净水储存池防护网不牢固','及时安装并加固',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'员工未佩戴一次性手套','立即佩带手套',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'剪头机电线落地','立即恢复原位',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'猪毛自抽设备未按要求维护','及时维护设备',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'链条未按要求保养打油','及时保养打油',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'地面有积水','及时清理积水',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'脚手架未拆卸','及时拆卸入库',null, 0, 'admin', NOW(), NULL);
insert into `hb_risk_strategy_dictionary` (risk_position, risk, strategy, remarks, is_deleted, create_by, create_time, update_by) VALUES (null,'物品杂乱堆放','物品及时放入仓库',null, 0, 'admin', NOW(), NULL);


-- 分圈登记 增加一个状态字段status(opened-表示该批次的圈养猪存栏数未闭环，closed-表示存栏量已闭环)
ALTER TABLE `js_divide_circle` ADD COLUMN status_flag VARCHAR(20) COMMENT '是否闭环标记：opened-表示该批次的圈养猪存栏数未闭环，closed-表示存栏量已闭环';

-- 新增 设备维护条目字典表
CREATE TABLE `hb_device_maintenance_dictionary` (
                                        `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                        `device_name` VARCHAR ( 90 ) DEFAULT NULL COMMENT '设备名称',
                                        `maintenance_item` VARCHAR ( 255 ) DEFAULT NULL COMMENT '维护条目',
                                        `remarks` VARCHAR ( 255 ) DEFAULT NULL COMMENT '备注',
                                        `is_deleted` TINYINT ( 1 ) DEFAULT 0 COMMENT '是否删除标志，0否1是',
                                        `create_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '创建者',
                                        `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                        `update_by` VARCHAR ( 255 ) DEFAULT NULL COMMENT '更新者',
                                        `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
	                                    PRIMARY KEY ( `id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '设备维护条目字典表';

INSERT INTO `hb_device_maintenance_dictionary` (id, device_name, maintenance_item, remarks, is_deleted, create_by, create_time, update_by, update_time) VALUES (NULL, '击晕机','检查轴承、链条',null, 0, 'admin', CURRENT_TIMESTAMP, NULL, CURRENT_TIMESTAMP);
INSERT INTO `hb_device_maintenance_dictionary` (id, device_name, maintenance_item, remarks, is_deleted, create_by, create_time, update_by, update_time) VALUES (NULL, '击晕机','调查链条张紧度',null, 0, 'admin', CURRENT_TIMESTAMP, NULL, CURRENT_TIMESTAMP);
INSERT INTO `hb_device_maintenance_dictionary` (id, device_name, maintenance_item, remarks, is_deleted, create_by, create_time, update_by, update_time) VALUES (NULL, '击晕机','链条加油',null, 0, 'admin', CURRENT_TIMESTAMP, NULL, CURRENT_TIMESTAMP);
INSERT INTO `hb_device_maintenance_dictionary` (id, device_name, maintenance_item, remarks, is_deleted, create_by, create_time, update_by, update_time) VALUES (NULL, '生产线链条','检查链条、轮子、钩子',null, 0, 'admin', CURRENT_TIMESTAMP, NULL, CURRENT_TIMESTAMP);
INSERT INTO `hb_device_maintenance_dictionary` (id, device_name, maintenance_item, remarks, is_deleted, create_by, create_time, update_by, update_time) VALUES (NULL, '生产线链条','调查链条张紧度',null, 0, 'admin', CURRENT_TIMESTAMP, NULL, CURRENT_TIMESTAMP);
INSERT INTO `hb_device_maintenance_dictionary` (id, device_name, maintenance_item, remarks, is_deleted, create_by, create_time, update_by, update_time) VALUES (NULL, '生产线链条','保养润滑气缸',null, 0, 'admin', CURRENT_TIMESTAMP, NULL, CURRENT_TIMESTAMP);
INSERT INTO `hb_device_maintenance_dictionary` (id, device_name, maintenance_item, remarks, is_deleted, create_by, create_time, update_by, update_time) VALUES (NULL, '刨毛机','检查刨毛片',null, 0, 'admin', CURRENT_TIMESTAMP, NULL, CURRENT_TIMESTAMP);
INSERT INTO `hb_device_maintenance_dictionary` (id, device_name, maintenance_item, remarks, is_deleted, create_by, create_time, update_by, update_time) VALUES (NULL, '刨毛机','保养润滑气缸',null, 0, 'admin', CURRENT_TIMESTAMP, NULL, CURRENT_TIMESTAMP);
INSERT INTO `hb_device_maintenance_dictionary` (id, device_name, maintenance_item, remarks, is_deleted, create_by, create_time, update_by, update_time) VALUES (NULL, '刨毛机','保养轴承',null, 0, 'admin', CURRENT_TIMESTAMP, NULL, CURRENT_TIMESTAMP);
INSERT INTO `hb_device_maintenance_dictionary` (id, device_name, maintenance_item, remarks, is_deleted, create_by, create_time, update_by, update_time) VALUES (NULL, '劈半锯','检查限位导向器、启动开关、轴承',null, 0, 'admin', CURRENT_TIMESTAMP, NULL, CURRENT_TIMESTAMP);
INSERT INTO `hb_device_maintenance_dictionary` (id, device_name, maintenance_item, remarks, is_deleted, create_by, create_time, update_by, update_time) VALUES (NULL, '劈半锯','检查锯片',null, 0, 'admin', CURRENT_TIMESTAMP, NULL, CURRENT_TIMESTAMP);


-- 人员管理 添加“健康证明号”
ALTER TABLE `staff` ADD COLUMN health_cert_no VARCHAR(20) COMMENT '健康证明号';

-- 供应商管理 添加“供应商类别”、“身份证/主体识别号”
ALTER TABLE `supplier` ADD COLUMN `principal_type` VARCHAR(30) COMMENT '供应商类别';
ALTER TABLE `supplier` ADD COLUMN `principal_id` VARCHAR(60) COMMENT '身份识别号';