|
|
@@ -400,6 +400,29 @@ public class EnergyService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private int calcSevenDimBodyScoreFromScores(List<HealthDimensionScore> scores) {
|
|
|
+ if (scores == null || scores.isEmpty()) return 0;
|
|
|
+ java.util.Map<String, Double> weights = new java.util.HashMap<>();
|
|
|
+ weights.put("gut", 0.20);
|
|
|
+ weights.put("nutrition", 0.18);
|
|
|
+ weights.put("exercise", 0.15);
|
|
|
+ weights.put("sleep", 0.15);
|
|
|
+ weights.put("growth", 0.12);
|
|
|
+ weights.put("immunity", 0.10);
|
|
|
+ weights.put("vision", 0.10);
|
|
|
+ double weightedSum = 0;
|
|
|
+ double totalWeight = 0;
|
|
|
+ for (HealthDimensionScore s : scores) {
|
|
|
+ Double w = weights.get(s.getDimension());
|
|
|
+ if (w != null && s.getScore() != null) {
|
|
|
+ weightedSum += s.getScore() * w;
|
|
|
+ totalWeight += w;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (totalWeight == 0) return 0;
|
|
|
+ return (int) Math.round(weightedSum / totalWeight);
|
|
|
+ }
|
|
|
+
|
|
|
/** 孩子 心 — DAN EMI 70% + 先天 30% + 行为修正 */
|
|
|
private int calcChildMind(FamilyMember child) {
|
|
|
Long childId = child.getId();
|