diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 7a73a41..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} \ No newline at end of file diff --git a/SYSTEM-OVERVIEW.md b/SYSTEM-OVERVIEW.md new file mode 100644 index 0000000..776bd63 --- /dev/null +++ b/SYSTEM-OVERVIEW.md @@ -0,0 +1,334 @@ +# 医科高校 AI 学习中心 · 系统功能全景图 + +## 系统定位 + +**医科类高校 AI 学习中心**是面向医学院校的智能学习平台,以"能力"为核心,贯穿基础医学→临床医学→见习实习→住院医师培养的完整成长链。系统将学生在校的所有学习活动(课程、对练、科研、协作)统一汇入能力图谱,形成数据贯通的闭环成长体系。 + +--- + +## 用户角色与核心价值 + +``` +┌─────────────────────────────────────────────────────────────────────┐ +│ 医科高校 AI 学习中心 │ +├────────────────┬───────────────────┬────────────────────────────────┤ +│ 🎓 学生 │ 👨‍🏫 导师 │ 🔧 管理员 │ +│ │ │ │ +│ • 全程学习汇聚 │ • 题目质量把关 │ • AI 技能定义与治理 │ +│ • AI 智能训练 │ • 成果点评指导 │ • 权限与合规管理 │ +│ • 能力画像可视化│ • 学生画像监测 │ • 审计日志与安全 │ +│ • 职业规划闭环 │ • 教学问责 │ │ +│ • 科研能力培养 │ │ │ +│ • 负责任AI协作 │ │ │ +└────────────────┴───────────────────┴────────────────────────────────┘ +``` + +--- + +## 功能模块全景 + +### 一、学生端功能矩阵 + +#### 1. 个人学习空间 +**价值**:一站式汇聚成长链上所有学习内容,告别分散记录 + +| 功能 | 说明 | +|------|------| +| 成果记录 | 支持 9 种类型:课程记录、作业、实验报告、临床见习/实习、OSCE 考核、文献阅读、科研成果、证书、执业资格备考 | +| 自动归档 | 按学年、学期、临床轮转科室三维度自动归类 | +| 里程碑标记 | 标记阶段性成长节点,关联该阶段内学习成果 | +| 智能检索 | 按类型/学年/学期/科室筛选,时间倒序,分页浏览 | +| 能力关联 | 每条成果自动映射到能力图谱中的能力标签 | + +#### 2. AI 评估与反馈 +**价值**:实时获得 AI 对学习进度的过程性与阶段性评价 + +| 功能 | 说明 | +|------|------| +| 形成性评价 | 每新增一条学习成果,30 秒内获得 AI 过程性反馈 | +| 终结性评价 | 完成里程碑时,基于该阶段全部成果生成综合画像 | +| 发展建议 | 每条建议精确指向能力图谱中的具体能力维度 | +| 可信标注 | 所有 AI 评价附带来源依据与置信度,可追溯核验 | + +#### 3. 课程对练 +**价值**:AI 生成高质量练习题,导师把关,模拟真实考试场景 + +``` +课程内容 ──AI生成题目──→ 导师审核 ──通过──→ 学生对练 ──→ 结果诊断 + │ + └─退回(附原因) +``` + +| 功能 | 说明 | +|------|------| +| 智能出题 | 支持 A1-A4 型选择题、病例分析题、临床决策题 | +| 权威保障 | 每题绑定权威知识源(教材/指南/官方题库) | +| 导师审核 | 题目经导师通过后才可使用,退回需注明原因 | +| 模拟对练 | 逐题呈现、限时作答(120秒/题)、即时判定 | +| 诊断报告 | 正确率、用时、薄弱环节分析(<60% 能力标签) | +| 改进建议 | 针对每个薄弱环节生成具体建议 | +| 间隔重复 | SM-2 算法优先复现错题与即将遗忘的题 | +| 模拟考试 | 限时批量答题,交卷后统一批阅 | + +#### 4. 临床情景对话对练 +**价值**:模拟真实问诊场景,训练临床沟通与决策能力 + +| 功能 | 说明 | +|------|------| +| 情景呈现 | 基于权威知识源的临床情景(含难度、时长、考核重点) | +| 多轮对话 | 与 AI 模拟患者进行最多 50 轮对话 | +| 角色扮演 | AI 以设定角色应答,保持情景连贯 | +| 三维评估 | 问诊完整性 + 临床推理 + 医患沟通 三方面评分 | +| 上下文记忆 | 携带最近 10 轮历史,保持对话连贯 | + +#### 5. 能力画像 +**价值**:全方位量化呈现个人能力分布,辅助就业与发展决策 + +``` + 知识掌握 + ▲ + 职业倾向 / \ 临床技能 + / \ + AI协同素养───科研能力 + \ + 人文素养 +``` + +| 功能 | 说明 | +|------|------| +| 六维画像 | 知识掌握、临床技能、科研能力、人文素养、AI协同素养、职业倾向 | +| 量化评分 | 每个维度 0-100 分值 | +| 数据溯源 | 每项结论可追溯到具体学习成果或对练记录 | +| 动态更新 | 能力图谱数据更新后自动重算 | +| 成长趋势 | 能力维度时间序列,可视化成长曲线 | + +#### 6. 职业规划 +**价值**:明确职业目标与能力差距,获得可执行的发展计划 + +``` +设定职业目标 → 匹配岗位胜任力模型 → 能力差距分析 → 生成发展规划 + ↑ │ + └── 能力更新后重算 ←──┘ + (动态闭环) +``` + +| 功能 | 说明 | +|------|------| +| 目标设定 | 选择或自定义职业目标 | +| 胜任力模型 | 参照权威医学框架(科学与学术、临床能力、健康与社会、职业素养) | +| 差距分析 | 逐项对照当前能力水平与岗位要求 | +| 行动建议 | 每个差距项提供具体行动与目标水平 | +| 资源推荐 | 为差距项推荐学习资源或对练任务 | +| 动态闭环 | 能力提升后重算差距,规划自动更新 | + +#### 7. 研究资料查询 +**价值**:高效检索医学文献,AI辅助总结与引用管理,支撑科研与论文写作 + +``` +自然语言描述 → PICO/MeSH检索式 → 多源检索 → 证据分级总结 → 引用导出 +``` + +| 功能 | 说明 | +|------|------| +| 检索式生成 | 自然语言自动转为 PICO 要素 + MeSH 主题词的专业检索式 | +| 多源检索 | 支持 PubMed、CNKI、万方、UpToDate、Cochrane 等 | +| 结果筛选 | 按发表时间、来源类型、相关度筛选 | +| 证据分级 | 对纳入总结的每条资料标注证据强度 | +| AI 总结 | 生成带引用的结论,每条可追溯来源 | +| 引用管理 | 支持 Vancouver / GB-T 7714 格式,导出 EndNote / NoteExpress | +| 版权安全 | 仅提供摘要与链接,不存储或分发受版权保护全文 | + +#### 8. AI 协同训练 +**价值**:系统性培养负责任使用AI的能力——这在医学领域尤为关键 + +| 评估维度 | 说明 | +|----------|------| +| 提问能力 | 能否向AI提出精准、有效的问题 | +| 批判性验证 | 能否对AI输出进行来源核验与批判性思考 | +| 责任边界意识 | 是否清楚AI辅助与人工决策的边界 | +| 协同工作流 | 能否有效组织人机协作流程 | + +- 每维度各有真实任务载体的训练任务 +- 直接采用未核验AI输出时会被要求来源核验 +- 评估结果计入能力画像与岗位胜任力对照 +- 支持导师对协同质量进行点评 + +#### 9. 补充模块(v0.2+) + +| 模块 | 价值 | +|------|------| +| 轮转见习 | 记录临床轮转经历 | +| 技能视频 | 搜索与学习操作技能视频 | +| 执业医师备考 | AI出题 + 间隔重复 + 模拟考试 + 个性化推荐 | +| 学术交流 | 记录学术交流与会议参与 | +| 医学问答 | AI流式多轮医学知识对话 | +| 病例推演 | 逐步推演临床病例,保持全程上下文 | +| 用药安全 | 用药安全性检查与学习 | + +--- + +### 二、导师端功能矩阵 + +| 功能 | 价值 | +|------|------| +| **题目审核** | 审核AI生成题目的准确性,通过或退回(附原因),保障教学内容质量 | +| **成果点评** | 对学生学习成果进行教学点评,点评对学生可见,促进学生反思与改进 | +| **带教学生画像** | 查看所带学生的能力画像(脱敏),精准把握学生发展状况,针对性指导 | + +--- + +### 三、管理端功能矩阵 + +| 功能 | 价值 | +|------|------| +| **技能治理** | 定义、配置、启用AI技能;每个技能含输入规格、处理逻辑、知识源、输出格式、可信度规则五要素 | +| **审计日志** | 追踪所有技能配置变更(操作者、时间、内容) | +| **权限管理** | 按角色分级定义访问权限范围 | +| **合规监控** | 查看越权拒绝事件,确保数据安全 | + +--- + +## 系统架构示意 + +``` +┌──────────────────────────────────────────────────────────────────────┐ +│ 用户界面层 │ +│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ +│ │ 学生端 │ │ 导师端 │ │ 管理端 │ Next.js + Tailwind │ +│ └────┬─────┘ └────┬─────┘ └────┬─────┘ │ +└───────┼───────────────┼───────────────┼──────────────────────────────┘ + │ │ │ + └───────────────┼───────────────┘ + ▼ +┌──────────────────────────────────────────────────────────────────────┐ +│ 接入层 · 认证鉴权 │ +│ JWT 认证 · 角色路由 · API 网关 │ +└────────────────────────────┬─────────────────────────────────────────┘ + │ + ┌────────────────────┼────────────────────┐ + ▼ ▼ ▼ +┌───────────────┐ ┌─────────────────┐ ┌───────────────────┐ +│ 横切关注点 │ │ 业务模块层 │ │ 底座层 │ +│ │ │ │ │ │ +│ • 合规模块 │ │ • 学习空间 │ │ • 能力图谱 │ +│ 权限分级 │ │ • AI评估引擎 │ │ 统一能力标签 │ +│ 数据脱敏 │ │ • 课程对练引擎 │ │ 跨模块数据打通 │ +│ 授权管理 │ │ • 临床对话对练 │ │ │ +│ 审计日志 │ │ • 画像引擎 │ │ • 技能能力中心 │ +│ │ │ • 职业规划 │ │ 统一AI技能框架 │ +│ • AI 可信层 │ │ • 研究资料查询 │ │ 8+可复用技能 │ +│ 可信度标注 │ │ • AI协同培养 │ │ │ +│ 来源溯源 │ │ • 医学问答 │ │ │ +│ 未核验标记 │ │ • 病例推演 │ │ │ +│ │ │ • 执业备考 │ │ │ +└───────────────┘ │ • 轮转/学术/… │ │ │ + └────────┬────────┘ └─────────┬─────────┘ + │ │ + └──────────┬──────────┘ + ▼ +┌──────────────────────────────────────────────────────────────────────┐ +│ 基础设施层 │ +│ │ +│ ┌──────────┐ ┌──────────────┐ ┌───────────────────────────────┐ │ +│ │PostgreSQL │ │ AI 网关 │ │ 资料来源适配器 │ │ +│ │ 数据库 │ │ (通义千问等) │ │ PubMed/CNKI/万方/UpToDate/… │ │ +│ └──────────┘ └──────────────┘ └───────────────────────────────┘ │ +└──────────────────────────────────────────────────────────────────────┘ +``` + +--- + +## 核心设计理念 + +### 1. 能力贯通 —— 打破数据孤岛 + +所有学习活动通过统一的**能力图谱**连接。学习空间新增一条成果、课程对练完成一次测验、临床对话获得评分——这些数据都映射到相同的能力标签体系上,使得: + +- 学生画像基于全量行为数据生成,而非单一模块的局部视图 +- 职业规划能精确对照当前能力与目标岗位的差距 +- 各模块的使用数据相互增强,形成正反馈循环 + +### 2. AI 可信优先 —— 医学场景零容忍幻觉 + +在医学教育场景下,AI 幻觉(生成不实信息)的风险极高。系统采用: + +- **所有 AI 输出必须附带可信度标注**(来源 + 置信度) +- **无法溯源的内容标注为"未经核验"** +- **题目必须绑定权威知识源**,否则不进入使用流程 +- **总结中无法追溯的结论标注"未验证"**,不作为引用输出 + +### 3. 合规默认 —— 敏感数据天然受保护 + +医学生画像包含敏感的健康、心理数据,系统采用: + +- **默认脱敏**:非本人访问画像,敏感字段自动脱敏 +- **知情同意授权**:跨用途使用必须有学生有效授权 +- **即时撤销**:学生撤销授权后立即失效 +- **全审计**:所有敏感操作留痕(保留≥12个月) +- **最小采集**:仅采集与画像维度直接相关的数据 + +### 4. 人机协同 —— AI 辅助而非替代 + +- AI 生成题目 → **导师审核后才可使用** +- AI 文献总结 → **明确提示"不替代阅读原文"** +- AI 协同训练 → **直接采用未核验输出会被要求核验** +- 所有 AI 建议 → **可追溯依据,用户可核验** + +--- + +## 用户使用流程示例 + +### 典型学生日常 + +``` +1. 登录 → 进入学习空间 +2. 记录今日临床见习成果 → 系统自动归档 + 能力标签映射 +3. 30秒后收到 AI 形成性评价与发展建议 +4. 进入课程对练 → AI 出题(已过导师审核)→ 模拟答题 → 查看诊断报告 +5. 进入临床对话对练 → 模拟问诊 → 获得三维评估 +6. 查看能力画像 → 六维度分数 + 成长趋势 +7. 进入职业规划 → 查看差距分析 → 按推荐资源学习 +8. 能力提升后 → 画像自动更新 → 发展规划动态调整(闭环) +``` + +### 典型导师工作 + +``` +1. 登录 → 进入导师工作台 +2. 审核 AI 生成题目 → 通过准确的 / 退回有问题的 +3. 对学生学习成果进行点评 +4. 查看所带学生画像 → 了解学生能力分布 → 针对性指导 +``` + +--- + +## 技术规格摘要 + +| 维度 | 规格 | +|------|------| +| 前端 | Next.js 14 + React 18 + TypeScript + Tailwind CSS | +| 后端 | NestJS 10.4 + TypeScript + TypeORM | +| 数据库 | PostgreSQL(可选,开发环境支持内存模式) | +| AI 引擎 | OpenAI兼容接口(默认通义千问),支持 SSE 流式输出 | +| 认证 | JWT + bcrypt | +| 外部数据源 | PubMed、CNKI、万方、UpToDate、Cochrane | +| 速率保护 | AI调用 20次/分钟、500次/天 | +| 后端模块数 | 21 个业务模块 | + +--- + +## 系统差异化优势 + +| 维度 | 传统教学平台 | 本系统 | +|------|-------------|--------| +| 数据关联 | 各模块数据孤立 | 统一能力图谱贯通所有模块 | +| AI 输出信任 | 缺乏验证机制 | 全链路可信度标注 + 来源溯源 | +| 学习反馈 | 周期性人工评价 | 实时AI形成性评价 + 阶段终结性评价 | +| 职业发展 | 静态指导 | 动态闭环:能力变化→规划自动更新 | +| AI 素养 | 无系统培养 | 四维度协同能力训练+评估 | +| 数据隐私 | 粗放管理 | 知情同意+即时撤销+默认脱敏+全审计 | +| 教学质量 | 缺乏把控 | AI生成+人工审核双层保障 | + +--- + +*本文档描述系统面向用户的功能与价值。技术架构与实现细节参见 `.kiro/specs/college-ai-center/design.md`。* diff --git a/collegeAIcenter.code-workspace b/collegeAIcenter.code-workspace deleted file mode 100644 index 61e510d..0000000 --- a/collegeAIcenter.code-workspace +++ /dev/null @@ -1,9 +0,0 @@ -{ - "folders": [ - { - "path": "." - } - ], - "settings": { - } -} \ No newline at end of file diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..6e10610 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,164 @@ +#!/usr/bin/env bash +# +# College AI Center — 一键部署脚本 +# +# 用法: +# ./deploy.sh +# +# 作用:把本地代码同步到远程服务器,在服务器上安装依赖、构建前后端、 +# 配置 PostgreSQL 数据库、systemd 服务与 nginx(域名 mc.all8ai.top),并启动。 +# +# 与服务器上已有的 k12 应用互不影响(使用独立端口 3100/4100、独立目录、 +# 名称匹配的 nginx server_name,不占用 default_server)。 +# +# 依赖(本机):sshpass、rsync、ssh +# --------------------------------------------------------------------------- +set -euo pipefail + +# ====== 可配置参数 ====== +SERVER_IP="${SERVER_IP:-101.96.196.218}" +SERVER_USER="${SERVER_USER:-root}" +SERVER_PASS="${SERVER_PASS:-Why_701208}" + +REMOTE_DIR="/opt/college-ai-center" +BACKEND_PORT=3100 +FRONTEND_PORT=4100 + +# 数据库 +DB_NAME="college_ai_center" +DB_USER="cac_user" +DB_PASS="${DB_PASS:-Cac_$(echo "$SERVER_PASS" | md5sum 2>/dev/null | cut -c1-12 || echo Pg88dev)}" + +# 大模型配置(如需启用,部署后在服务器 .env 中填写 LLM_API_KEY) +LLM_API_KEY="${LLM_API_KEY:-}" +LLM_BASE_URL="${LLM_BASE_URL:-https://dashscope.aliyuncs.com/compatible-mode/v1}" +LLM_MODEL="${LLM_MODEL:-qwen-plus}" + +JWT_SECRET="${JWT_SECRET:-cac-prod-$(openssl rand -hex 16 2>/dev/null || echo change-me-in-prod)}" + +SSH_OPTS="-o StrictHostKeyChecking=no -o ConnectTimeout=20" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +ssh_run() { sshpass -p "$SERVER_PASS" ssh $SSH_OPTS "$SERVER_USER@$SERVER_IP" "$@"; } + +echo "==> [1/6] 检查本机依赖" +for c in sshpass rsync ssh; do + command -v "$c" >/dev/null 2>&1 || { echo "缺少命令:$c,请先安装(mac: brew install $c)"; exit 1; } +done + +echo "==> [2/6] 同步代码到 $SERVER_IP:$REMOTE_DIR" +ssh_run "mkdir -p $REMOTE_DIR" +sshpass -p "$SERVER_PASS" rsync -az --delete -e "ssh $SSH_OPTS" \ + --exclude 'node_modules' \ + --exclude 'web/node_modules' \ + --exclude '.next' \ + --exclude 'web/.next' \ + --exclude 'dist' \ + --exclude '.git' \ + --exclude 'coverage' \ + --exclude '*.log' \ + "$SCRIPT_DIR/" "$SERVER_USER@$SERVER_IP:$REMOTE_DIR/" + +echo "==> [3/6] 在服务器上准备数据库" +ssh_run "sudo -u postgres psql -tc \"SELECT 1 FROM pg_roles WHERE rolname='$DB_USER'\" | grep -q 1 || sudo -u postgres psql -c \"CREATE ROLE $DB_USER LOGIN PASSWORD '$DB_PASS';\"" +ssh_run "sudo -u postgres psql -tc \"SELECT 1 FROM pg_database WHERE datname='$DB_NAME'\" | grep -q 1 || sudo -u postgres psql -c \"CREATE DATABASE $DB_NAME OWNER $DB_USER;\"" +ssh_run "sudo -u postgres psql -c \"ALTER DATABASE $DB_NAME OWNER TO $DB_USER;\" >/dev/null 2>&1 || true" + +echo "==> [4/6] 写入后端 .env" +ssh_run "cat > $REMOTE_DIR/.env < [5/6] 安装依赖并构建(后端 + 前端)" +ssh_run "set -e; cd $REMOTE_DIR && npm install --no-audit --no-fund && npm run build" +ssh_run "set -e; cd $REMOTE_DIR/web && npm install --no-audit --no-fund && BACKEND_URL=http://127.0.0.1:$BACKEND_PORT npm run build" + +echo "==> [6/6] 配置 systemd 服务" + +# 后端 systemd +ssh_run "cat > /etc/systemd/system/cac-backend.service < /etc/systemd/system/cac-frontend.service </dev/null 2>&1 || true" + +# 若 ufw 启用,则放行端口 +ssh_run "if ufw status 2>/dev/null | grep -q 'Status: active'; then ufw allow $BACKEND_PORT/tcp; ufw allow $FRONTEND_PORT/tcp; fi || true" + +echo "==> 启动服务" +ssh_run "systemctl daemon-reload && systemctl enable cac-backend cac-frontend >/dev/null 2>&1 && systemctl restart cac-backend cac-frontend" + +echo "==> 等待服务就绪" +sleep 6 +ssh_run "systemctl is-active cac-backend cac-frontend; echo '--- backend health ---'; curl -s -o /dev/null -w 'backend(api/auth/login probe): %{http_code}\n' -X POST http://127.0.0.1:$BACKEND_PORT/api/auth/login -H 'Content-Type: application/json' -d '{}'; echo '--- frontend ---'; curl -s -o /dev/null -w 'frontend: %{http_code}\n' http://127.0.0.1:$FRONTEND_PORT" + +echo "" +echo "============================================================" +echo " 部署完成!" +echo " 前端访问: http://${SERVER_IP}:$FRONTEND_PORT" +echo " 后端 API: http://${SERVER_IP}:$BACKEND_PORT/api" +echo " 数据库 : $DB_NAME (用户 $DB_USER)" +echo "" +echo " 测试账户:student / mentor / admin(密码同 *123,如 student123)" +echo "" +echo " 常用运维:" +echo " systemctl status cac-backend cac-frontend" +echo " journalctl -u cac-backend -f" +echo " journalctl -u cac-frontend -f" +echo "============================================================" diff --git a/scripts/gen-pptx.js b/scripts/gen-pptx.js new file mode 100644 index 0000000..272f151 --- /dev/null +++ b/scripts/gen-pptx.js @@ -0,0 +1,1395 @@ +/** + * 生成「医科高校智能学习中心」汇报 PPT + * 面向高校管理者与广电领导,展现学生/学校/广电三方价值 + * 文案刻意减少"AI赋能/智能化"等流行词,改用具体教育场景与管理动作 + */ +const pptxgen = require('pptxgenjs'); + +const pres = new pptxgen(); +pres.layout = 'LAYOUT_WIDE'; // 13.33 x 7.5 英寸 +pres.author = 'College AI Center'; +pres.title = '医科高校智能学习中心'; + +// ===== 主题色 ===== +const C = { + ink: '1B3A5B', // 深藏青(主色/标题) + steel: '2C5F8A', // 钢青(副标题/线条) + edu: '2A7B7B', // 教育青(学生/学校) + gold: 'C8923D', // 琥珀金(广电/亮点) + rose: 'B5483D', // 警示红(挑战/差异) + bg: 'FFFFFF', + bgSoft: 'F4F6F8', + bgPanel: 'EDF1F4', + text: '2D3748', + textMid: '5A6A7A', + textLight: '8A98A6', + white: 'FFFFFF', + divider: 'D8DEE4', +}; + +// ===== 辅助函数 ===== +const W = 13.33, H = 7.5; + +function addSlide(bg = C.bg) { + const s = pres.addSlide(); + s.background = { color: bg }; + return s; +} + +// 页面顶部色条 + 章节标签 + 主标题 +function header(s, section, title, accent = C.ink) { + s.addShape('rect', { x: 0, y: 0, w: W, h: 0.12, fill: { color: accent } }); + s.addText(section, { + x: 0.6, y: 0.32, w: 12, h: 0.35, + fontSize: 12, color: C.textLight, fontFace: 'Microsoft YaHei', charSpacing: 2, + }); + s.addText(title, { + x: 0.6, y: 0.62, w: 12, h: 0.7, + fontSize: 26, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + s.addShape('rect', { x: 0.62, y: 1.32, w: 0.5, h: 0.05, fill: { color: accent } }); +} + +// 底部页码 +function footer(s, n) { + s.addText(`${n}`, { + x: W - 1.0, y: H - 0.45, w: 0.8, h: 0.3, + fontSize: 10, color: C.textLight, align: 'right', fontFace: 'Microsoft YaHei', + }); + s.addText('医科高校智能学习中心', { + x: 0.6, y: H - 0.45, w: 6, h: 0.3, + fontSize: 10, color: C.textLight, fontFace: 'Microsoft YaHei', + }); +} + +// 卡片:标题 + 正文(用于功能要点) +function card(s, x, y, w, h, title, lines, opts = {}) { + const fill = opts.fill || C.bgSoft; + const bar = opts.bar || C.edu; + s.addShape('roundRect', { + x, y, w, h, fill: { color: fill }, + line: { color: C.divider, width: 0.5 }, rectRadius: 0.08, + }); + s.addShape('rect', { x: x + 0.18, y: y + 0.22, w: 0.06, h: h - 0.44, fill: { color: bar } }); + s.addText(title, { + x: x + 0.36, y: y + 0.18, w: w - 0.5, h: 0.4, + fontSize: 14, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + const body = Array.isArray(lines) ? lines.map(t => ({ text: t, options: { bullet: { code: '2022' }, indentLevel: 0 } })) : lines; + s.addText(body, { + x: x + 0.36, y: y + 0.62, w: w - 0.55, h: h - 0.8, + fontSize: 11.5, color: C.text, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.25, valign: 'top', + }); +} + +// 大数字 + 标签(用于指标卡) +function metric(s, x, y, w, num, label, accent = C.edu) { + s.addShape('roundRect', { + x, y, w, h: 1.5, fill: { color: C.bgSoft }, + line: { color: C.divider, width: 0.5 }, rectRadius: 0.08, + }); + s.addText(num, { + x, y: y + 0.18, w, h: 0.7, + fontSize: 34, bold: true, color: accent, align: 'center', fontFace: 'Microsoft YaHei', + }); + s.addText(label, { + x, y: y + 0.95, w, h: 0.4, + fontSize: 12, color: C.textMid, align: 'center', fontFace: 'Microsoft YaHei', + }); +} + +// 三色角色徽标 +function roleBadge(s, x, y, text, color) { + s.addShape('roundRect', { + x, y, w: 1.6, h: 0.4, fill: { color: color }, rectRadius: 0.06, + }); + s.addText(text, { + x, y: y + 0.02, w: 1.6, h: 0.36, + fontSize: 12, bold: true, color: C.white, align: 'center', fontFace: 'Microsoft YaHei', + }); +} + +// ============================================================ +// 第 1 页 · 封面 +// ============================================================ +{ + const s = addSlide(C.ink); + // 装饰几何 + s.addShape('rect', { x: 0, y: 0, w: 0.35, h: H, fill: { color: C.gold } }); + s.addShape('rect', { x: 0.35, y: 0, w: 0.08, h: H, fill: { color: C.edu } }); + s.addShape('rect', { x: 0, y: H - 1.6, w: W, h: 0.02, fill: { color: C.steel } }); + + s.addText('医科高校', { + x: 1.0, y: 2.0, w: 11, h: 1.0, + fontSize: 52, bold: true, color: C.white, fontFace: 'Microsoft YaHei', + }); + s.addText('智能学习中心', { + x: 1.0, y: 2.85, w: 11, h: 1.0, + fontSize: 52, bold: true, color: C.white, fontFace: 'Microsoft YaHei', + }); + s.addText('以能力为核心 · 贯穿医学人才培养全链路', { + x: 1.0, y: 4.0, w: 11, h: 0.6, + fontSize: 20, color: C.gold, fontFace: 'Microsoft YaHei', + }); + s.addText('面向高校管理者与广电合作伙伴 · 汇报材料', { + x: 1.0, y: 5.9, w: 11, h: 0.4, + fontSize: 14, color: 'AEBFD0', fontFace: 'Microsoft YaHei', + }); + s.addText('基础医学 → 临床医学 → 见习实习 → 住院医师培养', { + x: 1.0, y: 6.4, w: 11, h: 0.4, + fontSize: 13, color: '8FA3B8', fontFace: 'Microsoft YaHei', charSpacing: 1, + }); +} + +// ============================================================ +// 第 2 页 · 目录 +// ============================================================ +{ + const s = addSlide(); + header(s, 'CONTENTS', '目录'); + const items = [ + ['01', '医学教育的现实挑战', C.rose], + ['02', '系统定位与三方共建', C.ink], + ['03', '学生价值:贯穿成长链的学习与训练', C.edu], + ['04', '学校价值:人才培养的数据底座', C.edu], + ['05', '广电价值:算力支撑与数据通道', C.gold], + ['06', '设计底线与差异化优势', C.steel], + ]; + items.forEach((it, i) => { + const y = 1.7 + i * 0.85; + s.addText(it[0], { + x: 0.9, y, w: 1.0, h: 0.6, + fontSize: 30, bold: true, color: it[2], fontFace: 'Microsoft YaHei', + }); + s.addShape('rect', { x: 2.0, y: y + 0.28, w: 0.4, h: 0.03, fill: { color: C.divider } }); + s.addText(it[1], { + x: 2.6, y: y + 0.08, w: 9.5, h: 0.5, + fontSize: 18, color: C.text, fontFace: 'Microsoft YaHei', + }); + }); + footer(s, 2); +} + +// ============================================================ +// 第 3 页 · 第一部分:医学教育的现实挑战 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 01 · 现实挑战', '医学教育正在面对的四个痛点', C.rose); + const pains = [ + ['成长数据分散', '课程、作业、见习、实习、考核、科研各自为政,\n学生四年下来的成长轨迹难以拼成完整图景。'], + ['过程性反馈缺失', '阶段性评价周期长,学生做完一次见习、写完\n一份报告,往往要等数周才得到老师反馈。'], + ['临床训练机会有限', '真实病例和标准化病人接触不足,问诊沟通、\n临床决策这些核心能力很难反复练习。'], + ['培养质量难量化', '缺乏全维度、可追溯的能力证据,就业推荐\n与住培选拔大多依赖期末成绩和主观印象。'], + ]; + pains.forEach((p, i) => { + const x = 0.6 + (i % 2) * 6.1; + const y = 1.7 + Math.floor(i / 2) * 2.5; + s.addShape('roundRect', { + x, y, w: 5.9, h: 2.25, fill: { color: C.bgSoft }, + line: { color: C.divider, width: 0.5 }, rectRadius: 0.1, + }); + s.addShape('rect', { x: x + 0.25, y: y + 0.25, w: 0.08, h: 1.75, fill: { color: C.rose } }); + s.addText(p[0], { + x: x + 0.5, y: y + 0.22, w: 5.2, h: 0.45, + fontSize: 17, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + s.addText(p[1], { + x: x + 0.5, y: y + 0.78, w: 5.2, h: 1.3, + fontSize: 12.5, color: C.textMid, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.3, valign: 'top', + }); + }); + footer(s, 3); +} + +// ============================================================ +// 第 4 页 · 第二部分:系统定位 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 02 · 系统定位', '一个学习中心,贯穿培养全链路', C.ink); + + s.addShape('roundRect', { + x: 0.6, y: 1.7, w: 12.1, h: 1.6, fill: { color: C.bgPanel }, + line: { color: C.divider, width: 0.5 }, rectRadius: 0.1, + }); + s.addText('面向医学院校的学习中心平台。以"能力"为核心,把学生在校的所有学习活动——课程、对练、科研、协作——统一汇入能力图谱,形成数据贯通的闭环成长体系。', { + x: 0.9, y: 1.9, w: 11.5, h: 1.2, + fontSize: 15, color: C.text, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.4, valign: 'middle', + }); + + // 成长链路 + const chain = ['基础医学', '临床医学', '见习实习', '住院医师培养']; + chain.forEach((t, i) => { + const x = 1.2 + i * 2.9; + s.addShape('roundRect', { + x, y: 3.7, w: 2.5, h: 0.7, fill: { color: C.edu }, rectRadius: 0.08, + }); + s.addText(t, { + x, y: 3.74, w: 2.5, h: 0.62, + fontSize: 15, bold: true, color: C.white, align: 'center', fontFace: 'Microsoft YaHei', + }); + if (i < 3) { + s.addText('→', { + x: x + 2.5, y: 3.7, w: 0.4, h: 0.7, + fontSize: 20, color: C.steel, align: 'center', valign: 'middle', fontFace: 'Microsoft YaHei', + }); + } + }); + + s.addText('统一能力图谱贯穿四个阶段,所有学习行为映射到同一套能力标签', { + x: 0.6, y: 4.7, w: 12, h: 0.4, + fontSize: 12.5, color: C.textMid, align: 'center', fontFace: 'Microsoft YaHei', + }); + + // 三方共建 + const parts = [ + [C.edu, '学生', '贯穿成长链的\n学习与训练'], + [C.edu, '学校', '全景式人才\n培养数据底座'], + [C.gold, '广电', '算力与数据\n通道支撑'], + ]; + parts.forEach((p, i) => { + const x = 1.5 + i * 3.6; + s.addShape('roundRect', { + x, y: 5.4, w: 3.2, h: 1.5, fill: { color: C.white }, + line: { color: p[0], width: 1.5 }, rectRadius: 0.1, + }); + s.addText(p[1], { + x, y: 5.55, w: 3.2, h: 0.5, + fontSize: 18, bold: true, color: p[0], align: 'center', fontFace: 'Microsoft YaHei', + }); + s.addText(p[2], { + x, y: 6.05, w: 3.2, h: 0.8, + fontSize: 12.5, color: C.textMid, align: 'center', fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.2, + }); + }); + footer(s, 4); +} + +// ============================================================ +// 第 5 页 · 三方价值总览 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 02 · 价值总览', '三方共建,各取所需', C.ink); + + const cols = [ + [C.edu, '学生', '通过多种交互提升能力', [ + '学习空间:成长记录一站式汇聚', + '对练训练:课程+临床双场景模拟', + '能力画像:六维量化,成长可视', + '职业规划:目标导向,动态闭环', + '科研辅助:多源检索,证据分级', + '协同素养:负责任使用工具的能力', + ]], + [C.edu, '学校', '了解学生全面情况', [ + '导师端:题目审核+成果点评+带教画像', + '管理端:技能治理+权限+审计+合规', + '能力图谱:打破数据孤岛,全量贯通', + '培养质量:可量化、可追溯、可比较', + '教学质量:系统生成+人工审核双层保障', + '决策依据:基于行为数据而非主观印象', + ]], + [C.gold, '广电', '提供算力与数据支持', [ + '算力支撑:大模型推理算力供给', + '流式输出:支撑对话对练实时交互', + '数据通道:多源医学文献接入', + '社会价值:算力转化为人才培养质量', + '可扩展:技能库持续扩展,需求增长', + '品牌效益:广电算力赋能医学教育', + ]], + ]; + cols.forEach((c, i) => { + const x = 0.6 + i * 4.1; + s.addShape('roundRect', { + x, y: 1.7, w: 3.9, h: 5.3, fill: { color: C.bgSoft }, + line: { color: c[0], width: 1.2 }, rectRadius: 0.1, + }); + s.addShape('rect', { x, y: 1.7, w: 3.9, h: 0.7, fill: { color: c[0] } }); + s.addText(c[1], { + x, y: 1.78, w: 3.9, h: 0.55, + fontSize: 20, bold: true, color: C.white, align: 'center', fontFace: 'Microsoft YaHei', + }); + s.addText(c[2], { + x: x + 0.2, y: 2.55, w: 3.5, h: 0.4, + fontSize: 12.5, color: c[0], align: 'center', fontFace: 'Microsoft YaHei', italic: true, + }); + const items = c[3].map(t => ({ text: t, options: { bullet: { code: '2022' } } })); + s.addText(items, { + x: x + 0.3, y: 3.05, w: 3.5, h: 3.8, + fontSize: 12, color: C.text, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.35, valign: 'top', + }); + }); + footer(s, 5); +} + +// ============================================================ +// 第 6 页 · 第三部分章节页:学生价值 +// ============================================================ +{ + const s = addSlide(C.edu); + s.addShape('rect', { x: 0, y: 0, w: 0.35, h: H, fill: { color: C.white } }); + s.addText('PART 03', { + x: 1.0, y: 2.4, w: 11, h: 0.6, + fontSize: 18, color: 'BFE3E3', fontFace: 'Microsoft YaHei', charSpacing: 4, + }); + s.addText('学生价值', { + x: 1.0, y: 2.9, w: 11, h: 1.0, + fontSize: 44, bold: true, color: C.white, fontFace: 'Microsoft YaHei', + }); + s.addText('贯穿成长链的学习与训练 · 六个支撑', { + x: 1.0, y: 4.0, w: 11, h: 0.6, + fontSize: 18, color: 'D9EFEF', fontFace: 'Microsoft YaHei', + }); +} + +// ============================================================ +// 第 7 页 · 学生价值总览 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 03 · 学生价值', '六个支撑,贯穿在校全程', C.edu); + const items = [ + ['学习空间', '成长记录一站式汇聚,\n9种成果类型自动归档'], + ['对练训练', '课程对练+临床对话,\n模拟考场与诊室'], + ['能力画像', '六维量化评分,\n成长趋势可视'], + ['职业规划', '目标导向,差距分析,\n动态闭环更新'], + ['科研辅助', '多源文献检索,\n证据分级与引用管理'], + ['协同素养', '负责任使用工具,\n四维度系统培养'], + ]; + items.forEach((it, i) => { + const x = 0.6 + (i % 3) * 4.1; + const y = 1.7 + Math.floor(i / 3) * 2.5; + s.addShape('roundRect', { + x, y, w: 3.9, h: 2.25, fill: { color: C.bgSoft }, + line: { color: C.divider, width: 0.5 }, rectRadius: 0.1, + }); + s.addShape('rect', { x: x + 0.25, y: y + 0.25, w: 0.08, h: 1.75, fill: { color: C.edu } }); + s.addText(it[0], { + x: x + 0.5, y: y + 0.25, w: 3.2, h: 0.45, + fontSize: 17, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + s.addText(it[1], { + x: x + 0.5, y: y + 0.8, w: 3.2, h: 1.2, + fontSize: 12.5, color: C.textMid, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.3, valign: 'top', + }); + }); + footer(s, 7); +} + +// ============================================================ +// 第 8 页 · 学习空间 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 03 · 学生价值 01', '学习空间:让成长有迹可循', C.edu); + + // 左:9种成果类型 + s.addText('九种成果类型,覆盖在校全程', { + x: 0.6, y: 1.6, w: 6, h: 0.4, + fontSize: 15, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + const types = ['课程记录', '作业', '实验报告', '临床见习', '临床实习', 'OSCE考核', '文献阅读', '科研成果', '证书/资格备考']; + types.forEach((t, i) => { + const x = 0.6 + (i % 3) * 2.05; + const y = 2.1 + Math.floor(i / 3) * 0.65; + s.addShape('roundRect', { + x, y, w: 1.9, h: 0.5, fill: { color: C.white }, + line: { color: C.edu, width: 1 }, rectRadius: 0.06, + }); + s.addText(t, { + x, y: y + 0.02, w: 1.9, h: 0.46, + fontSize: 12, color: C.edu, align: 'center', fontFace: 'Microsoft YaHei', + }); + }); + + // 右:三个特性 + s.addText('三个特性', { + x: 7.2, y: 1.6, w: 5.5, h: 0.4, + fontSize: 15, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + const feats = [ + ['三维自动归档', '按学年、学期、临床轮转科室\n三个维度自动归类'], + ['能力标签映射', '每条成果自动映射到\n能力图谱中的能力标签'], + ['里程碑标记', '标记阶段性成长节点,\n关联该阶段内全部成果'], + ]; + feats.forEach((f, i) => { + const y = 2.1 + i * 1.4; + s.addShape('roundRect', { + x: 7.2, y, w: 5.5, h: 1.25, fill: { color: C.bgSoft }, + line: { color: C.divider, width: 0.5 }, rectRadius: 0.08, + }); + s.addText(f[0], { + x: 7.4, y: y + 0.15, w: 5.1, h: 0.4, + fontSize: 13.5, bold: true, color: C.edu, fontFace: 'Microsoft YaHei', + }); + s.addText(f[1], { + x: 7.4, y: y + 0.55, w: 5.1, h: 0.6, + fontSize: 11.5, color: C.textMid, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.2, + }); + }); + + // 底部价值条 + s.addShape('roundRect', { + x: 0.6, y: 6.3, w: 12.1, h: 0.7, fill: { color: C.edu }, rectRadius: 0.08, + }); + s.addText('价值:告别分散记录,学生四年成长轨迹在一个空间里完整呈现,为画像与职业规划提供数据基础', { + x: 0.8, y: 6.35, w: 11.7, h: 0.6, + fontSize: 12.5, color: C.white, align: 'center', valign: 'middle', fontFace: 'Microsoft YaHei', + }); + footer(s, 8); +} + +// ============================================================ +// 第 9 页 · 对练训练——课程对练 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 03 · 学生价值 02', '对练训练(一):把考场搬进系统', C.edu); + + // 流程链 + const flow = ['系统出题', '导师审核', '学生对练', '诊断报告', '间隔重复']; + flow.forEach((t, i) => { + const x = 0.8 + i * 2.45; + s.addShape('roundRect', { + x, y: 1.7, w: 2.1, h: 0.65, fill: { color: i === 1 ? C.gold : C.edu }, rectRadius: 0.08, + }); + s.addText(t, { + x, y: 1.74, w: 2.1, h: 0.57, + fontSize: 13, bold: true, color: C.white, align: 'center', fontFace: 'Microsoft YaHei', + }); + if (i < 4) { + s.addText('→', { + x: x + 2.1, y: 1.7, w: 0.35, h: 0.65, + fontSize: 18, color: C.steel, align: 'center', valign: 'middle', + }); + } + }); + s.addText('导师审核环节用金色标出——题目必须经导师通过后才可使用,退回需注明原因', { + x: 0.6, y: 2.5, w: 12, h: 0.35, + fontSize: 11.5, color: C.textMid, align: 'center', fontFace: 'Microsoft YaHei', italic: true, + }); + + // 四个要点 + const pts = [ + ['题型覆盖', 'A1-A4型选择题、病例分析题、\n临床决策题,贴近真实考试'], + ['权威绑定', '每题绑定权威知识源\n(教材/指南/官方题库)'], + ['限时作答', '逐题呈现,120秒/题,\n即时判定,模拟真实考场'], + ['错题复现', 'SM-2算法优先复现错题\n与即将遗忘的题'], + ]; + pts.forEach((p, i) => { + const x = 0.6 + (i % 2) * 6.1; + const y = 3.1 + Math.floor(i / 2) * 1.5; + card(s, x, y, 5.9, 1.35, p[0], [p[1]], { bar: C.edu }); + }); + + // 诊断报告说明 + s.addShape('roundRect', { + x: 0.6, y: 6.2, w: 12.1, h: 0.8, fill: { color: C.bgPanel }, rectRadius: 0.08, + }); + s.addText('诊断报告:正确率、用时、薄弱环节分析(低于60%的能力标签自动标记),并针对每个薄弱环节生成具体改进建议', { + x: 0.8, y: 6.3, w: 11.7, h: 0.6, + fontSize: 12.5, color: C.text, align: 'center', valign: 'middle', fontFace: 'Microsoft YaHei', + }); + footer(s, 9); +} + +// ============================================================ +// 第 10 页 · 对练训练——临床情景对话 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 03 · 学生价值 02', '对练训练(二):把诊室搬进系统', C.edu); + + // 左:对话场景示意 + s.addShape('roundRect', { + x: 0.6, y: 1.7, w: 5.8, h: 5.1, fill: { color: C.bgSoft }, + line: { color: C.divider, width: 0.5 }, rectRadius: 0.1, + }); + s.addText('模拟问诊对话', { + x: 0.8, y: 1.85, w: 5.4, h: 0.4, + fontSize: 15, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + const dialog = [ + ['学生', '您哪里不舒服?', C.edu], + ['模拟患者', '胸口闷,活动后加重,有三四天了。', C.textMid], + ['学生', '有没有放射痛?伴随出汗吗?', C.edu], + ['模拟患者', '偶尔往左肩串,出汗不明显。', C.textMid], + ['学生', '既往有高血压、糖尿病吗?', C.edu], + ['模拟患者', '高血压五年,没规律吃药。', C.textMid], + ]; + dialog.forEach((d, i) => { + const y = 2.4 + i * 0.6; + s.addText(`${d[0]}:`, { + x: 0.9, y, w: 0.8, h: 0.4, + fontSize: 11.5, bold: true, color: d[2], fontFace: 'Microsoft YaHei', + }); + s.addText(d[1], { + x: 1.7, y, w: 4.5, h: 0.4, + fontSize: 11.5, color: C.text, fontFace: 'Microsoft YaHei', + }); + }); + s.addText('· 最多50轮对话 · 携带最近10轮历史保持连贯 · 角色扮演保持情景一致', { + x: 0.8, y: 6.1, w: 5.4, h: 0.5, + fontSize: 10.5, color: C.textLight, fontFace: 'Microsoft YaHei', + }); + + // 右:三维评估 + s.addText('三维评估,量化临床能力', { + x: 6.7, y: 1.7, w: 6, h: 0.4, + fontSize: 15, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + const evals = [ + ['问诊完整性', '主诉、现病史、既往史、\n个人史是否覆盖到位'], + ['临床推理', '鉴别诊断思路是否清晰,\n假设是否合理推进'], + ['医患沟通', '提问方式、同理心、\n信息传达是否有效'], + ]; + evals.forEach((e, i) => { + const y = 2.2 + i * 1.5; + s.addShape('roundRect', { + x: 6.7, y, w: 6, h: 1.35, fill: { color: C.white }, + line: { color: C.edu, width: 1 }, rectRadius: 0.08, + }); + s.addShape('rect', { x: 6.7, y, w: 0.1, h: 1.35, fill: { color: C.edu } }); + s.addText(e[0], { + x: 6.95, y: y + 0.18, w: 5.6, h: 0.4, + fontSize: 14, bold: true, color: C.edu, fontFace: 'Microsoft YaHei', + }); + s.addText(e[1], { + x: 6.95, y: y + 0.6, w: 5.6, h: 0.65, + fontSize: 12, color: C.textMid, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.25, + }); + }); + footer(s, 10); +} + +// ============================================================ +// 第 11 页 · 能力画像 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 03 · 学生价值 03', '能力画像:六维量化,看见自己', C.edu); + + // 六维雷达示意(用六边形+标签模拟) + const cx = 3.5, cy = 4.2; + const dims = [ + ['知识掌握', 0, -1.6], + ['临床技能', 1.4, -0.8], + ['科研能力', 1.4, 0.8], + ['人文素养', 0, 1.6], + ['协同素养', -1.4, 0.8], + ['职业倾向', -1.4, -0.8], + ]; + // 外框六边形 + s.addShape('hexagon', { + x: cx - 1.8, y: cy - 1.8, w: 3.6, h: 3.6, + fill: { color: C.bgSoft }, line: { color: C.edu, width: 1.5 }, + }); + // 内层六边形(数据示意) + s.addShape('hexagon', { + x: cx - 1.1, y: cy - 1.1, w: 2.2, h: 2.2, + fill: { color: C.edu, transparency: 75 }, line: { color: C.edu, width: 1 }, + }); + dims.forEach((d) => { + s.addText(d[0], { + x: cx + d[1] - 0.9, y: cy + d[2] - 0.2, w: 1.8, h: 0.4, + fontSize: 11.5, bold: true, color: C.ink, align: 'center', fontFace: 'Microsoft YaHei', + }); + }); + s.addText('六维能力雷达(示意)', { + x: 0.6, y: 6.2, w: 5.8, h: 0.35, + fontSize: 11, color: C.textLight, align: 'center', fontFace: 'Microsoft YaHei', + }); + + // 右:特性 + s.addText('画像的四个特性', { + x: 7.0, y: 1.7, w: 5.7, h: 0.4, + fontSize: 15, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + const feats = [ + ['每维0-100分', '六维度量化评分,\n分布一目了然'], + ['数据可溯源', '每项结论可追溯到\n具体学习成果或对练记录'], + ['动态更新', '能力图谱数据更新后\n自动重算,无需手动维护'], + ['成长趋势', '能力维度时间序列,\n可视化成长曲线'], + ]; + feats.forEach((f, i) => { + const y = 2.2 + i * 1.15; + s.addShape('roundRect', { + x: 7.0, y, w: 5.7, h: 1.0, fill: { color: C.bgSoft }, + line: { color: C.divider, width: 0.5 }, rectRadius: 0.08, + }); + s.addText(f[0], { + x: 7.2, y: y + 0.12, w: 5.3, h: 0.35, + fontSize: 13, bold: true, color: C.edu, fontFace: 'Microsoft YaHei', + }); + s.addText(f[1], { + x: 7.2, y: y + 0.48, w: 5.3, h: 0.45, + fontSize: 11.5, color: C.textMid, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.2, + }); + }); + footer(s, 11); +} + +// ============================================================ +// 第 12 页 · 职业规划 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 03 · 学生价值 04', '职业规划:目标导向,动态闭环', C.edu); + + // 闭环流程 + const flow = [ + ['设定职业目标', '选择或自定义\n目标岗位'], + ['匹配胜任力模型', '参照权威医学框架\n四大胜任力域'], + ['能力差距分析', '逐项对照当前水平\n与岗位要求'], + ['生成发展规划', '每个差距项提供\n行动与目标水平'], + ]; + flow.forEach((f, i) => { + const x = 0.7 + i * 3.05; + s.addShape('roundRect', { + x, y: 1.8, w: 2.8, h: 1.3, fill: { color: C.edu }, rectRadius: 0.08, + }); + s.addText(f[0], { + x, y: 1.9, w: 2.8, h: 0.4, + fontSize: 13, bold: true, color: C.white, align: 'center', fontFace: 'Microsoft YaHei', + }); + s.addText(f[1], { + x: x + 0.15, y: 2.35, w: 2.5, h: 0.65, + fontSize: 11, color: 'D9EFEF', align: 'center', fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.2, + }); + if (i < 3) { + s.addText('→', { + x: x + 2.8, y: 1.8, w: 0.25, h: 1.3, + fontSize: 18, color: C.steel, align: 'center', valign: 'middle', + }); + } + }); + + // 闭环回箭头说明 + s.addShape('roundRect', { + x: 0.7, y: 3.4, w: 11.9, h: 0.7, fill: { color: C.bgPanel }, rectRadius: 0.08, + }); + s.addText('动态闭环:能力提升后 → 画像自动更新 → 差距重算 → 发展规划自动调整,无需学生手动维护', { + x: 0.9, y: 3.48, w: 11.5, h: 0.55, + fontSize: 12.5, color: C.edu, align: 'center', valign: 'middle', bold: true, fontFace: 'Microsoft YaHei', + }); + + // 胜任力模型四域 + s.addText('岗位胜任力模型 · 参照权威医学框架', { + x: 0.6, y: 4.4, w: 12, h: 0.4, + fontSize: 14, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + const domains = [ + ['科学与学术', '基础医学知识、\n循证医学能力'], + ['临床能力', '病史采集、临床推理、\n操作技能'], + ['健康与社会', '公共卫生、预防医学、\n社会因素认知'], + ['职业素养', '伦理、沟通、\n团队协作、自我提升'], + ]; + domains.forEach((d, i) => { + const x = 0.6 + i * 3.05; + s.addShape('roundRect', { + x, y: 4.9, w: 2.8, h: 1.5, fill: { color: C.bgSoft }, + line: { color: C.edu, width: 1 }, rectRadius: 0.08, + }); + s.addText(d[0], { + x, y: 5.05, w: 2.8, h: 0.4, + fontSize: 13, bold: true, color: C.edu, align: 'center', fontFace: 'Microsoft YaHei', + }); + s.addText(d[1], { + x: x + 0.15, y: 5.5, w: 2.5, h: 0.8, + fontSize: 11, color: C.textMid, align: 'center', fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.2, + }); + }); + s.addText('资源推荐:为每个差距项推荐对应的学习资源或对练任务,直接可执行', { + x: 0.6, y: 6.6, w: 12, h: 0.35, + fontSize: 11.5, color: C.textMid, fontFace: 'Microsoft YaHei', italic: true, + }); + footer(s, 12); +} + +// ============================================================ +// 第 13 页 · 科研辅助 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 03 · 学生价值 05', '科研辅助:多源检索,证据分级', C.edu); + + // 流程链 + const flow = ['自然语言描述', 'PICO/MeSH检索式', '多源检索', '证据分级总结', '引用导出']; + flow.forEach((t, i) => { + const x = 0.6 + i * 2.5; + s.addShape('roundRect', { + x, y: 1.7, w: 2.3, h: 0.65, fill: { color: C.edu }, rectRadius: 0.08, + }); + s.addText(t, { + x, y: 1.74, w: 2.3, h: 0.57, + fontSize: 11.5, bold: true, color: C.white, align: 'center', fontFace: 'Microsoft YaHei', + }); + if (i < 4) { + s.addText('→', { + x: x + 2.3, y: 1.7, w: 0.2, h: 0.65, + fontSize: 16, color: C.steel, align: 'center', valign: 'middle', + }); + } + }); + + // 数据源 + s.addText('接入的医学数据源', { + x: 0.6, y: 2.7, w: 6, h: 0.4, + fontSize: 14, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + const sources = ['PubMed', 'CNKI 中国知网', '万方数据', 'UpToDate', 'Cochrane']; + sources.forEach((t, i) => { + const x = 0.6 + (i % 3) * 2.05; + const y = 3.15 + Math.floor(i / 3) * 0.65; + s.addShape('roundRect', { + x, y, w: 1.9, h: 0.5, fill: { color: C.white }, + line: { color: C.edu, width: 1 }, rectRadius: 0.06, + }); + s.addText(t, { + x, y: y + 0.02, w: 1.9, h: 0.46, + fontSize: 12, color: C.edu, align: 'center', fontFace: 'Microsoft YaHei', + }); + }); + + // 右:特性 + const feats = [ + ['证据分级', '对纳入总结的每条资料\n标注证据强度'], + ['带引用总结', '生成带引用的结论,\n每条可追溯来源'], + ['引用管理', 'Vancouver / GB-T 7714 格式,\n导出 EndNote / NoteExpress'], + ['版权安全', '仅提供摘要与链接,\n不存储或分发受版权全文'], + ]; + feats.forEach((f, i) => { + const x = 6.8 + (i % 2) * 3.0; + const y = 2.7 + Math.floor(i / 2) * 1.7; + card(s, x, y, 2.85, 1.55, f[0], [f[1]], { bar: C.edu }); + }); + + // 底部价值 + s.addShape('roundRect', { + x: 0.6, y: 6.3, w: 12.1, h: 0.7, fill: { color: C.edu }, rectRadius: 0.08, + }); + s.addText('价值:把文献检索从"大海捞针"变成"精准取证",支撑课题研究与论文写作,同时培养循证思维', { + x: 0.8, y: 6.35, w: 11.7, h: 0.6, + fontSize: 12.5, color: C.white, align: 'center', valign: 'middle', fontFace: 'Microsoft YaHei', + }); + footer(s, 13); +} + +// ============================================================ +// 第 14 页 · 协同素养 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 03 · 学生价值 06', '协同素养:负责任地使用工具', C.edu); + + s.addShape('roundRect', { + x: 0.6, y: 1.6, w: 12.1, h: 0.9, fill: { color: C.bgPanel }, rectRadius: 0.08, + }); + s.addText('在医学领域,能否负责任地使用智能工具本身就是一种核心能力。系统从四个维度系统培养,并把结果计入能力画像与岗位胜任力对照。', { + x: 0.8, y: 1.7, w: 11.7, h: 0.7, + fontSize: 13, color: C.text, align: 'center', valign: 'middle', fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.3, + }); + + const dims = [ + ['提问能力', '能否向工具提出\n精准、有效的问题'], + ['批判性验证', '能否对工具输出进行\n来源核验与批判性思考'], + ['责任边界意识', '是否清楚工具辅助\n与人工决策的边界'], + ['协同工作流', '能否有效组织\n人机协作流程'], + ]; + dims.forEach((d, i) => { + const x = 0.6 + i * 3.05; + s.addShape('roundRect', { + x, y: 2.8, w: 2.8, h: 2.0, fill: { color: C.bgSoft }, + line: { color: C.edu, width: 1.2 }, rectRadius: 0.1, + }); + s.addShape('rect', { x, y: 2.8, w: 2.8, h: 0.55, fill: { color: C.edu } }); + s.addText(d[0], { + x, y: 2.87, w: 2.8, h: 0.45, + fontSize: 14, bold: true, color: C.white, align: 'center', fontFace: 'Microsoft YaHei', + }); + s.addText(d[1], { + x: x + 0.2, y: 3.5, w: 2.4, h: 1.1, + fontSize: 12, color: C.textMid, align: 'center', fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.3, valign: 'middle', + }); + }); + + // 机制说明 + const mechs = [ + '每个维度都有真实任务载体的训练任务,不是空讲理论', + '直接采用未核验输出时,系统会要求来源核验', + '评估结果计入能力画像与岗位胜任力对照', + '支持导师对协同质量进行点评', + ]; + mechs.forEach((m, i) => { + const y = 5.1 + i * 0.5; + s.addText('·', { x: 0.8, y, w: 0.3, h: 0.4, fontSize: 14, color: C.edu, bold: true, fontFace: 'Microsoft YaHei' }); + s.addText(m, { x: 1.1, y, w: 11.5, h: 0.4, fontSize: 12, color: C.text, fontFace: 'Microsoft YaHei' }); + }); + footer(s, 14); +} + +// ============================================================ +// 第 15 页 · 补充模块 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 03 · 学生价值 07', '补充模块:覆盖更多学习场景', C.edu); + const mods = [ + ['轮转见习', '记录临床轮转经历,\n按科室归档'], + ['技能视频', '搜索与学习\n临床操作技能视频'], + ['执业医师备考', '出题+间隔重复+\n模拟考试+个性化推荐'], + ['学术交流', '记录学术交流与\n会议参与'], + ['医学知识问答', '流式多轮\n医学知识对话'], + ['病例推演', '逐步推演临床病例,\n保持全程上下文'], + ['用药安全', '用药安全性\n检查与学习'], + ['持续扩展', '技能库可持续扩展,\n按需新增能力'], + ]; + mods.forEach((m, i) => { + const x = 0.6 + (i % 4) * 3.05; + const y = 1.7 + Math.floor(i / 4) * 2.5; + s.addShape('roundRect', { + x, y, w: 2.85, h: 2.25, fill: { color: C.bgSoft }, + line: { color: C.divider, width: 0.5 }, rectRadius: 0.1, + }); + s.addShape('rect', { x: x + 0.2, y: y + 0.25, w: 0.08, h: 1.75, fill: { color: i === 7 ? C.gold : C.edu } }); + s.addText(m[0], { + x: x + 0.4, y: y + 0.25, w: 2.3, h: 0.45, + fontSize: 14, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + s.addText(m[1], { + x: x + 0.4, y: y + 0.8, w: 2.3, h: 1.2, + fontSize: 11.5, color: C.textMid, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.25, valign: 'top', + }); + }); + footer(s, 15); +} + +// ============================================================ +// 第 16 页 · 学生价值小结(一个日常) +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 03 · 学生价值', '一个学生的日常:闭环成长的一天', C.edu); + const steps = [ + ['1', '登录学习空间', '记录今日临床见习成果,\n系统自动归档+能力标签映射'], + ['2', '收到过程性评价', '30秒内获得反馈\n与发展建议'], + ['3', '课程对练', '系统出题(已过导师审核)→\n模拟答题 → 查看诊断报告'], + ['4', '临床对话对练', '模拟问诊 →\n获得三维评估'], + ['5', '查看能力画像', '六维度分数 +\n成长趋势'], + ['6', '职业规划', '查看差距分析 →\n按推荐资源学习'], + ['7', '闭环更新', '能力提升后 → 画像自动更新 →\n发展规划动态调整'], + ]; + steps.forEach((st, i) => { + const y = 1.7 + i * 0.72; + s.addShape('ellipse', { + x: 0.7, y: y + 0.05, w: 0.45, h: 0.45, fill: { color: C.edu }, + }); + s.addText(st[0], { + x: 0.7, y: y + 0.07, w: 0.45, h: 0.41, + fontSize: 14, bold: true, color: C.white, align: 'center', valign: 'middle', fontFace: 'Microsoft YaHei', + }); + s.addText(st[1], { + x: 1.4, y, w: 3.0, h: 0.55, + fontSize: 13.5, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', valign: 'middle', + }); + s.addText(st[2], { + x: 4.6, y, w: 8.0, h: 0.55, + fontSize: 12, color: C.textMid, fontFace: 'Microsoft YaHei', valign: 'middle', + }); + if (i < 6) { + s.addShape('rect', { x: 0.91, y: y + 0.5, w: 0.03, h: 0.27, fill: { color: C.divider } }); + } + }); + footer(s, 16); +} + +// ============================================================ +// 第 17 页 · 第四部分章节页:学校价值 +// ============================================================ +{ + const s = addSlide(C.edu); + s.addShape('rect', { x: 0, y: 0, w: 0.35, h: H, fill: { color: C.white } }); + s.addText('PART 04', { + x: 1.0, y: 2.4, w: 11, h: 0.6, + fontSize: 18, color: 'BFE3E3', fontFace: 'Microsoft YaHei', charSpacing: 4, + }); + s.addText('学校价值', { + x: 1.0, y: 2.9, w: 11, h: 1.0, + fontSize: 44, bold: true, color: C.white, fontFace: 'Microsoft YaHei', + }); + s.addText('人才培养的数据底座 · 导师+管理+贯通', { + x: 1.0, y: 4.0, w: 11, h: 0.6, + fontSize: 18, color: 'D9EFEF', fontFace: 'Microsoft YaHei', + }); +} + +// ============================================================ +// 第 18 页 · 学校价值总览 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 04 · 学校价值', '三个层面,支撑培养决策', C.edu); + const items = [ + ['导师端', '教学把关与精准指导', [ + '题目审核:系统生成→导师把关', + '成果点评:促进学生反思改进', + '带教画像:脱敏查看学生能力分布', + ]], + ['管理端', '治理与合规并重', [ + '技能治理:定义、配置、启用', + '权限管理:按角色分级', + '审计日志:配置变更可追溯', + '合规监控:越权拒绝可查', + ]], + ['数据底座', '能力图谱贯通,打破孤岛', [ + '统一能力标签连接所有模块', + '画像基于全量行为数据', + '培养质量可量化、可追溯', + ]], + ]; + items.forEach((it, i) => { + const x = 0.6 + i * 4.1; + s.addShape('roundRect', { + x, y: 1.7, w: 3.9, h: 5.1, fill: { color: C.bgSoft }, + line: { color: C.edu, width: 1.2 }, rectRadius: 0.1, + }); + s.addShape('rect', { x, y: 1.7, w: 3.9, h: 1.0, fill: { color: C.edu } }); + s.addText(it[0], { + x, y: 1.82, w: 3.9, h: 0.5, + fontSize: 18, bold: true, color: C.white, align: 'center', fontFace: 'Microsoft YaHei', + }); + s.addText(it[1], { + x, y: 2.3, w: 3.9, h: 0.35, + fontSize: 12, color: 'D9EFEF', align: 'center', fontFace: 'Microsoft YaHei', + }); + const lines = it[2].map(t => ({ text: t, options: { bullet: { code: '2022' } } })); + s.addText(lines, { + x: x + 0.3, y: 2.95, w: 3.4, h: 3.6, + fontSize: 12.5, color: C.text, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.4, valign: 'top', + }); + }); + footer(s, 18); +} + +// ============================================================ +// 第 19 页 · 导师端 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 04 · 学校价值 01', '导师端:让带教有据可依', C.edu); + + const items = [ + ['题目审核', '系统生成的题目经导师通过后才可使用,\n退回需注明原因。保障教学内容准确性与权威性。', '系统出题 → 导师审核 → 通过/退回(附原因)'], + ['成果点评', '对学生学习成果进行教学点评,\n点评对学生可见,促进学生反思与改进。', '导师点评 → 学生可见 → 反思改进'], + ['带教学生画像', '查看所带学生的能力画像(脱敏),\n精准把握学生发展状况,针对性指导。', '脱敏画像 → 能力分布 → 针对性指导'], + ]; + items.forEach((it, i) => { + const y = 1.7 + i * 1.75; + s.addShape('roundRect', { + x: 0.6, y, w: 12.1, h: 1.55, fill: { color: C.bgSoft }, + line: { color: C.divider, width: 0.5 }, rectRadius: 0.08, + }); + s.addShape('rect', { x: 0.6, y, w: 0.1, h: 1.55, fill: { color: C.edu } }); + s.addText(it[0], { + x: 0.9, y: y + 0.15, w: 3.0, h: 0.45, + fontSize: 16, bold: true, color: C.edu, fontFace: 'Microsoft YaHei', + }); + s.addText(it[1], { + x: 0.9, y: y + 0.65, w: 6.8, h: 0.8, + fontSize: 12.5, color: C.text, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.3, valign: 'top', + }); + s.addShape('roundRect', { + x: 8.0, y: y + 0.35, w: 4.5, h: 0.85, fill: { color: C.white }, + line: { color: C.edu, width: 1 }, rectRadius: 0.06, + }); + s.addText(it[2], { + x: 8.15, y: y + 0.4, w: 4.2, h: 0.75, + fontSize: 11, color: C.edu, align: 'center', valign: 'middle', fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.2, + }); + }); + footer(s, 19); +} + +// ============================================================ +// 第 20 页 · 管理端 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 04 · 学校价值 02', '管理端:治理与合规并重', C.edu); + + // 技能五要素 + s.addText('技能治理 · 每个技能含五要素', { + x: 0.6, y: 1.6, w: 12, h: 0.4, + fontSize: 15, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + const elems = ['输入规格', '处理逻辑', '知识源', '输出格式', '可信度规则']; + elems.forEach((e, i) => { + const x = 0.6 + i * 2.45; + s.addShape('roundRect', { + x, y: 2.05, w: 2.3, h: 0.6, fill: { color: C.edu }, rectRadius: 0.08, + }); + s.addText(e, { + x, y: 2.09, w: 2.3, h: 0.52, + fontSize: 12.5, bold: true, color: C.white, align: 'center', fontFace: 'Microsoft YaHei', + }); + }); + s.addText('管理员可定义、配置、启用技能;每个技能的变更都进入审计日志(操作者、时间、内容)', { + x: 0.6, y: 2.8, w: 12, h: 0.35, + fontSize: 11.5, color: C.textMid, fontFace: 'Microsoft YaHei', italic: true, + }); + + // 三大治理能力 + const govs = [ + ['权限管理', '按角色分级定义访问权限范围,\n学生、导师、管理员各司其职'], + ['审计日志', '追踪所有技能配置变更,\n操作者、时间、内容全程留痕'], + ['合规监控', '查看越权拒绝事件,\n确保敏感数据访问安全'], + ]; + govs.forEach((g, i) => { + const x = 0.6 + i * 4.1; + card(s, x, 3.4, 3.9, 1.8, g[0], [g[1]], { bar: C.edu }); + }); + + // 合规默认原则 + s.addShape('roundRect', { + x: 0.6, y: 5.5, w: 12.1, h: 1.5, fill: { color: C.bgPanel }, rectRadius: 0.08, + }); + s.addText('合规默认 · 敏感数据天然受保护', { + x: 0.8, y: 5.6, w: 11.7, h: 0.4, + fontSize: 14, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + const rules = ['默认脱敏:非本人访问画像,敏感字段自动脱敏', '知情同意:跨用途使用必须有学生有效授权', '即时撤销:学生撤销授权后立即失效', '全审计:敏感操作留痕,保留≥12个月', '最小采集:仅采集与画像维度直接相关的数据']; + rules.forEach((r, i) => { + const x = 0.9 + (i % 3) * 4.0; + const y = 6.1 + Math.floor(i / 3) * 0.4; + s.addText('· ' + r, { + x, y, w: 3.8, h: 0.35, + fontSize: 10.5, color: C.text, fontFace: 'Microsoft YaHei', + }); + }); + footer(s, 20); +} + +// ============================================================ +// 第 21 页 · 数据贯通 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 04 · 学校价值 03', '数据贯通:从孤岛到全景', C.edu); + + // 对比:传统 vs 本系统 + s.addText('传统平台:各模块数据孤立', { + x: 0.6, y: 1.6, w: 12, h: 0.4, + fontSize: 14, bold: true, color: C.rose, fontFace: 'Microsoft YaHei', + }); + const isolated = ['课程系统', '作业系统', '见习记录', '考核系统', '科研管理']; + isolated.forEach((t, i) => { + const x = 0.6 + i * 2.45; + s.addShape('roundRect', { + x, y: 2.05, w: 2.3, h: 0.6, fill: { color: C.white }, + line: { color: C.rose, width: 1, dashType: 'dash' }, rectRadius: 0.08, + }); + s.addText(t, { + x, y: 2.09, w: 2.3, h: 0.52, + fontSize: 12, color: C.rose, align: 'center', fontFace: 'Microsoft YaHei', + }); + }); + s.addText('数据互不相通,学生画像是单一模块的局部视图', { + x: 0.6, y: 2.75, w: 12, h: 0.3, + fontSize: 11, color: C.textMid, fontFace: 'Microsoft YaHei', italic: true, + }); + + // 本系统 + s.addText('本系统:统一能力图谱贯通所有模块', { + x: 0.6, y: 3.3, w: 12, h: 0.4, + fontSize: 14, bold: true, color: C.edu, fontFace: 'Microsoft YaHei', + }); + // 中心能力图谱 + s.addShape('ellipse', { + x: 5.4, y: 4.0, w: 2.5, h: 1.0, fill: { color: C.edu }, + }); + s.addText('能力图谱', { + x: 5.4, y: 4.1, w: 2.5, h: 0.8, + fontSize: 15, bold: true, color: C.white, align: 'center', valign: 'middle', fontFace: 'Microsoft YaHei', + }); + const connected = ['学习空间', '课程对练', '临床对话', '能力画像', '职业规划', '科研查询']; + connected.forEach((t, i) => { + const angle = (i / 6) * Math.PI * 2; + const cx = 6.65, cy = 4.5, r = 2.2; + const x = cx + Math.cos(angle) * r - 0.9; + const y = cy + Math.sin(angle) * r * 0.55 - 0.25; + s.addShape('roundRect', { + x, y, w: 1.8, h: 0.5, fill: { color: C.bgSoft }, + line: { color: C.edu, width: 1 }, rectRadius: 0.06, + }); + s.addText(t, { + x, y: y + 0.02, w: 1.8, h: 0.46, + fontSize: 11, color: C.edu, align: 'center', fontFace: 'Microsoft YaHei', + }); + }); + + // 三个收益 + const gains = [ + '学生画像基于全量行为数据,而非单一模块局部视图', + '职业规划能精确对照当前能力与目标岗位的差距', + '各模块使用数据相互增强,形成正反馈循环', + ]; + gains.forEach((g, i) => { + const y = 6.0 + i * 0.4; + s.addText('· ' + g, { + x: 0.8, y, w: 12, h: 0.35, + fontSize: 12, color: C.text, fontFace: 'Microsoft YaHei', + }); + }); + footer(s, 21); +} + +// ============================================================ +// 第 22 页 · 第五部分章节页:广电价值 +// ============================================================ +{ + const s = addSlide(C.gold); + s.addShape('rect', { x: 0, y: 0, w: 0.35, h: H, fill: { color: C.white } }); + s.addText('PART 05', { + x: 1.0, y: 2.4, w: 11, h: 0.6, + fontSize: 18, color: 'F0E0C0', fontFace: 'Microsoft YaHei', charSpacing: 4, + }); + s.addText('广电价值', { + x: 1.0, y: 2.9, w: 11, h: 1.0, + fontSize: 44, bold: true, color: C.white, fontFace: 'Microsoft YaHei', + }); + s.addText('算力支撑与数据通道 · 投入转化为人才培养', { + x: 1.0, y: 4.0, w: 11, h: 0.6, + fontSize: 18, color: 'F5E8D0', fontFace: 'Microsoft YaHei', + }); +} + +// ============================================================ +// 第 23 页 · 广电价值总览 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 05 · 广电价值', '算力与数据通道,支撑平台运行', C.gold); + + const items = [ + ['算力支撑', '大模型推理算力供给', '支撑出题、评价、对话、\n总结等全部智能交互'], + ['流式输出', 'SSE流式响应', '对话对练实时逐字输出,\n支撑自然交互体验'], + ['数据通道', '多源医学文献接入', 'PubMed、CNKI、万方、\nUpToDate、Cochrane'], + ['社会价值', '算力转化为培养质量', '每一次调用都转化为\n学生的能力提升'], + ]; + items.forEach((it, i) => { + const x = 0.6 + (i % 2) * 6.1; + const y = 1.7 + Math.floor(i / 2) * 2.5; + s.addShape('roundRect', { + x, y, w: 5.9, h: 2.25, fill: { color: C.bgSoft }, + line: { color: C.gold, width: 1.2 }, rectRadius: 0.1, + }); + s.addShape('rect', { x: x + 0.25, y: y + 0.25, w: 0.08, h: 1.75, fill: { color: C.gold } }); + s.addText(it[0], { + x: x + 0.5, y: y + 0.22, w: 5.2, h: 0.4, + fontSize: 17, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + s.addText(it[1], { + x: x + 0.5, y: y + 0.65, w: 5.2, h: 0.35, + fontSize: 12.5, color: C.gold, bold: true, fontFace: 'Microsoft YaHei', + }); + s.addText(it[2], { + x: x + 0.5, y: y + 1.05, w: 5.2, h: 1.0, + fontSize: 12, color: C.textMid, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.3, valign: 'top', + }); + }); + footer(s, 23); +} + +// ============================================================ +// 第 24 页 · 合作模式与投入产出 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 05 · 广电价值', '合作模式与投入产出', C.gold); + + // 指标卡 + metric(s, 0.6, 1.7, 2.9, '21', '业务模块(后端)', C.gold); + metric(s, 3.7, 1.7, 2.9, '8+', '可复用技能', C.gold); + metric(s, 6.8, 1.7, 2.9, '5', '接入数据源', C.gold); + metric(s, 9.9, 1.7, 2.9, '3', '用户角色', C.gold); + + // 调用保护 + s.addText('调用保护机制', { + x: 0.6, y: 3.5, w: 12, h: 0.4, + fontSize: 15, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + const limits = [ + ['20次/分钟', '单用户调用上限,\n防止瞬时滥用'], + ['500次/天', '单用户每日上限,\n保障算力公平分配'], + ['兜底降级', '算力不可用时回退\n规则/缓存/默认,\n不拖垮主流程'], + ]; + limits.forEach((l, i) => { + const x = 0.6 + i * 4.1; + s.addShape('roundRect', { + x, y: 3.95, w: 3.9, h: 1.5, fill: { color: C.bgSoft }, + line: { color: C.gold, width: 1 }, rectRadius: 0.08, + }); + s.addText(l[0], { + x, y: 4.1, w: 3.9, h: 0.45, + fontSize: 16, bold: true, color: C.gold, align: 'center', fontFace: 'Microsoft YaHei', + }); + s.addText(l[1], { + x: x + 0.2, y: 4.6, w: 3.5, h: 0.8, + fontSize: 11.5, color: C.textMid, align: 'center', fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.25, + }); + }); + + // 投入产出 + s.addShape('roundRect', { + x: 0.6, y: 5.7, w: 12.1, h: 1.3, fill: { color: C.gold }, rectRadius: 0.08, + }); + s.addText('投入产出', { + x: 0.8, y: 5.8, w: 11.7, h: 0.35, + fontSize: 13, bold: true, color: C.white, fontFace: 'Microsoft YaHei', + }); + s.addText('算力投入 → 支撑学生日常学习与训练调用 → 转化为医学人才培养质量 → 广电算力赋能医学教育的社会效益与品牌价值。技能库可持续扩展,算力需求随应用深化稳步增长。', { + x: 0.8, y: 6.15, w: 11.7, h: 0.8, + fontSize: 12, color: C.white, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.3, valign: 'top', + }); + footer(s, 24); +} + +// ============================================================ +// 第 25 页 · 第六部分:设计底线 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 06 · 设计底线', '四个底线,确保系统可信可用', C.steel); + + const lines = [ + ['能力贯通', '打破数据孤岛', '所有学习活动通过统一能力图谱连接。\n学习空间新增成果、对练完成测验、对话获得评分——\n都映射到同一套能力标签,画像基于全量行为数据。'], + ['可信优先', '医学场景零容忍幻觉', '所有输出附带可信度标注(来源+置信度);\n无法溯源的内容标注"未经核验";题目必须绑定权威知识源;\n总结中无法追溯的结论不作为引用输出。'], + ['合规默认', '敏感数据天然受保护', '默认脱敏、知情同意授权、即时撤销、\n全审计留痕(≥12个月)、最小采集。\n医学生画像包含敏感健康心理数据,天然受保护。'], + ['人机协同', '辅助而非替代', '系统生成题目→导师审核后才可使用;\n文献总结明确提示"不替代阅读原文";\n直接采用未核验输出会被要求核验;所有建议可追溯依据。'], + ]; + lines.forEach((l, i) => { + const x = 0.6 + (i % 2) * 6.1; + const y = 1.7 + Math.floor(i / 2) * 2.7; + s.addShape('roundRect', { + x, y, w: 5.9, h: 2.45, fill: { color: C.bgSoft }, + line: { color: C.steel, width: 1 }, rectRadius: 0.1, + }); + s.addShape('rect', { x: x + 0.25, y: y + 0.25, w: 0.08, h: 1.95, fill: { color: C.steel } }); + s.addText(l[0], { + x: x + 0.5, y: y + 0.22, w: 3.0, h: 0.4, + fontSize: 16, bold: true, color: C.ink, fontFace: 'Microsoft YaHei', + }); + s.addText(l[1], { + x: x + 3.6, y: y + 0.25, w: 2.1, h: 0.35, + fontSize: 11.5, color: C.steel, align: 'right', bold: true, fontFace: 'Microsoft YaHei', + }); + s.addText(l[2], { + x: x + 0.5, y: y + 0.7, w: 5.2, h: 1.6, + fontSize: 11.5, color: C.textMid, fontFace: 'Microsoft YaHei', + lineSpacingMultiple: 1.3, valign: 'top', + }); + }); + footer(s, 25); +} + +// ============================================================ +// 第 26 页 · 与传统教学平台差异 +// ============================================================ +{ + const s = addSlide(); + header(s, 'PART 06 · 差异化优势', '与传统教学平台的七个差异', C.steel); + + const rows = [ + ['数据关联', '各模块数据孤立', '统一能力图谱贯通所有模块'], + ['学习反馈', '周期性人工评价', '实时过程性评价 + 阶段终结性评价'], + ['职业发展', '静态指导', '动态闭环:能力变化→规划自动更新'], + ['协同素养', '无系统培养', '四维度协同能力训练+评估'], + ['数据隐私', '粗放管理', '知情同意+即时撤销+默认脱敏+全审计'], + ['教学质量', '缺乏把控', '系统生成+人工审核双层保障'], + ['输出信任', '缺乏验证机制', '全链路可信度标注 + 来源溯源'], + ]; + // 表头 + const headY = 1.7; + s.addShape('rect', { x: 0.6, y: headY, w: 12.1, h: 0.5, fill: { color: C.steel } }); + s.addText('维度', { x: 0.7, y: headY + 0.05, w: 2.5, h: 0.4, fontSize: 12.5, bold: true, color: C.white, fontFace: 'Microsoft YaHei' }); + s.addText('传统教学平台', { x: 3.3, y: headY + 0.05, w: 4.0, h: 0.4, fontSize: 12.5, bold: true, color: C.white, fontFace: 'Microsoft YaHei' }); + s.addText('本系统', { x: 7.5, y: headY + 0.05, w: 5.0, h: 0.4, fontSize: 12.5, bold: true, color: C.white, fontFace: 'Microsoft YaHei' }); + + rows.forEach((r, i) => { + const y = headY + 0.5 + i * 0.62; + if (i % 2 === 0) { + s.addShape('rect', { x: 0.6, y, w: 12.1, h: 0.62, fill: { color: C.bgSoft } }); + } + s.addText(r[0], { x: 0.7, y: y + 0.08, w: 2.5, h: 0.45, fontSize: 12, bold: true, color: C.ink, fontFace: 'Microsoft YaHei' }); + s.addText(r[1], { x: 3.3, y: y + 0.08, w: 4.0, h: 0.45, fontSize: 11.5, color: C.rose, fontFace: 'Microsoft YaHei' }); + s.addText(r[2], { x: 7.5, y: y + 0.08, w: 5.0, h: 0.45, fontSize: 11.5, color: C.edu, fontFace: 'Microsoft YaHei' }); + }); + footer(s, 26); +} + +// ============================================================ +// 第 27 页 · 结尾 +// ============================================================ +{ + const s = addSlide(C.ink); + s.addShape('rect', { x: 0, y: 0, w: 0.35, h: H, fill: { color: C.gold } }); + s.addShape('rect', { x: 0.35, y: 0, w: 0.08, h: H, fill: { color: C.edu } }); + + s.addText('让每一个医学生的成长', { + x: 1.0, y: 2.2, w: 11, h: 0.9, + fontSize: 40, bold: true, color: C.white, fontFace: 'Microsoft YaHei', + }); + s.addText('都被看见、可追溯、有依据', { + x: 1.0, y: 3.0, w: 11, h: 0.9, + fontSize: 40, bold: true, color: C.gold, fontFace: 'Microsoft YaHei', + }); + + const summary = [ + ['贯穿成长链', '基础医学 → 临床医学 → 见习实习 → 住院医师培养'], + ['数据可追溯', '每项能力结论可追溯到具体学习成果'], + ['培养有依据', '基于全量行为数据,而非主观印象'], + ['算力有价值', '广电算力投入转化为人才培养质量'], + ]; + summary.forEach((it, i) => { + const y = 4.4 + i * 0.55; + s.addText('· ', { x: 1.0, y, w: 0.3, h: 0.45, fontSize: 16, color: C.gold, bold: true, fontFace: 'Microsoft YaHei' }); + s.addText(it[0], { + x: 1.3, y, w: 2.2, h: 0.45, + fontSize: 15, bold: true, color: C.white, fontFace: 'Microsoft YaHei', + }); + s.addText(it[1], { + x: 3.6, y, w: 9, h: 0.45, + fontSize: 13, color: 'AEBFD0', fontFace: 'Microsoft YaHei', + }); + }); + + s.addText('医科高校智能学习中心', { + x: 1.0, y: 6.8, w: 11, h: 0.4, + fontSize: 14, color: '8FA3B8', fontFace: 'Microsoft YaHei', charSpacing: 2, + }); +} + +// ===== 生成文件 ===== +pres.writeFile({ fileName: '医科高校智能学习中心-汇报.pptx' }) + .then(fn => console.log('已生成: ' + fn)); diff --git a/src/common/rate-limit/ai-rate-limit.guard.ts b/src/common/rate-limit/ai-rate-limit.guard.ts new file mode 100644 index 0000000..86dc025 --- /dev/null +++ b/src/common/rate-limit/ai-rate-limit.guard.ts @@ -0,0 +1,83 @@ +import { + CanActivate, + ExecutionContext, + HttpException, + HttpStatus, + Injectable, + Logger, +} from '@nestjs/common'; + +import type { AuthenticatedUser } from '@modules/auth'; + +/** + * AI 调用速率限制守卫。 + * + * 基于内存滑动窗口,按用户限制 AI 密集型端点的调用频率, + * 防止滥用导致的成本失控。 + * + * 配置(环境变量): + * - `AI_RATE_LIMIT_PER_MINUTE`:每分钟最大调用次数(默认 20) + * - `AI_RATE_LIMIT_PER_DAY`:每日最大调用次数(默认 500) + * + * 注意:内存实现仅适用于单实例部署;多实例需替换为 Redis 等共享存储。 + */ +@Injectable() +export class AIRateLimitGuard implements CanActivate { + private readonly logger = new Logger(AIRateLimitGuard.name); + + private readonly perMinute = parseInt( + process.env.AI_RATE_LIMIT_PER_MINUTE ?? '20', + 10, + ); + private readonly perDay = parseInt( + process.env.AI_RATE_LIMIT_PER_DAY ?? '500', + 10, + ); + + /** 每个用户的调用时间戳记录(毫秒)。 */ + private readonly callLog = new Map(); + + canActivate(context: ExecutionContext): boolean { + const request = context.switchToHttp().getRequest<{ + user?: AuthenticatedUser; + }>(); + const userId = request.user?.id ?? 'anonymous'; + + const now = Date.now(); + const minuteAgo = now - 60_000; + const dayAgo = now - 86_400_000; + + const log = this.callLog.get(userId) ?? []; + + // 清理超过一天的记录 + const recentLog = log.filter((ts) => ts > dayAgo); + + const callsLastMinute = recentLog.filter((ts) => ts > minuteAgo).length; + const callsLastDay = recentLog.length; + + if (callsLastMinute >= this.perMinute) { + throw new HttpException( + { + code: 'RATE_LIMIT_EXCEEDED', + message: `AI 调用过于频繁,请稍后再试(每分钟上限 ${this.perMinute} 次)`, + }, + HttpStatus.TOO_MANY_REQUESTS, + ); + } + + if (callsLastDay >= this.perDay) { + throw new HttpException( + { + code: 'DAILY_LIMIT_EXCEEDED', + message: `今日 AI 调用次数已达上限(${this.perDay} 次),请明日再来`, + }, + HttpStatus.TOO_MANY_REQUESTS, + ); + } + + recentLog.push(now); + this.callLog.set(userId, recentLog); + + return true; + } +} diff --git a/src/infra/ai-gateway/ai-stream.controller.ts b/src/infra/ai-gateway/ai-stream.controller.ts new file mode 100644 index 0000000..36afe75 --- /dev/null +++ b/src/infra/ai-gateway/ai-stream.controller.ts @@ -0,0 +1,89 @@ +import { + Body, + Controller, + Inject, + Post, + Res, + UseGuards, +} from '@nestjs/common'; +import { Response } from 'express'; + +import { AuthenticatedUser, CurrentUser } from '@modules/auth'; +import { AIRateLimitGuard } from '@common/rate-limit/ai-rate-limit.guard'; + +import { AI_GATEWAY, AIGateway, AIStreamRequest } from './ai-gateway.types'; + +/** + * AI 流式生成端点。 + * + * 通过 Server-Sent Events 逐 chunk 返回 AI 生成内容, + * 前端可实时显示生成过程(打字机效果)。 + * + * 受 `AIRateLimitGuard` 速率限制保护,防止 AI 调用滥用。 + */ +@Controller('api/ai') +@UseGuards(AIRateLimitGuard) +export class AIStreamController { + constructor( + @Inject(AI_GATEWAY) private readonly ai: AIGateway, + ) {} + + /** + * POST /api/ai/stream + * + * Body: { prompt, systemPrompt?, messages?, temperature?, maxTokens? } + * + * 返回 SSE 流: + * - data: {"chunk":"..."} — 每个生成 chunk + * - data: {"done":true,"content":"完整内容","annotation":{...}} — 生成结束 + * - data: {"error":"错误信息"} — 出错 + */ + @Post('stream') + async stream( + @Body() body: { + prompt: string; + systemPrompt?: string; + messages?: Array<{ role: 'system' | 'user' | 'assistant'; content: string }>; + temperature?: number; + maxTokens?: number; + }, + @Res() res: Response, + @CurrentUser() _user: AuthenticatedUser, + ) { + res.setHeader('Content-Type', 'text/event-stream'); + // no-transform 阻止下游代理(Next.js dev proxy)对 SSE 流进行 gzip 压缩, + // 压缩会缓冲整个响应导致前端无法实时收到 chunk(打字机效果失效)。 + res.setHeader('Cache-Control', 'no-cache, no-transform'); + res.setHeader('Content-Encoding', 'identity'); + res.setHeader('Connection', 'keep-alive'); + res.setHeader('X-Accel-Buffering', 'no'); + res.flushHeaders(); + + const request: AIStreamRequest = { + prompt: body.prompt, + systemPrompt: body.systemPrompt, + messages: body.messages, + temperature: body.temperature, + maxTokens: body.maxTokens, + }; + + try { + const result = await this.ai.generateStream(request, (chunk) => { + res.write(`data: ${JSON.stringify({ chunk })}\n\n`); + }); + + res.write( + `data: ${JSON.stringify({ + done: true, + content: result.content, + annotation: result.annotation, + })}\n\n`, + ); + } catch (error: unknown) { + const message = error instanceof Error ? error.message : '生成失败'; + res.write(`data: ${JSON.stringify({ error: message })}\n\n`); + } finally { + res.end(); + } + } +} diff --git a/src/modules/exam-prep/entities/question-bank.entity.ts b/src/modules/exam-prep/entities/question-bank.entity.ts new file mode 100644 index 0000000..be2930d --- /dev/null +++ b/src/modules/exam-prep/entities/question-bank.entity.ts @@ -0,0 +1,30 @@ +import { Column, CreateDateColumn, Entity, Index, PrimaryColumn } from 'typeorm'; + +/** + * 执业医师备考内置题库实体。 + * 用于持久化存储 AI 生成或人工录入的题库题目,支持自动查重。 + */ +@Entity({ name: 'question_bank' }) +export class QuestionBankEntity { + @PrimaryColumn({ type: 'varchar', length: 128 }) + id!: string; + + @Index() + @Column({ type: 'varchar', length: 64 }) + subject!: string; + + @Column({ type: 'text' }) + content!: string; + + @Column({ type: 'jsonb', default: () => "'[]'" }) + options!: string[]; + + @Column({ type: 'varchar', length: 8 }) + correctAnswer!: string; + + @Column({ type: 'text' }) + explanation!: string; + + @CreateDateColumn({ type: 'timestamptz' }) + createdAt!: Date; +} diff --git a/src/modules/exam-prep/repositories/in-memory-question-bank.repository.ts b/src/modules/exam-prep/repositories/in-memory-question-bank.repository.ts new file mode 100644 index 0000000..6080042 --- /dev/null +++ b/src/modules/exam-prep/repositories/in-memory-question-bank.repository.ts @@ -0,0 +1,71 @@ +import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { dirname, join } from 'node:path'; + +import { Injectable, Logger, OnModuleInit } from '@nestjs/common'; + +import type { QuestionBankEntry, QuestionBankRepository } from '../exam-prep.types'; + +const DATA_DIR = join(process.cwd(), '.data'); +const DATA_FILE = join(DATA_DIR, 'question-bank.json'); + +/** + * 内存题库仓库,附带 JSON 文件持久化。 + * 适用于 DB_ENABLED=false 的本地开发/测试场景,重启后可恢复数据。 + */ +@Injectable() +export class InMemoryQuestionBankRepository implements QuestionBankRepository, OnModuleInit { + private readonly logger = new Logger(InMemoryQuestionBankRepository.name); + private store = new Map(); + + onModuleInit() { + this.loadFromDisk(); + } + + async save(entry: QuestionBankEntry): Promise { + this.store.set(entry.id, entry); + this.flushToDisk(); + } + + async list(subject?: string): Promise { + const all = Array.from(this.store.values()).sort( + (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(), + ); + if (subject) { + return all.filter((q) => q.subject === subject); + } + return all; + } + + async findById(id: string): Promise { + return this.store.get(id); + } + + private loadFromDisk(): void { + if (!existsSync(DATA_FILE)) { + this.logger.log(`题库持久化文件不存在,等待首次写入: ${DATA_FILE}`); + return; + } + try { + const raw = readFileSync(DATA_FILE, 'utf-8'); + const parsed = JSON.parse(raw) as QuestionBankEntry[]; + if (Array.isArray(parsed)) { + this.store = new Map(parsed.map((q) => [q.id, q])); + this.logger.log(`已从 ${DATA_FILE} 加载 ${this.store.size} 条题库记录`); + } + } catch (err: any) { + this.logger.warn(`题库持久化文件读取失败: ${err.message}`); + } + } + + private flushToDisk(): void { + try { + if (!existsSync(DATA_DIR)) { + mkdirSync(DATA_DIR, { recursive: true }); + } + const data = Array.from(this.store.values()); + writeFileSync(DATA_FILE, JSON.stringify(data, null, 2), 'utf-8'); + } catch (err: any) { + this.logger.warn(`题库持久化文件写入失败: ${err.message}`); + } + } +} diff --git a/src/modules/exam-prep/repositories/typeorm-question-bank.repository.ts b/src/modules/exam-prep/repositories/typeorm-question-bank.repository.ts new file mode 100644 index 0000000..6e1e0e1 --- /dev/null +++ b/src/modules/exam-prep/repositories/typeorm-question-bank.repository.ts @@ -0,0 +1,55 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Repository } from 'typeorm'; + +import { QuestionBankEntity } from '../entities/question-bank.entity'; +import type { QuestionBankEntry, QuestionBankRepository } from '../exam-prep.types'; + +/** + * 基于 TypeORM / PostgreSQL 的题库持久化实现。 + */ +@Injectable() +export class TypeOrmQuestionBankRepository implements QuestionBankRepository { + constructor( + @InjectRepository(QuestionBankEntity) + private readonly repo: Repository, + ) {} + + async save(entry: QuestionBankEntry): Promise { + const entity = new QuestionBankEntity(); + entity.id = entry.id; + entity.subject = entry.subject; + entity.content = entry.content; + entity.options = entry.options; + entity.correctAnswer = entry.correctAnswer; + entity.explanation = entry.explanation; + entity.createdAt = new Date(entry.createdAt); + await this.repo.save(entity); + } + + async list(subject?: string): Promise { + const where = subject ? { subject } : {}; + const rows = await this.repo.find({ + where, + order: { createdAt: 'DESC' }, + }); + return rows.map((r) => this.toEntry(r)); + } + + async findById(id: string): Promise { + const row = await this.repo.findOne({ where: { id } }); + return row ? this.toEntry(row) : undefined; + } + + private toEntry(r: QuestionBankEntity): QuestionBankEntry { + return { + id: r.id, + subject: r.subject, + content: r.content, + options: r.options, + correctAnswer: r.correctAnswer, + explanation: r.explanation, + createdAt: r.createdAt.toISOString(), + }; + } +} diff --git a/tsconfig.json b/tsconfig.json index 6a978e1..e480bc6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,9 @@ "target": "ES2021", "sourceMap": true, "outDir": "./dist", + "rootDir": "./src", "baseUrl": "./", + "ignoreDeprecations": "6.0", "incremental": true, "skipLibCheck": true, "strictNullChecks": true, diff --git a/web/src/components/exam-recommendations.tsx b/web/src/components/exam-recommendations.tsx new file mode 100644 index 0000000..227b64f --- /dev/null +++ b/web/src/components/exam-recommendations.tsx @@ -0,0 +1,87 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { Lightbulb, TrendingDown } from "lucide-react"; + +import { Badge } from "@/components/ui/badge"; +import { examPrepApi } from "@/lib/services"; + +interface Recommendation { + subject: string; + label: string; + priority: number; + reason: string; + correctRate: number | null; + totalAnswered: number; + daysSinceLastPractice: number; +} + +const PRIORITY_VARIANT: Record = { + 1: "destructive", + 2: "info", + 3: "warning", + 4: "success", +}; + +/** + * 个性化备考推荐横幅:展示薄弱科目与今日复习建议。 + */ +export function ExamRecommendations({ + onPickSubject, +}: { + onPickSubject?: (subject: string) => void; +}) { + const [recs, setRecs] = useState([]); + const [summary, setSummary] = useState(""); + const [loaded, setLoaded] = useState(false); + + useEffect(() => { + examPrepApi + .getRecommendations() + .then((res) => { + setRecs(res.recommendations ?? []); + setSummary(res.summary ?? ""); + setLoaded(true); + }) + .catch(() => setLoaded(true)); + }, []); + + if (!loaded || recs.length === 0) return null; + + // 只展示优先级最高的前 3 个 + const top = recs.slice(0, 3); + + return ( +
+
+ + + +
+

