xuhy
2026-01-07 f9926c8598425eb1c3747b63f9daae54588dbaf1
海诊通AI对接,H5报告推送存储
3个文件已修改
86 ■■■■■ 已修改文件
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/H5AICallbackController.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TSysInspection.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/H5AICallbackController.java
@@ -132,31 +132,67 @@
    @PostMapping("/xiMaReportPush")
    public String xiMaReportPush(JSONObject jsonObject) throws Exception {
    public JSONObject xiMaReportPush(JSONObject json) throws Exception {
        TSysAiConfig sysAiConfig = sysAiConfigService.getById(1);
        // 应用AES秘钥
        String clientKey = sysAiConfig.getClientKey();
        // 平台RSA公钥
        String clientIV = sysAiConfig.getClientIV();
        String data = jsonObject.getString("data");
        String data = json.getString("data");
        // 解密
        String raw = AesUtil.decrypt(clientKey, clientIV , data);
        log.info("H5舌面报告推送,解密后:{}",raw);
        return "success";
        JSONObject jsonObject = JSONObject.parseObject(raw);
        // 报告信息
        String reportTime = jsonObject.getString("reportTime"); // 报告时间
        String reportH5Url = jsonObject.getString("reportH5Url"); // 报告H5地址URL
        TSysInspection sysInspection = new TSysInspection();
        sysInspection.setCheckTime(reportTime);
        sysInspection.setReportPrintUrl(reportH5Url);
        // 用户信息
        JSONObject userInfo = jsonObject.getJSONObject("userInfo");
        String outUserId = userInfo.getString("outUserId"); // 用户唯一标识
        String birthday = userInfo.getString("birthday"); // 生日
        String gender = userInfo.getString("gender"); // 用户性别:0男1女
        String nickname = userInfo.getString("nickname"); // 用户姓名
        // 查询用户
        TSysAppUser sysAppUser = sysAppUserService.getOne(Wrappers.lambdaQuery(TSysAppUser.class)
                .eq(TSysAppUser::getIdentifierNumber, outUserId)
                .last("LIMIT 1"));
        sysInspection.setAppUserId(sysAppUser.getId());
        sysInspection.setOutUserId(outUserId);
        sysInspection.setBirthday(birthday);
        sysInspection.setSex("0".equals(gender)?1:2);
        sysInspection.setNickName(nickname);
        // 小程序检测
        sysInspection.setInspectionType(2);
        // TODO 舌诊信息
        sysInspectionService.save(sysInspection);
        JSONObject response = new JSONObject();
        response.put("error_code",0);
        return response;
    }
    @PostMapping("/xiMaDoubleScreenReportPush")
    public JSONObject xiMaDoubleScreenReportPush(JSONObject jsonObject) throws Exception {
        log.info("双屏仪报告推送:{}",jsonObject);
        // 主体信息
        String reportTime = jsonObject.getString("report_time");
        String report_print_url = jsonObject.getString("report_print_url");
        String present_history = jsonObject.getString("present_history");
        String tcm_syndrome = jsonObject.getString("tcm_syndrome");
        String disease_history_memo = jsonObject.getString("disease_history_memo");
        String western_medicine_diagnosis = jsonObject.getString("western_medicine_diagnosis");
        String reportTime = jsonObject.getString("report_time"); // 报告时间
        String report_print_url = jsonObject.getString("report_print_url"); // 报告H5页面地址
        String present_history = jsonObject.getString("present_history"); // 患者现病史
        String tcm_syndrome = jsonObject.getString("tcm_syndrome"); // 中医证型
        String disease_history_memo = jsonObject.getString("disease_history_memo"); // 历史疾病补充
        String western_medicine_diagnosis = jsonObject.getString("western_medicine_diagnosis"); // 西医诊断
        TSysInspection sysInspection = new TSysInspection();
        sysInspection.setCheckTime(reportTime);
@@ -168,12 +204,12 @@
        // 用户信息
        JSONObject userInfo = jsonObject.getJSONObject("user_info");
        Long id = userInfo.getLong("id");
        String phone = userInfo.getString("phone");
        String user_name = userInfo.getString("user_name");
        Long device_account_id = userInfo.getLong("device_account_id");
        String sex = userInfo.getString("sex");
        String age = userInfo.getString("age");
        Long id = userInfo.getLong("id"); // 用户ID
        String phone = userInfo.getString("phone"); // 手机号
        String user_name = userInfo.getString("user_name"); // 用户姓名
        Long device_account_id = userInfo.getLong("device_account_id"); // 设备账号ID
        String sex = userInfo.getString("sex"); // 性别
        String age = userInfo.getString("age"); // 年龄
        sysInspection.setThreeUserId(id);
        sysInspection.setPhone(phone);
@@ -181,6 +217,7 @@
        sysInspection.setSex("男".equals(sex) ? 1 : 2);
        sysInspection.setAge(Integer.parseInt(age));
        sysInspection.setDeviceAccountId(device_account_id);
        // 硬件检测
        sysInspection.setInspectionType(3);
        // 通过手机号查询小程序用户
@@ -202,10 +239,10 @@
            JSONObject json = riskEstimate.getJSONObject(i);
            TSysInspectionRiskEstimate sysInspectionRiskEstimate = new TSysInspectionRiskEstimate();
            sysInspectionRiskEstimate.setInspectionId(sysInspection.getId());
            String name = json.getString("name");
            String link_url = json.getString("link_url");
            String value = json.getString("value");
            String value_desc = json.getString("value_desc");
            String name = json.getString("name"); // 疾病名称
            String link_url = json.getString("link_url"); // 疾病H5链接
            String value = json.getString("value"); // 风险值
            String value_desc = json.getString("value_desc"); // 风险值描述
            sysInspectionRiskEstimate.setRiskName(name);
            sysInspectionRiskEstimate.setRiskLinkUrl(link_url);
            sysInspectionRiskEstimate.setRiskValue(value);
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -119,7 +119,8 @@
                        "/operations/getBySingleNum/**",
                        "/user/getUserInfoByNumber/**",
                        "/wxLogin/**","/t-contract/import-template","/t-contract/importContracts",
                        "/aiCallback/reportReturn","/t-sys-activity/list","/t-sys-activity/pageList","/t-sys-activity/getDetailById",
                        "/aiCallback/reportReturn","/aiCallback/xiMaReportPush","/aiCallback/xiMaDoubleScreenReportPush",
                        "/t-sys-activity/list","/t-sys-activity/pageList","/t-sys-activity/getDetailById",
                        "/t-sys-banner/pageList","/t-sys-banner/list","/t-sys-product-introduction/pageList",
                        "/t-sys-product-introduction/list","/t-sys-product-introduction/getDetailById","/t-sys-config/getDetailById",
                        "/t-sys-educational-info/list","/t-sys-educational-info/getDetailById","/t-sys-educational-info/pageList",
ruoyi-system/src/main/java/com/ruoyi/system/model/TSysInspection.java
@@ -115,6 +115,14 @@
    @TableField("tongue_result_id")
    private Integer tongueResultId;
    @ApiModelProperty(value = "用户唯一标识")
    @TableField("out_user_id")
    private String outUserId;
    @ApiModelProperty(value = "生日")
    @TableField("birthday")
    private String birthday;
    @ApiModelProperty(value = "诊所名称")
    @TableField(exist = false)
    private String clinicName;