{% extends "base.html" %} {% block title %}推論儀表板 S3{% endblock %} {% block content %}
← 新診 Inference · Step 8 of 8

推論儀表板

六經定位 → 候選方證 → 條文原文(v2 spec 三大區塊)

{% if patient or diff_count %}
{% if patient %}
👤 病人基本資料 (S2-1)
{{ patient.get('name', '?') }} ({{ patient.get('gender', '?') }}, {{ patient.get('age', '?') }} 歲, 體型 {{ patient.get('body_type', '?') }})
{% if patient.get('pregnancy') == 'yes' %}孕婦{% endif %} {% if patient.get('habits') %}習慣: {{ patient.get('habits', [])|join('、') }}
{% endif %} {% if patient.get('history') %}既往: {{ patient.get('history')[:40] }}{% if patient.get('history')|length > 40 %}…{% endif %}{% endif %}
{% endif %} {% if observations_matched %}
👁 望聞切診 ({{ observations_matched|length }} 項)
{% for o in observations_matched %} {{ o.field }}: {{ o.value }} {% endfor %}
{% endif %} {% if bagang and bagang.get('病位') %}
⚡ 八綱快診
病位 {{ bagang.get('病位') }} · 寒熱 {{ bagang.get('寒熱') }} · 虛實 {{ bagang.get('虛實') }} {% if bagang.get('嚴重度') %} · 嚴重度 {{ bagang.get('嚴重度') }}{% endif %} {% if bagang.get('chief_complaint') %}
主訴: {{ bagang.get('chief_complaint') }}{% endif %}
{% endif %} {% if diff_count %}
🔬 S2-7 鑑別答案 ({{ diff_count }} 題)
{% if diff_extra %}
{% for cat, sids in diff_extra.items() %} {{ cat }}: {{ sids|join('、') }}
{% endfor %}
{% else %}
鑑別答案已收, 但未映射到已知症狀 (v0.2.2 mapping 待補)
{% endif %}
{% endif %}
{% endif %} {% if chief_text %}
主訴:{{ chief_text }} {% if cc_info.llm_used and cc_info.symptoms %} ✦ 已併入推論
LLM 抽取:{% for cat, sids in cc_info.symptoms.items() %}{{ cat }}={{ sids|join('、') }}{% if not loop.last %};{% endif %}{% endfor %}
{% elif cc_info.note %} {{ cc_info.note }} {% endif %}
{% endif %} {% if inference %}
Primary
{{ inference[0].name }}病 {{ inference[0].pct }}%
{% if inference|length > 1 %}
Secondary {% for m in inference[1:3] %} {{ m.name }} {{ m.pct }}% {% endfor %}
{% endif %}
{% endif %}
Meridian distribution
{% for m in inference %}
{{ m.name }}
{{ m.pct }}%
{% endfor %}
{% if rag_hits %}
典籍出處 (RAG: 金匱/溫病條辨/千金/景岳/回春/金鑑/醫林改錯)
{% for h in rag_hits %}
{{ h.book }}·{{ h.chapter }} 相關度 {{ "%.0f"|format(h.score * 100) }}%
{{ h.text[:400] }}{% if h.text|length > 400 %}…{% endif %}
{% endfor %}
{% endif %}

候選方證 (Top 3)

{% if rerank_info %}
🤖 LLM rerank: {% if rerank_info.llm_used %} 已啟用 {% if rerank_info.llm_best %}LLM 選 {{ rerank_info.llm_best }}{% endif %} {% if rerank_info.llm_reason %} — {{ rerank_info.llm_reason }}{% endif %} {% if rerank_info.llm_note %}
{{ rerank_info.llm_note }}{% endif %} {% else %} 未啟用 {{ rerank_info.llm_reason }} {% endif %}
{% endif %} {% for p in prescriptions %}
① 候選 #{{ p.rank }} {% if p.rank == 1 %}✓ 推薦{% else %}次選{% endif %}
{{ p.name }}
證型:{{ p.syndrome }}
Match {{ p.match }}% Confidence: {{ p.confidence }}

配對特徵: {% for f in p.matched_features %}{{ f }}{% endfor %} {% for m in p.missing_features %}⚠ {{ m }}{% endfor %}
{% if p.composition %}
Composition
{% for c in p.composition %} {% endfor %}
藥材劑量
{{ c.name }}{{ c.qty }}
{% endif %} {% if p.patient_modifiers %}
⚠ 病人 modifier:
{% endif %} {% if p.rescue_from %}
🚨 救逆 modifier (previous_treatment 觸發):
{% endif %} {% if p.disease_interactions %}
🏥 病史-方證互動 (disease_formula_interactions 觸發):
{% endif %}
Algorithm lens: {% for l in p.algorithm_lens %}{{ l }}{% endfor %}
Rationale: {{ p.rationale }}
{% if p.contraindications %}
⚠ Contraindications
{% endif %}
{{ p.source_text }}
— {{ p.source_ref }}
{% if p.rank == 1 %} 開始服藥觀察 → {% endif %}
{# 三版本對照面板 #} {% if p.versions %} {% endif %} {# 為什麼這個方面板 #} {# 加減項面板 #}
{% endfor %}

Safety

{% for label, ok in safety_checks.items() %} {% if ok %}✓{% else %}✕{% endif %} {{ label.replace('_', ' ').title() }} {% endfor %}
開始服藥觀察 →
{% endblock %}