智能备考推荐

+

{summary}

+
+
+
+ {top.map((r) => ( + + ))} +
+
+ ); +} diff --git a/web/src/components/markdown.tsx b/web/src/components/markdown.tsx new file mode 100644 index 0000000..adbd109 --- /dev/null +++ b/web/src/components/markdown.tsx @@ -0,0 +1,59 @@ +"use client"; + +import ReactMarkdown from "react-markdown"; +import remarkGfm from "remark-gfm"; + +import { cn } from "@/lib/utils"; + +/** + * 统一的 Markdown 渲染组件。 + * + * 用于渲染 AI 生成的富文本内容(标题、列表、加粗、代码、表格等), + * 样式与应用主题一致,支持暗色模式。可在流式输出过程中实时渲染。 + */ +export function Markdown({ + content, + className, +}: { + content: string; + className?: string; +}) { + return ( +
+ {content} +
+ ); +} diff --git a/web/src/components/mock-exam.tsx b/web/src/components/mock-exam.tsx new file mode 100644 index 0000000..8eaff07 --- /dev/null +++ b/web/src/components/mock-exam.tsx @@ -0,0 +1,322 @@ +"use client"; + +import { useEffect, useRef, useState } from "react"; +import { CheckCircle2, Clock, FileText, XCircle } from "lucide-react"; +import { toast } from "sonner"; + +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { Select } from "@/components/ui/select"; +import { ApiError } from "@/lib/api"; +import { examPrepApi } from "@/lib/services"; + +const SUBJECTS = [ + { value: "internal", label: "内科学" }, + { value: "surgery", label: "外科学" }, + { value: "pediatrics", label: "儿科学" }, + { value: "obgyn", label: "妇产科学" }, + { value: "pharmacology", label: "药理学" }, + { value: "pathology", label: "病理学" }, + { value: "diagnostics", label: "诊断学" }, + { value: "ethics", label: "医学伦理" }, +]; + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +type Phase = "config" | "exam" | "result"; + +/** + * 模拟考试组件:限时批量答题 → 交卷统一批阅。 + */ +export function MockExam() { + const [phase, setPhase] = useState("config"); + const [count, setCount] = useState(10); + const [timeLimit, setTimeLimit] = useState(20); + const [busy, setBusy] = useState(false); + const [error, setError] = useState(null); + + const [exam, setExam] = useState(null); + const [answers, setAnswers] = useState>({}); + const [result, setResult] = useState(null); + const [remainingSec, setRemainingSec] = useState(0); + const timerRef = useRef | null>(null); + + useEffect(() => { + return () => { + if (timerRef.current) clearInterval(timerRef.current); + }; + }, []); + + async function startExam() { + setBusy(true); + setError(null); + try { + const e = await examPrepApi.startMockExam({ count, timeLimitMinutes: timeLimit }); + setExam(e); + setAnswers({}); + setResult(null); + setPhase("exam"); + setRemainingSec(timeLimit * 60); + timerRef.current = setInterval(() => { + setRemainingSec((s) => { + if (s <= 1) { + if (timerRef.current) clearInterval(timerRef.current); + void submitExam(e, true); + return 0; + } + return s - 1; + }); + }, 1000); + } catch (err) { + setError(err instanceof ApiError ? err.message : "无法发起模拟考试"); + } finally { + setBusy(false); + } + } + + async function submitExam(examData = exam, auto = false) { + if (!examData) return; + if (timerRef.current) clearInterval(timerRef.current); + setBusy(true); + setError(null); + try { + const payload = { + examId: examData.examId, + answers: examData.questions.map((q: any) => ({ + questionId: q.id, + answer: answers[q.id] ?? "", + })), + }; + const r = await examPrepApi.submitMockExam(payload); + setResult(r); + setPhase("result"); + if (auto) toast.warning("考试时间到,已自动交卷。"); + } catch (err) { + setError(err instanceof ApiError ? err.message : "交卷失败"); + } finally { + setBusy(false); + } + } + + function reset() { + if (timerRef.current) clearInterval(timerRef.current); + setPhase("config"); + setExam(null); + setAnswers({}); + setResult(null); + } + + const answeredCount = exam ? Object.keys(answers).filter((k) => answers[k]).length : 0; + + // ── 配置阶段 ── + if (phase === "config") { + return ( + + + + 模拟考试 + + + +

+ 限时批量答题,模拟真实考场环境。交卷后统一批阅并生成成绩单。 +

+ {error && } +
+
+ + +
+
+ + +
+ +
+
+
+ ); + } + + // ── 考试阶段 ── + if (phase === "exam" && exam) { + const mm = String(Math.floor(remainingSec / 60)).padStart(2, "0"); + const ss = String(remainingSec % 60).padStart(2, "0"); + const lowTime = remainingSec <= 60; + return ( + + +
+ 模拟考试进行中 +
+ + 已答 {answeredCount} / {exam.totalQuestions} + + + {mm}:{ss} + +
+
+
+ + {error && } + {exam.questions.map((q: any) => ( +
+
+ {q.index}. +
+

{q.content}

+ + {q.subjectLabel} + +
+
+ {q.options && ( +
+ {q.options.map((opt: string, i: number) => { + const letter = String.fromCharCode(65 + i); + const selected = answers[q.id] === letter; + return ( + + ); + })} +
+ )} +
+ ))} +
+ + +
+
+
+ ); + } + + // ── 成绩阶段 ── + if (phase === "result" && result) { + return ( + + + 考试成绩单 + + +
+
= 80 ? "text-success" : result.score >= 60 ? "text-warning" : "text-destructive" + }`} + > + {result.score} +
+
+ + {result.passed ? "及格" : "未及格"} + + {result.overtime && 超时} +
+

+ {result.correctCount}/{result.totalQuestions} 题正确 · 用时 {result.elapsedMinutes} 分钟 +

+

{result.comment}

+
+ + {/* 科目分布 */} +
+

各科目表现

+ {Object.entries(result.bySubject).map(([key, val]: [string, any]) => { + const label = SUBJECTS.find((s) => s.value === key)?.label ?? key; + return ( +
+ {label} + = 80 ? "text-success" : val.rate >= 60 ? "text-warning" : "text-destructive" + }`} + > + {val.correct}/{val.total}({val.rate}%) + +
+ ); + })} +
+ + {/* 逐题解析 */} +
+

