| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229 |
- <template>
- <view class="page">
- <!-- native navigation bar used, no custom header -->
- <scroll-view class="content" scroll-y>
- <!-- 报告头 -->
- <view class="report-head" v-if="headInfo">
- <view class="head-name">{{ headInfo.personName || headInfo.childName || '健康报告' }}</view>
- <view class="head-meta">
- <text class="type-badge">{{ typeLabel }}</text>
- <text class="head-date">{{ headInfo.reportDateText || '' }}</text>
- </view>
- </view>
- <!-- view mode -->
- <view v-if="pageMode==='view'">
- <report-blocks-renderer v-if="blocks && blocks.length > 0" :blocks="blocks" @help="onBlockHelp" />
- <view class="empty-hint" v-else>暂无报告内容</view>
- <view class="edit-btn" v-if="isGutFlora && pageMode==='view'">
- <view class="nav-edit" @tap="enterEditMode"><text>{{ backendBlocksExist ? '编辑' : '查看完整数据 ›' }}</text></view>
- </view>
- </view>
- <!-- draft/edit mode (full form) -->
- <view v-else>
- <!-- 解析中状态(仅 draft 模式,从上传页跳转后自动解析) -->
- <view class="parsing-banner" v-if="parsing">
- <view class="parsing-spinner"></view>
- <view class="parsing-content">
- <text class="parsing-main-text">AI 正在解析您的报告</text>
- <text class="parsing-sub-text" :key="parsingStep">{{ parsingText }}</text>
- </view>
- </view>
- <view class="tip-banner">
- <text class="tip-icon">✅</text>
- <text class="tip-text">{{ pageMode === 'draft' ? '请核对以下解析内容,可修改后确认入库' : '请核对报告内容,可修改后保存' }}</text>
- </view>
- <!-- 匹配可信度(仅 draft 模式) -->
- <view class="confidence-card" v-if="confidenceLevelClass">
- <view class="confidence-header">
- <text class="confidence-label">匹配可信度</text>
- <text class="confidence-badge" :class="'badge-' + confidenceLevelClass">{{ confidenceLevelText }}</text>
- </view>
- <view class="confidence-bar-track">
- <view class="confidence-bar-fill" :class="'fill-' + confidenceLevelClass" :style="'width:' + confidencePercent + '%'"></view>
- </view>
- <text class="confidence-desc">{{ confidenceDesc }}</text>
- </view>
- <view class="form-section">
- <!-- 基本信息 -->
- <view class="card">
- <view class="card-title">基本信息</view>
- <view class="field-row member-select-row" @click="toggleMemberPanel">
- <text class="field-label">被检测人</text>
- <text class="field-value" :class="{ 'binding-required': needBind && !selectedMemberObj }">{{ memberDisplayText }}</text>
- <text class="member-select-arrow">{{ selectedMemberObj ? '修改 ›' : '选择 ›' }}</text>
- </view>
- <!-- 被检测人选择面板(内联展开) -->
- <view class="member-panel" v-if="showMemberPanel">
- <!-- 候选匹配列表(按置信度排序) -->
- <view class="candidate-section" v-if="candidates.length > 0">
- <text class="candidate-section-hint">以下成员与报告信息匹配,请选择:</text>
- <view
- class="candidate-item"
- v-for="(cand, idx) in candidates"
- :key="idx"
- :class="{ 'candidate-selected': selectedMemberId === (cand.id || cand.userId) }"
- @click="selectAndClose(cand)"
- >
- <view class="candidate-left">
- <text class="candidate-avatar">{{ (cand.nickname || cand.name || '?').substring(0, 1) }}</text>
- <view class="candidate-info">
- <text class="candidate-name">{{ cand.nickname || cand.name || '未知' }}</text>
- <text class="candidate-detail" v-if="cand.gender || cand.age">{{ genderText(cand.gender) }}{{ cand.age ? ' · ' + cand.age + '岁' : '' }}</text>
- <text class="candidate-fields" v-if="cand.matchFields">匹配: {{ cand.matchFields }}</text>
- </view>
- </view>
- <view class="candidate-right">
- <view class="score-bar-track">
- <view class="score-bar-fill" :style="'width:' + (cand.similarityScore * 100) + '%'"></view>
- </view>
- <text class="score-text">{{ Math.round(cand.similarityScore * 100) }}%</text>
- </view>
- </view>
- </view>
- <!-- 全量家庭成员列表(始终显示,候选区已展示的成员去重) -->
- <view class="member-list" v-if="familyMembers.length > 0">
- <text class="member-list-hint" v-if="candidates.length > 0">全部成员({{ otherMembers.length }} 人)</text>
- <view
- class="member-item"
- v-for="(member, mIdx) in otherMembers"
- :key="mIdx"
- :class="{ 'member-selected': selectedMemberId === (member.userId || member.id) }"
- @click="selectAndClose(member)"
- >
- <text class="member-avatar">{{ (member.nickname || '?').substring(0, 1) }}</text>
- <text class="member-name">{{ member.nickname || '未知' }}</text>
- </view>
- </view>
- <!-- 不绑定成员(仅编辑模式:解绑当前报告,不纳入家庭维度计算) -->
- <view class="member-item unbind-member" v-if="pageMode === 'edit'" @click="unbindMember">
- <text class="member-avatar unbind-avatar">✕</text>
- <text class="member-name">不绑定成员</text>
- </view>
- <!-- 新建成员入口 -->
- <view class="create-member-entry" @click="toggleAutoCreate">
- <text class="create-member-icon">+</text>
- <text class="create-member-text">{{ showAutoCreateForm ? '收起新建表单' : '不在列表中?新建家庭成员' }}</text>
- </view>
- <!-- 新建成员表单(面板内嵌) -->
- <view class="auto-create-inline" v-if="showAutoCreateForm">
- <view class="form-item">
- <text class="form-item-label">姓名</text>
- <input class="form-item-input" v-model="newMember.name" placeholder="请输入姓名" />
- </view>
- <view class="form-item">
- <text class="form-item-label">性别</text>
- <view class="gender-selector">
- <text class="gender-option" :class="{ 'gender-selected': newMember.gender === 'male' }" @click="newMember.gender = 'male'">男</text>
- <text class="gender-option" :class="{ 'gender-selected': newMember.gender === 'female' }" @click="newMember.gender = 'female'">女</text>
- </view>
- </view>
- <view class="form-item">
- <text class="form-item-label">年龄</text>
- <input class="form-item-input" type="number" v-model="newMember.age" placeholder="请输入年龄" />
- </view>
- <view class="btn-create-submit" :class="{ 'btn-disabled': creatingMember }" @click="doAutoCreate">
- <text v-if="creatingMember">创建中...</text>
- <text v-else>确认创建</text>
- </view>
- </view>
- </view>
- <view class="field-row" v-if="extractedGender">
- <text class="field-label">性别</text>
- <text class="field-value">{{ extractedGender === 'male' ? '男' : extractedGender === 'female' ? '女' : extractedGender }}</text>
- </view>
- <view class="field-row" v-if="extractedAge">
- <text class="field-label">年龄</text>
- <text class="field-value">{{ extractedAge }}</text>
- </view>
- <view class="field-row" v-if="payload.summary && payload.type !== 'tongue'">
- <text class="field-label">综合评分</text>
- <input class="field-input" type="number" v-model="payload.summary.overallScore" />
- </view>
- <view class="field-row" v-if="payload.summary">
- <text class="field-label">报告日期</text>
- <input class="field-input" type="text" v-model="payload.summary.reportDate" placeholder="如: 2025-06-15" />
- </view>
- <view class="field-row" v-if="payload.summary && payload.type !== 'tongue'">
- <text class="field-label">报告摘要</text>
- <textarea class="field-textarea" v-model="payload.summary.summary" maxlength="500" />
- </view>
- </view>
- <!-- 舌诊指标(只读展示) -->
- <view class="card" v-if="payload.type === 'tongue' && payload.indicators && payload.indicators.length">
- <view class="card-title">舌象指标</view>
- <view class="tongue-indicator-grid">
- <view class="tongue-ind-item" v-for="(ind, idx) in payload.indicators" :key="idx">
- <text class="tongue-ind-label">{{ indicatorLabel(ind.code) }}</text>
- <text class="tongue-ind-value">{{ ind.value }}</text>
- </view>
- </view>
- <view class="tongue-summary" v-if="payload.summary && payload.summary.overallAssessment">
- <text class="tongue-summary-title">综合评估</text>
- <text class="tongue-summary-text">{{ payload.summary.overallAssessment }}</text>
- </view>
- </view>
- <!-- 健康指标(舌诊时隐藏,使用上方舌象指标卡片) -->
- <view class="card" v-if="payload.type !== 'tongue' && payload.indicators && payload.indicators.length">
- <view class="card-title">
- <text>健康指标</text>
- <text class="title-count">共 {{ payload.indicators.length }} 项</text>
- <text class="title-abnormal" v-if="totalAbnormalCount > 0">,{{ totalAbnormalCount }} 项异常</text>
- <view class="card-title-actions">
- <text class="expand-all-btn" @click="toggleAllGroups(true)">全部展开</text>
- <text class="expand-all-btn" @click="toggleAllGroups(false)">全部折叠</text>
- </view>
- </view>
- <!-- 按指标类型分组折叠 -->
- <view class="indicator-group" v-for="(group, gIdx) in indicatorGroups" :key="gIdx">
- <view class="indicator-group-header" @click="toggleGroup(gIdx)">
- <view class="indicator-group-header-left">
- <text class="indicator-group-arrow" :class="{ 'arrow-open': groupExpandList[gIdx] }">›</text>
- <text class="indicator-group-name">{{ group.category }}</text>
- </view>
- <view class="indicator-group-header-right">
- <text class="indicator-group-abnormal" v-if="group.abnormalCount > 0">{{ group.abnormalCount }} 项异常</text>
- <text class="indicator-group-count">{{ group.items.length }} 项</text>
- </view>
- </view>
- <view class="indicator-group-body" v-if="groupExpandList[gIdx]">
- <view class="indicator-item" v-for="(ind, idx) in group.items" :key="idx">
- <view class="ind-header">
- <text class="ind-help-btn" @click.stop="showHelp(ind)">?</text>
- <input class="ind-name" :class="'ind-name-' + _cssClass(ind.status)" v-model="ind.indicatorName" />
- <input class="ind-value" :class="'ind-value-' + _cssClass(ind.status)" v-model="ind.indicatorValue" />
- </view>
- <view class="ind-detail" v-if="ind.unit || ind.refRange">
- <text class="ind-ref" v-if="ind.refRange">参考: {{ ind.refRange }}</text>
- <text class="ind-unit" v-if="ind.unit">{{ ind.unit }}</text>
- </view>
- <view class="ind-symptoms" v-if="ind.symptoms">
- <text class="ind-symptom-label">症状:</text>
- <input class="ind-symptom-input" v-model="ind.symptoms" />
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 肠道菌群 -->
- <view class="card" v-if="payload.gutFlora && payload.gutFlora.length">
- <view class="card-title collapsible-title" @click="toggleCollapse('gutFlora')">
- <text>肠道菌群 ({{ payload.gutFlora.length }})</text>
- <text class="collapse-arrow" :class="{ 'arrow-open': collapseState.gutFlora }">›</text>
- </view>
- <view v-if="collapseState.gutFlora">
- <view class="flora-item" v-for="(flora, idx) in payload.gutFlora" :key="idx">
- <input class="flora-name" v-model="payload.gutFlora[idx].name" />
- <input class="flora-abundance" type="digit" v-model="payload.gutFlora[idx].abundance" />
- <view class="status-tag" :class="'status-' + _cssClass(flora.status)">
- {{ statusText(flora.status) }}
- </view>
- </view>
- </view>
- </view>
- <!-- 疾病风险 -->
- <view class="card" v-if="payload.diseaseRisks && payload.diseaseRisks.length">
- <view class="card-title collapsible-title" @click="toggleCollapse('diseaseRisk')">
- <text>疾病风险 ({{ payload.diseaseRisks.length }})</text>
- <text class="collapse-arrow" :class="{ 'arrow-open': collapseState.diseaseRisk }">›</text>
- </view>
- <view v-if="collapseState.diseaseRisk">
- <view class="risk-item" v-for="(risk, idx) in payload.diseaseRisks" :key="idx">
- <input class="risk-name" v-model="payload.diseaseRisks[idx].diseaseName" />
- <view class="risk-level" :class="'risk-' + (risk.riskLevel || 'low')">
- {{ riskLevelText(risk.riskLevel) }}
- </view>
- </view>
- </view>
- </view>
- <!-- 益生菌种 -->
- <view class="card" v-if="payload.probioticSpecies && payload.probioticSpecies.length">
- <view class="card-title collapsible-title" @click="toggleCollapse('probiotic')">
- <text>益生菌种 ({{ payload.probioticSpecies.length }})</text>
- <text class="collapse-arrow" :class="{ 'arrow-open': collapseState.probiotic }">›</text>
- </view>
- <view v-if="collapseState.probiotic">
- <view class="flora-item" v-for="(flora, idx) in payload.probioticSpecies" :key="idx">
- <input class="flora-name" v-model="payload.probioticSpecies[idx].name" />
- <input class="flora-abundance" type="digit" v-model="payload.probioticSpecies[idx].abundance" />
- <view class="status-tag" :class="'status-' + _cssClass(flora.status)">
- {{ statusText(flora.status) }}
- </view>
- </view>
- </view>
- </view>
- <!-- Taxonomy 分类(纲/目/科/属/种) -->
- <view class="card" v-if="hasTaxonomyData()">
- <view class="card-title collapsible-title" @click="toggleCollapse('taxonomy')">
- <text>菌群分类组成 ({{ taxonomyTotalCount }})</text>
- <text class="collapse-arrow" :class="{ 'arrow-open': collapseState.taxonomy }">›</text>
- </view>
- <view v-if="collapseState.taxonomy">
- <view class="taxonomy-group" v-if="payload.taxonomyClass && payload.taxonomyClass.length">
- <text class="taxonomy-group-label">菌纲 (Class)</text>
- <view class="flora-item" v-for="(flora, idx) in payload.taxonomyClass" :key="getTaxonomyKey('c', idx)">
- <input class="flora-name" v-model="payload.taxonomyClass[idx].name" />
- <input class="flora-abundance" type="digit" v-model="payload.taxonomyClass[idx].abundance" />
- </view>
- </view>
- <view class="taxonomy-group" v-if="payload.taxonomyOrder && payload.taxonomyOrder.length">
- <text class="taxonomy-group-label">菌目 (Order)</text>
- <view class="flora-item" v-for="(flora, idx) in payload.taxonomyOrder" :key="getTaxonomyKey('o', idx)">
- <input class="flora-name" v-model="payload.taxonomyOrder[idx].name" />
- <input class="flora-abundance" type="digit" v-model="payload.taxonomyOrder[idx].abundance" />
- </view>
- </view>
- <view class="taxonomy-group" v-if="payload.taxonomyFamily && payload.taxonomyFamily.length">
- <text class="taxonomy-group-label">菌科 (Family)</text>
- <view class="flora-item" v-for="(flora, idx) in payload.taxonomyFamily" :key="getTaxonomyKey('f', idx)">
- <input class="flora-name" v-model="payload.taxonomyFamily[idx].name" />
- <input class="flora-abundance" type="digit" v-model="payload.taxonomyFamily[idx].abundance" />
- </view>
- </view>
- <view class="taxonomy-group" v-if="payload.taxonomyGenus && payload.taxonomyGenus.length">
- <text class="taxonomy-group-label">菌属 (Genus)</text>
- <view class="flora-item" v-for="(flora, idx) in payload.taxonomyGenus" :key="getTaxonomyKey('g', idx)">
- <input class="flora-name" v-model="payload.taxonomyGenus[idx].name" />
- <input class="flora-abundance" type="digit" v-model="payload.taxonomyGenus[idx].abundance" />
- </view>
- </view>
- <view class="taxonomy-group" v-if="payload.taxonomySpecies && payload.taxonomySpecies.length">
- <text class="taxonomy-group-label">菌种 (Species)</text>
- <view class="flora-item" v-for="(flora, idx) in payload.taxonomySpecies" :key="getTaxonomyKey('s', idx)">
- <input class="flora-name" v-model="payload.taxonomySpecies[idx].name" />
- <input class="flora-abundance" type="digit" v-model="payload.taxonomySpecies[idx].abundance" />
- </view>
- </view>
- </view>
- </view>
- <!-- 病原菌 -->
- <view class="card" v-if="hasPathogenData()">
- <view class="card-title collapsible-title" @click="toggleCollapse('pathogen')">
- <text>病原菌 ({{ pathogenTotalCount }})</text>
- <text class="collapse-arrow" :class="{ 'arrow-open': collapseState.pathogen }">›</text>
- </view>
- <view v-if="collapseState.pathogen">
- <view class="pathogen-group" v-if="payload.pathogenGenus && payload.pathogenGenus.length">
- <text class="pathogen-group-label">病原菌属</text>
- <view class="flora-item" v-for="(flora, idx) in payload.pathogenGenus" :key="getTaxonomyKey('pg', idx)">
- <input class="flora-name" v-model="payload.pathogenGenus[idx].name" />
- <input class="flora-abundance" type="digit" v-model="payload.pathogenGenus[idx].abundance" />
- <view class="status-tag" :class="'status-' + _cssClass(flora.status)">
- {{ statusText(flora.status) }}
- </view>
- </view>
- </view>
- <view class="pathogen-group" v-if="payload.pathogenDetection && payload.pathogenDetection.length">
- <text class="pathogen-group-label">病原菌检出</text>
- <view class="flora-item" v-for="(flora, idx) in payload.pathogenDetection" :key="getTaxonomyKey('pd', idx)">
- <input class="flora-name" v-model="payload.pathogenDetection[idx].name" />
- <input class="flora-abundance" type="digit" v-model="payload.pathogenDetection[idx].abundance" />
- <view class="status-tag" :class="'status-' + _cssClass(flora.status)">
- {{ statusText(flora.status) }}
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 操作按钮(draft: 放弃/确认入库; edit: 取消/保存) -->
- <view class="action-row">
- <view class="btn-discard" @click="handleLeftAction">
- <text>{{ pageMode === 'draft' ? '放弃' : '取消' }}</text>
- </view>
- <view class="btn-confirm" :class="{ 'btn-disabled': pageMode === 'draft' && !canConfirm }" @click="handleRightAction">
- <text v-if="pageMode === 'draft' && confirming">确认中...</text>
- <text v-else>{{ pageMode === 'draft' ? '确认入库' : '保存' }}</text>
- </view>
- </view>
- </view>
- <view class="bottom-spacer"></view>
- </view>
- </scroll-view>
- <!-- 指标帮助弹窗(置于 scroll-view 外,position:fixed 覆盖视口) -->
- <view class="help-overlay" v-if="showHelpPopup" @click="closeHelp">
- <view class="help-popup" @click.stop>
- <view class="help-popup-header">
- <text class="help-popup-title">{{ helpData.name }}</text>
- <text class="help-popup-close" @click="closeHelp">✕</text>
- </view>
- <view class="help-popup-body">
- <view class="help-row">
- <text class="help-label">当前值</text>
- <text class="help-value">{{ helpData.value }}</text>
- </view>
- <view class="help-row" v-if="helpData.refRange">
- <text class="help-label">参考范围</text>
- <text class="help-value">{{ helpData.refRange }}</text>
- </view>
- <view class="help-row">
- <text class="help-label">状态</text>
- <text class="help-value" :class="'help-status-' + _cssClass(helpData.status)">{{ statusText(helpData.status) }}</text>
- </view>
- <view class="help-desc" v-if="helpData.description">
- <text class="help-desc-label">说明</text>
- <text class="help-desc-text">{{ helpData.description }}</text>
- </view>
- <view class="help-desc" v-else>
- <text class="help-desc-label">说明</text>
- <text class="help-desc-text">{{ getDefaultDescription(helpData.name, helpData.status) }}</text>
- </view>
- </view>
- </view>
- </view>
- <!-- 报告反馈入口(仅查看模式) -->
- <view class="feedback-entry" v-if="pageMode==='view' && reportId" @tap="openFeedback">
- <text class="feedback-entry-icon">💬</text>
- <text class="feedback-entry-text">对报告有疑问或建议</text>
- <text class="feedback-entry-arrow">›</text>
- </view>
- <feedback-popup :visible="feedbackVisible" :report-id="reportId" @close="closeFeedback" />
- </view>
- </template>
- <script>
- import ReportBlocksRenderer from '../../components/report-blocks-renderer.vue'
- import FeedbackPopup from '@/pages/health/components/feedback-popup.vue'
- import { getReportDetail, getDanReportDetail, getReportPayload, editHealthReport, parseReportDraft, confirmReportPreview, discardReportDraft, confirmTongue, discardTongue, getFamilyMemberList, addFamilyMember, queryIndicatorKnowledge, queryBacteriaKnowledge } from '../../utils/api.js'
- import { parseDate } from '../../utils/format.js'
- export default {
- components: { ReportBlocksRenderer, FeedbackPopup },
- data() {
- return {
- reportType: 'gut_flora',
- reportId: null,
- draftId: null,
- memberId: null,
- familyId: null,
- blocks: [],
- backendBlocksExist: false,
- headInfo: null,
- pageMode: 'view', // view / draft / edit
- directEdit: false, // 是否从列表 mode=edit 直入编辑模式(取消时返回上一页)
- parsing: false,
- parsingText: '正在检测报告类型...',
- parsingStep: 0,
- parsingTimer: null,
- confirming: false,
- payload: {
- type: 'gut_flora',
- reportFormat: '',
- summary: {},
- indicators: [],
- gutFlora: [],
- diseaseRisks: [],
- foods: [],
- probioticSpecies: [],
- taxonomyClass: [],
- taxonomyOrder: [],
- taxonomyFamily: [],
- taxonomyGenus: [],
- taxonomySpecies: [],
- pathogenGenus: [],
- pathogenDetection: []
- },
- extractedName: '',
- extractedGender: '',
- extractedAge: '',
- matchedMemberId: null,
- needBind: false,
- selectedMemberId: null,
- selectedMemberObj: null,
- familyMembers: [],
- matchConfidence: null,
- matchLabel: '',
- candidates: [],
- showMemberPanel: false,
- showAutoCreateForm: false,
- newMember: { name: '', gender: 'male', age: '' },
- creatingMember: false,
- createdMemberId: null,
- groupExpandList: [],
- collapseState: { gutFlora: false, diseaseRisk: false, probiotic: false, taxonomy: false, pathogen: false },
- showHelpPopup: false,
- helpData: {},
- _kbCache: {},
- feedbackVisible: false
- }
- },
- computed: {
- typeLabel() {
- var map = { gut_flora: '肠道菌群报告', dan: 'DAN测评报告', physical_exam: '体检报告', tongue: '舌诊报告' }
- return map[this.reportType] || '健康报告'
- },
- isGutFlora() {
- return this.reportType === 'gut_flora'
- },
- hasPayloadData() {
- var p = this.payload
- return p && ((p.indicators && p.indicators.length > 0) || (p.diseaseRisks && p.diseaseRisks.length > 0) || (p.gutFlora && p.gutFlora.length > 0))
- },
- totalAbnormalCount() {
- var list = this.payload.indicators || []
- var count = 0
- for (var i = 0; i < list.length; i++) {
- if (this.isAbnormalStatus(list[i].status)) count++
- }
- return count
- },
- indicatorGroups() {
- var groups = []
- var orderMap = {}
- var list = this.payload.indicators || []
- for (var i = 0; i < list.length; i++) {
- var ind = list[i]
- var cat = ind.category || '其他指标'
- var gIdx = orderMap[cat]
- if (gIdx === undefined) {
- gIdx = groups.length
- orderMap[cat] = gIdx
- groups.push({ category: cat, items: [], abnormalCount: 0 })
- }
- groups[gIdx].items.push(ind)
- if (this.isAbnormalStatus(ind.status)) groups[gIdx].abnormalCount++
- }
- return groups
- },
- memberDisplayText() {
- if (this.selectedMemberObj) return this.selectedMemberObj.nickname || this.selectedMemberObj.name || '已选择'
- if (this.extractedName) return this.extractedName + (this.needBind ? '(待绑定)' : '')
- return '未选择'
- },
- /** 全量成员减去候选区已展示的成员,避免重复 */
- otherMembers() {
- var candIds = {}
- for (var i = 0; i < this.candidates.length; i++) {
- var c = this.candidates[i]
- var cid = c.id || c.userId
- if (cid !== null && cid !== undefined) candIds[cid] = true
- }
- var list = []
- for (var j = 0; j < this.familyMembers.length; j++) {
- var m = this.familyMembers[j]
- var mid = m.userId || m.id
- if (mid !== null && mid !== undefined && candIds[mid]) continue
- list.push(m)
- }
- return list
- },
- canConfirm() {
- if (this.parsing) return false
- if (this.needBind && !this.selectedMemberId && !this.createdMemberId) return false
- return this.draftId && !this.confirming
- },
- confidenceLevelClass() {
- var c = this.matchConfidence
- if (c === null || c === undefined) return ''
- if (c >= 0.8) return 'high'
- if (c >= 0.6) return 'medium'
- return 'low'
- },
- confidenceLevelText() {
- var cls = this.confidenceLevelClass
- if (cls === 'high') return '高'
- if (cls === 'medium') return '中'
- if (cls === 'low') return '低'
- return ''
- },
- confidencePercent() {
- var c = this.matchConfidence
- if (c === null || c === undefined) return 0
- return Math.round(c * 100)
- },
- confidenceDesc() {
- var cls = this.confidenceLevelClass
- if (cls === 'high') return '报告信息与档案高度匹配,可信度较高。'
- if (cls === 'medium') return '报告信息与档案部分匹配,请仔细核对被检测人。'
- if (cls === 'low') return '报告信息与档案匹配度较低,建议手动选择被检测人。'
- return ''
- },
- taxonomyTotalCount() {
- var lists = [this.payload.taxonomyClass, this.payload.taxonomyOrder, this.payload.taxonomyFamily, this.payload.taxonomyGenus, this.payload.taxonomySpecies]
- var total = 0
- for (var i = 0; i < lists.length; i++) {
- if (lists[i] && lists[i].length) total += lists[i].length
- }
- return total
- },
- pathogenTotalCount() {
- var lists = [this.payload.pathogenGenus, this.payload.pathogenDetection]
- var total = 0
- for (var i = 0; i < lists.length; i++) {
- if (lists[i] && lists[i].length) total += lists[i].length
- }
- return total
- }
- },
- onLoad(options) {
- this.reportType = options.reportType || 'gut_flora'
- this.reportId = options.reportId ? parseInt(options.reportId) : null
- this.draftId = options.draftId ? parseInt(options.draftId) : null
- this.memberId = options.memberId ? parseInt(options.memberId) : null
- this.familyId = options.familyId ? parseInt(options.familyId) : null
- if (this.draftId) {
- this.pageMode = 'draft'
- this.parseByDraftId()
- } else if (this.reportId) {
- // 列表直入编辑模式:跳过查看过渡页(仅肠道菌群报告支持编辑)
- if (options.mode === 'edit' && this.reportType === 'gut_flora') {
- this.pageMode = 'edit'
- this.directEdit = true
- }
- this.loadData()
- }
- },
- methods: {
- // ===== 报告反馈(原「快速分析」入口已合并,反馈由 AI 解答) =====
- openFeedback: function() {
- this.feedbackVisible = true
- },
- closeFeedback: function() {
- this.feedbackVisible = false
- },
- loadData() {
- var self = this
- uni.showLoading({ title: '加载中...' })
- var fn = self.reportType === 'dan' ? getDanReportDetail : getReportDetail
- fn(self.reportId).then(function(res) {
- uni.hideLoading()
- if (res.code === 200) {
- var report = res.data.report || res.data
- var head = {}
- head.personName = report.personName || report.childName || ''
- head.childName = report.childName || ''
- head.reportDateText = report.reportDate ? parseDate(report.reportDate) : ''
- self.headInfo = head
- var backendBlocks = (res.data && res.data.blocks) || report.blocks || []
- if (res.data.payload) {
- self.payload = Object.assign({}, self.defaultPayload(), res.data.payload)
- }
- // 报告来源格式优先取 payload,兜底取 report 实体字段
- if (!self.payload.reportFormat && report.reportFormat) {
- self.payload.reportFormat = report.reportFormat
- }
- // 后端无 blocks 时从 payload 自动组装
- var cleanBlocks = self.stripFoodBlocks(backendBlocks)
- if (cleanBlocks.length > 0) {
- self.blocks = cleanBlocks
- self.backendBlocksExist = true
- } else if (self.hasPayloadData) {
- self.blocks = self.stripFoodBlocks(self.assembleBlocksFromPayload())
- self.backendBlocksExist = false
- } else {
- self.blocks = []
- self.backendBlocksExist = false
- }
- self.needBind = !!report.needBind
- self.selectedMemberId = report.subjectId || null
- } else {
- uni.showToast({ title: res.message || '加载失败', icon: 'none' })
- }
- }).catch(function() {
- uni.hideLoading()
- uni.showToast({ title: '加载异常', icon: 'none' })
- })
- },
- defaultPayload() {
- return {
- type: 'gut_flora',
- reportFormat: '',
- summary: {},
- indicators: [],
- gutFlora: [],
- diseaseRisks: [],
- foods: [],
- probioticSpecies: [],
- taxonomyClass: [],
- taxonomyOrder: [],
- taxonomyFamily: [],
- taxonomyGenus: [],
- taxonomySpecies: [],
- pathogenGenus: [],
- pathogenDetection: []
- }
- },
- enterEditMode: function() {
- var self = this
- self.pageMode = 'edit'
- self.directEdit = false
- self.showMemberPanel = false
- // 按需加载 payload(编辑回填)
- if (self.reportId && self.reportType !== 'dan') {
- uni.showLoading({ title: '加载编辑数据...' })
- getReportPayload(self.reportId).then(function(res) {
- uni.hideLoading()
- if (res.code === 200 && res.data && res.data.payload) {
- self.payload = Object.assign({}, self.defaultPayload(), res.data.payload)
- }
- }).catch(function() {
- uni.hideLoading()
- })
- }
- },
- cancelEdit() {
- // 从列表 mode=edit 直入编辑模式时,取消等同返回上一页(报告卡片/报告列表)
- if (this.directEdit) {
- uni.navigateBack()
- return
- }
- this.pageMode = 'view'
- this.showMemberPanel = false
- this.showAutoCreateForm = false
- this.showHelpPopup = false
- this.loadData()
- },
- parseByDraftId() {
- var self = this
- self.parsing = true
- self.parsingStep = 0
- self.parsingText = '正在检测报告类型,识别报告来源...'
- // 循环切换文案,让用户知道系统在工作
- var messages = [
- '正在检测报告类型,识别报告来源...',
- 'AI 大模型正在深度分析报告内容...',
- '提取关键指标,请稍候...'
- ]
- self.parsingTimer = setInterval(function() {
- self.parsingStep = (self.parsingStep + 1) % messages.length
- self.parsingText = messages[self.parsingStep]
- }, 2500)
- // 调用 parse-report-preview,需要文件路径;从 upload 页传来的 draftId 需要重新获取文件路径
- // 这里使用后端解析接口:先上传文件,然后解析
- // 由于只传了 draftId,回调服务器已有的草稿进行解析
- // 使用上传接口模式:需要文件路径
- // 这里通过 draftId 请求后端确认,后端会使用已存储的文件进行解析
- // 兼容模式:直接请求确认,由后端决定如何解析
- parseReportDraft(self.draftId).then(function(res) {
- self.parsing = false
- if (self.parsingTimer) { clearInterval(self.parsingTimer); self.parsingTimer = null }
- if (res.code === 200) {
- self.applyParseResult(res.data)
- } else {
- uni.showToast({ title: res.message || '解析失败', icon: 'none' })
- }
- }).catch(function() {
- self.parsing = false
- if (self.parsingTimer) { clearInterval(self.parsingTimer); self.parsingTimer = null }
- uni.showToast({ title: '解析异常', icon: 'none' })
- })
- },
- applyParseResult(detail) {
- console.log('[报告入库] applyParseResult', detail)
- var self = this
- self.payload = detail.payload || self.defaultPayload()
- self.extractedName = detail.extractedName || ''
- self.extractedGender = detail.extractedGender || ''
- self.extractedAge = detail.extractedAge || ''
- self.matchConfidence = detail.matchConfidence !== undefined && detail.matchConfidence !== null ? detail.matchConfidence : null
- self.matchLabel = detail.matchLabel || ''
- self.matchedMemberId = detail.matchedMemberId || null
- self.needBind = !!detail.needBind
- self.candidates = detail.candidates || []
- self.loadFamilyMembers()
- console.log('[报告入库] applyParseResult 后状态', {
- needBind: self.needBind,
- matchedMemberId: self.matchedMemberId,
- candidates: self.candidates.length,
- selectedMemberId: self.selectedMemberId,
- canConfirm: self.canConfirm
- })
- if (!self.needBind) {
- self.selectedMemberId = self.matchedMemberId
- }
- var best = self.candidates[0]
- if (best && (best.id || best.userId)) {
- self.selectedMemberId = best.id || best.userId
- self.selectedMemberObj = best
- }
- // 如果需要绑定且有候选成员,默认自动选中第一个
- if (self.needBind && !self.selectedMemberId && self.candidates.length > 0) {
- setTimeout(function() {
- self.toggleMemberPanel()
- uni.showToast({ title: '请确认被检测人', icon: 'none' })
- }, 300)
- }
- console.log('[报告入库] applyParseResult 最终状态', {
- selectedMemberId: self.selectedMemberId,
- canConfirm: self.canConfirm
- })
- },
- loadFamilyMembers() {
- var self = this
- getFamilyMemberList({ visibleOnly: true }).then(function(res) {
- if (res.code === 200) {
- self.familyMembers = res.data || []
- }
- }).catch(function() {})
- },
- toggleMemberPanel() {
- this.showMemberPanel = !this.showMemberPanel
- if (this.showMemberPanel && this.familyMembers.length === 0) {
- this.loadFamilyMembers()
- }
- },
- selectAndClose(member) {
- this.selectedMemberId = member.id || member.userId
- this.selectedMemberObj = member
- this.createdMemberId = null
- this.needBind = false
- this.showMemberPanel = false
- this.showAutoCreateForm = false
- },
- // 解绑:不绑定任何成员(报告不纳入家庭/用户维度计算)
- unbindMember() {
- this.selectedMemberId = null
- this.selectedMemberObj = null
- this.createdMemberId = null
- this.needBind = false
- this.showMemberPanel = false
- this.showAutoCreateForm = false
- },
- genderText(g) {
- if (g === 'male') return '男'
- if (g === 'female') return '女'
- return g || ''
- },
- toggleAutoCreate() {
- this.showAutoCreateForm = !this.showAutoCreateForm
- },
- doAutoCreate() {
- var self = this
- if (!self.newMember.name) {
- uni.showToast({ title: '请填写姓名', icon: 'none' })
- return
- }
- self.creatingMember = true
- addFamilyMember({
- name: self.newMember.name,
- gender: self.newMember.gender,
- age: self.newMember.age ? parseInt(self.newMember.age) : null
- }).then(function(res) {
- self.creatingMember = false
- if (res.code === 200) {
- var member = res.data || {}
- self.selectedMemberId = member.id || member.userId
- self.selectedMemberObj = member
- self.createdMemberId = self.selectedMemberId
- self.needBind = false
- self.showMemberPanel = false
- self.showAutoCreateForm = false
- self.loadFamilyMembers()
- uni.showToast({ title: '创建成功', icon: 'success' })
- } else {
- uni.showToast({ title: res.message || '创建失败', icon: 'none' })
- }
- }).catch(function() {
- self.creatingMember = false
- uni.showToast({ title: '创建异常', icon: 'none' })
- })
- },
- toggleGroup(idx) {
- this.groupExpandList[idx] = !this.groupExpandList[idx]
- },
- toggleCollapse(key) {
- this.collapseState[key] = !this.collapseState[key]
- },
- toggleAllGroups(open) {
- var groups = this.indicatorGroups
- var list = []
- for (var i = 0; i < groups.length; i++) list.push(!!open)
- this.groupExpandList = list
- },
- _cssClass(status) {
- var s = (status || '').toString()
- if (s === 'high' || s === '偏高') return 'high'
- if (s === 'low' || s === '偏低') return 'low'
- if (s === '缺乏' || s === '不足' || s === 'deficient' || s === 'insufficient') return 'deficient'
- if (s === 'abnormal' || s === '异常') return 'abnormal'
- if (s === 'warning' || s === '注意' || s === '需注意') return 'warning'
- if (s === 'high-risk' || s === '高风险') return 'high-risk'
- if (s === 'low-risk' || s === '低风险') return 'low-risk'
- if (s === 'not-detected' || s === '未检出') return 'not-detected'
- return 'normal'
- },
- statusText(status) {
- var s = (status || '').toString()
- if (s === 'high' || s === '偏高') return '偏高'
- if (s === 'low' || s === '偏低') return '偏低'
- if (s === '缺乏' || s === 'deficient') return '缺乏'
- if (s === '不足' || s === 'insufficient') return '不足'
- if (s === 'abnormal' || s === '异常') return '异常'
- if (s === 'warning' || s === '注意' || s === '需注意') return '需注意'
- if (s === 'high-risk' || s === '高风险') return '高风险'
- if (s === 'low-risk' || s === '低风险') return '低风险'
- if (s === 'not-detected' || s === '未检出') return '未检出'
- if (s === 'normal') return '正常'
- return '正常'
- },
- // 与 report-confirm 保持一致的白名单:仅明确异常/需关注的状态计入异常数,
- // 未知状态文本(解析器自由提取)一律视为正常,避免"样式正常却计入异常"的矛盾。
- isAbnormalStatus(status) {
- if (!status) return false
- var abnormalMap = { 'high': 1, 'low': 1, 'abnormal': 1, '偏高': 1, '偏低': 1, '异常': 1, '缺乏': 1, '不足': 1, '注意': 1, '高风险': 1 }
- return !!abnormalMap[String(status).trim()]
- },
- showHelp(ind) {
- this.helpData = {
- name: ind.indicatorName || ind.name || '',
- value: ind.indicatorValue || ind.value || '',
- refRange: ind.refRange || '',
- status: ind.status || 'normal',
- description: ind.description || ''
- }
- this.showHelpPopup = true
- },
- /** blocks renderer ? 按钮点击 — 按需查询知识库(页面级缓存) */
- onBlockHelp: function(item, blockType) {
- var self = this
- var name = item.name || ''
- if (!name) return
- var cacheKey = blockType + ':' + name
- if (self._kbCache[cacheKey]) {
- self.helpData = self._kbCache[cacheKey]
- self.showHelpPopup = true
- return
- }
- uni.showLoading({ title: '加载说明...' })
- var queryFn = blockType === 'bacteria' ? queryBacteriaKnowledge : queryIndicatorKnowledge
- queryFn(name).then(function(res) {
- uni.hideLoading()
- if (res.code === 200 && res.data) {
- var v3 = res.data
- var high = v3['偏高影响'] || ''
- var low = v3['偏低影响'] || ''
- var suggestion = v3['调整建议'] || ''
- var desc = ''
- if (high) desc += '偏高影响:' + high + '\n'
- if (low) desc += '偏低影响:' + low
- if (suggestion) desc += (desc ? '\n' : '') + '调整建议:' + suggestion
- self.helpData = {
- name: v3['名称'] || name,
- value: item.value || '',
- refRange: item.refRange || '',
- status: item.status || 'normal',
- description: desc || v3['说明'] || self.getDefaultDescription(name, item.status)
- }
- } else {
- self.helpData = {
- name: name,
- value: item.value || '',
- refRange: item.refRange || '',
- status: item.status || 'normal',
- description: self.getDefaultDescription(name, item.status)
- }
- }
- self._kbCache[cacheKey] = self.helpData
- self.showHelpPopup = true
- }).catch(function() {
- uni.hideLoading()
- self.helpData = {
- name: name,
- value: item.value || '',
- refRange: item.refRange || '',
- status: item.status || 'normal',
- description: self.getDefaultDescription(name, item.status)
- }
- self.showHelpPopup = true
- })
- },
- closeHelp() {
- this.showHelpPopup = false
- },
- getDefaultDescription(name, status) {
- if (!status || status === 'normal') return '该指标处于正常范围内,无需特别关注。'
- if (status === 'high' || status === '偏高') return '该指标偏高,建议咨询专业医生或营养师进行进一步评估。'
- if (status === 'low' || status === '偏低') return '该指标偏低,建议咨询专业医生或营养师进行进一步评估。'
- if (status === '缺乏' || status === '不足') return '该指标不足,建议通过饮食或补充剂适当补充。'
- if (status === 'abnormal') return '该指标异常,建议咨询专业医生进行详细检查。'
- if (status === '注意') return '该指标需要关注,建议定期监测并咨询专业人士。'
- return '请参考专业医生的建议进行解读。'
- },
- riskLevelText(level) {
- if (level === 'high') return '高风险'
- if (level === 'medium' || level === 'moderate') return '中风险'
- return '低风险'
- },
- indicatorLabel(code) {
- var map = { tongueColor: '舌色', tongueShape: '舌形', tongueCoating: '舌苔', tongueMoisture: '润燥' }
- return map[code] || code || ''
- },
- getTaxonomyKey(prefix, idx) {
- return prefix + '_' + idx
- },
- hasTaxonomyData() {
- return !!(this.payload.taxonomyClass && this.payload.taxonomyClass.length) ||
- !!(this.payload.taxonomyOrder && this.payload.taxonomyOrder.length) ||
- !!(this.payload.taxonomyFamily && this.payload.taxonomyFamily.length) ||
- !!(this.payload.taxonomyGenus && this.payload.taxonomyGenus.length) ||
- !!(this.payload.taxonomySpecies && this.payload.taxonomySpecies.length)
- },
- hasPathogenData() {
- return !!(this.payload.pathogenGenus && this.payload.pathogenGenus.length) ||
- !!(this.payload.pathogenDetection && this.payload.pathogenDetection.length)
- },
- handleLeftAction() {
- if (this.pageMode === 'draft') this.doDiscard()
- else this.cancelEdit()
- },
- handleRightAction() {
- if (this.pageMode === 'draft') {
- console.log('[报告入库] 点击确认按钮', {
- pageMode: this.pageMode,
- draftId: this.draftId,
- confirming: this.confirming,
- canConfirm: this.canConfirm,
- selectedMemberId: this.selectedMemberId,
- needBind: this.needBind,
- matchedMemberId: this.matchedMemberId,
- memberId: this.memberId,
- payloadType: this.payload.type,
- indicatorsCount: (this.payload.indicators || []).length
- })
- // 如果需要绑定但没有选择会员,先弹出会员选择面板
- if (this.needBind && !this.selectedMemberId && !this.createdMemberId) {
- uni.showToast({ title: '请先选择被检测人', icon: 'none' })
- this.toggleMemberPanel()
- return
- }
- this.doConfirm()
- } else this.saveEdit()
- },
- doDiscard() {
- var self = this
- uni.showModal({
- title: '提示',
- content: '确定放弃该报告草稿吗?',
- success: function(res) {
- if (!res.confirm) return
- var discardFn = self.payload.type === 'tongue' ? discardTongue : discardReportDraft
- discardFn(self.draftId).then(function(res2) {
- if (res2.code === 200) {
- uni.showToast({ title: '已放弃', icon: 'success' })
- setTimeout(function() { uni.navigateBack() }, 600)
- } else {
- uni.showToast({ title: res2.message || '操作失败', icon: 'none' })
- }
- })
- }
- })
- },
- doConfirm() {
- console.log('[报告入库] doConfirm 开始', { canConfirm: this.canConfirm, draftId: this.draftId })
- if (!this.canConfirm) {
- console.warn('[报告入库] canConfirm 为 false,跳过执行')
- return
- }
- var self = this
- self.confirming = true
- uni.showLoading({ title: '确认入库并生成方案...' })
- var postData = { draftId: self.draftId, payload: self.payload }
- if (self.selectedMemberId) postData.subjectId = self.selectedMemberId
- else if (self.createdMemberId) postData.subjectId = self.createdMemberId
- else if (self.matchedMemberId) postData.subjectId = self.matchedMemberId
- else if (self.memberId) postData.subjectId = self.memberId
- console.log('[报告入库] 准备调用 API', postData)
- var confirmFn = self.payload.type === 'tongue' ? confirmTongue : confirmReportPreview
- confirmFn(postData).then(function(res) {
- console.log('[报告入库] API 响应', res)
- uni.hideLoading()
- self.confirming = false
- if (res.code === 200) {
- var data = res.data || {}
- var reportId = data.reportId || (data.report && data.report.id)
- if (reportId && self.payload.type !== 'tongue') {
- setTimeout(function() {
- uni.redirectTo({ url: '/pages/health/report-detail?reportType=' + (self.payload.type || 'gut_flora') + '&reportId=' + reportId })
- uni.showToast({ title: '入库成功', icon: 'success' })
- }, 600)
- } else {
- setTimeout(function() {
- uni.navigateBack()
- uni.showToast({ title: '入库成功', icon: 'success' })
- }, 600)
- }
- } else {
- uni.showToast({ title: res.message || '确认失败', icon: 'none' })
- }
- }).catch(function() {
- uni.hideLoading()
- self.confirming = false
- uni.showToast({ title: '确认异常', icon: 'none' })
- })
- },
- saveEdit() {
- var self = this
- if (!self.reportId) return
- uni.showLoading({ title: '保存中...' })
- // 未选择成员 → 传 null 表示解绑(不纳入任何用户/家庭维度计算)
- // 注意:不传 0(0 会被后端当作无成员处理但语义不明,null 明确解绑)
- var subjectId = self.selectedMemberId || self.createdMemberId || null
- editHealthReport(self.reportId, self.payload, subjectId).then(function(res) {
- uni.hideLoading()
- if (res.code === 200) {
- uni.showToast({ title: '已保存', icon: 'success' })
- self.pageMode = 'view'
- self.groupExpandList = []
- self.loadData()
- } else {
- uni.showToast({ title: res.message || '保存失败', icon: 'none' })
- }
- }).catch(function() {
- uni.hideLoading()
- uni.showToast({ title: '保存异常', icon: 'none' })
- })
- },
- /** 从 blocks 中过滤掉"食物推荐/饮食推荐"块(报告详情不展示饮食推荐) */
- stripFoodBlocks: function(blocks) {
- var list = blocks || []
- var result = []
- for (var i = 0; i < list.length; i++) {
- var b = list[i]
- var t = (b && b.title) || ''
- if (t.indexOf('食物推荐') >= 0 || t.indexOf('饮食推荐') >= 0) continue
- result.push(b)
- }
- return result
- },
- /** 从 payload 数据自动组装展示块(后端无 blocks 时使用) */
- assembleBlocksFromPayload: function() {
- var blocks = []
- var p = this.payload
- if (!p) return blocks
- // 1. 评分圆环块(北京/谷禾报告评分体系不同:北京用 GMHI 指数,谷禾用健康总分)
- var scoreItems = []
- var isBeijing = p.reportFormat === 'beijing'
- if (p.summary) {
- if (isBeijing) {
- // 北京菌群报告:GMHI 肠道微生物健康指数为主评分
- this._addScoreItem(scoreItems, 'GMHI 肠道微生物健康指数', p.summary.overallScore != null ? p.summary.overallScore : p.summary.gmhiIndex)
- this._addScoreItem(scoreItems, '菌群健康', p.summary.gutHealthScore)
- if (p.summary.gutBalanceScore != null) { this._addSubScore(scoreItems, '菌群健康', '平衡', p.summary.gutBalanceScore) }
- if (p.summary.gutDiversityScore != null) { this._addSubScore(scoreItems, '菌群健康', '多样性', p.summary.gutDiversityScore) }
- if (p.summary.beneficialBacteriaScore != null) { this._addSubScore(scoreItems, '菌群健康', '有益菌', p.summary.beneficialBacteriaScore) }
- if (p.summary.coreSpeciesScore != null) { this._addSubScore(scoreItems, '菌群健康', '核心菌属', p.summary.coreSpeciesScore) }
- } else {
- // 谷禾/其它报告:健康总分 + 细分维度
- this._addScoreItem(scoreItems, '综合', p.summary.overallScore)
- this._addScoreItem(scoreItems, '菌群健康', p.summary.gutHealthScore)
- this._addScoreItem(scoreItems, '慢病控制', p.summary.chronicDiseaseScore)
- // 子项
- if (p.summary.nutritionScore != null) { this._addSubScore(scoreItems, '综合', '营养均衡', p.summary.nutritionScore) }
- if (p.summary.gutBalanceScore != null) { this._addSubScore(scoreItems, '菌群健康', '平衡', p.summary.gutBalanceScore) }
- if (p.summary.gutDiversityScore != null) { this._addSubScore(scoreItems, '菌群健康', '多样性', p.summary.gutDiversityScore) }
- if (p.summary.beneficialBacteriaScore != null) { this._addSubScore(scoreItems, '菌群健康', '有益菌', p.summary.beneficialBacteriaScore) }
- if (p.summary.harmfulBacteriaScore != null) { this._addSubScore(scoreItems, '菌群健康', '有害菌', p.summary.harmfulBacteriaScore) }
- if (p.summary.coreSpeciesScore != null) { this._addSubScore(scoreItems, '菌群健康', '核心菌属', p.summary.coreSpeciesScore) }
- }
- // 肠道年龄/肠型(两种格式均有或部分有)
- if (p.summary.gutAge) { this._addScoreItem(scoreItems, '肠道年龄', p.summary.gutAge) }
- if (p.summary.gutType) { this._addScoreItem(scoreItems, '肠型', p.summary.gutType) }
- }
- if (scoreItems.length > 0) {
- blocks.push({ type: 'score', title: isBeijing ? '肠道微生物健康指数' : '健康评分', items: scoreItems })
- }
- // 2. 疾病风险分组块
- var risks = p.diseaseRisks || []
- if (risks.length > 0) {
- var important = []
- var normal = []
- for (var ri = 0; ri < risks.length; ri++) {
- var r = risks[ri]
- var level = r.riskLevel || ''
- var item = { name: r.diseaseName || '', value: r.riskValue || '', level: level }
- if (level === '需注意' || level === '注意' || level === '高风险' || level === '异常') {
- important.push(item)
- } else {
- normal.push(item)
- }
- }
- if (important.length > 0) blocks.push({ type: 'risk_group', title: '重要风险', items: important })
- if (normal.length > 0) blocks.push({ type: 'risk_group', title: '其它风险', items: normal })
- }
- // 3. 指标分组块
- var inds = p.indicators || []
- if (inds.length > 0) {
- var byCat = {}
- var byCatAbnormal = {}
- for (var ii = 0; ii < inds.length; ii++) {
- var ind = inds[ii]
- var cat = ind.category || '其他指标'
- if (!byCat[cat]) byCat[cat] = []
- if (byCatAbnormal[cat] === undefined) byCatAbnormal[cat] = 0
- byCat[cat].push({
- name: ind.indicatorName || ind.name || '',
- value: ind.indicatorValue || ind.value || '',
- unit: ind.unit || '',
- refRange: ind.refRange || '',
- status: ind.status || ''
- })
- if (this.isAbnormalStatus(ind.status)) byCatAbnormal[cat]++
- }
- var catKeys = Object.keys(byCat)
- for (var ck = 0; ck < catKeys.length; ck++) {
- blocks.push({
- type: 'indicator',
- title: catKeys[ck],
- items: byCat[catKeys[ck]],
- abnormalCount: byCatAbnormal[catKeys[ck]] || 0
- })
- }
- }
- // 4. 菌种列表块
- var floraItems = []
- // 肠道菌群
- var gf = p.gutFlora || []
- for (var fi = 0; fi < gf.length; fi++) {
- var f = gf[fi]
- floraItems.push({
- name: f.name || f.bacteriaName || '',
- value: f.abundance != null ? f.abundance : (f.bacteriaValue || ''),
- range: f.normalRange || '',
- status: f.populationLevel || f.level || f.status || ''
- })
- }
- // 病原菌
- var pg = p.pathogenGenus || []
- for (var pi = 0; pi < pg.length; pi++) {
- var pgi = pg[pi]
- floraItems.push({
- name: pgi.name || pgi.bacteriaName || '',
- value: pgi.abundance != null ? pgi.abundance : (pgi.bacteriaValue || ''),
- range: pgi.normalRange || '',
- status: pgi.populationLevel || pgi.level || pgi.status || ''
- })
- }
- var pd = p.pathogenDetection || []
- for (var pdi = 0; pdi < pd.length; pdi++) {
- var pdiItem = pd[pdi]
- floraItems.push({
- name: pdiItem.name || pdiItem.bacteriaName || '',
- value: pdiItem.abundance != null ? pdiItem.abundance : (pdiItem.bacteriaValue || ''),
- range: pdiItem.normalRange || '',
- status: pdiItem.populationLevel || pdiItem.level || pdiItem.status || ''
- })
- }
- if (floraItems.length > 0) {
- blocks.push({
- type: 'list', title: '菌种详情',
- columns: [{ key: 'name', label: '菌种' }, { key: 'value', label: '数值' }, { key: 'range', label: '正常范围' }, { key: 'status', label: '状态' }],
- items: floraItems
- })
- }
- // 5. 益生菌种列表
- var ps = p.probioticSpecies || []
- if (ps.length > 0) {
- var psItems = []
- for (var psi = 0; psi < ps.length; psi++) {
- var psiItem = ps[psi]
- psItems.push({
- name: psiItem.name || psiItem.bacteriaName || '',
- value: psiItem.abundance != null ? psiItem.abundance : (psiItem.bacteriaValue || ''),
- range: psiItem.normalRange || '',
- status: psiItem.populationLevel || psiItem.level || psiItem.status || ''
- })
- }
- blocks.push({
- type: 'list', title: '益生菌种',
- columns: [{ key: 'name', label: '菌种' }, { key: 'value', label: '数值' }, { key: 'range', label: '正常范围' }, { key: 'status', label: '状态' }],
- items: psItems
- })
- }
- // 6. 分类学列表(纲/目/科/属/种)
- var taxLabels = [
- { key: 'taxonomyClass', label: '菌纲 (Class)' },
- { key: 'taxonomyOrder', label: '菌目 (Order)' },
- { key: 'taxonomyFamily', label: '菌科 (Family)' },
- { key: 'taxonomyGenus', label: '菌属 (Genus)' },
- { key: 'taxonomySpecies', label: '菌种 (Species)' }
- ]
- for (var tli = 0; tli < taxLabels.length; tli++) {
- var tl = taxLabels[tli]
- var taxList = p[tl.key] || []
- if (taxList.length > 0) {
- var taxItems = []
- for (var txi = 0; txi < taxList.length; txi++) {
- var tx = taxList[txi]
- taxItems.push({ name: tx.name || '', value: tx.abundance != null ? tx.abundance : '' })
- }
- blocks.push({
- type: 'list', title: tl.label,
- columns: [{ key: 'name', label: '名称' }, { key: 'value', label: '丰度' }],
- items: taxItems
- })
- }
- }
- return blocks
- },
- _addScoreItem: function(items, label, value) {
- if (value == null || value === '') return
- items.push({ label: label, value: value, max: 100 })
- },
- _addSubScore: function(items, parentLabel, label, value) {
- if (value == null) return
- items.push({ parentLabel: parentLabel, label: label, value: value, max: 100 })
- }
- },
- onUnload: function() {
- if (this.parsingTimer) { clearInterval(this.parsingTimer); this.parsingTimer = null }
- }
- }
- </script>
- <style scoped>
- .page {
- min-height: 100vh;
- background: #f8f8f8;
- }
- .content {
- height: calc(100vh - 100rpx);
- padding: 20rpx 30rpx;
- box-sizing: border-box;
- }
- .report-head {
- margin: 20rpx 0;
- padding: 24rpx;
- background: #fff;
- border-radius: 16rpx;
- }
- .head-name {
- font-size: 36rpx;
- font-weight: 600;
- color: #333;
- }
- .head-meta {
- display: flex;
- align-items: center;
- gap: 12rpx;
- margin-top: 10rpx;
- }
- .type-badge {
- font-size: 22rpx;
- color: #4a90d9;
- background: #eef4ff;
- padding: 4rpx 14rpx;
- border-radius: 8rpx;
- }
- .head-date {
- font-size: 24rpx;
- color: #999;
- }
- .empty-hint {
- text-align: center;
- color: #999;
- font-size: 26rpx;
- padding: 60rpx 0;
- }
- .edit-btn {
- margin: 30rpx 0;
- display: flex;
- justify-content: center;
- }
- .nav-edit {
- background: #4a90d9;
- color: #fff;
- padding: 16rpx 60rpx;
- border-radius: 40rpx;
- font-size: 28rpx;
- }
- .title-count {
- font-size: 24rpx;
- font-weight: normal;
- color: #94A3B8;
- margin-left: 8rpx;
- }
- .title-abnormal {
- font-size: 24rpx;
- font-weight: normal;
- color: #C62828;
- }
- .card-title-actions {
- margin-left: auto;
- display: flex;
- flex-direction: row;
- gap: 16rpx;
- }
- .expand-all-btn {
- font-size: 22rpx;
- color: #5B9BD5;
- padding: 4rpx 12rpx;
- border: 2rpx solid #5B9BD5;
- border-radius: 20rpx;
- }
- .expand-all-btn:active { opacity: 0.7; }
- /* 卡片折叠标题(肠道菌群/疾病风险/益生菌种/分类组成/病原菌) */
- .card-title.collapsible-title {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- cursor: pointer;
- user-select: none;
- }
- .card-title.collapsible-title:active { opacity: 0.7; }
- .collapse-arrow {
- font-size: 30rpx;
- color: #94A3B8;
- margin-left: 12rpx;
- transform: rotate(0deg);
- transition: transform 0.2s ease;
- flex-shrink: 0;
- }
- .collapse-arrow.arrow-open {
- transform: rotate(90deg);
- }
- /* ===== 鎸囨爣鍒嗙粍鎶樺彔 ===== */
- .indicator-group {
- border: 2rpx solid #E8EDF2;
- border-radius: 12rpx;
- margin-bottom: 12rpx;
- overflow: hidden;
- }
- .indicator-group-header {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- padding: 20rpx 16rpx;
- background: #F1F5F9;
- }
- .indicator-group-header:active { opacity: 0.8; }
- .indicator-group-header-left {
- display: flex;
- flex-direction: row;
- align-items: center;
- flex: 1;
- min-width: 0;
- }
- .indicator-group-arrow {
- font-size: 30rpx;
- color: #94A3B8;
- margin-right: 12rpx;
- transform: rotate(0deg);
- transition: transform 0.2s ease;
- flex-shrink: 0;
- }
- .indicator-group-arrow.arrow-open {
- transform: rotate(90deg);
- }
- .indicator-group-name {
- font-size: 26rpx;
- color: #333;
- font-weight: 600;
- flex: 1;
- min-width: 0;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .indicator-group-header-right {
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 12rpx;
- flex-shrink: 0;
- margin-left: 12rpx;
- }
- .indicator-group-need {
- font-size: 20rpx;
- color: #E65100;
- background: #FFF3E0;
- padding: 4rpx 12rpx;
- border-radius: 20rpx;
- font-weight: 500;
- }
- .indicator-group-count {
- font-size: 22rpx;
- color: #94A3B8;
- }
- .indicator-group-abnormal {
- font-size: 22rpx;
- color: #C62828;
- font-weight: 500;
- margin-right: 8rpx;
- }
- .indicator-group-body {
- padding: 16rpx;
- }
- .field-row {
- display: flex;
- flex-direction: row;
- align-items: center;
- margin-bottom: 16rpx;
- }
- .field-label {
- font-size: 26rpx;
- color: #666;
- width: 160rpx;
- flex-shrink: 0;
- }
- .field-value {
- font-size: 26rpx;
- color: #333;
- font-weight: 500;
- flex: 1;
- }
- .field-value.binding-required {
- color: #E65100;
- }
- .member-select-row {
- cursor: pointer;
- }
- .member-select-row:active {
- opacity: 0.7;
- }
- .member-select-arrow {
- font-size: 24rpx;
- color: #5B9BD5;
- margin-left: 12rpx;
- flex-shrink: 0;
- }
- .member-panel {
- background: #F8FAFB;
- border-radius: 12rpx;
- padding: 16rpx;
- margin: 8rpx 0 16rpx;
- }
- .auto-create-inline {
- margin-top: 16rpx;
- padding-top: 16rpx;
- border-top: 2rpx solid #E3F2FD;
- }
- .field-input {
- flex: 1;
- font-size: 26rpx;
- color: #333;
- padding: 8rpx 16rpx;
- background: #F5F7FA;
- border-radius: 8rpx;
- }
- .field-textarea {
- width: 100%;
- min-height: 120rpx;
- font-size: 26rpx;
- color: #333;
- padding: 16rpx;
- background: #F5F7FA;
- border-radius: 12rpx;
- box-sizing: border-box;
- margin-top: 8rpx;
- }
- .member-list {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- gap: 16rpx;
- }
- .member-list-hint {
- width: 100%;
- font-size: 24rpx;
- color: #999;
- margin-bottom: 8rpx;
- }
- .member-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 20rpx 24rpx;
- background: #F5F7FA;
- border-radius: 16rpx;
- border: 2rpx solid transparent;
- min-width: 120rpx;
- }
- .member-selected {
- background: #E3F2FD;
- border-color: #5B9BD5;
- }
- .member-avatar {
- width: 64rpx;
- height: 64rpx;
- border-radius: 50%;
- background: #5B9BD5;
- color: #fff;
- font-size: 28rpx;
- font-weight: bold;
- text-align: center;
- line-height: 64rpx;
- margin-bottom: 8rpx;
- }
- .member-name { font-size: 24rpx; color: #333; }
- .indicator-item {
- background: #F8FAFB;
- border-radius: 12rpx;
- padding: 16rpx;
- margin-bottom: 12rpx;
- }
- .ind-header {
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 12rpx;
- }
- .ind-name {
- flex: 1;
- font-size: 26rpx;
- color: #333;
- font-weight: 500;
- padding: 4rpx 8rpx;
- background: #fff;
- border-radius: 6rpx;
- }
- .ind-value {
- width: 160rpx;
- font-size: 26rpx;
- color: #1565C0;
- font-weight: bold;
- text-align: right;
- padding: 4rpx 8rpx;
- background: #fff;
- border-radius: 6rpx;
- }
- .ind-detail {
- display: flex;
- flex-direction: row;
- margin-top: 8rpx;
- gap: 16rpx;
- }
- .ind-ref { font-size: 22rpx; color: #94A3B8; }
- .ind-unit { font-size: 22rpx; color: #64748B; }
- .ind-symptoms {
- display: flex;
- flex-direction: row;
- align-items: center;
- margin-top: 8rpx;
- gap: 8rpx;
- }
- .ind-symptom-label { font-size: 22rpx; color: #94A3B8; flex-shrink: 0; }
- .ind-symptom-input {
- flex: 1;
- font-size: 22rpx;
- color: #333;
- padding: 4rpx 8rpx;
- background: #fff;
- border-radius: 6rpx;
- }
- .status-tag {
- display: inline-block;
- font-size: 20rpx;
- padding: 4rpx 12rpx;
- border-radius: 8rpx;
- font-weight: 500;
- }
- .status-normal { background: #E8F5E9; color: #2E7D32; }
- .status-high { background: #FFF3E0; color: #E65100; }
- .status-low { background: #E3F2FD; color: #1565C0; }
- .status-abnormal { background: #FFEBEE; color: #C62828; }
- /* ===== 鎸囨爣甯姪鎸夐挳 ===== */
- .ind-help-btn {
- width: 36rpx;
- height: 36rpx;
- border-radius: 50%;
- background: #E2E8F0;
- color: #64748B;
- font-size: 24rpx;
- font-weight: bold;
- text-align: center;
- line-height: 36rpx;
- flex-shrink: 0;
- }
- .ind-help-btn:active {
- background: #CBD5E1;
- }
- /* ===== 鎸囨爣杈撳叆妗嗛鑹茬姸鎬?===== */
- .ind-name-normal, .ind-value-normal {
- background: #fff;
- }
- .ind-name-high, .ind-value-high,
- .ind-name-low, .ind-value-low,
- .ind-name-abnormal, .ind-value-abnormal,
- .ind-name-deficient, .ind-value-deficient,
- .ind-name-insufficient, .ind-value-insufficient,
- .ind-name-warning, .ind-value-warning,
- .ind-name-high-risk, .ind-value-high-risk,
- .ind-name-low-risk, .ind-value-low-risk,
- .ind-name-not-detected, .ind-value-not-detected {
- background: #FFF0F0;
- color: #C62828;
- }
- /* ===== 鎸囨爣甯姪寮圭獥 ===== */
- .help-overlay {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0,0,0,0.4);
- z-index: 999;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .help-popup {
- width: 580rpx;
- max-height: 70vh;
- background: #fff;
- border-radius: 24rpx;
- overflow: hidden;
- }
- .help-popup-header {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- padding: 28rpx 30rpx;
- border-bottom: 2rpx solid #F0F0F0;
- }
- .help-popup-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- flex: 1;
- }
- .help-popup-close {
- font-size: 32rpx;
- color: #999;
- padding: 8rpx;
- }
- .help-popup-body {
- padding: 24rpx 30rpx;
- }
- .help-row {
- display: flex;
- flex-direction: row;
- align-items: center;
- margin-bottom: 16rpx;
- }
- .help-label {
- font-size: 26rpx;
- color: #94A3B8;
- width: 140rpx;
- flex-shrink: 0;
- }
- .help-value {
- font-size: 28rpx;
- color: #333;
- font-weight: 500;
- flex: 1;
- }
- .help-status-normal { color: #2E7D32; }
- .help-status-high { color: #C62828; }
- .help-status-low { color: #1565C0; }
- .help-status-abnormal { color: #C62828; }
- .help-desc {
- margin-top: 8rpx;
- padding: 20rpx;
- background: #F8FAFB;
- border-radius: 12rpx;
- }
- .help-desc-label {
- display: block;
- font-size: 24rpx;
- color: #94A3B8;
- margin-bottom: 8rpx;
- }
- .help-desc-text {
- display: block;
- font-size: 26rpx;
- color: #333;
- line-height: 1.6;
- }
- .flora-item {
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 12rpx;
- padding: 12rpx 16rpx;
- background: #F8FAFB;
- border-radius: 10rpx;
- margin-bottom: 8rpx;
- }
- .flora-name {
- flex: 1;
- font-size: 26rpx;
- color: #333;
- padding: 4rpx 8rpx;
- background: #fff;
- border-radius: 6rpx;
- }
- .flora-abundance {
- width: 140rpx;
- font-size: 26rpx;
- color: #1565C0;
- text-align: right;
- padding: 4rpx 8rpx;
- background: #fff;
- border-radius: 6rpx;
- }
- .taxonomy-group {
- margin-bottom: 16rpx;
- }
- .taxonomy-group:last-child {
- margin-bottom: 0;
- }
- .taxonomy-group-label {
- display: block;
- font-size: 24rpx;
- font-weight: 500;
- color: #666;
- padding: 8rpx 4rpx 6rpx;
- }
- .pathogen-group {
- margin-bottom: 16rpx;
- }
- .pathogen-group:last-child {
- margin-bottom: 0;
- }
- .pathogen-group-label {
- display: block;
- font-size: 24rpx;
- font-weight: 500;
- color: #D32F2F;
- padding: 8rpx 4rpx 6rpx;
- }
- .risk-item {
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 12rpx;
- padding: 12rpx 16rpx;
- background: #F8FAFB;
- border-radius: 10rpx;
- margin-bottom: 8rpx;
- }
- .risk-name {
- flex: 1;
- font-size: 26rpx;
- color: #333;
- padding: 4rpx 8rpx;
- background: #fff;
- border-radius: 6rpx;
- }
- .risk-level {
- font-size: 22rpx;
- font-weight: 500;
- padding: 4rpx 12rpx;
- border-radius: 8rpx;
- }
- .risk-low { background: #E8F5E9; color: #2E7D32; }
- .risk-medium, .risk-moderate { background: #FFF3E0; color: #E65100; }
- .risk-high { background: #FFEBEE; color: #C62828; }
- .food-item {
- display: flex;
- }
- .action-row {
- display: flex;
- flex-direction: row;
- gap: 20rpx;
- margin-top: 10rpx;
- margin-bottom: 20rpx;
- }
- .btn-discard {
- flex: 1;
- background: #fff;
- border: 2rpx solid #EF4444;
- color: #EF4444;
- font-size: 28rpx;
- font-weight: bold;
- text-align: center;
- padding: 24rpx;
- border-radius: 16rpx;
- }
- .btn-discard:active { opacity: 0.7; }
- .btn-confirm {
- flex: 2;
- background: linear-gradient(135deg, #5B9BD5, #3A7CC4);
- color: #fff;
- font-size: 28rpx;
- font-weight: bold;
- text-align: center;
- padding: 24rpx;
- border-radius: 16rpx;
- }
- .btn-confirm:active { opacity: 0.85; }
- .btn-disabled { opacity: 0.5; }
- .bottom-spacer { height: 80rpx; }
- /* ===== Phase 2: 鍖归厤鍙俊搴?===== */
- .confidence-card {
- margin: 0 30rpx 20rpx;
- background: #fff;
- border-radius: 16rpx;
- padding: 24rpx;
- box-shadow: 0 2rpx 6rpx rgba(0,0,0,0.04);
- }
- .confidence-header {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 16rpx;
- }
- .confidence-label {
- font-size: 26rpx;
- color: #333;
- font-weight: 500;
- }
- .confidence-badge {
- font-size: 22rpx;
- font-weight: bold;
- padding: 4rpx 16rpx;
- border-radius: 20rpx;
- }
- .badge-high { background: #E8F5E9; color: #2E7D32; }
- .badge-medium { background: #FFF8E1; color: #F57F17; }
- .badge-low { background: #FFF3E0; color: #E65100; }
- .badge-none { background: #FFEBEE; color: #C62828; }
- .confidence-bar-track {
- height: 12rpx;
- background: #E2E8F0;
- border-radius: 6rpx;
- overflow: hidden;
- margin-bottom: 12rpx;
- }
- .confidence-bar-fill {
- height: 100%;
- border-radius: 6rpx;
- transition: width 0.3s ease;
- }
- .fill-high { background: linear-gradient(90deg, #66BB6A, #43A047); }
- .fill-medium { background: linear-gradient(90deg, #FFD54F, #FFC107); }
- .fill-low { background: linear-gradient(90deg, #FF8A65, #FF5722); }
- .fill-none { background: linear-gradient(90deg, #EF9A9A, #E53935); }
- .confidence-desc {
- font-size: 22rpx;
- color: #94A3B8;
- line-height: 1.4;
- }
- /* ===== Phase 2: 鍊欓€夋垚鍛樺垪琛?===== */
- .candidate-section {
- margin-bottom: 16rpx;
- }
- .candidate-section-hint {
- display: block;
- font-size: 24rpx;
- color: #64748B;
- margin-bottom: 12rpx;
- }
- .candidate-item {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- padding: 16rpx;
- background: #F8FAFB;
- border-radius: 12rpx;
- margin-bottom: 10rpx;
- border: 2rpx solid transparent;
- }
- .candidate-item:active { opacity: 0.8; }
- .candidate-selected {
- background: #E3F2FD;
- border-color: #5B9BD5;
- }
- .candidate-left {
- display: flex;
- flex-direction: row;
- align-items: center;
- flex: 1;
- min-width: 0;
- }
- .candidate-avatar {
- width: 56rpx;
- height: 56rpx;
- border-radius: 50%;
- background: #5B9BD5;
- color: #fff;
- font-size: 24rpx;
- font-weight: bold;
- text-align: center;
- line-height: 56rpx;
- margin-right: 16rpx;
- flex-shrink: 0;
- }
- .candidate-info {
- flex: 1;
- min-width: 0;
- }
- .candidate-name {
- font-size: 26rpx;
- color: #333;
- font-weight: 500;
- display: block;
- }
- .candidate-detail {
- font-size: 22rpx;
- color: #94A3B8;
- display: block;
- }
- .candidate-fields {
- font-size: 20rpx;
- color: #5B9BD5;
- display: block;
- margin-top: 2rpx;
- }
- .candidate-right {
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 12rpx;
- flex-shrink: 0;
- margin-left: 16rpx;
- }
- .score-bar-track {
- width: 80rpx;
- height: 10rpx;
- background: #E2E8F0;
- border-radius: 5rpx;
- overflow: hidden;
- }
- .score-bar-fill {
- height: 100%;
- background: linear-gradient(90deg, #5B9BD5, #3A7CC4);
- border-radius: 5rpx;
- }
- .score-text {
- font-size: 24rpx;
- color: #1565C0;
- font-weight: bold;
- min-width: 48rpx;
- text-align: right;
- }
- /* ===== Phase 2: 鏂板缓鎴愬憳鍏ュ彛 ===== */
- .create-member-entry {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- padding: 20rpx;
- border: 2rpx dashed #CBD5E1;
- border-radius: 12rpx;
- margin-top: 8rpx;
- }
- .create-member-entry:active { background: #F1F5F9; }
- .create-member-icon {
- font-size: 28rpx;
- color: #5B9BD5;
- font-weight: bold;
- margin-right: 8rpx;
- }
- .create-member-text {
- font-size: 24rpx;
- color: #5B9BD5;
- }
- /* ===== Phase 2: 鏂板缓鎴愬憳琛ㄥ崟锛堥潰鏉垮唴宓岋級 ===== */
- .form-item {
- display: flex;
- flex-direction: row;
- align-items: center;
- margin-bottom: 20rpx;
- }
- .form-item-label {
- font-size: 26rpx;
- color: #333;
- width: 100rpx;
- flex-shrink: 0;
- }
- .form-item-input {
- flex: 1;
- font-size: 26rpx;
- color: #333;
- padding: 12rpx 16rpx;
- background: #F5F7FA;
- border-radius: 10rpx;
- }
- .gender-selector {
- display: flex;
- flex-direction: row;
- gap: 16rpx;
- }
- .gender-option {
- font-size: 26rpx;
- color: #333;
- padding: 12rpx 32rpx;
- background: #F5F7FA;
- border-radius: 10rpx;
- border: 2rpx solid transparent;
- }
- .gender-option:active { opacity: 0.7; }
- .gender-selected {
- background: #E3F2FD;
- border-color: #5B9BD5;
- color: #1565C0;
- }
- .btn-create-submit {
- background: linear-gradient(135deg, #5B9BD5, #3A7CC4);
- color: #fff;
- font-size: 28rpx;
- font-weight: bold;
- text-align: center;
- padding: 22rpx;
- border-radius: 14rpx;
- margin-top: 10rpx;
- }
- .btn-create-submit:active { opacity: 0.85; }
- /* ===== 鑸岃瘖鎸囨爣 ===== */
- .tongue-indicator-grid {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- gap: 12rpx;
- }
- .tongue-ind-item {
- width: calc(50% - 6rpx);
- background: #F8FAFC;
- border-radius: 16rpx;
- padding: 20rpx 24rpx;
- box-sizing: border-box;
- }
- .tongue-ind-label {
- display: block;
- font-size: 24rpx;
- color: #94A3B8;
- margin-bottom: 8rpx;
- }
- .tongue-ind-value {
- display: block;
- font-size: 28rpx;
- color: #1E293B;
- font-weight: 500;
- }
- .tongue-summary {
- margin-top: 20rpx;
- padding: 20rpx 24rpx;
- background: #FFF8E1;
- border-radius: 16rpx;
- }
- .tongue-summary-title {
- font-size: 24rpx;
- color: #F59E0B;
- font-weight: 600;
- display: block;
- margin-bottom: 8rpx;
- }
- .tongue-summary-text {
- font-size: 26rpx;
- color: #333;
- line-height: 1.6;
- }
- .tip-banner,
- .parsing-banner,
- .confidence-card {
- margin-left: 0;
- margin-right: 0;
- }
- .form-section {
- margin-left: 0;
- margin-right: 0;
- }
- /* 解析中 banner */
- .parsing-banner {
- display: flex;
- align-items: center;
- background: linear-gradient(135deg, #FFF7ED, #FFF0E0);
- border: 1rpx solid #FFD4A8;
- border-radius: 20rpx;
- padding: 28rpx 32rpx;
- margin-bottom: 20rpx;
- }
- .parsing-spinner {
- width: 48rpx;
- height: 48rpx;
- border: 4rpx solid #FFD4A8;
- border-top-color: #FF8C42;
- border-radius: 50%;
- flex-shrink: 0;
- animation: parsing-spin 0.8s linear infinite;
- }
- @keyframes parsing-spin {
- to { transform: rotate(360deg); }
- }
- .parsing-content {
- display: flex;
- flex-direction: column;
- margin-left: 20rpx;
- flex: 1;
- }
- .parsing-main-text {
- font-size: 28rpx;
- font-weight: 600;
- color: #D97706;
- line-height: 1.5;
- }
- .parsing-sub-text {
- font-size: 24rpx;
- color: #92400E;
- line-height: 1.5;
- margin-top: 6rpx;
- opacity: 0.8;
- }
- /* ===== 报告反馈入口 ===== */
- .feedback-entry {
- position: fixed;
- right: 30rpx;
- bottom: 60rpx;
- display: flex;
- flex-direction: row;
- align-items: center;
- background: linear-gradient(135deg, #5B9BD5, #3B82F6);
- border-radius: 44rpx;
- padding: 18rpx 30rpx;
- box-shadow: 0 4rpx 16rpx rgba(59, 130, 246, 0.4);
- z-index: 90;
- }
- .feedback-entry-icon { font-size: 32rpx; margin-right: 10rpx; }
- .feedback-entry-text { font-size: 28rpx; color: #fff; font-weight: 500; }
- .feedback-entry-arrow { font-size: 30rpx; color: #fff; margin-left: 6rpx; }
- .feedback-entry:active { opacity: 0.85; }
- </style>
|