Selaa lähdekoodia

HL-03: QA复验3项修复(R3全跳过死循环占位标记+血脂阈值按项目细分+对话页跳过此题按钮)

Agnes Agent 1 viikko sitten
vanhempi
sitoutus
6dd08a5862

+ 25 - 3
cfc-backend/src/main/java/com/etotem/cfc/service/impl/HealthPlanServiceImpl.java

@@ -462,10 +462,17 @@ public class HealthPlanServiceImpl implements HealthPlanService {
         String enhancedGoal = goal;
         if (followUpAnswers != null && !followUpAnswers.isEmpty()) {
             StringBuilder sb = new StringBuilder(goal == null ? "" : goal);
-            sb.append("\n\n【补充信息】");
+            boolean headerAppended = false;
             for (Map.Entry<String, Object> e : followUpAnswers.entrySet()) {
+                // QA 修复(HL-03):全部跳过时前端用 __dismissed__ 占位标记保证携带,
+                // 此处跳过标记键,不把占位拼入 goal
+                if ("__dismissed__".equals(e.getKey())) continue;
                 String v = e.getValue() == null ? "" : String.valueOf(e.getValue());
                 if (v.trim().isEmpty()) continue;
+                if (!headerAppended) {
+                    sb.append("\n\n【补充信息】");
+                    headerAppended = true;
+                }
                 sb.append("\n").append(demapQuestionId(e.getKey())).append(":").append(v.trim());
             }
             enhancedGoal = sb.toString();
@@ -546,8 +553,23 @@ public class HealthPlanServiceImpl implements HealthPlanService {
             if (value != null && !String.valueOf(value).trim().isEmpty()) {
                 try {
                     double v = Double.parseDouble(String.valueOf(value));
-                    String norm = name.contains("总胆固醇") || name.contains("TC") ? "5.2" : "1.7";
-                    double threshold = Double.parseDouble(norm);
+                    // QA 修复(HL-03):按血脂项目细分阈值——总胆固醇/TC 5.2、LDL/低密度 3.4、
+                    // 甘油三酯及其他 1.7;HDL 高好低坏不判高(>2.2 仅软提示偏高区间,不进 problems)
+                    String upper = name.toUpperCase();
+                    if (upper.contains("HDL") || name.contains("高密度")) {
+                        if (v > 2.2) {
+                            riskNotes.add(name + "数值处于偏高区间(" + v + "):高密度脂蛋白偏高通常无需干预,个别情况建议就医复查确认");
+                        }
+                        continue;
+                    }
+                    double threshold;
+                    if (name.contains("总胆固醇") || upper.contains("TC")) {
+                        threshold = 5.2;
+                    } else if (upper.contains("LDL") || name.contains("低密度")) {
+                        threshold = 3.4;
+                    } else {
+                        threshold = 1.7;
+                    }
                     if (v > threshold) {
                         problems.add(name + "偏高(" + v + "):需要关注血脂水平,建议结合饮食调整并就医复查");
                     }

+ 6 - 0
cfc-frontend/pages/health/health-plan-summary.vue

@@ -196,6 +196,7 @@
 
       <view class="btn-pair">
         <button v-if="followUpIdx > 0" class="btn-skip" :disabled="loading" @click="prevFollowUp">上一题</button>
+        <button class="btn-skip" :disabled="loading" @click="skipFollowUp">跳过此题</button>
         <button class="btn-confirm" :disabled="loading" @click="nextFollowUp">{{ followUpIdx + 1 >= followUpQuestions.length ? '提交并生成方案' : '下一题' }}</button>
       </view>
       <view class="back-link" @click="backToQuestionnaire">← 返回修改问卷</view>
@@ -1145,6 +1146,11 @@ selectedMembers: function() {
         var v = self.followUpAnswerMap[q.questionId]
         if (v && String(v).trim()) map[q.questionId] = String(v).trim()
       })
+      // QA 修复(HL-03):全部跳过/全部留空时 map 为空 → 置带标记的非空对象,
+      // 保证 generatePlan 携带 followUpAnswers → 后端 hasAnswers=true → 不再触发 detect 死循环
+      if (Object.keys(map).length === 0) {
+        map = { __dismissed__: true }
+      }
       self.followUpAnswers = map
       self.followUpActive = false
       self.generatePlan()