drop table if exists `base_meta`;
CREATE TABLE `base_meta`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`group_id` bigint(20) NULL DEFAULT NULL COMMENT '种类ID',
`meta_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Key值',
`meta_value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Value值',
`order_index` int(11) NULL DEFAULT 0 COMMENT '排序',
`memo` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`group_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '种类code',
PRIMARY KEY (`id`) USING BTREE,
INDEX `group_code`(`group_code`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `base_meta_group`;
CREATE TABLE `base_meta_group`  (
`id` bigint(20) NOT NULL  AUTO_INCREMENT COMMENT '主键ID',
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '种类名称',
`order_index` int(11) NOT NULL DEFAULT 0 COMMENT '排序',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`edit_flag` int(1) NULL DEFAULT 1 COMMENT '修改标识（0：不可修改、1：可修改）',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '种类编码',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('alarm_type', '报警类型', 20);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('apply_objective', '申购目的', 10);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('containerversion', '试剂柜版本', 1);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('container_structure', '货柜结构', 9);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('container_structure_A', '2*2货柜位置', 11);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('container_structure_B', '一体柜货柜位置', 12);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('container_structure_C', '2*3货柜位置', 13);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('container_type', '货柜类型', 8);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('control_products', '管控品', 15);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('encode_replace_1', '厂商', 22);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('encode_replace_2', '规格', 23);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('encode_replace_3', '包装', 24);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('laboratory_type', '实验室类型', 6);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('operate_status', '操作状态', 21);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('product_name', '厂商', 15);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('project_num', '课题号', 14);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('reagent_character', '危险性质', 3);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('reagent_format', '试剂规格', 4);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('reagent_type', '试剂类型', 2);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('reagent_unit', '主计单位', 5);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('securityManager', '安全管理员', 0);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('sync_reagent_recorder', '接口同步时间', 0);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('user_company', '公司单位', 0);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('user_department', '负责部门', 1);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('user_violate_type', '人员违规类型', 19);
INSERT INTO `base_meta_group`(`code`, `name`, `order_index`) VALUES ('warehouse_type', '仓库类型', 7);



drop table if exists `base_page`;
CREATE TABLE `base_page`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`parent_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '父ID',
`name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '画面名',
`level_type` int(5) NULL DEFAULT NULL COMMENT '当前节点级别',
`level_index` int(5) NULL DEFAULT 0 COMMENT '节点序号',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (1,'apply_mng', '申购管理', 0, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (2,'approval_mng', '审批管理', 1, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (3,'base_meta_data', '数据字典', 15, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (4,'container_status_mng', '试剂柜状态管理', 5, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (5,'laboratory_container_mng', '实验室货柜管理', 11, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (6,'laboratory_mng', '实验室管理', 10, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (7,'laboratory_reagent_reserve', '实验室试剂库存', 22, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (8,'laboratory_stock_mng', '实验室库存管理', 5, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (9,'order_mng', '订单管理', 3, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (10,'personal_use_info', '个人领用情况', 7, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (11,'price_mng', '价格管理', 1, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (12,'project_mng', '课题管理', 18, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (13,'reagent_mng', '试剂管理', 9, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (14,'reagent_user_flow_info', '试剂流向追踪', 8, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (15,'require_mng', '需求管理', 2, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (16,'role_mng', '角色管理', 17, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (17,'supplier_info_mng', '供应商信息管理', 14, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (18,'supplier_order_mng', '供应商订单管理', 18, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (20,'sysFile_mng', 'app文件管理', 0, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (21,'sys_alarm', '货柜预警', 20, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (23,'sys_dangerous_encode', '危化品编码', 23, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (24,'sys_encode_replace_dict', '编码替换字典', 24, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (25,'sys_hazardous_waste', '危废处理信息', 25, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (26,'user_mng', '人员管理', 16, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (27,'user_violate_mng', '人员违规操作预警', 21, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (28,'warehouse_container_mng', '仓库货柜管理', 13, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (29,'warehouse_mng', '仓库管理', 12, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (30,'warehouse_status_mng', '库房状态管理', 27, 1);
INSERT INTO `base_page`(`id`,`code`, `name`, `level_index`, `valid_flag`) VALUES (31,'warehouse_stock_mng', '仓库库存管理', 6, 1);





drop table if exists `base_role`;
CREATE TABLE `base_role`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名',
`memo` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`btn_permission` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '新增,修改,删除,导入' COMMENT '按钮权限,分割',
`user_permission` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '所有人员' COMMENT '人员可见权限,分割',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

INSERT INTO `base_role`(`id`,`name`, `memo`, `valid_flag`, `btn_permission`, `user_permission`) VALUES (1,'系统管理员', '具有所有权限', 1, '新增,修改,删除,导入', '所有人员');
INSERT INTO `base_role`(`id`,`name`, `memo`, `valid_flag`, `btn_permission`, `user_permission`) VALUES (2,'试剂统一管理员', '试剂统一管理员\r\n', 1, '新增,修改,删除,导入', '所有人员');
INSERT INTO `base_role`(`id`,`name`, `memo`, `valid_flag`, `btn_permission`, `user_permission`) VALUES (3,'实验负责人', '实验负责人', 1, '新增,修改,删除,导入', '课题组');
INSERT INTO `base_role`(`id`,`name`, `memo`, `valid_flag`, `btn_permission`, `user_permission`) VALUES (4,'供应商', '', 1, '新增,修改,删除,导入', '所有人员');
INSERT INTO `base_role`(`id`,`name`, `memo`, `valid_flag`, `btn_permission`, `user_permission`) VALUES (5,'采购员', '只有采购管理的权限', 1, '新增,修改,删除,导入', '所有人员');
INSERT INTO `base_role`(`id`,`name`, `memo`, `valid_flag`, `btn_permission`, `user_permission`) VALUES (6,'实验员', '实验员', 1, '新增,修改,删除,导入', '所有人员');
INSERT INTO `base_role`(`id`,`name`, `memo`, `valid_flag`, `btn_permission`, `user_permission`) VALUES (7,'库管员', '', 1, '新增,修改,删除,导入', '所有人员');

drop table if exists `base_role_page`;
CREATE TABLE `base_role_page`  (
`id` bigint(20) NOT NULL  AUTO_INCREMENT COMMENT '主键ID',
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
`page_id` bigint(20) NOT NULL COMMENT '画面ID',
PRIMARY KEY (`id`) USING BTREE,
INDEX `role_id`(`role_id`) USING BTREE,
INDEX `page_id`(`page_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 1);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 2);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 3);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 4);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 5);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 6);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 7);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 8);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 9);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 10);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 11);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 12);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 13);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 14);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 15);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 16);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 17);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 18);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 19);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 20);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 21);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 22);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 23);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 24);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 25);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 26);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 27);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 28);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 29);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 30);
INSERT INTO `base_role_page`(`role_id`, `page_id`) VALUES (1, 31);

