CREATE TABLE `receive_data_log` (
    `event_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '事件流水号',
    `process_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '传输标记号',
    `event_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '数据文件内容主业务类型',
    `event_type_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '数据文件内容主业务类型名称',
    `sub_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '数据文件内容子业务类型',
    `sub_type_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '数据文件内容子业务类型名称',
    `data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '数据文件内容',
    `ver` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'API协议版本',
    `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除(0-否 1-是)',
    PRIMARY KEY (`event_id`) USING BTREE,
    KEY `idx_process_id` (`process_id`) USING BTREE,
    KEY `idx_event_type` (`event_type`) USING BTREE,
    KEY `idx_sub_type` (`sub_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='接收数据日志信息表';

CREATE TABLE domestic_pharma_base_info (
    id BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
    event_id VARCHAR(32) NOT NULL COMMENT '事件流水号',
    tyshxydm VARCHAR(20) NOT NULL COMMENT '统一社会信用代码',
    jnypscqymc VARCHAR(100) NOT NULL COMMENT '生产企业名称',
    jnypscqylx VARCHAR(50) COMMENT '企业类型',
    zsdz VARCHAR(200) COMMENT '注册地址',
    zsdzgjhdq VARCHAR(10) COMMENT '注册地址国家/地区代码',
    zsdzszxszzq VARCHAR(10) COMMENT '注册地址所在行政区',
    zsdzsqzzzm VARCHAR(10) COMMENT '注册地址社区/镇/村',
    zsdzxzzxxjs VARCHAR(10) COMMENT '注册地址乡镇/街道',
    zsdzxzjdbsc VARCHAR(100) COMMENT '注册地址详细街道办/社区',
    zsdzcjlld VARCHAR(100) COMMENT '注册地址村居/路/楼栋',
    zsdzmphm VARCHAR(100) COMMENT '注册地址门牌号码',
    fddbr VARCHAR(50) COMMENT '法定代表人',
    zczb VARCHAR(50) COMMENT '注册资本(万元)',
    clrq DATE COMMENT '成立日期',
    yyqx VARCHAR(50) COMMENT '营业期限',
    jyfw VARCHAR(500) COMMENT '经营范围',
    djjg VARCHAR(200) COMMENT '登记机关',
    gddhhm VARCHAR(20) COMMENT '固定电话号码',
    czhm VARCHAR(20) COMMENT '传真号码',
    dzxx VARCHAR(100) COMMENT '电子信箱',
    qywz VARCHAR(100) COMMENT '企业网址',
    lxr VARCHAR(50) COMMENT '联系人',
    lxdh VARCHAR(20) COMMENT '联系电话',
    zsgps VARCHAR(50) COMMENT 'GPS坐标(经度,纬度)',
    create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    is_deleted TINYINT DEFAULT 0 COMMENT '是否删除(0-否 1-是)',
    INDEX idx_jnypscqymc (jnypscqymc),
    INDEX idx_zsdzszxszzq (zsdzszxszzq)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='境内药品生产企业基本信息数据表';


CREATE TABLE `domestic_drug_production_apply_info` (
       `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
       `event_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '事件流水号',
       `rec_time` datetime NOT NULL COMMENT '事件响应时间',
       `ypzsm` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '药品追溯码',
       `syjbzypzsm` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '上一级包装药品追溯码',
       `bzcj` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '包装层级',
       `ymzt` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '暂无',
       `tyshxydmscqy` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '统一社会信用代码',
       `scqymc` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '境内药品生产企业名称',
       `yptymc` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '药品通用名称',
       `gjypbsm` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '国家药品标识码',
       `ymscph` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '药品生产批号',
       `scrq` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '药品生产日期',
       `ymyxqjzrq` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '药品有效期截止日期',
       `scsl` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '生产数量',
       `scdz` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '生产地址',
       `rkdbh` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '入库单编号',
       `rksj` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '入库时间',
       `rkdwmc` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '入库单位名称',
       `rkdwtyshxydm` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '入库单位统一社会信用代码',
       `rkdwlx` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '入库单位类型',
       `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
       `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
       `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除(0-否 1-是)',
       PRIMARY KEY (`id`)  USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='国产药品生产信息数据子集';