|
|
@@ -1996,11 +1996,41 @@ public class HealthReportController {
|
|
|
gf.setPopulationLevel(pf.getPopulationLevel());
|
|
|
gf.setDetectionRate(pf.getDetectionRate());
|
|
|
gf.setDescription(pf.getDescription());
|
|
|
- gf.setCategory(pf.getCategory());
|
|
|
- gf.setLevel(pf.getLevel());
|
|
|
+ // 分类层级表归一化:募极/北京的"菌纲构成/菌目构成..."→ taxonomy + 英文LEVEL,
|
|
|
+ // 否则前端 taxonomy 标签页按 category='taxonomy' + level='CLASS' 过滤匹配不到
|
|
|
+ gf.setCategory(normalizeFloraCategory(pf.getCategory()));
|
|
|
+ gf.setLevel(normalizeFloraLevel(pf.getCategory(), pf.getLevel()));
|
|
|
return gf;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 菌群分类归一化:以"构成"结尾的层级分类(菌门构成/菌纲构成/菌目构成/菌科构成/菌属构成/菌种构成)
|
|
|
+ * 统一映射为 taxonomy,与前端标签页过滤条件对齐。
|
|
|
+ */
|
|
|
+ private String normalizeFloraCategory(String category) {
|
|
|
+ if (category == null) return null;
|
|
|
+ if (category.endsWith("构成")) {
|
|
|
+ return HealthGutFlora.CATEGORY_TAXONOMY; // "taxonomy"
|
|
|
+ }
|
|
|
+ return category;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 菌群层级归一化:中文层级(门/纲/目/科/属/种)→ 英文 LEVEL 常量,
|
|
|
+ * 与前端 levelMap 对齐。非层级数据(如 category=核心菌属 且 level=GENUS)原样保留。
|
|
|
+ */
|
|
|
+ private String normalizeFloraLevel(String category, String level) {
|
|
|
+ if (level == null) return null;
|
|
|
+ String normalized = level;
|
|
|
+ if ("门".equals(level)) normalized = HealthGutFlora.LEVEL_PHYLUM;
|
|
|
+ else if ("纲".equals(level)) normalized = HealthGutFlora.LEVEL_CLASS;
|
|
|
+ else if ("目".equals(level)) normalized = HealthGutFlora.LEVEL_ORDER;
|
|
|
+ else if ("科".equals(level)) normalized = HealthGutFlora.LEVEL_FAMILY;
|
|
|
+ else if ("属".equals(level)) normalized = HealthGutFlora.LEVEL_GENUS;
|
|
|
+ else if ("种".equals(level)) normalized = HealthGutFlora.LEVEL_SPECIES;
|
|
|
+ return normalized;
|
|
|
+ }
|
|
|
+
|
|
|
private List<HealthDiseaseRisk> buildDiseaseRisksFromPayload(ParsedReportPayload.Payload payload) {
|
|
|
List<ParsedReportPayload.DiseaseRisk> list = payload.getDiseaseRisks();
|
|
|
if (list == null || list.isEmpty()) return new ArrayList<>();
|