Просмотр исходного кода

feat(health): 菌群报告详情页重构 - 去掉疾病风险手风琴和病原菌入口,修复报告日期显示,新增报告总结描述

E2E Test Bot 1 неделя назад
Родитель
Сommit
1931021d99
1 измененных файлов с 59 добавлено и 52 удалено
  1. 59 52
      cfc-frontend/pages/health/gut-flora-detail.vue

+ 59 - 52
cfc-frontend/pages/health/gut-flora-detail.vue

@@ -25,6 +25,11 @@
         <view class="interpretation-box" v-if="reportInterpretation && reportInterpretation.gutAgeAssessment">
         <view class="interpretation-box" v-if="reportInterpretation && reportInterpretation.gutAgeAssessment">
           <text class="interp-text">{{ reportInterpretation.gutAgeAssessment }}</text>
           <text class="interp-text">{{ reportInterpretation.gutAgeAssessment }}</text>
         </view>
         </view>
+        <!-- 报告总结描述 -->
+        <view class="summary-box" v-if="reportSummaryText">
+          <text class="summary-title">报告总结</text>
+          <text class="summary-text">{{ reportSummaryText }}</text>
+        </view>
       </view>
       </view>
 
 
       <!-- 评分圆环(折行显示,无横向滚动) -->
       <!-- 评分圆环(折行显示,无横向滚动) -->
@@ -44,11 +49,6 @@
           <text class="nav-label">菌群详情</text>
           <text class="nav-label">菌群详情</text>
           <text class="nav-count">{{ floraAbnormalCount }}/{{ floraCount }}种</text>
           <text class="nav-count">{{ floraAbnormalCount }}/{{ floraCount }}种</text>
         </view>
         </view>
-        <view class="nav-card" @tap="goToPathogen">
-          <text class="nav-icon">🔬</text>
-          <text class="nav-label">病原菌</text>
-          <text class="nav-count">{{ pathogenCount }}项</text>
-        </view>
         <view class="nav-card" @tap="goToRisks">
         <view class="nav-card" @tap="goToRisks">
           <text class="nav-icon">⚠️</text>
           <text class="nav-icon">⚠️</text>
           <text class="nav-label">疾病风险</text>
           <text class="nav-label">疾病风险</text>
@@ -213,26 +213,6 @@
         </view>
         </view>
       </view>
       </view>
 
 
-      <!-- 疾病风险内联展示(颜色区分) -->
-      <view class="accordion-section" v-if="diseaseRisks.length > 0">
-        <view class="accordion-header" @tap="toggleAccordion('risks')">
-          <text class="accordion-title">疾病风险</text>
-          <text class="accordion-stats" v-if="diseaseRisksAbnormal > 0">需关注 <text class="abnormal-num">{{ diseaseRisksAbnormal }}</text> 项</text>
-          <text class="accordion-arrow">{{ accordionOpen.risks ? '收起' : '展开' }}</text>
-        </view>
-        <view class="accordion-body" v-if="accordionOpen.risks">
-          <view class="risk-card-inline" v-for="(risk, ri) in diseaseRisks" :key="ri"
-                :class="'risk-level-' + (risk._cssClass || 'low')">
-            <text class="risk-name-inline">{{ risk.diseaseName }}</text>
-            <text class="risk-badge-inline" :class="'badge-' + (risk._cssClass || 'low')">
-              {{ risk.riskLevel || '--' }}
-            </text>
-            <text class="risk-value-inline" v-if="risk.riskValue">风险值 {{ risk.riskValue }}</text>
-          </view>
-          <view class="empty-hint" v-if="diseaseRisks.length === 0">暂无疾病风险数据</view>
-        </view>
-      </view>
-
       <view class="feedback-section" @tap="openFeedback">
       <view class="feedback-section" @tap="openFeedback">
         <text class="feedback-icon">💬</text>
         <text class="feedback-icon">💬</text>
         <text class="feedback-text">对这个报告有疑问或建议?告诉我们</text>
         <text class="feedback-text">对这个报告有疑问或建议?告诉我们</text>
@@ -385,7 +365,6 @@ export default {
       foodCount: 0,
       foodCount: 0,
       cautionCount: 0,
       cautionCount: 0,
       indicatorCount: 0,
       indicatorCount: 0,
-      pathogenCount: 0,
       knowledgeVisible: false,
       knowledgeVisible: false,
       knowledgeData: {},
       knowledgeData: {},
       feedbackVisible: false,
       feedbackVisible: false,
@@ -449,6 +428,31 @@ export default {
       }
       }
       return count
       return count
     },
     },
