drop table if exists ocr_picture;

/*==============================================================*/
/* Table: ocr_picture                                           */
/*==============================================================*/
create table ocr_picture
(
    ID                   bigint(20) not null comment '主键',
    create_by            varchar(100) not null comment '创建人',
    create_time          bigint(15) not null comment '创建时间',
    update_by            varchar(100) comment '修改人',
    update_time          bigint(15) comment '修改时间',
    classificationid     varchar(32) comment '分类表主键--通过“图片分类”字段做匹配，如果没有自动添加',
    pictureclassid       varchar(32) comment '图片类型--通过“AI图片分类接口获得”',
    iztrueorfalse        int comment '图片真假0:假，1：真',
    judgeid              bigint(20) comment '选判真假原因id,从字典表中获得，其他时，当前字段为零',
    judgedesc            varchar(190) comment '图片为假的其他原因，长度不超过50个汉字',
    tenant_id            bigint(20) comment '公司ID',
    tenantstatus         varchar(50) comment '公司状态',
    plantCode            varchar(50) comment '公司代码，第三方系统',
    tenantname           varchar(255) comment '公司名称',
    pictureid            varchar(64) comment '业务主体ID--图片主键',
    picturename          varchar(255) comment '业务主体名称--图片成名',
    imgName              varchar(200) comment '图片名称',
    imgUrl               varchar(255) comment '图片地址',
    picturestatus        varchar(50) comment '业务主体状态',
    projectId            varchar(64) comment '源项目id',
    projectIdName        varchar(200) comment '项目名称',
    projectstatus        varchar(50) comment '项目状态',
    planId               varchar(64) comment '源计划id',
    planName             varchar(200) comment '计划名称',
    planstatus           varchar(50) comment '计划状态',
    planchildid          varchar(64) comment '所属子计划ID',
    planchildname        varchar(255) comment '所属子计划名称',
    planchildstatus      varchar(50) comment '所属子计划状态',
    upTime               bigint(15) comment '上传时间',
    genTime              bigint(15) comment '生成时间',
    space                varchar(20) comment '色彩空间',
    source               varchar(100) comment '来源',
    upHead               varchar(255) comment '上报者头像--接口传送',
    upuserid             varchar(64) comment '上报人主键',
    upName               varchar(200) comment '上报者名称--接口传送',
    releaseArea          varchar(200) comment '发布地区,拜访城市,城市名称，例如：北京市、天津市、石家庄市',
    releaseProvince      varchar(200) comment '拜访省份',
    remark               varchar(100) comment '任务id',
    taskName             varchar(200) comment '任务名称，源系统',
    taskstatus           varchar(2) default '0' comment '是否已经生成任务,0：否，1：是',
    work_status          varchar(2) default '0' comment '是否已经审批，0：未生成，1：审批中，2：已审批',
    categoryid           bigint(20) comment '现项目ID',
    taskchildpictureid   varchar(32) comment '任务-工单主键',
    field1               varchar(255) comment '提报人',
    field2               varchar(100) comment '拜访客户类型',
    field3               varchar(100) comment '拜访客户名称,终端名称，例如中日友好医院',
    field4               varchar(100) comment '任务来源',
    field5               varchar(100) comment '厂商',
    field6               varchar(100) comment '拜访客户级别',
    field7               varchar(100) comment '科室名称',
    field8               varchar(100) comment '拜访小结',
    field9               varchar(100) comment '产品名称',
    field10              varchar(255) comment '地区，定位信息，例如北京市朝阳区文苑路10号',
    field11              bigint(15) comment '拜访日期',
    field12              varchar(20) comment '定位距离',
    field13              varchar(20) comment '病历号',
    field14              varchar(10) comment '是否重复',
    field15              varchar(10) comment '任务类型',
    field18              varchar(10) comment '备用字段',
    field16              varchar(10) comment '任务状态',
    field17              varchar(10) comment '拜访项目类别',
    primary key (ID)
);

drop table if exists ocr_taskchild_picture;

