diff --git a/.husky/pre-commit b/.husky/pre-commit
index 2d88ca55..59525d49 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -1,9 +1,51 @@
#!/usr/bin/env sh
-# 前端构建检查
-cd openhis-ui-vue3
-# 检查是否安装了lint-staged或eslint
-if npm list --depth=0 | grep -q "eslint"; then
- npm run lint -- --max-warnings 0
+# ============================================================
+# Husky Pre-commit Hook - HIS项目
+# 配置: 关羽 | 日期: 2026-04-24
+# 功能: 提交前自动检查前端构建
+# ============================================================
+
+echo "========================================"
+echo "🔍 [Pre-commit] HIS项目提交检查"
+echo "========================================"
+
+# 检查前端目录是否存在
+if [ ! -d "openhis-ui-vue3" ]; then
+ echo "⚠️ [Pre-commit] 未找到openhis-ui-vue3目录,跳过前端检查"
+ exit 0
fi
-# 执行生产构建检查
-npm run build:prod -- --mode development 2>/dev/null || exit 1
+
+cd openhis-ui-vue3
+
+# 检查node_modules是否存在
+if [ ! -d "node_modules" ]; then
+ echo "⚠️ [Pre-commit] node_modules未安装,请先执行 npm install"
+ echo " 提示: 首次使用或依赖变更后需要安装依赖"
+ exit 1
+fi
+
+# 执行lint检查(ESLint配置由赵云下周完善后启用)
+if grep -q '"lint"' package.json 2>/dev/null; then
+ echo "📋 [Pre-commit] 执行Lint检查..."
+ if npm run lint -- --max-warnings 0 2>&1; then
+ echo "✅ [Pre-commit] Lint检查通过"
+ else
+ echo "❌ [Pre-commit] Lint检查失败!请修复代码规范问题"
+ exit 1
+ fi
+else
+ echo "⏭️ [Pre-commit] 未配置lint脚本(待赵云配置ESLint后启用)"
+fi
+
+# 执行快速构建检查(development模式,仅检查语法和类型)
+echo "🔨 [Pre-commit] 执行构建检查 (build:dev)..."
+if timeout 120 npm run build:dev 2>&1; then
+ echo "✅ [Pre-commit] 构建检查通过"
+else
+ echo "❌ [Pre-commit] 构建检查失败!请修复编译错误后重新提交"
+ exit 1
+fi
+
+echo "========================================"
+echo "✅ [Pre-commit] 所有检查通过,允许提交"
+echo "========================================"
diff --git a/docs/specs/cicd-gatekeeper.md b/docs/specs/cicd-gatekeeper.md
index 8bdee6ab..f540b635 100644
--- a/docs/specs/cicd-gatekeeper.md
+++ b/docs/specs/cicd-gatekeeper.md
@@ -32,7 +32,7 @@
**触发时机**:代码推送到远程仓库后
**验证内容**:
- 完整的测试套件(单元+集成+端到端)
-- 代码覆盖率检查(≥80%)
+- 代码覆盖率检查(分阶段目标:Q1≥30%,Q2≥50%,Q3≥80%)
- 安全扫描(SAST)
- 构建产物验证
- 部署到测试环境
@@ -52,7 +52,33 @@
## ⚙️ 具体配置要求
### ESLint 配置
-```javascript
+```
+
+
+### Java 后端配置
+```xml
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ com.github.spotbugs
+ spotbugs-maven-plugin
+ 4.2.0
+
+```
+
+### 数据库迁移配置
+```yaml
+# application.yml Flyway配置
+flyway:
+ enabled: true
+ locations: classpath:db/migration
+ baseline-on-migrate: true
+```
+javascript
// .eslintrc.js 关键配置
module.exports = {
plugins: ['import'],
diff --git a/docs/specs/commit-template.md b/docs/specs/commit-template.md
index c06d1c26..42544dba 100644
--- a/docs/specs/commit-template.md
+++ b/docs/specs/commit-template.md
@@ -25,6 +25,12 @@ refactor(nurse): 重构护士站护理记录组件
- **技术方案**:采用的技术方案和设计思路
- **兼容性**:是否涉及API或数据结构变更
+
+## 🗄️ 数据库变更
+- **表结构变更**:列出新增/修改的表和字段
+- **数据迁移**:是否需要数据迁移脚本
+- **回滚方案**:数据库变更的回滚策略
+
## ✅ 验证情况
- **测试覆盖**:单元测试、集成测试覆盖情况
- **手动验证**:手动测试的场景和结果
diff --git a/docs/specs/frontend-checklist.md b/docs/specs/frontend-checklist.md
index 3709eb11..a659448a 100644
--- a/docs/specs/frontend-checklist.md
+++ b/docs/specs/frontend-checklist.md
@@ -66,6 +66,26 @@
- [ ] 数据兼容性已确认
- [ ] 紧急联系人已明确
+
+## 🔧 后端检查项
+
+### 编译验证
+- [ ] Maven编译成功(`mvn clean compile`)
+- [ ] 无编译错误,仅有可接受的警告
+- [ ] 依赖版本兼容性确认
+
+### 数据库脚本
+- [ ] DDL/DML脚本语法正确
+- [ ] 回滚脚本已准备
+- [ ] 数据迁移脚本已测试
+
+## 🔄 前后端协同
+
+### 接口兼容性
+- [ ] API接口契约变更已双方确认
+- [ ] 前端调用后端接口正常
+- [ ] 错误码处理逻辑一致
+
## ✅ 最终确认
### 发布前最后检查
diff --git a/openhis-ui-vue3/package.json b/openhis-ui-vue3/package.json
index 46fbc042..1a48378c 100644
--- a/openhis-ui-vue3/package.json
+++ b/openhis-ui-vue3/package.json
@@ -16,7 +16,8 @@
"test": "vitest",
"test:run": "vitest run",
"test:coverage": "vitest run --coverage",
- "test:ui": "vitest --ui"
+ "test:ui": "vitest --ui",
+ "prepare": "cd .. && husky openhis-ui-vue3/.husky"
},
"repository": {
"type": "git",
@@ -80,5 +81,14 @@
"vite-plugin-vue-mcp": "^0.3.2",
"vitest": "^4.0.18",
"vue-tsc": "^3.1.8"
+ },
+ "lint-staged": {
+ "openhis-ui-vue3/**/*.{js,vue,ts}": [
+ "cd openhis-ui-vue3 && npm run lint -- --fix",
+ "cd openhis-ui-vue3 && npm run build:dev"
+ ],
+ "**/*.{js,vue,ts}": [
+ "echo \"文件变更已记录,构建检查将在pre-commit中执行\""
+ ]
}
-}
+}
\ No newline at end of file