drop table if exists `favor`;
CREATE TABLE `favor`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` bigint(20) NOT NULL,
`reagent_id` bigint(20) NOT NULL,
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `regeant_id`(`reagent_id`) USING BTREE,
INDEX `create_time`(`create_time`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `ope_apply`;
CREATE TABLE `ope_apply`  (
`id` bigint(20) NOT NULL  AUTO_INCREMENT COMMENT '主键ID',
`apply_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '申购编号',
`reagent_id` bigint(20) NOT NULL COMMENT '试剂ID',
`used` int NULL DEFAULT 0 COMMENT '已从仓库中领取数',
`num` int NULL DEFAULT NULL COMMENT '申购数量',
`deadline` timestamp(0) NULL DEFAULT NULL COMMENT '货期',
`apply_user_id` bigint(20) NOT NULL COMMENT '申购人',
`objective` bigint(20) NULL DEFAULT NULL COMMENT '课题ID（参照base_meta，种类为apply_objective）',
`status` int(2) NULL DEFAULT NULL COMMENT '4.已入库,6.已确认,10.过期',
`create_time` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT NULL COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`approve_user_id` bigint(32) NULL DEFAULT NULL COMMENT '审批者',
`memo` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '批注',
`before_approve_user_id` bigint(32) NULL DEFAULT NULL,
`before_memo` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`start_reagent_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '条形码开始',
`end_reagent_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '条形码结束',
`arrival_num` int NULL DEFAULT NULL,
`house_id` bigint(20) NULL DEFAULT NULL COMMENT '场所ID',
`place` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '货柜位置（参照base_meta，种类根据货柜类型变化）',
`container_id` bigint(20) NULL DEFAULT NULL COMMENT '货柜ID',
`article_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '货号',
`apply_goal` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '申购目的',
`apply_price` decimal(12, 2) NULL DEFAULT NULL COMMENT '申购价格',
`stock_flag` int(1) NULL DEFAULT 1 COMMENT '是否缺货（0：缺货，1：不缺货）',
`first_user` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`arrival_time` timestamp(0) NULL DEFAULT NULL COMMENT '到货时间',
`consignee_id` bigint(20) NULL DEFAULT NULL COMMENT '收货人id',
PRIMARY KEY (`id`) USING BTREE,
INDEX `reagent_id`(`reagent_id`) USING BTREE,
INDEX `apply_user_id`(`apply_user_id`) USING BTREE,
INDEX `approve_user_id`(`approve_user_id`) USING BTREE,
INDEX `status`(`status`) USING BTREE,
INDEX `apply_code`(`apply_code`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

drop table if exists `ope_apply_order`;
CREATE TABLE `ope_apply_order`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`ope_order_id` bigint(20) NOT NULL COMMENT '订单ID',
`ope_apply_id` bigint(20) NOT NULL COMMENT '申购ID',
PRIMARY KEY (`id`) USING BTREE,
INDEX `ope_order_id`(`ope_order_id`) USING BTREE,
INDEX `ope_apply_id`(`ope_apply_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `ope_email_status`;
CREATE TABLE `ope_email_status`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`order_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单编号',
`apply_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '申购编号',
`reagent_id` bigint(20) NOT NULL COMMENT '试剂ID',
`num` int(11) NULL DEFAULT NULL COMMENT '到货数量',
`apply_user_id` bigint(20) NULL DEFAULT NULL COMMENT '申购人ID',
`status` int(1) NULL DEFAULT NULL COMMENT '状态',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `ope_laboratory_reserve`;
CREATE TABLE `ope_laboratory_reserve`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`reagent_id` bigint(20) NOT NULL COMMENT '试剂ID',
`article_number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '货号',
`reserve` int(11) NULL DEFAULT 0 COMMENT '库存数量',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id',
`house_id` bigint(20) NULL DEFAULT NULL COMMENT '场所id',
`container_id` bigint(20) NULL DEFAULT NULL COMMENT '货柜id',
PRIMARY KEY (`id`) USING BTREE,
INDEX `reagent_id`(`reagent_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