+    /** 报告日期格式化 — 计算属性避免模板中方法引用失效 */
+    reportDateText: function() {
+      var d = this.report.reportDate
+      if (!d) return ''
+      var date = parseDate(d)
+      if (!date) return String(d).substring(0, 10)
+      var y = date.getFullYear()
+      var m = ('' + (date.getMonth() + 1)).padStart(2, '0')
+      var day = ('' + date.getDate()).padStart(2, '0')
+      return y + '-' + m + '-' + day
+    },
+    /** 报告总结描述 */
+    reportSummaryText: function() {
+      var parts = []
+      if (this.report.healthRating) parts.push('综合评级: ' + this.report.healthRating)
+      if (this.reportInterpretation && this.reportInterpretation.gutAgeAssessment)
+        parts.push(this.reportInterpretation.gutAgeAssessment)
+      if (this.analysisData && this.analysisData.dietaryPattern && this.analysisData.dietaryPattern.detail)
+        parts.push(this.analysisData.dietaryPattern.detail)
+      var funcAnalysis = this.analysisData && this.analysisData.functionalAnalysis || []
+      var abnDims = funcAnalysis.filter(function(d) { return d.status && d.status !== '良好' })
+      if (abnDims.length > 0)
+        parts.push('需关注维度:' + abnDims.map(function(d) { return d.name }).join('、'))
+      return parts.join(';')
+    },
     draftMemberText: function() {
     draftMemberText: function() {
       if (this.selectedMemberObj) return this.selectedMemberObj.nickname || this.selectedMemberObj.name || '已选择'
       if (this.selectedMemberObj) return this.selectedMemberObj.nickname || this.selectedMemberObj.name || '已选择'
       if (this.extractedName) return this.extractedName + '(待绑定)'
       if (this.extractedName) return this.extractedName + '(待绑定)'
@@ -467,17 +471,6 @@ export default {
   },
   },
   methods: {
   methods: {
     goBack: function() { uni.navigateBack() },
     goBack: function() { uni.navigateBack() },
-    /** 报告日期仅显示 yyyy-MM-dd(去掉时间部分) */
-    reportDateText: function() {
-      var d = this.report.reportDate
-      if (!d) return ''
-      var date = parseDate(d)
-      if (!date) return String(d).substring(0, 10)
-      var y = date.getFullYear()
-      var m = ('' + (date.getMonth() + 1)).padStart(2, '0')
-      var day = ('' + date.getDate()).padStart(2, '0')
-      return y + '-' + m + '-' + day
-    },
     /** 状态 → CSS安全英文(兼容中英文,与 report-confirm 保持一致) */
     /** 状态 → CSS安全英文(兼容中英文,与 report-confirm 保持一致) */
     _cssForStatus: function(s) {
     _cssForStatus: function(s) {
       var k = String(s || '').trim()
       var k = String(s || '').trim()
@@ -606,11 +599,6 @@ export default {
             }).catch(function() {})
             }).catch(function() {})
           }
           }
           self.indicatorCount = (res.data.indicators || []).length
           self.indicatorCount = (res.data.indicators || []).length
-          // 计算病原菌总数
-          var flora = res.data.gutFlora || []
-          self.pathogenCount = flora.filter(function(i) {
-            return i.category === 'pathogen_genus' || i.category === 'pathogen_detection'
-          }).length
         }
         }
       })
       })
       // 加载菌群功能分析
       // 加载菌群功能分析
@@ -662,7 +650,7 @@ export default {
         uni.showToast({ title: '加载异常', icon: 'none' })
         uni.showToast({ title: '加载异常', icon: 'none' })
       })
       })
     },
     },
-    applyDraftPayload: function(payload) {
+applyDraftPayload: function(payload) {
       // 将 draft payload 映射到模板所需的数据结构(report/scoreItems/indicators)
       // 将 draft payload 映射到模板所需的数据结构(report/scoreItems/indicators)
       var report = {}
       var report = {}
       if (payload.summary) {
       if (payload.summary) {
@@ -670,9 +658,10 @@ export default {
         report.personName = s.personName || ''
         report.personName = s.personName || ''
         report.reportNumber = s.reportNumber || ''
         report.reportNumber = s.reportNumber || ''
         report.gutAge = s.gutAge || ''
         report.gutAge = s.gutAge || ''
-report.gutType = s.gutType || ''
-      report.shannonIndex = s.shannonIndex || ''
-      report.overallScore = s.overallScore
+        report.gutType = s.gutType || ''
+        report.shannonIndex = s.shannonIndex || ''
+        report.reportDate = s.reportDate || ''
+        report.overallScore = s.overallScore
         report.gutHealthScore = s.gutHealthScore
         report.gutHealthScore = s.gutHealthScore
         report.chronicDiseaseScore = s.chronicDiseaseScore
         report.chronicDiseaseScore = s.chronicDiseaseScore
         report.nutritionScore = s.nutritionScore
         report.nutritionScore = s.nutritionScore
@@ -961,12 +950,6 @@ report.gutType = s.gutType || ''
     goToSpecies: function() {
     goToSpecies: function() {
       uni.navigateTo({ url: '/pages/health/gut-flora-species-detail?reportId=' + this.reportId })
       uni.navigateTo({ url: '/pages/health/gut-flora-species-detail?reportId=' + this.reportId })
     },
     },
-    goToPathogen: function() {
-      uni.navigateTo({ url: '/pages/health/gut-flora-species-detail?reportId=' + this.reportId + '&tab=pathogen_genus' })
-    },
-    goToTaxonomy: function() {
-      uni.navigateTo({ url: '/pages/health/gut-flora-species-detail?reportId=' + this.reportId + '&tab=taxonomy_class' })
-    },
     goToRisks: function() {
     goToRisks: function() {
       uni.navigateTo({ url: '/pages/health/gut-flora-risks-detail?reportId=' + this.reportId })
       uni.navigateTo({ url: '/pages/health/gut-flora-risks-detail?reportId=' + this.reportId })
     },
     },
@@ -1138,6 +1121,30 @@ report.gutType = s.gutType || ''
   line-height: 1.6;
   line-height: 1.6;
 }
 }
 
 
+/* 报告总结描述 */
+.summary-box {
+  background: rgba(255,255,255,0.15);
+  border-radius: 12rpx;
+  padding: 16rpx 20rpx;
+  margin: 16rpx 0 0;
+  border-left: 6rpx solid #A5D6A7;
+  display: flex;
+  flex-direction: column;
+  gap: 8rpx;
+}
+.summary-title {
+  font-size: 24rpx;
+  font-weight: 600;
+  color: #fff;
+  opacity: 0.95;
+}
+.summary-text {
+  font-size: 24rpx;
+  color: #fff;
+  line-height: 1.6;
+  opacity: 0.95;
+}
+
 /* 解读入口 */
 /* 解读入口 */
 .ai-fab {
 .ai-fab {
   position: fixed;
   position: fixed;