From e8af9ea40a06e0d761a1203333fe117abe708d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BD=97?= Date: Sat, 6 Jun 2026 09:46:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0AI=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E8=87=AA=E5=8A=A8=E5=8A=A0=E8=BD=BD=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=20=E2=80=94=20=E6=94=AF=E6=8C=81=E6=89=80=E6=9C=89AI?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 单一信源设计: - RULES.md: 项目唯一规范信源(218行,覆盖铁律+后端+前端规范) 多工具适配(7个配置文件): - AGENTS.md: Codex CLI / Claude Code 自动读取 - .cursorrules: Cursor IDE 自动读取 - .github/copilot-instructions.md: GitHub Copilot 自动读取 - .windsurfrules: Windsurf/Codeium 自动读取 - .clinerules: Cline 自动读取 - .aider.conf.yml: Aider 自动读取 - .qwenrules: Qwen Coder/通义灵码 自动读取 子目录 AGENTS.md 同步更新引用 RULES.md --- .aider.conf.yml | 4 + .clinerules | 3 + .cursorrules | 17 +++ .github/copilot-instructions.md | 11 ++ .qwenrules | 9 ++ .windsurfrules | 9 ++ AGENTS.md | 26 ++++ RULES.md | 218 ++++++++++++++++++++++++++++++++ healthlink-his-server/AGENTS.md | 85 +++---------- healthlink-his-ui/AGENTS.md | 37 +++--- 10 files changed, 336 insertions(+), 83 deletions(-) create mode 100644 .aider.conf.yml create mode 100644 .clinerules create mode 100644 .cursorrules create mode 100644 .github/copilot-instructions.md create mode 100644 .qwenrules create mode 100644 .windsurfrules create mode 100644 AGENTS.md create mode 100644 RULES.md diff --git a/.aider.conf.yml b/.aider.conf.yml new file mode 100644 index 000000000..4f09f9997 --- /dev/null +++ b/.aider.conf.yml @@ -0,0 +1,4 @@ +# Aider configuration for HealthLink-HIS +# Aider reads instructions from the files listed below +instruction-files: + - RULES.md diff --git a/.clinerules b/.clinerules new file mode 100644 index 000000000..6b2c0c34a --- /dev/null +++ b/.clinerules @@ -0,0 +1,3 @@ +# HealthLink-HIS Cline Rules + +Read RULES.md in the project root. It contains all iron rules and development standards for this project. diff --git a/.cursorrules b/.cursorrules new file mode 100644 index 000000000..262f59f21 --- /dev/null +++ b/.cursorrules @@ -0,0 +1,17 @@ +# HealthLink-HIS AI Development Rules + +Read and follow RULES.md in the project root. It contains all iron rules and development standards. + +## Key Rules +- All code changes must pass compilation tests before commit +- Database changes must use Flyway migration scripts +- Follow the layered architecture: Controller → AppService → Service → Mapper → Entity +- API prefix: /healthlink-his/api/v1/ +- Package: com.healthlink.his +- Backend: Spring Boot 4.0.6, JDK 25, MyBatis-Plus 3.5.16 +- Frontend: Vue 3, Vite, Element Plus, Pinia + +## File Structure +- Backend: healthlink-his-server/ +- Frontend: healthlink-his-ui/ +- Docs: MD/ (all specs in MD/specs/) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 000000000..70680379f --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,11 @@ +# HealthLink-HIS — GitHub Copilot Instructions + +Read RULES.md in the project root for complete development standards. + +## Quick Reference +- Backend: healthlink-his-server/ (Spring Boot 4.0.6, JDK 25, MyBatis-Plus 3.5.16) +- Frontend: healthlink-his-ui/ (Vue 3, Vite, Element Plus) +- Package: com.healthlink.his +- API prefix: /healthlink-his/api/v1/ +- All DB changes via Flyway: healthlink-his-domain/src/main/resources/db/migration/ +- Test before commit: mvn clean compile -DskipTests && npm run build:dev diff --git a/.qwenrules b/.qwenrules new file mode 100644 index 000000000..3391e851f --- /dev/null +++ b/.qwenrules @@ -0,0 +1,9 @@ +# HealthLink-HIS Development Rules + +Read RULES.md in the project root for all development standards and iron rules. + +This is a hospital information system (HIS) project. +Backend: healthlink-his-server/ (Spring Boot 4.0.6, JDK 25) +Frontend: healthlink-his-ui/ (Vue 3, Vite, Element Plus) +Package: com.healthlink.his +Always follow the iron rules defined in RULES.md. diff --git a/.windsurfrules b/.windsurfrules new file mode 100644 index 000000000..f4ceef5e8 --- /dev/null +++ b/.windsurfrules @@ -0,0 +1,9 @@ +# HealthLink-HIS Development Rules + +Read RULES.md in the project root for all development standards and iron rules. + +Backend: Spring Boot 4.0.6 + JDK 25 + MyBatis-Plus 3.5.16 +Frontend: Vue 3 + Vite + Element Plus + Pinia +Package: com.healthlink.his +API prefix: /healthlink-his/api/v1/ +DB migrations: Flyway scripts in healthlink-his-domain/src/main/resources/db/migration/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..b53c7fd15 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,26 @@ +# HealthLink-HIS — AI 开发规范 + +> 🤖 本文件由 Codex CLI、Claude Code 等工具自动读取。 +> 完整规范请阅读 **[RULES.md](RULES.md)**,必须严格遵守。 + +## 快速铁律 + +1. **修改完必须测试** — `mvn clean compile -DskipTests` + `npm run build:dev` +2. **Flyway 迁移** — 新建表/字段必须走 Flyway 脚本 +3. **测试通过才提交** — 编译+测试全通过才能 commit +4. **API路径对齐** — 后端 `/healthlink-his/api/v1/`,前端同步 +5. **先分解再行动** — 非平凡任务先出计划 +6. **文档在 MD 目录** — 大写下划线命名,含元数据块 + +## 项目结构 + +- 后端: `healthlink-his-server/` (Spring Boot 4.0.6 + JDK 25) +- 前端: `healthlink-his-ui/` (Vue 3 + Vite + Element Plus) +- 文档: `MD/` (30个规范文档) + +## 详细规范 + +→ 完整铁律: `MD/specs/IRON_RULES.md` +→ 后端规范: `MD/specs/BACKEND_DEVELOPMENT_STANDARD.md` +→ 前端规范: `MD/specs/FRONTEND_DEVELOPMENT_STANDARD.md` +→ 本文档完整版: `RULES.md` diff --git a/RULES.md b/RULES.md new file mode 100644 index 000000000..96bcf0135 --- /dev/null +++ b/RULES.md @@ -0,0 +1,218 @@ +# HealthLink-HIS — AI 开发规范(自动加载) + +> 🤖 **本文件供所有 AI 编码工具自动读取**。无论使用 Claude Code、Cursor、Codex CLI、Copilot、Qwen、Cline 还是其他工具,进入本项目后必须遵守以下规范。 + +--- + +## 一、项目概览 + +| 属性 | 值 | +|------|------| +| 项目名 | HealthLink-HIS(医院信息系统) | +| 后端路径 | `healthlink-his-server/` | +| 前端路径 | `healthlink-his-ui/` | +| 文档路径 | `MD/` | +| JDK | 25 (OpenJDK) | +| Spring Boot | 4.0.6 | +| Vue | 3.x + Vite + Element Plus | +| 数据库 | PostgreSQL 15+ | +| 包名 | `com.healthlink.his` | + +--- + +## 二、铁律(必须遵守,违反即失败) + +### 🔴 P0 铁律 — 不可违反 + +**铁律1: 修改完必须测试** +``` +后端: mvn clean compile -DskipTests → mvn install -DskipTests → mvn test +前端: npm run build:dev → npm run lint +``` +- 白盒:编译通过,无 ERROR +- 黑盒:关键接口返回 `{code:200, data:...}` +- 冒烟:应用正常启动,核心流程通畅 + +**铁律2: Flyway 数据库迁移** +- 凡是新建表、新增字段,必须创建 Flyway 迁移脚本 +- 路径:`healthlink-his-domain/src/main/resources/db/migration/` +- 命名:`V{版本号}__{描述}.sql`(双下划线) +- 禁止直接在数据库执行 SQL 不走 Flyway + +**铁律3: 测试通过后才提交** +- 编译 + 测试全部通过后才能 git commit +- 不提交未完成的功能、调试代码、临时文件 + +**铁律4: 前后端API路径对齐** +- 后端前缀:`/healthlink-his/api/v1/` +- 前端 `request.js` 的 baseURL 必须与后端匹配 +- 接口变更必须同步更新前后端代码 + +### 🟡 P1 铁律 — 强烈建议 + +**铁律5: 先分解再行动** +- 修改超过3个文件、涉及多模块、数据库变更,必须先制定计划 + +**铁律6: 验证后信** +- 每次修改后必须验证编译通过,不信记忆 +- 重新编译命令:`mvn clean compile -DskipTests` + +**铁律7: 文档统一管理** +- 所有文档存储在 `MD/` 目录 +- 文件名:大写英文+下划线(如 `BACKEND_CHECKLIST.md`) +- 文档头部必须包含元数据块(文档类型、版本、日期) + +**铁律8: 规范文档在 MD/specs/** +- 完整铁律:`MD/specs/IRON_RULES.md` +- 后端规范:`MD/specs/BACKEND_DEVELOPMENT_STANDARD.md` +- 前端规范:`MD/specs/FRONTEND_DEVELOPMENT_STANDARD.md` + +--- + +## 三、后端开发规范 + +### 分层架构 +``` +Controller → AppService → Service → Mapper → Entity + 接收请求 编排业务 单表CRUD 数据访问 实体定义 +``` + +### 命名规范 +| 类型 | 规则 | 示例 | +|------|------|------| +| Controller | `XxxController` | `RegistrationController` | +| AppService | `IXxxAppService` / `XxxAppServiceImpl` | `IRegistrationAppService` | +| Service | `IXxxService` / `XxxServiceImpl` | `IRegistrationService` | +| Mapper | `XxxMapper` | `RegistrationMapper` | +| Entity | `Xxx` | `Registration` | +| DTO | `XxxDto` / `XxxQueryDto` | `RegistrationDto` | + +### 包结构 +``` +com.healthlink.his.web.{module}.controller +com.healthlink.his.web.{module}.appservice +com.healthlink.his.web.{module}.service +com.healthlink.his.web.{module}.mapper +com.healthlink.his.web.{module}.dto +com.healthlink.his.domain.{module} +com.healthlink.his.common.enums +``` + +### 统一返回格式 +```java +// 成功 +AjaxResult.success(data) +// 失败 +AjaxResult.error("错误信息") +// 列表 +getDataTable(list) +``` + +### 关键约束 +- 所有查询使用 `LambdaQueryWrapper`,禁止字符串拼接 SQL +- `@Transactional(rollbackFor = Exception.class)` 管理事务 +- 所有接口标注 `@PreAuthorize` 权限控制 +- 患者敏感信息(身份证、手机号)在日志中脱敏 +- 扩展功能不要修改原有函数签名,新建 Service/AppService + +--- + +## 四、前端开发规范 + +### 技术栈 +- Vue 3 + Vite + Element Plus + Pinia + Axios +- 基于 RuoYi-Vue3 框架 + +### 目录结构 +``` +src/api/{module}/ # API接口(kebab-case路径) +src/views/{module}/ # 页面组件 +src/store/modules/ # Pinia状态管理 +src/components/ # 公共组件 +``` + +### API 路径规范 +```javascript +// 统一前缀 /healthlink-his/api/v1/ +export function listXxx(query) { + return request({ url: '/healthlink-his/api/v1/xxx/list', method: 'get', params: query }) +} +``` + +### 组件规范 +- 页面组件使用 `