feat(rvw): Complete Phase 4-5 - Bug fixes and Word export

Summary:
- Fix methodology score display issue in task list (show score instead of 'warn')
- Add methodology_score field to database schema
- Fix report display when only methodology agent is selected
- Implement Word document export using docx library
- Update documentation to v3.0/v3.1

Backend changes:
- Add methodologyScore to Prisma schema and TaskSummary type
- Update reviewWorker to save methodologyScore
- Update getTaskList to return methodologyScore

Frontend changes:
- Install docx and file-saver libraries
- Implement handleExportReport with Word generation
- Fix activeTab auto-selection based on available data
- Add proper imports for docx components

Documentation:
- Update RVW module status to 90% (Phase 1-5 complete)
- Update system status document to v3.0

Tested: All review workflows verified, Word export functional
This commit is contained in:
2026-01-10 22:52:15 +08:00
parent 179afa2c6b
commit 440f75255e
237 changed files with 3942 additions and 657 deletions

View File

@@ -1,10 +1,10 @@
# AIclinicalresearch 系统当前状态与开发指南
> **文档版本:** v2.9
> **文档版本:** v3.0
> **创建日期:** 2025-11-28
> **维护者:** 开发团队
> **最后更新:** 2026-01-07
> **重大进展:** 🎉 **RVW稿件审查模块开发完成85%** - 后端迁移+数据库扩展+前端重构全部完成
> **最后更新:** 2026-01-10
> **重大进展:** 🎉 **RVW稿件审查模块开发完成90%** - 后端迁移+数据库扩展+前端重构+Word导出全部完成
> **部署状态:** ✅ 生产环境运行中 | 公网地址http://8.140.53.236/
> **文档目的:** 快速了解系统当前状态为新AI助手提供上下文
@@ -45,7 +45,7 @@
| **IIT** | IIT Manager Agent | AI驱动IIT研究助手 - 智能质控+REDCap集成 | ⭐⭐⭐⭐⭐ | 🎉 **Phase 1.5完成60%- AI对话+REDCap数据集成** | **P0** |
| **SSA** | 智能统计分析 | 队列/预测模型/RCT分析 | ⭐⭐⭐⭐⭐ | 📋 规划中 | P2 |
| **ST** | 统计分析工具 | 100+轻量化统计工具 | ⭐⭐⭐⭐ | 📋 规划中 | P2 |
| **RVW** | 稿件审查系统 | 方法学评估、审稿流程 | ⭐⭐⭐⭐ | ✅ **开发完成(85%** | P3 |
| **RVW** | 稿件审查系统 | 方法学评估、审稿流程、Word导出 | ⭐⭐⭐⭐ | ✅ **开发完成(90%** | P3 |
---
@@ -815,7 +815,7 @@ npm run dev # http://localhost:3000
- **总计**:约 85,000 行
### 模块完成度
-**已完成**AIA100%、平台基础层100%、RVW85%Phase 1-3完成)
-**已完成**AIA100%、平台基础层100%、RVW90%Phase 1-5完成支持Word导出
- 🚧 **开发中**PKB90%核心功能完成、ASL80%、DCTool C 98%Tool B后端100%Tool B前端0%、IIT60%Phase 1.5完成)
- 📋 **未开始**SSA、ST
@@ -953,8 +953,8 @@ if (items.length >= 50) {
---
**文档版本**v2.9
**最后更新**2026-01-07
**文档版本**v3.0
**最后更新**2026-01-10
**下次更新**RVW生产环境部署 或 ASL智能文献筛选模块启动
---
@@ -1020,7 +1020,7 @@ if (items.length >= 50) {
---
**RVW稿件审查模块开发完成2026-01-07**
**RVW稿件审查模块开发完成2026-01-07 ~ 2026-01-10**
### Phase 1后端模块迁移与扩展
- ✅ 创建 `backend/src/modules/rvw/` 模块结构
@@ -1029,24 +1029,36 @@ if (items.length >= 50) {
- ✅ 实现批量运行APIbatchRunReviewTasks
- ✅ 替换 console.log 为 logger 服务
- ✅ 注册 v2 API路由/api/v2/rvw
- ✅ 实现 pg-boss 异步任务处理reviewWorker
### Phase 2数据库字段扩展
- ✅ 添加 selectedAgents、editorialScore、methodologyStatus 字段
- ✅ 添加 selectedAgents、editorialScore、methodologyScore、methodologyStatus 字段
- ✅ 添加 picoExtract、isArchived、archivedAt 字段
- ✅ 使用 prisma db push 同步到数据库
### Phase 3前端重构frontend-v2
- ✅ 创建 `frontend-v2/src/modules/rvw/index.tsx`~503行
- ✅ 实现 Dashboard 组件(任务列表、筛选、批量操作)
- ✅ 实现 ReportDetail 组件(双标签页切换
- ✅ 创建 `frontend-v2/src/modules/rvw/` 完整模块目录结构
- ✅ 实现 Dashboard 页面(任务列表、筛选、批量操作)
- ✅ 实现 TaskDetail 组件(审稿进度条、实时状态轮询
- ✅ 实现 EditorialReport/MethodologyReport 组件
- ✅ 实现 AgentModal 组件(智能体选择弹窗)
- ✅ 注册到 moduleRegistry.ts
- ✅ 添加顶部导航"预审稿"入口
### Phase 4集成测试与Bug修复2026-01-10
- ✅ 修复方法学分数不显示问题
- ✅ 修复只选方法学时详情页不显示报告问题
- ✅ 完整测试单智能体和双智能体审稿流程
### Phase 5报告导出2026-01-10
- ✅ 安装 docx 和 file-saver 库
- ✅ 实现 Word 文档导出功能
- ✅ 支持结构化报告(标题、基本信息、稿约规范性、方法学评估)
**技术亮点**
- 🔥 **新旧API兼容**v1 + v2 API同时运行
- 🔥 **智能体可选**:用户可选择运行稿约规范性/方法学/两者
- 🔥 **批量操作**:支持多选任务批量运行
- 🔥 **异步任务处理**:使用 pg-boss 队列处理长时间审稿任务
- 🔥 **Word导出**:使用 docx 库生成专业格式的审稿报告
- 🔥 **云原生改造**:使用 logger 服务,遵循开发规范
**模块进度**85%完成Phase 1-3
**模块进度**90%完成Phase 1-5

View File

@@ -606,6 +606,8 @@ async saveProcessedData(recordId, newData) {

View File

@@ -793,6 +793,8 @@ export const AsyncProgressBar: React.FC<AsyncProgressBarProps> = ({

View File

@@ -1286,6 +1286,8 @@ interface FulltextScreeningResult {

View File

@@ -400,6 +400,8 @@ GET /api/v1/asl/fulltext-screening/tasks/:taskId/export

View File

@@ -502,6 +502,8 @@ Failed to open file '\\tmp\\extraction_service\\temp_10000_test.pdf'

View File

@@ -568,6 +568,8 @@ df['creatinine'] = pd.to_numeric(df['creatinine'], errors='coerce')

View File

@@ -983,6 +983,8 @@ export const aiController = new AIController();

View File

@@ -1317,6 +1317,8 @@ npm install react-markdown

View File

@@ -225,6 +225,8 @@ FMA___基线 | FMA___1个月 | FMA___2个月

View File

@@ -383,6 +383,8 @@ formula = "FMA总分0-100 / 100"

View File

@@ -217,6 +217,8 @@ async handleFillnaMice(request, reply) {

View File

@@ -189,6 +189,8 @@ method: 'mean' | 'median' | 'mode' | 'constant' | 'ffill' | 'bfill'

View File

@@ -640,6 +640,8 @@ import { logger } from '../../../../common/logging/index.js';

View File

@@ -443,6 +443,8 @@ import { ChatContainer } from '@/shared/components/Chat';

View File

@@ -353,6 +353,8 @@ const initialMessages = defaultMessages.length > 0 ? defaultMessages : [{

View File

@@ -641,6 +641,8 @@ http://localhost:5173/data-cleaning/tool-c

View File

@@ -429,6 +429,8 @@ Docs: docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建

View File

@@ -302,6 +302,8 @@ ConflictDetectionService // 冲突检测(字段级对比)

View File

@@ -466,6 +466,8 @@ Tool B后端代码**100%复用**了平台通用能力层,无任何重复开发

View File

@@ -243,6 +243,8 @@ $ node scripts/check-dc-tables.mjs

View File

@@ -476,6 +476,8 @@ ${fields.map((f, i) => `${i + 1}. ${f.name}${f.desc}`).join('\n')}

View File

@@ -684,3 +684,5 @@ private async processMessageAsync(xmlData: any) {

View File

@@ -1078,3 +1078,5 @@ async function testIntegration() {

View File

@@ -219,3 +219,5 @@ Content-Type: application/json

View File

@@ -639,3 +639,5 @@ REDCap API: exportRecords success { recordCount: 1 }

View File

@@ -645,3 +645,5 @@ backend/src/modules/iit-manager/

View File

@@ -795,3 +795,5 @@ CREATE TABLE iit_schema.wechat_tokens (

View File

@@ -552,3 +552,5 @@ Day 3 的开发工作虽然遇到了多个技术问题,但最终成功完成

View File

@@ -319,3 +319,5 @@ AI: "出生日期2017-01-04

View File

@@ -263,3 +263,5 @@ Day 4: REDCap EMWebhook推送← 作为增强,而非核心

View File

@@ -677,3 +677,5 @@ const answer = `根据研究方案[1]和CRF表格[2],纳入标准包括:

View File

@@ -357,3 +357,5 @@ const newResults = resultsData.map((docResult: any) => ({
4. 完善错误处理和用户反馈

View File

@@ -1,10 +1,10 @@
# RVW稿件审查模块 - 当前状态与开发指南
> **文档版本:** v3.0
> **文档版本:** v3.1
> **创建日期:** 2026-01-07
> **最后更新:** 2026-01-07
> **最后更新:** 2026-01-10
> **维护者:** 开发团队
> **当前状态:** ✅ **Phase 1-3 完成,前后端功能可用**
> **当前状态:** ✅ **Phase 1-4 完成,前后端功能可用,报告导出完成**
> **文档目的:** 快速了解RVW模块状态为新AI助手提供上下文
---
@@ -20,7 +20,7 @@
| **商业价值** | ⭐⭐⭐⭐⭐ 极高 |
| **独立性** | ⭐⭐⭐⭐⭐ 极高(用户群完全不同) |
| **目标用户** | 期刊初审编辑 |
| **开发状态** | ✅ **核心功能100%完成,已集成到 frontend-v2** |
| **开发状态** | ✅ **核心功能100%完成,支持Word导出已集成到 frontend-v2** |
### 核心目标
@@ -77,15 +77,28 @@ backend/src/modules/rvw/
│ ├── editorialService.ts # 稿约规范性评估
│ ├── methodologyService.ts # 方法学评估
│ └── utils.ts # 工具函数
├── workers/
│ └── reviewWorker.ts # pg-boss异步任务处理
├── types/index.ts # TypeScript类型定义
└── __tests__/ # API测试脚本
前端(✅ 已完成):
frontend-v2/src/modules/rvw/
── index.tsx # 完整模块(~503行
├── Dashboard组件 # 审稿工作台(宽表、筛选、批量操作)
├── ReportDetail组件 # 报告详情(双标签页切换)
└── AgentModal组件 # 智能体选择弹窗
── index.tsx # 模块入口
├── api/index.ts # API接口
├── types/index.ts # 类型定义
├── styles/index.css # 样式文件
├── pages/
│ └── Dashboard.tsx # 审稿工作台(任务列表、筛选)
└── components/
├── Header.tsx # 页头(上传按钮)
├── Sidebar.tsx # 侧边栏导航
├── TaskTable.tsx # 任务列表表格
├── TaskDetail.tsx # 任务详情(进度条+报告+Word导出
├── EditorialReport.tsx # 稿约规范性报告
├── MethodologyReport.tsx # 方法学评估报告
├── AgentModal.tsx # 智能体选择弹窗
└── ScoreRing.tsx # 评分环组件
旧版本(保留兼容):
backend/src/legacy/
@@ -112,11 +125,12 @@ backend/prompts/
| Phase 1 | 后端模块迁移与扩展 | ✅ 已完成 | 2026-01-07 |
| Phase 2 | 数据库字段扩展 | ✅ 已完成 | 2026-01-07 |
| Phase 3 | 前端重构frontend-v2 | ✅ 已完成 | 2026-01-07 |
| Phase 4 | 集成测试 | 🔧 基本通过 | 2026-01-07 |
| Phase 5 | 系统设置与归档 | ⏸️ 暂缓 | - |
| **总计** | - | **85%** | - |
| Phase 4 | 集成测试与Bug修复 | ✅ 已完成 | 2026-01-10 |
| Phase 5 | 报告导出Word | ✅ 已完成 | 2026-01-10 |
| Phase 6 | 系统设置与归档 | ⏸️ 暂缓 | - |
| **总计** | - | **90%** | - |
### Phase 1-3 完成内容
### Phase 1-5 完成内容
**后端Phase 1**
- ✅ 创建 `backend/src/modules/rvw/` 模块结构
@@ -125,22 +139,37 @@ backend/prompts/
- ✅ 实现批量运行APIbatchRunReviewTasks
- ✅ 替换 console.log 为 logger 服务
- ✅ 注册 v2 API路由/api/v2/rvw
- ✅ 实现 pg-boss 异步任务处理reviewWorker
**数据库Phase 2**
- ✅ 添加 selectedAgents 字段String[]
- ✅ 添加 editorialScore 字段Float?
- ✅ 添加 methodologyScore 字段Float?- 2026-01-10新增
- ✅ 添加 methodologyStatus 字段String?
- ✅ 添加 picoExtract 字段Json?
- ✅ 添加 isArchived、archivedAt 字段(归档支持)
- ✅ 使用 prisma db push 同步到数据库
**前端Phase 3**
- ✅ 创建 `frontend-v2/src/modules/rvw/index.tsx`~503行
- ✅ 实现 Dashboard 组件(任务列表、筛选、批量操作)
- ✅ 实现 ReportDetail 组件(双标签页:稿约规范性/方法学
- ✅ 创建 `frontend-v2/src/modules/rvw/` 模块目录结构
- ✅ 实现 Dashboard 页面(任务列表、筛选、批量操作)
- ✅ 实现 TaskDetail 组件(审稿进度条、实时状态轮询
- ✅ 实现 EditorialReport 组件(稿约规范性评估报告)
- ✅ 实现 MethodologyReport 组件(方法学评估报告)
- ✅ 实现 AgentModal 组件(智能体选择弹窗)
- ✅ 注册到 moduleRegistry.ts
- ✅ 添加顶部导航入口
**集成测试与Bug修复Phase 4**
- ✅ 修复方法学分数不显示问题(列表页显示"warn"而不是分数)
- ✅ 修复只选方法学时详情页不显示报告问题
- ✅ 修复 activeTab 默认值导致的显示问题
- ✅ 完整测试单智能体和双智能体审稿流程
**报告导出Phase 5**
- ✅ 安装 docx 和 file-saver 库
- ✅ 实现 Word 文档导出功能
- ✅ 支持结构化报告(标题、基本信息表格、稿约规范性、方法学评估)
- ✅ 问题和建议使用不同颜色标记
详细任务清单见:[RVW模块迁移计划](./04-开发计划/RVW模块迁移计划.md)
@@ -287,8 +316,8 @@ Content-Type: multipart/form-data
| 问题 | 当前 | 目标 | 优先级 |
|------|------|------|--------|
| Schema位置 | public | review_schema | P2 |
| 任务处理 | 直接异步 | jobQueue | P2 |
| 报告导出 | 基础版 | PDF优化 | P3 |
| 任务处理 | ✅ pg-boss | - | ✅ 已完成 |
| 报告导出 | ✅ Word (.docx) | PDF优化 | P3 |
---
@@ -308,7 +337,7 @@ Content-Type: multipart/form-data
## 🚀 未来规划
### ✅ 已完成2026-01-07
### ✅ 已完成2026-01-07 ~ 2026-01-10
- [x] 架构迁移到 modules/rvw后端
- [x] 架构迁移到 modules/rvw前端 frontend-v2
@@ -316,11 +345,14 @@ Content-Type: multipart/form-data
- [x] 云原生改造logger服务
- [x] v2 API 路由注册
- [x] 数据库字段扩展
- [x] pg-boss异步任务处理2026-01-10
- [x] Word报告导出2026-01-10
- [x] 方法学分数显示修复2026-01-10
- [x] 单智能体审稿显示修复2026-01-10
### 后续版本
- [ ] Schema迁移到 review_schema
- [ ] 任务队列改造jobQueue
- [ ] PDF报告导出优化
- [ ] PICO卡片UI实现
- [ ] 历史归档UI实现
@@ -332,7 +364,7 @@ Content-Type: multipart/form-data
---
**文档版本:** v3.0
**最后更新:** 2026-01-07
**当前状态:** ✅ Phase 1-3 完成,模块可用
**文档版本:** v3.1
**最后更新:** 2026-01-10
**当前状态:** ✅ Phase 1-5 完成,模块可用支持Word导出
**下一步:** 生产环境部署测试 或 Schema隔离迁移

View File

@@ -767,3 +767,5 @@ docker exec redcap-apache php /tmp/create-redcap-password.php

View File

@@ -149,3 +149,5 @@ AIclinicalresearch/redcap-docker-dev/

View File

@@ -883,6 +883,8 @@ ACR镜像仓库

View File

@@ -1370,6 +1370,8 @@ SAE应用配置:

View File

@@ -1186,6 +1186,8 @@ docker exec -e PGPASSWORD="密码" ai-clinical-postgres psql -h RDS地址 -U air

View File

@@ -597,6 +597,8 @@ scripts/*.ts

View File

@@ -285,6 +285,8 @@ Node.js后端部署成功后

View File

@@ -508,6 +508,8 @@ Node.js后端 (SAE) ← http://172.17.173.88:3001

View File

@@ -223,6 +223,8 @@ curl http://localhost:3001/health

View File

@@ -261,6 +261,8 @@ npm run dev

View File

@@ -485,6 +485,8 @@ pgm-2zex1m2y3r23hdn5.pg.rds.aliyuncs.com:5432

View File

@@ -1813,6 +1813,8 @@ curl http://8.140.53.236/

View File

@@ -361,6 +361,8 @@ crpi-cd5ij4pjt65mweeo.cn-beijing.personal.cr.aliyuncs.com/ai-clinical/backend-se

View File

@@ -683,6 +683,8 @@ docker login --username=gofeng117@163.com \

View File

@@ -494,6 +494,8 @@ NAT网关成本¥100/月,对初创团队是一笔开销

View File

@@ -399,6 +399,8 @@ curl http://你的SAE地址:3001/health

View File

@@ -731,6 +731,8 @@ const job = await queue.getJob(jobId);

View File

@@ -498,6 +498,8 @@ processLiteraturesInBackground(task.id, projectId, testLiteratures);

View File

@@ -975,6 +975,8 @@ ROI = (¥22,556 - ¥144) / ¥144 × 100% = 15,564%

View File

@@ -1032,6 +1032,8 @@ Redis 实例¥500/月

View File

@@ -490,6 +490,8 @@ import { ChatContainer } from '@/shared/components/Chat';

View File

@@ -411,3 +411,5 @@ frontend-v2/src/modules/pkb/

View File

@@ -273,3 +273,5 @@ npm run dev

View File

@@ -788,3 +788,5 @@ AIA智能问答模块

View File

@@ -933,3 +933,5 @@ CREATE INDEX idx_rvw_tasks_created_at ON rvw_schema.review_tasks(created_at);

View File

@@ -586,3 +586,5 @@ const typography = {

View File

@@ -898,3 +898,5 @@ app.use('/api/v1/knowledge', (req, res) => {

View File

@@ -212,3 +212,5 @@ rm -rf src/modules/pkb

View File

@@ -387,3 +387,5 @@ GET /api/v2/pkb/batch-tasks/batch/templates

View File

@@ -31,3 +31,5 @@ import pkbRoutes from './modules/pkb/routes/index.js';

View File

@@ -300,3 +300,5 @@ backend/

View File

@@ -511,3 +511,5 @@ const response = await fetch('/api/v2/pkb/batch-tasks/batch/execute', {