report-confirm.vue 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743
  1. <template>
  2. <view class="confirm-container">
  3. <view class="nav-bar">
  4. <text class="nav-back" @click="goBack">‹ 返回</text>
  5. <text class="nav-title">确认健康报告</text>
  6. <view class="nav-placeholder"></view>
  7. </view>
  8. <view class="tip-banner">
  9. <text class="tip-icon">✅</text>
  10. <text class="tip-text">请核对以下解析内容,可修改后确认入库</text>
  11. </view>
  12. <!-- 解析中状态(仅 draftId 模式,从上传页跳转后自动解析) -->
  13. <view class="parsing-banner" v-if="parsing">
  14. <text class="parsing-icon">⏳</text>
  15. <text class="parsing-text">正在解析报告,请稍候...</text>
  16. </view>
  17. <!-- 匹配可信度 -->
  18. <view class="confidence-card" v-if="confidenceLevelClass">
  19. <view class="confidence-header">
  20. <text class="confidence-label">匹配可信度</text>
  21. <text class="confidence-badge" :class="'badge-' + confidenceLevelClass">{{ confidenceLevelText }}</text>
  22. </view>
  23. <view class="confidence-bar-track">
  24. <view class="confidence-bar-fill" :class="'fill-' + confidenceLevelClass" :style="'width:' + confidencePercent + '%'"></view>
  25. </view>
  26. <text class="confidence-desc">{{ confidenceDesc }}</text>
  27. </view>
  28. <view class="form-section">
  29. <!-- 基本信息 -->
  30. <view class="card">
  31. <view class="card-title">基本信息</view>
  32. <view class="field-row member-select-row" @click="toggleMemberPanel">
  33. <text class="field-label">被检测人</text>
  34. <text class="field-value" :class="{ 'binding-required': needBind && !selectedMemberObj }">{{ memberDisplayText }}</text>
  35. <text class="member-select-arrow">{{ selectedMemberObj ? '修改 ›' : '选择 ›' }}</text>
  36. </view>
  37. <!-- 被检测人选择面板(内联展开) -->
  38. <view class="member-panel" v-if="showMemberPanel">
  39. <!-- 候选匹配列表(按置信度排序) -->
  40. <view class="candidate-section" v-if="candidates.length > 0">
  41. <text class="candidate-section-hint">以下成员与报告信息匹配,请选择:</text>
  42. <view
  43. class="candidate-item"
  44. v-for="(cand, idx) in candidates"
  45. :key="idx"
  46. :class="{ 'candidate-selected': selectedMemberId === (cand.id || cand.userId) }"
  47. @click="selectAndClose(cand)"
  48. >
  49. <view class="candidate-left">
  50. <text class="candidate-avatar">{{ (cand.nickname || cand.name || '?').substring(0, 1) }}</text>
  51. <view class="candidate-info">
  52. <text class="candidate-name">{{ cand.nickname || cand.name || '未知' }}</text>
  53. <text class="candidate-detail" v-if="cand.gender || cand.age">{{ genderText(cand.gender) }}{{ cand.age ? ' · ' + cand.age + '岁' : '' }}</text>
  54. <text class="candidate-fields" v-if="cand.matchFields">匹配: {{ cand.matchFields }}</text>
  55. </view>
  56. </view>
  57. <view class="candidate-right">
  58. <view class="score-bar-track">
  59. <view class="score-bar-fill" :style="'width:' + (cand.similarityScore * 100) + '%'"></view>
  60. </view>
  61. <text class="score-text">{{ Math.round(cand.similarityScore * 100) }}%</text>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- 全量家庭成员列表(后备) -->
  66. <view class="member-list" v-if="familyMembers.length > 0 && (candidates.length === 0 || !showCandidatesOnly)">
  67. <view
  68. class="member-item"
  69. v-for="(member, mIdx) in familyMembers"
  70. :key="mIdx"
  71. :class="{ 'member-selected': selectedMemberId === (member.userId || member.id) }"
  72. @click="selectAndClose(member)"
  73. >
  74. <text class="member-avatar">{{ (member.nickname || '?').substring(0, 1) }}</text>
  75. <text class="member-name">{{ member.nickname || '未知' }}</text>
  76. </view>
  77. </view>
  78. <!-- 新建成员入口 -->
  79. <view class="create-member-entry" @click="toggleAutoCreate">
  80. <text class="create-member-icon">+</text>
  81. <text class="create-member-text">{{ showAutoCreateForm ? '收起新建表单' : '不在列表中?新建家庭成员' }}</text>
  82. </view>
  83. <!-- 新建成员表单(面板内嵌) -->
  84. <view class="auto-create-inline" v-if="showAutoCreateForm">
  85. <view class="form-item">
  86. <text class="form-item-label">姓名</text>
  87. <input class="form-item-input" v-model="newMember.name" placeholder="请输入姓名" />
  88. </view>
  89. <view class="form-item">
  90. <text class="form-item-label">性别</text>
  91. <view class="gender-selector">
  92. <text class="gender-option" :class="{ 'gender-selected': newMember.gender === 'male' }" @click="newMember.gender = 'male'">男</text>
  93. <text class="gender-option" :class="{ 'gender-selected': newMember.gender === 'female' }" @click="newMember.gender = 'female'">女</text>
  94. </view>
  95. </view>
  96. <view class="form-item">
  97. <text class="form-item-label">年龄</text>
  98. <input class="form-item-input" type="number" v-model="newMember.age" placeholder="请输入年龄" />
  99. </view>
  100. <view class="btn-create-submit" :class="{ 'btn-disabled': creatingMember }" @click="doAutoCreate">
  101. <text v-if="creatingMember">创建中...</text>
  102. <text v-else>确认创建</text>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="field-row" v-if="extractedGender">
  107. <text class="field-label">性别</text>
  108. <text class="field-value">{{ extractedGender === 'male' ? '男' : extractedGender === 'female' ? '女' : extractedGender }}</text>
  109. </view>
  110. <view class="field-row" v-if="extractedAge">
  111. <text class="field-label">年龄</text>
  112. <text class="field-value">{{ extractedAge }}</text>
  113. </view>
  114. <view class="field-row" v-if="payload.summary && payload.type !== 'tongue'">
  115. <text class="field-label">综合评分</text>
  116. <input class="field-input" type="number" v-model="payload.summary.overallScore" />
  117. </view>
  118. <view class="field-row" v-if="payload.summary && payload.type !== 'tongue'">
  119. <text class="field-label">报告日期</text>
  120. <input class="field-input" type="text" v-model="payload.summary.reportDate" placeholder="如: 2025-06-15" />
  121. </view>
  122. <view class="field-row" v-if="payload.summary && payload.type !== 'tongue'">
  123. <text class="field-label">报告摘要</text>
  124. <textarea class="field-textarea" v-model="payload.summary.summary" maxlength="500" />
  125. </view>
  126. </view>
  127. <!-- 舌诊指标(只读展示) -->
  128. <view class="card" v-if="payload.type === 'tongue' && payload.indicators && payload.indicators.length">
  129. <view class="card-title">舌象指标</view>
  130. <view class="tongue-indicator-grid">
  131. <view class="tongue-ind-item" v-for="(ind, idx) in payload.indicators" :key="idx">
  132. <text class="tongue-ind-label">{{ indicatorLabel(ind.code) }}</text>
  133. <text class="tongue-ind-value">{{ ind.value }}</text>
  134. </view>
  135. </view>
  136. <view class="tongue-summary" v-if="payload.summary && payload.summary.overallAssessment">
  137. <text class="tongue-summary-title">综合评估</text>
  138. <text class="tongue-summary-text">{{ payload.summary.overallAssessment }}</text>
  139. </view>
  140. </view>
  141. <!-- 健康指标(舌诊时隐藏,使用上方舌象指标卡片) -->
  142. <view class="card" v-if="payload.type !== 'tongue' && payload.indicators && payload.indicators.length">
  143. <view class="card-title">
  144. <text>健康指标</text>
  145. <text class="title-count">共 {{ payload.indicators.length }} 项</text>
  146. <text class="title-abnormal" v-if="totalAbnormalCount > 0">,{{ totalAbnormalCount }} 项异常</text>
  147. <view class="card-title-actions">
  148. <text class="expand-all-btn" @click="toggleAllGroups(true)">全部展开</text>
  149. <text class="expand-all-btn" @click="toggleAllGroups(false)">全部折叠</text>
  150. </view>
  151. </view>
  152. <!-- 按指标类型分组折叠 -->
  153. <view class="indicator-group" v-for="(group, gIdx) in indicatorGroups" :key="gIdx">
  154. <view class="indicator-group-header" @click="toggleGroup(gIdx)">
  155. <view class="indicator-group-header-left">
  156. <text class="indicator-group-arrow" :class="{ 'arrow-open': groupExpandList[gIdx] }">›</text>
  157. <text class="indicator-group-name">{{ group.category }}</text>
  158. </view>
  159. <view class="indicator-group-header-right">
  160. <text class="indicator-group-abnormal" v-if="group.abnormalCount > 0">{{ group.abnormalCount }} 项异常</text>
  161. <text class="indicator-group-count">{{ group.items.length }} 项</text>
  162. </view>
  163. </view>
  164. <view class="indicator-group-body" v-if="groupExpandList[gIdx]">
  165. <view class="indicator-item" v-for="(ind, idx) in group.items" :key="idx">
  166. <view class="ind-header">
  167. <text class="ind-help-btn" @click.stop="showHelp(ind)">?</text>
  168. <input class="ind-name" :class="'ind-name-' + _cssClass(ind.status)" v-model="ind.indicatorName" />
  169. <input class="ind-value" :class="'ind-value-' + _cssClass(ind.status)" v-model="ind.indicatorValue" />
  170. </view>
  171. <view class="ind-detail" v-if="ind.unit || ind.refRange">
  172. <text class="ind-ref" v-if="ind.refRange">参考: {{ ind.refRange }}</text>
  173. <text class="ind-unit" v-if="ind.unit">{{ ind.unit }}</text>
  174. </view>
  175. <view class="ind-symptoms" v-if="ind.symptoms">
  176. <text class="ind-symptom-label">症状:</text>
  177. <input class="ind-symptom-input" v-model="ind.symptoms" />
  178. </view>
  179. </view>
  180. </view>
  181. </view>
  182. </view>
  183. <!-- 指标帮助弹窗 -->
  184. <view class="help-overlay" v-if="showHelpPopup" @click="closeHelp">
  185. <view class="help-popup" @click.stop>
  186. <view class="help-popup-header">
  187. <text class="help-popup-title">{{ helpData.name }}</text>
  188. <text class="help-popup-close" @click="closeHelp">✕</text>
  189. </view>
  190. <view class="help-popup-body">
  191. <view class="help-row">
  192. <text class="help-label">当前值</text>
  193. <text class="help-value">{{ helpData.value }}</text>
  194. </view>
  195. <view class="help-row" v-if="helpData.refRange">
  196. <text class="help-label">参考范围</text>
  197. <text class="help-value">{{ helpData.refRange }}</text>
  198. </view>
  199. <view class="help-row">
  200. <text class="help-label">状态</text>
  201. <text class="help-value" :class="'help-status-' + _cssClass(helpData.status)">{{ statusText(helpData.status) }}</text>
  202. </view>
  203. <view class="help-desc" v-if="helpData.description">
  204. <text class="help-desc-label">说明</text>
  205. <text class="help-desc-text">{{ helpData.description }}</text>
  206. </view>
  207. <view class="help-desc" v-else>
  208. <text class="help-desc-label">说明</text>
  209. <text class="help-desc-text">{{ getDefaultDescription(helpData.name, helpData.status) }}</text>
  210. </view>
  211. </view>
  212. </view>
  213. </view>
  214. <!-- 肠道菌群 -->
  215. <view class="card" v-if="payload.gutFlora && payload.gutFlora.length">
  216. <view class="card-title">肠道菌群 ({{ payload.gutFlora.length }})</view>
  217. <view class="flora-item" v-for="(flora, idx) in payload.gutFlora" :key="idx">
  218. <input class="flora-name" v-model="payload.gutFlora[idx].name" />
  219. <input class="flora-abundance" type="digit" v-model="payload.gutFlora[idx].abundance" />
  220. <view class="status-tag" :class="'status-' + _cssClass(flora.status)">
  221. {{ statusText(flora.status) }}
  222. </view>
  223. </view>
  224. </view>
  225. <!-- 疾病风险 -->
  226. <view class="card" v-if="payload.diseaseRisks && payload.diseaseRisks.length">
  227. <view class="card-title">疾病风险 ({{ payload.diseaseRisks.length }})</view>
  228. <view class="risk-item" v-for="(risk, idx) in payload.diseaseRisks" :key="idx">
  229. <input class="risk-name" v-model="payload.diseaseRisks[idx].diseaseName" />
  230. <view class="risk-level" :class="'risk-' + (risk.riskLevel || 'low')">
  231. {{ riskLevelText(risk.riskLevel) }}
  232. </view>
  233. </view>
  234. </view>
  235. <!-- 饮食推荐 -->
  236. <view class="card" v-if="payload.foods && payload.foods.length">
  237. <view class="card-title">饮食推荐 ({{ payload.foods.length }})</view>
  238. <view class="food-item" v-for="(food, idx) in payload.foods" :key="idx">
  239. <input class="food-name" v-model="payload.foods[idx].foodName" />
  240. <input class="food-category" v-model="payload.foods[idx].category" />
  241. </view>
  242. </view>
  243. <!-- 益生菌种 -->
  244. <view class="card" v-if="payload.probioticSpecies && payload.probioticSpecies.length">
  245. <view class="card-title">益生菌种 ({{ payload.probioticSpecies.length }})</view>
  246. <view class="flora-item" v-for="(flora, idx) in payload.probioticSpecies" :key="idx">
  247. <input class="flora-name" v-model="payload.probioticSpecies[idx].name" />
  248. <input class="flora-abundance" type="digit" v-model="payload.probioticSpecies[idx].abundance" />
  249. <view class="status-tag" :class="'status-' + _cssClass(flora.status)">
  250. {{ statusText(flora.status) }}
  251. </view>
  252. </view>
  253. </view>
  254. <!-- Taxonomy 分类(纲/目/科/属/种) -->
  255. <view class="card" v-if="hasTaxonomyData()">
  256. <view class="card-title">菌群分类组成 ({{ taxonomyTotalCount }})</view>
  257. <view class="taxonomy-group" v-if="payload.taxonomyClass && payload.taxonomyClass.length">
  258. <text class="taxonomy-group-label">菌纲 (Class)</text>
  259. <view class="flora-item" v-for="(flora, idx) in payload.taxonomyClass" :key="getTaxonomyKey('c', idx)">
  260. <input class="flora-name" v-model="payload.taxonomyClass[idx].name" />
  261. <input class="flora-abundance" type="digit" v-model="payload.taxonomyClass[idx].abundance" />
  262. </view>
  263. </view>
  264. <view class="taxonomy-group" v-if="payload.taxonomyOrder && payload.taxonomyOrder.length">
  265. <text class="taxonomy-group-label">菌目 (Order)</text>
  266. <view class="flora-item" v-for="(flora, idx) in payload.taxonomyOrder" :key="getTaxonomyKey('o', idx)">
  267. <input class="flora-name" v-model="payload.taxonomyOrder[idx].name" />
  268. <input class="flora-abundance" type="digit" v-model="payload.taxonomyOrder[idx].abundance" />
  269. </view>
  270. </view>
  271. <view class="taxonomy-group" v-if="payload.taxonomyFamily && payload.taxonomyFamily.length">
  272. <text class="taxonomy-group-label">菌科 (Family)</text>
  273. <view class="flora-item" v-for="(flora, idx) in payload.taxonomyFamily" :key="getTaxonomyKey('f', idx)">
  274. <input class="flora-name" v-model="payload.taxonomyFamily[idx].name" />
  275. <input class="flora-abundance" type="digit" v-model="payload.taxonomyFamily[idx].abundance" />
  276. </view>
  277. </view>
  278. <view class="taxonomy-group" v-if="payload.taxonomyGenus && payload.taxonomyGenus.length">
  279. <text class="taxonomy-group-label">菌属 (Genus)</text>
  280. <view class="flora-item" v-for="(flora, idx) in payload.taxonomyGenus" :key="getTaxonomyKey('g', idx)">
  281. <input class="flora-name" v-model="payload.taxonomyGenus[idx].name" />
  282. <input class="flora-abundance" type="digit" v-model="payload.taxonomyGenus[idx].abundance" />
  283. </view>
  284. </view>
  285. <view class="taxonomy-group" v-if="payload.taxonomySpecies && payload.taxonomySpecies.length">
  286. <text class="taxonomy-group-label">菌种 (Species)</text>
  287. <view class="flora-item" v-for="(flora, idx) in payload.taxonomySpecies" :key="getTaxonomyKey('s', idx)">
  288. <input class="flora-name" v-model="payload.taxonomySpecies[idx].name" />
  289. <input class="flora-abundance" type="digit" v-model="payload.taxonomySpecies[idx].abundance" />
  290. </view>
  291. </view>
  292. </view>
  293. <!-- 病原菌 -->
  294. <view class="card" v-if="hasPathogenData()">
  295. <view class="card-title">病原菌 ({{ pathogenTotalCount }})</view>
  296. <view class="pathogen-group" v-if="payload.pathogenGenus && payload.pathogenGenus.length">
  297. <text class="pathogen-group-label">病原菌属</text>
  298. <view class="flora-item" v-for="(flora, idx) in payload.pathogenGenus" :key="getTaxonomyKey('pg', idx)">
  299. <input class="flora-name" v-model="payload.pathogenGenus[idx].name" />
  300. <input class="flora-abundance" type="digit" v-model="payload.pathogenGenus[idx].abundance" />
  301. <view class="status-tag" :class="'status-' + _cssClass(flora.status)">
  302. {{ statusText(flora.status) }}
  303. </view>
  304. </view>
  305. </view>
  306. <view class="pathogen-group" v-if="payload.pathogenDetection && payload.pathogenDetection.length">
  307. <text class="pathogen-group-label">病原菌检出</text>
  308. <view class="flora-item" v-for="(flora, idx) in payload.pathogenDetection" :key="getTaxonomyKey('pd', idx)">
  309. <input class="flora-name" v-model="payload.pathogenDetection[idx].name" />
  310. <input class="flora-abundance" type="digit" v-model="payload.pathogenDetection[idx].abundance" />
  311. <view class="status-tag" :class="'status-' + _cssClass(flora.status)">
  312. {{ statusText(flora.status) }}
  313. </view>
  314. </view>
  315. </view>
  316. </view>
  317. <!-- 操作按钮 -->
  318. <view class="action-row">
  319. <view class="btn-discard" @click="doDiscard">
  320. <text>放弃</text>
  321. </view>
  322. <view class="btn-confirm" :class="{ 'btn-disabled': !canConfirm }" @click="doConfirm">
  323. <text v-if="confirming">确认中...</text>
  324. <text v-else>确认入库</text>
  325. </view>
  326. </view>
  327. </view>
  328. <view class="bottom-spacer"></view>
  329. </view>
  330. </template>
  331. <script>
  332. import { confirmReportPreview, discardReportDraft, confirmTongue, discardTongue, parseReportDraft } from '../../utils/api.js'
  333. import { addFamilyMember, getFamilyMembers } from '../../utils/api.js'
  334. export default {
  335. data() {
  336. return {
  337. draftId: null,
  338. memberId: null,
  339. familyId: null,
  340. payload: {
  341. summary: {},
  342. indicators: [],
  343. gutFlora: [],
  344. probioticSpecies: [],
  345. taxonomyClass: [],
  346. taxonomyOrder: [],
  347. taxonomyFamily: [],
  348. taxonomyGenus: [],
  349. taxonomySpecies: [],
  350. pathogenGenus: [],
  351. pathogenDetection: [],
  352. foods: [],
  353. diseaseRisks: []
  354. },
  355. extractedName: '',
  356. extractedGender: '',
  357. extractedAge: '',
  358. matchedMemberId: null,
  359. needBind: false,
  360. selectedMemberId: null,
  361. familyMembers: [],
  362. confirming: false,
  363. // 仅 draftId 模式(从上传页跳转)下正在解析
  364. parsing: false,
  365. // Phase 2: 匹配可信度与候选
  366. matchConfidence: null,
  367. matchLabel: '',
  368. candidates: [],
  369. showCandidatesOnly: false,
  370. // 被检测人选择面板
  371. showMemberPanel: false,
  372. selectedMemberObj: null,
  373. // 新建成员
  374. showAutoCreateForm: false,
  375. newMember: {
  376. name: '',
  377. gender: '',
  378. age: ''
  379. },
  380. creatingMember: false,
  381. createdMemberId: null,
  382. // 指标分组折叠状态(按分组下标,默认全部折叠)
  383. groupExpandList: [],
  384. // 指标帮助弹窗
  385. showHelpPopup: false,
  386. helpData: { name: '', value: '', refRange: '', status: '', description: '' }
  387. }
  388. },
  389. computed: {
  390. canConfirm() {
  391. if (this.parsing) return false
  392. if (this.needBind && !this.selectedMemberId && !this.createdMemberId) return false
  393. return this.draftId && !this.confirming
  394. },
  395. confidenceLevelClass() {
  396. if (!this.matchConfidence && this.matchConfidence !== 0) return ''
  397. var val = parseFloat(this.matchConfidence)
  398. if (this.matchLabel === 'exact' || val >= 0.8) return 'high'
  399. if (this.matchLabel === 'fuzzy' || val >= 0.5) return 'medium'
  400. if (this.matchLabel === 'profile_match' || val >= 0.2) return 'low'
  401. return 'none'
  402. },
  403. confidenceLevelText() {
  404. var map = { high: '高', medium: '中', low: '低', none: '未匹配' }
  405. return map[this.confidenceLevelClass] || ''
  406. },
  407. confidencePercent() {
  408. if (!this.matchConfidence && this.matchConfidence !== 0) return 0
  409. return Math.round(parseFloat(this.matchConfidence) * 100)
  410. },
  411. confidenceDesc() {
  412. if (this.matchLabel === 'exact') return '根据姓名、性别、年龄自动精确匹配到家庭成员'
  413. if (this.matchLabel === 'fuzzy') return '部分字段匹配,请确认是否为以下家庭成员'
  414. if (this.matchLabel === 'profile_match') return '根据档案信息推测匹配,请手动确认'
  415. if (this.matchLabel === 'no_match') return '无法匹配到现有家庭成员,可新建成员'
  416. return ''
  417. },
  418. memberDisplayText() {
  419. var m = this.selectedMemberObj
  420. if (m && (m.nickname || m.name)) return m.nickname || m.name
  421. if (this.needBind) return '需手动绑定'
  422. return this.extractedName || '未识别'
  423. },
  424. // 指标按类型(category)分组,保持解析顺序,统计需处理(非正常)数量
  425. indicatorGroups() {
  426. var groups = []
  427. var orderMap = {}
  428. var list = (this.payload && this.payload.indicators) || []
  429. for (var i = 0; i < list.length; i++) {
  430. var ind = list[i]
  431. var cat = ind.category || '其他指标'
  432. if (!orderMap[cat]) {
  433. orderMap[cat] = groups.length
  434. groups.push({ category: cat, items: [], needCount: 0, abnormalCount: 0 })
  435. }
  436. var group = groups[orderMap[cat]]
  437. group.items.push(ind)
  438. if (this.isAbnormalStatus(ind.status)) {
  439. group.needCount++
  440. group.abnormalCount++
  441. }
  442. }
  443. return groups
  444. },
  445. totalAbnormalCount() {
  446. var list = (this.payload && this.payload.indicators) || []
  447. var count = 0
  448. for (var i = 0; i < list.length; i++) {
  449. if (this.isAbnormalStatus(list[i].status)) count++
  450. }
  451. return count
  452. },
  453. taxonomyTotalCount() {
  454. var total = 0
  455. total += (this.payload.taxonomyClass || []).length
  456. total += (this.payload.taxonomyOrder || []).length
  457. total += (this.payload.taxonomyFamily || []).length
  458. total += (this.payload.taxonomyGenus || []).length
  459. total += (this.payload.taxonomySpecies || []).length
  460. return total
  461. },
  462. pathogenTotalCount() {
  463. return (this.payload.pathogenGenus || []).length +
  464. (this.payload.pathogenDetection || []).length
  465. }
  466. },
  467. onLoad: function(options) {
  468. this.draftId = options.draftId ? parseInt(options.draftId) : null
  469. this.memberId = options.memberId ? parseInt(options.memberId) : null
  470. this.familyId = options.familyId ? parseInt(options.familyId) : null
  471. // 仅 draftId 模式(从上传页自动跳转):无 payload 参数 → 调用后端按草稿解析并自动填充
  472. if (this.draftId && !options.payload) {
  473. this.parseByDraftId()
  474. return
  475. }
  476. var payloadStr = decodeURIComponent(options.payload || '{}')
  477. try {
  478. var parsed = typeof payloadStr === 'string' ? JSON.parse(payloadStr) : payloadStr
  479. this.payload = Object.assign({
  480. summary: {},
  481. indicators: [],
  482. gutFlora: [],
  483. probioticSpecies: [],
  484. taxonomyClass: [],
  485. taxonomyOrder: [],
  486. taxonomyFamily: [],
  487. taxonomyGenus: [],
  488. taxonomySpecies: [],
  489. pathogenGenus: [],
  490. pathogenDetection: [],
  491. foods: [],
  492. diseaseRisks: []
  493. }, parsed)
  494. } catch (e) {
  495. console.log('解析payload失败', e)
  496. }
  497. this.extractedName = options.extractedName || ''
  498. this.extractedGender = options.extractedGender || ''
  499. this.extractedAge = options.extractedAge || ''
  500. this.matchedMemberId = options.matchedMemberId ? parseInt(options.matchedMemberId) : null
  501. // 从解析结果填充报告日期
  502. var extractedReportDate = options.extractedReportDate || ''
  503. if (extractedReportDate && this.payload.summary) {
  504. this.payload.summary.reportDate = extractedReportDate
  505. }
  506. this.needBind = options.needBind === 'true' || options.needBind === '1'
  507. this.matchConfidence = options.matchConfidence ? parseFloat(options.matchConfidence) : null
  508. this.matchLabel = decodeURIComponent(options.matchLabel || '')
  509. // 解析候选成员列表
  510. var candidatesStr = decodeURIComponent(options.candidates || '')
  511. if (candidatesStr) {
  512. try {
  513. this.candidates = JSON.parse(candidatesStr)
  514. } catch (e) {
  515. this.candidates = []
  516. }
  517. }
  518. // 有候选时优先展示候选列表
  519. if (this.candidates.length > 0) {
  520. this.showCandidatesOnly = true
  521. }
  522. // 始终加载家庭成员(面板始终可点击,needBind=false 也允许改选)
  523. this.loadFamilyMembers()
  524. if (this.needBind) {
  525. // 高置信度且已匹配 → 直接选中
  526. if (this.matchedMemberId && this.matchConfidence >= 0.8) {
  527. this.selectedMemberId = this.matchedMemberId
  528. }
  529. }
  530. },
  531. methods: {
  532. // 仅 draftId 模式:调用后端按草稿解析,成功后自动填充页面
  533. parseByDraftId() {
  534. var self = this
  535. self.parsing = true
  536. parseReportDraft(self.draftId).then(function(res) {
  537. var detail = res && res.data
  538. if (!detail) {
  539. self.parsing = false
  540. uni.showToast({ title: (res && res.message) || '解析失败,请重试', icon: 'none' })
  541. return
  542. }
  543. self.applyParseResult(detail)
  544. }).catch(function(err) {
  545. self.parsing = false
  546. var msg = (err && err.message) || '解析失败,请重试'
  547. uni.showToast({ title: msg, icon: 'none' })
  548. })
  549. },
  550. // 将后端解析结果应用到页面
  551. applyParseResult(detail) {
  552. this.parsing = false
  553. if (detail.payload) {
  554. this.payload = Object.assign({
  555. summary: {},
  556. indicators: [],
  557. gutFlora: [],
  558. probioticSpecies: [],
  559. taxonomyClass: [],
  560. taxonomyOrder: [],
  561. taxonomyFamily: [],
  562. taxonomyGenus: [],
  563. taxonomySpecies: [],
  564. pathogenGenus: [],
  565. pathogenDetection: [],
  566. foods: [],
  567. diseaseRisks: []
  568. }, detail.payload)
  569. }
  570. this.extractedName = detail.extractedName || ''
  571. this.extractedGender = detail.extractedGender || ''
  572. this.extractedAge = detail.extractedAge || ''
  573. this.matchedMemberId = detail.matchedMemberId ? parseInt(detail.matchedMemberId) : null
  574. this.needBind = !!detail.needBind
  575. this.matchConfidence = detail.confidence !== undefined && detail.confidence !== null ? parseFloat(detail.confidence) : null
  576. this.matchLabel = detail.matchLabel || ''
  577. this.candidates = detail.candidates || []
  578. this.showCandidatesOnly = this.candidates.length > 0
  579. // 始终加载家庭成员
  580. this.loadFamilyMembers()
  581. // 高置信度且已匹配 → 直接选中
  582. if (this.needBind && this.matchedMemberId && this.matchConfidence >= 0.8) {
  583. this.selectedMemberId = this.matchedMemberId
  584. }
  585. },
  586. loadFamilyMembers() {
  587. var self = this
  588. // 从后端获取真实家庭成员(家长 + 孩子),storage 中并无该数据
  589. getFamilyMembers().then(function(res) {
  590. var data = (res && res.data) || {}
  591. var parents = (data.parents || []).map(function(p) {
  592. return { id: p.id, nickname: p.realName || p.nickname, gender: p.gender, role: 'parent' }
  593. })
  594. var children = (data.children || []).map(function(c) {
  595. return { id: c.id, nickname: c.nickname, gender: c.gender, age: c.age, role: 'child' }
  596. })
  597. self.familyMembers = parents.concat(children)
  598. self.syncSelectedMemberObj()
  599. }).catch(function(e) {
  600. console.log('加载家庭成员失败', e)
  601. self.familyMembers = []
  602. })
  603. },
  604. toggleMemberPanel() {
  605. this.showMemberPanel = !this.showMemberPanel
  606. if (!this.showMemberPanel) {
  607. this.showAutoCreateForm = false
  608. }
  609. },
  610. selectAndClose(member) {
  611. var memberId = member.id || member.userId
  612. this.selectedMemberId = memberId
  613. this.selectedMemberObj = member
  614. this.extractedName = member.nickname || member.name || this.extractedName
  615. this.extractedGender = member.gender || this.extractedGender
  616. this.extractedAge = member.age || this.extractedAge
  617. this.showAutoCreateForm = false
  618. this.showMemberPanel = false
  619. },
  620. syncSelectedMemberObj() {
  621. if (!this.selectedMemberId) {
  622. this.selectedMemberObj = null
  623. return
  624. }
  625. var all = this.familyMembers.concat(this.candidates)
  626. for (var i = 0; i < all.length; i++) {
  627. var m = all[i]
  628. if ((m.id || m.userId) === this.selectedMemberId) {
  629. this.selectedMemberObj = m
  630. return
  631. }
  632. }
  633. },
  634. // === Phase 2: 候选匹配与新建成员 ===
  635. genderText(gender) {
  636. if (gender === 'male') return '男'
  637. if (gender === 'female') return '女'
  638. return gender || ''
  639. },
  640. toggleAutoCreate() {
  641. this.showAutoCreateForm = !this.showAutoCreateForm
  642. if (this.showAutoCreateForm) {
  643. this.newMember.name = this.extractedName || ''
  644. this.newMember.gender = this.extractedGender || ''
  645. this.newMember.age = this.extractedAge || ''
  646. this.selectedMemberId = null
  647. }
  648. },
  649. doAutoCreate() {
  650. var self = this
  651. if (!this.newMember.name) {
  652. uni.showToast({ title: '请输入成员姓名', icon: 'none' })
  653. return
  654. }
  655. self.creatingMember = true
  656. uni.showLoading({ title: '创建成员...' })
  657. addFamilyMember({
  658. nickname: self.newMember.name,
  659. gender: self.newMember.gender || '',
  660. age: self.newMember.age ? parseInt(self.newMember.age) : null
  661. }).then(function(res) {
  662. uni.hideLoading()
  663. if (res.code === 200) {
  664. var memberId = res.data && (res.data.userId || res.data.id)
  665. if (memberId) {
  666. self.createdMemberId = memberId
  667. self.selectedMemberId = memberId
  668. self.selectedMemberObj = {
  669. id: memberId,
  670. nickname: self.newMember.name,
  671. gender: self.newMember.gender,
  672. age: self.newMember.age
  673. }
  674. self.extractedName = self.newMember.name
  675. self.extractedGender = self.newMember.gender
  676. self.extractedAge = self.newMember.age
  677. self.showAutoCreateForm = false
  678. self.showMemberPanel = false
  679. uni.showToast({ title: '创建成功', icon: 'success' })
  680. }
  681. } else {
  682. uni.showToast({ title: res.message || '创建失败', icon: 'none' })
  683. }
  684. }).catch(function(e) {
  685. uni.hideLoading()
  686. uni.showToast({ title: '创建失败', icon: 'none' })
  687. }).finally(function() {
  688. self.creatingMember = false
  689. })
  690. },
  691. toggleGroup(gIdx) {
  692. this.$set(this.groupExpandList, gIdx, !this.groupExpandList[gIdx])
  693. },
  694. toggleAllGroups(expand) {
  695. var arr = []
  696. for (var i = 0; i < this.indicatorGroups.length; i++) {
  697. arr.push(expand)
  698. }
  699. this.groupExpandList = arr
  700. },
  701. _cssClass(status) {
  702. var map = { 'high': 'high', 'low': 'low', 'abnormal': 'abnormal', 'normal': 'normal', '缺乏': 'deficient', '偏低': 'low', '不足': 'insufficient', '正常': 'normal', '注意': 'warning', '偏高': 'high', '异常': 'abnormal', '高风险': 'high-risk', '低风险': 'low-risk', '未检出': 'not-detected' }
  703. return map[status] || 'normal'
  704. },
  705. statusText(status) {
  706. if (status === 'high' || status === '偏高') return '偏高'
  707. if (status === 'low' || status === '偏低') return '偏低'
  708. if (status === 'abnormal' || status === '异常') return '异常'
  709. if (status === '缺乏') return '缺乏'
  710. if (status === '不足') return '不足'
  711. if (status === '正常') return '正常'
  712. if (status === '注意') return '注意'
  713. if (status === '高风险') return '高风险'
  714. if (status === '低风险') return '低风险'
  715. if (status === '未检出') return '未检出'
  716. return '正常'
  717. },
  718. // 与 _cssClass 保持同一白名单:仅明确异常/需关注的状态计入异常数,
  719. // 未知状态文本(解析器自由提取)一律视为正常,避免"样式正常却计入异常"的矛盾。
  720. isAbnormalStatus(status) {
  721. if (!status) return false
  722. var abnormalMap = { 'high': 1, 'low': 1, 'abnormal': 1, '偏高': 1, '偏低': 1, '异常': 1, '缺乏': 1, '不足': 1, '注意': 1, '高风险': 1 }
  723. return !!abnormalMap[String(status).trim()]
  724. },
  725. showHelp(ind) {
  726. this.helpData = {
  727. name: ind.indicatorName || ind.name || '',
  728. value: ind.indicatorValue || ind.value || '',
  729. refRange: ind.refRange || ind.normalRange || '',
  730. status: ind.status || 'normal',
  731. description: ind.description || ind.symptoms || ''
  732. }
  733. this.showHelpPopup = true
  734. },
  735. closeHelp() {
  736. this.showHelpPopup = false
  737. },
  738. getDefaultDescription(name, status) {
  739. if (!status || status === 'normal') return '该指标处于正常范围内,无需特别关注。'
  740. if (status === 'high' || status === '偏高') return '该指标偏高,建议咨询专业医生或营养师进行进一步评估。'
  741. if (status === 'low' || status === '偏低') return '该指标偏低,建议咨询专业医生或营养师进行进一步评估。'
  742. if (status === '缺乏' || status === '不足') return '该指标不足,建议通过饮食或补充剂适当补充。'
  743. if (status === 'abnormal') return '该指标异常,建议咨询专业医生进行详细检查。'
  744. if (status === '注意') return '该指标需要关注,建议定期监测并咨询专业人士。'
  745. return '请参考专业医生的建议进行解读。'
  746. },
  747. riskLevelText(level) {
  748. if (level === 'high') return '高风险'
  749. if (level === 'medium' || level === 'moderate') return '中风险'
  750. return '低风险'
  751. },
  752. doConfirm() {
  753. if (!this.canConfirm) return
  754. var self = this
  755. self.confirming = true
  756. uni.showLoading({ title: '确认入库...' })
  757. var postData = {
  758. draftId: self.draftId,
  759. payload: self.payload
  760. }
  761. // 优先级: 已选成员 > 新建成员 > 自动匹配(高置信度) > 子ID
  762. if (self.selectedMemberId) {
  763. postData.subjectId = self.selectedMemberId
  764. } else if (self.createdMemberId) {
  765. postData.subjectId = self.createdMemberId
  766. } else if (self.matchedMemberId) {
  767. postData.subjectId = self.matchedMemberId
  768. } else if (self.memberId) {
  769. postData.subjectId = self.memberId
  770. }
  771. var confirmFn = self.payload.type === 'tongue' ? confirmTongue : confirmReportPreview
  772. confirmFn(postData).then(function(res) {
  773. uni.hideLoading()
  774. if (res.code === 200) {
  775. uni.showToast({ title: '入库成功', icon: 'success' })
  776. var reportId = res.data && res.data.reportId
  777. var reportType = res.data && res.data.reportType || ''
  778. setTimeout(function() {
  779. if (reportId) {
  780. uni.redirectTo({ url: '/pages/health/health-plan-summary?initialReportIds=' + reportId + '&subjectId=' + (postData.subjectId || '') })
  781. } else {
  782. uni.navigateBack()
  783. }
  784. }, 500)
  785. } else {
  786. uni.showToast({ title: res.message || '确认失败', icon: 'none' })
  787. }
  788. }).catch(function(e) {
  789. uni.hideLoading()
  790. uni.showToast({ title: '确认失败,请重试', icon: 'none' })
  791. console.log('确认入库失败', e)
  792. }).finally(function() {
  793. self.confirming = false
  794. })
  795. },
  796. doDiscard() {
  797. var self = this
  798. uni.showModal({
  799. title: '确认放弃',
  800. content: '放弃后解析数据将被删除,需要重新上传',
  801. success: function(res) {
  802. if (res.confirm) {
  803. var discardFn = self.payload.type === 'tongue' ? discardTongue : discardReportDraft
  804. discardFn(self.draftId).then(function() {
  805. uni.showToast({ title: '已放弃', icon: 'none' })
  806. setTimeout(function() { uni.navigateBack() }, 500)
  807. }).catch(function() {
  808. uni.showToast({ title: '操作失败', icon: 'none' })
  809. })
  810. }
  811. }
  812. })
  813. },
  814. goBack() {
  815. uni.navigateBack()
  816. },
  817. hasTaxonomyData() {
  818. return this.taxonomyTotalCount > 0
  819. },
  820. hasPathogenData() {
  821. return this.pathogenTotalCount > 0
  822. },
  823. // taxonomy/病原菌列表 key(微信小程序禁止 :key 表达式)
  824. getTaxonomyKey(prefix, idx) {
  825. return prefix + idx
  826. },
  827. // 舌诊指标标签映射
  828. indicatorLabel(code) {
  829. var map = {
  830. 'tongue_color': '舌色',
  831. 'coating_color': '苔色',
  832. 'coating_texture': '苔质',
  833. 'fissure': '裂纹',
  834. 'teeth_mark': '齿痕',
  835. 'sublingual_vein': '舌下静脉',
  836. 'constitution': '体质'
  837. }
  838. return map[code] || code
  839. }
  840. }
  841. }
  842. </script>
  843. <style scoped>
  844. .confirm-container {
  845. min-height: 100vh;
  846. background: #F5F7FA;
  847. }
  848. .nav-bar {
  849. position: sticky;
  850. top: 0;
  851. background: #fff;
  852. display: flex;
  853. flex-direction: row;
  854. align-items: center;
  855. justify-content: space-between;
  856. padding: 20rpx 30rpx;
  857. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  858. z-index: 100;
  859. }
  860. .nav-back { font-size: 32rpx; color: #5B9BD5; }
  861. .nav-title { font-size: 32rpx; font-weight: bold; color: #333; }
  862. .nav-placeholder { width: 80rpx; }
  863. .tip-banner {
  864. display: flex;
  865. flex-direction: row;
  866. align-items: center;
  867. background: #E8F5E9;
  868. margin: 20rpx 30rpx;
  869. padding: 20rpx 24rpx;
  870. border-radius: 16rpx;
  871. }
  872. .tip-icon { font-size: 32rpx; margin-right: 16rpx; flex-shrink: 0; }
  873. .tip-text { font-size: 24rpx; color: #2E7D32; line-height: 1.5; }
  874. .parsing-banner {
  875. display: flex;
  876. flex-direction: row;
  877. align-items: center;
  878. background: #FFF8E1;
  879. margin: 0 30rpx 20rpx;
  880. padding: 20rpx 24rpx;
  881. border-radius: 16rpx;
  882. }
  883. .parsing-icon { font-size: 32rpx; margin-right: 16rpx; flex-shrink: 0; }
  884. .parsing-text { font-size: 24rpx; color: #F57F17; line-height: 1.5; }
  885. .form-section { margin: 0 30rpx; }
  886. .card {
  887. background: #fff;
  888. border-radius: 16rpx;
  889. padding: 24rpx;
  890. margin-bottom: 20rpx;
  891. box-shadow: 0 2rpx 6rpx rgba(0,0,0,0.04);
  892. }
  893. .card-title {
  894. font-size: 28rpx;
  895. font-weight: bold;
  896. color: #333;
  897. margin-bottom: 20rpx;
  898. padding-bottom: 12rpx;
  899. border-bottom: 2rpx solid #F0F0F0;
  900. display: flex;
  901. flex-direction: row;
  902. align-items: center;
  903. flex-wrap: wrap;
  904. gap: 4rpx;
  905. }
  906. .title-count {
  907. font-size: 24rpx;
  908. font-weight: normal;
  909. color: #94A3B8;
  910. margin-left: 8rpx;
  911. }
  912. .title-abnormal {
  913. font-size: 24rpx;
  914. font-weight: normal;
  915. color: #C62828;
  916. }
  917. .card-title-actions {
  918. margin-left: auto;
  919. display: flex;
  920. flex-direction: row;
  921. gap: 16rpx;
  922. }
  923. .expand-all-btn {
  924. font-size: 22rpx;
  925. color: #5B9BD5;
  926. padding: 4rpx 12rpx;
  927. border: 2rpx solid #5B9BD5;
  928. border-radius: 20rpx;
  929. }
  930. .expand-all-btn:active { opacity: 0.7; }
  931. /* ===== 指标分组折叠 ===== */
  932. .indicator-group {
  933. border: 2rpx solid #E8EDF2;
  934. border-radius: 12rpx;
  935. margin-bottom: 12rpx;
  936. overflow: hidden;
  937. }
  938. .indicator-group-header {
  939. display: flex;
  940. flex-direction: row;
  941. align-items: center;
  942. justify-content: space-between;
  943. padding: 20rpx 16rpx;
  944. background: #F1F5F9;
  945. }
  946. .indicator-group-header:active { opacity: 0.8; }
  947. .indicator-group-header-left {
  948. display: flex;
  949. flex-direction: row;
  950. align-items: center;
  951. flex: 1;
  952. min-width: 0;
  953. }
  954. .indicator-group-arrow {
  955. font-size: 30rpx;
  956. color: #94A3B8;
  957. margin-right: 12rpx;
  958. transform: rotate(0deg);
  959. transition: transform 0.2s ease;
  960. flex-shrink: 0;
  961. }
  962. .indicator-group-arrow.arrow-open {
  963. transform: rotate(90deg);
  964. }
  965. .indicator-group-name {
  966. font-size: 26rpx;
  967. color: #333;
  968. font-weight: 600;
  969. flex: 1;
  970. min-width: 0;
  971. white-space: nowrap;
  972. overflow: hidden;
  973. text-overflow: ellipsis;
  974. }
  975. .indicator-group-header-right {
  976. display: flex;
  977. flex-direction: row;
  978. align-items: center;
  979. gap: 12rpx;
  980. flex-shrink: 0;
  981. margin-left: 12rpx;
  982. }
  983. .indicator-group-need {
  984. font-size: 20rpx;
  985. color: #E65100;
  986. background: #FFF3E0;
  987. padding: 4rpx 12rpx;
  988. border-radius: 20rpx;
  989. font-weight: 500;
  990. }
  991. .indicator-group-count {
  992. font-size: 22rpx;
  993. color: #94A3B8;
  994. }
  995. .indicator-group-abnormal {
  996. font-size: 22rpx;
  997. color: #C62828;
  998. font-weight: 500;
  999. margin-right: 8rpx;
  1000. }
  1001. .indicator-group-body {
  1002. padding: 16rpx;
  1003. }
  1004. .field-row {
  1005. display: flex;
  1006. flex-direction: row;
  1007. align-items: center;
  1008. margin-bottom: 16rpx;
  1009. }
  1010. .field-label {
  1011. font-size: 26rpx;
  1012. color: #666;
  1013. width: 160rpx;
  1014. flex-shrink: 0;
  1015. }
  1016. .field-value {
  1017. font-size: 26rpx;
  1018. color: #333;
  1019. font-weight: 500;
  1020. flex: 1;
  1021. }
  1022. .field-value.binding-required {
  1023. color: #E65100;
  1024. }
  1025. .member-select-row {
  1026. cursor: pointer;
  1027. }
  1028. .member-select-row:active {
  1029. opacity: 0.7;
  1030. }
  1031. .member-select-arrow {
  1032. font-size: 24rpx;
  1033. color: #5B9BD5;
  1034. margin-left: 12rpx;
  1035. flex-shrink: 0;
  1036. }
  1037. .member-panel {
  1038. background: #F8FAFB;
  1039. border-radius: 12rpx;
  1040. padding: 16rpx;
  1041. margin: 8rpx 0 16rpx;
  1042. }
  1043. .auto-create-inline {
  1044. margin-top: 16rpx;
  1045. padding-top: 16rpx;
  1046. border-top: 2rpx solid #E3F2FD;
  1047. }
  1048. .field-input {
  1049. flex: 1;
  1050. font-size: 26rpx;
  1051. color: #333;
  1052. padding: 8rpx 16rpx;
  1053. background: #F5F7FA;
  1054. border-radius: 8rpx;
  1055. }
  1056. .field-textarea {
  1057. width: 100%;
  1058. min-height: 120rpx;
  1059. font-size: 26rpx;
  1060. color: #333;
  1061. padding: 16rpx;
  1062. background: #F5F7FA;
  1063. border-radius: 12rpx;
  1064. box-sizing: border-box;
  1065. margin-top: 8rpx;
  1066. }
  1067. .member-list {
  1068. display: flex;
  1069. flex-direction: row;
  1070. flex-wrap: wrap;
  1071. gap: 16rpx;
  1072. }
  1073. .member-item {
  1074. display: flex;
  1075. flex-direction: column;
  1076. align-items: center;
  1077. padding: 20rpx 24rpx;
  1078. background: #F5F7FA;
  1079. border-radius: 16rpx;
  1080. border: 2rpx solid transparent;
  1081. min-width: 120rpx;
  1082. }
  1083. .member-selected {
  1084. background: #E3F2FD;
  1085. border-color: #5B9BD5;
  1086. }
  1087. .member-avatar {
  1088. width: 64rpx;
  1089. height: 64rpx;
  1090. border-radius: 50%;
  1091. background: #5B9BD5;
  1092. color: #fff;
  1093. font-size: 28rpx;
  1094. font-weight: bold;
  1095. text-align: center;
  1096. line-height: 64rpx;
  1097. margin-bottom: 8rpx;
  1098. }
  1099. .member-name { font-size: 24rpx; color: #333; }
  1100. .indicator-item {
  1101. background: #F8FAFB;
  1102. border-radius: 12rpx;
  1103. padding: 16rpx;
  1104. margin-bottom: 12rpx;
  1105. }
  1106. .ind-header {
  1107. display: flex;
  1108. flex-direction: row;
  1109. align-items: center;
  1110. gap: 12rpx;
  1111. }
  1112. .ind-name {
  1113. flex: 1;
  1114. font-size: 26rpx;
  1115. color: #333;
  1116. font-weight: 500;
  1117. padding: 4rpx 8rpx;
  1118. background: #fff;
  1119. border-radius: 6rpx;
  1120. }
  1121. .ind-value {
  1122. width: 160rpx;
  1123. font-size: 26rpx;
  1124. color: #1565C0;
  1125. font-weight: bold;
  1126. text-align: right;
  1127. padding: 4rpx 8rpx;
  1128. background: #fff;
  1129. border-radius: 6rpx;
  1130. }
  1131. .ind-detail {
  1132. display: flex;
  1133. flex-direction: row;
  1134. margin-top: 8rpx;
  1135. gap: 16rpx;
  1136. }
  1137. .ind-ref { font-size: 22rpx; color: #94A3B8; }
  1138. .ind-unit { font-size: 22rpx; color: #64748B; }
  1139. .ind-symptoms {
  1140. display: flex;
  1141. flex-direction: row;
  1142. align-items: center;
  1143. margin-top: 8rpx;
  1144. gap: 8rpx;
  1145. }
  1146. .ind-symptom-label { font-size: 22rpx; color: #94A3B8; flex-shrink: 0; }
  1147. .ind-symptom-input {
  1148. flex: 1;
  1149. font-size: 22rpx;
  1150. color: #333;
  1151. padding: 4rpx 8rpx;
  1152. background: #fff;
  1153. border-radius: 6rpx;
  1154. }
  1155. .status-tag {
  1156. display: inline-block;
  1157. font-size: 20rpx;
  1158. padding: 4rpx 12rpx;
  1159. border-radius: 8rpx;
  1160. font-weight: 500;
  1161. }
  1162. .status-normal { background: #E8F5E9; color: #2E7D32; }
  1163. .status-high { background: #FFF3E0; color: #E65100; }
  1164. .status-low { background: #E3F2FD; color: #1565C0; }
  1165. .status-abnormal { background: #FFEBEE; color: #C62828; }
  1166. /* ===== 指标帮助按钮 ===== */
  1167. .ind-help-btn {
  1168. width: 36rpx;
  1169. height: 36rpx;
  1170. border-radius: 50%;
  1171. background: #E2E8F0;
  1172. color: #64748B;
  1173. font-size: 24rpx;
  1174. font-weight: bold;
  1175. text-align: center;
  1176. line-height: 36rpx;
  1177. flex-shrink: 0;
  1178. }
  1179. .ind-help-btn:active {
  1180. background: #CBD5E1;
  1181. }
  1182. /* ===== 指标输入框颜色状态 ===== */
  1183. .ind-name-normal, .ind-value-normal {
  1184. background: #fff;
  1185. }
  1186. .ind-name-high, .ind-value-high,
  1187. .ind-name-low, .ind-value-low,
  1188. .ind-name-abnormal, .ind-value-abnormal,
  1189. .ind-name-deficient, .ind-value-deficient,
  1190. .ind-name-insufficient, .ind-value-insufficient,
  1191. .ind-name-warning, .ind-value-warning,
  1192. .ind-name-high-risk, .ind-value-high-risk,
  1193. .ind-name-low-risk, .ind-value-low-risk,
  1194. .ind-name-not-detected, .ind-value-not-detected {
  1195. background: #FFF0F0;
  1196. color: #C62828;
  1197. }
  1198. /* ===== 指标帮助弹窗 ===== */
  1199. .help-overlay {
  1200. position: fixed;
  1201. top: 0;
  1202. left: 0;
  1203. right: 0;
  1204. bottom: 0;
  1205. background: rgba(0,0,0,0.4);
  1206. z-index: 999;
  1207. display: flex;
  1208. align-items: center;
  1209. justify-content: center;
  1210. }
  1211. .help-popup {
  1212. width: 580rpx;
  1213. max-height: 70vh;
  1214. background: #fff;
  1215. border-radius: 24rpx;
  1216. overflow: hidden;
  1217. }
  1218. .help-popup-header {
  1219. display: flex;
  1220. flex-direction: row;
  1221. align-items: center;
  1222. justify-content: space-between;
  1223. padding: 28rpx 30rpx;
  1224. border-bottom: 2rpx solid #F0F0F0;
  1225. }
  1226. .help-popup-title {
  1227. font-size: 30rpx;
  1228. font-weight: bold;
  1229. color: #333;
  1230. flex: 1;
  1231. }
  1232. .help-popup-close {
  1233. font-size: 32rpx;
  1234. color: #999;
  1235. padding: 8rpx;
  1236. }
  1237. .help-popup-body {
  1238. padding: 24rpx 30rpx;
  1239. }
  1240. .help-row {
  1241. display: flex;
  1242. flex-direction: row;
  1243. align-items: center;
  1244. margin-bottom: 16rpx;
  1245. }
  1246. .help-label {
  1247. font-size: 26rpx;
  1248. color: #94A3B8;
  1249. width: 140rpx;
  1250. flex-shrink: 0;
  1251. }
  1252. .help-value {
  1253. font-size: 28rpx;
  1254. color: #333;
  1255. font-weight: 500;
  1256. flex: 1;
  1257. }
  1258. .help-status-normal { color: #2E7D32; }
  1259. .help-status-high { color: #C62828; }
  1260. .help-status-low { color: #1565C0; }
  1261. .help-status-abnormal { color: #C62828; }
  1262. .help-desc {
  1263. margin-top: 8rpx;
  1264. padding: 20rpx;
  1265. background: #F8FAFB;
  1266. border-radius: 12rpx;
  1267. }
  1268. .help-desc-label {
  1269. display: block;
  1270. font-size: 24rpx;
  1271. color: #94A3B8;
  1272. margin-bottom: 8rpx;
  1273. }
  1274. .help-desc-text {
  1275. display: block;
  1276. font-size: 26rpx;
  1277. color: #333;
  1278. line-height: 1.6;
  1279. }
  1280. .flora-item {
  1281. display: flex;
  1282. flex-direction: row;
  1283. align-items: center;
  1284. gap: 12rpx;
  1285. padding: 12rpx 16rpx;
  1286. background: #F8FAFB;
  1287. border-radius: 10rpx;
  1288. margin-bottom: 8rpx;
  1289. }
  1290. .flora-name {
  1291. flex: 1;
  1292. font-size: 26rpx;
  1293. color: #333;
  1294. padding: 4rpx 8rpx;
  1295. background: #fff;
  1296. border-radius: 6rpx;
  1297. }
  1298. .flora-abundance {
  1299. width: 140rpx;
  1300. font-size: 26rpx;
  1301. color: #1565C0;
  1302. text-align: right;
  1303. padding: 4rpx 8rpx;
  1304. background: #fff;
  1305. border-radius: 6rpx;
  1306. }
  1307. .taxonomy-group {
  1308. margin-bottom: 16rpx;
  1309. }
  1310. .taxonomy-group:last-child {
  1311. margin-bottom: 0;
  1312. }
  1313. .taxonomy-group-label {
  1314. display: block;
  1315. font-size: 24rpx;
  1316. font-weight: 500;
  1317. color: #666;
  1318. padding: 8rpx 4rpx 6rpx;
  1319. }
  1320. .pathogen-group {
  1321. margin-bottom: 16rpx;
  1322. }
  1323. .pathogen-group:last-child {
  1324. margin-bottom: 0;
  1325. }
  1326. .pathogen-group-label {
  1327. display: block;
  1328. font-size: 24rpx;
  1329. font-weight: 500;
  1330. color: #D32F2F;
  1331. padding: 8rpx 4rpx 6rpx;
  1332. }
  1333. .risk-item {
  1334. display: flex;
  1335. flex-direction: row;
  1336. align-items: center;
  1337. gap: 12rpx;
  1338. padding: 12rpx 16rpx;
  1339. background: #F8FAFB;
  1340. border-radius: 10rpx;
  1341. margin-bottom: 8rpx;
  1342. }
  1343. .risk-name {
  1344. flex: 1;
  1345. font-size: 26rpx;
  1346. color: #333;
  1347. padding: 4rpx 8rpx;
  1348. background: #fff;
  1349. border-radius: 6rpx;
  1350. }
  1351. .risk-level {
  1352. font-size: 22rpx;
  1353. font-weight: 500;
  1354. padding: 4rpx 12rpx;
  1355. border-radius: 8rpx;
  1356. }
  1357. .risk-low { background: #E8F5E9; color: #2E7D32; }
  1358. .risk-medium, .risk-moderate { background: #FFF3E0; color: #E65100; }
  1359. .risk-high { background: #FFEBEE; color: #C62828; }
  1360. .food-item {
  1361. display: flex;
  1362. flex-direction: row;
  1363. align-items: center;
  1364. gap: 12rpx;
  1365. padding: 12rpx 16rpx;
  1366. background: #F8FAFB;
  1367. border-radius: 10rpx;
  1368. margin-bottom: 8rpx;
  1369. }
  1370. .food-name {
  1371. flex: 1;
  1372. font-size: 26rpx;
  1373. color: #333;
  1374. padding: 4rpx 8rpx;
  1375. background: #fff;
  1376. border-radius: 6rpx;
  1377. }
  1378. .food-category {
  1379. width: 160rpx;
  1380. font-size: 24rpx;
  1381. color: #64748B;
  1382. text-align: right;
  1383. padding: 4rpx 8rpx;
  1384. background: #fff;
  1385. border-radius: 6rpx;
  1386. }
  1387. .action-row {
  1388. display: flex;
  1389. flex-direction: row;
  1390. gap: 20rpx;
  1391. margin-top: 10rpx;
  1392. margin-bottom: 20rpx;
  1393. }
  1394. .btn-discard {
  1395. flex: 1;
  1396. background: #fff;
  1397. border: 2rpx solid #EF4444;
  1398. color: #EF4444;
  1399. font-size: 28rpx;
  1400. font-weight: bold;
  1401. text-align: center;
  1402. padding: 24rpx;
  1403. border-radius: 16rpx;
  1404. }
  1405. .btn-discard:active { opacity: 0.7; }
  1406. .btn-confirm {
  1407. flex: 2;
  1408. background: linear-gradient(135deg, #5B9BD5, #3A7CC4);
  1409. color: #fff;
  1410. font-size: 28rpx;
  1411. font-weight: bold;
  1412. text-align: center;
  1413. padding: 24rpx;
  1414. border-radius: 16rpx;
  1415. }
  1416. .btn-confirm:active { opacity: 0.85; }
  1417. .btn-disabled { opacity: 0.5; }
  1418. .bottom-spacer { height: 80rpx; }
  1419. /* ===== Phase 2: 匹配可信度 ===== */
  1420. .confidence-card {
  1421. margin: 0 30rpx 20rpx;
  1422. background: #fff;
  1423. border-radius: 16rpx;
  1424. padding: 24rpx;
  1425. box-shadow: 0 2rpx 6rpx rgba(0,0,0,0.04);
  1426. }
  1427. .confidence-header {
  1428. display: flex;
  1429. flex-direction: row;
  1430. align-items: center;
  1431. justify-content: space-between;
  1432. margin-bottom: 16rpx;
  1433. }
  1434. .confidence-label {
  1435. font-size: 26rpx;
  1436. color: #333;
  1437. font-weight: 500;
  1438. }
  1439. .confidence-badge {
  1440. font-size: 22rpx;
  1441. font-weight: bold;
  1442. padding: 4rpx 16rpx;
  1443. border-radius: 20rpx;
  1444. }
  1445. .badge-high { background: #E8F5E9; color: #2E7D32; }
  1446. .badge-medium { background: #FFF8E1; color: #F57F17; }
  1447. .badge-low { background: #FFF3E0; color: #E65100; }
  1448. .badge-none { background: #FFEBEE; color: #C62828; }
  1449. .confidence-bar-track {
  1450. height: 12rpx;
  1451. background: #E2E8F0;
  1452. border-radius: 6rpx;
  1453. overflow: hidden;
  1454. margin-bottom: 12rpx;
  1455. }
  1456. .confidence-bar-fill {
  1457. height: 100%;
  1458. border-radius: 6rpx;
  1459. transition: width 0.3s ease;
  1460. }
  1461. .fill-high { background: linear-gradient(90deg, #66BB6A, #43A047); }
  1462. .fill-medium { background: linear-gradient(90deg, #FFD54F, #FFC107); }
  1463. .fill-low { background: linear-gradient(90deg, #FF8A65, #FF5722); }
  1464. .fill-none { background: linear-gradient(90deg, #EF9A9A, #E53935); }
  1465. .confidence-desc {
  1466. font-size: 22rpx;
  1467. color: #94A3B8;
  1468. line-height: 1.4;
  1469. }
  1470. /* ===== Phase 2: 候选成员列表 ===== */
  1471. .candidate-section {
  1472. margin-bottom: 16rpx;
  1473. }
  1474. .candidate-section-hint {
  1475. display: block;
  1476. font-size: 24rpx;
  1477. color: #64748B;
  1478. margin-bottom: 12rpx;
  1479. }
  1480. .candidate-item {
  1481. display: flex;
  1482. flex-direction: row;
  1483. align-items: center;
  1484. justify-content: space-between;
  1485. padding: 16rpx;
  1486. background: #F8FAFB;
  1487. border-radius: 12rpx;
  1488. margin-bottom: 10rpx;
  1489. border: 2rpx solid transparent;
  1490. }
  1491. .candidate-item:active { opacity: 0.8; }
  1492. .candidate-selected {
  1493. background: #E3F2FD;
  1494. border-color: #5B9BD5;
  1495. }
  1496. .candidate-left {
  1497. display: flex;
  1498. flex-direction: row;
  1499. align-items: center;
  1500. flex: 1;
  1501. min-width: 0;
  1502. }
  1503. .candidate-avatar {
  1504. width: 56rpx;
  1505. height: 56rpx;
  1506. border-radius: 50%;
  1507. background: #5B9BD5;
  1508. color: #fff;
  1509. font-size: 24rpx;
  1510. font-weight: bold;
  1511. text-align: center;
  1512. line-height: 56rpx;
  1513. margin-right: 16rpx;
  1514. flex-shrink: 0;
  1515. }
  1516. .candidate-info {
  1517. flex: 1;
  1518. min-width: 0;
  1519. }
  1520. .candidate-name {
  1521. font-size: 26rpx;
  1522. color: #333;
  1523. font-weight: 500;
  1524. display: block;
  1525. }
  1526. .candidate-detail {
  1527. font-size: 22rpx;
  1528. color: #94A3B8;
  1529. display: block;
  1530. }
  1531. .candidate-fields {
  1532. font-size: 20rpx;
  1533. color: #5B9BD5;
  1534. display: block;
  1535. margin-top: 2rpx;
  1536. }
  1537. .candidate-right {
  1538. display: flex;
  1539. flex-direction: row;
  1540. align-items: center;
  1541. gap: 12rpx;
  1542. flex-shrink: 0;
  1543. margin-left: 16rpx;
  1544. }
  1545. .score-bar-track {
  1546. width: 80rpx;
  1547. height: 10rpx;
  1548. background: #E2E8F0;
  1549. border-radius: 5rpx;
  1550. overflow: hidden;
  1551. }
  1552. .score-bar-fill {
  1553. height: 100%;
  1554. background: linear-gradient(90deg, #5B9BD5, #3A7CC4);
  1555. border-radius: 5rpx;
  1556. }
  1557. .score-text {
  1558. font-size: 24rpx;
  1559. color: #1565C0;
  1560. font-weight: bold;
  1561. min-width: 48rpx;
  1562. text-align: right;
  1563. }
  1564. /* ===== Phase 2: 新建成员入口 ===== */
  1565. .create-member-entry {
  1566. display: flex;
  1567. flex-direction: row;
  1568. align-items: center;
  1569. justify-content: center;
  1570. padding: 20rpx;
  1571. border: 2rpx dashed #CBD5E1;
  1572. border-radius: 12rpx;
  1573. margin-top: 8rpx;
  1574. }
  1575. .create-member-entry:active { background: #F1F5F9; }
  1576. .create-member-icon {
  1577. font-size: 28rpx;
  1578. color: #5B9BD5;
  1579. font-weight: bold;
  1580. margin-right: 8rpx;
  1581. }
  1582. .create-member-text {
  1583. font-size: 24rpx;
  1584. color: #5B9BD5;
  1585. }
  1586. /* ===== Phase 2: 新建成员表单(面板内嵌) ===== */
  1587. .form-item {
  1588. display: flex;
  1589. flex-direction: row;
  1590. align-items: center;
  1591. margin-bottom: 20rpx;
  1592. }
  1593. .form-item-label {
  1594. font-size: 26rpx;
  1595. color: #333;
  1596. width: 100rpx;
  1597. flex-shrink: 0;
  1598. }
  1599. .form-item-input {
  1600. flex: 1;
  1601. font-size: 26rpx;
  1602. color: #333;
  1603. padding: 12rpx 16rpx;
  1604. background: #F5F7FA;
  1605. border-radius: 10rpx;
  1606. }
  1607. .gender-selector {
  1608. display: flex;
  1609. flex-direction: row;
  1610. gap: 16rpx;
  1611. }
  1612. .gender-option {
  1613. font-size: 26rpx;
  1614. color: #333;
  1615. padding: 12rpx 32rpx;
  1616. background: #F5F7FA;
  1617. border-radius: 10rpx;
  1618. border: 2rpx solid transparent;
  1619. }
  1620. .gender-option:active { opacity: 0.7; }
  1621. .gender-selected {
  1622. background: #E3F2FD;
  1623. border-color: #5B9BD5;
  1624. color: #1565C0;
  1625. }
  1626. .btn-create-submit {
  1627. background: linear-gradient(135deg, #5B9BD5, #3A7CC4);
  1628. color: #fff;
  1629. font-size: 28rpx;
  1630. font-weight: bold;
  1631. text-align: center;
  1632. padding: 22rpx;
  1633. border-radius: 14rpx;
  1634. margin-top: 10rpx;
  1635. }
  1636. .btn-create-submit:active { opacity: 0.85; }
  1637. /* ===== 舌诊指标 ===== */
  1638. .tongue-indicator-grid {
  1639. display: flex;
  1640. flex-direction: row;
  1641. flex-wrap: wrap;
  1642. gap: 12rpx;
  1643. }
  1644. .tongue-ind-item {
  1645. width: calc(50% - 6rpx);
  1646. background: #F8FAFC;
  1647. border-radius: 16rpx;
  1648. padding: 20rpx 24rpx;
  1649. box-sizing: border-box;
  1650. }
  1651. .tongue-ind-label {
  1652. display: block;
  1653. font-size: 24rpx;
  1654. color: #94A3B8;
  1655. margin-bottom: 8rpx;
  1656. }
  1657. .tongue-ind-value {
  1658. display: block;
  1659. font-size: 28rpx;
  1660. color: #1E293B;
  1661. font-weight: 500;
  1662. }
  1663. .tongue-summary {
  1664. margin-top: 20rpx;
  1665. padding: 20rpx 24rpx;
  1666. background: #FFF8E1;
  1667. border-radius: 16rpx;
  1668. }
  1669. .tongue-summary-title {
  1670. font-size: 24rpx;
  1671. color: #F59E0B;
  1672. font-weight: 600;
  1673. display: block;
  1674. margin-bottom: 8rpx;
  1675. }
  1676. .tongue-summary-text {
  1677. font-size: 26rpx;
  1678. color: #333;
  1679. line-height: 1.6;
  1680. }
  1681. </style>