逐题解析

+
+ {result.results.map((r: any, i: number) => ( +
+
+ {r.correct ? ( + + ) : ( + + )} + 第 {i + 1} 题 +
+

{r.content}

+
+ 你的答案:{r.userAnswer} + 正确答案:{r.correctAnswer} +
+ {r.explanation && ( +

{r.explanation}

+ )} +
+ ))} +
+
+ + +
+
+ ); + } + + return null; +} + +function ErrorText({ message }: { message: string }) { + return ( +
{message}
+ ); +} diff --git a/web/src/components/offline-indicator.tsx b/web/src/components/offline-indicator.tsx new file mode 100644 index 0000000..4b1368d --- /dev/null +++ b/web/src/components/offline-indicator.tsx @@ -0,0 +1,35 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { WifiOff } from "lucide-react"; + +/** + * 离线状态指示器:检测网络断开,提示用户当前展示的是缓存数据。 + */ +export function OfflineIndicator() { + const [offline, setOffline] = useState(false); + + useEffect(() => { + if (typeof navigator === "undefined") return; + setOffline(!navigator.onLine); + + const onOffline = () => setOffline(true); + const onOnline = () => setOffline(false); + window.addEventListener("offline", onOffline); + window.addEventListener("online", onOnline); + return () => { + window.removeEventListener("offline", onOffline); + window.removeEventListener("online", onOnline); + }; + }, []); + + if (!offline) return null; + + return ( +
+ + 离线模式(显示缓存数据) + 离线 +
+ ); +} diff --git a/医科高校智能学习中心-汇报.pptx b/医科高校智能学习中心-汇报.pptx new file mode 100644 index 0000000..716aa85 Binary files /dev/null and b/医科高校智能学习中心-汇报.pptx differ