/*==============================================================*/
/* Table: ocr_taskchild_picture                                 */
/*==============================================================*/
create table ocr_taskchild_picture
(
    ID                   bigint(20) not null comment '主键',
    OCPICTUREID          text comment '比对图片主键，多个数据使用英文逗号分隔',
    PICTURERESULT        text comment '图片比对结果,与图片主键一一对应，记录比对结果，使用英文逗号分隔，例如99.6,98.1,97.2',
    PICTURECOMPARE       text comment '只记录主图，如果存在历史图片，不在这里记录',
    DEPTID               varchar(64) comment '所属部门',
    TENANTID             bigint(20) comment '租户ID',
    PACKAGEID            bigint(20) comment '任务包主键',
    PICTUREID            bigint(20) comment '原图片主键',
    CATEGORY             varchar(190) comment '类型名称',
    CATEGORYID           bigint(20) comment '项目ID',
    SPECIFICATION        varchar(190) comment '明细单',
    BUESSINESSNO         varchar(100) not null comment '业务编码',
    STATES               int comment '状态，审批状态 1:未提交 2:审批中 3:审批通过 ，5：拒绝',
    PROCESSINSTANCEID    varchar(64) comment '流程实例IdprocessInstanceId',
    PROCESSDEFINITIONID  varchar(64) comment '流程定义id',
    DEPLOYMENTID         varchar(64) comment '流程部署id',
    ASSIGNEENAME         varchar(190) comment '审批人姓名',
    ASSIGNEE             varchar(255) comment '审批人',
    UPDATEUSER           varchar(190) default '1' comment '修改人，记录创建人的帐号',
    UPDATETIME           bigint(15) comment '更新时间',
    FILEANNEX            varchar(190) comment '附件',
    GUIDANG              int comment '是否归档，0：未归档，1：归档',
    CREATEUSER           varchar(100) not null comment '创建人',
    CREATEUSERNAME       varchar(190) comment '创建人姓名',
    CREATEDATE           bigint(15) not null comment '创建时间',
    USERID               bigint(20) comment '员工主键',
    USERNAME             varchar(190) comment '员工姓名',
    FROMTASKID           varchar(100) comment '任务id,来源于图片表',
    FROMTASKNAME         varchar(200) comment '任务名称,来源于图片表',
    FROMUSERID           varchar(64) comment '提报人',
    FROMPROJECTID        varchar(64) comment '所属项目',
    FROMPLANID           varchar(64) comment '所属计划',
    FROMUPTIME           bigint(15) comment '提报时间',
    FROMSOURCEID         varchar(64) comment '任务来源',
    primary key (ID)
);

ALTER TABLE ocr_picture ADD COLUMN field17 varchar(10);
ALTER TABLE ocr_picture ADD COLUMN field18 varchar(10);

ALTER TABLE ocr_configuration ADD COLUMN IZFILED2 varchar(1) default 'N';
ALTER TABLE ocr_configuration ADD COLUMN IZFIELD6 varchar(1) default 'N';
ALTER TABLE ocr_configuration ADD COLUMN IZFIELD3 varchar(1) default 'N';
ALTER TABLE ocr_configuration ADD COLUMN IZFIELD17 varchar(1) default 'N';


ALTER TABLE ocr_picture ADD COLUMN pictureclassscores   varchar(20);


INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928285, '/backstage/jifen/ocrtaskchildpicture/listbypackageid', '任务包-任务列表');
INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928286, '/backstage/jifen/ocrtaskchildpicture/getdata', '任务包-单任务详情');
INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928287, '/backstage/jifen/ocrtaskchildpicture/listbypictureid', '任务包-单任务详情-相似图片列表');
INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928288, '/backstage/jifen/ocrtaskchildpicture/ordertrueorfalse', '任务包-批量设置真假');
INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928289, '/backstage/jifen/ocrtaskchildpicture/clearmark', '任务包-清除');

INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928290, '/flow/task/completeBatchFlow', '任务审批--批量');
INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928291, '/backstage/jifen/ocrtaskchildpicture/markpoint', '任务包--智能审批工具');


ALTER TABLE ocr_taskchild_picture ADD COLUMN HAVEPOINTS int default 0;


#筛选条件部分
ALTER TABLE ocr_usersearchchild ADD search_relation_type  varchar(30)  COMMENT '筛选关系';
ALTER TABLE ocr_usersearchchild ADD order_num  bigint COMMENT '排序字段';

#筛选关系字典
INSERT INTO `ocrnew`.`s_distionarygroup_t` (`ID`, `CODENO`, `DISTIONARYTYPEID`, `GROUPNAME`, `USEMODE`, `ENABLED`, `SORTING`, `CREATEUSER`, `CREATEDATE`, `UPDATEUSER`, `UPDATETIME`) VALUES (260403593406841716, 'searchRelationType', 251195458853011929, '筛选关系', 3, 1, 1, '1', 1709869309465, '1', NULL);

