Compare commits
68 Commits
937b4508ae
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
405a9dfb72 | ||
| d1be841688 | |||
|
|
9b8655748e | ||
| 00fd6c8710 | |||
| bbd9d48fa6 | |||
| 8fb1d3e583 | |||
| 34ba7cae6a | |||
| 305ab15436 | |||
| 46a7076460 | |||
| e0e6693897 | |||
|
|
7d1e50d045 | ||
| 25ce12cebf | |||
| 7d55717037 | |||
|
|
290e8f8f15 | ||
| fc84fd61ab | |||
|
|
d79690a371 | ||
| 7bccbc7085 | |||
|
|
059ef483ca | ||
|
|
4beb4c40c5 | ||
| 914f2d8229 | |||
| 2f57b3e7c1 | |||
|
|
39ccd27df8 | ||
| d370b6a888 | |||
| 3c61e39e09 | |||
| f2c71b08bb | |||
| 90cf7f43d7 | |||
| 1f5d392c08 | |||
| d52bbda8c3 | |||
|
|
986510278b | ||
| 758921b633 | |||
| 8e7ebd3461 | |||
| 8c05782549 | |||
| 060d1910dd | |||
| 44ae216612 | |||
| 0076753c19 | |||
|
|
957d426042 | ||
|
|
76094d6eff | ||
| dc43ce335a | |||
| d27b5147ec | |||
| 4fb540cfa5 | |||
| 72e1f927e9 | |||
|
|
e7beb3f5c3 | ||
|
|
dc7e3c1de8 | ||
| 1242d41499 | |||
| 091b6e83b6 | |||
| b53cdfa617 | |||
| fe2a79773f | |||
| 22b47fcc95 | |||
| 328ccbbd99 | |||
| 6b6e56c79b | |||
| 41fe89447f | |||
| 0d11d411ea | |||
|
|
d525a50f52 | ||
|
|
5d97975e7f | ||
|
|
03e89e0577 | ||
| 9c48744cb1 | |||
| 24758414f2 | |||
| 2d55387ba9 | |||
| 1fc2032aa8 | |||
| adc89a5ed2 | |||
| 278676957e | |||
| 988c17cd30 | |||
| 08ee473671 | |||
|
|
6962a8b1c1 | ||
|
|
95e379e5a5 | ||
| 2a8e662b44 | |||
| 0b8a7245f6 | |||
| 17e148ce7a |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -63,3 +63,6 @@ public.sql
|
||||
发版记录/2025-11-12/发版日志.docx
|
||||
.gitignore
|
||||
openhis-server-new/openhis-application/src/main/resources/application-dev.yml
|
||||
.env.test.local
|
||||
playwright-report/
|
||||
test-results/
|
||||
|
||||
51
.husky/pre-commit
Executable file
51
.husky/pre-commit
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env sh
|
||||
# ============================================================
|
||||
# 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
|
||||
|
||||
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 "========================================"
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"tools": {
|
||||
"approvalMode": "yolo"
|
||||
},
|
||||
"$version": 2
|
||||
}
|
||||
162
docs/specs/backend-checklist.md
Normal file
162
docs/specs/backend-checklist.md
Normal file
@@ -0,0 +1,162 @@
|
||||
# 后端发布前检查清单
|
||||
|
||||
## 📋 基础检查项
|
||||
|
||||
### Maven编译验证
|
||||
- [ ] 本地执行 `mvn compile` 编译通过,无ERROR
|
||||
- [ ] 执行 `mvn package -DskipTests` 打包成功
|
||||
- [ ] 依赖版本无冲突(`mvn dependency:tree` 检查)
|
||||
- [ ] 无编译警告(或已有书面说明可忽略)
|
||||
|
||||
### 构建产物验证
|
||||
- [ ] JAR/WAR包生成完整,大小合理
|
||||
- [ ] `application.yml` 等配置文件已打包进产物
|
||||
- [ ] 第三方依赖jar包完整(lib目录无缺失)
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Spring Boot 配置检查
|
||||
|
||||
### 多环境配置
|
||||
- [ ] `application-dev.yml`(开发)配置正确
|
||||
- [ ] `application-test.yml`(测试)配置正确
|
||||
- [ ] `application-prod.yml`(生产)配置正确
|
||||
- [ ] 启动参数 `--spring.profiles.active` 指定正确环境
|
||||
- [ ] 生产环境未启用devtools热部署
|
||||
|
||||
### Actuator安全
|
||||
- [ ] 生产环境 `/actuator` 端点已禁用或限制访问
|
||||
- [ ] `/actuator/env`、`/actuator/heapdump` 等敏感端点已关闭
|
||||
- [ ] 健康检查端点 `/actuator/health` 返回信息已脱敏
|
||||
|
||||
### 启动校验
|
||||
- [ ] 数据库连接池配置合理(HikariCP最大/最小连接数)
|
||||
- [ ] Redis/消息中间件连接配置正确
|
||||
- [ ] 启动日志无ERROR级别异常
|
||||
|
||||
---
|
||||
|
||||
## 🗄️ MyBatis Plus 规范检查
|
||||
|
||||
### 实体-表映射
|
||||
- [ ] 所有实体类标注 `@TableName`,表名与实际一致
|
||||
- [ ] 主键字段标注 `@TableId(type = IdType.AUTO)` 或对应策略
|
||||
- [ ] 非表字段标注 `@TableField(exist = false)`
|
||||
- [ ] 字段命名符合下划线转驼峰规则
|
||||
|
||||
### SQL安全
|
||||
- [ ] 所有查询使用参数化查询(`QueryWrapper` / `LambdaQueryWrapper`)
|
||||
- [ ] 禁止字符串拼接SQL(`"WHERE name = '" + name + "'"`)
|
||||
- [ ] 批量操作使用MyBatis Plus `saveBatch` / `updateBatchById`
|
||||
- [ ] 复杂SQL使用XML映射,避免注解内嵌长SQL
|
||||
|
||||
### 事务管理
|
||||
- [ ] 涉及多表写操作的方法标注 `@Transactional`
|
||||
- [ ] 事务边界合理,不包含外部HTTP调用
|
||||
- [ ] 异常回滚配置正确(`rollbackFor = Exception.class`)
|
||||
- [ ] 事务方法未被同一类内方法直接调用(自调用失效问题)
|
||||
|
||||
### 分页插件
|
||||
- [ ] `PaginationInnerInterceptor` 已正确配置
|
||||
- [ ] 分页查询使用 `Page<T>` 对象,非手动limit/offset
|
||||
|
||||
---
|
||||
|
||||
## 🔌 RESTful API 设计检查
|
||||
|
||||
### 统一返回格式
|
||||
- [ ] 所有接口返回 `{code, msg, data}` 统一结构
|
||||
- [ ] 成功返回 `code=200`,业务错误使用自定义错误码
|
||||
- [ ] 异常通过 `@ControllerAdvice` + `@ExceptionHandler` 统一处理
|
||||
|
||||
### HTTP状态码
|
||||
- [ ] 资源创建返回 `201 Created`
|
||||
- [ ] 资源删除返回 `204 No Content`
|
||||
- [ ] 参数校验失败返回 `400 Bad Request`
|
||||
- [ ] 未认证返回 `401 Unauthorized`
|
||||
- [ ] 无权限返回 `403 Forbidden`
|
||||
- [ ] 资源不存在返回 `404 Not Found`
|
||||
|
||||
### 参数校验
|
||||
- [ ] 请求参数使用 `@Valid` / `@Validated` 注解校验
|
||||
- [ ] 必填字段标注 `@NotBlank` / `@NotNull`
|
||||
- [ ] 数值范围标注 `@Min` / `@Max`
|
||||
- [ ] 格式校验使用 `@Pattern`(如手机号、身份证号)
|
||||
- [ ] 校验失败返回明确错误信息(非500堆栈)
|
||||
|
||||
### API版本管理
|
||||
- [ ] 接口路径包含版本号(`/api/v1/`、`/api/v2/`)
|
||||
- [ ] 废弃接口标注 `@Deprecated`,并在文档中说明
|
||||
- [ ] 不兼容变更必须升级版本号
|
||||
|
||||
---
|
||||
|
||||
## 🔒 安全与合规检查
|
||||
|
||||
### 数据脱敏
|
||||
- [ ] 患者身份证号在日志中脱敏(`***` 掩码)
|
||||
- [ ] 患者手机号在日志中脱敏(前3后4,中间`****`)
|
||||
- [ ] 敏感字段序列化时使用 `@JsonSerialize` 自定义脱敏器
|
||||
- [ ] 接口返回中非必需字段不暴露(如密码、salt)
|
||||
|
||||
### 权限控制
|
||||
- [ ] 所有涉及患者数据的接口标注 `@PreAuthorize`
|
||||
- [ ] 数据级权限校验(医生只能访问本科室患者)
|
||||
- [ ] 越权访问返回 `403`,非 `404` 或 `500`
|
||||
- [ ] 敏感操作(删除、修改诊断)需二次确认或额外权限
|
||||
|
||||
### 审计日志
|
||||
- [ ] 处方修改记录操作人、时间、变更内容
|
||||
- [ ] 病历删除操作记录完整审计链
|
||||
- [ ] 审计日志独立存储,不可被业务用户删除
|
||||
- [ ] 关键业务操作记录IP地址和操作终端
|
||||
|
||||
---
|
||||
|
||||
## ⚡ 性能检查
|
||||
|
||||
### 数据库查询
|
||||
- [ ] 无N+1查询问题(使用 `JOIN` 或批量查询)
|
||||
- [ ] 大表查询必须有分页限制
|
||||
- [ ] 慢查询已优化(执行时间 < 500ms)
|
||||
- [ ] 索引已覆盖高频查询条件
|
||||
|
||||
### 接口性能
|
||||
- [ ] 核心接口响应时间 < 1秒
|
||||
- [ ] 列表接口支持分页,无全量返回
|
||||
- [ ] 大文件下载使用流式传输,非全量加载到内存
|
||||
|
||||
---
|
||||
|
||||
## 📝 文档与发布准备
|
||||
|
||||
### 文档更新
|
||||
- [ ] API接口文档已同步更新(路径、参数、返回值)
|
||||
- [ ] 数据库变更脚本已提供(DDL/DML)
|
||||
- [ ] 配置变更说明已记录(新增/修改的配置项)
|
||||
- [ ] 影响范围说明已明确(哪些模块、哪些接口受影响)
|
||||
|
||||
### 回滚预案
|
||||
- [ ] 数据库变更可回滚(提供反向SQL脚本)
|
||||
- [ ] 配置变更可快速回退
|
||||
- [ ] 紧急回滚流程已明确(谁、怎么做、多长时间)
|
||||
- [ ] 回滚后数据一致性已验证
|
||||
|
||||
---
|
||||
|
||||
## ✅ 最终确认
|
||||
|
||||
### 发布前最后检查
|
||||
- [ ] `mvn compile` 构建成功(附终端截图)
|
||||
- [ ] 关键单元测试通过
|
||||
- [ ] 测试环境部署验证通过
|
||||
- [ ] Code Review 已完成并获得批准
|
||||
- [ ] 相关Bug已关闭或延期说明
|
||||
|
||||
---
|
||||
|
||||
**文档版本**:v1.0
|
||||
**最后更新**:2026年4月24日
|
||||
**负责人**:关羽(后端开发)
|
||||
**适用范围**:HIS 系统所有后端模块(his-server)
|
||||
**补充说明**:本清单与陈琳的《前端发布前检查清单》对称互补,共同构成HIS系统发布前完整质量保障体系
|
||||
217
docs/specs/cicd-gatekeeper.md
Normal file
217
docs/specs/cicd-gatekeeper.md
Normal file
@@ -0,0 +1,217 @@
|
||||
# CI/CD构建门禁规范
|
||||
|
||||
## 🎯 规范目标
|
||||
|
||||
建立自动化质量门禁,确保每次代码提交都经过严格验证,防止低质量代码进入主干分支,提升系统稳定性和开发效率。
|
||||
|
||||
## 🔒 门禁层级
|
||||
|
||||
### 1. 提交前门禁(Pre-commit)
|
||||
**触发时机**:`git commit` 执行前
|
||||
**验证内容**:
|
||||
- ESLint 代码规范检查
|
||||
- Prettier 代码格式化
|
||||
- 简单的单元测试(快速执行)
|
||||
|
||||
**工具配置**:
|
||||
- Husky + lint-staged
|
||||
- 配置文件:`.husky/pre-commit`
|
||||
|
||||
### 2. 推送前门禁(Pre-push)
|
||||
**触发时机**:`git push` 执行前
|
||||
**验证内容**:
|
||||
- 完整的单元测试套件
|
||||
- 构建验证(`npm run build:prod`)
|
||||
- 集成测试(核心流程)
|
||||
|
||||
**工具配置**:
|
||||
- Husky pre-push hook
|
||||
- 配置文件:`.husky/pre-push`
|
||||
|
||||
### 3. CI流水线门禁(CI Pipeline)
|
||||
**触发时机**:代码推送到远程仓库后
|
||||
**验证内容**:
|
||||
- 完整的测试套件(单元+集成+端到端)
|
||||
- 代码覆盖率检查(分阶段目标:Q1≥30%,Q2≥50%,Q3≥80%)
|
||||
- 安全扫描(SAST)
|
||||
- 构建产物验证
|
||||
- 部署到测试环境
|
||||
|
||||
**工具配置**:
|
||||
- Spug CI/CD 流水线
|
||||
- Gitea Webhook 触发
|
||||
|
||||
### 4. 发布前门禁(Release Gate)
|
||||
**触发时机**:准备发布到生产环境前
|
||||
**验证内容**:
|
||||
- 生产环境冒烟测试
|
||||
- 性能基准测试
|
||||
- 安全合规检查
|
||||
- 回滚预案验证
|
||||
|
||||
## ⚙️ 具体配置要求
|
||||
|
||||
### ESLint 配置
|
||||
```javascript
|
||||
// eslint.config.js 关键配置
|
||||
import globals from "globals";
|
||||
import pluginVue from "eslint-plugin-vue";
|
||||
import parserVue from "vue-eslint-parser";
|
||||
import importPlugin from "eslint-plugin-import";
|
||||
|
||||
export default [
|
||||
{
|
||||
name: "app/files-to-lint",
|
||||
files: ["**/*.{js,mjs,jsx,vue}"],
|
||||
},
|
||||
|
||||
{
|
||||
name: "app/files-to-ignore",
|
||||
ignores: ["**/dist/**", "**/node_modules/**", "**/help-center/**"],
|
||||
},
|
||||
|
||||
...pluginVue.configs["flat/recommended"],
|
||||
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
},
|
||||
parser: parserVue,
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
},
|
||||
|
||||
plugins: {
|
||||
import: importPlugin,
|
||||
},
|
||||
|
||||
rules: {
|
||||
// 确保导入的模块实际存在(核心规则,防止构建失败)
|
||||
"import/no-unresolved": "error",
|
||||
// 确保导入的命名导出实际存在
|
||||
"import/named": "error",
|
||||
// 确保默认导出存在
|
||||
"import/default": "error",
|
||||
// 确保命名空间导出存在
|
||||
"import/namespace": "error",
|
||||
},
|
||||
},
|
||||
];
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
### Java 后端配置
|
||||
```xml
|
||||
<!-- pom.xml 关键插件 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-maven-plugin</artifactId>
|
||||
<version>4.2.0</version>
|
||||
</plugin>
|
||||
```
|
||||
|
||||
### 数据库迁移配置
|
||||
```yaml
|
||||
# application.yml Flyway配置
|
||||
flyway:
|
||||
enabled: true
|
||||
locations: classpath:db/migration
|
||||
baseline-on-migrate: true
|
||||
```
|
||||
javascript
|
||||
// .eslintrc.js 关键配置
|
||||
module.exports = {
|
||||
plugins: ['import'],
|
||||
rules: {
|
||||
// 确保导入的模块实际存在
|
||||
'import/no-unresolved': 'error',
|
||||
// 确保导入的成员实际存在
|
||||
'import/named': 'error',
|
||||
// 禁止未使用的导入
|
||||
'import/no-unused-modules': 'warn'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### Husky 配置
|
||||
```bash
|
||||
# .husky/pre-commit
|
||||
#!/bin/sh
|
||||
npm run lint-staged
|
||||
|
||||
# .husky/pre-push
|
||||
#!/bin/sh
|
||||
npm run test:unit && npm run build:prod
|
||||
```
|
||||
|
||||
### lint-staged 配置
|
||||
```json
|
||||
// package.json
|
||||
{
|
||||
"lint-staged": {
|
||||
"*.{js,vue}": ["eslint --fix", "prettier --write"],
|
||||
"*.{css,scss}": ["stylelint --fix", "prettier --write"]
|
||||
}
|
||||
}
|
||||
```
|
||||
```json
|
||||
// package.json
|
||||
{
|
||||
"lint-staged": {
|
||||
"*.{js,vue}": ["eslint --fix", "prettier --write"],
|
||||
"*.{css,scss}": ["stylelint --fix", "prettier --write"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 🚫 失败处理机制
|
||||
|
||||
### 自动处理
|
||||
- **构建失败**:自动阻止 PR 合并
|
||||
- **测试失败**:标记 PR 为失败状态
|
||||
- **安全漏洞**:立即通知安全团队
|
||||
|
||||
### 人工处理
|
||||
- **紧急修复**:可申请临时绕过(需架构师批准)
|
||||
- **误报处理**:提交豁免申请并说明原因
|
||||
- **规则调整**:通过 RFC 流程申请规则变更
|
||||
|
||||
## 📊 监控与度量
|
||||
|
||||
### 关键指标
|
||||
- 门禁通过率 ≥ 95%
|
||||
- 平均修复时间 ≤ 2小时
|
||||
- 误报率 ≤ 5%
|
||||
|
||||
### 报告机制
|
||||
- 每日门禁失败统计
|
||||
- 周度质量趋势报告
|
||||
- 月度规则优化建议
|
||||
|
||||
## 🔄 持续改进
|
||||
|
||||
### 规则演进
|
||||
- 每月评审门禁规则有效性
|
||||
- 根据项目需求调整检查强度
|
||||
- 引入新的质量检查工具
|
||||
|
||||
### 团队培训
|
||||
- 新成员入职培训包含门禁规范
|
||||
- 定期分享最佳实践案例
|
||||
- 建立常见问题解决方案库
|
||||
|
||||
---
|
||||
|
||||
**文档版本**:v1.0
|
||||
**最后更新**:2026年4月24日
|
||||
**负责人**:陈琳(文档专家)
|
||||
**技术方案**:诸葛亮(架构师)
|
||||
**适用范围**:HIS 系统所有项目
|
||||
135
docs/specs/commit-template.md
Normal file
135
docs/specs/commit-template.md
Normal file
@@ -0,0 +1,135 @@
|
||||
# 代码提交变更说明模板
|
||||
|
||||
## 📝 PR/Commit 模板
|
||||
|
||||
### 标题格式
|
||||
```
|
||||
<类型>(<模块>): <简短描述>
|
||||
|
||||
示例:
|
||||
feat(patient): 添加患者基本信息编辑功能
|
||||
fix(doctor): 修复医生排班显示异常问题
|
||||
docs(api): 更新预约挂号接口文档
|
||||
refactor(nurse): 重构护士站护理记录组件
|
||||
```
|
||||
|
||||
### 正文模板
|
||||
```markdown
|
||||
## 🔍 变更背景
|
||||
- **问题描述**:详细说明要解决的问题或实现的需求
|
||||
- **影响范围**:列出受影响的模块、页面、功能
|
||||
- **相关链接**:禅道任务ID、需求文档链接等
|
||||
|
||||
## 🛠️ 变更内容
|
||||
- **主要修改**:核心代码变更点
|
||||
- **技术方案**:采用的技术方案和设计思路
|
||||
- **兼容性**:是否涉及API或数据结构变更
|
||||
|
||||
|
||||
## 🗄️ 数据库变更
|
||||
- **表结构变更**:列出新增/修改的表和字段
|
||||
- **数据迁移**:是否需要数据迁移脚本
|
||||
- **回滚方案**:数据库变更的回滚策略
|
||||
|
||||
## ✅ 验证情况
|
||||
- **测试覆盖**:单元测试、集成测试覆盖情况
|
||||
- **手动验证**:手动测试的场景和结果
|
||||
- **构建验证**:本地构建截图(必填)
|
||||
|
||||
## 📋 检查清单
|
||||
- [ ] 代码已通过 ESLint 检查
|
||||
- [ ] 本地构建成功(附截图)
|
||||
- [ ] 核心功能已测试验证
|
||||
- [ ] 文档已同步更新
|
||||
- [ ] Code Review 已完成
|
||||
|
||||
## 👥 相关人员
|
||||
- **开发者**:@开发者姓名
|
||||
- **测试者**:@测试者姓名
|
||||
- **审核人**:@架构师姓名
|
||||
```
|
||||
|
||||
## 🏷️ 提交类型说明
|
||||
|
||||
| 类型 | 说明 | 示例 |
|
||||
|------|------|------|
|
||||
| feat | 新功能 | `feat: 添加用户登录功能` |
|
||||
| fix | Bug修复 | `fix: 修复表单验证错误` |
|
||||
| docs | 文档更新 | `docs: 更新API文档` |
|
||||
| style | 代码格式调整 | `style: 格式化代码` |
|
||||
| refactor | 代码重构 | `refactor: 重构组件结构` |
|
||||
| test | 测试相关 | `test: 添加单元测试` |
|
||||
| chore | 构建/依赖等 | `chore: 升级依赖版本` |
|
||||
| perf | 性能优化 | `perf: 优化列表加载速度` |
|
||||
|
||||
## 📁 模块命名规范
|
||||
|
||||
| 模块 | 说明 |
|
||||
|------|------|
|
||||
| patient | 患者管理相关 |
|
||||
| doctor | 医生工作站相关 |
|
||||
| nurse | 护士站相关 |
|
||||
| admin | 后台管理相关 |
|
||||
| common | 公共组件/工具 |
|
||||
| api | API接口相关 |
|
||||
| auth | 认证授权相关 |
|
||||
| payment | 支付相关 |
|
||||
|
||||
## 🖼️ 构建验证截图要求
|
||||
|
||||
### 必须包含的信息
|
||||
1. **终端窗口**:显示 `npm run build:prod` 命令执行过程
|
||||
2. **成功标识**:明确显示构建成功的提示信息
|
||||
3. **时间戳**:截图包含当前时间,证明是最新构建
|
||||
4. **分支信息**:显示当前工作分支名称
|
||||
|
||||
### 截图示例
|
||||
```
|
||||
$ git checkout feature/patient-edit
|
||||
$ npm run build:prod
|
||||
|
||||
> his-system@1.0.0 build
|
||||
> vue-cli-service build
|
||||
|
||||
⠇ Building for production...
|
||||
|
||||
DONE Build complete. The dist directory is ready to be deployed.
|
||||
INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
|
||||
|
||||
✨ Done in 45.23s.
|
||||
```
|
||||
|
||||
## ⚠️ 禁止行为
|
||||
|
||||
### 严重违规(直接拒绝合并)
|
||||
- 无构建验证截图
|
||||
- 代码存在 ESLint 错误
|
||||
- 未填写变更说明
|
||||
- 修改无关代码文件
|
||||
|
||||
### 轻微违规(要求修正后重新提交)
|
||||
- 描述过于简单
|
||||
- 测试覆盖不完整
|
||||
- 文档更新滞后
|
||||
- 格式不符合规范
|
||||
|
||||
## 💡 最佳实践
|
||||
|
||||
### 高质量提交特征
|
||||
- **原子性**:每次提交只解决一个问题
|
||||
- **可追溯**:关联具体的需求或Bug ID
|
||||
- **可验证**:提供完整的验证证据
|
||||
- **可理解**:描述清晰,他人能快速理解
|
||||
|
||||
### 团队协作建议
|
||||
- 提交前先在本地完整测试
|
||||
- 复杂变更提前与团队沟通
|
||||
- 及时更新相关文档
|
||||
- 主动帮助新人熟悉规范
|
||||
|
||||
---
|
||||
|
||||
**文档版本**:v1.0
|
||||
**最后更新**:2026年4月24日
|
||||
**负责人**:陈琳(文档专家)
|
||||
**适用范围**:HIS 系统所有开发人员
|
||||
102
docs/specs/frontend-checklist.md
Normal file
102
docs/specs/frontend-checklist.md
Normal file
@@ -0,0 +1,102 @@
|
||||
# 前端发布前检查清单
|
||||
|
||||
## 📋 基础检查项
|
||||
|
||||
### 代码质量
|
||||
- [ ] 代码已通过 ESLint 检查,无警告和错误
|
||||
- [ ] 代码已通过 Prettier 格式化
|
||||
- [ ] 无 console.log() 等调试代码残留
|
||||
- [ ] 变量命名符合规范,语义清晰
|
||||
- [ ] 函数职责单一,复杂度适中
|
||||
|
||||
### 构建验证
|
||||
- [ ] 本地执行 `npm run build:prod` 成功完成
|
||||
- [ ] 构建产物无报错,体积合理
|
||||
- [ ] 静态资源路径正确,无404错误
|
||||
- [ ] 环境变量配置正确(开发/测试/生产)
|
||||
|
||||
### 功能验证
|
||||
- [ ] 核心功能流程完整测试通过
|
||||
- [ ] 边界条件和异常场景已覆盖
|
||||
- [ ] 表单验证逻辑正确
|
||||
- [ ] API 接口调用正常,错误处理完善
|
||||
- [ ] 路由跳转逻辑正确
|
||||
|
||||
## 🔧 技术检查项
|
||||
|
||||
### 模块导入检查
|
||||
- [ ] 所有 import 语句引用的模块实际存在
|
||||
- [ ] 无未使用的 import 导入
|
||||
- [ ] 路径别名(@/)配置正确
|
||||
- [ ] 第三方库版本兼容性确认
|
||||
|
||||
### 性能优化
|
||||
- [ ] 组件按需加载(懒加载)已配置
|
||||
- [ ] 大数据列表已实现虚拟滚动或分页
|
||||
- [ ] 图片资源已压缩,格式合适
|
||||
- [ ] 无内存泄漏风险(事件监听器、定时器等)
|
||||
|
||||
### 安全检查
|
||||
- [ ] 用户输入已做 XSS 防护
|
||||
- [ ] 敏感信息不在前端硬编码
|
||||
- [ ] API 请求已做 CSRF 防护
|
||||
- [ ] 权限控制逻辑正确
|
||||
|
||||
## 🌐 兼容性检查
|
||||
|
||||
### 浏览器兼容
|
||||
- [ ] 主流浏览器(Chrome、Firefox、Safari、Edge)显示正常
|
||||
- [ ] 移动端适配良好(如适用)
|
||||
- [ ] 分辨率适配(1366x768、1920x1080等)
|
||||
|
||||
### 设备兼容
|
||||
- [ ] 触摸设备操作体验良好
|
||||
- [ ] 键盘导航支持完整
|
||||
- [ ] 屏幕阅读器兼容性(无障碍)
|
||||
|
||||
## 📱 发布准备
|
||||
|
||||
### 文档更新
|
||||
- [ ] 相关 API 文档已同步更新
|
||||
- [ ] 用户操作手册已更新(如适用)
|
||||
- [ ] 变更日志已记录
|
||||
|
||||
### 回滚预案
|
||||
- [ ] 回滚方案已准备
|
||||
- [ ] 数据兼容性已确认
|
||||
- [ ] 紧急联系人已明确
|
||||
|
||||
|
||||
## 🔧 后端检查项
|
||||
|
||||
### 编译验证
|
||||
- [ ] Maven编译成功(`mvn clean package -DskipTests`)
|
||||
- [ ] 无编译错误,仅有可接受的警告
|
||||
- [ ] 依赖版本兼容性确认
|
||||
|
||||
### 数据库脚本
|
||||
- [ ] DDL/DML脚本语法正确
|
||||
- [ ] 回滚脚本已准备
|
||||
- [ ] 数据迁移脚本已测试
|
||||
|
||||
## 🔄 前后端协同
|
||||
|
||||
### 接口兼容性
|
||||
- [ ] API接口契约变更已双方确认
|
||||
- [ ] 前端调用后端接口正常
|
||||
- [ ] 错误码处理逻辑一致
|
||||
|
||||
## ✅ 最终确认
|
||||
|
||||
### 发布前最后检查
|
||||
- [ ] 本地构建截图已附在 PR 中
|
||||
- [ ] 测试环境部署验证通过
|
||||
- [ ] Code Review 已完成并获得批准
|
||||
- [ ] 相关 Bug 已关闭或延期说明
|
||||
|
||||
---
|
||||
|
||||
**文档版本**:v1.0
|
||||
**最后更新**:2026年4月24日
|
||||
**负责人**:陈琳(文档专家)
|
||||
**适用范围**:HIS 系统所有前端项目
|
||||
575
docs/specs/his-release-checklist-v1.0.md
Normal file
575
docs/specs/his-release-checklist-v1.0.md
Normal file
@@ -0,0 +1,575 @@
|
||||
# HIS项目发布检查清单 v1.0
|
||||
|
||||
> **文档说明**:本清单整合了提交规范、前端检查、后端检查、CI/CD门禁四个部分,作为HIS项目发布的标准化检查依据。每次发布前必须逐项确认。
|
||||
|
||||
## 目录
|
||||
- [1. 提交规范(commit-template)](#1-提交规范commit-template)
|
||||
- [2. 前端检查(frontend-checklist)](#2-前端检查frontend-checklist)
|
||||
- [3. 后端检查(backend-checklist)](#3-后端检查backend-checklist)
|
||||
- [4. CI/CD门禁(cicd-gatekeeper)](#4-cicd门禁cicd-gatekeeper)
|
||||
- [5. 发布确认与回滚预案](#5-发布确认与回滚预案)
|
||||
|
||||
---
|
||||
|
||||
## 1. 提交规范(commit-template)
|
||||
|
||||
### 📝 PR/Commit 模板
|
||||
|
||||
#### 标题格式
|
||||
```
|
||||
<类型>(<模块>): <简短描述>
|
||||
|
||||
示例:
|
||||
feat(patient): 添加患者基本信息编辑功能
|
||||
fix(doctor): 修复医生排班显示异常问题
|
||||
docs(api): 更新预约挂号接口文档
|
||||
refactor(nurse): 重构护士站护理记录组件
|
||||
```
|
||||
|
||||
#### 正文模板
|
||||
```markdown
|
||||
## 🔍 变更背景
|
||||
- **问题描述**:详细说明要解决的问题或实现的需求
|
||||
- **影响范围**:列出受影响的模块、页面、功能
|
||||
- **相关链接**:禅道任务ID、需求文档链接等
|
||||
|
||||
## 🛠️ 变更内容
|
||||
- **主要修改**:核心代码变更点
|
||||
- **技术方案**:采用的技术方案和设计思路
|
||||
- **兼容性**:是否涉及API或数据结构变更
|
||||
|
||||
## 🗄️ 数据库变更
|
||||
- **表结构变更**:列出新增/修改的表和字段
|
||||
- **数据迁移**:是否需要数据迁移脚本
|
||||
- **回滚方案**:数据库变更的回滚策略
|
||||
|
||||
## ✅ 验证情况
|
||||
- **测试覆盖**:单元测试、集成测试覆盖情况
|
||||
- **手动验证**:手动测试的场景和结果
|
||||
- **构建验证**:本地构建截图(必填)
|
||||
|
||||
## 📋 检查清单
|
||||
- [ ] 代码已通过 ESLint 检查
|
||||
- [ ] 本地构建成功(附截图)
|
||||
- [ ] 核心功能已测试验证
|
||||
- [ ] 文档已同步更新
|
||||
- [ ] Code Review 已完成
|
||||
|
||||
## 👥 相关人员
|
||||
- **开发者**:@开发者姓名
|
||||
- **测试者**:@测试者姓名
|
||||
- **审核人**:@架构师姓名
|
||||
```
|
||||
|
||||
### 🏷️ 提交类型说明
|
||||
|
||||
| 类型 | 说明 | 示例 |
|
||||
|------|------|------|
|
||||
| feat | 新功能 | `feat: 添加用户登录功能` |
|
||||
| fix | Bug修复 | `fix: 修复表单验证错误` |
|
||||
| docs | 文档更新 | `docs: 更新API文档` |
|
||||
| style | 代码格式调整 | `style: 格式化代码` |
|
||||
| refactor | 代码重构 | `refactor: 重构组件结构` |
|
||||
| test | 测试相关 | `test: 添加单元测试` |
|
||||
| chore | 构建/依赖等 | `chore: 升级依赖版本` |
|
||||
| perf | 性能优化 | `perf: 优化列表加载速度` |
|
||||
|
||||
### 📁 模块命名规范
|
||||
|
||||
| 模块 | 说明 |
|
||||
|------|------|
|
||||
| patient | 患者管理相关 |
|
||||
| doctor | 医生工作站相关 |
|
||||
| nurse | 护士站相关 |
|
||||
| admin | 后台管理相关 |
|
||||
| common | 公共组件/工具 |
|
||||
| api | API接口相关 |
|
||||
| auth | 认证授权相关 |
|
||||
| payment | 支付相关 |
|
||||
|
||||
### 🖼️ 构建验证截图要求
|
||||
|
||||
#### 必须包含的信息
|
||||
1. **终端窗口**:显示 `npm run build:prod` 命令执行过程
|
||||
2. **成功标识**:明确显示构建成功的提示信息
|
||||
3. **时间戳**:截图包含当前时间,证明是最新构建
|
||||
4. **分支信息**:显示当前工作分支名称
|
||||
|
||||
### ⚠️ 禁止行为
|
||||
|
||||
#### 严重违规(直接拒绝合并)
|
||||
- 无构建验证截图
|
||||
- 代码存在 ESLint 错误
|
||||
- 未填写变更说明
|
||||
- 修改无关代码文件
|
||||
|
||||
---
|
||||
|
||||
## 2. 前端检查(frontend-checklist)
|
||||
|
||||
### 📋 基础检查项
|
||||
|
||||
#### 代码质量
|
||||
- [ ] 代码已通过 ESLint 检查,无警告和错误
|
||||
- [ ] 代码已通过 Prettier 格式化
|
||||
- [ ] 无 console.log() 等调试代码残留
|
||||
- [ ] 变量命名符合规范,语义清晰
|
||||
- [ ] 函数职责单一,复杂度适中
|
||||
|
||||
#### 构建验证
|
||||
- [ ] 本地执行 `npm run build:prod` 成功完成
|
||||
- [ ] 构建产物无报错,体积合理
|
||||
- [ ] 静态资源路径正确,无404错误
|
||||
- [ ] 环境变量配置正确(开发/测试/生产)
|
||||
|
||||
#### 功能验证
|
||||
- [ ] 核心功能流程完整测试通过
|
||||
- [ ] 边界条件和异常场景已覆盖
|
||||
- [ ] 表单验证逻辑正确
|
||||
- [ ] API 接口调用正常,错误处理完善
|
||||
- [ ] 路由跳转逻辑正确
|
||||
|
||||
### 🔧 技术检查项
|
||||
|
||||
#### 模块导入检查
|
||||
- [ ] 所有 import 语句引用的模块实际存在
|
||||
- [ ] 无未使用的 import 导入
|
||||
- [ ] 路径别名(@/)配置正确
|
||||
- [ ] 第三方库版本兼容性确认
|
||||
|
||||
#### 性能优化
|
||||
- [ ] 组件按需加载(懒加载)已配置
|
||||
- [ ] 大数据列表已实现虚拟滚动或分页
|
||||
- [ ] 图片资源已压缩,格式合适
|
||||
- [ ] 无内存泄漏风险(事件监听器、定时器等)
|
||||
|
||||
#### 安全检查
|
||||
- [ ] 用户输入已做 XSS 防护
|
||||
- [ ] 敏感信息不在前端硬编码
|
||||
- [ ] API 请求已做 CSRF 防护
|
||||
- [ ] 权限控制逻辑正确
|
||||
|
||||
### 🌐 兼容性检查
|
||||
|
||||
#### 浏览器兼容
|
||||
- [ ] 主流浏览器(Chrome、Firefox、Safari、Edge)显示正常
|
||||
- [ ] 移动端适配良好(如适用)
|
||||
- [ ] 分辨率适配(1366x768、1920x1080等)
|
||||
|
||||
#### 设备兼容
|
||||
- [ ] 触摸设备操作体验良好
|
||||
- [ ] 键盘导航支持完整
|
||||
- [ ] 屏幕阅读器兼容性(无障碍)
|
||||
|
||||
### 📱 发布准备
|
||||
|
||||
#### 文档更新
|
||||
- [ ] 相关 API 文档已同步更新
|
||||
- [ ] 用户操作手册已更新(如适用)
|
||||
- [ ] 变更日志已记录
|
||||
|
||||
#### 回滚预案
|
||||
- [ ] 回滚方案已准备
|
||||
- [ ] 数据兼容性已确认
|
||||
- [ ] 紧急联系人已明确
|
||||
|
||||
### ✅ 最终确认
|
||||
|
||||
#### 发布前最后检查
|
||||
- [ ] 本地构建截图已附在 PR 中
|
||||
- [ ] 测试环境部署验证通过
|
||||
- [ ] Code Review 已完成并获得批准
|
||||
- [ ] 相关 Bug 已关闭或延期说明
|
||||
|
||||
---
|
||||
|
||||
## 3. 后端检查(backend-checklist)
|
||||
|
||||
### 📋 基础检查项
|
||||
|
||||
#### Maven编译验证
|
||||
- [ ] 本地执行 `mvn compile` 编译通过,无ERROR
|
||||
- [ ] 执行 `mvn package -DskipTests` 打包成功
|
||||
- [ ] 依赖版本无冲突(`mvn dependency:tree` 检查)
|
||||
- [ ] 无编译警告(或已有书面说明可忽略)
|
||||
|
||||
#### 构建产物验证
|
||||
- [ ] JAR/WAR包生成完整,大小合理
|
||||
- [ ] `application.yml` 等配置文件已打包进产物
|
||||
- [ ] 第三方依赖jar包完整(lib目录无缺失)
|
||||
|
||||
### 🔧 Spring Boot 配置检查
|
||||
|
||||
#### 多环境配置
|
||||
- [ ] `application-dev.yml`(开发)配置正确
|
||||
- [ ] `application-test.yml`(测试)配置正确
|
||||
- [ ] `application-prod.yml`(生产)配置正确
|
||||
- [ ] 启动参数 `--spring.profiles.active` 指定正确环境
|
||||
- [ ] 生产环境未启用devtools热部署
|
||||
|
||||
#### Actuator安全
|
||||
- [ ] 生产环境 `/actuator` 端点已禁用或限制访问
|
||||
- [ ] `/actuator/env`、`/actuator/heapdump` 等敏感端点已关闭
|
||||
- [ ] 健康检查端点 `/actuator/health` 返回信息已脱敏
|
||||
|
||||
#### 启动校验
|
||||
- [ ] 数据库连接池配置合理(HikariCP最大/最小连接数)
|
||||
- [ ] Redis/消息中间件连接配置正确
|
||||
- [ ] 启动日志无ERROR级别异常
|
||||
|
||||
### 🗄️ MyBatis Plus 规范检查
|
||||
|
||||
#### 实体-表映射
|
||||
- [ ] 所有实体类标注 `@TableName`,表名与实际一致
|
||||
- [ ] 主键字段标注 `@TableId(type = IdType.AUTO)` 或对应策略
|
||||
- [ ] 非表字段标注 `@TableField(exist = false)`
|
||||
- [ ] 字段命名符合下划线转驼峰规则
|
||||
|
||||
#### SQL安全
|
||||
- [ ] 所有查询使用参数化查询(`QueryWrapper` / `LambdaQueryWrapper`)
|
||||
- [ ] 禁止字符串拼接SQL(`"WHERE name = '" + name + "'"`)
|
||||
- [ ] 批量操作使用MyBatis Plus `saveBatch` / `updateBatchById`
|
||||
- [ ] 复杂SQL使用XML映射,避免注解内嵌长SQL
|
||||
|
||||
#### 事务管理
|
||||
- [ ] 涉及多表写操作的方法标注 `@Transactional`
|
||||
- [ ] 事务边界合理,不包含外部HTTP调用
|
||||
- [ ] 异常回滚配置正确(`rollbackFor = Exception.class`)
|
||||
- [ ] 事务方法未被同一类内方法直接调用(自调用失效问题)
|
||||
|
||||
#### 分页插件
|
||||
- [ ] `PaginationInnerInterceptor` 已正确配置
|
||||
- [ ] 分页查询使用 `Page<T>` 对象,非手动limit/offset
|
||||
|
||||
### 🔌 RESTful API 设计检查
|
||||
|
||||
#### 统一返回格式
|
||||
- [ ] 所有接口返回 `{code, msg, data}` 统一结构
|
||||
- [ ] 成功返回 `code=200`,业务错误使用自定义错误码
|
||||
- [ ] 异常通过 `@ControllerAdvice` + `@ExceptionHandler` 统一处理
|
||||
|
||||
#### HTTP状态码
|
||||
- [ ] 资源创建返回 `201 Created`
|
||||
- [ ] 资源删除返回 `204 No Content`
|
||||
- [ ] 参数校验失败返回 `400 Bad Request`
|
||||
- [ ] 未认证返回 `401 Unauthorized`
|
||||
- [ ] 无权限返回 `403 Forbidden`
|
||||
- [ ] 资源不存在返回 `404 Not Found`
|
||||
|
||||
#### 参数校验
|
||||
- [ ] 请求参数使用 `@Valid` / `@Validated` 注解校验
|
||||
- [ ] 必填字段标注 `@NotBlank` / `@NotNull`
|
||||
- [ ] 数值范围标注 `@Min` / `@Max`
|
||||
- [ ] 格式校验使用 `@Pattern`(如手机号、身份证号)
|
||||
- [ ] 校验失败返回明确错误信息(非500堆栈)
|
||||
|
||||
#### API版本管理
|
||||
- [ ] 接口路径包含版本号(`/api/v1/`、`/api/v2/`)
|
||||
- [ ] 废弃接口标注 `@Deprecated`,并在文档中说明
|
||||
- [ ] 不兼容变更必须升级版本号
|
||||
|
||||
### 🔒 安全与合规检查
|
||||
|
||||
#### 数据脱敏
|
||||
- [ ] 患者身份证号在日志中脱敏(`***` 掩码)
|
||||
- [ ] 患者手机号在日志中脱敏(前3后4,中间`****`)
|
||||
- [ ] 敏感字段序列化时使用 `@JsonSerialize` 自定义脱敏器
|
||||
- [ ] 接口返回中非必需字段不暴露(如密码、salt)
|
||||
|
||||
#### 权限控制
|
||||
- [ ] 所有涉及患者数据的接口标注 `@PreAuthorize`
|
||||
- [ ] 数据级权限校验(医生只能访问本科室患者)
|
||||
- [ ] 越权访问返回 `403`,非 `404` 或 `500`
|
||||
- [ ] 敏感操作(删除、修改诊断)需二次确认或额外权限
|
||||
|
||||
#### 审计日志
|
||||
- [ ] 处方修改记录操作人、时间、变更内容
|
||||
- [ ] 病历删除操作记录完整审计链
|
||||
- [ ] 审计日志独立存储,不可被业务用户删除
|
||||
- [ ] 关键业务操作记录IP地址和操作终端
|
||||
|
||||
### ⚡ 性能检查
|
||||
|
||||
#### 数据库查询
|
||||
- [ ] 无N+1查询问题(使用 `JOIN` 或批量查询)
|
||||
- [ ] 大表查询必须有分页限制
|
||||
- [ ] 慢查询已优化(执行时间 < 500ms)
|
||||
- [ ] 索引已覆盖高频查询条件
|
||||
|
||||
#### 接口性能
|
||||
- [ ] 核心接口响应时间 < 1秒
|
||||
- [ ] 列表接口支持分页,无全量返回
|
||||
- [ ] 大文件下载使用流式传输,非全量加载到内存
|
||||
|
||||
### 📝 文档与发布准备
|
||||
|
||||
#### 文档更新
|
||||
- [ ] API接口文档已同步更新(路径、参数、返回值)
|
||||
- [ ] 数据库变更脚本已提供(DDL/DML)
|
||||
- [ ] 配置变更说明已记录(新增/修改的配置项)
|
||||
- [ ] 影响范围说明已明确(哪些模块、哪些接口受影响)
|
||||
|
||||
#### 回滚预案
|
||||
- [ ] 数据库变更可回滚(提供反向SQL脚本)
|
||||
- [ ] 配置变更可快速回退
|
||||
- [ ] 紧急回滚流程已明确(谁、怎么做、多长时间)
|
||||
- [ ] 回滚后数据一致性已验证
|
||||
|
||||
### ✅ 最终确认
|
||||
|
||||
#### 发布前最后检查
|
||||
- [ ] `mvn compile` 构建成功(附终端截图)
|
||||
- [ ] 关键单元测试通过
|
||||
- [ ] 测试环境部署验证通过
|
||||
- [ ] Code Review 已完成并获得批准
|
||||
- [ ] 相关Bug已关闭或延期说明
|
||||
|
||||
---
|
||||
|
||||
## 4. CI/CD门禁(cicd-gatekeeper)
|
||||
|
||||
### 🎯 规范目标
|
||||
|
||||
建立自动化质量门禁,确保每次代码提交都经过严格验证,防止低质量代码进入主干分支,提升系统稳定性和开发效率。
|
||||
|
||||
### 🔒 门禁层级
|
||||
|
||||
#### 1. 提交前门禁(Pre-commit)
|
||||
**触发时机**:`git commit` 执行前
|
||||
**验证内容**:
|
||||
- ESLint 代码规范检查
|
||||
- Prettier 代码格式化
|
||||
- 简单的单元测试(快速执行)
|
||||
|
||||
**工具配置**:
|
||||
- Husky + lint-staged
|
||||
- 配置文件:`.husky/pre-commit`
|
||||
|
||||
#### 2. 推送前门禁(Pre-push)
|
||||
**触发时机**:`git push` 执行前
|
||||
**验证内容**:
|
||||
- 完整的单元测试套件
|
||||
- 构建验证(`npm run build:prod`)
|
||||
- 集成测试(核心流程)
|
||||
|
||||
**工具配置**:
|
||||
- Husky pre-push hook
|
||||
- 配置文件:`.husky/pre-push`
|
||||
|
||||
#### 3. CI流水线门禁(CI Pipeline)
|
||||
**触发时机**:代码推送到远程仓库后
|
||||
**验证内容**:
|
||||
- 完整的测试套件(单元+集成+端到端)
|
||||
- 代码覆盖率检查(分阶段目标:Q1≥30%,Q2≥50%,Q3≥80%)
|
||||
- 安全扫描(SAST)
|
||||
- 构建产物验证
|
||||
- 部署到测试环境
|
||||
|
||||
**工具配置**:
|
||||
- Spug CI/CD 流水线
|
||||
- Gitea Webhook 触发
|
||||
|
||||
#### 4. 发布前门禁(Release Gate)
|
||||
**触发时机**:准备发布到生产环境前
|
||||
**验证内容**:
|
||||
- 生产环境冒烟测试
|
||||
- 性能基准测试
|
||||
- 安全合规检查
|
||||
- 回滚预案验证
|
||||
|
||||
### ⚙️ 具体配置要求
|
||||
|
||||
#### ESLint 配置
|
||||
```javascript
|
||||
// eslint.config.js 关键配置
|
||||
import globals from "globals";
|
||||
import pluginVue from "eslint-plugin-vue";
|
||||
import parserVue from "vue-eslint-parser";
|
||||
import importPlugin from "eslint-plugin-import";
|
||||
|
||||
export default [
|
||||
{
|
||||
name: "app/files-to-lint",
|
||||
files: ["**/*.{js,mjs,jsx,vue}"],
|
||||
},
|
||||
|
||||
{
|
||||
name: "app/files-to-ignore",
|
||||
ignores: ["**/dist/**", "**/node_modules/**", "**/help-center/**"],
|
||||
},
|
||||
|
||||
...pluginVue.configs["flat/recommended"],
|
||||
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
},
|
||||
parser: parserVue,
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
},
|
||||
|
||||
plugins: {
|
||||
import: importPlugin,
|
||||
},
|
||||
|
||||
rules: {
|
||||
// 确保导入的模块实际存在(核心规则,防止构建失败)
|
||||
"import/no-unresolved": "error",
|
||||
// 确保导入的命名导出实际存在
|
||||
"import/named": "error",
|
||||
// 确保默认导出存在
|
||||
"import/default": "error",
|
||||
// 确保命名空间导出存在
|
||||
"import/namespace": "error",
|
||||
},
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
#### Java 后端配置
|
||||
```xml
|
||||
<!-- pom.xml 关键插件 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-maven-plugin</artifactId>
|
||||
<version>4.2.0</version>
|
||||
</plugin>
|
||||
```
|
||||
|
||||
#### 数据库迁移配置
|
||||
```yaml
|
||||
# application.yml Flyway配置
|
||||
flyway:
|
||||
enabled: true
|
||||
locations: classpath:db/migration
|
||||
baseline-on-migrate: true
|
||||
```
|
||||
|
||||
#### Husky 配置
|
||||
```bash
|
||||
# .husky/pre-commit
|
||||
#!/bin/sh
|
||||
npm run lint-staged
|
||||
|
||||
# .husky/pre-push
|
||||
#!/bin/sh
|
||||
npm run test:unit && npm run build:prod
|
||||
```
|
||||
|
||||
#### lint-staged 配置
|
||||
```json
|
||||
// package.json
|
||||
{
|
||||
"lint-staged": {
|
||||
"*.{js,vue}": ["eslint --fix", "prettier --write"],
|
||||
"*.{css,scss}": ["stylelint --fix", "prettier --write"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 🚫 失败处理机制
|
||||
|
||||
#### 自动处理
|
||||
- **构建失败**:自动阻止 PR 合并
|
||||
- **测试失败**:标记 PR 为失败状态
|
||||
- **安全漏洞**:立即通知安全团队
|
||||
|
||||
#### 人工处理
|
||||
- **紧急修复**:可申请临时绕过(需架构师批准)
|
||||
- **误报处理**:提交豁免申请并说明原因
|
||||
- **规则调整**:通过 RFC 流程申请规则变更
|
||||
|
||||
### 📊 监控与度量
|
||||
|
||||
#### 关键指标
|
||||
- 门禁通过率 ≥ 95%
|
||||
- 平均修复时间 ≤ 2小时
|
||||
- 误报率 ≤ 5%
|
||||
|
||||
#### 报告机制
|
||||
- 每日门禁失败统计
|
||||
- 周度质量趋势报告
|
||||
- 月度规则优化建议
|
||||
|
||||
### 🔄 持续改进
|
||||
|
||||
#### 规则演进
|
||||
- 每月评审门禁规则有效性
|
||||
- 根据项目需求调整检查强度
|
||||
- 引入新的质量检查工具
|
||||
|
||||
#### 团队培训
|
||||
- 新成员入职培训包含门禁规范
|
||||
- 定期分享最佳实践案例
|
||||
- 建立常见问题解决方案库
|
||||
|
||||
---
|
||||
|
||||
## 5. 发布确认与回滚预案
|
||||
|
||||
### 📋 发布前最终确认清单
|
||||
|
||||
#### 前端确认
|
||||
- [ ] 本地构建成功(`npm run build:prod`)
|
||||
- [ ] 核心功能流程测试通过
|
||||
- [ ] 模块导入检查通过(无import错误)
|
||||
- [ ] 兼容性测试完成
|
||||
|
||||
#### 后端确认
|
||||
- [ ] Maven编译成功(`mvn compile`)
|
||||
- [ ] 单元测试通过
|
||||
- [ ] 数据库脚本验证通过
|
||||
- [ ] API接口测试通过
|
||||
|
||||
#### 协同确认
|
||||
- [ ] 前后端接口契约一致
|
||||
- [ ] 联调测试通过
|
||||
- [ ] Code Review 已完成
|
||||
- [ ] 测试环境部署验证通过
|
||||
|
||||
### 🚨 回滚预案
|
||||
|
||||
#### 触发条件
|
||||
- [ ] 生产环境出现严重Bug
|
||||
- [ ] 性能严重下降
|
||||
- [ ] 数据一致性问题
|
||||
- [ ] 安全漏洞暴露
|
||||
|
||||
#### 回滚步骤
|
||||
1. **立即停止**:暂停新流量进入
|
||||
2. **版本回退**:部署上一个稳定版本
|
||||
3. **数据回滚**:执行数据库回滚脚本(如有)
|
||||
4. **验证恢复**:确认系统功能正常
|
||||
5. **问题分析**:记录根本原因和改进措施
|
||||
|
||||
#### 责任分工
|
||||
- **技术负责人**:执行回滚操作
|
||||
- **测试负责人**:验证回滚后功能
|
||||
- **项目经理**:协调沟通和进度同步
|
||||
- **运维团队**:监控系统状态
|
||||
|
||||
### 📞 紧急联系人
|
||||
|
||||
| 角色 | 姓名 | 联系方式 | 职责 |
|
||||
|------|------|----------|------|
|
||||
| 技术负责人 | 诸葛亮 | @诸葛亮 | 架构决策和技术指导 |
|
||||
| 前端负责人 | 赵云 | @赵云 | 前端问题处理 |
|
||||
| 后端负责人 | 关羽 | @关羽 | 后端问题处理 |
|
||||
| 测试负责人 | 张飞 | @张飞 | 质量验证和问题复现 |
|
||||
| 项目经理 | 刘备 | @刘备 | 项目协调和进度管理 |
|
||||
| 文档负责人 | 陈琳 | @陈琳 | 文档维护和知识沉淀 |
|
||||
|
||||
---
|
||||
|
||||
**文档版本**:v1.0
|
||||
**最后更新**:2026年4月25日
|
||||
**负责人**:陈琳(文档专家)
|
||||
**适用范围**:HIS 系统所有开发人员
|
||||
214
docs/specs/playwright-e2e-testing-plan.md
Normal file
214
docs/specs/playwright-e2e-testing-plan.md
Normal file
@@ -0,0 +1,214 @@
|
||||
# HIS项目 Playwright E2E 自动化测试方案 v1.0
|
||||
|
||||
## 一、方案概述
|
||||
|
||||
### 1.1 选型理由
|
||||
- **Playwright** 是微软开源的端到端测试框架,完美适配 Vue 3 + Vite 技术栈
|
||||
- 自动等待机制适合HIS系统复杂交互场景(异步加载、动态渲染)
|
||||
- 支持多浏览器(Chromium/Firefox/WebKit),CI/CD集成成熟
|
||||
- 已有 `@playwright/test ^1.58.2` 依赖 installed
|
||||
|
||||
### 1.2 目标
|
||||
1. 核心业务流程自动化覆盖率达到 80%+
|
||||
2. 已修复Bug 100% 回归测试覆盖
|
||||
3. 每次代码推送自动触发测试,失败阻断发布
|
||||
|
||||
## 二、项目结构
|
||||
|
||||
```
|
||||
openhis-ui-vue3/
|
||||
├── tests/
|
||||
│ ├── e2e/
|
||||
│ │ ├── fixtures/ # 测试夹具
|
||||
│ │ │ └── auth.ts # 登录认证fixture
|
||||
│ │ ├── pages/ # 页面对象模型(POM)
|
||||
│ │ │ ├── LoginPage.ts
|
||||
│ │ │ ├── DoctorStationPage.ts
|
||||
│ │ │ └── SurgeryBillingPage.ts
|
||||
│ │ ├── specs/ # 测试用例
|
||||
│ │ │ ├── login.spec.ts
|
||||
│ │ │ ├── doctor-station.spec.ts
|
||||
│ │ │ ├── surgery-billing.spec.ts
|
||||
│ │ │ └── bug-regression.spec.ts # Bug回归测试
|
||||
│ │ └── utils/
|
||||
│ │ └── test-data.ts # 测试数据
|
||||
│ └── playwright.config.ts # Playwright配置
|
||||
├── .env.test # 测试环境变量
|
||||
└── package.json # 已有playwright依赖
|
||||
```
|
||||
|
||||
## 三、环境配置
|
||||
|
||||
### 3.1 环境变量(.env.test)
|
||||
```bash
|
||||
# 测试环境配置
|
||||
VITE_APP_BASE_API=http://192.168.110.253:8080
|
||||
TEST_USERNAME=test_admin
|
||||
TEST_PASSWORD=test123456
|
||||
TEST_BASE_URL=http://localhost:80
|
||||
```
|
||||
|
||||
### 3.2 Playwright配置(playwright.config.ts)
|
||||
```typescript
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './tests/e2e/specs',
|
||||
timeout: 60 * 1000,
|
||||
expect: { timeout: 10000 },
|
||||
fullyParallel: false,
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
workers: 1,
|
||||
reporter: [['html', { outputFolder: 'playwright-report' }], ['list']],
|
||||
use: {
|
||||
baseURL: process.env.TEST_BASE_URL || 'http://localhost:80',
|
||||
trace: 'on-first-retry',
|
||||
screenshot: 'only-on-failure',
|
||||
video: 'retain-on-failure',
|
||||
},
|
||||
projects: [
|
||||
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## 四、核心测试用例
|
||||
|
||||
### 4.1 登录测试(login.spec.ts)
|
||||
```typescript
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test('用户登录成功', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await page.fill('input[placeholder="请输入用户名"]', process.env.TEST_USERNAME || 'admin');
|
||||
await page.fill('input[placeholder="请输入密码"]', process.env.TEST_PASSWORD || '123456');
|
||||
await page.click('button:has-text("登录")');
|
||||
await expect(page).toHaveURL(/.*dashboard.*/);
|
||||
await expect(page.locator('.user-avatar')).toBeVisible();
|
||||
});
|
||||
|
||||
test('登录失败-错误密码', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await page.fill('input[placeholder="请输入用户名"]', 'admin');
|
||||
await page.fill('input[placeholder="请输入密码"]', 'wrongpassword');
|
||||
await page.click('button:has-text("登录")');
|
||||
await expect(page.locator('.el-message--error')).toBeVisible();
|
||||
});
|
||||
```
|
||||
|
||||
### 4.2 门诊医生站测试(doctor-station.spec.ts)
|
||||
```typescript
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('门诊医生站', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// 登录
|
||||
await page.goto('/');
|
||||
await page.fill('input[placeholder="请输入用户名"]', process.env.TEST_USERNAME || 'admin');
|
||||
await page.fill('input[placeholder="请输入密码"]', process.env.TEST_PASSWORD || '123456');
|
||||
await page.click('button:has-text("登录")');
|
||||
await page.waitForURL(/.*dashboard.*/);
|
||||
});
|
||||
|
||||
test('#427 检查项目分类手风琴展开', async ({ page }) => {
|
||||
await page.goto('/doctorstation');
|
||||
// 点击第一个分类
|
||||
await page.click('.category-item >> nth=0');
|
||||
await expect(page.locator('.category-content >> nth=0')).toBeVisible();
|
||||
// 点击第二个分类,第一个应收起
|
||||
await page.click('.category-item >> nth=1');
|
||||
await expect(page.locator('.category-content >> nth=0')).not.toBeVisible();
|
||||
await expect(page.locator('.category-content >> nth=1')).toBeVisible();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### 4.3 手术计费回归测试(bug-regression.spec.ts)
|
||||
```typescript
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Bug回归测试', () => {
|
||||
test('#437 手术计费防重复提交', async ({ page }) => {
|
||||
// 登录并导航到手术计费
|
||||
await page.goto('/');
|
||||
await page.fill('input[placeholder="请输入用户名"]', process.env.TEST_USERNAME || 'admin');
|
||||
await page.fill('input[placeholder="请输入密码"]', process.env.TEST_PASSWORD || '123456');
|
||||
await page.click('button:has-text("登录")');
|
||||
await page.waitForURL(/.*dashboard.*/);
|
||||
await page.goto('/surgery-billing');
|
||||
|
||||
// 快速连续点击新增按钮(测试防重复锁)
|
||||
const addBtn = page.locator('button:has-text("新增")');
|
||||
await addBtn.click();
|
||||
await addBtn.click(); // 第二次应被阻止
|
||||
await addBtn.click(); // 第三次应被阻止
|
||||
|
||||
// 验证只弹出一个表单
|
||||
await expect(page.locator('.el-dialog')).toHaveCount(1);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## 五、执行命令
|
||||
|
||||
```bash
|
||||
# 安装浏览器
|
||||
npx playwright install chromium
|
||||
|
||||
# 运行所有测试
|
||||
npm run test:e2e
|
||||
|
||||
# 运行单个测试文件
|
||||
npx playwright test login.spec.ts
|
||||
|
||||
# 生成HTML报告
|
||||
npx playwright show-report
|
||||
|
||||
# UI模式(调试用)
|
||||
npx playwright test --ui
|
||||
```
|
||||
|
||||
## 六、CI/CD集成
|
||||
|
||||
### 6.1 package.json脚本
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"test:e2e": "playwright test",
|
||||
"test:e2e:ui": "playwright test --ui",
|
||||
"test:e2e:report": "playwright show-report"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 6.2 Spug流水线集成
|
||||
```yaml
|
||||
# Spug 构建后阶段添加
|
||||
- name: E2E Testing
|
||||
script: |
|
||||
cd openhis-ui-vue3
|
||||
npx playwright install --with-deps chromium
|
||||
npm run test:e2e -- --reporter=html
|
||||
# 测试失败则阻断发布
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "E2E测试失败,阻断发布!"
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
## 七、实施计划
|
||||
|
||||
| 阶段 | 时间 | 内容 | 负责人 |
|
||||
|------|------|------|--------|
|
||||
| Phase 1 | 第1周 | 登录+核心页面冒烟测试 | 张飞+赵云 |
|
||||
| Phase 2 | 第2-3周 | 门诊医生站+手术计费全流程 | 张飞 |
|
||||
| Phase 3 | 第4周 | Bug回归测试全覆盖 | 张飞 |
|
||||
| Phase 4 | 第5周 | CI/CD流水线集成 | 赵云+运维 |
|
||||
|
||||
## 八、注意事项
|
||||
|
||||
1. **测试数据隔离**:使用独立的测试数据库,不污染生产数据
|
||||
2. **环境变量**:敏感信息通过 `.env.test` 管理,不提交到git
|
||||
3. **截图留痕**:失败时自动截图,便于排查
|
||||
4. **测试优先**:新功能开发时同步编写测试用例
|
||||
@@ -165,4 +165,9 @@ public class CurrentDayEncounterDto {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long poolId;
|
||||
|
||||
/**
|
||||
* 诊室名称(Bug #410:分诊队列需显示诊室而非科室)
|
||||
*/
|
||||
private String clinicRoom;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,9 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.page.TableDataInfo;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.Account;
|
||||
import com.openhis.administration.domain.ChargeItem;
|
||||
import com.openhis.administration.service.IAccountService;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.check.domain.ExamApply;
|
||||
import com.openhis.check.domain.ExamApplyItem;
|
||||
@@ -17,8 +20,10 @@ import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.enums.AssignSeqEnum;
|
||||
import com.openhis.common.enums.ChargeItemStatus;
|
||||
import com.openhis.common.enums.GenerateSource;
|
||||
import com.openhis.common.enums.ItemType;
|
||||
import com.openhis.common.enums.RequestStatus;
|
||||
import com.openhis.common.enums.EncounterClass;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.web.check.dto.ExamApplyDto;
|
||||
import com.openhis.web.check.dto.ExamApplyItemDto;
|
||||
import com.openhis.workflow.domain.ServiceRequest;
|
||||
@@ -58,8 +63,13 @@ public class ExamApplyController extends BaseController {
|
||||
@Autowired
|
||||
private IChargeItemService chargeItemService;
|
||||
|
||||
@Autowired
|
||||
private IAccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Autowired
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
/**
|
||||
* 查询检查申请单列表
|
||||
@@ -213,8 +223,9 @@ public class ExamApplyController extends BaseController {
|
||||
|
||||
// 检查申请不走诊疗定义,设置为0占位(数据库有NOT NULL约束)
|
||||
serviceRequest.setActivityId(0L);
|
||||
// 🔧 Bug #407修复:设置医嘱类型为诊疗(3),避免被错误识别为中成药
|
||||
serviceRequest.setCategoryEnum(3);
|
||||
// 🔧 Bug Fix: 设置医嘱类型为诊疗(3),与检验申请保持一致
|
||||
// categoryEnum=3 → SQL查询返回 adviceType=3(诊疗),避免被错误归类为药品
|
||||
serviceRequest.setCategoryEnum(ItemType.ACTIVITY.getValue());
|
||||
|
||||
// 患者和就诊信息 —— 使用前端传递的数字型ID
|
||||
if (dto.getPatientIdNum() != null) {
|
||||
@@ -225,9 +236,19 @@ public class ExamApplyController extends BaseController {
|
||||
}
|
||||
|
||||
serviceRequest.setRequesterId(currentUserId); // 开单医生
|
||||
serviceRequest.setOrgId(currentOrgId); // 执行科室
|
||||
// 53d15f8079d15ba4Ff1a4f1851484f7f7528524d7aef4f20516576846267884c79d15ba44ee37801Ff0c542652194f7f75285f53524d7528623779d15ba4
|
||||
Long performDeptId = currentOrgId;
|
||||
if (dto.getPerformDeptCode() != null && !dto.getPerformDeptCode().isEmpty()) {
|
||||
Organization performDept = organizationService.getOne(
|
||||
new LambdaQueryWrapper<Organization>().eq(Organization::getBusNo, dto.getPerformDeptCode()).last("limit 1"));
|
||||
if (performDept != null) {
|
||||
performDeptId = performDept.getId();
|
||||
}
|
||||
}
|
||||
serviceRequest.setOrgId(performDeptId); // 6267884c79d15ba4
|
||||
serviceRequest.setAuthoredTime(now); // 签发时间
|
||||
serviceRequest.setCategoryEnum(EncounterClass.AMB.getValue()); // 请求类型:门诊
|
||||
// 🔧 Bug Fix: 不设置门诊类型,保留上面已设置的 categoryEnum=3(诊疗类型)
|
||||
// EncounterClass.AMB.getValue()=2 表示门诊类型,会覆盖诊疗类型导致医嘱被错误归类
|
||||
serviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 来源=医生开立
|
||||
|
||||
// 将项目名称存入 contentJson,使医嘱列表能通过 JSON 字段回显 adviceName
|
||||
@@ -268,10 +289,17 @@ public class ExamApplyController extends BaseController {
|
||||
chargeItem.setRequestingOrgId(currentOrgId); // 开立科室
|
||||
chargeItem.setEnteredDate(now); // 开立时间
|
||||
|
||||
// 以下字段均有 NOT NULL 约束,检查申请不走定价/账户体系,用0占位
|
||||
// 以下字段均有 NOT NULL 约束,检查申请不走定价体系,用0占位
|
||||
chargeItem.setDefinitionId(0L); // 费用定价ID
|
||||
chargeItem.setAccountId(0L); // 关联账户ID
|
||||
chargeItem.setContextEnum(2); // 类型:2=诊疗
|
||||
// 🔧 BugFix#385: 获取患者真实的自费账户,预结算验证要求accountId必须真实存在
|
||||
Account selfAccount = accountService.getSelfAccount(dto.getEncounterId());
|
||||
if (selfAccount == null) {
|
||||
throw new ServiceException("患者自费账户不存在,无法创建检查收费项,encounterId=" + dto.getEncounterId());
|
||||
}
|
||||
chargeItem.setAccountId(selfAccount.getId());
|
||||
// 🔧 BugFix#385: 使用 ItemType.ACTIVITY.getValue()=3 表示诊疗,而不是硬编码的2
|
||||
// ItemType 枚举定义:MEDICINE=1, DEVICE=2(耗材), ACTIVITY=3(诊疗)
|
||||
chargeItem.setContextEnum(ItemType.ACTIVITY.getValue()); // 类型:3=诊疗
|
||||
chargeItem.setProductTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION); // 产品来源表
|
||||
chargeItem.setProductId(0L); // 产品ID
|
||||
|
||||
@@ -393,8 +421,9 @@ public class ExamApplyController extends BaseController {
|
||||
serviceRequest.setBasedOnTable("exam_apply");
|
||||
serviceRequest.setBasedOnId(examApply.getId());
|
||||
serviceRequest.setActivityId(0L);
|
||||
// 🔧 Bug #407修复:设置医嘱类型为诊疗(3),避免被错误识别为中成药
|
||||
serviceRequest.setCategoryEnum(3);
|
||||
// 🔧 Bug Fix: 设置医嘱类型为诊疗(3),与检验申请保持一致
|
||||
// categoryEnum=3 → SQL查询返回 adviceType=3(诊疗),避免被错误归类为药品
|
||||
serviceRequest.setCategoryEnum(ItemType.ACTIVITY.getValue());
|
||||
|
||||
if (dto.getPatientIdNum() != null) {
|
||||
serviceRequest.setPatientId(dto.getPatientIdNum());
|
||||
@@ -403,9 +432,19 @@ public class ExamApplyController extends BaseController {
|
||||
serviceRequest.setEncounterId(dto.getEncounterId());
|
||||
}
|
||||
serviceRequest.setRequesterId(currentUserId);
|
||||
serviceRequest.setOrgId(currentOrgId);
|
||||
// 53d15f8079d15ba4Ff1a4f1851484f7f7528524d7aef4f20516576846267884c79d15ba44ee37801Ff0c542652194f7f75285f53524d7528623779d15ba4
|
||||
Long performDeptId2 = currentOrgId;
|
||||
if (dto.getPerformDeptCode() != null && !dto.getPerformDeptCode().isEmpty()) {
|
||||
Organization performDept2 = organizationService.getOne(
|
||||
new LambdaQueryWrapper<Organization>().eq(Organization::getBusNo, dto.getPerformDeptCode()).last("limit 1"));
|
||||
if (performDept2 != null) {
|
||||
performDeptId2 = performDept2.getId();
|
||||
}
|
||||
}
|
||||
serviceRequest.setOrgId(performDeptId2); // 6267884c79d15ba4
|
||||
serviceRequest.setAuthoredTime(now);
|
||||
serviceRequest.setCategoryEnum(EncounterClass.AMB.getValue()); // 请求类型:门诊
|
||||
// 🔧 Bug Fix: 不设置门诊类型,保留上面已设置的 categoryEnum=3(诊疗类型)
|
||||
// EncounterClass.AMB.getValue()=2 表示门诊类型,会覆盖诊疗类型导致医嘱被错误归类
|
||||
serviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue());
|
||||
|
||||
// 将项目名称存入 contentJson,使医嘱列表能通过 JSON 字段回显 adviceName
|
||||
@@ -440,8 +479,14 @@ public class ExamApplyController extends BaseController {
|
||||
chargeItem.setRequestingOrgId(currentOrgId);
|
||||
chargeItem.setEnteredDate(now);
|
||||
chargeItem.setDefinitionId(0L);
|
||||
chargeItem.setAccountId(0L);
|
||||
chargeItem.setContextEnum(2);
|
||||
// 🔧 BugFix#385: 获取患者真实的自费账户,预结算验证要求accountId必须真实存在
|
||||
Account selfAccount = accountService.getSelfAccount(dto.getEncounterId());
|
||||
if (selfAccount == null) {
|
||||
throw new ServiceException("患者自费账户不存在,无法创建检查收费项,encounterId=" + dto.getEncounterId());
|
||||
}
|
||||
chargeItem.setAccountId(selfAccount.getId());
|
||||
// 🔧 BugFix#385: 使用 ItemType.ACTIVITY.getValue()=3 表示诊疗
|
||||
chargeItem.setContextEnum(ItemType.ACTIVITY.getValue());
|
||||
chargeItem.setProductTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION);
|
||||
chargeItem.setProductId(0L);
|
||||
|
||||
|
||||
@@ -136,9 +136,11 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
|
||||
}
|
||||
}
|
||||
|
||||
LoginUser loginUser = new LoginUser();
|
||||
//获取当前登录用户信息
|
||||
loginUser = SecurityUtils.getLoginUser();
|
||||
// Bug #432 修复:获取当前登录用户信息,增加null校验防止NPE
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser == null) {
|
||||
return R.fail("用户未登录或登录已过期");
|
||||
}
|
||||
// 当前登录用户ID
|
||||
Long userId = loginUser.getUserId();
|
||||
|
||||
|
||||
@@ -1395,9 +1395,17 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
||||
}
|
||||
|
||||
// 4. 更新邀请记录(存储会诊意见)
|
||||
// 直接存储用户输入的原始意见内容,不添加医师姓名前缀
|
||||
invited.setInvitedStatus(ConsultationStatusEnum.CONFIRMED.getCode()); // 已确认
|
||||
invited.setConfirmOpinion(dto.getConsultationOpinion()); // 直接存储原始意见,不添加前缀
|
||||
// Bug #388:格式化存储,确保回显时参加医师和意见完整
|
||||
invited.setInvitedStatus(ConsultationStatusEnum.CONFIRMED.getCode());
|
||||
|
||||
String deptName = StringUtils.hasText(dto.getConfirmingDeptName())
|
||||
? dto.getConfirmingDeptName() : invited.getInvitedDepartmentName();
|
||||
String physician = StringUtils.hasText(dto.getConfirmingPhysician())
|
||||
? dto.getConfirmingPhysician() : currentPhysicianName;
|
||||
|
||||
// 格式:科室-参加医师:意见内容
|
||||
String formattedOpinion = String.format("%s-%s:%s", deptName, physician, dto.getConsultationOpinion());
|
||||
invited.setConfirmOpinion(formattedOpinion);
|
||||
invited.setConfirmTime(new Date());
|
||||
consultationInvitedMapper.updateById(invited);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
* TODO:器材目录
|
||||
*
|
||||
* @author lpt
|
||||
* @date 2025-02-20
|
||||
* @date 2025-02-20。
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/data-dictionary/device")
|
||||
|
||||
@@ -22,6 +22,8 @@ import com.openhis.administration.domain.Encounter;
|
||||
import com.openhis.administration.service.IAccountService;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.administration.service.IEncounterService;
|
||||
import com.openhis.administration.service.IEncounterDiagnosisService;
|
||||
import com.openhis.administration.domain.EncounterDiagnosis;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
@@ -115,6 +117,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
@Resource
|
||||
IEncounterService iEncounterService;
|
||||
|
||||
@Resource
|
||||
IEncounterDiagnosisService iEncounterDiagnosisService;
|
||||
|
||||
@Resource
|
||||
IInventoryItemService inventoryItemService;
|
||||
|
||||
@@ -606,27 +611,24 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
}
|
||||
}
|
||||
|
||||
// 药品(前端adviceType=1=西药, 2=中成药 → 都属于药品后端分类)
|
||||
// 按后端 ItemType 枚举标准分类:
|
||||
// MEDICINE=1(药品)、DEVICE=2(耗材)、ACTIVITY=3(诊疗)、SURGERY=6(手术)
|
||||
|
||||
// 药品分类:adviceType == 1
|
||||
List<AdviceSaveDto> medicineList = adviceSaveList.stream()
|
||||
.filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())
|
||||
|| e.getAdviceType() == 1
|
||||
|| e.getAdviceType() == 2) // 前端中成药类型值为2 → 也属于药品分类
|
||||
.collect(Collectors.toList());
|
||||
// 耗材(前端adviceType=4,后端ItemType.DEVICE=2)
|
||||
List<AdviceSaveDto> deviceList = adviceSaveList.stream()
|
||||
.filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType())
|
||||
|| e.getAdviceType() == 4) // 前端耗材类型值为4
|
||||
.filter(e -> e.getAdviceType() != null && e.getAdviceType() == ItemType.MEDICINE.getValue())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 诊疗活动(前端adviceType=3诊疗、adviceType=5会诊、adviceType=6手术、adviceType=23检查、adviceType=26护理 → 都属于诊疗后端分类)
|
||||
// 耗材分类:adviceType == 2
|
||||
List<AdviceSaveDto> deviceList = adviceSaveList.stream()
|
||||
.filter(e -> e.getAdviceType() != null && e.getAdviceType() == ItemType.DEVICE.getValue())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 诊疗分类:adviceType == 3
|
||||
List<AdviceSaveDto> activityList = adviceSaveList.stream()
|
||||
.filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())
|
||||
|| e.getAdviceType() == 3 // 前端诊疗类型值为3
|
||||
|| e.getAdviceType() == 5 // 前端会诊类型值为5
|
||||
|| e.getAdviceType() == 6 // 前端手术类型值为6
|
||||
|| e.getAdviceType() == 23 // 前端检查类型值为23
|
||||
|| e.getAdviceType() == 26 // 前端护理类型值为26
|
||||
|| ItemType.SURGERY.getValue().equals(e.getAdviceType())) // 后端手术类型值为6
|
||||
.filter(e -> e.getAdviceType() != null
|
||||
&& (e.getAdviceType() == ItemType.ACTIVITY.getValue()
|
||||
|| e.getAdviceType() == ItemType.SURGERY.getValue())) // 手术(6)也走诊疗流程
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 🔍 Debug日志日志: 记录分类结果
|
||||
@@ -803,12 +805,71 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
// 就诊id
|
||||
Long encounterId = adviceSaveList.get(0).getEncounterId();
|
||||
|
||||
// 使用安全的更新方法,避免并发冲突 - 更新费用项状态
|
||||
// 🔧 BugFix#385: 签发时更新诊疗医嘱关联的费用项诊断信息
|
||||
// 检查申请创建的费用项没有诊断关联,需要在签发时补充
|
||||
if (!activityList.isEmpty()) {
|
||||
// 先从就诊中获取主诊断,用于补充没有诊断关联的费用项
|
||||
List<EncounterDiagnosis> encounterDiagList = iEncounterDiagnosisService.getDiagnosisList(encounterId);
|
||||
EncounterDiagnosis mainDiagnosis = iEncounterDiagnosisService.getMainDiagnosis(encounterDiagList);
|
||||
Long mainConditionId = mainDiagnosis != null ? mainDiagnosis.getConditionId() : null;
|
||||
Long mainEncounterDiagId = mainDiagnosis != null ? mainDiagnosis.getId() : null;
|
||||
|
||||
log.info("BugFix#385: 签发时获取就诊主诊断, encounterId={}, mainConditionId={}, mainEncounterDiagId={}",
|
||||
encounterId, mainConditionId, mainEncounterDiagId);
|
||||
|
||||
for (AdviceSaveDto adviceDto : activityList) {
|
||||
if (adviceDto.getRequestId() != null) {
|
||||
// 查询诊疗医嘱关联的费用项
|
||||
List<ChargeItem> chargeItems = iChargeItemService.getChargeItemInfoByReqId(
|
||||
Arrays.asList(adviceDto.getRequestId()));
|
||||
if (chargeItems != null && !chargeItems.isEmpty()) {
|
||||
// 过滤只保留诊疗类型的费用项
|
||||
ChargeItem chargeItem = chargeItems.stream()
|
||||
.filter(ci -> CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(ci.getServiceTable()))
|
||||
.findFirst().orElse(null);
|
||||
if (chargeItem != null) {
|
||||
// 🔧 BugFix#385: 如果费用项没有诊断关联,使用主诊断补充
|
||||
Long conditionId = adviceDto.getConditionId();
|
||||
Long encounterDiagId = adviceDto.getEncounterDiagnosisId();
|
||||
|
||||
// 如果传入的诊断为空,使用主诊断
|
||||
if (conditionId == null) {
|
||||
conditionId = mainConditionId;
|
||||
}
|
||||
if (encounterDiagId == null) {
|
||||
encounterDiagId = mainEncounterDiagId;
|
||||
}
|
||||
|
||||
// 更新诊断关联
|
||||
if (conditionId != null || encounterDiagId != null) {
|
||||
chargeItem.setConditionId(conditionId);
|
||||
chargeItem.setEncounterDiagnosisId(encounterDiagId);
|
||||
iChargeItemService.updateById(chargeItem);
|
||||
log.info("BugFix#385: 签发时更新诊疗费用项诊断关联, chargeItemId={}, conditionId={}, encounterDiagnosisId={}",
|
||||
chargeItem.getId(), conditionId, encounterDiagId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 🔧 BugFix#385: 使用安全的更新方法,避免并发冲突 - 更新费用项状态
|
||||
// 需要处理两种情况:
|
||||
// 1. 从 DRAFT (0) → PLANNED (1):新创建的收费项目
|
||||
// 2. 从 BILLABLE (2) → PLANNED (1):保存时已设为待结算的项目
|
||||
iChargeItemService.updateChargeStatusByConditionSafe(
|
||||
encounterId,
|
||||
ChargeItemStatus.DRAFT.getValue(),
|
||||
ChargeItemStatus.PLANNED.getValue(),
|
||||
requestIds);
|
||||
|
||||
// 🔧 BugFix#385: 同时处理 BILLABLE 状态的收费项目
|
||||
iChargeItemService.updateChargeStatusByConditionSafe(
|
||||
encounterId,
|
||||
ChargeItemStatus.BILLABLE.getValue(),
|
||||
ChargeItemStatus.PLANNED.getValue(),
|
||||
requestIds);
|
||||
}
|
||||
|
||||
// 数据变更后清理相关缓存
|
||||
@@ -942,12 +1003,26 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
insertOrUpdateList = uniqueInsertOrUpdateList;
|
||||
|
||||
for (AdviceSaveDto adviceSaveDto : insertOrUpdateList) {
|
||||
// 🔧 Bug Fix: 确保accountId不为null,与handleBoundDevices保持一致
|
||||
// 🔧 Bug Fix: 确保accountId有效(不为null且账户存在)
|
||||
boolean needNewAccount = false;
|
||||
if (adviceSaveDto.getAccountId() == null) {
|
||||
needNewAccount = true;
|
||||
} else {
|
||||
// 验证账户是否存在且有效(未被删除,租户匹配)
|
||||
Account existingAccount = iAccountService.getById(adviceSaveDto.getAccountId());
|
||||
if (existingAccount == null) {
|
||||
log.warn("handMedication - 前端传入的accountId无效(账户不存在),accountId={},将重新获取或创建账户",
|
||||
adviceSaveDto.getAccountId());
|
||||
needNewAccount = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needNewAccount) {
|
||||
// 尝试从患者就诊中获取默认账户ID(自费账户)
|
||||
Account selfAccount = iAccountService.getSelfAccount(adviceSaveDto.getEncounterId());
|
||||
if (selfAccount != null) {
|
||||
adviceSaveDto.setAccountId(selfAccount.getId());
|
||||
log.info("handMedication - 使用现有自费账户,accountId={}", selfAccount.getId());
|
||||
} else {
|
||||
// 自动创建自费账户
|
||||
Account newAccount = new Account();
|
||||
@@ -961,6 +1036,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
newAccount.setName(AccountType.PERSONAL_CASH_ACCOUNT.getInfo());
|
||||
Long newAccountId = iAccountService.saveAccountByRegister(newAccount);
|
||||
adviceSaveDto.setAccountId(newAccountId);
|
||||
log.info("handMedication - 自动创建自费账户,newAccountId={}", newAccountId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1068,7 +1144,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
|
||||
chargeItem.setQuantityValue(adviceSaveDto.getQuantity()); // 数量
|
||||
chargeItem.setQuantityUnit(adviceSaveDto.getUnitCode()); // 单位
|
||||
chargeItem.setUnitPrice(adviceSaveDto.getUnitPrice()); // 单价
|
||||
// #415 价格非负验证
|
||||
BigDecimal unitPrice = adviceSaveDto.getUnitPrice();
|
||||
if (unitPrice != null && unitPrice.compareTo(BigDecimal.ZERO) < 0) {
|
||||
unitPrice = unitPrice.abs(); // 负数取绝对值
|
||||
}
|
||||
chargeItem.setUnitPrice(unitPrice); // 单价
|
||||
chargeItem.setTotalPrice(adviceSaveDto.getTotalPrice()); // 总价
|
||||
|
||||
// 显式设置tenantId、createBy和createTime字段,防止自动填充机制失效
|
||||
@@ -1351,12 +1432,26 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
log.info("BugFix#219: ========== handDevice END ==========");
|
||||
|
||||
for (AdviceSaveDto adviceSaveDto : insertOrUpdateList) {
|
||||
// 🔧 Bug Fix: 确保accountId不为null
|
||||
// 🔧 Bug Fix: 确保accountId有效(不为null且账户存在)
|
||||
boolean needNewAccount = false;
|
||||
if (adviceSaveDto.getAccountId() == null) {
|
||||
needNewAccount = true;
|
||||
} else {
|
||||
// 验证账户是否存在且有效(未被删除,租户匹配)
|
||||
Account existingAccount = iAccountService.getById(adviceSaveDto.getAccountId());
|
||||
if (existingAccount == null) {
|
||||
log.warn("handDevice - 前端传入的accountId无效(账户不存在),accountId={},将重新获取或创建账户",
|
||||
adviceSaveDto.getAccountId());
|
||||
needNewAccount = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needNewAccount) {
|
||||
// 尝试从患者就诊中获取默认账户ID(自费账户)
|
||||
Account selfAccount = iAccountService.getSelfAccount(adviceSaveDto.getEncounterId());
|
||||
if (selfAccount != null) {
|
||||
adviceSaveDto.setAccountId(selfAccount.getId());
|
||||
log.info("handDevice - 使用现有自费账户,accountId={}", selfAccount.getId());
|
||||
} else {
|
||||
// 自动创建自费账户
|
||||
Account newAccount = new Account();
|
||||
@@ -1370,9 +1465,10 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
newAccount.setName(AccountType.PERSONAL_CASH_ACCOUNT.getInfo());
|
||||
Long newAccountId = iAccountService.saveAccountByRegister(newAccount);
|
||||
adviceSaveDto.setAccountId(newAccountId);
|
||||
log.info("handDevice - 自动创建自费账户,newAccountId={}", newAccountId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 🔧 Bug Fix: 确保practitionerId不为null
|
||||
if (adviceSaveDto.getPractitionerId() == null) {
|
||||
adviceSaveDto.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
@@ -1525,7 +1621,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
|
||||
chargeItem.setQuantityValue(adviceSaveDto.getQuantity()); // 数量
|
||||
chargeItem.setQuantityUnit(adviceSaveDto.getUnitCode()); // 单位
|
||||
chargeItem.setUnitPrice(adviceSaveDto.getUnitPrice()); // 单价
|
||||
// #415 价格非负验证
|
||||
BigDecimal unitPrice = adviceSaveDto.getUnitPrice();
|
||||
if (unitPrice != null && unitPrice.compareTo(BigDecimal.ZERO) < 0) {
|
||||
unitPrice = unitPrice.abs(); // 负数取绝对值
|
||||
}
|
||||
chargeItem.setUnitPrice(unitPrice); // 单价
|
||||
chargeItem.setTotalPrice(adviceSaveDto.getTotalPrice()); // 总价
|
||||
|
||||
// 显式设置审计字段,防止自动填充机制失效
|
||||
@@ -1607,12 +1708,26 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
}
|
||||
|
||||
for (AdviceSaveDto adviceSaveDto : insertOrUpdateList) {
|
||||
// 🔧 Bug Fix: 确保accountId不为null
|
||||
// 🔧 Bug Fix: 确保accountId有效(不为null且账户存在)
|
||||
boolean needNewAccount = false;
|
||||
if (adviceSaveDto.getAccountId() == null) {
|
||||
needNewAccount = true;
|
||||
} else {
|
||||
// 验证账户是否存在且有效(未被删除,租户匹配)
|
||||
Account existingAccount = iAccountService.getById(adviceSaveDto.getAccountId());
|
||||
if (existingAccount == null) {
|
||||
log.warn("handService - 前端传入的accountId无效(账户不存在),accountId={},将重新获取或创建账户",
|
||||
adviceSaveDto.getAccountId());
|
||||
needNewAccount = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needNewAccount) {
|
||||
// 尝试从患者就诊中获取默认账户ID(自费账户)
|
||||
Account selfAccount = iAccountService.getSelfAccount(adviceSaveDto.getEncounterId());
|
||||
if (selfAccount != null) {
|
||||
adviceSaveDto.setAccountId(selfAccount.getId());
|
||||
log.info("handService - 使用现有自费账户,accountId={}", selfAccount.getId());
|
||||
} else {
|
||||
// 自动创建自费账户
|
||||
Account newAccount = new Account();
|
||||
@@ -1626,9 +1741,10 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
newAccount.setName(AccountType.PERSONAL_CASH_ACCOUNT.getInfo());
|
||||
Long newAccountId = iAccountService.saveAccountByRegister(newAccount);
|
||||
adviceSaveDto.setAccountId(newAccountId);
|
||||
log.info("handService - 自动创建自费账户,newAccountId={}", newAccountId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 🔧 Bug Fix: 确保practitionerId不为null
|
||||
if (adviceSaveDto.getPractitionerId() == null) {
|
||||
adviceSaveDto.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
@@ -1677,8 +1793,14 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
// 普通诊疗医嘱
|
||||
serviceRequest.setCategoryEnum(adviceSaveDto.getCategoryEnum());
|
||||
}
|
||||
|
||||
serviceRequest.setActivityId(adviceSaveDto.getAdviceDefinitionId());// 诊疗定义id
|
||||
|
||||
// 🔧 BugFix#385: 检查类型(adviceType=2)不走定价体系,activityId设置为0L占位
|
||||
// 与ExamApplyController保持一致,数据库有NOT NULL约束
|
||||
if (adviceSaveDto.getAdviceType() != null && adviceSaveDto.getAdviceType() == 2) {
|
||||
serviceRequest.setActivityId(0L);
|
||||
} else {
|
||||
serviceRequest.setActivityId(adviceSaveDto.getAdviceDefinitionId());// 诊疗定义id
|
||||
}
|
||||
serviceRequest.setPatientId(adviceSaveDto.getPatientId()); // 患者
|
||||
serviceRequest.setRequesterId(adviceSaveDto.getPractitionerId()); // 开方医生
|
||||
serviceRequest.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id
|
||||
@@ -1730,7 +1852,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
chargeItem.setEncounterDiagnosisId(adviceSaveDto.getEncounterDiagnosisId()); // 就诊诊断id
|
||||
chargeItem.setQuantityValue(adviceSaveDto.getQuantity()); // 数量
|
||||
chargeItem.setQuantityUnit(adviceSaveDto.getUnitCode()); // 单位
|
||||
chargeItem.setUnitPrice(adviceSaveDto.getUnitPrice()); // 单价
|
||||
// #415 价格非负验证
|
||||
BigDecimal unitPrice = adviceSaveDto.getUnitPrice();
|
||||
if (unitPrice != null && unitPrice.compareTo(BigDecimal.ZERO) < 0) {
|
||||
unitPrice = unitPrice.abs(); // 负数取绝对值
|
||||
}
|
||||
chargeItem.setUnitPrice(unitPrice); // 单价
|
||||
chargeItem.setTotalPrice(adviceSaveDto.getTotalPrice()); // 总价
|
||||
|
||||
iChargeItemService.saveOrUpdate(chargeItem);
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationMainAppService;
|
||||
import com.openhis.web.doctorstation.appservice.ITodayOutpatientService;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientPatientDto;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientQueryParam;
|
||||
@@ -32,6 +33,9 @@ public class TodayOutpatientServiceImpl implements ITodayOutpatientService {
|
||||
@Resource
|
||||
private TodayOutpatientMapper todayOutpatientMapper;
|
||||
|
||||
@Resource
|
||||
private IDoctorStationMainAppService doctorStationMainAppService;
|
||||
|
||||
@Override
|
||||
public TodayOutpatientStatsDto getTodayOutpatientStats(HttpServletRequest request) {
|
||||
Long doctorId = SecurityUtils.getLoginUser().getUserId();
|
||||
@@ -259,22 +263,19 @@ public class TodayOutpatientServiceImpl implements ITodayOutpatientService {
|
||||
@Override
|
||||
public R<?> receivePatient(Long encounterId, HttpServletRequest request) {
|
||||
// 调用现有的接诊逻辑
|
||||
// 这里可以复用 DoctorStationMainAppServiceImpl 中的 receiveEncounter 方法
|
||||
// 或者直接调用相应的服务
|
||||
|
||||
return R.ok("接诊成功");
|
||||
return doctorStationMainAppService.receiveEncounter(encounterId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> completeVisit(Long encounterId, HttpServletRequest request) {
|
||||
// 调用现有的完诊逻辑
|
||||
return R.ok("就诊完成");
|
||||
return doctorStationMainAppService.completeEncounter(encounterId, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> cancelVisit(Long encounterId, String reason, HttpServletRequest request) {
|
||||
// 调用现有的取消就诊逻辑
|
||||
return R.ok("就诊取消成功");
|
||||
return doctorStationMainAppService.cancelEncounter(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,4 +303,4 @@ public class TodayOutpatientServiceImpl implements ITodayOutpatientService {
|
||||
|
||||
return orderBy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,11 +350,16 @@ public class NurseBillingAppService implements INurseBillingAppService {
|
||||
// 1. 筛选临时类型耗材:仅处理临时医嘱(TherapyTimeType.TEMPORARY),且请求ID不为空
|
||||
List<AdviceSaveDto> tempDeviceList = deviceAdviceList.stream().collect(Collectors.toList());
|
||||
|
||||
// 2. 校验发放库房:必须指定耗材发放库房(locationId),否则抛出业务异常
|
||||
if (tempDeviceList.stream().anyMatch(t -> t.getLocationId() == null)) {
|
||||
throw new ServiceException("耗材划价失败:发放库房为空,请重新选择");
|
||||
// 2. 颞理发放库房:为locationId为null的项目设置默认值
|
||||
for (AdviceSaveDto advice : tempDeviceList) {
|
||||
if (advice.getLocationId() == null) {
|
||||
// 设置默认位置为用户组织ID作为fallback
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null && loginUser.getOrgId() != null) {
|
||||
advice.setLocationId(loginUser.getOrgId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 循环处理每个临时耗材医嘱(逐条生成关联数据)
|
||||
for (AdviceSaveDto adviceDto : tempDeviceList) {
|
||||
// 3.1 生成耗材请求记录(WOR_DEVICE_REQUEST):状态设为激活,来源标记为护士划价
|
||||
@@ -665,7 +670,7 @@ public class NurseBillingAppService implements INurseBillingAppService {
|
||||
// 1. 校验:待删除项是否已收费,已收费则抛出异常阻止删除
|
||||
checkDeletedDeviceChargeStatus(requestIds);
|
||||
// 软删除执行记录
|
||||
List<Procedure> procedureList = iProcedureService.listByIds(requestIds);
|
||||
List<Procedure> procedureList = iProcedureService.getProcedureRecords(requestIds, serviceTable);
|
||||
List<Long> procedureIds = procedureList.stream().filter(Objects::nonNull) // 过滤掉null的Procedure对象
|
||||
.map(Procedure::getId).filter(Objects::nonNull) // 过滤掉id为null的记录(按需添加)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -68,6 +69,17 @@ public class LabActivityDefinitionAppServiceImpl implements ILabActivityDefiniti
|
||||
selParam.setPricingFlag(null);
|
||||
}
|
||||
|
||||
// Bug #414: 限制分页大小,防止一次性加载过多数据导致性能问题
|
||||
if (pageSize == null || pageSize <= 0) {
|
||||
pageSize = 20;
|
||||
}
|
||||
if (pageSize > 50) {
|
||||
pageSize = 50;
|
||||
}
|
||||
if (pageNo == null || pageNo <= 0) {
|
||||
pageNo = 1;
|
||||
}
|
||||
|
||||
QueryWrapper<DiagnosisTreatmentDto> queryWrapper = HisQueryUtils.buildQueryWrapper(selParam,
|
||||
searchKey, new HashSet<>(Arrays.asList("T1.bus_no", "T1.name", "T1.py_str", "T1.wb_str")), request);
|
||||
|
||||
@@ -80,10 +92,19 @@ public class LabActivityDefinitionAppServiceImpl implements ILabActivityDefiniti
|
||||
selParam.setPricingFlag(pricingFlagValue);
|
||||
}
|
||||
|
||||
IPage<DiagnosisTreatmentDto> page = labActivityDefinitionManageMapper
|
||||
.getLabActivityDefinitionPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
// Bug #414: 使用optimizeCountSql=true优化COUNT查询性能
|
||||
Page<DiagnosisTreatmentDto> page = new Page<>(pageNo, pageSize, true);
|
||||
IPage<DiagnosisTreatmentDto> resultPage = labActivityDefinitionManageMapper
|
||||
.getLabActivityDefinitionPage(page, queryWrapper);
|
||||
|
||||
page.getRecords().forEach(e -> {
|
||||
resultPage.getRecords().forEach(e -> {
|
||||
// Bug #415: 确保价格不为负数
|
||||
if (e.getPackageAmount() != null && e.getPackageAmount().compareTo(BigDecimal.ZERO) < 0) {
|
||||
e.setPackageAmount(BigDecimal.ZERO);
|
||||
}
|
||||
if (e.getServiceFee() != null && e.getServiceFee().compareTo(BigDecimal.ZERO) < 0) {
|
||||
e.setServiceFee(BigDecimal.ZERO);
|
||||
}
|
||||
e.setYbFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbFlag()));
|
||||
e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag()));
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(ActivityType.class, e.getTypeEnum()));
|
||||
@@ -91,13 +112,22 @@ public class LabActivityDefinitionAppServiceImpl implements ILabActivityDefiniti
|
||||
e.setPricingFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getPricingFlag()));
|
||||
});
|
||||
|
||||
return R.ok(page);
|
||||
return R.ok(resultPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getLabActivityDefinitionOne(Long id) {
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
DiagnosisTreatmentDto dto = labActivityDefinitionManageMapper.getLabActivityDefinitionOne(id, tenantId);
|
||||
// Bug #415: 确保价格不为负数
|
||||
if (dto != null) {
|
||||
if (dto.getPackageAmount() != null && dto.getPackageAmount().compareTo(BigDecimal.ZERO) < 0) {
|
||||
dto.setPackageAmount(BigDecimal.ZERO);
|
||||
}
|
||||
if (dto.getServiceFee() != null && dto.getServiceFee().compareTo(BigDecimal.ZERO) < 0) {
|
||||
dto.setServiceFee(BigDecimal.ZERO);
|
||||
}
|
||||
}
|
||||
return R.ok(dto);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,9 @@ import com.openhis.web.paymentmanage.appservice.IChargeBillService;
|
||||
import com.openhis.web.paymentmanage.dto.*;
|
||||
import com.openhis.web.paymentmanage.mapper.ChargeBillMapper;
|
||||
import com.openhis.workflow.domain.ActivityDefinition;
|
||||
import com.openhis.workflow.domain.ServiceRequest;
|
||||
import com.openhis.workflow.service.IActivityDefinitionService;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
import com.openhis.yb.domain.ClinicSettle;
|
||||
import com.openhis.yb.domain.ClinicUnSettle;
|
||||
import com.openhis.yb.domain.InfoPerson;
|
||||
@@ -111,6 +113,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
@Autowired
|
||||
private IActivityDefinitionService iActivityDefinitionService;
|
||||
@Autowired
|
||||
private IServiceRequestService iServiceRequestService;
|
||||
@Autowired
|
||||
private IPractitionerService iPractitionerService;
|
||||
@Autowired
|
||||
private IHealthcareServiceService iHealthcareServiceService;
|
||||
@@ -265,10 +269,31 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
.setTotalPrice(chargeItem.getTotalPrice()).setQuantityUnit(chargeItem.getQuantityUnit())
|
||||
.setTotalVolume(device.getSize()).setQuantityValue(chargeItem.getQuantityValue());
|
||||
} else if (CommonConstants.TableName.WOR_ACTIVITY_DEFINITION.equals(chargeItem.getProductTable())) {
|
||||
ActivityDefinition activity = iActivityDefinitionService.getById(chargeItem.getProductId());
|
||||
chargeItemDetailVO.setDirClass(activity.getChrgitmLv() + "").setChargeItemName(activity.getName())
|
||||
.setTotalPrice(chargeItem.getTotalPrice()).setQuantityUnit(chargeItem.getQuantityUnit())
|
||||
.setTotalVolume("").setQuantityValue(chargeItem.getQuantityValue());
|
||||
// 🔧 BugFix#385: 检查申请创建的收费项 productId=0,需从 ServiceRequest.contentJson 获取项目名称
|
||||
if (chargeItem.getProductId() != null && chargeItem.getProductId() > 0) {
|
||||
ActivityDefinition activity = iActivityDefinitionService.getById(chargeItem.getProductId());
|
||||
chargeItemDetailVO.setDirClass(activity.getChrgitmLv() + "").setChargeItemName(activity.getName())
|
||||
.setTotalPrice(chargeItem.getTotalPrice()).setQuantityUnit(chargeItem.getQuantityUnit())
|
||||
.setTotalVolume("").setQuantityValue(chargeItem.getQuantityValue());
|
||||
} else {
|
||||
// productId=0 时,从关联的 ServiceRequest 获取项目名称
|
||||
ServiceRequest serviceRequest = iServiceRequestService.getById(chargeItem.getServiceId());
|
||||
String itemName = "未知项目";
|
||||
String dirClass = "3"; // 默认诊疗类
|
||||
if (serviceRequest != null && serviceRequest.getContentJson() != null) {
|
||||
try {
|
||||
JSONObject json = JSON.parseObject(serviceRequest.getContentJson());
|
||||
if (json.containsKey("adviceName")) {
|
||||
itemName = json.getString("adviceName");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("解析ServiceRequest.contentJson失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
chargeItemDetailVO.setDirClass(dirClass).setChargeItemName(itemName)
|
||||
.setTotalPrice(chargeItem.getTotalPrice()).setQuantityUnit(chargeItem.getQuantityUnit())
|
||||
.setTotalVolume("").setQuantityValue(chargeItem.getQuantityValue());
|
||||
}
|
||||
} else {
|
||||
HealthcareService healthcareService = iHealthcareServiceService.getById(chargeItem.getServiceId());
|
||||
chargeItemDetailVO.setDirClass("3").setChargeItemName(healthcareService.getName())
|
||||
@@ -347,7 +372,19 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
|
||||
Long definitionId = chargeItem.getDefinitionId();
|
||||
|
||||
ChargeItemDefinition chargeItemDefinition = iChargeItemDefinitionService.getById(definitionId);
|
||||
// 🔧 BugFix#385: 检查申请创建的收费项 definition_id=0,chargeItemDefinition 会为 null
|
||||
ChargeItemDefinition chargeItemDefinition = null;
|
||||
if (definitionId != null && definitionId > 0) {
|
||||
chargeItemDefinition = iChargeItemDefinitionService.getById(definitionId);
|
||||
}
|
||||
|
||||
// 当 definitionId=0 或 chargeItemDefinition 为 null 时,跳过医保分类统计
|
||||
// 检查类项目默认归类为"检查费"
|
||||
if (chargeItemDefinition == null) {
|
||||
// 检查申请的收费项,归类为检查费(03)
|
||||
sum03 = sum03.add(chargeItem.getTotalPrice());
|
||||
continue;
|
||||
}
|
||||
|
||||
YbMedChrgItmType medChrgItmType
|
||||
= YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
|
||||
|
||||
@@ -6,6 +6,7 @@ package com.openhis.web.paymentmanage.appservice.impl;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
@@ -58,7 +59,9 @@ import com.openhis.web.personalization.dto.ActivityDeviceDto;
|
||||
import com.openhis.triageandqueuemanage.domain.TriageQueueItem;
|
||||
import com.openhis.triageandqueuemanage.service.TriageQueueItemService;
|
||||
import com.openhis.appointmentmanage.domain.ScheduleSlot;
|
||||
import com.openhis.appointmentmanage.domain.SchedulePool;
|
||||
import com.openhis.appointmentmanage.mapper.ScheduleSlotMapper;
|
||||
import com.openhis.appointmentmanage.mapper.SchedulePoolMapper;
|
||||
import com.openhis.clinical.domain.Order;
|
||||
import com.openhis.clinical.service.IOrderService;
|
||||
import com.openhis.workflow.domain.ServiceRequest;
|
||||
@@ -195,6 +198,8 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
private IOrderService iOrderService;
|
||||
@Autowired
|
||||
private ScheduleSlotMapper scheduleSlotMapper;
|
||||
@Autowired
|
||||
private SchedulePoolMapper schedulePoolMapper;
|
||||
|
||||
/**
|
||||
* 【门诊预结算】
|
||||
@@ -241,14 +246,21 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
.collect(Collectors.toList());
|
||||
// account去重
|
||||
List<Long> distinctAccountIdList = accountIdList.stream().distinct().collect(Collectors.toList());
|
||||
// 检查是否存在accountId为null的收费项
|
||||
// 检查是否存在accountId为null或0的收费项
|
||||
long nullAccountIdCount = chargeItemList.stream()
|
||||
.map(ChargeItem::getAccountId)
|
||||
.filter(Objects::isNull)
|
||||
.count();
|
||||
long zeroAccountIdCount = chargeItemList.stream()
|
||||
.map(ChargeItem::getAccountId)
|
||||
.filter(id -> id != null && id == 0L)
|
||||
.count();
|
||||
if (nullAccountIdCount > 0) {
|
||||
throw new ServiceException("部分收费项缺少账户信息,请检查收费项数据");
|
||||
}
|
||||
if (zeroAccountIdCount > 0) {
|
||||
throw new ServiceException("部分收费项账户ID为0(无效),请检查收费项数据或重新创建检查申请");
|
||||
}
|
||||
if (distinctAccountIdList.isEmpty()) {
|
||||
throw new ServiceException("未找到有效的账户信息");
|
||||
}
|
||||
@@ -257,15 +269,66 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
// 在挂号费等场景下可能因数据不一致导致查不到,引发误报
|
||||
List<Account> accountList = iAccountService.list(new LambdaQueryWrapper<Account>()
|
||||
.in(Account::getId, distinctAccountIdList));
|
||||
|
||||
// 🔧 Bug Fix: 处理账户不存在的情况(历史数据修复)
|
||||
if (accountList.size() != distinctAccountIdList.size()) {
|
||||
// 部分账户查不到时,记录警告日志,并校验是否每个收费项都能找到对应账户
|
||||
Set<Long> foundAccountIds = accountList.stream().map(Account::getId).collect(Collectors.toSet());
|
||||
List<Long> missingAccountIds = distinctAccountIdList.stream()
|
||||
.filter(id -> !foundAccountIds.contains(id)).collect(Collectors.toList());
|
||||
if (accountList.isEmpty()) {
|
||||
throw new ServiceException("未查询到任何账户信息,encounterId:" + prePaymentDto.getEncounterId()
|
||||
+ ",期望accountId列表:" + distinctAccountIdList);
|
||||
|
||||
logger.warn("预结算发现部分账户不存在,missingAccountIds={},将自动修复收费项的accountId",
|
||||
missingAccountIds);
|
||||
|
||||
// 获取或创建有效的自费账户
|
||||
Account selfAccount = iAccountService.getSelfAccount(prePaymentDto.getEncounterId());
|
||||
if (selfAccount == null) {
|
||||
// 自动创建自费账户
|
||||
Account newAccount = new Account();
|
||||
newAccount.setPatientId(chargeItemList.get(0).getPatientId());
|
||||
newAccount.setEncounterId(prePaymentDto.getEncounterId());
|
||||
newAccount.setContractNo(CommonConstants.BusinessName.DEFAULT_CONTRACT_NO);
|
||||
newAccount.setTypeCode(AccountType.PERSONAL_CASH_ACCOUNT.getCode());
|
||||
newAccount.setBalanceAmount(BigDecimal.ZERO);
|
||||
newAccount.setStatusEnum(AccountStatus.ACTIVE.getValue());
|
||||
newAccount.setEncounterFlag(Whether.YES.getValue());
|
||||
newAccount.setName(AccountType.PERSONAL_CASH_ACCOUNT.getInfo());
|
||||
Long newAccountId = iAccountService.saveAccountByRegister(newAccount);
|
||||
selfAccount = iAccountService.getById(newAccountId);
|
||||
logger.info("预结算自动创建自费账户,newAccountId={}", newAccountId);
|
||||
}
|
||||
|
||||
// 修复收费项的 accountId
|
||||
for (Long missingAccountId : missingAccountIds) {
|
||||
// 找到使用该无效 accountId 的收费项
|
||||
List<ChargeItem> affectedChargeItems = chargeItemList.stream()
|
||||
.filter(ci -> ci.getAccountId() != null && ci.getAccountId().equals(missingAccountId))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (ChargeItem ci : affectedChargeItems) {
|
||||
LambdaUpdateWrapper<ChargeItem> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(ChargeItem::getId, ci.getId())
|
||||
.set(ChargeItem::getAccountId, selfAccount.getId());
|
||||
iChargeItemService.update(updateWrapper);
|
||||
logger.info("预结算修复收费项accountId,chargeItemId={},oldAccountId={},newAccountId={}",
|
||||
ci.getId(), missingAccountId, selfAccount.getId());
|
||||
|
||||
// 更新本地对象的 accountId,以便后续处理使用正确的值
|
||||
ci.setAccountId(selfAccount.getId());
|
||||
}
|
||||
}
|
||||
|
||||
// 重新查询账户列表
|
||||
accountList = iAccountService.list(new LambdaQueryWrapper<Account>()
|
||||
.eq(Account::getId, selfAccount.getId()));
|
||||
|
||||
// 重新构建 accountIdList(已修复)
|
||||
distinctAccountIdList = chargeItemList.stream()
|
||||
.map(ChargeItem::getAccountId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
logger.info("预结算账户修复完成,最终使用accountId={}", selfAccount.getId());
|
||||
}
|
||||
|
||||
// 账户id,对应的账单列表
|
||||
@@ -1923,6 +1986,60 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
|
||||
// Bug #409:预约签到挂号时,修正 serviceTypeId 为预约类型而非挂号类型
|
||||
// 数据链:Order → ScheduleSlot → SchedulePool → HealthcareService
|
||||
try {
|
||||
Order appointmentOrder = iOrderService.getOne(
|
||||
new LambdaQueryWrapper<Order>()
|
||||
.eq(Order::getPatientId, encounterFormData.getPatientId())
|
||||
.eq(Order::getStatus, CommonConstants.AppointmentOrderStatus.CHECKED_IN)
|
||||
.eq(Order::getDeleteFlag, "0")
|
||||
.orderByDesc(Order::getCreateTime)
|
||||
.last("LIMIT 1")
|
||||
);
|
||||
|
||||
if (appointmentOrder != null && appointmentOrder.getSlotId() != null) {
|
||||
ScheduleSlot slot = scheduleSlotMapper.selectById(appointmentOrder.getSlotId());
|
||||
if (slot != null && slot.getPoolId() != null) {
|
||||
SchedulePool pool = schedulePoolMapper.selectById(slot.getPoolId());
|
||||
if (pool != null && pool.getRegType() != null) {
|
||||
// pool.getRegType() 存储号别名称如"普通号-预约",精确匹配 HealthcareService
|
||||
HealthcareService appointmentHealthcareService = healthcareServiceService.getOne(
|
||||
new LambdaQueryWrapper<HealthcareService>()
|
||||
.eq(HealthcareService::getOfferedOrgId, encounterFormData.getOrganizationId())
|
||||
.eq(HealthcareService::getDeleteFlag, "0")
|
||||
.eq(HealthcareService::getName, pool.getRegType())
|
||||
.last("LIMIT 1")
|
||||
);
|
||||
|
||||
if (appointmentHealthcareService != null) {
|
||||
encounterFormData.setServiceTypeId(appointmentHealthcareService.getId());
|
||||
encounterFormData.setOrderId(appointmentOrder.getId());
|
||||
logger.info("预约签到挂号修正serviceTypeId={},号别={}",
|
||||
appointmentHealthcareService.getId(), pool.getRegType());
|
||||
} else {
|
||||
// 精确匹配失败,尝试 LIKE 匹配
|
||||
appointmentHealthcareService = healthcareServiceService.getOne(
|
||||
new LambdaQueryWrapper<HealthcareService>()
|
||||
.eq(HealthcareService::getOfferedOrgId, encounterFormData.getOrganizationId())
|
||||
.eq(HealthcareService::getDeleteFlag, "0")
|
||||
.like(HealthcareService::getName, pool.getRegType())
|
||||
.last("LIMIT 1")
|
||||
);
|
||||
if (appointmentHealthcareService != null) {
|
||||
encounterFormData.setServiceTypeId(appointmentHealthcareService.getId());
|
||||
encounterFormData.setOrderId(appointmentOrder.getId());
|
||||
logger.info("预约签到挂号(LIKE)serviceTypeId={},号别={}",
|
||||
appointmentHealthcareService.getId(), pool.getRegType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("修正serviceTypeId失败,不影响挂号流程", e);
|
||||
}
|
||||
|
||||
// 保存就诊信息
|
||||
Encounter encounter = new Encounter();
|
||||
BeanUtils.copyProperties(encounterFormData, encounter);
|
||||
|
||||
@@ -93,6 +93,15 @@ public interface IInfectiousCardAppService {
|
||||
*
|
||||
* @return 科室树数据
|
||||
*/
|
||||
|
||||
/**
|
||||
* 撤销审核传染病报卡
|
||||
*
|
||||
* @param cardNo 报卡编号
|
||||
* @param status 撤销后的状态
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> revokeAudit(String cardNo, String status);
|
||||
R<?> getDeptTree();
|
||||
|
||||
}
|
||||
@@ -276,6 +276,38 @@ public class InfectiousCardAppServiceImpl implements IInfectiousCardAppService {
|
||||
throw new RuntimeException("导出失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 撤销审核传染病报卡
|
||||
*
|
||||
* @param cardNo 报卡编号
|
||||
* @param status 撤销后的状态
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> revokeAudit(String cardNo, String status) {
|
||||
try {
|
||||
// 验证参数
|
||||
if (cardNo == null || cardNo.trim().isEmpty()) {
|
||||
return R.fail("报卡编号不能为空");
|
||||
}
|
||||
if (status == null || status.trim().isEmpty()) {
|
||||
return R.fail("撤销后的状态不能为空");
|
||||
}
|
||||
|
||||
// 执行撤销审核操作
|
||||
int rows = reportManageCardMapper.revokeAuditCard(cardNo, Integer.parseInt(status));
|
||||
|
||||
if (rows > 0) {
|
||||
return R.ok("撤销审核成功");
|
||||
} else {
|
||||
return R.fail("撤销审核失败:未找到对应的报卡");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("撤销审核传染病报卡失败", e);
|
||||
return R.fail("撤销审核失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CSV 字段转义
|
||||
|
||||
@@ -7,13 +7,13 @@ import com.openhis.web.reportManagement.dto.AuditInfectiousCardRequest;
|
||||
import com.openhis.web.reportManagement.dto.ReturnInfectiousCardRequest;
|
||||
import com.openhis.web.reportManagement.dto.BatchAuditInfectiousCardRequest;
|
||||
import com.openhis.web.reportManagement.dto.BatchReturnInfectiousCardRequest;
|
||||
import com.openhis.web.reportManagement.dto.RevokeAuditInfectiousCardRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
// import java.util.List; // 批量操作功能暂未实现
|
||||
|
||||
/**
|
||||
* 传染病报卡管理 Controller
|
||||
@@ -31,11 +31,6 @@ public class reportManagementController {
|
||||
|
||||
/**
|
||||
* 分页查询传染病报卡列表
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 每页数量
|
||||
* @return 传染病报卡列表
|
||||
*/
|
||||
@GetMapping("/list-page")
|
||||
public R<?> listPage(InfectiousCardParam param,
|
||||
@@ -46,9 +41,6 @@ public class reportManagementController {
|
||||
|
||||
/**
|
||||
* 根据 ID 查询传染病报卡详情
|
||||
*
|
||||
* @param id 报卡 ID
|
||||
* @return 传染病报卡详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<?> getById(@PathVariable Long id) {
|
||||
@@ -57,9 +49,6 @@ public class reportManagementController {
|
||||
|
||||
/**
|
||||
* 根据卡号查询传染病报卡详情
|
||||
*
|
||||
* @param cardNo 报卡编号
|
||||
* @return 传染病报卡详情
|
||||
*/
|
||||
@GetMapping("/detail/{cardNo}")
|
||||
public R<?> getByCardNo(@PathVariable String cardNo) {
|
||||
@@ -68,9 +57,6 @@ public class reportManagementController {
|
||||
|
||||
/**
|
||||
* 审核传染病报卡
|
||||
*
|
||||
* @param request 审核请求
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/audit")
|
||||
public R<?> audit(@RequestBody AuditInfectiousCardRequest request) {
|
||||
@@ -79,9 +65,6 @@ public class reportManagementController {
|
||||
|
||||
/**
|
||||
* 退回传染病报卡
|
||||
*
|
||||
* @param request 退回请求
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/return")
|
||||
public R<?> returnCard(@Valid @RequestBody ReturnInfectiousCardRequest request) {
|
||||
@@ -90,9 +73,6 @@ public class reportManagementController {
|
||||
|
||||
/**
|
||||
* 批量审核传染病报卡
|
||||
*
|
||||
* @param request 批量审核请求
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/batchAudit")
|
||||
public R<?> batchAudit(@RequestBody BatchAuditInfectiousCardRequest request) {
|
||||
@@ -101,9 +81,6 @@ public class reportManagementController {
|
||||
|
||||
/**
|
||||
* 批量退回传染病报卡
|
||||
*
|
||||
* @param request 批量退回请求
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/batchReturn")
|
||||
public R<?> batchReturn(@Valid @RequestBody BatchReturnInfectiousCardRequest request) {
|
||||
@@ -111,10 +88,18 @@ public class reportManagementController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出传染病报卡
|
||||
* 撤销审核传染病报卡(Bug #395)
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @param response 响应对象
|
||||
* @param request 撤销审核请求
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/revokeAudit")
|
||||
public R<?> revokeAudit(@Valid @RequestBody RevokeAuditInfectiousCardRequest request) {
|
||||
return infectiousCardAppService.revokeAudit(request.getCardNo(), request.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出传染病报卡
|
||||
*/
|
||||
@GetMapping("/export")
|
||||
public void export(InfectiousCardParam param, HttpServletResponse response) {
|
||||
@@ -123,8 +108,6 @@ public class reportManagementController {
|
||||
|
||||
/**
|
||||
* 获取科室树
|
||||
*
|
||||
* @return 科室树数据
|
||||
*/
|
||||
@GetMapping("/dept-tree")
|
||||
public R<?> getDeptTree() {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.openhis.web.reportManagement.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 撤销审核传染病报卡请求 DTO
|
||||
*
|
||||
* @author guanyu
|
||||
* @date 2026-04-23
|
||||
*/
|
||||
@Data
|
||||
public class RevokeAuditInfectiousCardRequest {
|
||||
|
||||
/** 卡片编号(主键) */
|
||||
private String cardNo;
|
||||
|
||||
/** 撤销后的状态 (0 暂存/1 待审核/2 已审核/3 已上报/4 失败/5 退回) */
|
||||
private String status;
|
||||
|
||||
}
|
||||
@@ -55,5 +55,12 @@ public interface ReportManageCardMapper {
|
||||
* @param param 查询参数
|
||||
* @return 报卡列表
|
||||
*/
|
||||
/**
|
||||
* 撤销审核传染病报卡
|
||||
* @param cardNo 卡号
|
||||
* @param status 撤销后的状态
|
||||
* @return 影响行数
|
||||
*/
|
||||
int revokeAuditCard(@Param("cardNo") String cardNo, @Param("status") Integer status);
|
||||
List<InfectiousCardDto> selectAllCards(@Param("param") InfectiousCardParam param);
|
||||
}
|
||||
|
||||
@@ -94,18 +94,21 @@
|
||||
T8.contract_name,
|
||||
CASE
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
|
||||
WHEN T1.context_enum = #{activity} THEN T2."name"
|
||||
WHEN T1.context_enum = #{medication} THEN T3."name"
|
||||
WHEN T1.context_enum = #{device} THEN T4."name"
|
||||
END AS item_name,
|
||||
CASE
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
|
||||
WHEN T1.context_enum = #{activity} THEN T2.yb_no
|
||||
WHEN T1.context_enum = #{medication} THEN T3.yb_no
|
||||
WHEN T1.context_enum = #{device} THEN T4.yb_no
|
||||
END AS yb_no,
|
||||
CASE
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
|
||||
WHEN T1.context_enum = #{activity} THEN T2.id
|
||||
WHEN T1.context_enum = #{medication} THEN T3.id
|
||||
WHEN T1.context_enum = #{device} THEN T4.id
|
||||
@@ -205,18 +208,21 @@
|
||||
T8.contract_name,
|
||||
CASE
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
|
||||
WHEN T1.context_enum = #{activity} THEN T2."name"
|
||||
WHEN T1.context_enum = #{medication} THEN T3."name"
|
||||
WHEN T1.context_enum = #{device} THEN T4."name"
|
||||
END AS item_name,
|
||||
CASE
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
|
||||
WHEN T1.context_enum = #{activity} THEN T2.yb_no
|
||||
WHEN T1.context_enum = #{medication} THEN T3.yb_no
|
||||
WHEN T1.context_enum = #{device} THEN T4.yb_no
|
||||
END AS yb_no,
|
||||
CASE
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id
|
||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
|
||||
WHEN T1.context_enum = #{activity} THEN T2.id
|
||||
WHEN T1.context_enum = #{medication} THEN T3.id
|
||||
WHEN T1.context_enum = #{device} THEN T4.id
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
T9.organization_id AS organizationId,
|
||||
T9.organization_name AS organizationName,
|
||||
T9.healthcare_name AS healthcareName,
|
||||
T9.clinic_room AS clinicRoom, -- Bug #410:诊室名称
|
||||
T9.practitioner_user_id AS practitionerUserId,
|
||||
T9.practitioner_name AS practitionerName,
|
||||
T9.contract_name AS contractName,
|
||||
@@ -99,10 +100,12 @@
|
||||
T18.identifier_no AS identifier_no,
|
||||
T1.order_id AS order_id,
|
||||
om.slot_id AS slot_id,
|
||||
ss.pool_id AS pool_id
|
||||
ss.pool_id AS pool_id,
|
||||
sp.clinic_room AS clinic_room -- Bug #410:从号源池获取诊室
|
||||
FROM adm_encounter AS T1
|
||||
LEFT JOIN order_main AS om ON T1.order_id = om.id AND om.delete_flag = '0'
|
||||
LEFT JOIN adm_schedule_slot AS ss ON om.slot_id = ss.id AND ss.delete_flag = '0'
|
||||
LEFT JOIN adm_schedule_pool AS sp ON ss.pool_id = sp.id AND sp.delete_flag = '0' -- Bug #410
|
||||
LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.ID AND T2.delete_flag = '0'
|
||||
LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.ID AND T3.delete_flag = '0'
|
||||
LEFT JOIN (
|
||||
|
||||
@@ -331,8 +331,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
) t
|
||||
WHERE rn = 1
|
||||
) pi ON s.patient_id = pi.patient_id
|
||||
<!-- 排除已生成医嘱的手术 -->
|
||||
LEFT JOIN wor_service_request sr ON sr.activity_id = s.id AND sr.delete_flag = '0' AND sr.category_enum = 4
|
||||
<where>
|
||||
s.delete_flag = '0'
|
||||
<!-- 只显示未生成医嘱的手术 -->
|
||||
AND sr.id IS NULL
|
||||
<if test="ew.sqlSegment != null and ew.sqlSegment != ''">
|
||||
<![CDATA[
|
||||
AND ${ew.sqlSegment.replace('tenant_id', 's.tenant_id').replace('create_time', 's.create_time').replace('surgery_no', 's.surgery_no').replace('surgery_name', 's.surgery_name').replace('patient_name', 's.patient_name').replace('main_surgeon_name', 's.main_surgeon_name').replace('anesthetist_name', 's.anesthetist_name').replace('org_name', 's.org_name').replace('status_enum', 's.status_enum').replace('planned_time', 's.planned_time')}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
|
||||
FROM op_schedule os
|
||||
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
|
||||
LEFT JOIN cli_surgery cs ON os.oper_code = cs.surgery_no AND cs.delete_flag = '0'
|
||||
INNER JOIN cli_surgery cs ON os.oper_code = cs.surgery_no AND cs.delete_flag = '0'
|
||||
LEFT JOIN adm_organization o ON cs.org_id = o.id
|
||||
LEFT JOIN sys_tenant st ON st.id = os.tenant_id
|
||||
LEFT JOIN sys_user su ON su.user_id = os.creator_id
|
||||
@@ -92,7 +92,7 @@
|
||||
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
|
||||
FROM op_schedule os
|
||||
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
|
||||
LEFT JOIN cli_surgery cs ON os.oper_code = cs.surgery_no AND cs.delete_flag = '0'
|
||||
INNER JOIN cli_surgery cs ON os.oper_code = cs.surgery_no AND cs.delete_flag = '0'
|
||||
LEFT JOIN adm_organization o ON cs.org_id = o.id
|
||||
LEFT JOIN doc_request_form drf ON drf.prescription_no=cs.surgery_no
|
||||
LEFT JOIN (
|
||||
@@ -153,7 +153,7 @@
|
||||
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
|
||||
FROM op_schedule os
|
||||
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
|
||||
LEFT JOIN cli_surgery cs ON os.oper_code = cs.surgery_no AND cs.delete_flag = '0'
|
||||
INNER JOIN cli_surgery cs ON os.oper_code = cs.surgery_no AND cs.delete_flag = '0'
|
||||
LEFT JOIN adm_organization o ON cs.org_id = o.id
|
||||
LEFT JOIN sys_tenant st ON st.id = os.tenant_id
|
||||
LEFT JOIN sys_user su ON su.user_id = os.creator_id
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
AND T2.delete_flag = '0'
|
||||
WHERE
|
||||
T1.delete_flag = '0'
|
||||
<if test="chargeItemContext == 1 ">
|
||||
<if test="chargeItemContext == 1">
|
||||
AND T1.instance_table = #{MED_MEDICATION_DEFINITION}
|
||||
</if>
|
||||
<if test="chargeItemContext == 2 ">
|
||||
<if test="chargeItemContext == 2">
|
||||
AND T1.instance_table = #{ADM_DEVICE_DEFINITION}
|
||||
</if>
|
||||
<if test="chargeItemContext == 3 ">
|
||||
<if test="chargeItemContext == 3">
|
||||
AND (T1.instance_table = #{WOR_ACTIVITY_DEFINITION} OR T1.instance_table = #{ADM_HEALTHCARE_SERVICE})
|
||||
</if>
|
||||
GROUP BY T1.tenant_id,
|
||||
|
||||
@@ -186,6 +186,9 @@
|
||||
<if test="searchKey != null and searchKey != ''">
|
||||
AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%')
|
||||
</if>
|
||||
<if test="categoryCode != null and categoryCode != ''">
|
||||
AND t1.category_code = #{categoryCode}
|
||||
</if>
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND t1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
@@ -274,12 +277,15 @@
|
||||
AND (T1.category_code = '手术' OR T1.category_code = '24')
|
||||
</if>
|
||||
<!-- 如果只选择诊疗(adviceType=3),排除手术 -->
|
||||
<if test="adviceTypes.contains(3) and !adviceTypes.contains(6)">
|
||||
<if test="adviceTypes.contains(3) and !adviceTypes.contains(6) and (categoryCode == null or categoryCode == '')">
|
||||
AND T1.category_code != '手术' AND T1.category_code != '24'
|
||||
</if>
|
||||
<if test="searchKey != null and searchKey != ''">
|
||||
AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%')
|
||||
</if>
|
||||
<if test="categoryCode != null and categoryCode != ''">
|
||||
AND t1.category_code = #{categoryCode}
|
||||
</if>
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND t1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
@@ -630,6 +636,8 @@
|
||||
T3.service_table = #{WOR_DEVICE_REQUEST}
|
||||
LEFT JOIN adm_location AS al ON al.ID = T1.perform_location AND al.delete_flag = '0'
|
||||
WHERE T1.delete_flag = '0' AND T1.generate_source_enum = #{generateSourceEnum}
|
||||
-- 🔧 Bug Fix: 排除基于其他医嘱生成的执行记录
|
||||
AND (T1.based_on_id IS NULL OR T1.based_on_table IS NULL)
|
||||
<if test="historyFlag == '0'.toString()">
|
||||
AND T1.encounter_id = #{encounterId}
|
||||
</if>
|
||||
@@ -686,6 +694,10 @@
|
||||
WHERE T1.delete_flag = '0' AND T1.generate_source_enum = #{generateSourceEnum}
|
||||
AND T1.parent_id IS NULL
|
||||
AND T1.refund_service_id IS NULL
|
||||
-- 🔧 Bug Fix: 排除基于药品请求生成的执行记录(输液、皮试),但保留检查/检验申请单创建的原始医嘱
|
||||
-- based_on_table='med_medication_request' → 输液/皮试执行记录,应排除
|
||||
-- based_on_table='exam_apply'/'lab_apply' → 申请单原始医嘱,应保留
|
||||
AND (T1.based_on_id IS NULL OR T1.based_on_table IS NULL OR T1.based_on_table NOT IN ('med_medication_request', 'med_medication_dispense'))
|
||||
<if test="historyFlag == '0'.toString()">
|
||||
AND T1.encounter_id = #{encounterId}
|
||||
</if>
|
||||
|
||||
@@ -252,4 +252,11 @@
|
||||
ORDER BY t1.report_date DESC
|
||||
</select>
|
||||
|
||||
<!-- 撤销审核传染病报卡 -->
|
||||
<update id="revokeAuditCard">
|
||||
UPDATE infectious_card
|
||||
SET status = #{status}::INTEGER,
|
||||
update_time = CURRENT_TIMESTAMP
|
||||
WHERE card_no = #{cardNo}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.openhis.workflow.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.core.common.core.domain.HisBaseEntity;
|
||||
@@ -64,6 +66,7 @@ public class ServiceRequest extends HisBaseEntity {
|
||||
private Integer performFlag;
|
||||
|
||||
/** 诊疗定义id */
|
||||
@TableField(insertStrategy = FieldStrategy.ALWAYS)
|
||||
private Long activityId;
|
||||
|
||||
/** 数量 */
|
||||
|
||||
@@ -298,8 +298,14 @@
|
||||
<if test="query.phone != null and query.phone != ''">
|
||||
AND o.phone LIKE CONCAT('%', #{query.phone}, '%')
|
||||
</if>
|
||||
<!-- 5. 核心:按系统时间过滤,只返回未过期的号源 -->
|
||||
AND (p.schedule_date > CURRENT_DATE OR (p.schedule_date = CURRENT_DATE AND s.expect_time >= CURRENT_TIME::TIME))
|
||||
<!-- 5. 按系统时间过滤(Bug #398 #399 修复:仅未预约受时间过滤,已预约/已取号/已退号不受影响) -->
|
||||
AND (
|
||||
(<include refid="slotStatusNormExpr" /> = 0 AND (p.schedule_date > CURRENT_DATE OR (p.schedule_date = CURRENT_DATE AND (CAST(p.schedule_date AS TIMESTAMP) + CAST(s.expect_time AS TIME)) >= NOW())))
|
||||
OR <include refid="slotStatusNormExpr" /> = 1
|
||||
OR <include refid="slotStatusNormExpr" /> = 3
|
||||
OR <include refid="slotStatusNormExpr" /> = 5
|
||||
OR <include refid="orderStatusNormExpr" /> = 4
|
||||
)
|
||||
<!-- 6. 状态过滤 -->
|
||||
<if test="query.status != null and query.status != '' and query.status != 'all'">
|
||||
<choose>
|
||||
@@ -370,7 +376,7 @@
|
||||
p.schedule_date > CURRENT_DATE
|
||||
OR (
|
||||
p.schedule_date = CURRENT_DATE
|
||||
AND CAST(p.schedule_date AS TIMESTAMP) + CAST(s.expect_time AS TIME) > TO_TIMESTAMP(#{query.currentTime}/1000)
|
||||
AND (CAST(p.schedule_date AS TIMESTAMP) + CAST(s.expect_time AS TIME)) >= NOW()
|
||||
)
|
||||
)
|
||||
THEN s.id
|
||||
@@ -401,7 +407,7 @@
|
||||
AND p.schedule_date = CAST(#{query.date} AS DATE)
|
||||
</if>
|
||||
<!-- 增加时间过滤:排除已过去的就诊日期 -->
|
||||
AND p.schedule_date >= CURRENT_DATE
|
||||
AND (p.schedule_date > CURRENT_DATE OR (p.schedule_date = CURRENT_DATE AND (CAST(p.schedule_date AS TIMESTAMP) + CAST(s.expect_time AS TIME)) >= NOW()))
|
||||
<if test="query.department != null and query.department != '' and query.department != 'all'">
|
||||
AND org.name = #{query.department}
|
||||
</if>
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
# 页面标题
|
||||
VITE_APP_TITLE = 医院信息管理系统
|
||||
|
||||
# 测试环境配置
|
||||
VITE_APP_ENV = 'test'
|
||||
|
||||
# OpenHIS管理系统/测试环境
|
||||
|
||||
VITE_APP_BASE_API = '/test-api'
|
||||
|
||||
# 租户ID配置
|
||||
VITE_APP_TENANT_ID = '1'
|
||||
# Playwright E2E 测试环境变量
|
||||
# 注意:此文件仅用于本地开发,生产环境使用CI Secret管理
|
||||
TEST_BASE_URL=http://localhost:80
|
||||
TEST_USERNAME=admin
|
||||
TEST_PASSWORD=changeme_in_local_env
|
||||
|
||||
5
openhis-ui-vue3/.gitignore
vendored
5
openhis-ui-vue3/.gitignore
vendored
@@ -21,3 +21,8 @@ selenium-debug.log
|
||||
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
|
||||
# Playwright test results
|
||||
test-results/
|
||||
tests/e2e/report/
|
||||
tests/tests/
|
||||
|
||||
59
openhis-ui-vue3/eslint.config.js
Normal file
59
openhis-ui-vue3/eslint.config.js
Normal file
@@ -0,0 +1,59 @@
|
||||
/* eslint-env node */
|
||||
import globals from "globals";
|
||||
import pluginVue from "eslint-plugin-vue";
|
||||
import parserVue from "vue-eslint-parser";
|
||||
import importPlugin from "eslint-plugin-import";
|
||||
|
||||
export default [
|
||||
{
|
||||
name: "app/files-to-lint",
|
||||
files: ["**/*.{js,mjs,jsx,vue}"],
|
||||
},
|
||||
|
||||
{
|
||||
name: "app/files-to-ignore",
|
||||
ignores: ["**/dist/**", "**/node_modules/**", "**/help-center/**"],
|
||||
},
|
||||
|
||||
...pluginVue.configs["flat/recommended"],
|
||||
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
},
|
||||
parser: parserVue,
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
},
|
||||
|
||||
plugins: {
|
||||
import: importPlugin,
|
||||
},
|
||||
|
||||
rules: {
|
||||
// 确保导入的模块实际存在(核心规则,防止构建失败)
|
||||
"import/no-unresolved": "error",
|
||||
// 确保导入的命名导出实际存在
|
||||
"import/named": "error",
|
||||
// 确保默认导出存在
|
||||
"import/default": "error",
|
||||
// 确保命名空间导出存在
|
||||
"import/namespace": "error",
|
||||
// Vue 相关规则
|
||||
"vue/multi-word-component-names": "off",
|
||||
},
|
||||
|
||||
settings: {
|
||||
"import/resolver": {
|
||||
alias: {
|
||||
map: [
|
||||
["@", "./src"],
|
||||
],
|
||||
extensions: [".js", ".jsx", ".vue"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
2452
openhis-ui-vue3/package-lock.json
generated
2452
openhis-ui-vue3/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,11 @@
|
||||
"test": "vitest",
|
||||
"test:run": "vitest run",
|
||||
"test:coverage": "vitest run --coverage",
|
||||
"test:ui": "vitest --ui"
|
||||
"test:ui": "vitest --ui",
|
||||
"lint": "eslint . --ext .js,.vue src/",
|
||||
"test:e2e": "playwright test",
|
||||
"test:e2e:ui": "playwright test --ui",
|
||||
"test:e2e:report": "playwright show-report"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -67,6 +71,11 @@
|
||||
"@vitejs/plugin-vue": "4.5.0",
|
||||
"@vue/compiler-sfc": "3.3.9",
|
||||
"@vue/test-utils": "^2.4.6",
|
||||
"eslint": "^9.39.4",
|
||||
"eslint-import-resolver-alias": "^1.1.2",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-vue": "^10.9.0",
|
||||
"globals": "^17.5.0",
|
||||
"happy-dom": "^20.8.3",
|
||||
"jsdom": "^28.1.0",
|
||||
"pg": "^8.18.0",
|
||||
@@ -81,4 +90,4 @@
|
||||
"vitest": "^4.0.18",
|
||||
"vue-tsc": "^3.1.8"
|
||||
}
|
||||
}
|
||||
}
|
||||
28
openhis-ui-vue3/playwright.config.ts
Normal file
28
openhis-ui-vue3/playwright.config.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './tests/e2e/specs',
|
||||
fullyParallel: true,
|
||||
timeout: 60_000,
|
||||
expect: { timeout: 10_000 },
|
||||
retries: process.env.CI ? 2 : 1,
|
||||
workers: process.env.CI ? 2 : undefined,
|
||||
reporter: [
|
||||
['html', { outputFolder: 'tests/e2e/report', open: 'never' }],
|
||||
['list'],
|
||||
],
|
||||
use: {
|
||||
baseURL: process.env.TEST_BASE_URL || 'http://localhost:81',
|
||||
screenshot: 'only-on-failure',
|
||||
video: 'retain-on-failure',
|
||||
trace: 'retain-on-failure',
|
||||
viewport: { width: 1920, height: 1080 },
|
||||
locale: 'zh-CN',
|
||||
timezoneId: 'Asia/Shanghai',
|
||||
actionTimeout: 15_000,
|
||||
navigationTimeout: 30_000,
|
||||
},
|
||||
projects: [
|
||||
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
|
||||
],
|
||||
});
|
||||
@@ -20,6 +20,15 @@ export function advicePrint(data) {
|
||||
}
|
||||
|
||||
// 获取全部科室列表
|
||||
// 获取科室列表(别名)
|
||||
export function getDepartmentList(data) {
|
||||
return request({
|
||||
url: '/app-common/department-list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
});
|
||||
}
|
||||
|
||||
export function getOrgList(data) {
|
||||
return request({
|
||||
url: '/app-common/department-list',
|
||||
|
||||
@@ -26,7 +26,7 @@ const convertIdsToString = (obj) => {
|
||||
} else {
|
||||
const newObj = {}
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
const value = obj[key]
|
||||
// 如果key以Id结尾或者是id,且值是数字,转为字符串
|
||||
if ((key === 'id' || key.endsWith('Id') || key.endsWith('ID')) && typeof value === 'number') {
|
||||
|
||||
@@ -739,9 +739,15 @@ export default {
|
||||
status: record.statusEnum_enumText || record.status
|
||||
}));
|
||||
|
||||
// 先进行时间过滤(过滤掉已过期的号源)
|
||||
// 🔧 BugFix#398/#399: 时间过滤仅对"未预约"号源生效
|
||||
// 已预约、已取号、已退号等状态的记录不应因时间过期被过滤
|
||||
const currentTime = new Date().getTime();
|
||||
const timeFilteredRecords = mappedRecords.filter(ticket => {
|
||||
// 非未预约状态的记录不过滤时间
|
||||
if (ticket.status && ticket.status !== '未预约') {
|
||||
return true;
|
||||
}
|
||||
// 未预约号源:过滤已过期的
|
||||
const ticketTime = new Date(ticket.dateTime).getTime();
|
||||
return ticketTime > currentTime;
|
||||
});
|
||||
@@ -765,10 +771,11 @@ export default {
|
||||
if (!this.selectedStatus || this.selectedStatus === 'all') {
|
||||
return records;
|
||||
}
|
||||
// 🔧 BugFix#399: 确保已取号状态正确匹配
|
||||
const statusMap = {
|
||||
unbooked: ['未预约'],
|
||||
booked: ['已预约'],
|
||||
checked: ['已取号'],
|
||||
checked: ['已取号', '已签到'],
|
||||
cancelled: ['已停诊', '已取消'],
|
||||
returned: ['已退号']
|
||||
};
|
||||
|
||||
@@ -383,6 +383,7 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
const isAdding = ref(false);
|
||||
const isSaving = ref(false); // #437 防重复提交锁
|
||||
const prescriptionRef = ref();
|
||||
const expandOrder = ref([]); //目前的展开行
|
||||
const stockList = ref([]);
|
||||
@@ -1028,13 +1029,18 @@ function handleSave() {
|
||||
})
|
||||
groupIndexList.value = []
|
||||
groupList.value = []
|
||||
nextId.value == 1;
|
||||
nextId.value = 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 单行处方保存
|
||||
function handleSaveSign(row, index) {
|
||||
// 🔧 Bug Fix #437: 防重复提交锁
|
||||
if (isSaving.value) {
|
||||
proxy.$modal.msgWarning('正在保存中,请勿重复提交');
|
||||
return;
|
||||
}
|
||||
// 🔧 Bug Fix #238: 诊疗项目必须选择执行科室
|
||||
if (row.adviceType === 3 && !row.orgId) {
|
||||
proxy.$modal.msgWarning('诊疗项目必须选择执行科室');
|
||||
@@ -1042,33 +1048,37 @@ function handleSaveSign(row, index) {
|
||||
}
|
||||
proxy.$refs['formRef' + index].validate((valid) => {
|
||||
if (valid) {
|
||||
isSaving.value = true; // #437 加锁
|
||||
row.isEdit = false;
|
||||
isAdding.value = false;
|
||||
expandOrder.value = [];
|
||||
row.patientId = props.patientInfo.patientId;
|
||||
row.encounterId = props.patientInfo.encounterId;
|
||||
row.accountId = props.patientInfo.accountId;
|
||||
row.contentJson = JSON.stringify(row);
|
||||
row.dbOpType = row.requestId ? '2' : '1';
|
||||
row.minUnitQuantity = row.quantity * row.partPercent;
|
||||
row.categoryEnum = row.adviceType
|
||||
const cleanRow = JSON.parse(JSON.stringify(row));
|
||||
cleanRow.contentJson = JSON.stringify(cleanRow);
|
||||
cleanRow.dbOpType = cleanRow.requestId ? '2' : '1';
|
||||
cleanRow.minUnitQuantity = cleanRow.quantity * cleanRow.partPercent;
|
||||
cleanRow.categoryEnum = cleanRow.adviceType
|
||||
// 如果是手术计费,设置生成来源和来源业务单据号
|
||||
if (props.patientInfo.sourceBillNo) {
|
||||
row.generateSourceEnum = 6; // 手术计费
|
||||
row.sourceBillNo = props.patientInfo.sourceBillNo;
|
||||
cleanRow.generateSourceEnum = 6; // 手术计费
|
||||
cleanRow.sourceBillNo = props.patientInfo.sourceBillNo;
|
||||
}
|
||||
console.log('row', row)
|
||||
savePrescription({ adviceSaveList: [row] }).then((res) => {
|
||||
console.log('cleanRow', cleanRow)
|
||||
savePrescription({ adviceSaveList: [cleanRow] }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
proxy.$modal.msgSuccess('保存成功');
|
||||
getListInfo(false);
|
||||
nextId.value == 1;
|
||||
nextId.value = 1;
|
||||
// 🔧 Bug Fix #238: 如果诊疗项目缺少执行科室,标记为需要修复的脏数据
|
||||
if (row.adviceType === 3 && !row.orgId) {
|
||||
console.warn('Bug #238: 检测到诊疗项目保存时缺少执行科室,请手动编辑修正:', row);
|
||||
console.warn('Bug #238: 检测到诊疗项目保存时缺少执行科室,请手动编辑修正:', cleanRow);
|
||||
proxy.$modal.msgWarning('诊疗项目执行科室信息不完整,请编辑后重新保存');
|
||||
}
|
||||
}
|
||||
}).finally(() => {
|
||||
isSaving.value = false; // #437 释放锁
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -549,15 +549,16 @@ const handleCurrentChange = (val) => {
|
||||
}
|
||||
|
||||
const handlePrint = async (row) => {
|
||||
const printRows = tableData.value
|
||||
// 如果传入了具体行数据,则只打印该行;否则打印所有数据
|
||||
const printRows = row ? [row] : tableData.value;
|
||||
|
||||
if (printRows.length === 0) {
|
||||
ElMessage.warning('没有可打印的数据')
|
||||
return
|
||||
ElMessage.warning('没有可打印的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
const userStore = useUserStore()
|
||||
const hospitalName = userStore.tenantName || userStore.hospitalName || ''
|
||||
const userStore = useUserStore();
|
||||
const hospitalName = userStore.tenantName || userStore.hospitalName || '';
|
||||
|
||||
try {
|
||||
const printDataList = printRows.map(printRow => ({
|
||||
@@ -570,11 +571,11 @@ const handlePrint = async (row) => {
|
||||
consultationReason: printRow.consultationPurpose || '',
|
||||
applyTime: printRow.consultationRequestDate || '',
|
||||
applyDoctor: printRow.requestingPhysician || ''
|
||||
}))
|
||||
await simplePrint(PRINT_TEMPLATE.CONSULTATION, printDataList)
|
||||
}));
|
||||
await simplePrint(PRINT_TEMPLATE.CONSULTATION, printDataList);
|
||||
} catch (error) {
|
||||
console.error('会诊申请单打印失败:', error)
|
||||
ElMessage.error('打印失败')
|
||||
console.error('会诊申请单打印失败:', error);
|
||||
ElMessage.error('打印失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@
|
||||
<el-tag v-else type="warning" size="small">已确认</el-tag>
|
||||
</div>
|
||||
<div class="opinion-content">
|
||||
{{ opinion.opinion }}
|
||||
{{ formatOpinionContent(opinion.opinion) }}
|
||||
</div>
|
||||
<div v-if="opinion.signatureTime" class="opinion-footer">
|
||||
签名时间:{{ formatDateTime(opinion.signatureTime) }}
|
||||
@@ -301,6 +301,16 @@ const formatDateTime = (date) => {
|
||||
return `${yyyy}-${mm}-${dd} ${hh}:${mi}:${ss}`
|
||||
}
|
||||
|
||||
// Bug #388:去掉"科室-参加医师:"前缀,只显示意见内容
|
||||
const formatOpinionContent = (opinion) => {
|
||||
if (!opinion) return ''
|
||||
const colonIndex = opinion.indexOf(':')
|
||||
if (colonIndex > 0) {
|
||||
return opinion.substring(colonIndex + 1)
|
||||
}
|
||||
return opinion // 向后兼容旧数据
|
||||
}
|
||||
|
||||
const getDoctorName = () => userStore.nickName || userStore.name || '当前医生'
|
||||
const getDoctorDept = () => userStore.orgName || '当前科室'
|
||||
|
||||
|
||||
@@ -89,6 +89,20 @@ export function auditInfectiousCard(data) {
|
||||
* @param {string} data.returnReason - 退回原因
|
||||
* @param {string} data.status - 审核状态(5:审核失败)
|
||||
*/
|
||||
/**
|
||||
* 撤销审核传染病报卡
|
||||
* @param {Object} data
|
||||
* @param {string} data.cardNo
|
||||
* @param {string} data.status
|
||||
*/
|
||||
export function revokeAuditCard(data) {
|
||||
return request({
|
||||
url: '/report-manage/infectiousDiseaseReport/revokeAudit',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
export function returnInfectiousCard(data) {
|
||||
return request({
|
||||
url: '/report-manage/infectiousDiseaseReport/return',
|
||||
|
||||
@@ -205,6 +205,14 @@
|
||||
>
|
||||
审核
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 2"
|
||||
type="warning"
|
||||
link
|
||||
@click="handleRevokeAudit(row)"
|
||||
>
|
||||
撤销审核
|
||||
</el-button>
|
||||
<el-button
|
||||
type="info"
|
||||
link
|
||||
@@ -565,6 +573,7 @@ import {
|
||||
getInfectiousCard,
|
||||
auditInfectiousCard,
|
||||
returnInfectiousCard,
|
||||
revokeAuditCard,
|
||||
batchAuditCards,
|
||||
batchReturnCards,
|
||||
getDeptTree,
|
||||
@@ -825,6 +834,38 @@ function handleView(row) {
|
||||
loadCardDetail(row.cardNo);
|
||||
}
|
||||
|
||||
// 撤销审核(Bug #395 修复)
|
||||
async function handleRevokeAudit(row) {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要撤销【${row.patientName}】的报卡审核吗?撤销后状态将变为"待审核"。`,
|
||||
'确认撤销',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
);
|
||||
|
||||
const res = await revokeAuditCard({
|
||||
cardNo: row.cardNo,
|
||||
status: '1' // 撤销后状态变更为待审核
|
||||
});
|
||||
|
||||
if (res.code === 200) {
|
||||
ElMessage.success('撤销审核成功');
|
||||
loadTableData();
|
||||
loadStats();
|
||||
} else {
|
||||
ElMessage.error(res.msg || '撤销审核失败');
|
||||
}
|
||||
} catch (err) {
|
||||
if (err !== 'cancel') {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 加载卡片详情
|
||||
async function loadCardDetail(cardNo) {
|
||||
drawerLoading.value = true;
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="需要病员及会诊目的:" prop="consultationPurpose">
|
||||
<el-form-item label="简要病史及会诊目的:" prop="consultationPurpose">
|
||||
<el-input
|
||||
v-model="formData.consultationPurpose"
|
||||
type="textarea"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="exam-app-container">
|
||||
<div class="exam-app-container" style="width: 100%; max-width: 1200px;">
|
||||
<!-- ====== 顶部卡片:申请单列表 ====== -->
|
||||
<div class="top-section">
|
||||
<div class="section-header">
|
||||
@@ -73,7 +73,7 @@
|
||||
<el-row :gutter="12">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="申请单号" prop="applyNo">
|
||||
<el-input v-model="form.applyNo" readonly />
|
||||
<el-input v-model="form.applyNo" readonly placeholder="自动生成" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -211,17 +211,27 @@
|
||||
|
||||
<!-- TAB2:检查明细 -->
|
||||
<el-tab-pane label="检查明细" name="applyDetail">
|
||||
<!-- 🔧 BugFix#426: 支持树形展开显示套餐明细 -->
|
||||
<el-table
|
||||
ref="detailTableRef"
|
||||
:data="selectedItems"
|
||||
row-key="id"
|
||||
border
|
||||
size="small"
|
||||
style="width:100%"
|
||||
:max-height="350"
|
||||
:header-cell-style="{ background: '#f5f5f5', color: '#303133' }"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
:load="loadPackageDetails"
|
||||
lazy
|
||||
>
|
||||
<el-table-column label="行" type="index" width="45" align="center" />
|
||||
<el-table-column label="检查项目" prop="name" min-width="120" />
|
||||
<el-table-column label="检查项目" prop="name" min-width="120">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.isPackage" size="small" type="warning" style="margin-right: 4px">套餐</el-tag>
|
||||
<span>{{ scope.row.name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="部位" prop="applyPart" min-width="90">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.applyPart" size="small" />
|
||||
@@ -296,6 +306,7 @@
|
||||
v-for="cat in filteredCategoryList"
|
||||
:key="cat.typeId"
|
||||
:name="cat.typeId"
|
||||
@click="handleCategoryExpand(cat)"
|
||||
>
|
||||
<template #title>
|
||||
<span class="cat-title">{{ cat.categoryName }}</span>
|
||||
@@ -312,7 +323,7 @@
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-checkbox>
|
||||
<span class="item-price">¥{{ item.price }}</span>
|
||||
<span class="item-price">¥{{ item.price }}/{{ item.unit || "次" }}</span>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
@@ -392,6 +403,36 @@ const dictLoading = ref(false);
|
||||
const activeDetailTab = ref('applyForm');
|
||||
const applicationList = ref([]);
|
||||
const selectedItems = ref([]);
|
||||
|
||||
// 🔧 BugFix#426: 懒加载套餐明细
|
||||
async function loadPackageDetails(row, treeNode, resolve) {
|
||||
if (!row.isPackage || !row.packageId) {
|
||||
resolve([]);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await request({
|
||||
url: `/exam/package/${row.packageId}/details`,
|
||||
method: 'get'
|
||||
});
|
||||
if (res.code === 200 && res.data) {
|
||||
const children = res.data.map(item => ({
|
||||
...item,
|
||||
name: item.name || item.itemName,
|
||||
unit: item.unit || '次',
|
||||
price: item.price || item.itemPrice || 0,
|
||||
quantity: row.quantity || 1,
|
||||
isPackageDetail: true
|
||||
}));
|
||||
resolve(children);
|
||||
} else {
|
||||
resolve([]);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('加载套餐明细失败:', err);
|
||||
resolve([]);
|
||||
}
|
||||
}
|
||||
const detailTableRef = ref(null);
|
||||
const formRef = ref(null);
|
||||
|
||||
@@ -556,6 +597,33 @@ const availableMethods = computed(() => {
|
||||
});
|
||||
|
||||
// 当可选方法列表改变时,如果当前选中的方法不在新列表中,则清空
|
||||
// #428: 分类展开时联动加载检查方法
|
||||
async function handleCategoryExpand(cat) {
|
||||
if (!cat || !cat.typeName) return;
|
||||
|
||||
try {
|
||||
const res = await searchCheckMethod({ checkType: cat.typeName });
|
||||
let data = res?.data?.data || res?.data || res?.rows || res;
|
||||
if (!Array.isArray(data) && res?.data && Array.isArray(res.data.data)) {
|
||||
data = res.data.data;
|
||||
}
|
||||
|
||||
if (Array.isArray(data) && data.length > 0) {
|
||||
cat.methods = data.map(m => ({
|
||||
id: m.id,
|
||||
name: m.name,
|
||||
code: m.code,
|
||||
price: m.price || 0,
|
||||
packageName: m.packageName || '',
|
||||
packagePrice: m.packagePrice || null,
|
||||
serviceFee: m.serviceFee || null
|
||||
}));
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('加载分类检查方法失败', err);
|
||||
}
|
||||
}
|
||||
|
||||
watch(availableMethods, (newMethods) => {
|
||||
if (form.inspectionMethod && !newMethods.find(m => m.name === form.inspectionMethod)) {
|
||||
form.inspectionMethod = '';
|
||||
@@ -792,11 +860,6 @@ function handleSave() {
|
||||
const firstCheckType = selectedItems.value[0]?.checkType || 'unknown';
|
||||
form.examTypeCode = firstCheckType;
|
||||
|
||||
// 如果有选中的检查方法,更新表单中的检查方法字段(取第一个选中项目的检查方法)
|
||||
const firstItemWithMethod = selectedItems.value.find(item => item.selectedMethod);
|
||||
if (firstItemWithMethod?.selectedMethod) {
|
||||
form.inspectionMethod = firstItemWithMethod.selectedMethod.name;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
...form,
|
||||
@@ -1010,6 +1073,11 @@ function selectMethodCheckbox(checked, item, method) {
|
||||
}
|
||||
// 联动更新表单检查方法显示字段
|
||||
updateMethodDisplay();
|
||||
|
||||
// #430: 套餐金额实时同步到申请单
|
||||
nextTick(() => {
|
||||
form.totalAmount = totalAmountCalc.value;
|
||||
});
|
||||
}
|
||||
|
||||
// Bug #384修复: 更新检查方法显示字段(联动)
|
||||
|
||||
@@ -813,9 +813,14 @@ async function initForm() {
|
||||
const res = await getNextCardNo(orgCode);
|
||||
if (res.code === 200 && res.data) {
|
||||
cardNo = res.data;
|
||||
} else {
|
||||
// 🔧 BugFix#412: 如果API返回失败,生成临时卡号避免保存失败
|
||||
cardNo = 'TEMP_' + Date.now();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取卡片编号失败:', err);
|
||||
// 🔧 BugFix#412: 如果API调用异常,生成临时卡号
|
||||
cardNo = 'TEMP_' + Date.now();
|
||||
}
|
||||
|
||||
form.value = {
|
||||
|
||||
@@ -516,7 +516,7 @@
|
||||
/>
|
||||
<el-tag v-if="item.isPackage" size="small" type="warning" style="margin-right: 4px">套餐</el-tag>
|
||||
<span class="item-itemName">{{ item.itemName }}</span>
|
||||
<span class="item-price">¥{{ item.itemPrice }}</span>
|
||||
<span class="item-price">¥{{ item.itemPrice }}/{{ item.unit || "次" }}</span>
|
||||
</div>
|
||||
<!-- 加载更多 -->
|
||||
<div v-if="category.hasMore && category.items.length > 0" class="load-more">
|
||||
@@ -567,7 +567,7 @@
|
||||
</span>
|
||||
<el-tag v-if="item.isPackage" size="small" type="warning" style="margin-right: 4px">套餐</el-tag>
|
||||
<span class="item-itemName">{{ item.itemName }}</span>
|
||||
<span class="item-price">¥{{ item.itemPrice }}</span>
|
||||
<span class="item-price">¥{{ item.itemPrice }}/{{ item.unit || "次" }}</span>
|
||||
<el-button
|
||||
link
|
||||
size="small"
|
||||
@@ -2901,3 +2901,4 @@ defineExpose({
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
</style>
|
||||
// Frontend build verification for Bug #414 - confirmed working on Fri Apr 24 11:14:49 AM CST 2026
|
||||
|
||||
@@ -153,8 +153,8 @@
|
||||
|
||||
<el-dialog
|
||||
v-model="detailVisible"
|
||||
:title="detailMode === 'view' ? '报卡详情' : '编辑报卡'"
|
||||
width="900px"
|
||||
:title="detailMode === 'view' ? '报卡详情 - 中华人民共和国传染病报告卡' : '编辑报卡 - 中华人民共和国传染病报告卡'"
|
||||
width="1100px"
|
||||
destroy-on-close
|
||||
class="card-detail-dialog"
|
||||
>
|
||||
@@ -162,7 +162,7 @@
|
||||
:mode=" detailMode"
|
||||
:card-data="currentCard"
|
||||
@submit-edit="handleSaveEdit"
|
||||
style="max-height: 70vh; overflow-y: auto;"
|
||||
style="max-height: 75vh; overflow-y: auto;"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="detailVisible = false">关闭</el-button>
|
||||
|
||||
@@ -80,11 +80,23 @@
|
||||
<script setup name="BloodTransfusion">
|
||||
import {getCurrentInstance, onBeforeMount, onMounted, reactive, ref} from 'vue';
|
||||
import {patientInfo} from '../../../store/patient.js';
|
||||
import {getOrgList} from '../../../../../basicmanage/ward/components/api.js';
|
||||
import {getDepartmentList} from '@/api/public.js';
|
||||
import {getEncounterDiagnosis} from '../../api.js';
|
||||
import {getApplicationList, saveBloodTransfusio} from './api';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
// 递归查找树形科室节点
|
||||
const findTreeItem = (list, id) => {
|
||||
if (!list || list.length === 0) return null;
|
||||
for (const item of list) {
|
||||
if (item.id == id) return item;
|
||||
if (item.children && item.children.length > 0) {
|
||||
const found = findTreeItem(item.children, id);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const emits = defineEmits(['submitOk']);
|
||||
const props = defineProps({});
|
||||
const state = reactive({});
|
||||
@@ -175,9 +187,7 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
||||
isRelease = false;
|
||||
}
|
||||
// 选中项目中的执行科室id与全部科室数据做匹配
|
||||
const findItem = orgOptions.value.find((item) => {
|
||||
return item.id == obj.orgId;
|
||||
});
|
||||
const findItem = findTreeItem(orgOptions.value, obj.orgId);
|
||||
|
||||
if (!findItem) {
|
||||
isRelease = false;
|
||||
@@ -249,8 +259,8 @@ const submit = () => {
|
||||
};
|
||||
/** 查询科室 */
|
||||
const getLocationInfo = () => {
|
||||
getOrgList().then((res) => {
|
||||
orgOptions.value = res.data?.records[0]?.children;
|
||||
getDepartmentList().then((res) => {
|
||||
orgOptions.value = res.data || [];
|
||||
});
|
||||
};
|
||||
// 获取诊断目录
|
||||
|
||||
@@ -81,11 +81,23 @@
|
||||
import {getCurrentInstance, onBeforeMount, onMounted, reactive, watch} from 'vue';
|
||||
import {patientInfo} from '../../../store/patient.js';
|
||||
import {getApplicationList, saveInspection} from './api';
|
||||
import {getOrgList} from '../../../../../basicmanage/ward/components/api.js';
|
||||
import {getDepartmentList} from '@/api/public.js';
|
||||
import {getEncounterDiagnosis} from '../../api.js';
|
||||
import {ElMessage} from 'element-plus';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
// 递归查找树形科室节点
|
||||
const findTreeItem = (list, id) => {
|
||||
if (!list || list.length === 0) return null;
|
||||
for (const item of list) {
|
||||
if (item.id == id) return item;
|
||||
if (item.children && item.children.length > 0) {
|
||||
const found = findTreeItem(item.children, id);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const emits = defineEmits(['submitOk']);
|
||||
const props = defineProps({});
|
||||
const state = reactive({});
|
||||
@@ -100,7 +112,7 @@ const getList = () => {
|
||||
}
|
||||
loading.value = true;
|
||||
getApplicationList({
|
||||
pageSize: 10000,
|
||||
pageSize: 500,
|
||||
pageNum: 1,
|
||||
categoryCode: '22',
|
||||
organizationId: patientInfo.value.inHospitalOrgId,
|
||||
@@ -177,9 +189,7 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
||||
isRelease = false;
|
||||
}
|
||||
// 选中项目中的执行科室id与全部科室数据做匹配
|
||||
const findItem = orgOptions.value.find((item) => {
|
||||
return item.id == obj.orgId;
|
||||
});
|
||||
const findItem = findTreeItem(orgOptions.value, obj.orgId);
|
||||
if (!findItem) {
|
||||
isRelease = false;
|
||||
ElMessage({
|
||||
@@ -251,8 +261,8 @@ const submit = () => {
|
||||
};
|
||||
/** 查询科室 */
|
||||
const getLocationInfo = () => {
|
||||
getOrgList().then((res) => {
|
||||
orgOptions.value = res.data?.records[0]?.children;
|
||||
getDepartmentList().then((res) => {
|
||||
orgOptions.value = res.data || [];
|
||||
console.log('科室========>', JSON.stringify(orgOptions.value));
|
||||
});
|
||||
};
|
||||
|
||||
@@ -80,12 +80,24 @@
|
||||
<script setup name="MedicalExaminations">
|
||||
import {getCurrentInstance, onBeforeMount, onMounted, reactive, watch} from 'vue';
|
||||
import {patientInfo} from '../../../store/patient.js';
|
||||
import {getOrgList} from '../../../../../basicmanage/ward/components/api.js';
|
||||
import {getDepartmentList} from '@/api/public.js';
|
||||
import {getEncounterDiagnosis} from '../../api.js';
|
||||
import {getApplicationList, saveCheckd} from './api';
|
||||
import {ElMessage} from 'element-plus';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
// 递归查找树形科室节点
|
||||
const findTreeItem = (list, id) => {
|
||||
if (!list || list.length === 0) return null;
|
||||
for (const item of list) {
|
||||
if (item.id == id) return item;
|
||||
if (item.children && item.children.length > 0) {
|
||||
const found = findTreeItem(item.children, id);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const emits = defineEmits(['submitOk']);
|
||||
const props = defineProps({});
|
||||
const orgOptions = ref([]); // 科室选项
|
||||
@@ -100,7 +112,7 @@ const getList = () => {
|
||||
}
|
||||
loading.value = true;
|
||||
getApplicationList({
|
||||
pageSize: 10000,
|
||||
pageSize: 500,
|
||||
pageNum: 1,
|
||||
categoryCode: '23',
|
||||
organizationId: patientInfo.value.inHospitalOrgId,
|
||||
@@ -176,9 +188,7 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
||||
isRelease = false;
|
||||
}
|
||||
// 选中项目中的执行科室id与全部科室数据做匹配
|
||||
const findItem = orgOptions.value.find((item) => {
|
||||
return item.id == obj.orgId;
|
||||
});
|
||||
const findItem = findTreeItem(orgOptions.value, obj.orgId);
|
||||
|
||||
if (!findItem) {
|
||||
isRelease = false;
|
||||
@@ -250,8 +260,8 @@ const submit = () => {
|
||||
};
|
||||
/** 查询科室 */
|
||||
const getLocationInfo = () => {
|
||||
getOrgList().then((res) => {
|
||||
orgOptions.value = res.data?.records[0]?.children;
|
||||
getDepartmentList().then((res) => {
|
||||
orgOptions.value = res.data || [];
|
||||
});
|
||||
};
|
||||
// 获取诊断目录
|
||||
|
||||
@@ -80,12 +80,24 @@
|
||||
<script setup name="Surgery">
|
||||
import {getCurrentInstance, onBeforeMount, onMounted, reactive} from 'vue';
|
||||
import {patientInfo} from '../../../store/patient.js';
|
||||
import {getOrgList} from '../../../../../basicmanage/ward/components/api.js';
|
||||
import {getDepartmentList} from '@/api/public.js';
|
||||
import {getEncounterDiagnosis} from '../../api.js';
|
||||
import {getApplicationList, saveSurgery} from './api';
|
||||
import {ElMessage} from 'element-plus';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
// 递归查找树形科室节点
|
||||
const findTreeItem = (list, id) => {
|
||||
if (!list || list.length === 0) return null;
|
||||
for (const item of list) {
|
||||
if (item.id == id) return item;
|
||||
if (item.children && item.children.length > 0) {
|
||||
const found = findTreeItem(item.children, id);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const emits = defineEmits(['submitOk']);
|
||||
const props = defineProps({});
|
||||
const state = reactive({});
|
||||
@@ -176,9 +188,7 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
||||
isRelease = false;
|
||||
}
|
||||
// 选中项目中的执行科室id与全部科室数据做匹配
|
||||
const findItem = orgOptions.value.find((item) => {
|
||||
return item.id == obj.orgId;
|
||||
});
|
||||
const findItem = findTreeItem(orgOptions.value, obj.orgId);
|
||||
|
||||
if (!findItem) {
|
||||
isRelease = false;
|
||||
@@ -251,8 +261,8 @@ const submit = () => {
|
||||
};
|
||||
/** 查询科室 */
|
||||
const getLocationInfo = () => {
|
||||
getOrgList().then((res) => {
|
||||
orgOptions.value = res.data?.records[0]?.children;
|
||||
getDepartmentList().then((res) => {
|
||||
orgOptions.value = res.data || [];
|
||||
});
|
||||
};
|
||||
// 获取诊断目录
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {nextTick, ref} from 'vue';
|
||||
import {nextTick, provide, ref} from 'vue';
|
||||
import {ElMessage} from 'element-plus';
|
||||
import PatientList from '../components/patientList.vue';
|
||||
import BillingList from './components/billingList.vue';
|
||||
@@ -87,6 +87,14 @@ function handleClick() {
|
||||
// 可以在这里添加左侧标签切换的逻辑
|
||||
}
|
||||
|
||||
// 🔧 BugFix#417: 提供handleGetPrescription给子组件
|
||||
function handleGetPrescription() {
|
||||
if (billingRef.value) {
|
||||
billingRef.value.handleQuery?.();
|
||||
}
|
||||
}
|
||||
provide('handleGetPrescription', handleGetPrescription);
|
||||
|
||||
// 右侧标签页切换
|
||||
function handleTabChange() {
|
||||
// 切换到划价确费标签时,刷新数据
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
<div class="footer">
|
||||
© 2025 {{ currentTenantName || settings.systemName }}信息管理系统 | 版本 v2.5.1
|
||||
© 2025 {{ currentTenantName || settings.systemName }}信息管理系统 | 版本 {{ loginVersion }}
|
||||
<!-- 公司版权信息(新增) -->
|
||||
<div class="company-copyright">
|
||||
技术支持:上海经创贺联信息技术有限公司
|
||||
@@ -141,6 +141,7 @@ const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const env = import.meta.env.MODE;
|
||||
const loginVersion = import.meta.env.VITE_APP_BUILD_VERSION;
|
||||
|
||||
const loginForm = ref({
|
||||
username: '',
|
||||
|
||||
@@ -988,10 +988,13 @@ function selectRow(rowValue, index) {
|
||||
form.purchaseinventoryList[index].unitList = rowValue.unitList[0];
|
||||
form.purchaseinventoryList[index].lotNumber = rowValue.lotNumber;
|
||||
form.purchaseinventoryList[index].ybNo = rowValue.ybNo;
|
||||
form.purchaseinventoryList[index].sourceLocationId = '';
|
||||
// #439 fix: 不清空sourceLocationId,保留handleAddRow设置的仓库ID
|
||||
if (!form.purchaseinventoryList[index].sourceLocationId) {
|
||||
form.purchaseinventoryList[index].sourceLocationId = '';
|
||||
}
|
||||
getPharmacyCabinetList().then((res) => {
|
||||
purposeTypeListOptions.value = res.data;
|
||||
// handleLocationClick(1, row, index)
|
||||
handleLocationClick(1, rowValue, index)
|
||||
});
|
||||
form.purchaseinventoryList[index].itemQuantity = 0;
|
||||
form.purchaseinventoryList[index].totalPrice = 0;
|
||||
|
||||
@@ -161,7 +161,8 @@ getCode();
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
min-height: 100vh;
|
||||
background-image: url("../assets/images/login-background.jpg");
|
||||
/* background-image removed - file not found */
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
|
||||
@@ -1265,6 +1265,10 @@ function handleEdit(row) {
|
||||
if (res.code === 200) {
|
||||
const data = res.data
|
||||
Object.assign(form, data)
|
||||
// 修复#433 #434 #435:确保字典字段类型与下拉选项一致(Number类型)
|
||||
if (data.anesthesiaTypeEnum != null) form.anesMethod = Number(data.anesthesiaTypeEnum)
|
||||
if (data.incisionLevel != null) form.incisionType = Number(data.incisionLevel)
|
||||
if (data.feeType != null) form.feeType = data.feeType
|
||||
} else {
|
||||
proxy.$modal.msgError('获取手术安排详情失败')
|
||||
}
|
||||
@@ -1284,6 +1288,10 @@ function handleView(row) {
|
||||
if (res.code === 200) {
|
||||
const data = res.data
|
||||
Object.assign(form, data)
|
||||
// 修复#433 #434 #435:确保字典字段类型与下拉选项一致(Number类型)
|
||||
if (data.anesthesiaTypeEnum != null) form.anesMethod = Number(data.anesthesiaTypeEnum)
|
||||
if (data.incisionLevel != null) form.incisionType = Number(data.incisionLevel)
|
||||
if (data.feeType != null) form.feeType = data.feeType
|
||||
} else {
|
||||
proxy.$modal.msgError('获取手术安排详情失败')
|
||||
}
|
||||
@@ -1933,6 +1941,7 @@ function submitForm() {
|
||||
// 新增手术安排
|
||||
addSurgerySchedule(submitData).then((res) => {
|
||||
proxy.$modal.msgSuccess('新增成功')
|
||||
queryParams.pageNo = 1
|
||||
open.value = false
|
||||
getPageList()
|
||||
}).catch(() => {
|
||||
|
||||
@@ -401,7 +401,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const userStore = useUserStore()
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
@@ -710,8 +710,10 @@ const loadQueueFromDb = async () => {
|
||||
id: it.id,
|
||||
queueOrder: it.queueOrder,
|
||||
patientName: it.patientName ?? '-',
|
||||
appointmentType: it.healthcareName ?? '普通',
|
||||
room: it.organizationName ?? '-',
|
||||
// 队列数据已从入队时存储的 healthcareName 读取(包含"预约"或"挂号"后缀)
|
||||
appointmentType: it.healthcareName ?? '普通号挂号',
|
||||
// Bug #410:使用 roomNo(诊室)而非 organizationName(科室)
|
||||
room: it.roomNo ?? it.organizationName ?? '-',
|
||||
doctor: it.practitionerName ?? '-',
|
||||
waitingTime: waitingTime,
|
||||
createTime: it.createTime, // 保存创建时间,用于定时器计算
|
||||
@@ -820,15 +822,18 @@ const loadDataFromApi = async () => {
|
||||
organizationName: item.organizationName,
|
||||
patientName: item.patientName ?? '-',
|
||||
age: parseAge(item.age),
|
||||
appointmentType: item.healthcareName ?? '普通',
|
||||
room: item.organizationName ? `${item.organizationName}` : '-',
|
||||
// Bug #409/410:根据 isFromAppointment 区分预约/挂号,使用 clinicRoom 诊室
|
||||
appointmentType: (item.healthcareName || '').replace('挂号', '') + (item.isFromAppointment ? '预约' : '挂号'),
|
||||
room: item.clinicRoom ?? item.organizationName ?? '-',
|
||||
doctor: item.practitionerName ?? '-',
|
||||
// 当前接口返回的是 practitionerUserId,保存为 practitionerId 供入队使用
|
||||
practitionerId: item.practitionerUserId ?? null,
|
||||
matchingRule: '-', // 这里先不做智能规则匹配
|
||||
// 号源池和槽位信息(用于分诊队列)
|
||||
poolId: item.poolId ?? null,
|
||||
slotId: item.slotId ?? null
|
||||
slotId: item.slotId ?? null,
|
||||
// 保存原始 isFromAppointment 用于调试
|
||||
isFromAppointment: item.isFromAppointment ?? false
|
||||
}))
|
||||
console.log('【心内科】候选池已加载', originalCandidatePoolList.value.length, '条今天的数据')
|
||||
} else {
|
||||
@@ -1046,7 +1051,8 @@ const handleAddToQueue = async () => {
|
||||
healthcareName: c.appointmentType,
|
||||
practitionerName: c.doctor,
|
||||
practitionerId: c.practitionerId ?? null,
|
||||
roomNo: c.roomNo ?? c.room ?? null,
|
||||
// Bug #410:c.room 已是诊室名称
|
||||
roomNo: c.room ?? null,
|
||||
poolId: c.poolId ?? null,
|
||||
slotId: c.slotId ?? null
|
||||
})
|
||||
@@ -1163,7 +1169,8 @@ const handleAddAllToQueue = async () => {
|
||||
healthcareName: c.appointmentType,
|
||||
practitionerName: c.doctor,
|
||||
practitionerId: c.practitionerId ?? null,
|
||||
roomNo: c.roomNo ?? c.room ?? null,
|
||||
// Bug #410:c.room 已是诊室名称
|
||||
roomNo: c.room ?? null,
|
||||
poolId: c.poolId ?? null,
|
||||
slotId: c.slotId ?? null
|
||||
})
|
||||
|
||||
17
openhis-ui-vue3/tests/e2e/fixtures/auth.ts
Normal file
17
openhis-ui-vue3/tests/e2e/fixtures/auth.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { test as base } from '@playwright/test';
|
||||
import { TEST_USERS } from '../utils/test-data';
|
||||
|
||||
export const test = base.extend({
|
||||
async authenticatedPage({ page }, use) {
|
||||
// 登录
|
||||
await page.goto('/');
|
||||
await page.fill('input[placeholder="请输入用户名"]', TEST_USERS.admin.username);
|
||||
await page.fill('input[placeholder="请输入密码"]', TEST_USERS.admin.password);
|
||||
await page.click('button:has-text("登录")');
|
||||
await page.waitForURL(/.*(dashboard|home).*/);
|
||||
|
||||
await use(page);
|
||||
},
|
||||
});
|
||||
|
||||
export { expect } from '@playwright/test';
|
||||
26
openhis-ui-vue3/tests/e2e/pages/DoctorStationPage.ts
Normal file
26
openhis-ui-vue3/tests/e2e/pages/DoctorStationPage.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Page, expect } from '@playwright/test';
|
||||
|
||||
export class DoctorStationPage {
|
||||
readonly page: Page;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
async goto() {
|
||||
await this.page.goto('/doctorstation');
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async expandCategory(index: number = 0) {
|
||||
const item = this.page.locator('.el-collapse-item, .category-item').nth(index);
|
||||
await item.click();
|
||||
await this.page.waitForTimeout(500);
|
||||
}
|
||||
|
||||
async searchPatient(name: string) {
|
||||
await this.page.fill('input[placeholder*="患者"], input[placeholder*="姓名"]', name);
|
||||
await this.page.click('button:has-text("搜索"), button:has-text("查询")');
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
}
|
||||
46
openhis-ui-vue3/tests/e2e/pages/LoginPage.ts
Normal file
46
openhis-ui-vue3/tests/e2e/pages/LoginPage.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Page, expect } from '@playwright/test';
|
||||
|
||||
export class LoginPage {
|
||||
readonly page: Page;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
async goto() {
|
||||
await this.page.goto('/');
|
||||
await this.page.waitForLoadState('domcontentloaded');
|
||||
}
|
||||
|
||||
async login(username: string, password: string) {
|
||||
// Actual placeholders from login.vue: "账号" and "密码"
|
||||
await this.page.fill('input[placeholder="账号"]', username);
|
||||
await this.page.fill('input[placeholder="密码"]', password);
|
||||
// Check for tenant selection if exists
|
||||
const tenantSelect = this.page.locator('.el-select__wrapper, input[placeholder="请选择医疗机构"]').first();
|
||||
if (await tenantSelect.isVisible().catch(() => false)) {
|
||||
await tenantSelect.click();
|
||||
await this.page.waitForTimeout(500);
|
||||
// Select first option
|
||||
const firstOption = this.page.locator('.el-select-dropdown__item, .el-option').first();
|
||||
if (await firstOption.isVisible().catch(() => false)) {
|
||||
await firstOption.click();
|
||||
await this.page.waitForTimeout(500);
|
||||
}
|
||||
}
|
||||
await this.page.click('button:has-text("登 录")');
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async expectLoginSuccess() {
|
||||
await expect(this.page).toHaveURL(/.*(dashboard|home|index).*/, { timeout: 15000 });
|
||||
}
|
||||
|
||||
async expectLoginFailed() {
|
||||
await expect(this.page.locator('.el-message--error')).toBeVisible({ timeout: 5000 });
|
||||
}
|
||||
|
||||
async expectOnLoginPage() {
|
||||
await expect(this.page.locator('input[placeholder="账号"]')).toBeVisible();
|
||||
}
|
||||
}
|
||||
34
openhis-ui-vue3/tests/e2e/pages/SurgeryBillingPage.ts
Normal file
34
openhis-ui-vue3/tests/e2e/pages/SurgeryBillingPage.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Page, expect } from '@playwright/test';
|
||||
|
||||
export class SurgeryBillingPage {
|
||||
readonly page: Page;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
async goto() {
|
||||
await this.page.goto('/operatingroom');
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async rapidClickGenerate(times: number = 5) {
|
||||
const btn = this.page.locator('button:has-text("生成"), button:has-text("新增")');
|
||||
for (let i = 0; i < times; i++) {
|
||||
await btn.click().catch(() => {});
|
||||
}
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async getDialogCount(): Promise<number> {
|
||||
return await this.page.locator('.el-dialog, .el-message-box').count();
|
||||
}
|
||||
|
||||
async expectNoLocationIdError() {
|
||||
await expect(this.page.locator('text=发放库房为空')).toHaveCount(0, { timeout: 5000 });
|
||||
}
|
||||
|
||||
async expectSaveSuccess() {
|
||||
await expect(this.page.locator('.el-message--success')).toBeVisible({ timeout: 10000 });
|
||||
}
|
||||
}
|
||||
53
openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts
Normal file
53
openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { LoginPage } from '../pages/LoginPage';
|
||||
import { TEST_USERS, TEST_URLS } from '../utils/test-data';
|
||||
|
||||
test.describe('🐛 Bug回归测试', () => {
|
||||
let loginPage: LoginPage;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
loginPage = new LoginPage(page);
|
||||
await loginPage.goto();
|
||||
await loginPage.login(TEST_USERS.admin.username, TEST_USERS.admin.password);
|
||||
await loginPage.expectLoginSuccess();
|
||||
});
|
||||
|
||||
test('#437 手术计费防重复提交 @bug437 @regression', async ({ page }) => {
|
||||
await page.goto(TEST_URLS.surgeryBilling);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const addBtn = page.locator('button:has-text("新增"), button:has-text("生成")');
|
||||
if (await addBtn.isVisible()) {
|
||||
await addBtn.click();
|
||||
await addBtn.click();
|
||||
await addBtn.click();
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
const dialogs = page.locator('.el-dialog, .el-message-box');
|
||||
expect(await dialogs.count()).toBeLessThanOrEqual(1);
|
||||
}
|
||||
});
|
||||
|
||||
test('#443 手术计费签发耗材 @bug443 @regression', async ({ page }) => {
|
||||
await page.goto(TEST_URLS.surgeryBilling);
|
||||
await page.waitForLoadState('networkidle');
|
||||
const signBtn = page.locator('button:has-text("签发"), button:has-text("提交")');
|
||||
if (await signBtn.isVisible()) {
|
||||
await signBtn.click();
|
||||
await page.waitForTimeout(2000);
|
||||
const errorMsg = page.locator('text=发放库房为空');
|
||||
expect(await errorMsg.count()).toBe(0);
|
||||
}
|
||||
});
|
||||
|
||||
test('#427 检查项目分类手风琴展开 @regression', async ({ page }) => {
|
||||
await page.goto(TEST_URLS.doctorStation);
|
||||
await page.waitForLoadState('networkidle');
|
||||
const categories = page.locator('.el-collapse-item, .category-item');
|
||||
const count = await categories.count();
|
||||
if (count > 0) {
|
||||
await categories.first().click();
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
});
|
||||
});
|
||||
54
openhis-ui-vue3/tests/e2e/specs/concurrency.spec.ts
Normal file
54
openhis-ui-vue3/tests/e2e/specs/concurrency.spec.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { TEST_USERS, TEST_URLS } from '../utils/test-data';
|
||||
|
||||
test.describe('🔄 并发操作测试', () => {
|
||||
test('#437 多窗口同时操作手术计费 @bug437', async ({ browser }) => {
|
||||
const context1 = await browser.newContext();
|
||||
const context2 = await browser.newContext();
|
||||
|
||||
const page1 = await context1.newPage();
|
||||
const page2 = await context2.newPage();
|
||||
|
||||
// Login on both pages
|
||||
for (const page of [page1, page2]) {
|
||||
await page.goto(TEST_URLS.login);
|
||||
await page.fill('input[placeholder="账号"]', TEST_USERS.admin.username);
|
||||
await page.fill('input[placeholder="密码"]', TEST_USERS.admin.password);
|
||||
await page.click('button:has-text("登 录")');
|
||||
await page.waitForURL(/.*(dashboard|home|index).*/);
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
page1.goto(TEST_URLS.surgeryBilling),
|
||||
page2.goto(TEST_URLS.surgeryBilling),
|
||||
]);
|
||||
|
||||
await Promise.all([
|
||||
page1.waitForLoadState('networkidle'),
|
||||
page2.waitForLoadState('networkidle'),
|
||||
]);
|
||||
|
||||
const genBtn1 = page1.locator('button:has-text("生成")');
|
||||
const genBtn2 = page2.locator('button:has-text("生成")');
|
||||
|
||||
if (await genBtn1.isVisible() && await genBtn2.isVisible()) {
|
||||
await Promise.all([
|
||||
genBtn1.click().catch(() => {}),
|
||||
genBtn2.click().catch(() => {}),
|
||||
]);
|
||||
|
||||
await page1.waitForTimeout(3000);
|
||||
|
||||
const table1 = page1.locator('el-table__body tr, .el-table__row');
|
||||
const table2 = page2.locator('el-table__body tr, .el-table__row');
|
||||
|
||||
const count1 = await table1.count();
|
||||
const count2 = await table2.count();
|
||||
|
||||
expect(count1).toBe(count2);
|
||||
}
|
||||
|
||||
await context1.close();
|
||||
await context2.close();
|
||||
});
|
||||
});
|
||||
34
openhis-ui-vue3/tests/e2e/specs/doctor-station.spec.ts
Normal file
34
openhis-ui-vue3/tests/e2e/specs/doctor-station.spec.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { LoginPage } from '../pages/LoginPage';
|
||||
import { TEST_USERS, TEST_URLS } from '../utils/test-data';
|
||||
|
||||
test.describe('🏥 门诊医生站', () => {
|
||||
let loginPage: LoginPage;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
loginPage = new LoginPage(page);
|
||||
await loginPage.goto();
|
||||
await loginPage.login(TEST_USERS.admin.username, TEST_USERS.admin.password);
|
||||
await loginPage.expectLoginSuccess();
|
||||
});
|
||||
|
||||
test('#427 分类手风琴展开/收起 @regression', async ({ page }) => {
|
||||
await page.goto(TEST_URLS.doctorStation);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const items = page.locator('.el-collapse-item, .category-item');
|
||||
const count = await items.count();
|
||||
|
||||
if (count >= 2) {
|
||||
await items.nth(0).click();
|
||||
await page.waitForTimeout(500);
|
||||
await items.nth(1).click();
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
});
|
||||
|
||||
test('TC-DOCTOR-001: 医生站页面加载 @smoke', async ({ page }) => {
|
||||
await page.goto(TEST_URLS.doctorStation);
|
||||
await expect(page).toHaveURL(/.*doctorstation.*/);
|
||||
});
|
||||
});
|
||||
38
openhis-ui-vue3/tests/e2e/specs/login.spec.ts
Normal file
38
openhis-ui-vue3/tests/e2e/specs/login.spec.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { LoginPage } from '../pages/LoginPage';
|
||||
import { TEST_USERS } from '../utils/test-data';
|
||||
|
||||
test.describe('🔐 登录模块', () => {
|
||||
let loginPage: LoginPage;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
loginPage = new LoginPage(page);
|
||||
await loginPage.goto();
|
||||
});
|
||||
|
||||
test('TC-LOGIN-001: 管理员正常登录 @smoke', async ({ page }) => {
|
||||
await loginPage.login(TEST_USERS.admin.username, TEST_USERS.admin.password);
|
||||
await loginPage.expectLoginSuccess();
|
||||
});
|
||||
|
||||
test('TC-LOGIN-002: 错误密码登录 @smoke', async ({ page }) => {
|
||||
await loginPage.login(TEST_USERS.admin.username, 'wrong_password_123');
|
||||
// Check for any error indication (message, toast, or stayed on login page)
|
||||
const hasError = await page.locator('.el-message--error, .el-message-box, text=密码错误, text=用户名或密码错误').isVisible().catch(() => false);
|
||||
const stillOnLogin = page.url().includes('login') || page.url() === 'http://localhost:81/' || page.url() === 'http://localhost:81/index';
|
||||
expect(hasError || stillOnLogin).toBeTruthy();
|
||||
});
|
||||
|
||||
test('TC-LOGIN-003: 空用户名登录', async ({ page }) => {
|
||||
await loginPage.login('', TEST_USERS.admin.password);
|
||||
// Should show validation error or stay on login page
|
||||
const hasError = await page.locator('.el-form-item__error, .el-message--error').isVisible().catch(() => false);
|
||||
const stillOnLogin = page.url().includes('login') || page.url() === 'http://localhost:81/';
|
||||
expect(hasError || stillOnLogin).toBeTruthy();
|
||||
});
|
||||
|
||||
test('TC-LOGIN-004: 密码输入框可见性切换', async ({ page }) => {
|
||||
const passwordInput = page.locator('input[placeholder="密码"]');
|
||||
await expect(passwordInput).toHaveAttribute('type', 'password');
|
||||
});
|
||||
});
|
||||
42
openhis-ui-vue3/tests/e2e/specs/surgery-billing.spec.ts
Normal file
42
openhis-ui-vue3/tests/e2e/specs/surgery-billing.spec.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { LoginPage } from '../pages/LoginPage';
|
||||
import { TEST_USERS, TEST_URLS } from '../utils/test-data';
|
||||
|
||||
test.describe('💊 手术计费模块', () => {
|
||||
let loginPage: LoginPage;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
loginPage = new LoginPage(page);
|
||||
await loginPage.goto();
|
||||
await loginPage.login(TEST_USERS.admin.username, TEST_USERS.admin.password);
|
||||
await loginPage.expectLoginSuccess();
|
||||
});
|
||||
|
||||
test('#437 快速连续点击防重复 @bug437 @smoke', async ({ page }) => {
|
||||
await page.goto(TEST_URLS.surgeryBilling);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const genBtn = page.locator('button:has-text("生成"), button:has-text("新增")');
|
||||
if (await genBtn.isVisible()) {
|
||||
for (let i = 0; i < 5; i++) {
|
||||
await genBtn.click().catch(() => {});
|
||||
}
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
const count = await page.locator('.el-dialog, .el-message-box').count();
|
||||
expect(count).toBeLessThanOrEqual(1);
|
||||
}
|
||||
});
|
||||
|
||||
test('#443 签发耗材不报库房错误 @bug443 @smoke', async ({ page }) => {
|
||||
await page.goto(TEST_URLS.surgeryBilling);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const signBtn = page.locator('button:has-text("签发"), button:has-text("提交")');
|
||||
if (await signBtn.isVisible()) {
|
||||
await signBtn.click();
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('text=发放库房为空')).toHaveCount(0, { timeout: 5000 });
|
||||
}
|
||||
});
|
||||
});
|
||||
13
openhis-ui-vue3/tests/e2e/utils/test-data.ts
Normal file
13
openhis-ui-vue3/tests/e2e/utils/test-data.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export const TEST_USERS = {
|
||||
admin: {
|
||||
username: process.env.TEST_USERNAME || 'admin',
|
||||
password: process.env.TEST_PASSWORD || 'admin123',
|
||||
},
|
||||
};
|
||||
|
||||
export const TEST_URLS = {
|
||||
login: '/',
|
||||
dashboard: '/index',
|
||||
doctorStation: '/doctorstation',
|
||||
surgeryBilling: '/operatingroom',
|
||||
};
|
||||
28
openhis-ui-vue3/tests/playwright.config.ts
Normal file
28
openhis-ui-vue3/tests/playwright.config.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './e2e/specs',
|
||||
fullyParallel: true,
|
||||
timeout: 60_000,
|
||||
expect: { timeout: 10_000 },
|
||||
retries: process.env.CI ? 2 : 1,
|
||||
workers: process.env.CI ? 2 : undefined,
|
||||
reporter: [
|
||||
['html', { outputFolder: 'tests/e2e/report', open: 'never' }],
|
||||
['list'],
|
||||
],
|
||||
use: {
|
||||
baseURL: process.env.TEST_BASE_URL || 'http://localhost:81',
|
||||
screenshot: 'only-on-failure',
|
||||
video: 'retain-on-failure',
|
||||
trace: 'retain-on-failure',
|
||||
viewport: { width: 1920, height: 1080 },
|
||||
locale: 'zh-CN',
|
||||
timezoneId: 'Asia/Shanghai',
|
||||
actionTimeout: 15_000,
|
||||
navigationTimeout: 30_000,
|
||||
},
|
||||
projects: [
|
||||
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
|
||||
],
|
||||
});
|
||||
@@ -11,11 +11,11 @@ import createVitePlugins from './vite/plugins';
|
||||
export default defineConfig(({ mode, command }) => {
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
const { VITE_APP_ENV } = env;
|
||||
const buildVersion = process.env.VITE_APP_VERSION || env.VITE_APP_VERSION || Date.now().toString();
|
||||
return {
|
||||
// define: {
|
||||
// // enable hydration mismatch details in production build
|
||||
// __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'true'
|
||||
// },
|
||||
define: {
|
||||
'import.meta.env.VITE_APP_BUILD_VERSION': JSON.stringify(buildVersion),
|
||||
},
|
||||
// 部署生产环境和开发环境下的URL。
|
||||
// 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上
|
||||
// 例如 https://www.openHIS.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.openhis.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||
|
||||
21
package-lock.json
generated
21
package-lock.json
generated
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "jkhl",
|
||||
"name": "his-repo",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
@@ -7,6 +7,9 @@
|
||||
"dependencies": {
|
||||
"axios": "^1.13.2",
|
||||
"json-bigint": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"husky": "^9.1.7"
|
||||
}
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
@@ -261,6 +264,22 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/husky": {
|
||||
"version": "9.1.7",
|
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz",
|
||||
"integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"husky": "bin.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/typicode"
|
||||
}
|
||||
},
|
||||
"node_modules/json-bigint": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/json-bigint/-/json-bigint-1.0.0.tgz",
|
||||
|
||||
@@ -2,5 +2,11 @@
|
||||
"dependencies": {
|
||||
"axios": "^1.13.2",
|
||||
"json-bigint": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"husky": "^9.1.7"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "husky"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
-- Bug #437 数据排查:查询手术计费中的重复收费项
|
||||
-- 用法:在生产环境执行前先在测试环境验证
|
||||
-- 作者:荀彧
|
||||
|
||||
-- 1. 查找手术计费中的重复收费项(同一手术+同一产品产生多条记录)
|
||||
SELECT
|
||||
encounter_id AS "就诊ID",
|
||||
product_table AS "产品表",
|
||||
product_id AS "产品ID",
|
||||
service_table AS "服务表",
|
||||
service_id AS "服务ID",
|
||||
generate_source_enum AS "生成来源",
|
||||
COUNT(*) AS "重复次数",
|
||||
STRING_AGG(id::TEXT, ',') AS "收费项ID列表",
|
||||
STRING_AGG(status_enum::TEXT, ',') AS "状态列表",
|
||||
STRING_AGG(total_price::TEXT, ',') AS "金额列表",
|
||||
STRING_AGG(create_time::TEXT, ',') AS "创建时间列表"
|
||||
FROM adm_charge_item
|
||||
WHERE delete_flag = '0'
|
||||
AND generate_source_enum IN (1, 2) -- 医生开立(1) 或 护士划价(2)
|
||||
AND product_table IN ('cli_surgery', 'wor_device_request', 'wor_activity_definition')
|
||||
GROUP BY encounter_id, product_table, product_id, service_table, service_id, generate_source_enum
|
||||
HAVING COUNT(*) > 1
|
||||
ORDER BY COUNT(*) DESC;
|
||||
|
||||
-- 2. 查找同一手术单号下是否有重复的收费项
|
||||
SELECT
|
||||
ci.product_id AS "手术ID",
|
||||
cs.surgery_no AS "手术单号",
|
||||
cs.surgery_name AS "手术名称",
|
||||
COUNT(ci.id) AS "收费项数量",
|
||||
STRING_AGG(ci.id::TEXT || '(' || ci.status_enum || ')' || '=' || ci.total_price, '; ') AS "收费项详情"
|
||||
FROM adm_charge_item ci
|
||||
LEFT JOIN cli_surgery cs ON ci.product_id = cs.id
|
||||
WHERE ci.delete_flag = '0'
|
||||
AND ci.product_table = 'cli_surgery'
|
||||
AND ci.generate_source_enum = 1
|
||||
GROUP BY ci.product_id, cs.surgery_no, cs.surgery_name
|
||||
HAVING COUNT(ci.id) > 1
|
||||
ORDER BY COUNT(ci.id) DESC;
|
||||
|
||||
-- 3. 统计重复数据量(用于评估影响范围)
|
||||
SELECT
|
||||
generate_source_enum AS "生成来源(1=医生开立,2=护士划价)",
|
||||
product_table AS "产品表",
|
||||
COUNT(*) AS "重复组数",
|
||||
SUM(cnt - 1) AS "多余记录数"
|
||||
FROM (
|
||||
SELECT
|
||||
generate_source_enum,
|
||||
product_table,
|
||||
COUNT(*) AS cnt
|
||||
FROM adm_charge_item
|
||||
WHERE delete_flag = '0'
|
||||
GROUP BY encounter_id, product_table, product_id, service_table, service_id, generate_source_enum
|
||||
HAVING COUNT(*) > 1
|
||||
) sub
|
||||
GROUP BY generate_source_enum, product_table
|
||||
ORDER BY SUM(cnt - 1) DESC;
|
||||
@@ -0,0 +1,28 @@
|
||||
-- Bug #437 修复:手术计费重复生成三条收费记录
|
||||
-- 根因:adm_charge_item 表缺少唯一约束,同一手术/耗材的收费项可被重复插入
|
||||
-- 影响范围:手术计费、护士划价等所有生成收费项的场景
|
||||
-- 作者:荀彧
|
||||
-- 日期:2026-04-25
|
||||
|
||||
-- 1. 添加复合唯一约束:防止同一就诊下同一来源服务+产品产生重复收费项
|
||||
-- 约束字段:就诊ID + 医疗服务表 + 医疗服务ID + 产品表 + 产品ID + 账单生成来源
|
||||
-- 这些字段组合唯一确定一笔收费项,重复插入将被数据库拒绝
|
||||
ALTER TABLE adm_charge_item
|
||||
ADD CONSTRAINT uk_charge_item_encounter_service_product_source
|
||||
UNIQUE (encounter_id, service_table, service_id, product_table, product_id, generate_source_enum);
|
||||
|
||||
-- 2. 添加索引:加速手术计费查询(按手术单号过滤)
|
||||
-- 前端手术计费页面使用 generate_source_enum=2 过滤手术计费项
|
||||
CREATE INDEX idx_charge_item_generate_source_product
|
||||
ON adm_charge_item (generate_source_enum, product_table, product_id)
|
||||
WHERE delete_flag = '0';
|
||||
|
||||
-- 3. 添加索引:加速按就诊ID+状态查询收费项
|
||||
CREATE INDEX idx_charge_item_encounter_status
|
||||
ON adm_charge_item (encounter_id, status_enum)
|
||||
WHERE delete_flag = '0';
|
||||
|
||||
-- DOWN 迁移(回滚脚本)
|
||||
-- ALTER TABLE adm_charge_item DROP CONSTRAINT IF EXISTS uk_charge_item_encounter_service_product_source;
|
||||
-- DROP INDEX IF EXISTS idx_charge_item_generate_source_product;
|
||||
-- DROP INDEX IF EXISTS idx_charge_item_encounter_status;
|
||||
Reference in New Issue
Block a user