-- ----------------------------
-- prpm_case_task 添加字段
-- ----------------------------
ALTER TABLE `prpm_case_info` ADD COLUMN `policy_hold_name` varchar(100) DEFAULT NULL COMMENT '投保人姓名' AFTER `insured_phone`;

ALTER TABLE `prpm_case_info` ADD COLUMN `security_type` varchar(20) DEFAULT NULL COMMENT '被保险人证件类型' AFTER `policy_hold_name`;

ALTER TABLE `prpm_case_info` ADD COLUMN `security_no` varchar(100) DEFAULT NULL COMMENT '被保险人证件号码' AFTER `security_type`;

ALTER TABLE `prpm_case_info` ADD COLUMN `insured_addr` varchar(255) DEFAULT NULL COMMENT '被保险人地址' AFTER `security_no`;



-- ----------------------------
-- prpm_docs_info 电子单证信息表
-- ----------------------------

DROP TABLE IF EXISTS `prpm_docs_info`;
CREATE TABLE `prpm_docs_info`  (
  `docs_info_id` bigint NOT NULL AUTO_INCREMENT COMMENT '电子单证id',
  `regist_no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报案号',
  `loss_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '损失项ID',
  `loss_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务序号',
  `link_uuid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '链接UUID',
  `doc_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单证状态(00:未提交，01:已提交)',
  `policy_no` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '保单号',
  `doc_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单证类型',
  `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号',
  `doc_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '单证数据',
  `render_time` datetime NULL DEFAULT NULL COMMENT '提交时间',
  `doc_source` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单证来源 00-Web端 01-App端',
  `doc_num` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单证数量',
  `license_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '车牌号',
  `vehicle_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '车辆类型',
  `handler_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作人工号',
  `handler_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作人名称',
  `handler_org_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作人机构代码',
  `handler_org_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作人机构名称',
  `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`docs_info_id`) USING BTREE,
  INDEX `IDX_CASE_NO`(`regist_no` ASC) USING BTREE,
  INDEX `IDX_DOC_RENDER_TIME`(`render_time` ASC) USING BTREE,
  INDEX `IDX_DOC_CREATE_TIME`(`create_time` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '电子单证信息表' ROW_FORMAT = DYNAMIC;


-- ----------------------------
-- prpm_app_version APP版本控制表
-- ----------------------------
CREATE TABLE `prpm_app_version` (
  `app_version_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'APP版本控制表主键',
  `version_id` varchar(30) DEFAULT NULL COMMENT '终端版本号',
  `file_name` varchar(100) DEFAULT NULL COMMENT '更新包文件名称',
  `download_url` varchar(255) DEFAULT NULL COMMENT '更新包下载URL',
  `version_content` varchar(255) DEFAULT NULL COMMENT '版本更新内容',
  `effect_date` datetime DEFAULT NULL COMMENT '生效时间',
  `app_type` tinyint(1) DEFAULT NULL COMMENT '终端类型：1-Android，2-IOS',
  `system_code` tinyint(1) DEFAULT NULL COMMENT '系统类型：1-A（修理厂）;2-B（查勘端）；3-C（自助端）',
  `update_mode` tinyint(1) DEFAULT NULL COMMENT '更新模式：1-强制更新;2-选择更新;3-无需更新',
  `notice_type` tinyint(4) DEFAULT NULL COMMENT '通知类型：0-不通知；1-全部通知用户；2-通知Android用户；3-通知iOS用户',
  `is_enable` tinyint(1) DEFAULT NULL COMMENT '是否有效：0-No；1-Yes',
  `version_upload_status` tinyint(1) DEFAULT NULL COMMENT '文件上传状态：1-上传中;2-上传成功;3-上传失败;',
  `create_by` varchar(64) DEFAULT NULL COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) DEFAULT NULL COMMENT '修改者',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`app_version_id`) USING BTREE,
  KEY `IDX_APPVER_VERID` (`version_id`,`system_code`) USING BTREE,
  KEY `IDX_TYPE_SYSTEM_UPLOADSTATUS_ENABLE` (`app_type`,`system_code`,`is_enable`,`version_upload_status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='APP版本控制表';