|
@@ -171,6 +171,9 @@ public class HealthReportController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private ReportCollectService reportCollectService;
|
|
private ReportCollectService reportCollectService;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private com.etotem.cfc.service.AiGateway aiGateway;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 创建健康报告(含指标明细)
|
|
* 创建健康报告(含指标明细)
|
|
|
*/
|
|
*/
|
|
@@ -635,8 +638,14 @@ public class HealthReportController {
|
|
|
@RequestAttribute(value = "familyId", required = false) Long familyId) {
|
|
@RequestAttribute(value = "familyId", required = false) Long familyId) {
|
|
|
|
|
|
|
|
if ("tongue".equals(type)) {
|
|
if ("tongue".equals(type)) {
|
|
|
- if (memberId == null) {
|
|
|
|
|
- return Result.error("memberId is required for tongue diagnosis");
|
|
|
|
|
|
|
+ // 舌诊照片:直接走舌诊流程(AI 视觉分析 + 存舌诊记录),不走 PDF 采集链
|
|
|
|
|
+ try {
|
|
|
|
|
+ Map<String, Object> tongueResult = tongueDiagnosisService.parsePreview(file, memberId);
|
|
|
|
|
+ tongueResult.put("type", "tongue");
|
|
|
|
|
+ return Result.success(tongueResult);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("舌诊解析失败", e);
|
|
|
|
|
+ return Result.error("舌诊解析失败: " + e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -657,6 +666,20 @@ public class HealthReportController {
|
|
|
if (!wechatService.checkImage(fileBytes)) {
|
|
if (!wechatService.checkImage(fileBytes)) {
|
|
|
return Result.error("图片内容包含敏感信息,上传失败");
|
|
return Result.error("图片内容包含敏感信息,上传失败");
|
|
|
}
|
|
}
|
|
|
|
|
+ // auto 模式下的图片先判断是否为舌象照片:是 → 直接走舌诊流程,
|
|
|
|
|
+ // 避免舌诊照片被当作 PDF 报告走采集链导致 EOF 错误
|
|
|
|
|
+ if ("auto".equals(type) || "image".equals(type)) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ boolean isTongue = aiGateway.detectTongue(fileBytes, originalFilename);
|
|
|
|
|
+ if (isTongue) {
|
|
|
|
|
+ Map<String, Object> tongueResult = tongueDiagnosisService.parsePreview(file, memberId);
|
|
|
|
|
+ tongueResult.put("type", "tongue");
|
|
|
|
|
+ return Result.success(tongueResult);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("舌象照片分类失败,按普通图片处理: {}", e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
// PDF 类型校验
|
|
// PDF 类型校验
|
|
|
String lcName = originalFilename != null ? originalFilename.toLowerCase() : "";
|
|
String lcName = originalFilename != null ? originalFilename.toLowerCase() : "";
|