feat(admin): Add user management and upgrade to module permission system

Features - User Management (Phase 4.1):
- Database: Add user_modules table for fine-grained module permissions
- Database: Add 4 user permissions (view/create/edit/delete) to role_permissions
- Backend: UserService (780 lines) - CRUD with tenant isolation
- Backend: UserController + UserRoutes (648 lines) - 13 API endpoints
- Backend: Batch import users from Excel
- Frontend: UserListPage (412 lines) - list/filter/search/pagination
- Frontend: UserFormPage (341 lines) - create/edit with module config
- Frontend: UserDetailPage (393 lines) - details/tenant/module management
- Frontend: 3 modal components (592 lines) - import/assign/configure
- API: GET/POST/PUT/DELETE /api/admin/users/* endpoints

Architecture Upgrade - Module Permission System:
- Backend: Add getUserModules() method in auth.service
- Backend: Login API returns modules array in user object
- Frontend: AuthContext adds hasModule() method
- Frontend: Navigation filters modules based on user.modules
- Frontend: RouteGuard checks requiredModule instead of requiredVersion
- Frontend: Remove deprecated version-based permission system
- UX: Only show accessible modules in navigation (clean UI)
- UX: Smart redirect after login (avoid 403 for regular users)

Fixes:
- Fix UTF-8 encoding corruption in ~100 docs files
- Fix pageSize type conversion in userService (String to Number)
- Fix authUser undefined error in TopNavigation
- Fix login redirect logic with role-based access check
- Update Git commit guidelines v1.2 with UTF-8 safety rules

Database Changes:
- CREATE TABLE user_modules (user_id, tenant_id, module_code, is_enabled)
- ADD UNIQUE CONSTRAINT (user_id, tenant_id, module_code)
- INSERT 4 permissions + role assignments
- UPDATE PUBLIC tenant with 8 module subscriptions

Technical:
- Backend: 5 new files (~2400 lines)
- Frontend: 10 new files (~2500 lines)
- Docs: 1 development record + 2 status updates + 1 guideline update
- Total: ~4900 lines of code

Status: User management 100% complete, module permission system operational
This commit is contained in:
2026-01-16 13:42:10 +08:00
parent 98d862dbd4
commit 66255368b7
560 changed files with 70424 additions and 52353 deletions

View File

@@ -1,16 +1,16 @@
# DC - 数据清洗整理
> **妯″潡浠e彿锛?* DC (Data Cleaning)
> **寮€鍙戠姸鎬侊細** 鈴?瑙勫垝涓?
> **鍟嗕笟浠峰€硷細** 猸愨瓙猸愨瓙猸?鍙<>嫭绔嬪敭鍗?
> **<EFBFBD>珛鎬э細** 猸愨瓙猸愨瓙猸?
> **模块代号:** DC (Data Cleaning)
> **开发状态:** ⏳ 规划中
> **商业价值:** ⭐⭐⭐⭐⭐ 可独立售卖
> **独立性:** ⭐⭐⭐⭐⭐
> **优先级:** P1
---
## 📋 模块概述
鏁版嵁娓呮礂鏁寸悊妯″潡鎻愪緵涓撲笟宸ュ叿锛屽<EFBFBD>鐞嗗尰闄㈠<EFBFBD>鍑虹殑娴烽噺锛堢櫨涓囪<EFBFBD>绾э級銆佸<EFBFBD>琛ㄦ牸鐨凟xcel鏁版嵁銆?
数据清洗整理模块提供专业工具处理医院导出的海量百万行级、多表格的Excel数据。
**核心价值:** 核心差异化功能,解决医学科研痛点
@@ -20,20 +20,20 @@
### 1. 表格ETL重点
- 多张Excel表格导入
- 鎸?鎮€匢D"鍜?鏃堕棿"鑷<>JOIN
- 閲嶇粍涓哄共鍑€鐨勫垎鏋愬<EFBFBD>琛?
- 按"患者ID"和"时间"自动JOIN
- 重组为干净的分析宽表
### 2. 鏂囨湰鎻愬彇锛圢ER锛夛紙閲嶇偣锛?
### 2. 文本提取NER重点
- 从病理报告提取结构化字段
- 浠庝綇闄㈠皬缁撴彁鍙栧叧閿<EFBFBD>俊鎭?
- 从住院小结提取关键信息
- TNM分期自动识别
### 3. 数据质量报告
- 缂哄け鍊肩粺璁?
- 寮傚父鍊兼<EFBFBD>娴?
- 缺失值统计
- 异常值检测
- 数据质量评分
### 4. 瀵煎嚭鏍囧噯鍖栨暟鎹?
### 4. 导出标准化数据
- Excel导出
- SPSS格式
- R语言格式
@@ -44,39 +44,39 @@
```
DC-数据清洗整理/
鈹溾攢鈹€ [AI瀵规帴] DC<EFBFBD>€熶笂涓嬫枃.md # 鈴?寰呭垱寤?
├── [AI对接] DC快速上下文.md # ⏳ 待创建
├── 00-项目概述/
鈹? 鈹斺攢鈹€ 01-浜у搧闇€姹傛枃妗?PRD).md # 鈴?寰呭垱寤?
│ └── 01-产品需求文档(PRD).md # ⏳ 待创建
├── 01-设计文档/
鈹? 鈹溾攢鈹€ 01-ETL寮曟搸璁捐<EFBFBD>.md # 鈴?寰呭垱寤?
鈹? 鈹斺攢鈹€ 02-鍖诲<E98D96>NLP璁捐<E79281>.md # 鈴?寰呭垱寤?
鈹斺攢鈹€ README.md # 鉁?褰撳墠鏂囨。
│ ├── 01-ETL引擎设计.md # ⏳ 待创建
│ └── 02-医学NLP设计.md # ⏳ 待创建
└── README.md # ✅ 当前文档
```
---
## 🔗 依赖的通用能力
- **LLM缃戝叧** - 鍖诲<EFBFBD>NER鎻愬彇锛堜簯绔<EFBFBD>増锛?
- **LLM网关** - 医学NER提取云端版
- **文档处理引擎** - Excel/Docx读取
- **ETL寮曟搸** - 鏁版嵁娓呮礂鍜岃浆鎹?
- **鍖诲<EFBFBD>NLP寮曟搸** - 瀹炰綋璇嗗埆锛堝崟鏈虹増锛?
- **ETL引擎** - 数据清洗和转换
- **医学NLP引擎** - 实体识别(单机版)
---
## 🎯 商业模式
**<EFBFBD>爣瀹㈡埛锛?* 涓村簥绉戝<E7BB89>銆佹暟鎹<E69A9F><E98EB9>鐞嗗憳
**<EFBFBD>崠鏂瑰紡锛?* 鐙<>珛浜у
**瀹氫环绛栫暐锛?* 鎸夐」鐩<E3808D>暟鎴栦竴娆℃€<E28483>icense
**目标客户:** 临床科室、数据管理员
**售卖方式:** 独立产品
**定价策略:** 按项目数或一次性License
---
## 鈿狅笍 鎶€鏈<E282AC>毦鐐?
## ⚠️ 技术难点
1. **澶ф暟鎹<EFBFBD><EFBFBD>鐞?* - 鐧句竾琛屾暟鎹<E69A9F>殑鍐呭瓨绠
2. **闅愮<EFBFBD>淇濇姢** - 鍗曟満鐗堝繀椤?00%鏈<>湴鍖?
3. **NER鍑嗙‘鐜?* - 鍖诲<E98D96><EFBFBD><E98F88>澶嶆潅
1. **大数据处理** - 百万行数据的内存管理
2. **隐私保护** - 单机版必须100%本地化
3. **NER准确率** - 医学术语复杂
---