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

@@ -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/