|
|
@@ -7,6 +7,8 @@ import com.etotem.cfc.entity.*;
|
|
|
import com.etotem.cfc.mapper.DanReportUploadMapper;
|
|
|
import com.etotem.cfc.mapper.FamilyMemberMapper;
|
|
|
import com.etotem.cfc.mapper.ReportTypeRegistryMapper;
|
|
|
+import com.etotem.cfc.mapper.ReportUnknownClusterMapper;
|
|
|
+import com.etotem.cfc.mapper.ReportUnknownUploadMapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
@@ -85,6 +87,14 @@ public class ReportCollectService {
|
|
|
@Resource
|
|
|
private DanReportUploadService danReportUploadService;
|
|
|
|
|
|
+ /** 未知聚类(S-cfc-363 / RED-2):解析失败/未知格式报告进入「未知聚类」人工标注池 */
|
|
|
+ @Resource
|
|
|
+ private ReportUnknownClusterMapper unknownClusterMapper;
|
|
|
+
|
|
|
+ /** 未知上传记录(S-cfc-363 / RED-2):未知聚类链路的上传记录 */
|
|
|
+ @Resource
|
|
|
+ private ReportUnknownUploadMapper unknownUploadMapper;
|
|
|
+
|
|
|
@Resource(name = "taskExecutor")
|
|
|
private Executor taskExecutor;
|
|
|
|
|
|
@@ -421,6 +431,30 @@ public class ReportCollectService {
|
|
|
&& (payload.getGutFlora() == null || payload.getGutFlora().isEmpty())) {
|
|
|
throw new IllegalArgumentException("解析结果中未提取到有效指标数据");
|
|
|
}
|
|
|
+ validateSummaryScores(payload.getSummary());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 防异常值入库(S-cfc-363 / RED-3,TC-P-22-E):健康评分类字段出现负数视为解析错误,
|
|
|
+ * 拒绝入库并提示「数据异常,暂不入库」。校验 9 个评分类字段
|
|
|
+ * (overall/gutHealth/chronicDisease/nutrition/balance/diversity/beneficial/harmful/coreGenus)。
|
|
|
+ */
|
|
|
+ private void validateSummaryScores(ParsedReportPayload.Summary summary) {
|
|
|
+ if (summary == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Integer[] scores = {
|
|
|
+ summary.getOverallScore(), summary.getGutHealthScore(),
|
|
|
+ summary.getChronicDiseaseScore(), summary.getNutritionScore(),
|
|
|
+ summary.getBalanceScore(), summary.getDiversityScore(),
|
|
|
+ summary.getBeneficialScore(), summary.getHarmfulScore(),
|
|
|
+ summary.getCoreGenusScore()
|
|
|
+ };
|
|
|
+ for (Integer score : scores) {
|
|
|
+ if (score != null && score < 0) {
|
|
|
+ throw new IllegalArgumentException("数据异常,暂不入库:健康评分存在负数(" + score + ")");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private String resolvePdfPath(HealthReportDraft draft) {
|