CREATE TABLE ocr_form_config (
     id BIGINT NOT NULL PRIMARY KEY,
     status VARCHAR(255),
     message VARCHAR(255),
     timestamp TIMESTAMP,
     signature VARCHAR(255),
     data LONGTEXT,
     tenant_no BIGINT,
     account_no BIGINT,
     project_no BIGINT,
     taskForm_no BIGINT,
     field_list VARCHAR(255),
     type INT,
     field_code VARCHAR(255),
     field_name VARCHAR(255),
     parent_file_code VARCHAR(255),
     level INT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE ocr_picture (
     id BIGINT NOT NULL PRIMARY KEY,
     task_id BIGINT,
     image_no BIGINT,
     image_url VARCHAR(255),
     image_type VARCHAR(255),
     image_status VARCHAR(10),
     local_image_url VARCHAR(255),
     max_similarity_score VARCHAR(255),
     similarity_score VARCHAR(255)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE duplicate_task (
     id BIGINT NOT NULL PRIMARY KEY,
     task_id BIGINT,
     image_no BIGINT,
     image_url VARCHAR(255),
     image_type VARCHAR(255),
     image_status VARCHAR(10),
     local_image_url VARCHAR(255),
     max_similarity_score VARCHAR(255),
     similarity_score VARCHAR(255)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE task (
    id BIGINT AUTO_INCREMENT PRIMARY KEY,
    tenant_code VARCHAR(50) COMMENT '租户编码',
    access_key VARCHAR(100) COMMENT '访问密钥',
    timestamp BIGINT COMMENT '时间戳',
    signature VARCHAR(255) COMMENT '签名',
    tenant_no BIGINT COMMENT '租户雪花no',
    task_no BIGINT COMMENT '任务NO',
    account_no BIGINT COMMENT '业务主体雪花no',
    account_name VARCHAR(100) COMMENT '业务主体名称',
    project_no BIGINT COMMENT '关联项目no',
    project_name VARCHAR(100) COMMENT '项目名称',
    task_form_no BIGINT COMMENT '任务表单no',
    plan_no BIGINT COMMENT '所属主计划ID',
    plan_name VARCHAR(100) COMMENT '所属主计划名称',
    plan_child_no BIGINT COMMENT '所属子计划ID',
    plan_child_name VARCHAR(100) COMMENT '所属子计划名称',
    task_id BIGINT COMMENT '任务ID',
    task_name VARCHAR(100) COMMENT '任务名称',
    user_no BIGINT COMMENT '提报人no',
    user_name VARCHAR(100) COMMENT '提报人名称',
    submit_time BIGINT COMMENT '任务提交时间',
    live_photo LONGTEXT COMMENT '拍照打卡',
    dynamic_fields TEXT COMMENT '动态字段'
) COMMENT='任务表';

CREATE TABLE duplicate_task (
    id BIGINT AUTO_INCREMENT PRIMARY KEY,
    tenant_code VARCHAR(255) NOT NULL COMMENT '租户代码',
    access_key VARCHAR(255) NOT NULL COMMENT '访问标识',
    timestamp BIGINT NOT NULL COMMENT '请求时间戳',
    signature VARCHAR(255) NOT NULL COMMENT '签名',
    account_no BIGINT COMMENT '业务主体',
    tenant_no BIGINT COMMENT '租户',
    request_id BIGINT COMMENT '请求批次ID',
    task_nos TEXT COMMENT '任务nos',
    query_config TEXT COMMENT '查询配置（JSON格式）',
    max_similarity_score TEXT COMMENT '最大相似度',
    completed TINYINT COMMENT '是否已经完成（0:否, 1:是）'
) COMMENT='重复任务表';

CREATE TABLE ocr_picture_compare (
     id BIGINT NOT NULL PRIMARY KEY,
     task_no BIGINT,
     image_no BIGINT,
     image_url VARCHAR(255),
     image_type VARCHAR(255),
     image_status VARCHAR(10),
     local_image_url VARCHAR(255),
     max_similarity_score VARCHAR(255),
     similarity_score VARCHAR(255)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE photos_compare (
    id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键',
    first_img_no BIGINT NOT NULL COMMENT '图片NO',
    first_img_url VARCHAR(255) COMMENT '图片地址',
    first_local_img_url VARCHAR(255) COMMENT '本地图片地址',
    first_img_hash VARCHAR(255) COMMENT '图片hash值',
    second_img_no BIGINT NOT NULL COMMENT '图片NO',
    second_img_url VARCHAR(255) COMMENT '图片地址',
    second_local_img_url VARCHAR(255) COMMENT '本地图片地址',
    second_img_hash VARCHAR(255) COMMENT '图片hash值',
    similarity_score VARCHAR(50) COMMENT '相似度'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='图片对比表';