INSERT INTO `ocrnew`.`s_distionary_t` (`ID`, `DISTIONARYTYPEID`, `DISTIONATYGROUPID`, `CODENO`, `NAME`, `CONTENT`, `ENABLED`, `SORTING`, `CREATEUSER`, `CREATEDATE`, `UPDATEUSER`, `UPDATETIME`, `WEIGHT`, `BACKUP`) VALUES (260403794584536052, 251195458853011929, 260403593406841716, '0', '当', 'where', 1, 0, '1', 1709869405394, '1', NULL, NULL, NULL);
INSERT INTO `ocrnew`.`s_distionary_t` (`ID`, `DISTIONARYTYPEID`, `DISTIONATYGROUPID`, `CODENO`, `NAME`, `CONTENT`, `ENABLED`, `SORTING`, `CREATEUSER`, `CREATEDATE`, `UPDATEUSER`, `UPDATETIME`, `WEIGHT`, `BACKUP`) VALUES (260403989460288628, 251195458853011929, 260403593406841716, '1', '与', 'and', 1, 1, '1', 1709869498319, '1', NULL, NULL, NULL);
INSERT INTO `ocrnew`.`s_distionary_t` (`ID`, `DISTIONARYTYPEID`, `DISTIONATYGROUPID`, `CODENO`, `NAME`, `CONTENT`, `ENABLED`, `SORTING`, `CREATEUSER`, `CREATEDATE`, `UPDATEUSER`, `UPDATETIME`, `WEIGHT`, `BACKUP`) VALUES (260404014349288692, 251195458853011929, 260403593406841716, '2', '或', 'or', 1, 2, '1', 1709869510187, '1', NULL, NULL, NULL);



#真假原因字典
INSERT INTO `ocrnew`.`s_distionary_t` (`ID`, `DISTIONARYTYPEID`, `DISTIONATYGROUPID`, `CODENO`, `NAME`, `CONTENT`, `ENABLED`, `SORTING`, `CREATEUSER`, `CREATEDATE`, `UPDATEUSER`, `UPDATETIME`, `WEIGHT`, `BACKUP`) VALUES (260402999231251188, 251195458853011929, 251196098891219545, '0', '其他', '其他', 1, 99, '1', 1709869115234, '1', NULL, NULL, NULL);


#2024-03-10

INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928292, '/backstage/ocrnewtest/ocrprovince/listall', '查询省份');
INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928293, '/backstage/oa/category/listall', '查询项目');


drop table if exists ocr_province;

/*==============================================================*/
/* Table: ocr_province                                          */
/*==============================================================*/
create table ocr_province
(
    ID                   bigint(20) not null comment '主键',
    CREATEBY             varchar(100) not null comment '创建人',
    CREATETIME           bigint(15) not null comment '创建时间',
    UPDATEBY             varchar(100) comment '修改人',
    UPDATETIME           bigint(15) comment '修改时间',
    TENANTID             bigint(20) comment '租户ID',
    PRONAME              varchar(255) comment '省份名称',
    REORDER              int comment '排序字段',
    primary key (ID)
);


ALTER TABLE ocr_taskchild_picture ADD COLUMN TASKNAME varchar(190) comment '当前节点名称';

ALTER TABLE OA_USERAPPROVE_T ADD COLUMN  TASKNAME  varchar(190) comment '审批节点名称';
ALTER TABLE OA_USERAPPROVE_T ADD COLUMN  STATSHIS int comment '审批状态，记录当前节点审批状态，1：.待审批 (只针对前端返回 库中逻辑上不存在) 2.通过 3.不通过';
ALTER TABLE OA_USERAPPROVE_T ADD COLUMN  COMMENTHIS varchar(190) comment '审批意见';
ALTER TABLE OA_USERAPPROVE_T ADD COLUMN  TASKINDEX int comment '节点位置，待定字段';
ALTER TABLE OA_USERAPPROVE_T ADD COLUMN  TASKNO varchar(64) comment '节点编号,待定字段';


INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928301, '/flow/task/listalldata', '查询我的待审批、审批历史');


update S_RESOURCES_T set RESOURCENAME='公司管理',RESOURCEDESC='公司管理'  where ID=5;
update S_DEPARTMENT_T set DEPARTSHOTNAME='无量云',DEPARTNAME='无量云',DEPARTDESC='无量云说明',DEPARTADDRESS='无量云地址' where ID=0;