drop table if exists `ope_order`;
CREATE TABLE `ope_order`  (
`id` bigint(20) NOT NULL  AUTO_INCREMENT COMMENT '主键ID',
`order_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单编号',
`order_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单名称',
`status` int(1) NULL DEFAULT NULL COMMENT '状态（3：待采购、4：已入库）',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`memo` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '批注',
`consignee_user_id` bigint(20) NULL DEFAULT NULL COMMENT '收货人ID',
`order_user_id` bigint(20) NULL DEFAULT NULL COMMENT '下单人ID',
`supplier_id` bigint(20) NULL DEFAULT NULL,
`supplier_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`arrival_time` timestamp(0) NULL DEFAULT NULL COMMENT '到货时间',
`destory_flag` int(1) NULL DEFAULT 0 COMMENT '报销状态（0：未报销 1：已报销）',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `ope_reagent_status`;
CREATE TABLE `ope_reagent_status`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`reagent_id` bigint(20) NOT NULL COMMENT '试剂ID',
`article_number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '货号',
`reagent_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '试剂条形码',
`realstatus` int(11) NULL DEFAULT NULL,
`status` int(1) NULL DEFAULT NULL COMMENT '状态（0：个人领用、1：在仓库、2：在实验室、3：报废）',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`house_id` bigint(20) NULL DEFAULT NULL COMMENT '场所ID',
`container_id` bigint(20) NULL DEFAULT NULL COMMENT '货柜ID',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`remainder` decimal(12, 2) NULL DEFAULT NULL COMMENT '残存量',
`place` varchar(150) NULL DEFAULT NULL COMMENT '货柜位置',
`project_num` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`store_type` int(1) NULL DEFAULT NULL COMMENT '入库类型（1:申购、2:直接入库）',
`apply_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '申购编号',
`order_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '订单编号',
`start_reagent_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '条形码开始',
`end_reagent_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '条形码结束',
`arrival_num` int(11) NULL DEFAULT NULL COMMENT '到货数量',
PRIMARY KEY (`id`) USING BTREE,
INDEX `reagent_id`(`reagent_id`) USING BTREE,
INDEX `user_id`(`user_id`) USING BTREE,
INDEX `oreagent_code`(`reagent_code`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

drop table if exists `ope_use_flow`;
CREATE TABLE `ope_use_flow`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`reagent_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '试剂条形码',
`status` int(1) NULL DEFAULT NULL COMMENT '状态（0：个人领用、1：在仓库、2：在实验室、3：报废）',
`realstatus` int NULL DEFAULT NULL,
`house_id` bigint(20) NULL DEFAULT NULL COMMENT '场所ID',
`container_id` bigint(20) NULL DEFAULT NULL COMMENT '货柜ID',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`remainder` decimal(12, 2) NULL DEFAULT NULL COMMENT '残存量',
`place` varchar(150) NULL DEFAULT NULL COMMENT '货柜位置',
`operatestate` bigint(20) NULL DEFAULT NULL,
`store_type` int(1) NULL DEFAULT NULL COMMENT '入库类型（1:申购、2:直接入库）',
`receipt_number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '领用单号',
`note` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '领用备注',
`volume` decimal(10, 4) NULL DEFAULT NULL COMMENT '体积',
PRIMARY KEY (`id`) USING BTREE,
INDEX `user_id`(`user_id`) USING BTREE,
INDEX `oreagent_code`(`reagent_code`) USING BTREE,
INDEX `ocontainer_id`(`container_id`) USING BTREE,
INDEX `ooperatestate`(`operatestate`) USING BTREE,
INDEX `create_time`(`create_time`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `ope_warehouse_reserve`;
CREATE TABLE `ope_warehouse_reserve`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`reagent_id` bigint(20) NULL DEFAULT NULL COMMENT '试剂ID',
`article_number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '货号',
`reserve` int(11) NULL DEFAULT 0 COMMENT '库存数量',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`apply_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '申购编号',
`order_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '订单编号',
`warehouseId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '仓库id',
`container_id` bigint(20) NULL DEFAULT NULL COMMENT '货柜id',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT '收货人id',
PRIMARY KEY (`id`) USING BTREE,
INDEX `reagent_id`(`reagent_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

drop table if exists `sys_alarm`;
CREATE TABLE `sys_alarm`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`container_id` bigint(20) NOT NULL COMMENT '货柜ID',
`warning_id` bigint(20) NULL DEFAULT NULL COMMENT '告警类别',
`warning_time` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间',
`warning_level` int(1) NULL DEFAULT NULL COMMENT '报警级别',
`controller_code` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

drop table if exists `sys_container_sensors`;
CREATE TABLE `sys_container_sensors`  (
`id` bigint(20) NOT NULL  AUTO_INCREMENT COMMENT '主键ID',
`container_id` bigint(20) NOT NULL COMMENT '货柜ID',
`temp` float NULL DEFAULT NULL COMMENT '温度值',
`humidity` float NULL DEFAULT NULL COMMENT '湿度值',
`voc1` float NULL DEFAULT NULL COMMENT '气体浓度',
`flag` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报警信息 0表示没有报警，非0值看哪些比特位被置位，定义如下：Bit0：温度低报警; Bit1：温度高报警; Bit2：湿度低报警; Bit3：湿度高报警; Bit4：VOC1',
`type` tinyint(4) NULL DEFAULT NULL COMMENT '1:sys_laboratory_container 2:sys_warehouse_container',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `container_id`(`container_id`) USING BTREE,
INDEX `update_time`(`update_time`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

drop table if exists `sys_controller`;
CREATE TABLE `sys_controller`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`controller_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主控编码',
`controller_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主控名称',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`type` bigint(20) NULL DEFAULT NULL COMMENT '主控柜类型（数据字典：controller_type）',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `sys_controller_unique_code`(`controller_code`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '主控库' ROW_FORMAT = DYNAMIC;


drop table if exists `sys_dangerous_encode`;
CREATE TABLE `sys_dangerous_encode`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`container_number` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '柜码',
`reagent_code` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '试剂名称码',
`reagent_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '试剂名称',
`cas` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'CAS号',
`memo` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`property` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '性状',
`feature` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '特性',
`avoid` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '相忌',
`status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '状态',
`fire` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '灭火器',
`random` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '随机码',
`code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '编码',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`creator` bigint(20) NULL DEFAULT NULL COMMENT '创建用户',
`count` int(11) NULL DEFAULT NULL COMMENT '使用次数',
PRIMARY KEY (`id`) USING BTREE,
INDEX `sreagent_code`(`reagent_code`) USING BTREE,
INDEX `sreagent_name`(`reagent_name`) USING BTREE,
INDEX `scas`(`cas`) USING BTREE,
INDEX `suptime`(`update_time`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `sys_encode_replace_dict`;
CREATE TABLE `sys_encode_replace_dict`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`type` int(1) NULL DEFAULT NULL COMMENT '三种类型:1.厂家,2.规格,3.包装',
`number` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '编号',
`info` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '信息',
`abbreviation` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '信息简写',
`creator` bigint(20) NULL DEFAULT NULL COMMENT '创建者',
`update_time` datetime(6) NULL DEFAULT NULL COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

drop table if exists `sys_file`;
CREATE TABLE `sys_file`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`valid_flag` int(1) NULL DEFAULT NULL,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`fileName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`createTime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
`updateTime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
`remark` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`version` int(11) NULL DEFAULT NULL,
`newOrOld` int(11) NULL DEFAULT NULL COMMENT '1新2旧',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_swedish_ci ROW_FORMAT = DYNAMIC;


drop table if exists `sys_hazardous_waste`;
CREATE TABLE `sys_hazardous_waste`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`acid` double(12, 4) NULL DEFAULT NULL COMMENT '酸',
`alkali` double(12, 4) NULL DEFAULT NULL COMMENT '碱',
`organic` double(12, 4) NULL DEFAULT NULL COMMENT '有机',
`solid` double(12, 4) NULL DEFAULT NULL COMMENT '固废',
`medical` double(12, 4) NULL DEFAULT NULL COMMENT '医疗',
`apply_person` varchar(64) NULL DEFAULT NULL COMMENT '确认者名称',
`project_id` bigint(20) NULL DEFAULT NULL COMMENT '课题组id',
`department` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门',
`unit` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单位',
`tid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单号',
`status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态  待解决、已解决、已拒绝',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
`updator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
`create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`updatetime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `sstatus`(`status`) USING BTREE,
INDEX `sapply_person`(`apply_person`) USING BTREE,
INDEX `sproject`(`project_id`) USING BTREE,
INDEX `sdepartment`(`department`) USING BTREE,
INDEX `screate_time`(`create_time`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `sys_laboratory`;
CREATE TABLE `sys_laboratory`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`type` bigint(20) NULL COMMENT '实验室类型（参照base_meta，种类为laboratory_type）',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实验室名',
`info_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态码',
`bar_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地点条码',
`location1` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '使用地点-楼号',
`location2` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '使用地点-地址号',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`department` bigint(20) NULL DEFAULT NULL COMMENT '负责部门（参照base_meta，种类为user_department）',
`project` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '课题组字符串,分隔',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `sys_laboratory_container`;
CREATE TABLE `sys_laboratory_container`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`laboratory_id` bigint(32) NULL DEFAULT NULL COMMENT '实验室ID',
`type` bigint(20)  NULL DEFAULT NULL COMMENT '货柜类型（参照base_meta，种类为container_type）',
`container_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '货柜条码',
`info_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态码',
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '临时存储库名称',
`structure` bigint(20) NULL DEFAULT NULL COMMENT '货柜结构（参照base_meta，种类为container_structure）',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`character_left` bigint(20) NULL DEFAULT NULL COMMENT '危险性质（参照base_meta，种类为reagent_character）',
`character_right` bigint(20) NULL DEFAULT NULL COMMENT '危险性质（参照base_meta，种类为reagent_character）',
`controller_code` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主控条码',
`temp` float NULL DEFAULT NULL COMMENT '温度值',
`humidity` float NULL DEFAULT NULL COMMENT '湿度值',
`voc1` float NULL DEFAULT NULL COMMENT '气体浓度',
`flag` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报警信息 0表示没有报警，非0值看哪些比特位被置位，定义如下：Bit0：温度低报警; Bit1：温度高报警; Bit2：湿度低报警; Bit3：湿度高报警; Bit4：VOC1',
`project` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '课题组字符串,分隔',
PRIMARY KEY (`id`) USING BTREE,
INDEX `laboratory_id`(`laboratory_id`) USING BTREE,
INDEX `container_code_unique`(`container_code`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '实验室临时存储库' ROW_FORMAT = DYNAMIC;


drop table if exists `sys_project`;
CREATE TABLE `sys_project`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`project_no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '课题号',
`project_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '课题名称',
`sys_user_id` bigint(32) NULL DEFAULT NULL COMMENT '课题负责人，对应sys_user主键ID',
`remark` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注说明',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`creater_user` bigint(32) NULL DEFAULT NULL COMMENT '创建人id',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
`project` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '课题组',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = DYNAMIC;
INSERT INTO `smartlab_promote`.`sys_project`(`project_no`, `project_name`, `sys_user_id`, `valid_flag`,  `project`) VALUES ('Y6DDG31001', '吴晓东课题', 1,  1, '吴晓东课题组');

drop table if exists `sys_reagent`;
CREATE TABLE `sys_reagent`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '试剂名称',
`cas` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'CAS编号',
`reagent_type` varchar(50) NULL DEFAULT NULL COMMENT '试剂类型',
`reagent_character` varchar(50) NULL DEFAULT NULL COMMENT '危险性质',
`supplier_id` bigint(20) NULL DEFAULT NULL COMMENT '供应商ID',
`reagent_format` varchar(50) NULL DEFAULT NULL COMMENT '试剂规格',
`main_metering` decimal(12, 2) NULL DEFAULT NULL COMMENT '主计量',
`reagent_unit` varchar(50) NULL DEFAULT NULL COMMENT '主计单位',
`price` decimal(12, 2) NULL DEFAULT NULL COMMENT '含税售价',
`per_box` int(11) NULL DEFAULT NULL COMMENT '每箱数量',
`memo` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`deadline` int(11) NULL DEFAULT 0 COMMENT '货期(天数)',
`product_sn` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品编号',
`dangerous_flag` int(11) NOT NULL DEFAULT 0 COMMENT '危险品标识\n0:普通试剂\n1:危险试剂',
`control_products` varchar(40) NULL DEFAULT NULL COMMENT '管制品',
`product_home` varchar(40) NULL DEFAULT NULL COMMENT '厂家',
`type` int(11) NULL DEFAULT NULL,
`safetynum` int(8) NULL DEFAULT 0 COMMENT '安全库存数量',
`originprice` decimal(10, 2) NULL DEFAULT NULL COMMENT '原始价格',
`density` decimal(10, 4) NULL DEFAULT NULL COMMENT '密度',
PRIMARY KEY (`id`) USING BTREE,
INDEX `supplier_id`(`supplier_id`) USING BTREE,
INDEX `export`(`cas`, `supplier_id`, `reagent_format`, `main_metering`, `reagent_unit`) USING BTREE COMMENT '根据字段去判断数据是否重复',
INDEX `create_time`(`create_time`) USING BTREE,
INDEX `price`(`price`) USING BTREE,
INDEX `sproduct_home`(`product_home`) USING BTREE,
INDEX `scontrol_products`(`control_products`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `sys_sequence`;
CREATE TABLE `sys_sequence`  (
`id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '主键ID',
`name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '序列名',
`min_val` int(11) NOT NULL DEFAULT 0 COMMENT '最小值',
`max_val` int(11) NOT NULL DEFAULT 0 COMMENT '最大值',
`current_val` int(11) NOT NULL DEFAULT 0 COMMENT '当前值',
`step` int(11) NOT NULL DEFAULT 1 COMMENT '增长值',
`update_time` timestamp(0) NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `name`(`name`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `sys_supplier`;
CREATE TABLE `sys_supplier`  (
`id` bigint(20) NOT NULL  AUTO_INCREMENT COMMENT '主键ID',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '供应商名',
`person_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人',
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电话',
`memo` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `sys_user`;
CREATE TABLE `sys_user`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`arp` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'ARP号',
`account` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '登陆账号',
`password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '登陆密码',
`company` bigint(20) NULL DEFAULT NULL COMMENT '负责公司（参照base_meta，种类为user_company）',
`department` bigint(20) NULL DEFAULT NULL COMMENT '负责部门（参照base_meta，种类为user_department）',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '姓名',
`phone` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电话',
`email` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮箱',
`memo` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`id_card` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'ID卡号',
`approver_flag` int(1) NULL DEFAULT 0 COMMENT '是否审批者（0：不是、1：是）',
`role_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色ID',
`see_flag` int(1) NULL DEFAULT 0 COMMENT '可见度（0一般人员，1负责人，2管理员）',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`point` int(11) NULL DEFAULT 20,
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`project_id` bigint(20) NULL DEFAULT NULL COMMENT '课题组id',
`waster` int(1) NULL DEFAULT NULL COMMENT '1危废处置人员 2危废管理员',
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片url',
`score` decimal(6, 2) NULL DEFAULT NULL COMMENT '考试分数',
PRIMARY KEY (`id`) USING BTREE,
INDEX `company`(`company`) USING BTREE,
INDEX `department`(`department`) USING BTREE,
INDEX `role_id`(`role_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

INSERT INTO sys_user(`arp`, `account`, `password`,  `name`, `waster`,`role_id`) VALUES ('ADMIN', 'admin', '7e6d414341e084973de15d75f4c91bc1', '管理员',  2,1);


drop table if exists `sys_warehouse`;
CREATE TABLE `sys_warehouse`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '仓库类型（参照base_meta，种类为warehouse_type）',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库名',
`info_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态码',
`bar_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地点条码',
`location1` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '使用地点-楼号',
`location2` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '使用地点-地址号',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`department` bigint(20) NULL DEFAULT NULL COMMENT '部门id',
`temperature_max` decimal(8, 4) NULL DEFAULT NULL COMMENT '温度最大值',
`temperature_min` decimal(8, 4) NULL DEFAULT NULL COMMENT '温度最小值',
`humidity_max` decimal(8, 4) NULL DEFAULT NULL COMMENT '湿度最大值',
`humidity_min` decimal(8, 4) NULL DEFAULT NULL COMMENT '湿度最小值',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `sys_warehouse_container`;
CREATE TABLE `sys_warehouse_container`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`warehouse_id` bigint(20) NULL DEFAULT NULL COMMENT '仓库ID',
`type` bigint(20) NULL DEFAULT NULL COMMENT '货柜类型（参照base_meta，种类为container_type）',
`container_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '货柜条码',
`info_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态码',
`structure` bigint(20) NULL DEFAULT NULL COMMENT '货柜结构（参照base_meta，种类为container_structure）',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '货柜名称',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`valid_flag` int(1) NULL DEFAULT 1 COMMENT '有效标识（0：无效、1：有效）',
`character_left` bigint(20) NULL DEFAULT NULL COMMENT '危险性质（参照base_meta，种类为reagent_character）',
`character_right` bigint(20) NULL DEFAULT NULL COMMENT '危险性质（参照base_meta，种类为reagent_character）',
`controller_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主控代码',
PRIMARY KEY (`id`) USING BTREE,
INDEX `warehouse_id`(`warehouse_id`) USING BTREE,
INDEX `container_code_unique`(`container_code`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `sys_warehouse_status`;
CREATE TABLE `sys_warehouse_status`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '仓库类型',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '仓库名称',
`temperature` decimal(7, 4) NULL DEFAULT NULL COMMENT '温度',
`humidity` decimal(7, 4) NULL DEFAULT NULL COMMENT '湿度',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
`create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建日期',
`valid_flag` tinyint(3) NULL DEFAULT NULL COMMENT '有效标识',
`warehouse_id` bigint(20) NULL DEFAULT NULL COMMENT '仓库id',
`select_date` datetime(0) NULL DEFAULT NULL COMMENT '指定日期',
`warning` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报警信息',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;


drop table if exists `sys_warning`;
CREATE TABLE `sys_warning`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` bigint(32) NULL DEFAULT NULL COMMENT '用户ID',
`container_id` bigint(32) NULL DEFAULT NULL COMMENT '柜台ID',
`warning_id` bigint(32) NULL DEFAULT NULL COMMENT '报警类别',
`warning_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT 'yyyy-MM-dd HH:mm:ss',
`warning_level` int(4) NULL DEFAULT NULL COMMENT '1：警告\r\n2：错误\r\n3：危险\r\n4：严重危险',
`warning_point` int(4) NULL DEFAULT NULL COMMENT '实验人员“信誉”扣分',
`status` int(4) NULL DEFAULT NULL COMMENT '0:未处理 1：已处理',
`memo` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`daping_alarm_id` bigint(32) NULL DEFAULT NULL COMMENT '大屏关联Id',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

drop table if exists `ope_reagent_code`;
CREATE TABLE `ope_reagent_code`  (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`order_id` bigint(20) NOT NULL COMMENT '订单id',
`apply_id` bigint(20) NOT NULL COMMENT '申请id',
`end_code` int(11) NOT NULL COMMENT '试剂标签编码结束位置',
`start_code` int(11) NOT NULL COMMENT '试剂标签编码开始位置',
`code_prex` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
`status` int(11) NOT NULL DEFAULT 0 COMMENT '状态',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `order_id`(`order_id`) USING BTREE,
UNIQUE INDEX `apply_id`(`apply_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

