Files
ws_health/doc/architecture-overview.html
T

1458 lines
54 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ws_health 架构概要设计</title>
<style>
:root {
--bg: #f5f2ed;
--paper: #ffffff;
--ink: #1f242a;
--ink-soft: #414a53;
--muted: #707a85;
--line: #e5ded4;
--line-soft: #f0ebe4;
--accent: #b9602a;
--accent-soft: #fbf0e6;
--accent-line: #eccfae;
--ok: #2f7358;
--ok-soft: #e8f3ee;
--warn: #9a6a1d;
--warn-soft: #fbf3e2;
--bad: #a8442f;
--bad-soft: #fbebe7;
--info: #355f8a;
--info-soft: #eaf1f8;
--radius: 10px;
--mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
margin: 0;
background:
radial-gradient(1200px 500px at 85% -10%, #fdf6ee 0%, transparent 60%),
var(--bg);
color: var(--ink);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
"Microsoft YaHei", "Hiragino Sans GB", sans-serif;
font-size: 15px;
line-height: 1.75;
-webkit-font-smoothing: antialiased;
}
.shell {
max-width: 1180px;
margin: 0 auto;
padding: 44px 28px 80px;
display: grid;
grid-template-columns: 214px minmax(0, 1fr);
gap: 48px;
}
/* ---------- 封面 ---------- */
.cover {
grid-column: 1 / -1;
padding-bottom: 30px;
border-bottom: 1px solid var(--line);
margin-bottom: 6px;
}
.eyebrow {
display: inline-flex;
align-items: center;
gap: 8px;
font-size: 12px;
letter-spacing: 0.16em;
color: var(--accent);
font-weight: 600;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 22px;
height: 2px;
background: var(--accent);
display: inline-block;
}
h1 {
margin: 12px 0 10px;
font-size: 34px;
line-height: 1.25;
letter-spacing: -0.02em;
font-weight: 700;
}
.lead {
margin: 0;
max-width: 760px;
color: var(--ink-soft);
font-size: 15.5px;
}
.meta {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 20px;
}
.chip {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 11px;
border: 1px solid var(--line);
background: var(--paper);
border-radius: 999px;
font-size: 12.5px;
color: var(--ink-soft);
}
.chip b { font-weight: 600; color: var(--ink); }
/* ---------- 侧边目录 ---------- */
aside {
position: relative;
}
.toc {
position: sticky;
top: 24px;
border-left: 2px solid var(--line);
padding-left: 16px;
}
.toc-title {
font-size: 11px;
letter-spacing: 0.14em;
color: var(--muted);
font-weight: 600;
margin-bottom: 12px;
text-transform: uppercase;
}
.toc a {
display: block;
padding: 4px 0;
color: var(--muted);
text-decoration: none;
font-size: 13px;
transition: color 0.15s ease;
}
.toc a:hover { color: var(--accent); }
.toc a.active {
color: var(--accent);
font-weight: 600;
}
.toc .sub {
padding-left: 12px;
font-size: 12.5px;
}
/* ---------- 正文 ---------- */
main { min-width: 0; }
section {
padding: 30px 0 6px;
border-bottom: 1px solid var(--line-soft);
}
section:last-of-type { border-bottom: none; }
h2 {
margin: 0 0 14px;
font-size: 23px;
letter-spacing: -0.01em;
display: flex;
align-items: baseline;
gap: 10px;
}
h2 .no {
font-family: var(--mono);
font-size: 13px;
color: var(--accent);
background: var(--accent-soft);
border: 1px solid var(--accent-line);
border-radius: 6px;
padding: 1px 7px;
position: relative;
top: -2px;
}
h3 {
margin: 26px 0 10px;
font-size: 16.5px;
letter-spacing: 0.005em;
}
h4 {
margin: 20px 0 8px;
font-size: 14.5px;
color: var(--ink-soft);
}
p { margin: 9px 0; }
ul, ol { margin: 8px 0 12px; padding-left: 22px; }
li { margin: 5px 0; }
li::marker { color: var(--accent); }
code {
font-family: var(--mono);
font-size: 0.88em;
background: #f4efe8;
border: 1px solid #ece4d9;
border-radius: 4px;
padding: 1px 5px;
color: #7a4322;
overflow-wrap: anywhere;
}
pre {
margin: 14px 0;
padding: 16px 18px;
background: #262b31;
color: #e8e4dc;
border-radius: var(--radius);
overflow-x: auto;
font-family: var(--mono);
font-size: 12.5px;
line-height: 1.7;
}
pre code {
background: none;
border: none;
padding: 0;
color: inherit;
font-size: inherit;
}
pre .c { color: #8f9aa5; }
pre .k { color: #e0a76a; }
pre .s { color: #a8c7a1; }
.callout {
margin: 18px 0;
padding: 14px 16px;
background: var(--paper);
border: 1px solid var(--line);
border-left: 3px solid var(--accent);
border-radius: 0 var(--radius) var(--radius) 0;
color: var(--ink-soft);
font-size: 14px;
}
.callout b { color: var(--ink); }
.callout.note { border-left-color: var(--info); }
.callout.warn { border-left-color: var(--warn); }
/* ---------- 表格 ---------- */
.table-wrap {
overflow-x: auto;
margin: 14px 0;
border: 1px solid var(--line);
border-radius: var(--radius);
background: var(--paper);
}
table {
width: 100%;
border-collapse: collapse;
font-size: 13.5px;
line-height: 1.6;
}
th {
text-align: left;
padding: 10px 14px;
background: #faf6f0;
color: var(--ink-soft);
font-weight: 600;
border-bottom: 1px solid var(--line);
white-space: nowrap;
}
td {
padding: 9px 14px;
border-bottom: 1px solid var(--line-soft);
vertical-align: top;
color: var(--ink-soft);
}
tr:last-child td { border-bottom: none; }
td b, td strong { color: var(--ink); font-weight: 600; }
.nowrap { white-space: nowrap; }
/* ---------- 标签 ---------- */
.tag {
display: inline-block;
padding: 1px 8px;
border-radius: 999px;
font-size: 11.5px;
line-height: 1.7;
border: 1px solid transparent;
white-space: nowrap;
font-weight: 500;
}
.tag.ok { color: var(--ok); background: var(--ok-soft); border-color: #cfe6da; }
.tag.warn { color: var(--warn); background: var(--warn-soft); border-color: #ecd9b4; }
.tag.bad { color: var(--bad); background: var(--bad-soft); border-color: #efd0c7; }
.tag.info { color: var(--info); background: var(--info-soft); border-color: #cfdeee; }
.tag.gray { color: var(--muted); background: #f3f1ed; border-color: #e5e1da; }
/* ---------- 架构图 ---------- */
.arch {
margin: 18px 0;
padding: 22px;
background: var(--paper);
border: 1px solid var(--line);
border-radius: 12px;
}
.arch-row {
display: grid;
grid-template-columns: 76px minmax(0, 1fr);
gap: 14px;
align-items: stretch;
}
.arch-label {
display: flex;
align-items: center;
justify-content: center;
font-size: 11.5px;
letter-spacing: 0.08em;
color: var(--muted);
border-right: 1px dashed var(--line);
padding-right: 12px;
text-align: center;
}
.arch-nodes {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.node {
flex: 1 1 150px;
min-width: 130px;
padding: 10px 13px;
background: #fdfbf8;
border: 1px solid var(--line);
border-radius: 8px;
font-size: 13px;
line-height: 1.5;
color: var(--ink);
}
.node small {
display: block;
color: var(--muted);
font-size: 11.5px;
margin-top: 2px;
font-family: var(--mono);
}
.node.accent {
background: var(--accent-soft);
border-color: var(--accent-line);
}
.node strong { font-weight: 600; }
.arch-arrow {
text-align: center;
color: var(--muted);
font-size: 11.5px;
letter-spacing: 0.06em;
padding: 8px 0;
}
.arch-arrow span {
display: inline-block;
padding: 0 10px;
background: var(--paper);
}
.arch-divider {
height: 1px;
background: var(--line-soft);
margin: 16px 0;
}
/* ---------- 状态机 ---------- */
.machine {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin: 10px 0 16px;
}
.state {
padding: 5px 12px;
border-radius: 8px;
border: 1px solid var(--line);
background: #fdfbf8;
font-family: var(--mono);
font-size: 12.5px;
color: var(--ink);
}
.state.start { background: #f3f1ed; color: var(--muted); }
.state.end { background: var(--ok-soft); border-color: #cfe6da; color: var(--ok); }
.state.bad { background: var(--bad-soft); border-color: #efd0c7; color: var(--bad); }
.edge {
font-size: 12px;
color: var(--muted);
white-space: nowrap;
}
.edge::after { content: " →"; color: var(--accent); }
/* ---------- 时间线 ---------- */
.timeline {
margin: 18px 0;
padding: 0;
list-style: none;
counter-reset: tl;
}
.timeline li {
position: relative;
padding: 0 0 18px 42px;
counter-increment: tl;
border-left: 1px solid var(--line);
margin-left: 13px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
content: counter(tl);
position: absolute;
left: -13px;
top: 1px;
width: 26px;
height: 26px;
border-radius: 50%;
background: var(--paper);
border: 1px solid var(--accent-line);
color: var(--accent);
font-size: 12px;
font-family: var(--mono);
display: flex;
align-items: center;
justify-content: center;
}
.timeline b { display: block; color: var(--ink); font-size: 14px; }
.timeline span { color: var(--ink-soft); font-size: 13.5px; }
/* ---------- 卡片网格 ---------- */
.grid-2 {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
margin: 14px 0;
}
.card {
padding: 15px 17px;
background: var(--paper);
border: 1px solid var(--line);
border-radius: var(--radius);
}
.card h4 { margin-top: 0; color: var(--ink); }
.card p { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-soft); }
.card .kicker {
font-size: 11px;
letter-spacing: 0.1em;
color: var(--accent);
font-weight: 600;
}
/* ---------- 页脚 ---------- */
.footer {
grid-column: 1 / -1;
margin-top: 36px;
padding-top: 18px;
border-top: 1px solid var(--line);
color: var(--muted);
font-size: 12.5px;
display: flex;
justify-content: space-between;
gap: 16px;
flex-wrap: wrap;
}
.footer a { color: var(--accent); text-decoration: none; }
/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
.shell {
grid-template-columns: 1fr;
padding: 28px 18px 60px;
gap: 24px;
}
aside { order: 2; }
.toc {
position: static;
border-left: none;
border-top: 1px solid var(--line);
padding: 16px 0 0;
display: flex;
flex-wrap: wrap;
gap: 4px 16px;
}
.toc-title { width: 100%; margin-bottom: 6px; }
.toc a { padding: 2px 0; }
.toc .sub { display: none; }
h1 { font-size: 27px; }
h2 { font-size: 20px; }
.arch-row { grid-template-columns: 1fr; }
.arch-label {
justify-content: flex-start;
border-right: none;
border-bottom: 1px dashed var(--line);
padding: 0 0 4px;
}
}
@media (max-width: 620px) {
.grid-2 { grid-template-columns: 1fr; }
.node { flex-basis: 100%; }
}
@media print {
body { background: #fff; font-size: 12px; }
.shell { display: block; max-width: none; padding: 0; }
aside { display: none; }
section { break-inside: avoid-page; }
.table-wrap, .arch, .card { break-inside: avoid; }
a { color: inherit; text-decoration: none; }
}
</style>
</head>
<body>
<div class="shell">
<header class="cover">
<div class="eyebrow">Architecture Overview</div>
<h1>ws_health 架构概要设计</h1>
<p class="lead">
面向陪诊业务的后端服务、两端小程序、Web 管理后台与微信支付链路的整体设计摘要。
本文只保留跨模块的核心方案与不变量,实施细节与未完成事项分别以专项文档和
<a href="./plan.md" style="color:var(--accent);text-decoration:none;">plan.md</a> 为准。
</p>
<div class="meta">
<span class="chip"><b>版本</b> v1.0</span>
<span class="chip"><b>日期</b> 2026-11-10</span>
<span class="chip"><b>代码基准</b> api/health · api/user · ui/wxapp_escort · ui/wxapp_companion · ui/web_escort_admin</span>
<span class="chip"><b>来源</b> 6 份专项设计文档</span>
</div>
</header>
<aside>
<nav class="toc">
<div class="toc-title">目录</div>
<a href="#decisions">01 概览与关键决策</a>
<a href="#topology">02 系统架构</a>
<a href="#identity">03 身份与权限</a>
<a href="#onboarding" class="sub">3.1 陪诊师入驻</a>
<a href="#order">04 订单域</a>
<a href="#payment">05 支付与退款</a>
<a href="#clients">06 管理端设计</a>
<a href="#data">07 数据模型一览</a>
<a href="#nonfunctional">08 安全与一致性</a>
<a href="#status">09 现状与后续</a>
</nav>
</aside>
<main>
<!-- 01 -->
<section id="decisions">
<h2><span class="no">01</span>概览与关键决策</h2>
<p>
ws_health 是一个按业务域拆分目录、独立部署的轻量微服务系统:<code>api/health</code>
承载陪诊业务(订单、健康档案、医院、资源、AI 聊天),<code>api/user</code>
承载平台账号、多应用身份与 token 鉴权;前端包含 C 端小程序、陪诊师小程序与 Vue Web 管理后台。
</p>
<p>
设计的核心不是“服务数量”,而是几条贯穿全系统的边界:<b>账号与授权分离</b>、
<b>订单状态与支付状态分离</b>、<b>业务订单与支付流水分离</b>、
<b>小程序端与管理后台的应用身份分离</b>。
</p>
<div class="table-wrap">
<table>
<thead>
<tr><th>关键决策</th><th>选择</th><th>理由 / 约束</th></tr>
</thead>
<tbody>
<tr>
<td>服务拆分方式</td>
<td>按目录拆分 + nginx 路径路由,各自独立部署</td>
<td>中等流量下足够;避免过早引入注册中心、服务网格等基础设施</td>
</tr>
<tr>
<td>数据库</td>
<td>共用 MongoDB 实例,<b>按服务分库</b></td>
<td>边界清晰、索引不冲突;量级上升后可平滑迁移到独立实例</td>
</tr>
<tr>
<td>鉴权</td>
<td>token 单点在 user 服务,health 实时校验 + 进程内缓存</td>
<td>改造成本低;代价是登出/锁定在 health 侧最多延迟 5 分钟</td>
</tr>
<tr>
<td>多应用身份</td>
<td><code>user</code> / <code>user_app</code> / <code>user_identity</code> 三表</td>
<td>登录身份、应用授权、平台账号生命周期不同,混在一个字段无法建唯一约束</td>
</tr>
<tr>
<td>入驻审批一致性</td>
<td>条件更新抢占 + 幂等补偿,<b>不使用 Mongo 事务</b></td>
<td>部署形态不保证副本集;唯一索引与条件更新足以覆盖并发</td>
</tr>
<tr>
<td>订单归属</td>
<td>管理员代客下单采用<b>档案锚定</b>,无归属可留空</td>
<td>遵守 user 服务“不接受按 userId 明文查询”的安全约束,不新开查人接口</td>
</tr>
<tr>
<td>支付数据</td>
<td>流水表是财务事实源,订单 <code>payment</code> 只是汇总快照</td>
<td>一单多流水、退款可追溯、对账口径统一</td>
</tr>
<tr>
<td>Web 后台身份</td>
<td>独立应用 <code>web-escort-admin</code>,不复用小程序 appId</td>
<td>两端可分别授权、分别停用;管理员判定只认 <code>user_app</code> 成员关系</td>
</tr>
<tr>
<td>小程序角色化</td>
<td>页内切换数据源与入口,<b>不做动态 tabBar</b></td>
<td>微信原生 tabBar 不支持按角色动态隐藏,custom tabBar 成本高</td>
</tr>
</tbody>
</table>
</div>
<div class="callout note">
<b>阅读口径:</b>文中“已实现”指代码与接口已落地;“明确不做”是已评审的边界,不代表遗漏;
仍待开发的事项统一收敛到 <a href="./plan.md" style="color:var(--accent);">plan.md</a>。
</div>
</section>
<!-- 02 -->
<section id="topology">
<h2><span class="no">02</span>系统架构</h2>
<div class="arch">
<div class="arch-row">
<div class="arch-label">客户端</div>
<div class="arch-nodes">
<div class="node"><strong>C 端小程序</strong><small>wxapp_escort</small>下单 / 支付 / 预约记录</div>
<div class="node"><strong>陪诊师小程序</strong><small>wxapp_companion</small>管理员 + 陪诊员共用</div>
<div class="node"><strong>Web 管理后台</strong><small>web_escort_admin</small>Vue 3 + Vite + TS</div>
<div class="node"><strong>微信客户端</strong><small>wx.login / 扫码 / 支付</small></div>
</div>
</div>
<div class="arch-arrow"><span>↓ HTTPS / WSS</span></div>
<div class="arch-row">
<div class="arch-label">接入层</div>
<div class="arch-nodes">
<div class="node accent"><strong>nginx</strong><small>/health → 9004 · /user → 9010 · /ws → 9005</small>同域分流、TLS 终止</div>
</div>
</div>
<div class="arch-arrow"><span>↓ 反向代理</span></div>
<div class="arch-row">
<div class="arch-label">服务层</div>
<div class="arch-nodes">
<div class="node"><strong>health 服务</strong><small>HTTP :9004</small>订单 / 档案 / 医院 / 支付 / 资源</div>
<div class="node"><strong>health 服务</strong><small>WS :9005</small>AI 聊天,Agent 按 userId 缓存</div>
<div class="node"><strong>user 服务</strong><small>HTTP :9010</small>注册登录 / token / 多应用授权</div>
</div>
</div>
<div class="arch-arrow"><span>↓ Mongoose</span></div>
<div class="arch-row">
<div class="arch-label">数据层</div>
<div class="arch-nodes">
<div class="node"><strong>health 业务库</strong><small>escort_record / payment_record / refund_record …</small></div>
<div class="node"><strong>eiot_user 库</strong><small>user / user_app / user_identity</small></div>
</div>
</div>
<div class="arch-divider"></div>
<div class="arch-row">
<div class="arch-label">外部依赖</div>
<div class="arch-nodes">
<div class="node">微信登录<small>jscode2session</small></div>
<div class="node">微信支付<small>APIv3 JSAPI</small></div>
<div class="node">DeepSeek / Tavily<small>AI Agent</small></div>
<div class="node">百度地图<small>位置能力</small></div>
</div>
</div>
</div>
<h3>请求与鉴权链路</h3>
<div class="timeline">
<li>
<b>客户端携带 token</b>
<span>请求头 <code>token: xxx</code> 或 <code>Authorization: Bearer xxx</code>,health 服务两者兼容。</span>
</li>
<li>
<b>health 侧 requireAuth</b>
<span>先查进程内 token→user 缓存(TTL 5 分钟,LRU 上限 2000,无效 token 负缓存 60 秒);未命中再调 user 服务 <code>/user/userInfo</code>。</span>
</li>
<li>
<b>身份与角色判定</b>
<span>管理员看 <code>apps</code> 中的成员关系与 <code>roles</code>;陪诊员看 Employee 档案(<code>role=attendant</code> 且 <code>status=active</code>);订单级权限再由 <code>canAccess</code> 逐单拦截。</span>
</li>
<li>
<b>业务处理</b>
<span>响应 HTTP 状态码恒为 200,业务码在 <code>body.code</code>,提示文案在 <code>body.msg</code>;前端按 <code>body.code</code> 判断会话失效与错误。</span>
</li>
</div>
<div class="callout">
<b>边界:</b>health 服务不直接建模 user 数据,唯一关联字段是 <code>employee.userId</code>(跨服务软引用);
跨服务不做分布式事务,弱一致场景用幂等 + 补偿。
</div>
</section>
<!-- 03 -->
<section id="identity">
<h2><span class="no">03</span>身份与权限</h2>
<p>
用户模型把过去塞在 <code>user.app</code> 一个 Mixed 字段里的三件事拆开:
<b>平台账号</b>、<b>应用成员与授权</b>、<b>外部登录身份</b>。
</p>
<div class="arch" style="padding:18px 22px;">
<div class="arch-row">
<div class="arch-label">核心账号</div>
<div class="arch-nodes">
<div class="node accent"><strong>user</strong><small>平台账号</small>profile / security / status,不保存应用清单</div>
</div>
</div>
<div class="arch-arrow"><span>↓ 1 : N</span></div>
<div class="arch-row">
<div class="arch-label">派生关系</div>
<div class="arch-nodes">
<div class="node"><strong>user_app</strong><small>成员 + 授权</small>roles / status / source / grant / config</div>
<div class="node"><strong>user_identity</strong><small>登录身份</small>appId + provider + openid / unionid</div>
</div>
</div>
</div>
<div class="table-wrap">
<table>
<thead>
<tr><th>集合</th><th>回答的问题</th><th>关键唯一约束</th></tr>
</thead>
<tbody>
<tr>
<td><code>user</code></td>
<td>“这个人是谁”</td>
<td><code>profile.mobile</code> unique + sparse</td>
</tr>
<tr>
<td><code>user_app</code></td>
<td>“他能进哪个应用、是什么角色、是否被停用”</td>
<td><code>{ userId, appId }</code> unique;<code>status</code> 取 <code>active / disabled</code></td>
</tr>
<tr>
<td><code>user_identity</code></td>
<td>“他用什么方式登录”</td>
<td><code>{ appId, provider, openid }</code> unique partial;<code>{ provider, unionid }</code> unique partial</td>
</tr>
</tbody>
</table>
</div>
<h3>授权规则</h3>
<ul>
<li><b>登录只授予 <code>user</code></b>:管理员角色只能通过 <code>POST /user/grant</code> 或运维脚本显式授予,登录接口不会产生管理员。</li>
<li><b>角色校验必须带应用维度</b>:<code>auth({ appId, roles })</code>;声明了 <code>appId</code> 就必须存在 <code>status=active</code> 的成员关系,否则 403。只写 <code>roles</code> 不写 <code>appId</code> 视为路由配置错误。</li>
<li><b>撤销不删成员</b>:撤销角色只 <code>$pull</code> roles,保留成员记录便于审计;撤销前校验“至少保留一个启用管理员”。</li>
<li><b>应用注册表集中维护</b>:<code>APP_REGISTRY</code> 记录 appId → platform / provider,启动时校验 conf.json 覆盖情况,配置缺失在部署阶段暴露。</li>
</ul>
<h3>health 侧如何判定管理员与陪诊员</h3>
<div class="table-wrap">
<table>
<thead>
<tr><th>身份</th><th>判定依据</th><th>可访问范围</th></tr>
</thead>
<tbody>
<tr>
<td><b>管理员</b></td>
<td><code>userInfo</code> 返回的 <code>apps</code> 中存在 <code>wxapp-escort-admin</code> 或 <code>web-escort-admin</code>,<code>roles</code> 含 <code>admin</code> 且未停用;过渡期兼容旧 <code>app</code> 字段</td>
<td>全量订单、档案、医院写接口、培训报名、陪诊师管理、退款查单、删除订单</td>
</tr>
<tr>
<td><b>陪诊员</b></td>
<td>Employee 档案 <code>role=attendant</code> + <code>status=active</code></td>
<td>本人名下订单、本人订单状态流转、支付查单、服务记录</td>
</tr>
<tr>
<td><b>C 端用户</b></td>
<td>token 用户本人</td>
<td><code>/escort-record/my</code>、<code>/health-profile/mine</code>、支付 / 取消</td>
</tr>
</tbody>
</table>
</div>
<h3>user ↔ employee 关联加固</h3>
<ul>
<li><code>employee.userId</code> 建 <b>partial unique</b> 索引(仅约束 ObjectId 类型),一人最多一条员工档案;换微信号走人工改绑,不自动合并。</li>
<li><code>employee.userIdSource</code> 记录绑定来源:<code>manual</code> / <code>application</code>,可追溯。</li>
<li><code>employeeNo</code> 为 <code>unique + sparse</code>,<b>不能设默认空串</b>;建档路径显式生成 <code>ATT{yyyyMMdd}{4位随机}</code>,撞号换号重试。</li>
<li>三层身份各司其职:<code>user.apps</code> 中有 <code>wxapp-escort-admin</code> 只代表“进过陪诊师端”;<code>attendant_application</code> 代表“申请过程”;<code>employee</code>(attendant + active)才代表权限。</li>
</ul>
<!-- 3.1 -->
<div id="onboarding"></div>
<h3>3.1 陪诊师入驻</h3>
<p>
新增一条完整链路:<b>微信登录 → 无身份仅见申请页 → 提交资料 → Web 后台审核 → 通过后自动建档 → 全功能开放</b>。
申请数据独立成表,员工表只保存审核通过的真实员工。
</p>
<div class="machine">
<span class="state start">无申请</span>
<span class="edge">提交</span>
<span class="state">pending</span>
<span class="edge">通过</span>
<span class="state end">approved</span>
<span class="edge">(已是员工)</span>
</div>
<div class="machine">
<span class="state">pending</span>
<span class="edge">驳回</span>
<span class="state bad">rejected</span>
<span class="edge">重新提交</span>
<span class="state">新的 pending</span>
</div>
<div class="table-wrap">
<table>
<thead>
<tr><th>设计点</th><th>方案</th></tr>
</thead>
<tbody>
<tr>
<td>数据模型</td>
<td><code>attendant_application</code>:申请人信息、服务城市、资质 / 健康证 data URL、状态、审核记录、<code>approvedEmployeeId</code>(补偿用)</td>
</tr>
<tr>
<td>并发防重</td>
<td><code>{ userId: 1 }</code> partial unique(仅 <code>status=pending</code>);提交先查后插,撞 <code>11000</code> 回落原单</td>
</tr>
<tr>
<td>审批一致性</td>
<td>先条件更新抢占 <code>pending → approved</code>;再幂等建档;失败可重按“通过”续跑,<b>不用事务</b></td>
</tr>
<tr>
<td>建档规则</td>
<td>无档案则新建并显式生成工号;已有 <code>attendant</code> 档案则激活并同步字段;其他岗位抛冲突、申请单回滚为 pending</td>
</tr>
<tr>
<td>材料处理</td>
<td>证件照留在申请表做审计,<b>不复制进 employee</b>;仅回填健康证到期日等结构化字段</td>
</tr>
<tr>
<td>结果感知</td>
<td>不做主动推送;用户下次进入小程序时申请页 / 全局守卫强刷角色即可感知</td>
</tr>
</tbody>
</table>
</div>
<h4>审批幂等逻辑</h4>
<pre><code><span class="c">// 第一步:只有 pending 能被抢占,两个管理员并发只有一个成功</span>
doc = findOneAndUpdate({ _id, status: <span class="s">"pending"</span> }, { $set: { status: <span class="s">"approved"</span>, review } })
<span class="c">// 已处理过:approved 但未回填员工 → 续跑;已回填 → 幂等成功;其余 → 409</span>
<span class="c">// 第二步:ensureEmployee(doc) 幂等建档,成功后回填 approvedEmployeeId</span></code></pre>
<h4>小程序全局守卫</h4>
<ol>
<li>包装全局 <code>Page()</code> 构造器,在每个页面 <code>onShow</code> 后统一执行守卫,避免逐页遗漏。</li>
<li>当前路由在白名单(申请页)→ 直接放行。</li>
<li><code>ensureRoleSafe()</code> 解析失败(5xx / 断网)→ <b>停留当前页</b>,不跳转,避免误踢在职陪诊师。</li>
<li><code>role === "none"</code> → <code>reLaunch</code> 到申请页;<code>admin / attendant</code> 正常放行。</li>
</ol>
<div class="callout warn">
<b>明确不做:</b>撤回申请、审核结果订阅消息、给 <code>/escort-record</code> 增加身份中间件(C 端共用这些接口)、把材料照片复制到 employee。
</div>
</section>
<!-- 04 -->
<section id="order">
<h2><span class="no">04</span>订单域</h2>
<p>
<code>escort_record</code> 是业务聚合根,同时保存<b>归属引用</b>、<b>就诊人快照</b>、
<b>服务与排期</b>、<b>陪诊员</b>、<b>医院</b>、<b>费用快照</b>、<b>取消信息</b>等。
快照字段保证档案被修改或删除后,历史订单仍可完整还原。
</p>
<h3>三个正交状态维度</h3>
<div class="table-wrap">
<table>
<thead>
<tr><th>维度</th><th>取值</th><th>迁移规则</th></tr>
</thead>
<tbody>
<tr>
<td>服务状态 <code>status</code></td>
<td><code>pending → confirmed → in_progress → completed</code></td>
<td>单向;<code>completed</code> 为终态,不可回退</td>
</tr>
<tr>
<td>取消状态 <code>cancelStatus</code></td>
<td><code>none / requested / cancelled</code></td>
<td>只允许 <code>none → requested / cancelled</code>、<code>requested → cancelled</code></td>
</tr>
<tr>
<td>支付状态 <code>payment.status</code></td>
<td><code>unpaid / partial / paid / refunding / refunded</code></td>
<td>已收款后禁止改支付状态、实收金额、总金额;退款由支付链路推进</td>
</tr>
</tbody>
</table>
</div>
<p>
取消与支付是独立维度:服务状态只描述履约生命周期,取消用 <code>cancelStatus</code> 表达,
展示优先级取 <code>cancelStatus</code>。用户端只保留“取消订单”,不提供删除入口。
</p>
<h3>服务目录是预约规则的唯一事实源</h3>
<p>
<code>api/health/resource/services.js</code> 定义服务价格、可服务区域、
<code>advanceDays</code>、<code>durationMinutes</code>、<code>sessions</code>、
<code>requiresAddress</code>。后端下单 / 改期会<b>忽略</b>客户端提交的
<code>schedule.duration</code> 与 <code>payment.totalFee</code>,按目录重新派生并校验;
前端只能只读展示,不能自行填写。
</p>
<h3>订单归属:档案锚定</h3>
<ul>
<li>管理员代客下单<b>不传 userId</b>(传了也忽略),订单归属取所选健康档案的 <code>profile.userId</code>。</li>
<li>档案无归属时允许下单,订单 <code>userId</code> 留空;后期由管理员在订单编辑中补归属,补齐后 C 端才可见。</li>
<li>不新开“按 userId 查用户”的接口,遵守 user 服务的安全约束。</li>
<li>无主订单必须跳过“每人最多 3 张未完成单”的校验,否则会按空 userId 统计全部无主订单并全局拦截。</li>
<li>新建订单携带 <code>idempotencyKey</code>,防止连点重复建单。</li>
</ul>
<h3>权限与查询口径</h3>
<div class="table-wrap">
<table>
<thead>
<tr><th>场景</th><th>接口 / 规则</th></tr>
</thead>
<tbody>
<tr>
<td>管理员全量列表</td>
<td><code>GET /escort-record</code>,<code>requireAuth + requireAdmin</code></td>
</tr>
<tr>
<td>陪诊员本人列表</td>
<td><code>GET /escort-record/attendant</code>,按 <code>attendant.id = 当前 userId</code> 限定,复用管理员的过滤 / 分页 / 支付窗口派生逻辑</td>
</tr>
<tr>
<td>单条访问</td>
<td><code>HandlerEscortRecord.canAccess</code> 逐单判定:管理员放行,陪诊员仅本人名下</td>
</tr>
<tr>
<td>列表筛选</td>
<td>服务状态(多值)、取消状态、支付状态、支付渠道、预约日期 / 时间段、关键词(就诊人 / 陪诊员 / 医院 / 订单号)、userId、healthProfileId</td>
</tr>
<tr>
<td>计数一致性</td>
<td>筛选条件统一收敛到 <code>buildRecordFilter</code>,列表与 <code>counts</code> 必须同源,避免页签角标与列表不一致</td>
</tr>
</tbody>
</table>
</div>
<div class="callout">
<b>为什么 C 端与管理端共用写接口:</b>下单、改单、取消同属一套状态机与资金规则;
追加身份中间件会直接打断 C 端。越权风险由逐单 <code>canAccess</code> 与字段白名单控制。
</div>
</section>
<!-- 05 -->
<section id="payment">
<h2><span class="no">05</span>支付与退款</h2>
<h3>选型</h3>
<div class="table-wrap">
<table>
<thead>
<tr><th>要素</th><th>结论</th></tr>
</thead>
<tbody>
<tr><td>支付产品</td><td>小程序支付(JSAPI 下单 + <code>wx.requestPayment</code>)</td></tr>
<tr><td>商户 / API</td><td>普通商户直连,APIv3,JSON 报文 + RSA-SHA256 签名</td></tr>
<tr><td>验签</td><td>微信支付公钥(<code>PUB_KEY_ID_</code>),长期有效免轮换</td></tr>
<tr><td>SDK</td><td>Node 内置 <code>crypto</code> 自实现,无新增依赖</td></tr>
<tr><td>支付窗口</td><td>下单显式传 <code>time_expire</code>,默认 24 小时且不晚于服务开始当天;窗口以下单时间为起点固定计算</td></tr>
</tbody>
</table>
</div>
<h3>数据模型:订单快照 + 流水事实源</h3>
<div class="arch" style="padding:18px 22px;">
<div class="arch-row">
<div class="arch-label">业务</div>
<div class="arch-nodes">
<div class="node accent"><strong>escort_record</strong><small>业务订单</small>status + <code>payment</code> 汇总快照(展示用)</div>
</div>
</div>
<div class="arch-arrow"><span>↓ 1 : N,每次支付尝试一条</span></div>
<div class="arch-row">
<div class="arch-label">资金</div>
<div class="arch-nodes">
<div class="node"><strong>payment_record</strong><small>支付流水</small>outTradeNo / transactionId / 状态机 / 事件时间戳</div>
<div class="node"><strong>refund_record</strong><small>退款流水</small>outRefundNo / refundId / 状态 / 入账账户</div>
</div>
</div>
</div>
<ul>
<li><b>金额全链路用“分”(int)</b>:由 <code>service.price</code> 字符串按小数点拆位得到整数分,不做元 × 100 浮点运算,只在展示层转元。</li>
<li><b>一单可多流水,单号不重用</b>:<code>outTradeNo = 订单_id + "-" + 尝试序号</code>,唯一索引;订单的 <code>payment.paymentRecordId</code> 指向当前有效流水。</li>
<li><b>支付方式双字段</b>:<code>payChannel</code> 是用户选择的渠道(<code>online_wechat / offline</code>),<code>method</code> 是实际收款方式(空 / <code>online_wechat</code> / <code>offline_cash</code> / <code>offline_transfer</code>);避免把未收到的钱记成已按某方式收款。</li>
</ul>
<h3>支付主链路</h3>
<div class="timeline">
<li>
<b>创建支付</b>
<span>校验订单本人 / 待支付 / 金额大于 0 / 未超支付窗口;同一订单按 recordId 进程内串行,防止并发产生两条在途流水。</span>
</li>
<li>
<b>JSAPI 下单</b>
<span>prepay_id 有效期内(2 小时)重复点击直接复用;已过期但仍在支付窗口内,<b>沿用原 outTradeNo 与原参数重下</b>;旧流水已关闭或窗口到期才换新号。</span>
</li>
<li>
<b>前端调起收银台</b>
<span>前端回调不可信;支付后必须调后端查单确认,以后端结果为准。</span>
</li>
<li>
<b>支付回调(权威)</b>
<span>验签 → AES-256-GCM 解密 → 校验 <code>out_trade_no</code> / 金额 / <code>mchid</code> / <code>appid</code> / <code>currency</code> → 写流水 → 刷订单快照 → 5 秒内应答 200,重复推送幂等。</span>
</li>
<li>
<b>取消 / 切换支付方式</b>
<span>若存在在途流水,必须先关单;关单失败当场查单一次:已支付则中止切换并转退款,未确认则标记 <code>closed_unconfirmed</code> 交给巡检。</span>
</li>
<li>
<b>退款</b>
<span>先写 <code>refund_record(processing)</code> 再调退款接口;超时/系统异常先查退款,未受理则同一 <code>outRefundNo</code> 原参数重试一次;回调或管理端查单补写终态。</span>
</li>
</div>
<h3>关键一致性规则</h3>
<div class="table-wrap">
<table>
<thead>
<tr><th>场景</th><th>处理</th></tr>
</thead>
<tbody>
<tr>
<td>已取消订单收到支付回调</td>
<td>流水仍落 <code>pay_success</code>(钱确实到账,是财务事实),订单快照保持 <code>cancelled</code>;应答 200 之后异步发起原路全额退款</td>
</tr>
<tr>
<td>存在未决流水时改价</td>
<td>禁止修改 <code>payment.totalFee</code>;要调价必须先关单,否则微信侧金额与本地流水错位</td>
</tr>
<tr>
<td>手工标记“线上微信 + 已支付”</td>
<td>必须存在支付流水,否则 400;线上收款只能由支付回调写入</td>
</tr>
<tr>
<td>线下收款</td>
<td>平台补记 <code>offline_cash / offline_transfer</code> + <code>paidFee</code>,按金额推导 <code>unpaid / partial / paid</code>;不改动履约链路</td>
</tr>
<tr>
<td>回调验签 / 解密 / 字段校验失败</td>
<td>只记日志并应答 4XX/5XX,<b>不落业务库</b>(报文不可信)</td>
</tr>
<tr>
<td>外部调用异常</td>
<td>统一记 <code>lastError { stage, code, message, requestId, httpStatus, at }</code>、<code>errorCount</code>、<code>lastAttemptAt</code>;接口只返回通用提示,不暴露内部细节</td>
</tr>
</tbody>
</table>
</div>
<h3>后台巡检(回调丢失的唯一兜底)</h3>
<ul>
<li>服务启动时注册单一定时器,默认运行,每 10 分钟扫一次最近 7 天内的 <code>created</code> / <code>closed_unconfirmed</code> 流水。</li>
<li><code>created</code>:查单为 <code>SUCCESS</code> 则按回调同一套逻辑收敛;<code>NOTPAY</code> 且已过 <code>timeExpireAt</code> 则关单置 <code>closed</code>。</li>
<li><code>closed_unconfirmed</code>:查单确认,未支付补记 <code>closed</code>,已支付转退款。</li>
<li>对账以 <code>transactionId / outTradeNo</code> 为键,与微信交易账单逐笔核对;本期不做自动账单下载,保留人工对账与巡检兜底。</li>
</ul>
</section>
<!-- 06 -->
<section id="clients">
<h2><span class="no">06</span>管理端设计</h2>
<h3>6.1 陪诊师小程序(wxapp_companion)</h3>
<ul>
<li><b>角色化</b>:登录后解析 <code>admin / attendant / none</code>;管理员看全量数据,陪诊员只看本人订单;tabBar 静态不变,入口与数据源在页内切换。</li>
<li><b>全局守卫</b>:包装 <code>Page()</code> 统一注入;无身份跳申请页;角色解析失败停留当前页。</li>
<li><b>入驻申请页</b>:未申请 / 已驳回展示表单并可预填;待审核展示静态说明;已是员工直接回首页。页脚展示当前微信账号,不提供无效的“退出登录”。</li>
<li><b>订单操作</b>:管理员可补录线下收款、取消、退款查单、删除;陪诊员只能做状态流转与服务记录;已收款订单的支付字段锁定只读。</li>
</ul>
<h3>6.2 Web 管理后台(web_escort_admin)</h3>
<div class="table-wrap">
<table>
<thead>
<tr><th>项</th><th>设计</th></tr>
</thead>
<tbody>
<tr>
<td>技术栈</td>
<td>Vue 3 + Vite + TypeScript + Pinia(persistedstate)+ Vue Router + Bootstrap 5 / INSPINIA</td>
</tr>
<tr>
<td>登录</td>
<td>手机号 + 密码(<code>POST /user/signin</code>)或微信扫码(<code>/user/wechat/qr/*</code>,一次性 ticket 换 token)</td>
</tr>
<tr>
<td>身份判定</td>
<td>路由守卫拉 <code>/user/userInfo</code>,要求 <code>apps</code> 中存在 <code>web-escort-admin</code> 且 <code>roles</code> 含 <code>admin</code></td>
</tr>
<tr>
<td>请求封装</td>
<td>HTTP 状态码恒 200;<code>body.code === 401</code> 清会话跳登录;<code>body.code !== 0</code> 用 <code>body.msg</code> 提示</td>
</tr>
<tr>
<td>一期模块</td>
<td>工作台、订单管理(列表 / 详情 / 状态流转 / 支付补录 / 取消审核 / 退款核销 / 软删除)、用户管理(锁定 / 解锁)、就诊人管理、陪诊师管理(含入驻审核页签与材料弹窗)</td>
</tr>
<tr>
<td>二期模块</td>
<td>医院管理、培训报名审核闭环、内容配置(协议 / 指南);管理员授权管理可复用 <code>/user/grant</code></td>
</tr>
</tbody>
</table>
</div>
<div class="callout note">
<b>安全边界:</b>扫码只解决“你是谁”,不解决“能不能进后台”——不自动建号、不自动授予 admin;
未授权的微信号一律拒绝。token 不放进 URL,只带一次性 ticket。
</div>
</section>
<!-- 07 -->
<section id="data">
<h2><span class="no">07</span>数据模型一览</h2>
<div class="table-wrap">
<table>
<thead>
<tr><th>库</th><th>集合</th><th>职责</th><th>关键索引 / 约束</th></tr>
</thead>
<tbody>
<tr>
<td rowspan="3">eiot_user</td>
<td><code>user</code></td>
<td>平台账号、资料、安全凭证、账号状态</td>
<td><code>profile.mobile</code> unique sparse</td>
</tr>
<tr>
<td><code>user_app</code></td>
<td>应用成员、角色、启停用、授权来源、个人配置</td>
<td><code>{ userId, appId }</code> unique;<code>{ appId, status }</code>、<code>{ appId, roles }</code></td>
</tr>
<tr>
<td><code>user_identity</code></td>
<td>微信 / 密码等外部登录身份、unionid</td>
<td><code>{ appId, provider, openid }</code> unique partial;<code>{ provider, unionid }</code> unique partial</td>
</tr>
<tr>
<td rowspan="8">health 业务库</td>
<td><code>employee</code></td>
<td>员工档案:岗位、状态、工号、服务区域、健康证、公示信息</td>
<td><code>{ userId }</code> unique partial(ObjectId);<code>employeeNo</code> unique sparse</td>
</tr>
<tr>
<td><code>attendant_application</code></td>
<td>陪诊师入驻申请、材料、审核记录</td>
<td><code>{ userId }</code> unique partial(pending);<code>{ status, meta.createtime }</code></td>
</tr>
<tr>
<td><code>escort_record</code></td>
<td>订单聚合:患者快照、服务、陪诊员、医院、排期、费用快照、取消</td>
<td>按 userId / attendant.id / status / appointmentDate / payment.status 查询</td>
</tr>
<tr>
<td><code>payment_record</code></td>
<td>支付流水(财务事实源)</td>
<td><code>outTradeNo</code> unique;<code>transactionId</code> unique sparse;<code>{ recordId }</code></td>
</tr>
<tr>
<td><code>refund_record</code></td>
<td>退款流水</td>
<td><code>outRefundNo</code> unique;<code>refundId</code> unique sparse</td>
</tr>
<tr>
<td><code>health_profile</code></td>
<td>就诊人档案,可归属某个 C 端用户</td>
<td><code>{ userId }</code>、<code>{ name, mobile }</code></td>
</tr>
<tr>
<td><code>hospital</code></td>
<td>医院库:名称、主体、省市、地址、科室、等级</td>
<td>拼音 / 复旦排名由服务端派生</td>
</tr>
<tr>
<td><code>training_application</code></td>
<td>培训报名</td>
<td>按状态与提交时间查询</td>
</tr>
</tbody>
</table>
</div>
</section>
<!-- 08 -->
<section id="nonfunctional">
<h2><span class="no">08</span>安全与一致性</h2>
<div class="grid-2">
<div class="card">
<div class="kicker">SECURITY</div>
<h4>敏感数据边界</h4>
<p>
身份证号与证件照片只允许 <code>requireAdmin</code> 获取;审核列表不返回大图与身份证号,
详情单独按 id 查询。图片入参校验 data URL 前缀、base64 合法性与 JPEG/PNG 文件头,
不只信 MIME。
</p>
</div>
<div class="card">
<div class="kicker">AUDIT</div>
<h4>可追溯</h4>
<p>
审批人、审批时间、驳回原因全部落库;支付与退款保留完整事件时间戳、
<code>bankType</code>、<code>successTime</code>、<code>Request-ID</code> 与错误快照。
</p>
</div>
<div class="card">
<div class="kicker">CONSISTENCY</div>
<h4>幂等优先,不上分布式事务</h4>
<p>
全系统以唯一索引 + 条件更新 + upsert 为基础:申请靠 pending 唯一索引,
审批靠条件抢占,支付靠流水号唯一索引与状态条件更新,用户绑定靠 openid 唯一索引。
</p>
</div>
<div class="card">
<div class="kicker">MIGRATION</div>
<h4>索引变更走显式脚本</h4>
<p>
同键不同选项的索引不能共存,迁移脚本按“查重 → 删旧索引 → 建新索引”执行;
所有 model 挂 <code>error</code> 监听,避免索引创建失败导致进程启动即崩。
</p>
</div>
</div>
<h3>已知取舍</h3>
<div class="table-wrap">
<table>
<thead>
<tr><th>取舍</th><th>影响</th><th>触发条件 / 后续</th></tr>
</thead>
<tbody>
<tr>
<td>health 侧 token 缓存 5 分钟</td>
<td>登出 / 锁定最多延迟 5 分钟生效</td>
<td>可接受;后续引入 JWT 短 access + refresh 可改善</td>
</tr>
<tr>
<td>单 token</td>
<td>管理端登录会把 C 端踢下线</td>
<td><code>user_session</code> 作为独立事项另行评估</td>
</tr>
<tr>
<td>限流、微信 access_token、WS Agent 缓存均为进程内存态</td>
<td>nginx 挂多实例后失效</td>
<td>水平扩容前外移 Redis</td>
</tr>
<tr>
<td>两服务各一份 conf.json</td>
<td>Mongo 连接信息重复、凭证轮换需改多处</td>
<td>中期统一到服务器级 <code>.env</code></td>
</tr>
<tr>
<td>旧 <code>user.app</code> 字段仍在</td>
<td>身份数据存在双写与兼容读取</td>
<td>所有客户端改读 <code>apps</code> 后的下个发布周期移除</td>
</tr>
</tbody>
</table>
</div>
</section>
<!-- 09 -->
<section id="status">
<h2><span class="no">09</span>现状与后续</h2>
<h3>已落地的主干</h3>
<div class="table-wrap">
<table>
<thead>
<tr><th>域</th><th>状态</th><th>说明</th></tr>
</thead>
<tbody>
<tr>
<td>用户多应用模型</td>
<td><span class="tag ok">已实施</span></td>
<td>三表、APP_REGISTRY、appId 维度的 auth、grant / app-config 接口已落地;旧 app 字段处于兼容期</td>
</tr>
<tr>
<td>陪诊师入驻</td>
<td><span class="tag ok">已实施</span></td>
<td>申请 / 审核 / 自动建档 / 全局守卫 / Web 审核页签全链路完成</td>
</tr>
<tr>
<td>订单域</td>
<td><span class="tag ok">已实施</span></td>
<td>状态机、筛选与计数、代客下单档案锚定、陪诊员列表、服务目录派生均已落地</td>
</tr>
<tr>
<td>微信支付</td>
<td><span class="tag ok">已实施</span></td>
<td>JSAPI 下单 / 查单 / 关单 / 退款 / 回调 / 巡检 / 错误落库已接入;商户配置与合规为上线前运维项</td>
</tr>
<tr>
<td>Web 后台一期</td>
<td><span class="tag ok">已实施</span></td>
<td>登录、工作台、订单、用户、就诊人、陪诊师(含入驻审核)已可用</td>
</tr>
<tr>
<td>陪诊师小程序同步改造</td>
<td><span class="tag warn">部分完成</span></td>
<td>角色层与订单主链路已完成;客户详情、档案归属、培训、医院库、请求层配置等仍待补齐</td>
</tr>
<tr>
<td>用户模型收尾</td>
<td><span class="tag warn">部分完成</span></td>
<td>P4(删旧 app、strict: true)与 P5(下游完全改读 apps)未完成</td>
</tr>
</tbody>
</table>
</div>
<div class="callout">
<b>后续工作不在本文展开。</b>所有未完成事项、上线前运维清单、明确延后项与待产品确认问题,
统一维护在 <a href="./plan.md" style="color:var(--accent);font-weight:600;">plan.md</a>。
</div>
<h3>相关专项文档</h3>
<ul>
<li><a href="./backend-architecture.md">backend-architecture.md</a>:后端结构、鉴权缓存、扩容前优化</li>
<li><a href="./user-multi-app-plan.md">user-multi-app-plan.md</a>:多应用账号模型与迁移</li>
<li><a href="./attendant-onboarding-plan.md">attendant-onboarding-plan.md</a>:入驻申请与审核</li>
<li><a href="./escort-admin-sync-plan.md">escort-admin-sync-plan.md</a>:陪诊师端功能同步差距</li>
<li><a href="./web-escort-admin-plan.md">web-escort-admin-plan.md</a>:Web 后台方案</li>
<li><a href="./wechatpay-plan.md">wechatpay-plan.md</a>:微信支付接入与资金安全</li>
</ul>
</section>
</main>
<footer class="footer">
<span>ws_health 架构概要设计 · v1.0 · 2026-11-10</span>
<span>未完成事项见 <a href="./plan.md">plan.md</a></span>
</footer>
</div>
<script>
(function () {
var links = Array.prototype.slice.call(document.querySelectorAll('.toc a'));
var sections = links
.map(function (link) {
var id = link.getAttribute('href').slice(1);
return document.getElementById(id);
})
.filter(Boolean);
if (!('IntersectionObserver' in window)) return;
var observer = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (!entry.isIntersecting) return;
links.forEach(function (link) {
link.classList.toggle(
'active',
link.getAttribute('href') === '#' + entry.target.id
);
});
});
}, { rootMargin: '-15% 0px -70% 0px', threshold: 0 });
sections.forEach(function (section) { observer.observe(section); });
})();
</script>
</body>
</html>