delete from S_RESOURCES_T where ID=1196092352600928256;
delete from S_RESOURCEMETHOD_T where RESOURCEID=1196092352600928256;

ALTER TABLE S_DEPARTMENT_T ADD COLUMN SERVICENAME          varchar(190) comment '对应的Service名，主要是spring的service名';
ALTER TABLE S_DEPARTMENT_T ADD COLUMN BUILTFORM            int comment '内置表单，使用flowable表单，0：使用本地数据，1：使用flowable表单，3:外置表单，4：其他自定义表单';
ALTER TABLE S_DEPARTMENT_T ADD COLUMN FORMURL              varchar(190) comment '表单地址，用户展示用户表单使用';
ALTER TABLE S_DEPARTMENT_T ADD COLUMN FORMDETAIL           varchar(190) comment '表单详情';
ALTER TABLE S_DEPARTMENT_T ADD COLUMN FORMTYPE             varchar(50) comment '表单分类';
ALTER TABLE S_DEPARTMENT_T ADD COLUMN PROCESSDEFINITIONID  varchar(64) comment '流程定义id';
ALTER TABLE S_DEPARTMENT_T ADD COLUMN TYPEDEPT             int default 1 comment '公司类型，0：租户，1：主体';
ALTER TABLE S_DEPARTMENT_T ADD COLUMN TYPEDEPT             int default 1 comment '公司类型，0：租户，1：主体';
ALTER TABLE S_DEPARTMENT_T ADD COLUMN CATEGORY             varchar(190) not null comment '对应的工作流编码，与工作流中的命名空间对应';

INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928213, '/flow/definition/flowImg', '查看流程图');

INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK) VALUES(1196092352600928214, '/backstage/admin/department/updateflowable', '公司关联工作流');




INSERT INTO S_RESOURCES_T(ID,RESOURCENAME,RPARENTID,ROOTID,RESOURCETYPE,PRIORITYPE,RESOURCE,RESOURCELIST,RESOURCEDESC,ENABLED,RIOCNIMAGE)
VALUES (1231708402914598912,'前端菜单管理',160000,160000, '1', '5','/backstage/oa/frontmenuHtml/toList','/backstage/oa/frontmenu/list','前端菜单管理', '1', 'icon-diamond');

INSERT INTO S_RESOURCEMETHOD_T (RESOURCEID,METHODID,RESOURCEBEFOR,RESOURCEAFTER) VALUES
    (1231708402914598912, '101','/backstage/oa/frontmenuHtml/toSave','/backstage/oa/frontmenu/save');

INSERT INTO S_RESOURCEMETHOD_T (RESOURCEID,METHODID,RESOURCEBEFOR,RESOURCEAFTER) VALUES
    (1231708402914598912, '102','/backstage/oa/frontmenuHtml/toEdit','/backstage/oa/frontmenu/edit');

INSERT INTO S_RESOURCEMETHOD_T (RESOURCEID,METHODID,RESOURCEBEFOR,RESOURCEAFTER) VALUES
    (1231708402914598912, '103','/backstage/oa/frontmenu/delmore',null);

INSERT INTO S_RESOURCEMETHOD_T (RESOURCEID,METHODID,RESOURCEBEFOR,RESOURCEAFTER) VALUES
    (1231708402914598912, '104','/backstage/oa/frontmenu/getdata',null);

INSERT INTO S_RESOURCEMETHOD_T (RESOURCEID,METHODID,RESOURCEBEFOR,RESOURCEAFTER) VALUES
    (1231708402914598912, '111','/backstage/oa/frontmenuHtml/toEdit','/backstage/oa/frontmenu/edit');

INSERT INTO S_RESOURCEMETHOD_T (RESOURCEID,METHODID,RESOURCEBEFOR,RESOURCEAFTER) VALUES
    (1231708402914598912, '112','/backstage/oa/frontmenu/delone',null);

INSERT INTO S_RESOURCEMETHOD_T (RESOURCEID,METHODID,RESOURCEBEFOR,RESOURCEAFTER)
VALUES (1231708402914598912, 105,'/backstage/oa/userfrontmenu/list','/backstage/oa/userfrontmenu/saveactiongrant');

INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK)
VALUES(1231708402641969153, '/backstage/oa/userfrontmenuHtml/showlist', '进入前端菜单用户列表');

INSERT INTO S_BACKSTAGEOPENURL_T(ID,URL,REMARK)
VALUES(1231708402641969153, '/backstage/oa/userfrontmenuHtml/showlist', '进入前端菜单用户列表');
