CREATE TABLE `wm_score_package` (
    `id` int NOT NULL AUTO_INCREMENT,
    `task_rule_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规则ID',
    `drug_ent_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `score_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `score_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包名称',
    `score` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `agent_type_id` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `level1_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '一级代理商',
    `level2_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '二级代理商',
    `zb_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '众包ID',
    `xxdb_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '销售代表ID',
    `typeid` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分配对象类型',
    `package_status` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包状态',
    `package_finish_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包完成状态',
    `package_audit_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包审核状态',
    `send_package_dept_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '发包方ID',
    `dept_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '组织机构ID',
    `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否删除',
    `enable_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否禁用',
    `tenant_id` int NOT NULL DEFAULT '1' COMMENT '所属租户',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `create_user` int DEFAULT NULL COMMENT '创建人',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `update_user` int DEFAULT NULL COMMENT '更新人',
    `ytj` int DEFAULT NULL,
    `ysh` int DEFAULT NULL,
    `dsh` int DEFAULT NULL,
    `ytjtt` int DEFAULT NULL,
    `ywctt` int DEFAULT NULL,
    `yshtt` int DEFAULT NULL,
    `receive_date` datetime DEFAULT NULL COMMENT '领取时间',
    `is_conduct` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '是否进行中',
    `drugs_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `statement_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '结算单号',
    `settle_status` int DEFAULT NULL COMMENT '结算状态',
    `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '结算结果描述',
    `invoice_category` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '发票类目',
    `settle_amount` decimal(30,2) DEFAULT NULL COMMENT '实际结算金额',
    `discount` decimal(11,4) DEFAULT NULL COMMENT '折扣',
    `package_finish_time` datetime DEFAULT NULL COMMENT '完成时间',
    `relation_score_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '关联积分包id',
    `package_type1` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包任务类型1',
    `package_type2` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包任务类型2',
    `user_num` int DEFAULT NULL COMMENT '需求人数',
    `task_num` int DEFAULT NULL COMMENT '任务个数',
    `package_user_scope` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '接单对象范围',
    `kfpjf` int DEFAULT NULL COMMENT '可分配积分',
    `belong_date` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属月份',
    `allocation_date` datetime DEFAULT NULL COMMENT '分配日期',
    `pay_rate` decimal(20,2) DEFAULT NULL COMMENT '已支付百分比',
    `finish_rate` decimal(20,2) DEFAULT NULL COMMENT '已完成百分比',
    `pay_score` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '已支付积分值',
    `end_label_date` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '查询结束日期',
    `score_package_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包名称',
    `related_service` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '关联服务企业',
    `package_is_conduct` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包是否进行中',
    `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '描述',
    `user_score` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '个人预计包值',
    `enable_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '终止方式',
    `is_receive` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '是否允许接单',
    `rule_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规则id',
    `accept_sug` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '接包对象',
    `task_add_flag` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '1' COMMENT '是否可以新增任务1-可以  0-不可以',
    `settle_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '结算状态',
    `score_package_status` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包状态',
    `old_package` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否为旧数据',
    `settlement_date` datetime DEFAULT NULL COMMENT '结算时间',
    `source_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '数据来源类型（0：手动上传，1：系统对接）',
    `project_num` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '项目编号',
    `drug_producer` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '关联药品生产厂商名称',
    `p2p_amount` decimal(11,2) DEFAULT NULL,
    `p2p_time` datetime DEFAULT NULL COMMENT '公对公提交时间',
    `oms_order_sn` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '订单号',
    `sub_type` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '结算渠道',
    `sub_location` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '税源地',
    `p2p_service_amount` decimal(11,2) DEFAULT '0.00' COMMENT '公对公服务费',
    `pkg_sn` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包编号',
    `mah_settle_dept_id` int DEFAULT NULL COMMENT 'MAH结算-药企deptId',
    `mah_settle_step` char(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'MAH结算-步进状态(BUSINESS-业务, FINANCE-财务)',
    `mah_settle_time` datetime DEFAULT NULL COMMENT 'mah结算时间',
    `ent_task_limit` decimal(5,2) DEFAULT '0.00' COMMENT '企业任务上限(单位%)',
    `drugtable` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '推广药品id',
    `invoice_number` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '发票号码',
    `invoice_file` json DEFAULT NULL COMMENT '发票文件',
    `audit_management_fee_rates` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT '审核管理费比例',
    `end_time` date DEFAULT NULL COMMENT '截止日期',
    `area` json DEFAULT NULL COMMENT '推广区域',
    PRIMARY KEY (`id`),
    KEY `代理商` (`agent_type_id`),
    KEY `代理商类型` (`drug_ent_id`),
    KEY `众包` (`zb_id`),
    KEY `一级代理商1` (`level1_id`),
    KEY `二级代理商2` (`level2_id`),
    KEY `wm_score_package_accept_sug_index` (`accept_sug`),
    KEY `wm_score_package_relation_score_id_index` (`relation_score_id`),
    KEY `wm_score_package_mah_settle_dept_id_index` (`mah_settle_dept_id`)
) ENGINE=InnoDB AUTO_INCREMENT=44417 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='积分包';

CREATE TABLE `sys_dept` (
    `dept_id` int NOT NULL AUTO_INCREMENT,
    `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `sort` int NOT NULL DEFAULT '0' COMMENT '排序',
    `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
    `parent_id` int DEFAULT NULL,
    `tenant_id` int DEFAULT NULL,
    `dept_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `level` int DEFAULT NULL COMMENT '级别',
    `level1_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '药企名称',
    `level1_id` int DEFAULT NULL COMMENT '药企ID',
    `level2_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '一级代理商名称',
    `level2_id` int DEFAULT NULL COMMENT '一级代理商ID',
    `level3_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '二级代理商名称',
    `level3_id` int DEFAULT NULL COMMENT '二级代理商ID',
    `app_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `app_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `rsa_public_key` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `query_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `subject_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '结算主体',
    `subject_type` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `tax_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '税号',
    `dept_permissions` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '部门专用权限限制（字符串逗号分隔:0.导出）',
    `gmv1_rate` int DEFAULT NULL COMMENT 'gmv1收益率（万分之）',
    `gmv2_rate` int DEFAULT NULL COMMENT 'gmv2收益率（万分之）',
    `renlijia_service_charge_rate` int DEFAULT NULL COMMENT '人力家服务费（万分之）',
    `issue_date` date DEFAULT NULL COMMENT '服务起始时间',
    `expiry_date` date DEFAULT NULL COMMENT '服务截止时间',
    `financial_review_type` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '财务复核方式',
    `emails` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '邮箱(多个逗号分隔)',
    PRIMARY KEY (`dept_id`),
    UNIQUE KEY `sys_dept_dept_code_uindex` (`dept_code`)
) ENGINE=InnoDB AUTO_INCREMENT=1611890704 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='部门管理';

CREATE TABLE `sys_dept_relation` (
     `ancestor` int NOT NULL COMMENT '祖先节点',
     `descendant` int NOT NULL COMMENT '后代节点',
     KEY `idx2` (`descendant`),
     KEY `idx1` (`ancestor`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='部门关系表';

CREATE TABLE `sys_user` (
    `user_id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `salt` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `avatar` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `dept_id` int DEFAULT NULL COMMENT '部门ID',
    `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `lock_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
    `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
    `wx_openid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '微信登录openId',
    `mini_openid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '小程序openId',
    `qq_openid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'QQ openId',
    `gitee_login` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '码云 标识',
    `osc_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '开源中国 标识',
    `tenant_id` int NOT NULL DEFAULT '0' COMMENT '所属租户',
    `realname` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户姓名',
    `province` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '省',
    `city` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '市',
    `area` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '区',
    `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '地址',
    `temp1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备用字段1',
    `temp2` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备用字段2',
    `temp3` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备用字段3',
    `temp4` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备用字段4',
    `temp5` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备用字段5',
    `plat_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '平台ID',
    `drug_ent_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '药企ID',
    `w1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `id_card_number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '身份证',
    `user_sign` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '签名',
    `cert_status` int DEFAULT NULL COMMENT '认证状态',
    `cert_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '认证结果描述',
    `province_code` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '省份编码',
    `city_code` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '城市编码',
    `user_type` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '认证方式0-人力家 1-税邦云',
    `bank_card_number` varchar(19) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '银行卡号',
    `rlj_cert_status` int DEFAULT NULL COMMENT '人力家认证状态',
    `tax_helper_agreement_signature` int DEFAULT '0' COMMENT '税邦云协议签署记录 0 未签署 1 已签署',
    `bank_phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '银行预留手机号',
    `bank_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '开户行',
    `sign_agreement` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '小程序签署协议信息',
    `age_reminder` tinyint DEFAULT '1' COMMENT '年龄超60周岁提醒',
    `re_signed_agreement` int DEFAULT '1' COMMENT '是否已补签协议',
    `gender` char(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '性别，1男，2女',
    `degree` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '学历',
    `qualification_record_number` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '医药代表资质备案号',
    `qualifications_url` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '资质证书url',
    `latest_change_pwd_time` datetime DEFAULT NULL COMMENT '上次修改密码时间',
    PRIMARY KEY (`user_id`),
    KEY `user_idx1_username` (`username`),
    KEY `user_qq_openid` (`qq_openid`),
    KEY `user_wx_openid` (`wx_openid`)
) ENGINE=InnoDB AUTO_INCREMENT=11189 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='用户表';

CREATE TABLE `wm_score_package_settle_note` (
    `id` int NOT NULL AUTO_INCREMENT COMMENT '积分包结算记录主键id',
    `package_status_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '积分包结算状态主键id',
    `package_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '积分包id',
    `settle_amount` decimal(10,2) DEFAULT NULL COMMENT '结算金额',
    `user_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '结算用户id',
    `invoice_type` int DEFAULT NULL COMMENT '发票类型',
    `settle_no` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '结算单号',
    `discount` decimal(10,2) DEFAULT NULL COMMENT '折扣',
    `settle_note_status` int DEFAULT '0' COMMENT '结算记录状态',
    `remark` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci COMMENT '标记',
    `notify_time` datetime DEFAULT NULL COMMENT '通知时间',
    `task_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '任务ID',
    `category_name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '开票类型名称',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `sub_time` datetime DEFAULT NULL COMMENT '提交时间',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `stream_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '税邦云流水号',
    `id_card_number` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '身份证号',
    `sub_to_gig_time` datetime DEFAULT NULL COMMENT '提交到零工平台时间',
    `sub_type` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '结算类型',
    `subject_location` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '税源地',
    `third_task_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '第三方任务id',
    `finish_task_flag` int DEFAULT '0' COMMENT '是否完成完单操作',
    `actual_amount` decimal(18,2) DEFAULT NULL,
    `settle_dept_id` int DEFAULT NULL COMMENT '实际结算企业id',
    `settle_dept_sub_id` int DEFAULT NULL COMMENT '实际结算企业subId',
    `review_status` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '财务复核状态',
    `review_time` datetime DEFAULT NULL COMMENT '复核时间',
    `review_user` int DEFAULT NULL COMMENT '复核人',
    `use_financial_id` int DEFAULT NULL COMMENT '使用财务配置的主键ID',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=27903 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='积分包计算记录';

CREATE TABLE `wm_score_package_status` (
   `id` int NOT NULL AUTO_INCREMENT,
   `user_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户id',
   `package_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包id',
   `status` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '审核状态：1.审核中，2.审核通过，3.审核不通过',
   `dept_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '组织机构ID',
   `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否删除',
   `enable_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否禁用',
   `tenant_id` int NOT NULL DEFAULT '1' COMMENT '所属租户',
   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
   `create_user` int DEFAULT NULL COMMENT '创建人',
   `update_time` datetime DEFAULT NULL COMMENT '更新时间',
   `update_user` int DEFAULT NULL COMMENT '更新人',
   `user_score` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '个人预计包值',
   `enable_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '终止方式',
   `task_num` int DEFAULT NULL COMMENT '个人包任务个数',
   `task_add_flag` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '1' COMMENT '是否可以新增任务1-可以  0-不可以',
   `quiz_res` json DEFAULT NULL COMMENT '测评结果',
   PRIMARY KEY (`id`),
   KEY `idx_pkg_id` (`package_id` DESC) COMMENT '积分包ID',
   KEY `idx_ctime` (`create_time` DESC) COMMENT '日期索引',
   KEY `idx_df` (`del_flag`),
   KEY `idx_uid` (`user_id` DESC)
) ENGINE=InnoDB AUTO_INCREMENT=55255 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='积分包状态';

CREATE TABLE `wm_da_drug_ent_drugtable` (
    `id` int NOT NULL AUTO_INCREMENT,
    `drugname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '药品名称',
    `drugname_ty` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '通用药品你名称',
    `drug_ent_id` char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '企业ID',
    `is_yb` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '是否医保',
    `dose_id` char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '剂型ID',
    `guige_id` char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格ID',
    `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
    `dept_id` int DEFAULT NULL COMMENT '组织机构ID',
    `del_flag` int NOT NULL DEFAULT '0' COMMENT '是否删除',
    `enable_flag` int NOT NULL DEFAULT '0' COMMENT '是否禁用',
    `tenant_id` int NOT NULL DEFAULT '1' COMMENT '所属租户',
    `create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
    `create_user` int DEFAULT NULL COMMENT '创建人',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `update_user` int DEFAULT NULL COMMENT '更新人',
    `drug_ent_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属药企名称',
    `drug_ent_num` int DEFAULT NULL COMMENT '分配统计',
    `ssxkcyy` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '上市许可持有人',
    `yyfz` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '原验/仿制',
    `dose_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '剂型名称',
    `guige_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格名称',
    `detail` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '详情信息(暂手动维护,用于报告)',
    `relate_lit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '关联问卷',
    PRIMARY KEY (`id`),
    KEY `剂型` (`dose_id`),
    KEY `药企外键` (`drug_ent_id`),
    KEY `规格` (`guige_id`)
) ENGINE=InnoDB AUTO_INCREMENT=494 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='档案-药企药品';

CREATE TABLE `sys_dict_item` (
     `id` int NOT NULL AUTO_INCREMENT COMMENT '编号',
     `dict_id` int NOT NULL,
     `value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
     `label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
     `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
     `description` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
     `sort` int NOT NULL DEFAULT '0' COMMENT '排序（升序）',
     `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
     `remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
     `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
     `tenant_id` int NOT NULL DEFAULT '0' COMMENT '所属租户',
     PRIMARY KEY (`id`),
     KEY `sys_dict_value` (`value`),
     KEY `sys_dict_label` (`label`),
     KEY `sys_dict_del_flag` (`del_flag`)
) ENGINE=InnoDB AUTO_INCREMENT=1122 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='字典项';

CREATE TABLE `wm_da_drug_ent` (
      `id` int NOT NULL AUTO_INCREMENT,
      `entname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '企业名称',
      `entcode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '组织机构代码',
      `temp1` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
      `temp2` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
      `temp3` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
      `temp4` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
      `dept_id` int DEFAULT NULL COMMENT '组织机构ID',
      `del_flag` int NOT NULL DEFAULT '0' COMMENT '是否删除',
      `enable_flag` int NOT NULL DEFAULT '0' COMMENT '是否禁用',
      `tenant_id` int NOT NULL DEFAULT '1' COMMENT '所属租户',
      `create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
      `create_user` int DEFAULT NULL COMMENT '创建人',
      `update_time` datetime DEFAULT NULL COMMENT '更新时间',
      `update_user` int DEFAULT NULL COMMENT '更新人',
      `pgqx` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '派工权限',
      `management` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '管理模式',
      `subject_type` varchar(1024) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '结算主体类型：0->人力家，1->税邦云',
      PRIMARY KEY (`id`),
      UNIQUE KEY `code` (`entcode`)
) ENGINE=InnoDB AUTO_INCREMENT=10089 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='档案-药企';

CREATE TABLE `wm_task` (
   `id` int NOT NULL AUTO_INCREMENT,
   `task_number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务编号',
   `task_rule_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分规则',
   `score` int DEFAULT NULL COMMENT '积分值',
   `score_package_drug_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务提交到的积分包ID',
   `score_package_level1_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务提交到一级经销商的集分宝id',
   `score_package_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分包',
   `task_type_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务类型ID',
   `lookinto_date` datetime DEFAULT NULL COMMENT '调研时间',
   `province` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '省',
   `city` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '市',
   `area` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '区',
   `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '地址',
   `lookinto_type_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '调研类型ID',
   `task_content_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务内容ID',
   `task_status` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务状态',
   `task_user_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务用户ID',
   `task_user_type` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户类型ID',
   `drug_ent_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务药企',
   `dept_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '组织机构ID',
   `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否删除',
   `enable_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否禁用',
   `tenant_id` int NOT NULL DEFAULT '1' COMMENT '所属租户',
   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
   `create_user` int DEFAULT NULL COMMENT '创建人',
   `update_time` datetime DEFAULT NULL COMMENT '更新时间',
   `update_user` int DEFAULT NULL COMMENT '更新人',
   `submit_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '提交状态',
   `share_img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分享图片地址',
   `plat_audit_status` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '平台审核状态',
   `ext_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备用字段',
   `task_info_img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务详情图片',
   `compare_result` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '对比结果',
   `approval_opinion` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '审批意见',
   `approval_info` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '审批说明',
   `real_flag` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否真实',
   `report_one_id` int DEFAULT NULL COMMENT '任务提交到一级cso的报告ID',
   `report_one_approval_status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '任务提交到一级cso的报告审核状态',
   `report_one_approval_opinion` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务提交到一级cso的报告审批意见',
   `report_one_approval_info` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务提交到一级cso的报告审批说明',
   `report_second_id` int DEFAULT NULL COMMENT '任务提交到二级cso的报告ID',
   `report_second_approval_status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '任务提交到二级cso的报告审核状态',
   `report_second_approval_opinion` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务提交到二级cso的报告审批意见',
   `report_second_approval_info` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务提交到二级cso的报告审批说明',
   `report_drug_id` int DEFAULT NULL COMMENT '任务提交到药企的报告ID',
   `report_drug_approval_status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '任务提交到药企的报告审核状态',
   `report_drug_approval_opinion` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务提交到药企的报告审批意见',
   `report_drug_approval_info` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务提交到药企的报告审批说明',
   `task_status_info` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'cso审核审核意见',
   `task_from` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '1' COMMENT '来源',
   `task_settle_status` int DEFAULT NULL COMMENT '任务结算状态',
   `review_task_count` int NOT NULL DEFAULT '0' COMMENT '复审次数记录',
   `dept_review_task_count` int NOT NULL DEFAULT '0' COMMENT '企业复审次数记录',
   `approval_user_id` int DEFAULT NULL COMMENT '审核人userId',
   `approval_time` datetime DEFAULT NULL COMMENT '审核时间',
   `dept_approval_user_id` int DEFAULT NULL COMMENT '企业审核人userId',
   `dept_approval_time` datetime DEFAULT NULL COMMENT '企业审核时间',
   `remote_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '远端ip',
   `ip2region` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '地址',
   `version` int NOT NULL DEFAULT '0' COMMENT '乐观锁',
   PRIMARY KEY (`id`),
   KEY `wm_task_report_one_id_index` (`report_one_id`),
   KEY `wm_task_report_drug_id_index` (`report_drug_id`),
   KEY `wm_task_score_package_id_index` (`score_package_id`),
   KEY `sp_ts_rf_index` (`score_package_id`,`real_flag`,`task_status`),
   KEY `wm_task_report_second_id_index` (`report_second_id`),
   KEY `idx_did` (`dept_id`),
   KEY `idx_ttid` (`task_type_id` DESC),
   KEY `idx_ctime` (`create_time` DESC),
   KEY `idx_tstatus` (`task_status`),
   KEY `idx_uid` (`task_user_id` DESC),
   KEY `idx_tcid` (`task_content_id` DESC),
   KEY `idx_looking_type_id` (`lookinto_type_id` DESC),
   KEY `idx_enable_flag` (`enable_flag`),
   KEY `idx_real_flag` (`real_flag`)
) ENGINE=InnoDB AUTO_INCREMENT=2191137 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='任务表';

CREATE TABLE `wm_task_type` (
    `id` int unsigned NOT NULL AUTO_INCREMENT,
    `task_type_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务类型名称',
    `task_type_level` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任务类型级别',
    `task_score_start` int DEFAULT NULL COMMENT '积分范围开始',
    `task_score_end` int DEFAULT NULL COMMENT '积分范围结束',
    `score` int DEFAULT NULL COMMENT '完成后可获得分',
    `task_ent_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '积分分配代理商',
    `durgent_id` char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '药企ID',
    `level1_id` char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '一级代理商ID',
    `dept_id` int DEFAULT NULL COMMENT '组织机构ID',
    `del_flag` int NOT NULL DEFAULT '0' COMMENT '是否删除',
    `enable_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否禁用',
    `tenant_id` int NOT NULL DEFAULT '1' COMMENT '所属租户',
    `create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
    `create_user` int DEFAULT NULL COMMENT '创建人',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `update_user` int DEFAULT NULL COMMENT '更新人',
    `status` int DEFAULT '0' COMMENT '积分规则状态',
    `base_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '父类ID',
    `real_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `rule_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
    `parent_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '父级ID',
    `task_receiver_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '1' COMMENT '承接对象(1-个人,2-企业)',
    `task_remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '任务备注',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28391 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='任务类型打分表';

CREATE TABLE `wm_da_agent` (
   `id` int NOT NULL AUTO_INCREMENT,
   `gsmc` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '公司名称',
   `yyzz` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '营业执照',
   `sbjnzm` varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '社保缴纳证明',
   `frsfzzm_zm` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '法人身份证证明-正面',
   `frsfzzm_bm` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '法人身份证证明-背面',
   `frsfzzm_sc` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '法人身份证证明-手持',
   `is_examine` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '是否审核',
   `zj_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '证件类型',
   `zj_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '证件号码',
   `ext_drug_ent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '扩展可选药企',
   `dept_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '组织机构ID',
   `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否删除',
   `enable_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否禁用',
   `tenant_id` int NOT NULL DEFAULT '1' COMMENT '所属租户',
   `create_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
   `create_user` int DEFAULT NULL COMMENT '创建人',
   `update_time` datetime DEFAULT NULL COMMENT '更新时间',
   `update_user` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人',
   `drug_ent_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属药企',
   `temp1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
   `temp2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
   `js_account` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '结算账号 ',
   `management` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '管理模式',
   `pgqx` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '派工权限',
   `qylx` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '企业类型',
   `subject_type` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
   `agent_type` char(2) COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商类型',
   `mah_settle_dept_id` int DEFAULT NULL COMMENT 'MAH结算-药企deptId',
   PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30420 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='档案-代理商';

CREATE TABLE `sys_financial_gmv_settle_data` (
     `id` int NOT NULL AUTO_INCREMENT,
     `payment_company` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '客户公司名称',
     `company_type` varchar(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '公司类型',
     `service_rate` decimal(10,4) NOT NULL COMMENT '要易服务费率',
     `is_channel` tinyint(1) NOT NULL COMMENT '渠道标识',
     `channel_commission_rate` decimal(10,4) NOT NULL COMMENT '渠道税率',
     `tax_land_rate` json NOT NULL COMMENT '底价',
     `in_use_tag` tinyint(1) NOT NULL COMMENT '当前使用标识',
     `gmt_operates` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '操作人员',
     `gmt_modified` datetime NOT NULL COMMENT '修改时间',
     PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=291 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='GMV财务数据配置表';

CREATE TABLE `sys_dept_sub` (
    `sub_id` int NOT NULL AUTO_INCREMENT,
    `dept_id` int NOT NULL,
    `subject_type` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '认证方式0-人力家 1-税邦云',
    `subject_channel` int NOT NULL DEFAULT '0' COMMENT '结算通道',
    `subject_location` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '税源地',
    `app_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
    `app_secret` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `rsa_public_key` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `query_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `subject_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '结算主体',
    `limit_amount` decimal(18,2) DEFAULT NULL,
    `enable_flag` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
    `subject_user_type` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '税邦云用户类型id',
    `subject_invoice_category` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '税邦云用户类型对应的发票类目',
    `path_no` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '汇企云批次付款渠道编号',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `service_charge` decimal(4,2) NOT NULL DEFAULT '0.00' COMMENT '费率',
    `cert_enable` tinyint DEFAULT '1' COMMENT '认证是否启用：1：启用，0：停用',
    `settle_enable` tinyint DEFAULT '1' COMMENT '结算是否启用：1：启用，0：停用',
    `eid_enable` tinyint DEFAULT '1' COMMENT 'E证通认证是否启用：1-启用，0-停用',
    PRIMARY KEY (`sub_id`)
) ENGINE=InnoDB AUTO_INCREMENT=331 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='部门结算主体管理';

CREATE TABLE `sys_user_sub` (
    `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `user_id` int NOT NULL COMMENT '用户ID',
    `dept_id` int DEFAULT NULL COMMENT '部门id',
    `gig_type` int NOT NULL COMMENT '零工平台类型（订单支付方式类型:0-人力家 1-税邦云 2-自由职家 3-易联数科）',
    `gig_channel` int DEFAULT '0' COMMENT '渠道',
    `subject_location` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '税源地',
    `callback_status` int DEFAULT '0' COMMENT '回调状态 0 是未发起，1是进行中，2是已回调',
    `cert_status` int NOT NULL DEFAULT '0' COMMENT '认证状态  0 : 未签约; 1 : 已认证; 2 : 已签约',
    `cert_remark` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '认证结果描述',
    `fail_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '认证失败原因',
    `user_type` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '人员类型',
    `bank_card_number` varchar(19) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '银行卡号',
    `bank_phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '银行预留手机号',
    `bank_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '开户行',
    `id_card_front_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '身份证照片-正面',
    `id_card_back_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '身份证照片-反面',
    `cert_video1_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '认证视频1',
    `cert_video2_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '认证视频1',
    `agreement_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '协议',
    `request_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求流水号',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `create_user` int DEFAULT NULL COMMENT '创建人',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `update_user` int DEFAULT NULL COMMENT '更新人',
    `callback_time` datetime DEFAULT NULL COMMENT '回调时间',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15132 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='用户签约认证主体信息表';

CREATE TABLE `sys_user_role` (
     `user_id` int NOT NULL COMMENT '用户ID',
     `role_id` int NOT NULL COMMENT '角色ID',
     PRIMARY KEY (`user_id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='用户角色表';

CREATE TABLE `sys_role` (
    `role_id` int NOT NULL AUTO_INCREMENT,
    `role_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `role_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `role_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `ds_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '2',
    `ds_scope` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `update_time` datetime DEFAULT NULL,
    `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
    `tenant_id` int DEFAULT NULL,
    PRIMARY KEY (`role_id`),
    KEY `role_idx1_role_code` (`role_code`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='系统角色表';

CREATE TABLE `wm_user_plat_quiz_res` (
     `res_id` int NOT NULL AUTO_INCREMENT COMMENT 'Id',
     `user_id` int NOT NULL COMMENT '用户ID',
     `quiz_id` int DEFAULT NULL COMMENT '试卷id',
     `quiz_res` json DEFAULT NULL COMMENT '测试结果',
     `res_expiry` date NOT NULL COMMENT '测评有效期',
     `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     PRIMARY KEY (`res_id`),
     KEY `idx_qid` (`quiz_id`),
     KEY `idx_uid` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC COMMENT='用户测评的评判结果';

CREATE TABLE `sys_impl_plan` (
     `plan_id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
     `plan_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计划名称',
     `plan_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计划类型',
     `plan_state` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '计划类型',
     `disassemble_state` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拆解状态',
     `plan_score` bigint NOT NULL DEFAULT '0' COMMENT '计划值',
     `avail_score` bigint NOT NULL DEFAULT '0' COMMENT '可用值',
     `plan_issue` date NOT NULL COMMENT '签发时间',
     `plan_expiry` date NOT NULL COMMENT '截止日期',
     `parent_id` bigint NOT NULL COMMENT '父ID',
     `consignor_id` bigint NOT NULL COMMENT '委托人ID',
     `consignee_id` bigint NOT NULL COMMENT '受托人ID',
     `sku_id` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品ID',
     `ckt_res` tinyint(1) DEFAULT NULL COMMENT '审核结果',
     `ckt_msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '审核意见',
     `ckt_time` datetime DEFAULT NULL COMMENT '审核时间',
     `ckt_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '审核人用户名',
     `loc_flag` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '锁定标记',
     `del_flag` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '删除标记',
     `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
     `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人',
     `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
     PRIMARY KEY (`plan_id`),
     UNIQUE KEY `uk_name` (`plan_name`,`consignor_id`),
     KEY `sys_impl_plan_parent_id_index` (`parent_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='执行计划';
