Compare commits
74 Commits
61f4020487
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
| 700e353b79 | |||
| 0b2c19d2c5 | |||
| 47394de43c | |||
| f0f1dde6b6 | |||
| 1ab1165697 | |||
| a8f1b1fdfa | |||
| 3b94d19199 | |||
| db1139a14f | |||
|
|
bea74aeac2 | ||
|
|
634a1f45f9 | ||
| 8f1ad3307c | |||
| d8080fa22d | |||
|
|
e8783d9f8f | ||
| d8c4348341 | |||
|
|
8e61490005 | ||
| f5f4e3c48e | |||
| 0f013715b8 | |||
| fb9722d328 | |||
| 6f9192d30d | |||
| f2b5b90f34 | |||
| a2cbd5e583 | |||
| d3df46858b | |||
| 47a7a945bc | |||
| 0a56c0dcf0 | |||
| 15d32134e2 | |||
| eff98ea5eb | |||
| a47306825a | |||
|
|
9b35fec931 | ||
| e20e2b637f | |||
| ebd2e8aa75 | |||
| cb268fe26d | |||
| 23bd49d940 | |||
| 32adb984e2 | |||
| c1d453600b | |||
| 02eab2d932 | |||
| d5c8b7a1ad | |||
|
|
4053064a22 | ||
|
|
089e28f913 | ||
| cf9ab03b17 | |||
| d332650bfa | |||
| 840983ac94 | |||
|
|
86673d7be3 | ||
|
|
3753a916f5 | ||
|
|
0556f77870 | ||
|
|
b185c156ca | ||
|
|
a48308dcbf | ||
| e37f6a70f9 | |||
|
|
28629ccd35 | ||
|
|
fbd7f0be78 | ||
|
|
763f05da84 | ||
|
|
8c74d45332 | ||
| 8d62c0461b | |||
| 58936c957d | |||
| 062c4a92b8 | |||
| fb9f85e967 | |||
| 38ef377cbd | |||
| 240d5dc3f7 | |||
| 82702f16e0 | |||
| 0b4b63dfbe | |||
| b4422a0dca | |||
| d8627df2dd | |||
| 09ca077559 | |||
| 3091fc7337 | |||
| b0850257c8 | |||
| fa2884b320 | |||
| 941054734f | |||
| 8d69dc3c00 | |||
| 2157806ba5 | |||
| 2236cbea36 | |||
| 2128e717e7 | |||
| 1311e87e13 | |||
| ddf1553846 | |||
| 5d82800976 | |||
| 0c35044231 |
26
.trae/documents/plan_20251231_062502.md
Normal file
26
.trae/documents/plan_20251231_062502.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# 修复门诊预约界面专家号查询结果显示问题
|
||||
|
||||
## 问题分析
|
||||
1. 前端传递的参数正确:`type=expert`,后端正确转换为`ticketType=专家`
|
||||
2. 实际查询返回了5条记录,但COUNT查询只返回了1条记录
|
||||
3. 这导致前端只显示了1条记录,而不是全部5条
|
||||
4. 原因:MyBatis-Plus自动生成的COUNT查询和实际查询使用了不同的条件,特别是逻辑删除条件
|
||||
|
||||
## 解决方案
|
||||
1. 修改TicketMapper.xml中的自定义COUNT查询,显式添加`delete_flag = '0'`条件
|
||||
2. 在selectTicketPage和selectTicketPage_mpCount查询中都添加逻辑删除条件
|
||||
3. 确保两个查询使用完全相同的WHERE条件
|
||||
|
||||
## 修复步骤
|
||||
1. 修改`selectTicketPage`查询,添加逻辑删除条件`and delete_flag = '0'`
|
||||
2. 修改`selectTicketPage_mpCount`查询,添加逻辑删除条件`and delete_flag = '0'`
|
||||
3. 确保两个查询的WHERE条件完全一致
|
||||
4. 测试修复后的功能,确保专家号能正确显示全部5条记录
|
||||
|
||||
## 代码修改点
|
||||
- 文件:`d:/work/openhis-server-new/openhis-domain/src/main/resources/mapper/clinical/TicketMapper.xml`
|
||||
- 查询:`selectTicketPage` 和 `selectTicketPage_mpCount`
|
||||
- 修改内容:添加逻辑删除条件`and delete_flag = '0'`
|
||||
|
||||
## 预期效果
|
||||
修复后,COUNT查询和实际查询将使用完全相同的条件,包括逻辑删除条件,从而确保COUNT查询返回正确的总记录数,前端能显示所有5条专家号记录。
|
||||
30
.trae/documents/plan_20251231_063300.md
Normal file
30
.trae/documents/plan_20251231_063300.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# 修复门诊预约界面专家号查询COUNT结果不正确问题
|
||||
|
||||
## 问题分析
|
||||
1. 前端传递的参数正确:`type=expert`,后端正确转换为`ticketType=专家`
|
||||
2. COUNT查询和实际查询的WHERE条件完全相同:`WHERE delete_flag = '0' AND ticket_type = '专家'`
|
||||
3. 但COUNT查询只返回1条记录,而实际查询返回5条记录
|
||||
4. 原因:MyBatis-Plus的分页插件在处理自定义COUNT查询时,存在bug,导致COUNT查询结果不正确
|
||||
|
||||
## 解决方案
|
||||
修改`TicketAppServiceImpl.java`中的`listTicket`方法,不使用MyBatis-Plus的自动分页功能,而是手动实现分页查询:
|
||||
1. 直接调用`ticketService.countTickets`方法获取总记录数
|
||||
2. 手动构建查询条件
|
||||
3. 确保COUNT查询和实际查询使用完全相同的条件
|
||||
|
||||
## 修复步骤
|
||||
1. 修改`TicketAppServiceImpl.java`中的`listTicket`方法
|
||||
2. 手动实现分页查询,包括:
|
||||
- 构建查询条件
|
||||
- 调用`countTickets`获取总记录数
|
||||
- 调用`selectTicketList`获取分页数据
|
||||
- 手动组装分页结果
|
||||
3. 测试修复后的功能,确保专家号能正确显示全部5条记录
|
||||
|
||||
## 代码修改点
|
||||
- 文件:`d:/work/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/appservice/impl/TicketAppServiceImpl.java`
|
||||
- 方法:`listTicket`
|
||||
- 修改内容:替换MyBatis-Plus的自动分页,改为手动分页实现
|
||||
|
||||
## 预期效果
|
||||
修复后,COUNT查询和实际查询将使用完全相同的条件,COUNT查询将返回正确的总记录数(5条),前端能显示所有5条专家号记录。
|
||||
32
.trae/documents/修复号源列表显示问题.md
Normal file
32
.trae/documents/修复号源列表显示问题.md
Normal file
@@ -0,0 +1,32 @@
|
||||
## 问题分析
|
||||
根据日志和代码分析,发现号源列表显示"没有更多数据了"的问题原因:
|
||||
|
||||
1. **后端查询正常**:成功查询到5条符合条件的专家号源记录
|
||||
2. **数据转换失败**:在`convertToDto`方法中,`fee`字段类型转换错误
|
||||
3. **响应返回空列表**:由于转换异常,最终返回给前端的号源列表为空
|
||||
|
||||
## 问题根源
|
||||
- `Ticket`实体类的`fee`字段为**BigDecimal类型**(数据库存储)
|
||||
- `TicketDto`类的`fee`字段为**String类型**(前端展示)
|
||||
- 在`convertToDto`方法中,直接将BigDecimal类型的`fee`赋值给String类型的`fee`,导致**ClassCastException**
|
||||
|
||||
## 修复方案
|
||||
修改`TicketAppServiceImpl.java`文件中的`convertToDto`方法,将BigDecimal类型的`fee`转换为String类型:
|
||||
|
||||
```java
|
||||
// 原代码
|
||||
dto.setFee(ticket.getFee());
|
||||
|
||||
// 修复后代码
|
||||
dto.setFee(ticket.getFee().toString());
|
||||
```
|
||||
|
||||
## 预期效果
|
||||
1. 修复后,后端能成功将`Ticket`实体转换为`TicketDto`
|
||||
2. 前端能接收到包含5条专家号源的完整列表
|
||||
3. 页面显示正常,不再出现"没有更多数据了"的提示
|
||||
|
||||
## 验证方法
|
||||
1. 重新启动项目,访问号源管理页面
|
||||
2. 选择"专家号"类型,查看是否能正确显示5条号源记录
|
||||
3. 检查日志,确认没有类型转换异常
|
||||
23
.trae/documents/修复门诊预约界面专家号查询问题.md
Normal file
23
.trae/documents/修复门诊预约界面专家号查询问题.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# 修复门诊预约界面专家号查询问题
|
||||
|
||||
## 问题分析
|
||||
从日志中发现关键问题:
|
||||
- 前端传递的ticket_type值是英文:`general` (普通号) 和 `expert` (专家号)
|
||||
- 数据库中存储的ticket_type值是中文:`普通` 和 `专家`
|
||||
- 导致查询条件不匹配,无法查询到数据
|
||||
|
||||
## 解决方案
|
||||
需要在后端添加类型映射转换,将前端传递的英文类型转换为数据库中存储的中文类型。
|
||||
|
||||
## 修复步骤
|
||||
1. 修改 `TicketAppServiceImpl.java` 文件,在处理type参数时添加映射转换逻辑
|
||||
2. 添加从英文类型到中文类型的映射关系
|
||||
3. 测试修复后的功能,确保普通号和专家号都能正确查询
|
||||
|
||||
## 代码修改点
|
||||
- 文件:`d:/work/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/appservice/impl/TicketAppServiceImpl.java`
|
||||
- 方法:`listTicket` 中的type参数处理部分
|
||||
- 修改内容:添加类型映射转换,将 "general" 转换为 "普通","expert" 转换为 "专家"
|
||||
|
||||
## 预期效果
|
||||
修复后,前端选择"普通号"或"专家号"时,系统能正确查询到对应的号源数据,不再出现"没有更多数据了"的提示。
|
||||
23
.trae/documents/修复门诊预约界面只显示1条数据的问题.md
Normal file
23
.trae/documents/修复门诊预约界面只显示1条数据的问题.md
Normal file
@@ -0,0 +1,23 @@
|
||||
**问题分析**:
|
||||
后端返回的响应格式是`{code: 200, msg: "操作成功", data: {total: 5, limit: 20, page: 1, list: [5条记录]}}`,而前端可能期望直接访问`list`属性,导致只能显示1条数据。
|
||||
|
||||
**修复方案**:
|
||||
|
||||
1. 修改`TicketAppServiceImpl.java`的`listTicket`方法,确保返回的分页数据格式正确
|
||||
2. 调整响应结构,使其更符合前端期望
|
||||
3. 保持与现有代码的兼容性
|
||||
|
||||
**修改点**:
|
||||
|
||||
* `TicketAppServiceImpl.java`:优化`listTicket`方法的响应格式
|
||||
|
||||
* 确保分页信息和列表数据都能正确返回给前端
|
||||
|
||||
**预期效果**:
|
||||
|
||||
* 后端返回正确格式的响应数据
|
||||
|
||||
* 前端能够正确显示所有5条专家号数据
|
||||
|
||||
* 保持与现有代码的兼容性
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
68
README.md
68
README.md
@@ -1,68 +0,0 @@
|
||||
# 平台介绍
|
||||
|
||||
## 🏠【关于我们】
|
||||
|
||||

|
||||
|
||||
天天开源致⼒于打造中国应⽤管理 软件开源⽣态,⾯向医疗、企业、教育三⼤⾏业信息化需求,提供优质的开源软件产品与解决⽅案。平台现已发布OpenHIS、OpenCOM、OpenEDU系列开源产品,并持续招募⽣态合作伙伴,期待共同构建开源创新的⾏业协作模式,加速⾏业的数字化进程。
|
||||
|
||||
天天开源的前⾝是新致开源,最早于2022年6⽉发布开源医疗软件平台OpenHIS.org.cn,于2023年6⽉发布开源企业软件平台OpenCOM.com.cn。2025年7⽉,新致开源品牌更新为天天开源,我们始终秉持开源、专业、协作的理念,致⼒于为医疗、教育、中⼩企业等⾏业提供优质的开源解决⽅案。
|
||||
|
||||
了解我们a:https://open.tntlinking.com/about?site=gitee
|
||||
|
||||
## 💾【部署包下载】
|
||||
|
||||
请访问官网产品中心下载部署包:https://open.tntlinking.com/resource/productCenter?site=gitee
|
||||
|
||||
## 📚【支持文档】
|
||||
|
||||
技术支持资源:https://open.tntlinking.com/resource/openProductDoc?site=gitee
|
||||
(含演示环境、操作手册、部署手册、开发手册、常见问题等)
|
||||
|
||||
产品介绍:https://open.tntlinking.com/resource/productPresentation?site=gitee
|
||||
|
||||
操作教程:https://open.tntlinking.com/resource/operationTutorial?site=gitee
|
||||
|
||||
沙龙回顾:https://open.tntlinking.com/resource/openSourceSalon#23?site=gitee
|
||||
|
||||
## 🤝【合作方式】
|
||||
|
||||
产品服务价格:https://open.tntlinking.com/cost?site=gitee
|
||||
|
||||
加入生态伙伴:https://open.tntlinking.com/ecology/becomePartner?site=gitee
|
||||
|
||||
## 🤗【技术社区】
|
||||
|
||||
请访问官网扫码加入技术社区交流:https://open.tntlinking.com/ecology/joinCommunity?site=gitee
|
||||
|
||||
请关注公众号【天天开源软件】以便获得最新产品更新信息。
|
||||
|
||||
|
||||
|
||||
# 项目介绍
|
||||
|
||||
OpenHIS医院系统(信创版)集十大核心模块于一体,涵盖目录管理、基础数据配置、个性化设置、门诊/住院全流程管理、药房药库智能管控、精细化耗材管理、财务核算体系、医保合规对接及多维报表分析等功能模块,共计372项标准化功能。
|
||||
|
||||
系统深度适配民营及公立一二级医院业务场景,支持单体医院、集团化运营及区域医疗协同等多种部署模式,并通过国家信创认证体系,确保全栈技术自主可控。如有项目需求,可联系官方平台合作。
|
||||
|
||||
|
||||
|
||||
## 运行环境
|
||||
|
||||
jdk17 (必须)
|
||||
node.js-v16.15 (推荐)
|
||||
PostgreSQL-v16.2 (必须)
|
||||
redis (常用稳定版本即可)
|
||||
|
||||
## 开发提示
|
||||
|
||||
需要修改数据库和redis的连接信息,详见:
|
||||
application.yml
|
||||
application-druid.yml
|
||||
|
||||
## 目录解释
|
||||
|
||||
前端: openhis-ui-vue3
|
||||
后端: openhis-server
|
||||
启动类: OpenHisApplication
|
||||
|
||||
104
check_display_order.sql
Normal file
104
check_display_order.sql
Normal file
@@ -0,0 +1,104 @@
|
||||
-- 检查流水号(display_order)是否按“科室+医生+当天”正确递增
|
||||
--
|
||||
-- 说明:
|
||||
-- 1. display_order 存的是纯数字(1, 2, 3...),不带时间戳前缀
|
||||
-- 2. 时间戳前缀(如 20260109)是在前端显示时加上的
|
||||
-- 3. 后端用 Redis key "ORG-{科室ID}-DOC-{医生ID}" 按天自增
|
||||
--
|
||||
-- 如何判断逻辑是否正确:
|
||||
-- 同一科室、同一医生、同一天的记录,display_order 应该递增(1, 2, 3...)
|
||||
-- 不同科室、不同医生、不同天的记录,可能都是 1(这是正常的)
|
||||
|
||||
-- ========================================
|
||||
-- 查询1:按“科室+医生+日期”分组,看每组内的 display_order 是否递增
|
||||
-- ========================================
|
||||
SELECT
|
||||
DATE(start_time) AS 日期,
|
||||
organization_id AS 科室ID,
|
||||
registrar_id AS 医生ID,
|
||||
COUNT(*) AS 该组记录数,
|
||||
MIN(display_order) AS 最小序号,
|
||||
MAX(display_order) AS 最大序号,
|
||||
STRING_AGG(display_order::text, ', ' ORDER BY start_time) AS 序号列表,
|
||||
STRING_AGG(id::text, ', ' ORDER BY start_time) AS 记录ID列表
|
||||
FROM adm_encounter
|
||||
WHERE delete_flag = '0'
|
||||
AND start_time >= CURRENT_DATE - INTERVAL '7 days' -- 只看最近7天
|
||||
AND display_order IS NOT NULL
|
||||
GROUP BY DATE(start_time), organization_id, registrar_id
|
||||
ORDER BY 日期 DESC, 科室ID, 医生ID;
|
||||
|
||||
-- ========================================
|
||||
-- 查询2:详细查看每条记录,看同组内的序号是否连续
|
||||
-- ========================================
|
||||
SELECT
|
||||
id AS 记录ID,
|
||||
DATE(start_time) AS 日期,
|
||||
organization_id AS 科室ID,
|
||||
registrar_id AS 医生ID,
|
||||
start_time AS 挂号时间,
|
||||
display_order AS 流水号,
|
||||
-- 计算:同组内的序号应该是 1, 2, 3...,看是否有重复或跳号
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY DATE(start_time), organization_id, registrar_id
|
||||
ORDER BY start_time
|
||||
) AS 应该是第几个,
|
||||
CASE
|
||||
WHEN display_order = ROW_NUMBER() OVER (
|
||||
PARTITION BY DATE(start_time), organization_id, registrar_id
|
||||
ORDER BY start_time
|
||||
) THEN '✓ 正常'
|
||||
ELSE '✗ 异常'
|
||||
END AS 是否正常
|
||||
FROM adm_encounter
|
||||
WHERE delete_flag = '0'
|
||||
AND start_time >= CURRENT_DATE - INTERVAL '7 days'
|
||||
AND display_order IS NOT NULL
|
||||
ORDER BY DATE(start_time) DESC, organization_id, registrar_id, start_time;
|
||||
|
||||
-- ========================================
|
||||
-- 查询3:只看今天的数据(最直观)
|
||||
-- ========================================
|
||||
SELECT
|
||||
id AS 记录ID,
|
||||
organization_id AS 科室ID,
|
||||
registrar_id AS 医生ID,
|
||||
start_time AS 挂号时间,
|
||||
display_order AS 流水号
|
||||
FROM adm_encounter
|
||||
WHERE delete_flag = '0'
|
||||
AND DATE(start_time) = CURRENT_DATE
|
||||
AND display_order IS NOT NULL
|
||||
ORDER BY organization_id, registrar_id, start_time;
|
||||
|
||||
-- ========================================
|
||||
-- 查询4:发现问题 - 找出同组内 display_order 重复的记录
|
||||
-- ========================================
|
||||
WITH ranked AS (
|
||||
SELECT
|
||||
id,
|
||||
DATE(start_time) AS reg_date,
|
||||
organization_id,
|
||||
registrar_id,
|
||||
start_time,
|
||||
display_order,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY DATE(start_time), organization_id, registrar_id
|
||||
ORDER BY start_time
|
||||
) AS should_be_order
|
||||
FROM adm_encounter
|
||||
WHERE delete_flag = '0'
|
||||
AND start_time >= CURRENT_DATE - INTERVAL '7 days'
|
||||
AND display_order IS NOT NULL
|
||||
)
|
||||
SELECT
|
||||
reg_date AS 日期,
|
||||
organization_id AS 科室ID,
|
||||
registrar_id AS 医生ID,
|
||||
COUNT(*) AS 重复数量,
|
||||
STRING_AGG(id::text || '->' || display_order::text, ', ') AS 问题记录
|
||||
FROM ranked
|
||||
WHERE display_order != should_be_order
|
||||
GROUP BY reg_date, organization_id, registrar_id
|
||||
ORDER BY reg_date DESC;
|
||||
|
||||
10
md/test.html
Normal file
10
md/test.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>测试合并11111</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
287
md/需求/94-手术室维护界面_2026-1-9.md
Normal file
287
md/需求/94-手术室维护界面_2026-1-9.md
Normal file
@@ -0,0 +1,287 @@
|
||||
## 手术室维护界面PRD文档
|
||||
|
||||
### 一、页面概述
|
||||
|
||||
**页面名称**:手术室维护界面
|
||||
**页面目标**:提供手术室基础数据的维护功能,包括新增、编辑、启用/停用手术室信息,为手术安排提供基础数据支持
|
||||
**适用场景**:医院管理员需要新增、修改、启用/停用手术室信息时使用
|
||||
**页面类型**:列表页+表单页(含模态框)
|
||||
|
||||
**原型图地址:**https://static.pm-ai.cn/prototype/20260104/ee5d222231effefcb39624d1646a2e20/index.html
|
||||
|
||||
**核心功能**:
|
||||
|
||||
1. 手术室列表展示与查询
|
||||
2. 新增手术室信息
|
||||
3. 编辑现有手术室信息
|
||||
4. 启用/停用手术室状态
|
||||
5. 数据有效性校验
|
||||
|
||||
**用户价值**:
|
||||
|
||||
- 管理员可集中管理所有手术室基础信息
|
||||
- 确保手术安排时能获取准确的手术室数据
|
||||
- 通过状态管理控制手术室可用性
|
||||
|
||||
**流程图:**
|
||||
|
||||

|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[手术室维护界面] --> B[手术室列表展示]
|
||||
|
||||
B --> C[新增手术室]
|
||||
|
||||
B --> D[编辑手术室]
|
||||
|
||||
B --> E[启用/停用手术室]
|
||||
|
||||
B --> F[查询手术室]
|
||||
|
||||
C --> G[点击新增按钮]
|
||||
|
||||
G --> H[打开新增模态框]
|
||||
|
||||
H --> I[填写表单字段]
|
||||
|
||||
I --> J{必填字段校验}
|
||||
|
||||
J -->|通过| K[提交数据]
|
||||
|
||||
J -->|不通过| L[提示请填写所有必填项]
|
||||
|
||||
K --> M[表格新增数据行]
|
||||
|
||||
D --> N[点击修改按钮]
|
||||
|
||||
N --> O[打开编辑模态框]
|
||||
|
||||
O --> P[修改表单字段]
|
||||
|
||||
P --> Q{必填字段校验}
|
||||
|
||||
Q -->|通过| R[保存数据]
|
||||
|
||||
Q -->|不通过| S[提示请填写所有必填项]
|
||||
|
||||
R --> T[更新表格对应行]
|
||||
|
||||
E --> U[点击启用/停用按钮]
|
||||
|
||||
U --> V{二次确认}
|
||||
|
||||
V -->|确认| W[切换状态标签]
|
||||
|
||||
V -->|取消| X[取消操作]
|
||||
|
||||
W --> Y[更新按钮状态]
|
||||
|
||||
F --> Z[输入查询条件]
|
||||
|
||||
Z --> AA[筛选表格数据]
|
||||
|
||||
K --> AB{房间号重复校验}
|
||||
|
||||
AB -->|不重复| AC[提示房间号已存在]
|
||||
|
||||
AB -->|重复| AD[更新按钮状态]
|
||||
```
|
||||
|
||||
### 二、整体布局分析
|
||||
|
||||
**页面宽度**:自适应布局
|
||||
**主要区域划分**:
|
||||
|
||||
1. 页头区域(15%高度)
|
||||
2. 表格展示区(85%高度)
|
||||
**布局特点**:上下布局,表格采用固定表头+滚动内容区设计
|
||||
**响应式要求**:移动端适配时改为纵向堆叠布局,操作按钮组变为纵向排列
|
||||
|
||||
### 三、页面区域详细描述
|
||||
|
||||
#### 1. 页头区域
|
||||
|
||||
**区域位置**:页面顶部
|
||||
**区域尺寸**:高度60px,宽度100%
|
||||
**区域功能**:展示标题和主要操作入口
|
||||
**包含元素**:
|
||||
|
||||
- **标题文本**
|
||||
- 元素类型:H1标题
|
||||
- 显示内容:"手术室列表"
|
||||
- 样式特征:1.75rem/600字重,深灰色(#333)
|
||||
- **新增按钮**
|
||||
- 元素类型:主要操作按钮
|
||||
- 显示内容:"新增"(带+图标)
|
||||
- 交互行为:点击触发新增模态框
|
||||
- 样式特征:蓝色背景(#5a7cff),白色文字,8px圆角,悬停上浮1px
|
||||
|
||||
#### 2. 表格展示区(手术室列表表格)
|
||||
|
||||
**区域位置**:页头下方
|
||||
**区域尺寸**:高度自适应,宽度100%
|
||||
**区域功能**:展示手术室数据并支持行级操作
|
||||
**包含元素**:
|
||||
|
||||
- **数据表格**
|
||||
- 展示方式:固定表头表格
|
||||
- 数据字段:
|
||||
- 房间号:文本 - OR01 - 不可操作
|
||||
- 手术室名称:文本 - 第一手术室 - 不可操作
|
||||
- 类型:文本 - 普通/日间/复合 - 不可操作
|
||||
- 所属科室:文本 - 外科 - 不可操作
|
||||
- 状态:标签 - 有效/无效 - 通过操作按钮切换
|
||||
- 操作功能:每行包含"修改"和"状态切换(停用-黄色/启用-绿色)"按钮
|
||||
- **表格样式**:
|
||||
- 表头:浅灰色背景(#f8f9fa),大写字母,14px字号
|
||||
- 行悬停:浅灰色背景(#f8f9fa)
|
||||
- 状态标签:
|
||||
- 有效:绿色背景+文字(#28a745)
|
||||
- 无效:灰色背景+文字(#6c757d)
|
||||
|
||||
#### 3. 新增手术室弹窗
|
||||
|
||||
**区域位置**:页面居中模态弹窗
|
||||
**区域功能**:收集新增手术室所需信息
|
||||
**包含元素**:
|
||||
|
||||
- 表单字段:
|
||||
1. 房间号输入框
|
||||
2. 类型:文本输入
|
||||
3. 必填:是
|
||||
4. 示例值:OR04
|
||||
5. 校验规则:非空校验
|
||||
6. 手术室名称输入框
|
||||
- 类型:文本输入
|
||||
- 必填:是
|
||||
- 示例值:第四手术室
|
||||
1. 手术室类型下拉框
|
||||
- 类型:单选下拉
|
||||
- 选项:普通/日间/复合/特殊
|
||||
- 默认值:普通
|
||||
1. 所属科室下拉框
|
||||
- 类型:单选下拉
|
||||
- 必填:是
|
||||
- 选项:外科/妇产科等8个科室
|
||||
- 默认提示:"请选择科室"
|
||||
- 操作按钮:
|
||||
- 取消按钮(灰色边框)
|
||||
- 确认按钮(蓝色填充)
|
||||
- 校验逻辑:必填字段非空校验
|
||||
- 成功反馈:提示"手术室添加成功"
|
||||
- 失败反馈:提示"请填写所有必填项"
|
||||
|
||||
#### 4. 编辑手术室弹窗
|
||||
|
||||
**区域位置**:页面居中模态弹窗
|
||||
**区域功能**:修改现有手术室信息
|
||||
**包含元素**:
|
||||
|
||||
- 表单字段(同新增弹窗,带初始值)
|
||||
- 操作按钮:
|
||||
- 取消按钮
|
||||
- 保存按钮
|
||||
- 校验逻辑:同新增弹窗
|
||||
- 成功反馈:提示"手术室信息已更新"
|
||||
|
||||
### 四、交互功能详细说明
|
||||
|
||||
#### 1. 新增手术室
|
||||
|
||||
**功能描述**:添加新的手术室记录
|
||||
**触发条件**:点击页头"新增"按钮
|
||||
**操作流程**:
|
||||
|
||||
1. 打开新增模态框
|
||||
2. 填写必填字段(房间号、名称、科室)
|
||||
3. 点击确认提交(插入his_or_room表)
|
||||
4. 表格末尾新增数据行
|
||||
**异常处理**:
|
||||
- 必填项为空时弹出"请填写所有必填项"提示
|
||||
- 房间号重复需在后端校验并提示
|
||||
|
||||
#### 2. 编辑手术室
|
||||
|
||||
**功能描述**:修改现有手术室信息
|
||||
**触发条件**:点击行内"修改"按钮
|
||||
**操作流程**:
|
||||
|
||||
1. 打开编辑模态框(自动填充当前行数据)
|
||||
2. 用户修改数据
|
||||
3. 点击"保存"时校验并更新对应行数据
|
||||
**状态保持**:记录当前编辑行索引确保数据更新准确
|
||||
|
||||
#### 3. 状态切换
|
||||
|
||||
**功能描述**:启用/停用手术室
|
||||
**触发条件**:点击"停用"或"启用"按钮
|
||||
**操作流程**:
|
||||
|
||||
1. 弹出二次确认对话框
|
||||
2. 用户确认后切换状态标签
|
||||
3. 按钮变为相反操作(停用↔启用)
|
||||
4. 、停用手术室
|
||||
- **步骤**:
|
||||
1. 查询需要停用的手术室记录。
|
||||
2. 将 valid_flag 设置为 0(无效)。
|
||||
- **示例**:
|
||||
|
||||
UPDATE his_or_room
|
||||
|
||||
SET valid_flag = '0'
|
||||
|
||||
WHERE room_code = 'OR06';
|
||||
|
||||
5\. 启用手术室
|
||||
|
||||
**步骤**:
|
||||
|
||||
1. 查询需要启用的手术室记录。
|
||||
1. 将 valid_flag 设置为 1(有效)。
|
||||
- **示例**:
|
||||
|
||||
UPDATE his_or_room
|
||||
|
||||
SET valid_flag = '1'
|
||||
|
||||
WHERE room_code = 'OR06';
|
||||
|
||||
**防误操作**:所有状态变更需二次确认
|
||||
|
||||
### 五、数据结构说明(HIS_OR_ROOM手术室字典表)
|
||||
|
||||
| **字段名称** | **数据类型** | **是否为空** | **说明/典型值** | **外键/来源** |
|
||||
|--------------|--------------|--------------|-----------------|-------------------------------|
|
||||
| room_id | VARCHAR(10) | N | 主键 | 自增主键 |
|
||||
| room_code | VARCHAR(10) | N | 手术室房间号 | 自定义编码,如 OR01、OR02 |
|
||||
| room_name | VARCHAR(100) | N | 手术室名称 | 如 "第一手术室"、"第二手术室" |
|
||||
| room_type | VARCHAR(10) | N | 手术室类型 | 普通、日间、复合 |
|
||||
| dept_code | VARCHAR(10) | N | 所属科室 | FK → 科室管理的科室代码 |
|
||||
| valid_flag | CHAR(1) | N | 是否有效 | 1有效,0无效 |
|
||||
| created_time | DATETIME | N | 创建时间 | 默认当前时间 |
|
||||
| updated_time | DATETIME | N | 更新时间 | 默认当前时间,自动更新 |
|
||||
|
||||
### 六、开发实现要点
|
||||
|
||||
**样式规范**:
|
||||
|
||||
- 主色调:#5a7cff(按钮/交互元素)
|
||||
- 辅助色:#7b8a8b(次要文本)
|
||||
- 字体:
|
||||
- 标题:1.75rem/600字重
|
||||
- 正文:0.875rem/400字重
|
||||
- 间距系统:
|
||||
- 卡片内边距:24px
|
||||
- 表单字段间距:16px
|
||||
|
||||
**技术要求**:
|
||||
|
||||
**注意事项**:
|
||||
|
||||
1. 数据安全:
|
||||
- 所有变更操作需记录操作日志
|
||||
- 停用状态的手术室需在前端标记不可预约
|
||||
2. 性能优化:
|
||||
- 表格数据分页加载
|
||||
- 模态框使用懒加载
|
||||
@@ -86,6 +86,7 @@ public class SysLoginController {
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("optionJson", loginUser.getOptionJson());
|
||||
ajax.put("optionMap", loginUser.getOptionMap());
|
||||
ajax.put("practitionerId", String.valueOf(loginUser.getPractitionerId()));
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
|
||||
@@ -76,6 +76,25 @@ public class SecurityUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全获取用户名(失败时返回默认值)
|
||||
**/
|
||||
public static String getUsernameSafe() {
|
||||
try {
|
||||
Authentication authentication = getAuthentication();
|
||||
if (authentication != null && authentication.getPrincipal() != null) {
|
||||
if (authentication.getPrincipal() instanceof LoginUser) {
|
||||
return ((LoginUser) authentication.getPrincipal()).getUsername();
|
||||
} else {
|
||||
return authentication.getPrincipal().toString();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 静默处理异常,返回默认值
|
||||
}
|
||||
return "anonymous";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Authentication
|
||||
*/
|
||||
|
||||
@@ -60,6 +60,17 @@
|
||||
<artifactId>core-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.core</groupId>
|
||||
<artifactId>core-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JSQLParser - 用于MyBatis Plus -->
|
||||
<dependency>
|
||||
<groupId>com.github.jsqlparser</groupId>
|
||||
<artifactId>jsqlparser</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -11,9 +11,10 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||
|
||||
/**
|
||||
* 事务处理
|
||||
* 已注释:与 @Transactional 注解冲突,导致事务回滚错误
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
//@Aspect
|
||||
//@Component
|
||||
public class TransactionAspect {
|
||||
|
||||
private final PlatformTransactionManager transactionManager;
|
||||
@@ -23,19 +24,19 @@ public class TransactionAspect {
|
||||
this.transactionManager = transactionManager;
|
||||
}
|
||||
|
||||
@Before("@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
|
||||
"@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
|
||||
"@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
|
||||
"@annotation(org.springframework.web.bind.annotation.DeleteMapping)")
|
||||
//@Before("@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
|
||||
// "@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
|
||||
// "@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
|
||||
// "@annotation(org.springframework.web.bind.annotation.DeleteMapping)")
|
||||
public void beginTransaction() {
|
||||
TransactionStatus status = transactionManager.getTransaction(new DefaultTransactionDefinition());
|
||||
transactionStatus.set(status);
|
||||
}
|
||||
|
||||
@AfterReturning("@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
|
||||
"@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
|
||||
"@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
|
||||
"@annotation(org.springframework.web.bind.annotation.DeleteMapping)")
|
||||
//@AfterReturning("@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
|
||||
// "@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
|
||||
// "@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
|
||||
// "@annotation(org.springframework.web.bind.annotation.DeleteMapping)")
|
||||
public void commitTransaction() {
|
||||
TransactionStatus status = transactionStatus.get();
|
||||
if (status != null && !status.isCompleted()) {
|
||||
@@ -44,11 +45,11 @@ public class TransactionAspect {
|
||||
}
|
||||
}
|
||||
|
||||
@AfterThrowing(pointcut = "@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
|
||||
"@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
|
||||
"@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
|
||||
"@annotation(org.springframework.web.bind.annotation.DeleteMapping)",
|
||||
throwing = "ex")
|
||||
//@AfterThrowing(pointcut = "@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
|
||||
// "@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
|
||||
// "@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
|
||||
// "@annotation(org.springframework.web.bind.annotation.DeleteMapping)",
|
||||
// throwing = "ex")
|
||||
public void rollbackTransaction(Exception ex) {
|
||||
TransactionStatus status = transactionStatus.get();
|
||||
if (status != null && !status.isCompleted()) {
|
||||
|
||||
@@ -91,6 +91,15 @@ public interface SysMenuMapper {
|
||||
*/
|
||||
public SysMenu selectMenuByPath(String path);
|
||||
|
||||
/**
|
||||
* 根据路径Path查询信息(排除指定菜单ID)
|
||||
*
|
||||
* @param path 路径
|
||||
* @param menuId 菜单ID
|
||||
* @return 菜单信息
|
||||
*/
|
||||
public SysMenu selectMenuByPathExcludeId(@Param("path") String path, @Param("menuId") Long menuId);
|
||||
|
||||
/**
|
||||
* 是否存在菜单子节点
|
||||
*
|
||||
|
||||
@@ -14,6 +14,8 @@ import com.core.system.mapper.SysMenuMapper;
|
||||
import com.core.system.mapper.SysRoleMapper;
|
||||
import com.core.system.mapper.SysRoleMenuMapper;
|
||||
import com.core.system.service.ISysMenuService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -27,6 +29,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
public class SysMenuServiceImpl implements ISysMenuService {
|
||||
private static final Logger log = LoggerFactory.getLogger(SysMenuServiceImpl.class);
|
||||
public static final String PREMISSION_STRING = "perms[\"{0}\"]";
|
||||
|
||||
@Autowired
|
||||
@@ -281,12 +284,13 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
*/
|
||||
@Override
|
||||
public int updateMenu(SysMenu menu) {
|
||||
//路径Path唯一性判断
|
||||
//路径Path唯一性判断(排除当前菜单本身)
|
||||
String path = menu.getPath();
|
||||
if (StringUtils.isNotBlank(path)) {
|
||||
SysMenu sysMenu = menuMapper.selectMenuByPath(menu.getPath());
|
||||
// 先判断sysMenu是否不为null,再比较menuId
|
||||
if (sysMenu != null && !menu.getMenuId().equals(sysMenu.getMenuId())) {
|
||||
SysMenu sysMenu = menuMapper.selectMenuByPathExcludeId(menu.getPath(), menu.getMenuId());
|
||||
if (sysMenu != null) {
|
||||
log.warn("路由地址已存在 - menuId: {}, path: {}, 存在的menuId: {}",
|
||||
menu.getMenuId(), menu.getPath(), sysMenu.getMenuId());
|
||||
return -1; // 路由地址已存在
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
<if test="listClass != null">list_class = #{listClass},</if>
|
||||
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="pyStr !=null">pyStr = #{pyStr}</if>
|
||||
<if test="pyStr !=null">py_str = #{pyStr},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = now()
|
||||
@@ -144,7 +144,7 @@
|
||||
<if test="listClass != null and listClass != ''">list_class,</if>
|
||||
<if test="isDefault != null and isDefault != ''">is_default,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="pyStr !=null and pyStr !=null ''" >py_str,</if>
|
||||
<if test="pyStr !=null and pyStr != ''" >py_str,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
@@ -157,7 +157,7 @@
|
||||
<if test="listClass != null and listClass != ''">#{listClass},</if>
|
||||
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="pyStr !=null and pyStr !=''" >{pystr},</if>
|
||||
<if test="pyStr !=null and pyStr !=''" >#{pyStr},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
now()
|
||||
|
||||
@@ -177,6 +177,12 @@
|
||||
<select id="selectMenuByPath" parameterType="String" resultMap="SysMenuResult">
|
||||
<include refid="selectMenuVo"/>
|
||||
where path = #{path}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectMenuByPathExcludeId" resultMap="SysMenuResult">
|
||||
<include refid="selectMenuVo"/>
|
||||
where path = #{path} and menu_id != #{menuId}
|
||||
</select>
|
||||
|
||||
<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
|
||||
|
||||
@@ -64,6 +64,11 @@
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
</dependency>
|
||||
<!-- rabbitMQ -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.openhis.web.administration.controller;
|
||||
|
||||
import com.core.common.annotation.Log;
|
||||
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.enums.BusinessType;
|
||||
import com.core.common.utils.poi.ExcelUtil;
|
||||
import com.openhis.administration.domain.PractitionerPatient;
|
||||
import com.openhis.administration.service.IPractitionerPatientService;
|
||||
import com.openhis.administration.dto.PractitionerPatientDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 医生患者关系管理Controller
|
||||
*
|
||||
* @author system
|
||||
* @date 2026-01-02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/administration/practitioner-patient")
|
||||
public class PractitionerPatientController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IPractitionerPatientService practitionerPatientService;
|
||||
|
||||
/**
|
||||
* 查询医生患者关系列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('administration:practitionerPatient:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(PractitionerPatient practitionerPatient) {
|
||||
startPage();
|
||||
List<PractitionerPatient> list = practitionerPatientService.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出医生患者关系列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('administration:practitionerPatient:export')")
|
||||
@Log(title = "医生患者关系", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PractitionerPatient practitionerPatient) {
|
||||
List<PractitionerPatient> list = practitionerPatientService.list();
|
||||
ExcelUtil<PractitionerPatient> util = new ExcelUtil<>(PractitionerPatient.class);
|
||||
util.exportExcel(response, list, "医生患者关系数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生患者关系详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('administration:practitionerPatient:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(practitionerPatientService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生的所有有效患者
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('administration:practitionerPatient:query')")
|
||||
@GetMapping("/practitioner/{practitionerId}/patients")
|
||||
public AjaxResult getPatientsByPractitioner(@PathVariable Long practitionerId) {
|
||||
return AjaxResult.success(practitionerPatientService.getValidPatientsByPractitioner(practitionerId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者的所有有效医生
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('administration:practitionerPatient:query')")
|
||||
@GetMapping("/patient/{patientId}/practitioners")
|
||||
public AjaxResult getPractitionersByPatient(@PathVariable Long patientId) {
|
||||
return AjaxResult.success(practitionerPatientService.getValidPractitionersByPatient(patientId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增医生患者关系
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('administration:practitionerPatient:add')")
|
||||
@Log(title = "医生患者关系", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody PractitionerPatientDto dto) {
|
||||
PractitionerPatient relationship = new PractitionerPatient();
|
||||
relationship.setPractitionerId(dto.getPractitionerId());
|
||||
relationship.setPatientId(dto.getPatientId());
|
||||
relationship.setRelationshipType(dto.getRelationshipType());
|
||||
relationship.setOrganizationId(dto.getOrganizationId());
|
||||
relationship.setStartDate(dto.getStartDate());
|
||||
relationship.setRemark(dto.getRemark());
|
||||
|
||||
return toAjax(practitionerPatientService.createRelationship(relationship));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改医生患者关系
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('administration:practitionerPatient:edit')")
|
||||
@Log(title = "医生患者关系", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody PractitionerPatient practitionerPatient) {
|
||||
return toAjax(practitionerPatientService.updateById(practitionerPatient));
|
||||
}
|
||||
|
||||
/**
|
||||
* 终止医生患者关系
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('administration:practitionerPatient:remove')")
|
||||
@Log(title = "医生患者关系", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/terminate/{id}")
|
||||
public AjaxResult terminate(@PathVariable Long id) {
|
||||
return toAjax(practitionerPatientService.terminateRelationship(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除医生患者关系
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('administration:practitionerPatient:remove')")
|
||||
@Log(title = "医生患者关系", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(practitionerPatientService.removeByIds(List.of(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量创建医生患者关系
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('administration:practitionerPatient:add')")
|
||||
@Log(title = "批量创建医生患者关系", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/batch")
|
||||
public AjaxResult batchAdd(@RequestBody List<PractitionerPatientDto> dtos) {
|
||||
List<PractitionerPatient> relationships = dtos.stream().map(dto -> {
|
||||
PractitionerPatient relationship = new PractitionerPatient();
|
||||
relationship.setPractitionerId(dto.getPractitionerId());
|
||||
relationship.setPatientId(dto.getPatientId());
|
||||
relationship.setRelationshipType(dto.getRelationshipType());
|
||||
relationship.setOrganizationId(dto.getOrganizationId());
|
||||
relationship.setStartDate(dto.getStartDate());
|
||||
relationship.setRemark(dto.getRemark());
|
||||
return relationship;
|
||||
}).toList();
|
||||
|
||||
return toAjax(practitionerPatientService.batchCreateRelationships(relationships));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.openhis.web.appointmentmanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.DeptAppointmentHours;
|
||||
|
||||
public interface IDeptAppointmentHoursAppService {
|
||||
|
||||
R<?> getDeptAppthoursList(DeptAppointmentHours deptAppointmentHours, Integer pageNum, Integer pageSize);
|
||||
|
||||
R<?> getDeptAppthoursDetail(Long id);
|
||||
|
||||
R<?> addDeptAppthours(DeptAppointmentHours deptAppointmentHours);
|
||||
|
||||
R<?> updateDeptAppthours(DeptAppointmentHours deptAppointmentHours);
|
||||
|
||||
R<?> deleteDeptAppthours(Long id);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.openhis.web.appointmentmanage.appservice;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.appointmentmanage.dto.TicketDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 号源管理应用服务接口
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public interface ITicketAppService {
|
||||
|
||||
/**
|
||||
* 查询号源列表
|
||||
*
|
||||
* @param params 查询参数
|
||||
* @return 号源列表
|
||||
*/
|
||||
R<?> listTicket(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 预约号源
|
||||
*
|
||||
* @param params 预约参数
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> bookTicket(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
*
|
||||
* @param ticketId 号源ID
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> cancelTicket(Long ticketId);
|
||||
|
||||
/**
|
||||
* 取号
|
||||
*
|
||||
* @param ticketId 号源ID
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> checkInTicket(Long ticketId);
|
||||
|
||||
/**
|
||||
* 停诊
|
||||
*
|
||||
* @param ticketId 号源ID
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> cancelConsultation(Long ticketId);
|
||||
|
||||
/**
|
||||
* 查询所有号源(用于测试)
|
||||
*
|
||||
* @return 所有号源列表
|
||||
*/
|
||||
R<?> listAllTickets();
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.openhis.web.appointmentmanage.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.DeptAppointmentHours;
|
||||
import com.openhis.appointmentmanage.mapper.DeptAppointmentHoursMapper;
|
||||
import com.openhis.appointmentmanage.service.IDeptAppointmentHoursService;
|
||||
import com.openhis.web.appointmentmanage.appservice.IDeptAppointmentHoursAppService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DeptAppointmentHoursAppServiceImpl implements IDeptAppointmentHoursAppService {
|
||||
|
||||
@Resource
|
||||
private IDeptAppointmentHoursService deptAppointmentHoursService;
|
||||
|
||||
@Resource
|
||||
private DeptAppointmentHoursMapper deptAppointmentHoursMapper;
|
||||
|
||||
@Override
|
||||
public R<?> getDeptAppthoursList(DeptAppointmentHours deptAppointmentHours, Integer pageNum, Integer pageSize) {
|
||||
LambdaQueryWrapper<DeptAppointmentHours> wrapper = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(deptAppointmentHours.getInstitution())) {
|
||||
wrapper.eq(DeptAppointmentHours::getInstitution, deptAppointmentHours.getInstitution());
|
||||
}
|
||||
if (StrUtil.isNotBlank(deptAppointmentHours.getDepartment())) {
|
||||
wrapper.eq(DeptAppointmentHours::getDepartment, deptAppointmentHours.getDepartment());
|
||||
}
|
||||
wrapper.orderByDesc(DeptAppointmentHours::getCreatedTime);
|
||||
|
||||
Page<DeptAppointmentHours> page = new Page<>(pageNum, pageSize);
|
||||
Page<DeptAppointmentHours> resultPage = deptAppointmentHoursMapper.selectPage(page, wrapper);
|
||||
|
||||
return R.ok(resultPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getDeptAppthoursDetail(Long id) {
|
||||
if (ObjectUtil.isNull(id)) {
|
||||
return R.fail("ID不能为空");
|
||||
}
|
||||
DeptAppointmentHours deptAppointmentHours = deptAppointmentHoursService.getById(id);
|
||||
if (ObjectUtil.isNull(deptAppointmentHours)) {
|
||||
return R.fail("数据不存在");
|
||||
}
|
||||
return R.ok(deptAppointmentHours);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> addDeptAppthours(DeptAppointmentHours deptAppointmentHours) {
|
||||
if (ObjectUtil.isNull(deptAppointmentHours)) {
|
||||
return R.fail("数据不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(deptAppointmentHours.getInstitution())) {
|
||||
return R.fail("所属机构不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(deptAppointmentHours.getDepartment())) {
|
||||
return R.fail("科室名称不能为空");
|
||||
}
|
||||
|
||||
deptAppointmentHours.setCreatedTime(LocalDateTime.now());
|
||||
boolean save = deptAppointmentHoursService.save(deptAppointmentHours);
|
||||
return R.ok(save);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> updateDeptAppthours(DeptAppointmentHours deptAppointmentHours) {
|
||||
if (ObjectUtil.isNull(deptAppointmentHours) || ObjectUtil.isNull(deptAppointmentHours.getId())) {
|
||||
return R.fail("ID不能为空");
|
||||
}
|
||||
|
||||
DeptAppointmentHours existing = deptAppointmentHoursService.getById(deptAppointmentHours.getId());
|
||||
if (ObjectUtil.isNull(existing)) {
|
||||
return R.fail("数据不存在");
|
||||
}
|
||||
|
||||
deptAppointmentHours.setUpdatedTime(LocalDateTime.now());
|
||||
boolean update = deptAppointmentHoursService.updateById(deptAppointmentHours);
|
||||
return R.ok(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> deleteDeptAppthours(Long id) {
|
||||
if (ObjectUtil.isNull(id)) {
|
||||
return R.fail("ID不能为空");
|
||||
}
|
||||
|
||||
DeptAppointmentHours existing = deptAppointmentHoursService.getById(id);
|
||||
if (ObjectUtil.isNull(existing)) {
|
||||
return R.fail("数据不存在");
|
||||
}
|
||||
|
||||
boolean remove = deptAppointmentHoursService.removeById(id);
|
||||
return R.ok(remove);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,363 @@
|
||||
package com.openhis.web.appointmentmanage.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.administration.service.IPatientService;
|
||||
import com.openhis.clinical.domain.Ticket;
|
||||
import com.openhis.clinical.service.ITicketService;
|
||||
import com.openhis.web.appointmentmanage.appservice.ITicketAppService;
|
||||
import com.openhis.web.appointmentmanage.dto.TicketDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 号源管理应用服务实现类
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Service
|
||||
public class TicketAppServiceImpl implements ITicketAppService {
|
||||
|
||||
@Resource
|
||||
private ITicketService ticketService;
|
||||
|
||||
@Resource
|
||||
private IPatientService patientService;
|
||||
|
||||
/**
|
||||
* 查询号源列表
|
||||
*
|
||||
* @param params 查询参数
|
||||
* @return 号源列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> listTicket(Map<String, Object> params) {
|
||||
// 调试日志:打印所有参数
|
||||
System.out.println("=== listTicket方法收到的所有参数:===");
|
||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||
System.out.println(entry.getKey() + ": " + entry.getValue());
|
||||
}
|
||||
System.out.println("=================================");
|
||||
// 构建查询条件
|
||||
Ticket ticket = new Ticket();
|
||||
// 设置查询参数
|
||||
// 处理日期参数
|
||||
if (params.containsKey("date")) {
|
||||
String date = (String) params.get("date");
|
||||
try {
|
||||
// 将日期字符串转换为Date类型,设置到appointmentDate字段
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date appointmentDate = sdf.parse(date);
|
||||
ticket.setAppointmentDate(appointmentDate);
|
||||
System.out.println("设置的appointmentDate:" + appointmentDate);
|
||||
} catch (Exception e) {
|
||||
// 日期格式错误,忽略该参数
|
||||
System.out.println("日期格式错误,忽略该参数:" + date + ",错误信息:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
// 处理状态参数
|
||||
if (params.containsKey("status")) {
|
||||
String status = (String) params.get("status");
|
||||
System.out.println("接收到的status参数:" + status);
|
||||
if (!"all".equals(status) && !"全部".equals(status)) {
|
||||
// 将中文状态转换为英文状态
|
||||
if ("未预约".equals(status)) {
|
||||
ticket.setStatus("unbooked");
|
||||
} else if ("已预约".equals(status)) {
|
||||
ticket.setStatus("booked");
|
||||
} else if ("已取号".equals(status)) {
|
||||
ticket.setStatus("checked");
|
||||
} else if ("已取消".equals(status)) {
|
||||
ticket.setStatus("cancelled");
|
||||
} else if ("已锁定".equals(status)) {
|
||||
ticket.setStatus("locked");
|
||||
} else {
|
||||
ticket.setStatus(status);
|
||||
}
|
||||
System.out.println("设置的status:" + ticket.getStatus());
|
||||
}
|
||||
}
|
||||
if (params.containsKey("name")) {
|
||||
String name = (String) params.get("name");
|
||||
ticket.setPatientName(name);
|
||||
}
|
||||
if (params.containsKey("card")) {
|
||||
String card = (String) params.get("card");
|
||||
ticket.setMedicalCard(card);
|
||||
}
|
||||
if (params.containsKey("phone")) {
|
||||
String phone = (String) params.get("phone");
|
||||
ticket.setPhone(phone);
|
||||
}
|
||||
if (params.containsKey("type")) {
|
||||
String type = (String) params.get("type");
|
||||
System.out.println("前端传递的type参数值:" + type);
|
||||
if (!"all".equals(type)) {
|
||||
// 类型映射转换:前端传递英文类型,数据库存储中文类型
|
||||
if ("general".equals(type)) {
|
||||
ticket.setTicketType("普通");
|
||||
} else if ("expert".equals(type)) {
|
||||
ticket.setTicketType("专家");
|
||||
} else if ("普通".equals(type)) {
|
||||
ticket.setTicketType("普通");
|
||||
} else if ("专家".equals(type)) {
|
||||
ticket.setTicketType("专家");
|
||||
} else {
|
||||
ticket.setTicketType(type);
|
||||
}
|
||||
System.out.println("转换后的ticketType值:" + ticket.getTicketType());
|
||||
}
|
||||
}
|
||||
|
||||
// 手动实现分页查询,避免MyBatis-Plus自动COUNT查询的问题
|
||||
int pageNum = params.get("page") != null ? Integer.valueOf(params.get("page").toString()) : 1;
|
||||
int pageSize = params.get("limit") != null ? Integer.valueOf(params.get("limit").toString()) : 10;
|
||||
|
||||
// 调试:输出构建的查询条件
|
||||
System.out.println("构建的查询条件:ticketType=" + ticket.getTicketType() + ", status=" + ticket.getStatus() + ", appointmentDate=" + ticket.getAppointmentDate());
|
||||
|
||||
// 1. 获取所有符合条件的记录
|
||||
List<Ticket> allTickets = ticketService.selectTicketList(ticket);
|
||||
|
||||
// 调试:输出查询到的所有记录
|
||||
System.out.println("查询到的所有记录:" + allTickets);
|
||||
if (!allTickets.isEmpty()) {
|
||||
for (Ticket t : allTickets) {
|
||||
System.out.println("记录详情:id=" + t.getId() + ", ticketType=" + t.getTicketType() + ", status=" + t.getStatus() + ", appointmentDate=" + t.getAppointmentDate() + ", deleteFlag=" + t.getDeleteFlag());
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 计算总记录数
|
||||
long total = allTickets.size();
|
||||
System.out.println("手动计算的总记录数:" + total);
|
||||
|
||||
// 3. 手动分页
|
||||
int start = (pageNum - 1) * pageSize;
|
||||
int end = Math.min(start + pageSize, allTickets.size());
|
||||
List<Ticket> pageTickets;
|
||||
if (start >= end) {
|
||||
pageTickets = new ArrayList<>();
|
||||
} else {
|
||||
pageTickets = allTickets.subList(start, end);
|
||||
}
|
||||
|
||||
// 4. 转换为DTO
|
||||
List<TicketDto> dtoList = pageTickets.stream().map(this::convertToDto).toList();
|
||||
|
||||
// 5. 构建响应数据,符合前端预期格式
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("list", dtoList);
|
||||
result.put("records", dtoList); // 兼容前端框架(如Element UI)可能使用的records字段
|
||||
result.put("total", total);
|
||||
result.put("page", pageNum);
|
||||
result.put("current", pageNum); // 兼容前端框架可能使用的current字段
|
||||
result.put("limit", pageSize);
|
||||
result.put("pageSize", pageSize); // 兼容前端框架可能使用的pageSize字段
|
||||
result.put("size", pageSize); // 兼容前端框架可能使用的size字段
|
||||
result.put("pageNum", pageNum); // 兼容前端框架可能使用的pageNum字段
|
||||
result.put("pages", (int) Math.ceil((double) total / pageSize)); // 计算总页数
|
||||
|
||||
// 调试:输出响应数据
|
||||
System.out.println("返回的响应数据:" + result);
|
||||
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约号源
|
||||
*
|
||||
* @param params 预约参数
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> bookTicket(Map<String, Object> params) {
|
||||
Long ticketId = null;
|
||||
if (params.get("ticketId") != null) {
|
||||
ticketId = Long.valueOf(params.get("ticketId").toString());
|
||||
}
|
||||
if (ticketId == null) {
|
||||
return R.fail("参数错误");
|
||||
}
|
||||
try {
|
||||
int result = ticketService.bookTicket(params);
|
||||
return R.ok(result > 0 ? "预约成功" : "预约失败");
|
||||
} catch (Exception e) {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
*
|
||||
* @param ticketId 号源ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> cancelTicket(Long ticketId) {
|
||||
if (ticketId == null) {
|
||||
return R.fail("参数错误");
|
||||
}
|
||||
try {
|
||||
int result = ticketService.cancelTicket(ticketId);
|
||||
return R.ok(result > 0 ? "取消成功" : "取消失败");
|
||||
} catch (Exception e) {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取号
|
||||
*
|
||||
* @param ticketId 号源ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> checkInTicket(Long ticketId) {
|
||||
if (ticketId == null) {
|
||||
return R.fail("参数错误");
|
||||
}
|
||||
try {
|
||||
int result = ticketService.checkInTicket(ticketId);
|
||||
return R.ok(result > 0 ? "取号成功" : "取号失败");
|
||||
} catch (Exception e) {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停诊
|
||||
*
|
||||
* @param ticketId 号源ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> cancelConsultation(Long ticketId) {
|
||||
if (ticketId == null) {
|
||||
return R.fail("参数错误");
|
||||
}
|
||||
try {
|
||||
int result = ticketService.cancelConsultation(ticketId);
|
||||
return R.ok(result > 0 ? "停诊成功" : "停诊失败");
|
||||
} catch (Exception e) {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> listAllTickets() {
|
||||
// 创建固定的测试数据,用于验证前端是否能展示数据
|
||||
List<TicketDto> testTickets = new ArrayList<>();
|
||||
|
||||
// 创建5条测试数据
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
TicketDto dto = new TicketDto();
|
||||
dto.setSlot_id((long) i);
|
||||
dto.setBusNo("TEST0000" + i);
|
||||
dto.setDepartment("内科");
|
||||
dto.setDoctor("张三");
|
||||
dto.setTicketType("expert");
|
||||
dto.setDateTime("08:00-08:50");
|
||||
dto.setStatus("未预约");
|
||||
dto.setFee("150");
|
||||
dto.setAppointmentDate(new Date());
|
||||
testTickets.add(dto);
|
||||
}
|
||||
|
||||
// 构建响应数据
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("list", testTickets);
|
||||
result.put("total", testTickets.size());
|
||||
result.put("page", 1);
|
||||
result.put("limit", 20);
|
||||
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为DTO
|
||||
*
|
||||
* @param ticket 号源实体
|
||||
* @return 号源DTO
|
||||
*/
|
||||
private TicketDto convertToDto(Ticket ticket) {
|
||||
TicketDto dto = new TicketDto();
|
||||
dto.setSlot_id(ticket.getId());
|
||||
dto.setBusNo(ticket.getBusNo());
|
||||
dto.setDepartment(ticket.getDepartment());
|
||||
dto.setDoctor(ticket.getDoctor());
|
||||
|
||||
// 处理号源类型(转换为英文,前端期望的是general或expert)
|
||||
String ticketType = ticket.getTicketType();
|
||||
if ("普通".equals(ticketType)) {
|
||||
dto.setTicketType("general");
|
||||
} else if ("专家".equals(ticketType)) {
|
||||
dto.setTicketType("expert");
|
||||
} else {
|
||||
dto.setTicketType(ticketType);
|
||||
}
|
||||
|
||||
// 处理号源时间(dateTime)
|
||||
dto.setDateTime(ticket.getTime());
|
||||
|
||||
// 处理号源状态(转换为中文)
|
||||
String status = ticket.getStatus();
|
||||
switch (status) {
|
||||
case "unbooked":
|
||||
dto.setStatus("未预约");
|
||||
break;
|
||||
case "booked":
|
||||
dto.setStatus("已预约");
|
||||
break;
|
||||
case "checked":
|
||||
dto.setStatus("已取号");
|
||||
break;
|
||||
case "cancelled":
|
||||
dto.setStatus("已取消");
|
||||
break;
|
||||
case "locked":
|
||||
dto.setStatus("已锁定");
|
||||
break;
|
||||
default:
|
||||
dto.setStatus(status);
|
||||
}
|
||||
|
||||
dto.setFee(ticket.getFee());
|
||||
dto.setPatientName(ticket.getPatientName());
|
||||
dto.setPatientId(ticket.getMedicalCard()); // 就诊卡号
|
||||
dto.setPhone(ticket.getPhone());
|
||||
|
||||
// 获取患者性别
|
||||
if (ticket.getPatientId() != null) {
|
||||
Patient patient = patientService.getById(ticket.getPatientId());
|
||||
if (patient != null) {
|
||||
Integer genderEnum = patient.getGenderEnum();
|
||||
if (genderEnum != null) {
|
||||
switch (genderEnum) {
|
||||
case 1:
|
||||
dto.setGender("男");
|
||||
break;
|
||||
case 2:
|
||||
dto.setGender("女");
|
||||
break;
|
||||
default:
|
||||
dto.setGender("未知");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dto.setAppointmentDate(ticket.getAppointmentDate());
|
||||
dto.setAppointmentTime(ticket.getAppointmentTime());
|
||||
dto.setDepartmentId(ticket.getDepartmentId());
|
||||
dto.setDoctorId(ticket.getDoctorId());
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.openhis.web.appointmentmanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.DeptAppointmentHours;
|
||||
import com.openhis.web.appointmentmanage.appservice.IDeptAppointmentHoursAppService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 科室预约工作时间维护 Controller
|
||||
*
|
||||
* @author openhis
|
||||
* @date 2025-12-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/appoinment/dept-appthours")
|
||||
public class DeptAppthoursController {
|
||||
|
||||
@Resource
|
||||
private IDeptAppointmentHoursAppService deptAppointmentHoursAppService;
|
||||
|
||||
/**
|
||||
* 获取科室预约工作时间列表
|
||||
*
|
||||
* @param deptAppointmentHours 查询条件
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页大小
|
||||
* @return 列表数据
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<?> getDeptAppthoursList(
|
||||
DeptAppointmentHours deptAppointmentHours,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
return deptAppointmentHoursAppService.getDeptAppthoursList(deptAppointmentHours, pageNum, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取科室预约工作时间详情
|
||||
*
|
||||
* @param id 记录ID
|
||||
* @return 详情数据
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<?> getDeptAppthoursDetail(@PathVariable("id") Long id) {
|
||||
return deptAppointmentHoursAppService.getDeptAppthoursDetail(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增科室预约工作时间
|
||||
*
|
||||
* @param deptAppointmentHours 新增数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping
|
||||
public R<?> addDeptAppthours(@RequestBody DeptAppointmentHours deptAppointmentHours) {
|
||||
return deptAppointmentHoursAppService.addDeptAppthours(deptAppointmentHours);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改科室预约工作时间
|
||||
*
|
||||
* @param deptAppointmentHours 修改数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping
|
||||
public R<?> updateDeptAppthours(@RequestBody DeptAppointmentHours deptAppointmentHours) {
|
||||
return deptAppointmentHoursAppService.updateDeptAppthours(deptAppointmentHours);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除科室预约工作时间
|
||||
*
|
||||
* @param id 记录ID
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public R<?> deleteDeptAppthours(@PathVariable("id") Long id) {
|
||||
return deptAppointmentHoursAppService.deleteDeptAppthours(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.openhis.web.appointmentmanage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.annotation.Anonymous;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.appointmentmanage.appservice.ITicketAppService;
|
||||
import com.openhis.web.appointmentmanage.dto.TicketDto;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 号源管理控制器
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/appointment/ticket")
|
||||
public class TicketController {
|
||||
|
||||
@Resource
|
||||
private ITicketAppService ticketAppService;
|
||||
|
||||
/**
|
||||
* 查询号源列表
|
||||
*
|
||||
* @param params 查询参数
|
||||
* @return 号源列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public R<?> listTicket(@RequestBody Map<String, Object> params) {
|
||||
return ticketAppService.listTicket(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询号源列表(支持GET请求,兼容旧版本)
|
||||
*
|
||||
* @param params 查询参数
|
||||
* @return 号源列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R<?> listTicketByGet(@RequestParam Map<String, Object> params) {
|
||||
return ticketAppService.listTicket(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有号源(用于测试)
|
||||
*
|
||||
* @return 所有号源列表
|
||||
*/
|
||||
@Anonymous
|
||||
@GetMapping("/listAll")
|
||||
public R<?> listAllTickets() {
|
||||
return ticketAppService.listAllTickets();
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约号源
|
||||
*
|
||||
* @param params 预约参数
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/book")
|
||||
public R<?> bookTicket(@RequestBody Map<String, Object> params) {
|
||||
return ticketAppService.bookTicket(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
*
|
||||
* @param ticketId 号源ID
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/cancel")
|
||||
public R<?> cancelTicket(@RequestParam Long ticketId) {
|
||||
return ticketAppService.cancelTicket(ticketId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取号
|
||||
*
|
||||
* @param ticketId 号源ID
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/checkin")
|
||||
public R<?> checkInTicket(@RequestParam Long ticketId) {
|
||||
return ticketAppService.checkInTicket(ticketId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停诊
|
||||
*
|
||||
* @param ticketId 号源ID
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/cancelConsultation")
|
||||
public R<?> cancelConsultation(@RequestParam Long ticketId) {
|
||||
return ticketAppService.cancelConsultation(ticketId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.openhis.web.appointmentmanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 号源管理DTO
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TicketDto {
|
||||
|
||||
/**
|
||||
* 号源唯一ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long slot_id;
|
||||
|
||||
/**
|
||||
* 号源编码
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 科室名称
|
||||
*/
|
||||
private String department;
|
||||
|
||||
/**
|
||||
* 医生姓名
|
||||
*/
|
||||
private String doctor;
|
||||
|
||||
/**
|
||||
* 号源类型 (普通/专家)
|
||||
*/
|
||||
private String ticketType;
|
||||
|
||||
/**
|
||||
* 号源时间
|
||||
*/
|
||||
private String dateTime;
|
||||
|
||||
/**
|
||||
* 状态 (unbooked:未预约, booked:已预约, checked:已取号, cancelled:已取消, locked:已锁定)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 挂号费
|
||||
*/
|
||||
private String fee;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 就诊卡号
|
||||
*/
|
||||
private String patientId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 患者性别
|
||||
*/
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 预约日期
|
||||
*/
|
||||
private Date appointmentDate;
|
||||
|
||||
/**
|
||||
* 预约时间
|
||||
*/
|
||||
private Date appointmentTime;
|
||||
|
||||
/**
|
||||
* 科室ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 医生ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long doctorId;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.openhis.web.basedatamanage.appservice;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.OperatingRoomDto;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 手术室应用Service接口
|
||||
*
|
||||
* @author system
|
||||
* @date 2026-01-04
|
||||
*/
|
||||
public interface IOperatingRoomAppService {
|
||||
|
||||
/**
|
||||
* 分页查询手术室列表
|
||||
*
|
||||
* @param operatingRoomDto 查询条件
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @param request 请求
|
||||
* @return 手术室列表
|
||||
*/
|
||||
R<?> getOperatingRoomPage(OperatingRoomDto operatingRoomDto, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 根据ID查询手术室详情
|
||||
*
|
||||
* @param id 手术室ID
|
||||
* @return 手术室详情
|
||||
*/
|
||||
R<?> getOperatingRoomById(Long id);
|
||||
|
||||
/**
|
||||
* 新增手术室
|
||||
*
|
||||
* @param operatingRoomDto 手术室信息
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> addOperatingRoom(@Validated OperatingRoomDto operatingRoomDto);
|
||||
|
||||
/**
|
||||
* 修改手术室
|
||||
*
|
||||
* @param operatingRoomDto 手术室信息
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> updateOperatingRoom(@Validated OperatingRoomDto operatingRoomDto);
|
||||
|
||||
/**
|
||||
* 删除手术室
|
||||
*
|
||||
* @param ids 手术室ID(支持批量)
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> deleteOperatingRoom(String ids);
|
||||
|
||||
/**
|
||||
* 启用手术室
|
||||
*
|
||||
* @param ids 手术室ID数组
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> enableOperatingRoom(java.util.List<Long> ids);
|
||||
|
||||
/**
|
||||
* 停用手术室
|
||||
*
|
||||
* @param ids 手术室ID数组
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> disableOperatingRoom(java.util.List<Long> ids);
|
||||
}
|
||||
@@ -0,0 +1,340 @@
|
||||
package com.openhis.web.basedatamanage.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.ChineseConvertUtils;
|
||||
import com.core.common.utils.DictUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.openhis.administration.domain.OperatingRoom;
|
||||
import com.openhis.administration.mapper.OperatingRoomMapper;
|
||||
import com.openhis.administration.service.IOperatingRoomService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import com.openhis.common.enums.AssignSeqEnum;
|
||||
import com.openhis.common.enums.LocationStatus;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IOperatingRoomAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OperatingRoomDto;
|
||||
import com.openhis.web.common.appservice.ICommonService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 手术室应用Service实现类
|
||||
*
|
||||
* @author system
|
||||
* @date 2026-01-04
|
||||
*/
|
||||
@Service
|
||||
public class OperatingRoomAppServiceImpl implements IOperatingRoomAppService {
|
||||
|
||||
@Resource
|
||||
private IOperatingRoomService operatingRoomService;
|
||||
|
||||
@Resource
|
||||
private OperatingRoomMapper operatingRoomMapper;
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Resource
|
||||
private ICommonService commonService;
|
||||
|
||||
/**
|
||||
* 分页查询手术室列表
|
||||
*
|
||||
* @param operatingRoomDto 查询条件
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @param request 请求
|
||||
* @return 手术室列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOperatingRoomPage(OperatingRoomDto operatingRoomDto, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<OperatingRoom> queryWrapper = HisQueryUtils.buildQueryWrapper(operatingRoomDto,
|
||||
operatingRoomDto.getName(),
|
||||
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), request);
|
||||
|
||||
// 设置排序
|
||||
queryWrapper.orderByDesc("display_order").orderByDesc("create_time");
|
||||
|
||||
// 查询手术室分页列表
|
||||
Page<OperatingRoomDto> operatingRoomPage =
|
||||
HisPageUtils.selectPage(operatingRoomMapper, queryWrapper, pageNo, pageSize, OperatingRoomDto.class);
|
||||
|
||||
// 处理枚举字段显示文本
|
||||
operatingRoomPage.getRecords().forEach(e -> {
|
||||
// 状态
|
||||
e.setStatusEnum_dictText(e.getStatusEnum() != null && e.getStatusEnum() == 1 ? "启用" : "停用");
|
||||
// 类型
|
||||
if (e.getRoomTypeEnum() != null) {
|
||||
e.setRoomTypeEnum_dictText(DictUtils.getDictLabel("operating_room_type", String.valueOf(e.getRoomTypeEnum())));
|
||||
}
|
||||
// 如果有机构ID,查询机构名称
|
||||
if (e.getOrganizationId() != null) {
|
||||
String orgName = commonService.getOrgNameById(e.getOrganizationId());
|
||||
e.setOrganizationName(orgName);
|
||||
}
|
||||
// 拼音码
|
||||
e.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(e.getName()));
|
||||
// 五笔码
|
||||
e.setWbStr(ChineseConvertUtils.toWBFirstLetter(e.getName()));
|
||||
});
|
||||
|
||||
return R.ok(operatingRoomPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询手术室详情
|
||||
*
|
||||
* @param id 手术室ID
|
||||
* @return 手术室详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOperatingRoomById(Long id) {
|
||||
OperatingRoom operatingRoom = operatingRoomService.getById(id);
|
||||
if (operatingRoom == null) {
|
||||
return R.fail("手术室信息不存在");
|
||||
}
|
||||
|
||||
OperatingRoomDto operatingRoomDto = new OperatingRoomDto();
|
||||
BeanUtils.copyProperties(operatingRoom, operatingRoomDto);
|
||||
|
||||
// 状态描述
|
||||
operatingRoomDto.setStatusEnum_dictText(
|
||||
operatingRoom.getStatusEnum() != null && operatingRoom.getStatusEnum() == 1 ? "启用" : "停用");
|
||||
|
||||
// 类型描述
|
||||
if (operatingRoom.getRoomTypeEnum() != null) {
|
||||
operatingRoomDto.setRoomTypeEnum_dictText(DictUtils.getDictLabel("operating_room_type", String.valueOf(operatingRoom.getRoomTypeEnum())));
|
||||
}
|
||||
|
||||
// 如果有机构ID,查询机构名称
|
||||
if (operatingRoom.getOrganizationId() != null) {
|
||||
String orgName = commonService.getOrgNameById(operatingRoom.getOrganizationId());
|
||||
operatingRoomDto.setOrganizationName(orgName);
|
||||
}
|
||||
|
||||
return R.ok(operatingRoomDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增手术室
|
||||
*
|
||||
* @param operatingRoomDto 手术室信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> addOperatingRoom(OperatingRoomDto operatingRoomDto) {
|
||||
// 校验名称不能为空
|
||||
if (StringUtils.isEmpty(operatingRoomDto.getName())) {
|
||||
return R.fail("手术室名称不能为空");
|
||||
}
|
||||
|
||||
// 校验房间号不能为空
|
||||
if (StringUtils.isEmpty(operatingRoomDto.getBusNo())) {
|
||||
return R.fail("房间号不能为空");
|
||||
}
|
||||
|
||||
// 去除空格
|
||||
String name = operatingRoomDto.getName().replaceAll("[ ]", "");
|
||||
operatingRoomDto.setName(name);
|
||||
|
||||
// 判断是否存在同名
|
||||
if (isExistName(name, null)) {
|
||||
return R.fail("【" + name + "】已存在");
|
||||
}
|
||||
|
||||
// 判断房间号是否已存在
|
||||
if (isExistBusNo(operatingRoomDto.getBusNo(), null)) {
|
||||
return R.fail("房间号【" + operatingRoomDto.getBusNo() + "】已存在");
|
||||
}
|
||||
|
||||
OperatingRoom operatingRoom = new OperatingRoom();
|
||||
BeanUtils.copyProperties(operatingRoomDto, operatingRoom);
|
||||
|
||||
// 拼音码
|
||||
operatingRoom.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(operatingRoomDto.getName()));
|
||||
// 五笔码
|
||||
operatingRoom.setWbStr(ChineseConvertUtils.toWBFirstLetter(operatingRoomDto.getName()));
|
||||
|
||||
boolean result = operatingRoomService.save(operatingRoom);
|
||||
if (result) {
|
||||
return R.ok(null, "新增成功");
|
||||
}
|
||||
return R.fail("新增失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改手术室
|
||||
*
|
||||
* @param operatingRoomDto 手术室信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> updateOperatingRoom(OperatingRoomDto operatingRoomDto) {
|
||||
// 校验手术室是否存在
|
||||
OperatingRoom existOperatingRoom = operatingRoomService.getById(operatingRoomDto.getId());
|
||||
if (existOperatingRoom == null) {
|
||||
return R.fail("手术室信息不存在");
|
||||
}
|
||||
|
||||
// 校验名称不能为空
|
||||
if (StringUtils.isEmpty(operatingRoomDto.getName())) {
|
||||
return R.fail("手术室名称不能为空");
|
||||
}
|
||||
|
||||
// 校验房间号不能为空
|
||||
if (StringUtils.isEmpty(operatingRoomDto.getBusNo())) {
|
||||
return R.fail("房间号不能为空");
|
||||
}
|
||||
|
||||
// 去除空格
|
||||
String name = operatingRoomDto.getName().replaceAll("[ ]", "");
|
||||
operatingRoomDto.setName(name);
|
||||
|
||||
// 判断是否存在同名(排除自己)
|
||||
if (isExistName(name, operatingRoomDto.getId())) {
|
||||
return R.fail("【" + name + "】已存在");
|
||||
}
|
||||
|
||||
// 判断房间号是否已存在(排除自己)
|
||||
if (isExistBusNo(operatingRoomDto.getBusNo(), operatingRoomDto.getId())) {
|
||||
return R.fail("房间号【" + operatingRoomDto.getBusNo() + "】已存在");
|
||||
}
|
||||
|
||||
OperatingRoom operatingRoom = new OperatingRoom();
|
||||
BeanUtils.copyProperties(operatingRoomDto, operatingRoom);
|
||||
|
||||
// 拼音码
|
||||
operatingRoom.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(operatingRoomDto.getName()));
|
||||
// 五笔码
|
||||
operatingRoom.setWbStr(ChineseConvertUtils.toWBFirstLetter(operatingRoomDto.getName()));
|
||||
|
||||
boolean result = operatingRoomService.updateById(operatingRoom);
|
||||
if (result) {
|
||||
return R.ok(null, "修改成功");
|
||||
}
|
||||
return R.fail("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除手术室
|
||||
*
|
||||
* @param ids 手术室ID(支持批量)
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteOperatingRoom(String ids) {
|
||||
// 解析ID字符串
|
||||
String[] idArray = ids.split(",");
|
||||
List<Long> idList = new ArrayList<>();
|
||||
for (String idStr : idArray) {
|
||||
try {
|
||||
idList.add(Long.parseLong(idStr.trim()));
|
||||
} catch (NumberFormatException e) {
|
||||
return R.fail("ID格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 删除手术室
|
||||
boolean result = operatingRoomService.removeByIds(idList);
|
||||
if (result) {
|
||||
return R.ok(null, "删除成功");
|
||||
}
|
||||
return R.fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用手术室
|
||||
*
|
||||
* @param ids 手术室ID数组
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> enableOperatingRoom(List<Long> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return R.fail("请选择要启用的手术室");
|
||||
}
|
||||
|
||||
// 批量更新状态为启用
|
||||
List<OperatingRoom> operatingRooms = operatingRoomService.listByIds(ids);
|
||||
for (OperatingRoom operatingRoom : operatingRooms) {
|
||||
operatingRoom.setStatusEnum(LocationStatus.ACTIVE.getValue());
|
||||
}
|
||||
|
||||
boolean result = operatingRoomService.updateBatchById(operatingRooms);
|
||||
if (result) {
|
||||
return R.ok("启用成功");
|
||||
}
|
||||
return R.fail("启用失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用手术室
|
||||
*
|
||||
* @param ids 手术室ID数组
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> disableOperatingRoom(List<Long> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return R.fail("请选择要停用的手术室");
|
||||
}
|
||||
|
||||
// 批量更新状态为停用
|
||||
List<OperatingRoom> operatingRooms = operatingRoomService.listByIds(ids);
|
||||
for (OperatingRoom operatingRoom : operatingRooms) {
|
||||
operatingRoom.setStatusEnum(LocationStatus.INACTIVE.getValue());
|
||||
}
|
||||
|
||||
boolean result = operatingRoomService.updateBatchById(operatingRooms);
|
||||
if (result) {
|
||||
return R.ok("停用成功");
|
||||
}
|
||||
return R.fail("停用失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断名称是否已存在
|
||||
*
|
||||
* @param name 名称
|
||||
* @param excludeId 排除的ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isExistName(String name, Long excludeId) {
|
||||
LambdaQueryWrapper<OperatingRoom> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OperatingRoom::getName, name);
|
||||
if (excludeId != null) {
|
||||
queryWrapper.ne(OperatingRoom::getId, excludeId);
|
||||
}
|
||||
return operatingRoomService.count(queryWrapper) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断房间号是否已存在
|
||||
*
|
||||
* @param busNo 房间号
|
||||
* @param excludeId 排除的ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
private boolean isExistBusNo(String busNo, Long excludeId) {
|
||||
LambdaQueryWrapper<OperatingRoom> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OperatingRoom::getBusNo, busNo);
|
||||
if (excludeId != null) {
|
||||
queryWrapper.ne(OperatingRoom::getId, excludeId);
|
||||
}
|
||||
return operatingRoomService.count(queryWrapper) > 0;
|
||||
}
|
||||
}
|
||||
@@ -407,8 +407,12 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
// iBizUserService.remove(new LambdaQueryWrapper<BizUser>().eq(BizUser::getUserId, userId));
|
||||
practitionerAppAppMapper.delUser(userId);
|
||||
practitionerAppAppMapper.delUserRole(userId);
|
||||
Practitioner one =
|
||||
iPractitionerService.getOne(new LambdaQueryWrapper<Practitioner>().eq(Practitioner::getUserId, userId));
|
||||
// 使用list()避免TooManyResultsException异常,然后取第一个记录
|
||||
List<Practitioner> practitionerList = iPractitionerService.list(new LambdaQueryWrapper<Practitioner>().eq(Practitioner::getUserId, userId));
|
||||
Practitioner one = practitionerList != null && !practitionerList.isEmpty() ? practitionerList.get(0) : null;
|
||||
if (one == null) {
|
||||
return R.fail(null, "未找到对应的医生信息");
|
||||
}
|
||||
Long practitionerId = one.getId();// 参与者id
|
||||
iPractitionerService.removeById(practitionerId);
|
||||
iPractitionerRoleService
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.appservice.IOperatingRoomAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OperatingRoomDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 手术室管理Controller
|
||||
*
|
||||
* @author system
|
||||
* @date 2026-01-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base-data-manage/operating-room")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class OperatingRoomController {
|
||||
|
||||
@Resource
|
||||
private IOperatingRoomAppService operatingRoomAppService;
|
||||
|
||||
/**
|
||||
* 分页查询手术室列表
|
||||
*
|
||||
* @param operatingRoomDto 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求
|
||||
* @return 手术室列表
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public R<?> getOperatingRoomPage(OperatingRoomDto operatingRoomDto,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
return operatingRoomAppService.getOperatingRoomPage(operatingRoomDto, pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手术室详情
|
||||
*
|
||||
* @param id 手术室ID
|
||||
* @return 手术室详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<?> getOperatingRoomById(@PathVariable Long id) {
|
||||
return operatingRoomAppService.getOperatingRoomById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增手术室
|
||||
*
|
||||
* @param operatingRoomDto 手术室信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping
|
||||
public R<?> addOperatingRoom(@Validated @RequestBody OperatingRoomDto operatingRoomDto) {
|
||||
return operatingRoomAppService.addOperatingRoom(operatingRoomDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改手术室
|
||||
*
|
||||
* @param operatingRoomDto 手术室信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping
|
||||
public R<?> updateOperatingRoom(@Validated @RequestBody OperatingRoomDto operatingRoomDto) {
|
||||
return operatingRoomAppService.updateOperatingRoom(operatingRoomDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除手术室
|
||||
*
|
||||
* @param ids 手术室ID(支持批量)
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<?> deleteOperatingRoom(@PathVariable String ids) {
|
||||
return operatingRoomAppService.deleteOperatingRoom(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用手术室
|
||||
*
|
||||
* @param ids 手术室ID数组
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/enable")
|
||||
public R<?> enableOperatingRoom(@RequestBody List<Long> ids) {
|
||||
return operatingRoomAppService.enableOperatingRoom(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用手术室
|
||||
*
|
||||
* @param ids 手术室ID数组
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/disable")
|
||||
public R<?> disableOperatingRoom(@RequestBody List<Long> ids) {
|
||||
return operatingRoomAppService.disableOperatingRoom(ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 手术室DTO
|
||||
*
|
||||
* @author system
|
||||
* @date 2026-01-04
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OperatingRoomDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 手术室名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 手术室类型
|
||||
*/
|
||||
@Dict(dictCode = "operating_room_type")
|
||||
private Integer roomTypeEnum;
|
||||
private String roomTypeEnum_dictText;
|
||||
|
||||
/**
|
||||
* 所属机构ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long organizationId;
|
||||
|
||||
/**
|
||||
* 机构名称
|
||||
*/
|
||||
private String organizationName;
|
||||
|
||||
/**
|
||||
* 位置描述
|
||||
*/
|
||||
private String locationDescription;
|
||||
|
||||
/**
|
||||
* 设备配置
|
||||
*/
|
||||
private String equipmentConfig;
|
||||
|
||||
/**
|
||||
* 容纳人数
|
||||
*/
|
||||
private Integer capacity;
|
||||
|
||||
/**
|
||||
* 状态编码
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
|
||||
/**
|
||||
* 状态描述
|
||||
*/
|
||||
private String statusEnum_dictText;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer displayOrder;
|
||||
|
||||
/**
|
||||
* 拼音码
|
||||
*/
|
||||
private String pyStr;
|
||||
|
||||
/**
|
||||
* 五笔码
|
||||
*/
|
||||
private String wbStr;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.openhis.web.chargemanage.dto.CurrentDayEncounterDto;
|
||||
import com.openhis.web.chargemanage.dto.OrgMetadata;
|
||||
import com.openhis.web.chargemanage.dto.PatientMetadata;
|
||||
import com.openhis.web.chargemanage.dto.PractitionerMetadata;
|
||||
import com.openhis.web.chargemanage.dto.ReprintRegistrationDto;
|
||||
import com.openhis.web.paymentmanage.dto.CancelRegPaymentDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -85,4 +86,12 @@ public interface IOutpatientRegistrationAppService {
|
||||
*/
|
||||
R<?> cancelRegister(Long encounterId);
|
||||
|
||||
/**
|
||||
* 补打挂号
|
||||
*
|
||||
* @param reprintRegistrationDto 补打挂号信息
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> reprintRegistration(ReprintRegistrationDto reprintRegistrationDto);
|
||||
|
||||
}
|
||||
|
||||
@@ -65,8 +65,16 @@ public class OutpatientPricingAppServiceImpl implements IOutpatientPricingAppSer
|
||||
@Override
|
||||
public IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
|
||||
Long organizationId, Integer pageNo, Integer pageSize) {
|
||||
// 根据前端传入的adviceType动态构建查询类型列表
|
||||
// 如果adviceType不为空,只查询该类型;如果为空,查询所有类型(1:药品, 2:耗材, 3:诊疗)
|
||||
List<Integer> adviceTypes;
|
||||
if (adviceBaseDto != null && adviceBaseDto.getAdviceType() != null) {
|
||||
adviceTypes = List.of(adviceBaseDto.getAdviceType());
|
||||
} else {
|
||||
adviceTypes = List.of(1, 2, 3);
|
||||
}
|
||||
return iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, null,
|
||||
organizationId, pageNo, pageSize, Whether.YES.getValue(), List.of(1, 2, 3), null);
|
||||
organizationId, pageNo, pageSize, Whether.YES.getValue(), adviceTypes, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.openhis.web.chargemanage.dto.CurrentDayEncounterDto;
|
||||
import com.openhis.web.chargemanage.dto.OrgMetadata;
|
||||
import com.openhis.web.chargemanage.dto.PatientMetadata;
|
||||
import com.openhis.web.chargemanage.dto.PractitionerMetadata;
|
||||
import com.openhis.web.chargemanage.dto.ReprintRegistrationDto;
|
||||
import com.openhis.web.chargemanage.mapper.OutpatientRegistrationAppMapper;
|
||||
import com.openhis.web.paymentmanage.appservice.IPaymentRecService;
|
||||
import com.openhis.web.paymentmanage.dto.CancelPaymentDto;
|
||||
@@ -37,10 +38,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -119,6 +117,19 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
||||
List<Long> patientIdList =
|
||||
iEncounterService.list().stream().map(e -> e.getPatientId()).collect(Collectors.toList());
|
||||
|
||||
// 一次性获取所有患者标识
|
||||
List<Long> patientIds = patientMetadataPage.getRecords().stream()
|
||||
.map(PatientMetadata::getId)
|
||||
.collect(Collectors.toList());
|
||||
final Map<Long, List<PatientIdentifier>> patientIdentifierMap;
|
||||
if (!patientIds.isEmpty()) {
|
||||
patientIdentifierMap = patientIdentifierService.list(
|
||||
new LambdaQueryWrapper<PatientIdentifier>().in(PatientIdentifier::getPatientId, patientIds)
|
||||
).stream().collect(Collectors.groupingBy(PatientIdentifier::getPatientId));
|
||||
} else {
|
||||
patientIdentifierMap = new HashMap<>();
|
||||
}
|
||||
|
||||
patientMetadataPage.getRecords().forEach(e -> {
|
||||
// 性别枚举
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
@@ -127,9 +138,8 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
||||
// 初复诊
|
||||
e.setFirstEnum_enumText(patientIdList.contains(e.getId()) ? EncounterType.FOLLOW_UP.getInfo()
|
||||
: EncounterType.INITIAL.getInfo());
|
||||
// 患者标识
|
||||
List<PatientIdentifier> patientIdentifiers = patientIdentifierService
|
||||
.list(new LambdaQueryWrapper<PatientIdentifier>().eq(PatientIdentifier::getPatientId, e.getId()));
|
||||
// 患者标识 - 从Map中获取,避免N+1查询
|
||||
List<PatientIdentifier> patientIdentifiers = patientIdentifierMap.get(e.getId());
|
||||
if (patientIdentifiers != null && !patientIdentifiers.isEmpty()) {
|
||||
// 取第一个标识号,如果需要可以根据业务需求选择其他逻辑
|
||||
e.setIdentifierNo(patientIdentifiers.get(0).getIdentifierNo());
|
||||
@@ -274,7 +284,7 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
||||
HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<CurrentDayEncounterDto> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
|
||||
new HashSet<>(Arrays.asList("patient_name", "organization_name", "practitioner_name", "healthcare_name")),
|
||||
new HashSet<>(Arrays.asList("patient_name", "organization_name", "practitioner_name", "healthcare_name", "identifier_no")),
|
||||
request);
|
||||
|
||||
// 手动处理 statusEnum 参数(用于过滤退号记录)
|
||||
@@ -321,4 +331,18 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
||||
return R.ok("已取消挂号");
|
||||
}
|
||||
|
||||
/**
|
||||
* 补打挂号
|
||||
* 补打挂号不需要修改数据库,只需要返回成功即可,前端已有所有需要的数据用于打印
|
||||
*
|
||||
* @param reprintRegistrationDto 补打挂号信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> reprintRegistration(ReprintRegistrationDto reprintRegistrationDto) {
|
||||
// 补打挂号只是重新打印,不需要修改数据库
|
||||
// 可以在这里添加日志记录补打操作
|
||||
return R.ok(null, "补打挂号成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.openhis.common.enums.PriorityLevel;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientRegistrationAppService;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientRegistrationInitDto;
|
||||
import com.openhis.web.chargemanage.dto.ReprintRegistrationDto;
|
||||
import com.openhis.web.paymentmanage.appservice.IEleInvoiceService;
|
||||
import com.openhis.web.paymentmanage.dto.CancelRegPaymentDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -151,4 +152,15 @@ public class OutpatientRegistrationController {
|
||||
return R.ok(iOutpatientRegistrationAppService.getCurrentDayEncounter(searchKey, pageNo, pageSize, request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 补打挂号
|
||||
*
|
||||
* @param reprintRegistrationDto 补打挂号信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping(value = "/reprint")
|
||||
public R<?> reprintRegistration(@RequestBody ReprintRegistrationDto reprintRegistrationDto) {
|
||||
return iOutpatientRegistrationAppService.reprintRegistration(reprintRegistrationDto);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -136,4 +136,14 @@ public class CurrentDayEncounterDto {
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 就诊卡号
|
||||
*/
|
||||
private String identifierNo;
|
||||
|
||||
/**
|
||||
* 流水号(就诊当日序号)
|
||||
*/
|
||||
private Integer displayOrder;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 补打挂号 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ReprintRegistrationDto {
|
||||
|
||||
/**
|
||||
* 就诊ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 就诊卡号
|
||||
*/
|
||||
private String cardNo;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 挂号科室
|
||||
*/
|
||||
private String organizationName;
|
||||
|
||||
/**
|
||||
* 医生姓名
|
||||
*/
|
||||
private String practitionerName;
|
||||
|
||||
/**
|
||||
* 挂号费
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 诊疗费
|
||||
*/
|
||||
private BigDecimal activityPrice;
|
||||
|
||||
/**
|
||||
* 病历费
|
||||
*/
|
||||
private BigDecimal medicalRecordFee;
|
||||
|
||||
/**
|
||||
* 合计
|
||||
*/
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/**
|
||||
* 预约/挂号时间
|
||||
*/
|
||||
private String visitTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.core.common.core.domain.R;
|
||||
import com.openhis.check.domain.LisGroupInfo;
|
||||
|
||||
public interface ILisGroupInfoAppService {
|
||||
R<?> getLisGroupInfoList();
|
||||
R<?> getLisGroupInfoList(Integer pageNum, Integer pageSize);
|
||||
|
||||
R<?> add(LisGroupInfo lisGroupInfo);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.openhis.web.check.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.check.domain.LisGroupInfo;
|
||||
import com.openhis.check.service.ILisGroupInfoService;
|
||||
@@ -17,11 +18,14 @@ public class LisGroupInfoAppServiceImpl implements ILisGroupInfoAppService {
|
||||
@Resource
|
||||
private ILisGroupInfoService lisGroupInfoService;
|
||||
@Override
|
||||
public R<?> getLisGroupInfoList() {
|
||||
List<LisGroupInfo> list = lisGroupInfoService.list();
|
||||
public R<?> getLisGroupInfoList(Integer pageNum, Integer pageSize) {
|
||||
Page<LisGroupInfo> page = new Page<>(pageNum, pageSize);
|
||||
Page<LisGroupInfo> list = lisGroupInfoService.page(page);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> add(LisGroupInfo lisGroupInfo) {
|
||||
if (ObjectUtil.isEmpty(lisGroupInfo)) {
|
||||
|
||||
@@ -19,8 +19,8 @@ public class LisGroupInfoController {
|
||||
*
|
||||
* */
|
||||
@GetMapping("/list")
|
||||
public R<?> getLisGroupInfoList(){
|
||||
return R.ok(lisGroupInfoAppService.getLisGroupInfoList());
|
||||
public R<?> getLisGroupInfoList(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
|
||||
return R.ok(lisGroupInfoAppService.getLisGroupInfoList(pageNum, pageSize));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -2,8 +2,11 @@ package com.openhis.web.clinicalmanage.appservice;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.domain.Encounter;
|
||||
import com.openhis.web.clinicalmanage.dto.SurgeryDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 手术管理应用Service接口
|
||||
*
|
||||
@@ -62,4 +65,12 @@ public interface ISurgeryAppService {
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> updateSurgeryStatus(Long id, Integer statusEnum);
|
||||
|
||||
/**
|
||||
* 根据患者ID查询就诊列表
|
||||
*
|
||||
* @param patientId 患者ID
|
||||
* @return 就诊列表
|
||||
*/
|
||||
R<List<Encounter>> getEncounterListByPatientId(Long patientId);
|
||||
}
|
||||
|
||||
@@ -5,29 +5,53 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.core.domain.entity.SysUser;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.system.service.ISysUserService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.openhis.administration.domain.ChargeItem;
|
||||
import com.openhis.administration.domain.Encounter;
|
||||
import com.openhis.administration.domain.OperatingRoom;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.administration.service.IAccountService;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.administration.service.IEncounterService;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.administration.service.IOperatingRoomService;
|
||||
import com.openhis.administration.service.IPatientService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.clinical.domain.Surgery;
|
||||
import com.openhis.clinical.service.ISurgeryService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.ChargeItemStatus;
|
||||
import com.openhis.common.enums.GenerateSource;
|
||||
import com.openhis.common.enums.RequestStatus;
|
||||
import com.openhis.common.enums.TherapyTimeType;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.common.utils.RedisKeys;
|
||||
import com.core.common.core.redis.RedisCache;
|
||||
import com.openhis.document.domain.RequestForm;
|
||||
import com.openhis.document.service.IRequestFormService;
|
||||
import com.openhis.web.clinicalmanage.appservice.ISurgeryAppService;
|
||||
import com.openhis.web.clinicalmanage.dto.SurgeryDto;
|
||||
import com.openhis.web.clinicalmanage.mapper.SurgeryAppMapper;
|
||||
import com.openhis.workflow.domain.ServiceRequest;
|
||||
import com.openhis.workflow.service.IActivityDefinitionService;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.core.framework.datasource.DynamicDataSourceContextHolder.log;
|
||||
|
||||
/**
|
||||
* 手术管理应用Service业务层处理
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-30
|
||||
*/
|
||||
@Service
|
||||
public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
||||
|
||||
@@ -40,8 +64,40 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
||||
@Resource
|
||||
private IPatientService patientService;
|
||||
|
||||
@Resource
|
||||
private IEncounterService encounterService;
|
||||
|
||||
@Resource
|
||||
private IRequestFormService requestFormService;
|
||||
|
||||
@Resource
|
||||
private IServiceRequestService serviceRequestService;
|
||||
|
||||
@Resource
|
||||
private IChargeItemService chargeItemService;
|
||||
|
||||
@Resource
|
||||
private IActivityDefinitionService activityDefinitionService;
|
||||
|
||||
@Resource
|
||||
private IAccountService accountService;
|
||||
|
||||
@Resource
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Resource
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Resource
|
||||
private IOperatingRoomService operatingRoomService;
|
||||
|
||||
@Resource
|
||||
private com.openhis.administration.service.IPractitionerService practitionerService;
|
||||
|
||||
@Resource
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 分页查询手术列表
|
||||
*
|
||||
* @param surgeryDto 查询条件
|
||||
* @param pageNo 当前页
|
||||
@@ -65,16 +121,57 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
||||
|
||||
/**
|
||||
* 根据ID查询手术详情
|
||||
*
|
||||
*
|
||||
* @param id 手术ID
|
||||
* @return 手术详情
|
||||
*/
|
||||
@Override
|
||||
public R<SurgeryDto> getSurgeryDetail(Long id) {
|
||||
String cacheKey = RedisKeys.getSurgeryKey(id);
|
||||
Object cachedObject = redisCache.getCacheObject(cacheKey);
|
||||
|
||||
// 先从Redis缓存中获取
|
||||
if (cachedObject != null) {
|
||||
if (cachedObject instanceof SurgeryDto) {
|
||||
SurgeryDto surgeryDto = (SurgeryDto) cachedObject;
|
||||
log.info("从Redis缓存中获取手术信息 - surgeryId: {}", id);
|
||||
return R.ok(surgeryDto);
|
||||
} else {
|
||||
log.warn("Redis缓存中手术信息类型不匹配 - surgeryId: {}", id);
|
||||
}
|
||||
}
|
||||
|
||||
// 缓存中没有,从数据库查询
|
||||
SurgeryDto surgeryDto = surgeryAppMapper.getSurgeryDetail(id);
|
||||
if (surgeryDto == null) {
|
||||
return R.fail("手术信息不存在");
|
||||
}
|
||||
|
||||
// 从申请单中获取次要手术信息
|
||||
if (surgeryDto.getSurgeryNo() != null) {
|
||||
LambdaQueryWrapper<RequestForm> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(RequestForm::getPrescriptionNo, surgeryDto.getSurgeryNo());
|
||||
RequestForm requestForm = requestFormService.getOne(queryWrapper);
|
||||
if (requestForm != null && requestForm.getDescJson() != null) {
|
||||
try {
|
||||
Map<String, Object> map = new ObjectMapper().readValue(requestForm.getDescJson(), Map.class);
|
||||
if (map.containsKey("secondarySurgeries")) {
|
||||
surgeryDto.setSecondarySurgeries((List<Map<String, Object>>) map.get("secondarySurgeries"));
|
||||
}
|
||||
// 增加手术指征的回显兜底(从JSON中加载)
|
||||
if (map.containsKey("surgeryIndication") && (surgeryDto.getSurgeryIndication() == null || surgeryDto.getSurgeryIndication().isEmpty())) {
|
||||
surgeryDto.setSurgeryIndication((String) map.get("surgeryIndication"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("解析手术申请单JSON失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 将查询结果存入Redis缓存(缓存30分钟)
|
||||
redisCache.setCacheObject(cacheKey, surgeryDto, 30, java.util.concurrent.TimeUnit.MINUTES);
|
||||
log.info("从数据库查询手术信息并存入Redis缓存 - surgeryId: {}", id);
|
||||
|
||||
return R.ok(surgeryDto);
|
||||
}
|
||||
|
||||
@@ -85,6 +182,7 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<?> addSurgery(SurgeryDto surgeryDto) {
|
||||
// 校验患者是否存在
|
||||
Patient patient = patientService.getById(surgeryDto.getPatientId());
|
||||
@@ -92,14 +190,183 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
||||
return R.fail("患者信息不存在");
|
||||
}
|
||||
|
||||
// 校验就诊ID是否存在
|
||||
if (surgeryDto.getEncounterId() == null) {
|
||||
return R.fail("请选择就诊流水号");
|
||||
}
|
||||
|
||||
// 校验就诊记录是否存在
|
||||
Encounter encounter = encounterService.getById(surgeryDto.getEncounterId());
|
||||
if (encounter == null) {
|
||||
return R.fail("就诊记录不存在");
|
||||
}
|
||||
|
||||
// 获取患者的自费账户ID
|
||||
Long accountId = accountService.getSelfPayAccount(surgeryDto.getEncounterId());
|
||||
if (accountId == null) {
|
||||
return R.fail("未找到患者的账户信息,请先完成挂号或住院登记");
|
||||
}
|
||||
|
||||
// 当前登录账号的科室id
|
||||
Long orgId = SecurityUtils.getLoginUser().getOrgId();
|
||||
// 当前参与者ID
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
// 当前用户ID
|
||||
Long userId = SecurityUtils.getLoginUser().getUserId();
|
||||
// 当前时间
|
||||
Date curDate = new Date();
|
||||
|
||||
// 获取申请医生姓名(从当前登录用户信息中获取)
|
||||
String applyDoctorName = SecurityUtils.getLoginUser().getUser().getNickName();
|
||||
|
||||
// 获取申请科室名称
|
||||
String applyDeptName = null;
|
||||
// 优先从用户信息的部门中获取
|
||||
if (SecurityUtils.getLoginUser().getUser().getDept() != null) {
|
||||
applyDeptName = SecurityUtils.getLoginUser().getUser().getDept().getDeptName();
|
||||
}
|
||||
// 如果用户信息中没有部门名称,则从机构表中查询
|
||||
if (applyDeptName == null && orgId != null) {
|
||||
Organization org = organizationService.getById(orgId);
|
||||
if (org != null) {
|
||||
applyDeptName = org.getName();
|
||||
}
|
||||
}
|
||||
|
||||
// 转换为实体对象
|
||||
Surgery surgery = new Surgery();
|
||||
BeanUtils.copyProperties(surgeryDto, surgery);
|
||||
|
||||
// 清空名称字段,确保从ID重新查询并填充
|
||||
surgery.setPatientName(null);
|
||||
surgery.setMainSurgeonName(null);
|
||||
surgery.setAnesthetistName(null);
|
||||
surgery.setAssistant1Name(null);
|
||||
surgery.setAssistant2Name(null);
|
||||
surgery.setScrubNurseName(null);
|
||||
surgery.setOperatingRoomName(null);
|
||||
surgery.setOrgName(null);
|
||||
surgery.setApplyDoctorName(null);
|
||||
surgery.setApplyDeptName(null);
|
||||
|
||||
// 设置申请医生信息(默认使用当前登录医生)
|
||||
// 注意:必须放在 copyProperties 之后,确保覆盖前端可能传递的空值
|
||||
log.info("设置申请医生信息 - doctorId: {}, doctorName: {}, deptId: {}, deptName: {}",
|
||||
practitionerId, applyDoctorName, orgId, applyDeptName);
|
||||
log.info("前端提交的数据 - applyDoctorId: {}, applyDoctorName: {}, applyDeptId: {}, applyDeptName: {}",
|
||||
surgeryDto.getApplyDoctorId(), surgeryDto.getApplyDoctorName(), surgeryDto.getApplyDeptId(), surgeryDto.getApplyDeptName());
|
||||
|
||||
surgery.setApplyDoctorId(practitionerId);
|
||||
surgery.setApplyDoctorName(applyDoctorName);
|
||||
surgery.setApplyDeptId(orgId);
|
||||
surgery.setApplyDeptName(applyDeptName);
|
||||
|
||||
// 填充其他人员字段的名称
|
||||
fillSurgeryNameFields(surgery);
|
||||
|
||||
// 设置创建者ID(因为数据库中 create_by 是 bigint 类型)
|
||||
// 这个值会被 MybastisColumnsHandler 自动填充,所以这里不需要设置
|
||||
|
||||
log.info("准备插入手术记录 - applyDoctorId: {}, applyDoctorName: {}, applyDeptId: {}, applyDeptName: {}",
|
||||
surgery.getApplyDoctorId(), surgery.getApplyDoctorName(), surgery.getApplyDeptId(), surgery.getApplyDeptName());
|
||||
log.info("准备插入手术记录 - mainSurgeonId: {}, mainSurgeonName: {}, anesthetistId: {}, anesthetistName: {}",
|
||||
surgery.getMainSurgeonId(), surgery.getMainSurgeonName(), surgery.getAnesthetistId(), surgery.getAnesthetistName());
|
||||
log.info("准备插入手术记录 - assistant1Id: {}, assistant1Name: {}, assistant2Id: {}, assistant2Name: {}",
|
||||
surgery.getAssistant1Id(), surgery.getAssistant1Name(), surgery.getAssistant2Id(), surgery.getAssistant2Name());
|
||||
log.info("准备插入手术记录 - operatingRoomId: {}, operatingRoomName: {}, orgId: {}, orgName: {}",
|
||||
surgery.getOperatingRoomId(), surgery.getOperatingRoomName(), surgery.getOrgId(), surgery.getOrgName());
|
||||
|
||||
Long surgeryId = surgeryService.insertSurgery(surgery);
|
||||
|
||||
log.info("手术记录插入成功 - surgeryId: {}, surgeryNo: {}", surgeryId, surgery.getSurgeryNo());
|
||||
|
||||
// 生成处方号(医嘱号)
|
||||
String prescriptionNo = surgery.getSurgeryNo();
|
||||
|
||||
// 保存申请单
|
||||
RequestForm requestForm = new RequestForm();
|
||||
requestForm.setTypeCode("SURGERY"); // 申请单类型
|
||||
requestForm.setPrescriptionNo(prescriptionNo); // 处方号(使用手术单号)
|
||||
requestForm.setName("手术申请单"); // 名称
|
||||
requestForm.setEncounterId(surgeryDto.getEncounterId()); // 就诊ID
|
||||
requestForm.setRequesterId(practitionerId); // 申请人
|
||||
requestForm.setDescJson(buildDescJson(surgeryDto)); // 描述内容
|
||||
requestFormService.save(requestForm);
|
||||
|
||||
// 生成手术医嘱
|
||||
ServiceRequest serviceRequest = new ServiceRequest();
|
||||
serviceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());
|
||||
serviceRequest.setBusNo(String.format("%04d", (int) (Math.random() * 10000)));
|
||||
serviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
|
||||
serviceRequest.setPrescriptionNo(prescriptionNo);
|
||||
serviceRequest.setTherapyEnum(TherapyTimeType.TEMPORARY.getValue());// 治疗类型
|
||||
serviceRequest.setQuantity(BigDecimal.valueOf(1)); // 请求数量
|
||||
serviceRequest.setUnitCode("次"); // 请求单位编码
|
||||
serviceRequest.setCategoryEnum(4); // 请求类型:4-手术
|
||||
serviceRequest.setActivityId(surgeryId); // 手术ID作为诊疗定义id
|
||||
serviceRequest.setPatientId(surgeryDto.getPatientId()); // 患者
|
||||
serviceRequest.setRequesterId(practitionerId); // 开方医生
|
||||
serviceRequest.setEncounterId(surgeryDto.getEncounterId()); // 就诊id
|
||||
serviceRequest.setAuthoredTime(curDate); // 请求签发时间
|
||||
serviceRequest.setOrgId(orgId); // 执行科室
|
||||
serviceRequestService.save(serviceRequest);
|
||||
|
||||
// 生成收费项目
|
||||
ChargeItem chargeItem = new ChargeItem();
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.DRAFT.getValue()); // 收费状态
|
||||
chargeItem.setBusNo("CI" + serviceRequest.getBusNo());
|
||||
chargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
|
||||
chargeItem.setPatientId(surgeryDto.getPatientId()); // 患者
|
||||
chargeItem.setContextEnum(3); // 类型:3-诊疗
|
||||
chargeItem.setEncounterId(surgeryDto.getEncounterId()); // 就诊id
|
||||
chargeItem.setAccountId(accountId); // 账户ID
|
||||
chargeItem.setDefinitionId(surgeryId); // 手术ID作为费用定价ID
|
||||
chargeItem.setEntererId(practitionerId);// 开立人ID
|
||||
chargeItem.setEnteredDate(curDate); // 开立时间
|
||||
chargeItem.setServiceTable(CommonConstants.TableName.WOR_SERVICE_REQUEST);// 医疗服务类型
|
||||
chargeItem.setServiceId(serviceRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setProductTable("cli_surgery");// 手术表
|
||||
chargeItem.setProductId(surgeryId);// 手术ID作为收费项id
|
||||
chargeItem.setRequestingOrgId(orgId); // 开立科室
|
||||
chargeItem.setQuantityValue(BigDecimal.valueOf(1)); // 数量
|
||||
chargeItem.setQuantityUnit("次"); // 单位
|
||||
chargeItem.setUnitPrice(surgeryDto.getSurgeryFee() != null ? surgeryDto.getSurgeryFee() : new BigDecimal("0.0")); // 单价
|
||||
chargeItem.setTotalPrice(surgeryDto.getTotalFee() != null ? surgeryDto.getTotalFee() : new BigDecimal("0.0")); // 总价
|
||||
chargeItemService.save(chargeItem);
|
||||
|
||||
// 清除相关缓存
|
||||
clearSurgeryAppCache(surgery);
|
||||
|
||||
return R.ok(surgeryId, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[]{"手术信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建描述JSON
|
||||
*
|
||||
* @param surgeryDto 手术信息
|
||||
* @return JSON字符串
|
||||
*/
|
||||
private String buildDescJson(SurgeryDto surgeryDto) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("surgeryName", surgeryDto.getSurgeryName() != null ? surgeryDto.getSurgeryName() : "");
|
||||
map.put("surgeryCode", surgeryDto.getSurgeryCode() != null ? surgeryDto.getSurgeryCode() : "");
|
||||
map.put("surgeryLevel", surgeryDto.getSurgeryLevel() != null ? surgeryDto.getSurgeryLevel() : "");
|
||||
map.put("surgeryIndication", surgeryDto.getSurgeryIndication() != null ? surgeryDto.getSurgeryIndication() : "");
|
||||
map.put("preoperativeDiagnosis", surgeryDto.getPreoperativeDiagnosis() != null ? surgeryDto.getPreoperativeDiagnosis() : "");
|
||||
|
||||
// 加入次要手术信息
|
||||
if (surgeryDto.getSecondarySurgeries() != null && !surgeryDto.getSecondarySurgeries().isEmpty()) {
|
||||
map.put("secondarySurgeries", surgeryDto.getSecondarySurgeries());
|
||||
}
|
||||
|
||||
try {
|
||||
return new ObjectMapper().writeValueAsString(map);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("构建手术申请单JSON失败", e);
|
||||
return "{}";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改手术信息
|
||||
*
|
||||
@@ -117,8 +384,38 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
||||
// 转换为实体对象
|
||||
Surgery surgery = new Surgery();
|
||||
BeanUtils.copyProperties(surgeryDto, surgery);
|
||||
|
||||
// 先清空名称字段,确保重新填充
|
||||
surgery.setPatientName(null);
|
||||
surgery.setMainSurgeonName(null);
|
||||
surgery.setAnesthetistName(null);
|
||||
surgery.setAssistant1Name(null);
|
||||
surgery.setAssistant2Name(null);
|
||||
surgery.setScrubNurseName(null);
|
||||
surgery.setOperatingRoomName(null);
|
||||
surgery.setOrgName(null);
|
||||
surgery.setApplyDoctorName(null);
|
||||
surgery.setApplyDeptName(null);
|
||||
|
||||
// 填充其他人员字段的名称
|
||||
fillSurgeryNameFields(surgery);
|
||||
|
||||
surgeryService.updateSurgery(surgery);
|
||||
|
||||
// 同步更新申请单中的描述内容
|
||||
if (surgery.getSurgeryNo() != null) {
|
||||
LambdaQueryWrapper<RequestForm> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(RequestForm::getPrescriptionNo, surgery.getSurgeryNo());
|
||||
RequestForm requestForm = requestFormService.getOne(queryWrapper);
|
||||
if (requestForm != null) {
|
||||
requestForm.setDescJson(buildDescJson(surgeryDto));
|
||||
requestFormService.updateById(requestForm);
|
||||
}
|
||||
}
|
||||
|
||||
// 清除相关缓存
|
||||
clearSurgeryAppCache(surgery);
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"手术信息"}));
|
||||
}
|
||||
|
||||
@@ -142,12 +439,16 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
||||
}
|
||||
|
||||
surgeryService.deleteSurgery(id);
|
||||
|
||||
// 清除相关缓存
|
||||
clearSurgeryAppCache(existSurgery);
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[]{"手术信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新手术状态
|
||||
*
|
||||
*
|
||||
* @param id 手术ID
|
||||
* @param statusEnum 状态
|
||||
* @return 结果
|
||||
@@ -161,6 +462,158 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
||||
}
|
||||
|
||||
surgeryService.updateSurgeryStatus(id, statusEnum);
|
||||
|
||||
// 清除相关缓存
|
||||
clearSurgeryAppCache(existSurgery);
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"手术状态"}));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据患者ID查询就诊列表
|
||||
*
|
||||
* @param patientId 患者ID
|
||||
* @return 就诊列表
|
||||
*/
|
||||
@Override
|
||||
public R<List<Encounter>> getEncounterListByPatientId(Long patientId) {
|
||||
if (patientId == null) {
|
||||
return R.fail("患者ID不能为空");
|
||||
}
|
||||
|
||||
// 查询该患者的所有就诊记录(进行中的优先)
|
||||
QueryWrapper<Encounter> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("patient_id", patientId)
|
||||
.in("status_enum", 2, 3) // 2-进行中, 3-已完成
|
||||
.orderByAsc("CASE WHEN status_enum = 2 THEN 0 ELSE 1 END") // 进行中的排在前面
|
||||
.orderByDesc("start_time"); // 按开始时间倒序
|
||||
|
||||
List<Encounter> encounterList = encounterService.list(wrapper);
|
||||
|
||||
if (encounterList == null || encounterList.isEmpty()) {
|
||||
return R.fail("该患者暂无就诊记录,请先挂号或办理住院");
|
||||
}
|
||||
|
||||
return R.ok(encounterList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充手术记录中的名称字段
|
||||
* 根据ID反向查询用户表、机构表、手术室表、患者表、就诊表,填充对应的名称字段
|
||||
*
|
||||
* @param surgery 手术实体对象
|
||||
*/
|
||||
private void fillSurgeryNameFields(Surgery surgery) {
|
||||
// 填充患者姓名
|
||||
if (surgery.getPatientId() != null) {
|
||||
Patient patient = patientService.getById(surgery.getPatientId());
|
||||
if (patient != null) {
|
||||
surgery.setPatientName(patient.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// 填充主刀医生姓名(使用practitionerId查询Practitioner表)
|
||||
if (surgery.getMainSurgeonId() != null) {
|
||||
com.openhis.administration.domain.Practitioner mainSurgeon = practitionerService.getById(surgery.getMainSurgeonId());
|
||||
if (mainSurgeon != null) {
|
||||
surgery.setMainSurgeonName(mainSurgeon.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// 填充麻醉医生姓名(使用practitionerId查询Practitioner表)
|
||||
if (surgery.getAnesthetistId() != null) {
|
||||
com.openhis.administration.domain.Practitioner anesthetist = practitionerService.getById(surgery.getAnesthetistId());
|
||||
if (anesthetist != null) {
|
||||
surgery.setAnesthetistName(anesthetist.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// 填充助手1姓名(使用practitionerId查询Practitioner表)
|
||||
if (surgery.getAssistant1Id() != null) {
|
||||
com.openhis.administration.domain.Practitioner assistant1 = practitionerService.getById(surgery.getAssistant1Id());
|
||||
if (assistant1 != null) {
|
||||
surgery.setAssistant1Name(assistant1.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// 填充助手2姓名(使用practitionerId查询Practitioner表)
|
||||
if (surgery.getAssistant2Id() != null) {
|
||||
com.openhis.administration.domain.Practitioner assistant2 = practitionerService.getById(surgery.getAssistant2Id());
|
||||
if (assistant2 != null) {
|
||||
surgery.setAssistant2Name(assistant2.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// 填充巡回护士姓名(使用practitionerId查询Practitioner表)
|
||||
if (surgery.getScrubNurseId() != null) {
|
||||
com.openhis.administration.domain.Practitioner scrubNurse = practitionerService.getById(surgery.getScrubNurseId());
|
||||
if (scrubNurse != null) {
|
||||
surgery.setScrubNurseName(scrubNurse.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// 填充手术室名称
|
||||
if (surgery.getOperatingRoomId() != null) {
|
||||
OperatingRoom operatingRoom = operatingRoomService.getById(surgery.getOperatingRoomId());
|
||||
if (operatingRoom != null) {
|
||||
surgery.setOperatingRoomName(operatingRoom.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// 填充执行科室名称
|
||||
if (surgery.getOrgId() != null) {
|
||||
Organization org = organizationService.getById(surgery.getOrgId());
|
||||
if (org != null) {
|
||||
surgery.setOrgName(org.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// 填充申请科室名称(如果还没有设置)
|
||||
if (surgery.getApplyDeptId() != null && (surgery.getApplyDeptName() == null || surgery.getApplyDeptName().isEmpty())) {
|
||||
Organization applyDept = organizationService.getById(surgery.getApplyDeptId());
|
||||
if (applyDept != null) {
|
||||
surgery.setApplyDeptName(applyDept.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// 填充申请医生姓名(如果还没有设置) - 使用practitionerId查询Practitioner表
|
||||
if (surgery.getApplyDoctorId() != null && (surgery.getApplyDoctorName() == null || surgery.getApplyDoctorName().isEmpty())) {
|
||||
com.openhis.administration.domain.Practitioner applyDoctor = practitionerService.getById(surgery.getApplyDoctorId());
|
||||
if (applyDoctor != null) {
|
||||
surgery.setApplyDoctorName(applyDoctor.getName());
|
||||
}
|
||||
}
|
||||
|
||||
log.info("填充手术名称字段完成 - patientName: {}, mainSurgeonName: {}, anesthetistName: {}, assistant1Name: {}, assistant2Name: {}, scrubNurseName: {}, operatingRoomName: {}, orgName: {}",
|
||||
surgery.getPatientName(), surgery.getMainSurgeonName(), surgery.getAnesthetistName(), surgery.getAssistant1Name(),
|
||||
surgery.getAssistant2Name(), surgery.getScrubNurseName(), surgery.getOperatingRoomName(), surgery.getOrgName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除手术相关的Redis缓存
|
||||
*
|
||||
* @param surgery 手术信息
|
||||
*/
|
||||
private void clearSurgeryAppCache(Surgery surgery) {
|
||||
// 清除单个手术缓存
|
||||
if (surgery.getId() != null) {
|
||||
String surgeryKey = RedisKeys.getSurgeryKey(surgery.getId());
|
||||
redisCache.deleteObject(surgeryKey);
|
||||
log.info("清除手术缓存 - surgeryId: {}", surgery.getId());
|
||||
}
|
||||
|
||||
// 清除患者手术列表缓存
|
||||
if (surgery.getPatientId() != null) {
|
||||
String patientKey = RedisKeys.getSurgeryListByPatientKey(surgery.getPatientId());
|
||||
redisCache.deleteObject(patientKey);
|
||||
log.info("清除患者手术列表缓存 - patientId: {}", surgery.getPatientId());
|
||||
}
|
||||
|
||||
// 清除就诊手术列表缓存
|
||||
if (surgery.getEncounterId() != null) {
|
||||
String encounterKey = RedisKeys.getSurgeryListByEncounterKey(surgery.getEncounterId());
|
||||
redisCache.deleteObject(encounterKey);
|
||||
log.info("清除就诊手术列表缓存 - encounterId: {}", surgery.getEncounterId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,15 @@ package com.openhis.web.clinicalmanage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.domain.Encounter;
|
||||
import com.openhis.web.clinicalmanage.appservice.ISurgeryAppService;
|
||||
import com.openhis.web.clinicalmanage.dto.SurgeryDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 手术管理Controller业务层处理
|
||||
*
|
||||
@@ -93,4 +96,15 @@ public class SurgeryController {
|
||||
public R<?> updateSurgeryStatus(@RequestParam Long id, @RequestParam Integer statusEnum) {
|
||||
return surgeryAppService.updateSurgeryStatus(id, statusEnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据患者ID查询就诊列表
|
||||
*
|
||||
* @param patientId 患者ID
|
||||
* @return 就诊列表
|
||||
*/
|
||||
@GetMapping(value = "/encounter-list")
|
||||
public R<List<Encounter>> getEncounterListByPatientId(@RequestParam Long patientId) {
|
||||
return surgeryAppService.getEncounterListByPatientId(patientId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 手术管理DTO
|
||||
@@ -43,6 +45,23 @@ public class SurgeryDto {
|
||||
/** 就诊流水号 */
|
||||
private String encounterNo;
|
||||
|
||||
/** 申请医生ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long applyDoctorId;
|
||||
|
||||
/** 申请医生姓名 */
|
||||
private String applyDoctorName;
|
||||
|
||||
/** 申请科室ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long applyDeptId;
|
||||
|
||||
/** 申请科室名称 */
|
||||
private String applyDeptName;
|
||||
|
||||
/** 手术指征 */
|
||||
private String surgeryIndication;
|
||||
|
||||
/** 手术名称 */
|
||||
private String surgeryName;
|
||||
|
||||
@@ -133,6 +152,13 @@ public class SurgeryDto {
|
||||
/** 手术室名称 */
|
||||
private String operatingRoomName;
|
||||
|
||||
/** 手术室所属机构ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long operatingRoomOrgId;
|
||||
|
||||
/** 手术室所属机构名称 */
|
||||
private String operatingRoomOrgName;
|
||||
|
||||
/** 执行科室ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
@@ -172,4 +198,19 @@ public class SurgeryDto {
|
||||
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
|
||||
/** 急诊标志 */
|
||||
private Integer emergencyFlag;
|
||||
|
||||
/** 植入高值耗材标志 */
|
||||
private Integer implantFlag;
|
||||
|
||||
/** 手术室确认时间 */
|
||||
private Date operatingRoomConfirmTime;
|
||||
|
||||
/** 手术室确认人 */
|
||||
private String operatingRoomConfirmUser;
|
||||
|
||||
/** 次要手术列表 */
|
||||
private List<Map<String, Object>> secondarySurgeries;
|
||||
}
|
||||
|
||||
@@ -203,4 +203,12 @@ public interface ICommonService {
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> lotNumberMatch(List<Long> encounterIdList);
|
||||
|
||||
/**
|
||||
* 根据机构ID获取机构名称
|
||||
*
|
||||
* @param orgId 机构ID
|
||||
* @return 机构名称
|
||||
*/
|
||||
String getOrgNameById(Long orgId);
|
||||
}
|
||||
|
||||
@@ -816,4 +816,24 @@ public class CommonServiceImpl implements ICommonService {
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据机构ID获取机构名称
|
||||
*
|
||||
* @param orgId 机构ID
|
||||
* @return 机构名称
|
||||
*/
|
||||
@Override
|
||||
public String getOrgNameById(Long orgId) {
|
||||
if (orgId == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
Organization organization = organizationService.getById(orgId);
|
||||
if (organization == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return organization.getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.openhis.web.controller;
|
||||
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.openhis.administration.domain.Encounter;
|
||||
import com.openhis.web.dto.HomeStatisticsDto;
|
||||
import com.openhis.web.service.IHomeStatisticsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 首页统计Controller
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/home")
|
||||
public class HomeStatisticsController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IHomeStatisticsService homeStatisticsService;
|
||||
|
||||
/**
|
||||
* 获取首页统计数据
|
||||
*
|
||||
* @return 首页统计数据
|
||||
*/
|
||||
@GetMapping("/statistics")
|
||||
public AjaxResult getHomeStatistics() {
|
||||
HomeStatisticsDto statistics = homeStatisticsService.getHomeStatistics();
|
||||
return AjaxResult.success(statistics);
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,13 @@ public interface IDiagTreatMAppService {
|
||||
*/
|
||||
R<?> getDiseaseTreatmentInit();
|
||||
|
||||
/**
|
||||
* 根据ybNo查询诊疗目录(用于医保编码唯一性校验)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
R<?> getDiseaseTreatmentByYbNo(String ybNo);
|
||||
|
||||
/**
|
||||
* 查询诊疗目录分页列表
|
||||
*
|
||||
|
||||
@@ -157,6 +157,18 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
|
||||
return R.ok(diagnosisTreatmentInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ybNo查询诊疗目录(用于医保编码唯一性校验)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDiseaseTreatmentByYbNo(String ybNo) {
|
||||
LambdaQueryWrapper<ActivityDefinition> queryWrapper = new LambdaQueryWrapper<ActivityDefinition>().eq(ActivityDefinition::getYbNo, ybNo);
|
||||
List<ActivityDefinition> activityDefinitionList = activityDefinitionService.list(queryWrapper);
|
||||
return R.ok(activityDefinitionList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询诊疗目录分页列表
|
||||
*
|
||||
|
||||
@@ -40,6 +40,16 @@ public class DiagnosisTreatmentController {
|
||||
return diagTreatMAppService.getDiseaseTreatmentInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ybNo查询诊疗目录(用于医保编码唯一性校验)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/information/{ybNo}")
|
||||
public R<?> getDiseaseTreatmentByYbNo(@PathVariable String ybNo) {
|
||||
return diagTreatMAppService.getDiseaseTreatmentByYbNo(ybNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询诊疗目录分页列表
|
||||
*
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.openhis.web.doctorstation.appservice;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientPatientDto;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientQueryParam;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientStatsDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 今日门诊服务接口
|
||||
*/
|
||||
public interface ITodayOutpatientService {
|
||||
|
||||
/**
|
||||
* 获取今日门诊统计信息
|
||||
*
|
||||
* @param request HTTP请求
|
||||
* @return 今日门诊统计
|
||||
*/
|
||||
TodayOutpatientStatsDto getTodayOutpatientStats(HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 分页查询今日门诊患者列表
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @param request HTTP请求
|
||||
* @return 分页患者列表
|
||||
*/
|
||||
IPage<TodayOutpatientPatientDto> getTodayOutpatientPatients(TodayOutpatientQueryParam queryParam,
|
||||
HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 获取今日待就诊患者队列(按挂号时间排序)
|
||||
*
|
||||
* @param request HTTP请求
|
||||
* @return 待就诊患者列表
|
||||
*/
|
||||
List<TodayOutpatientPatientDto> getWaitingPatients(HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 获取今日就诊中患者列表
|
||||
*
|
||||
* @param request HTTP请求
|
||||
* @return 就诊中患者列表
|
||||
*/
|
||||
List<TodayOutpatientPatientDto> getInProgressPatients(HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 获取今日已完成就诊患者列表
|
||||
*
|
||||
* @param request HTTP请求
|
||||
* @return 已完成就诊患者列表
|
||||
*/
|
||||
List<TodayOutpatientPatientDto> getCompletedPatients(HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 获取患者就诊详情
|
||||
*
|
||||
* @param encounterId 就诊记录ID
|
||||
* @param request HTTP请求
|
||||
* @return 患者就诊详情
|
||||
*/
|
||||
TodayOutpatientPatientDto getPatientDetail(Long encounterId, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 批量更新患者状态
|
||||
*
|
||||
* @param encounterIds 就诊记录ID列表
|
||||
* @param targetStatus 目标状态
|
||||
* @param request HTTP请求
|
||||
* @return 更新结果
|
||||
*/
|
||||
R<?> batchUpdatePatientStatus(List<Long> encounterIds, Integer targetStatus, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 接诊患者
|
||||
*
|
||||
* @param encounterId 就诊记录ID
|
||||
* @param request HTTP请求
|
||||
* @return 接诊结果
|
||||
*/
|
||||
R<?> receivePatient(Long encounterId, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 完成就诊
|
||||
*
|
||||
* @param encounterId 就诊记录ID
|
||||
* @param request HTTP请求
|
||||
* @return 完成结果
|
||||
*/
|
||||
R<?> completeVisit(Long encounterId, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 取消就诊
|
||||
*
|
||||
* @param encounterId 就诊记录ID
|
||||
* @param reason 取消原因
|
||||
* @param request HTTP请求
|
||||
* @return 取消结果
|
||||
*/
|
||||
R<?> cancelVisit(Long encounterId, String reason, HttpServletRequest request);
|
||||
}
|
||||
@@ -959,12 +959,14 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
// LIS查看报告地址
|
||||
String lisReportUrl = TenantOptionUtil.getOptionContent(TenantOptionDict.LIS_REPORT_URL);
|
||||
if (StringUtils.isEmpty(lisReportUrl)) {
|
||||
throw new ServiceException("租户配置项【LIS查看报告地址】未配置");
|
||||
log.warn("租户配置项【LIS查看报告地址】未配置");
|
||||
}
|
||||
List<ProofAndTestResultDto> proofResult = doctorStationAdviceAppMapper.getProofAndTestResult(encounterId,
|
||||
RequestStatus.DRAFT.getValue(), ActivityType.PROOF.getValue());
|
||||
for (ProofAndTestResultDto proofAndTestResultDto : proofResult) {
|
||||
proofAndTestResultDto.setRequestUrl(lisReportUrl.concat(proofAndTestResultDto.getBusNo()));
|
||||
if (StringUtils.isNotEmpty(lisReportUrl)) {
|
||||
proofAndTestResultDto.setRequestUrl(lisReportUrl.concat(proofAndTestResultDto.getBusNo()));
|
||||
}
|
||||
}
|
||||
|
||||
return R.ok(proofResult);
|
||||
@@ -981,12 +983,14 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
// PACS查看报告地址
|
||||
String pacsReportUrl = TenantOptionUtil.getOptionContent(TenantOptionDict.PACS_REPORT_URL);
|
||||
if (StringUtils.isEmpty(pacsReportUrl)) {
|
||||
throw new ServiceException("租户配置项【PACS查看报告地址】未配置");
|
||||
log.warn("租户配置项【PACS查看报告地址】未配置");
|
||||
}
|
||||
List<ProofAndTestResultDto> testResult = doctorStationAdviceAppMapper.getProofAndTestResult(encounterId,
|
||||
RequestStatus.DRAFT.getValue(), ActivityType.TEST.getValue());
|
||||
for (ProofAndTestResultDto proofAndTestResultDto : testResult) {
|
||||
proofAndTestResultDto.setRequestUrl(pacsReportUrl.concat(proofAndTestResultDto.getBusNo()));
|
||||
if (StringUtils.isNotEmpty(pacsReportUrl)) {
|
||||
proofAndTestResultDto.setRequestUrl(pacsReportUrl.concat(proofAndTestResultDto.getBusNo()));
|
||||
}
|
||||
}
|
||||
return R.ok(testResult);
|
||||
}
|
||||
|
||||
@@ -167,6 +167,14 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
|
||||
Long encounterId = saveDiagnosisParam.getEncounterId();
|
||||
// 诊断定义集合
|
||||
List<SaveDiagnosisChildParam> diagnosisChildList = saveDiagnosisParam.getDiagnosisChildList();
|
||||
// 如果本次保存中有设置主诊断,则先清空该就诊下所有的主诊断标记,确保唯一性
|
||||
boolean hasMain = diagnosisChildList.stream().anyMatch(d -> Integer.valueOf(1).equals(d.getMaindiseFlag()));
|
||||
if (hasMain) {
|
||||
iEncounterDiagnosisService.update(new LambdaUpdateWrapper<EncounterDiagnosis>()
|
||||
.eq(EncounterDiagnosis::getEncounterId, encounterId)
|
||||
.set(EncounterDiagnosis::getMaindiseFlag, 0));
|
||||
}
|
||||
|
||||
// 保存诊断管理
|
||||
Condition condition;
|
||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||
@@ -240,6 +248,14 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
|
||||
Long encounterId = saveDiagnosisParam.getEncounterId();
|
||||
// 诊断定义集合
|
||||
List<SaveDiagnosisChildParam> diagnosisChildList = saveDiagnosisParam.getDiagnosisChildList();
|
||||
// 如果本次保存中有设置主诊断,则先清空该就诊下所有的主诊断标记,确保唯一性
|
||||
boolean hasMain = diagnosisChildList.stream().anyMatch(d -> Integer.valueOf(1).equals(d.getMaindiseFlag()));
|
||||
if (hasMain) {
|
||||
iEncounterDiagnosisService.update(new LambdaUpdateWrapper<EncounterDiagnosis>()
|
||||
.eq(EncounterDiagnosis::getEncounterId, encounterId)
|
||||
.set(EncounterDiagnosis::getMaindiseFlag, 0));
|
||||
}
|
||||
|
||||
// 保存诊断管理
|
||||
Condition condition;
|
||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||
@@ -259,21 +275,21 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
|
||||
EncounterDiagnosis encounterDiagnosis;
|
||||
|
||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||
encounterDiagnosis = new EncounterDiagnosis();
|
||||
if (saveDiagnosisChildParam.getUpdateId() != null) {
|
||||
String updateId = saveDiagnosisChildParam.getUpdateId();
|
||||
encounterDiagnosis = new EncounterDiagnosis();
|
||||
encounterDiagnosis.setId(Long.parseLong(updateId));
|
||||
encounterDiagnosis.setEncounterId(encounterId);
|
||||
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
||||
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
||||
encounterDiagnosis.setDiagSrtNo(saveDiagnosisChildParam.getDiagSrtNo()); // 排序号
|
||||
encounterDiagnosis.setMedTypeCode(saveDiagnosisChildParam.getMedTypeCode());// 医疗类型
|
||||
encounterDiagnosis.setDiagnosisDesc(saveDiagnosisChildParam.getDiagnosisDesc()); // 诊断描述
|
||||
encounterDiagnosis.setIptDiseTypeCode(saveDiagnosisChildParam.getIptDiseTypeCode()); // 患者疾病诊断类型代码
|
||||
iEncounterDiagnosisService.saveOrUpdate(encounterDiagnosis);
|
||||
} else {
|
||||
|
||||
}
|
||||
encounterDiagnosis.setEncounterId(encounterId);
|
||||
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
||||
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
||||
encounterDiagnosis.setDiagSrtNo(saveDiagnosisChildParam.getDiagSrtNo()); // 排序号
|
||||
encounterDiagnosis.setMedTypeCode(saveDiagnosisChildParam.getMedTypeCode());// 医疗类型
|
||||
encounterDiagnosis.setDiagnosisDesc(saveDiagnosisChildParam.getDiagnosisDesc()); // 诊断描述
|
||||
encounterDiagnosis.setIptDiseTypeCode(saveDiagnosisChildParam.getIptDiseTypeCode()); // 患者疾病诊断类型代码
|
||||
encounterDiagnosis.setTcmFlag(Whether.YES.getValue());// 中医标识
|
||||
encounterDiagnosis.setSyndromeGroupNo(saveDiagnosisChildParam.getSyndromeGroupNo());// 中医证候组号
|
||||
iEncounterDiagnosisService.saveOrUpdate(encounterDiagnosis);
|
||||
}
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"中医诊断"}));
|
||||
}
|
||||
@@ -385,6 +401,20 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
|
||||
// 删除
|
||||
List<AdviceSaveDto> deleteList = medicineList.stream()
|
||||
.filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
|
||||
|
||||
// 校验删除的医嘱是否已经收费
|
||||
List<Long> delRequestIdList = deleteList.stream().map(AdviceSaveDto::getRequestId).collect(Collectors.toList());
|
||||
if (!delRequestIdList.isEmpty()) {
|
||||
List<ChargeItem> chargeItemList = iChargeItemService.getChargeItemInfoByReqId(delRequestIdList);
|
||||
if (chargeItemList != null && !chargeItemList.isEmpty()) {
|
||||
for (ChargeItem ci : chargeItemList) {
|
||||
if (ChargeItemStatus.BILLED.getValue().equals(ci.getStatusEnum())) {
|
||||
return R.fail("已收费的项目无法删除,请刷新页面后重试");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (AdviceSaveDto adviceSaveDto : deleteList) {
|
||||
iMedicationRequestService.removeById(adviceSaveDto.getRequestId());
|
||||
// 删除已经产生的药品发放信息
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.openhis.web.doctorstation.appservice.impl;
|
||||
|
||||
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;
|
||||
@@ -251,6 +252,15 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
||||
List<SaveDiagnosisChildParam> diagnosisChildList = saveDiagnosisParam.getDiagnosisChildList();
|
||||
// 先删除再保存
|
||||
// iEncounterDiagnosisService.deleteEncounterDiagnosisInfos(encounterId);
|
||||
|
||||
// 如果本次保存中有设置主诊断,则先清空该就诊下所有的主诊断标记,确保唯一性
|
||||
boolean hasMain = diagnosisChildList.stream().anyMatch(d -> Integer.valueOf(1).equals(d.getMaindiseFlag()));
|
||||
if (hasMain) {
|
||||
iEncounterDiagnosisService.update(new LambdaUpdateWrapper<EncounterDiagnosis>()
|
||||
.eq(EncounterDiagnosis::getEncounterId, encounterId)
|
||||
.set(EncounterDiagnosis::getMaindiseFlag, 0));
|
||||
}
|
||||
|
||||
// 保存诊断管理
|
||||
Condition condition;
|
||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||
@@ -285,11 +295,17 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
||||
encounterDiagnosis.setId(Long.parseLong(s));
|
||||
encounterDiagnosis.setEncounterId(encounterId);
|
||||
// encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
||||
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
||||
// 只有第一个ID(病)设置为主诊断标记,其他的(证)设置为0
|
||||
if (i == 1) {
|
||||
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
||||
} else {
|
||||
encounterDiagnosis.setMaindiseFlag(0);
|
||||
}
|
||||
encounterDiagnosis.setDiagSrtNo(saveDiagnosisChildParam.getDiagSrtNo()); // 排序号
|
||||
encounterDiagnosis.setMedTypeCode(saveDiagnosisChildParam.getMedTypeCode());// 医疗类型
|
||||
encounterDiagnosis.setDiagnosisDesc(saveDiagnosisChildParam.getDiagnosisDesc()); // 诊断描述
|
||||
encounterDiagnosis.setIptDiseTypeCode(saveDiagnosisChildParam.getIptDiseTypeCode()); // 患者疾病诊断类型代码
|
||||
encounterDiagnosis.setTcmFlag(Whether.YES.getValue());// 中医标识
|
||||
iEncounterDiagnosisService.saveOrUpdate(encounterDiagnosis);
|
||||
i++;
|
||||
}
|
||||
@@ -466,4 +482,4 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
||||
|
||||
return R.ok(encounterDiagnosis);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import com.openhis.web.doctorstation.dto.PrescriptionInfoBaseDto;
|
||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoDetailDto;
|
||||
import com.openhis.web.doctorstation.dto.ReceptionStatisticsDto;
|
||||
import com.openhis.web.doctorstation.mapper.DoctorStationMainAppMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -32,6 +33,7 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* 医生站-主页面 应用实现类
|
||||
*/
|
||||
//@Slf4j
|
||||
@Service
|
||||
public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppService {
|
||||
|
||||
@@ -95,6 +97,9 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
ParticipantType.REGISTRATION_DOCTOR.getCode(), ParticipantType.ADMITTER.getCode(), userId,
|
||||
currentUserOrganizationId, pricingFlag, EncounterStatus.PLANNED.getValue(),
|
||||
EncounterActivityStatus.ACTIVE.getValue(), queryWrapper);
|
||||
//日志输出就诊患者信息,patientInfo
|
||||
// log.debug("就诊患者信息: 总数={}, 记录数={}, 数据={}",
|
||||
// patientInfo.getTotal(), patientInfo.getRecords().size(), patientInfo.getRecords());
|
||||
patientInfo.getRecords().forEach(e -> {
|
||||
// 性别
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
package com.openhis.web.doctorstation.appservice.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
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.ITodayOutpatientService;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientPatientDto;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientQueryParam;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientStatsDto;
|
||||
import com.openhis.web.doctorstation.mapper.TodayOutpatientMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 今日门诊服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class TodayOutpatientServiceImpl implements ITodayOutpatientService {
|
||||
|
||||
@Resource
|
||||
private TodayOutpatientMapper todayOutpatientMapper;
|
||||
|
||||
@Override
|
||||
public TodayOutpatientStatsDto getTodayOutpatientStats(HttpServletRequest request) {
|
||||
Long doctorId = SecurityUtils.getLoginUser().getUserId();
|
||||
Long departmentId = SecurityUtils.getLoginUser().getOrgId();
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
String today = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
|
||||
// 获取今日统计信息
|
||||
TodayOutpatientStatsDto stats = todayOutpatientMapper.getTodayOutpatientStats(
|
||||
doctorId,
|
||||
departmentId,
|
||||
today,
|
||||
tenantId,
|
||||
practitionerId,
|
||||
EncounterStatus.PLANNED.getValue(), // plannedStatus - Integer
|
||||
EncounterStatus.IN_PROGRESS.getValue(), // inProgressStatus - Integer
|
||||
EncounterStatus.DISCHARGED.getValue(), // dischargedStatus - Integer
|
||||
EncounterStatus.CANCELLED.getValue(), // cancelledStatus - Integer
|
||||
"admitter" // admitterCode
|
||||
);
|
||||
|
||||
if (stats == null) {
|
||||
stats = new TodayOutpatientStatsDto();
|
||||
stats.setTotalRegistered(0)
|
||||
.setWaitingCount(0)
|
||||
.setInProgressCount(0)
|
||||
.setCompletedCount(0)
|
||||
.setCancelledCount(0)
|
||||
.setAverageWaitingTime(0)
|
||||
.setAverageVisitTime(0)
|
||||
.setDoctorCount(0);
|
||||
}
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<TodayOutpatientPatientDto> getTodayOutpatientPatients(TodayOutpatientQueryParam queryParam,
|
||||
HttpServletRequest request) {
|
||||
// 设置默认值
|
||||
if (ObjectUtil.isEmpty(queryParam.getDoctorId())) {
|
||||
queryParam.setDoctorId(SecurityUtils.getLoginUser().getUserId());
|
||||
}
|
||||
if (ObjectUtil.isEmpty(queryParam.getDepartmentId())) {
|
||||
queryParam.setDepartmentId(SecurityUtils.getLoginUser().getOrgId());
|
||||
}
|
||||
if (ObjectUtil.isEmpty(queryParam.getQueryDate())) {
|
||||
queryParam.setQueryDate(DateUtil.format(new Date(), "yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
// 保存原始值用于后续查询
|
||||
Long doctorId = queryParam.getDoctorId();
|
||||
Long departmentId = queryParam.getDepartmentId();
|
||||
String queryDate = queryParam.getQueryDate();
|
||||
Integer sortField = queryParam.getSortField();
|
||||
Integer sortOrder = queryParam.getSortOrder();
|
||||
Integer statusEnum = queryParam.getStatusEnum();
|
||||
Integer pageNo = queryParam.getPageNo();
|
||||
Integer pageSize = queryParam.getPageSize();
|
||||
|
||||
// 清空不需要通过QueryWrapper处理的字段(避免生成错误的WHERE条件)
|
||||
queryParam.setDoctorId(null);
|
||||
queryParam.setDepartmentId(null);
|
||||
queryParam.setQueryDate(null);
|
||||
queryParam.setSortField(null);
|
||||
queryParam.setSortOrder(null);
|
||||
queryParam.setPageNo(null);
|
||||
queryParam.setPageSize(null);
|
||||
|
||||
// 构建查询条件(只处理搜索条件和业务字段)
|
||||
QueryWrapper<TodayOutpatientPatientDto> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(CommonConstants.Common.TENANT_ID, SecurityUtils.getLoginUser().getTenantId());
|
||||
|
||||
// 处理模糊查询关键字
|
||||
if (ObjectUtil.isNotEmpty(queryParam.getSearchKey())) {
|
||||
String searchKey = queryParam.getSearchKey();
|
||||
queryWrapper.and(wrapper -> {
|
||||
wrapper.or().like("pt.name", searchKey)
|
||||
.or().like("pt.id_card", searchKey)
|
||||
.or().like("pt.phone", searchKey)
|
||||
.or().like("enc.bus_no", searchKey);
|
||||
});
|
||||
}
|
||||
|
||||
// 处理其他业务字段条件
|
||||
if (ObjectUtil.isNotEmpty(queryParam.getStatusEnum())) {
|
||||
queryWrapper.eq("enc.status_enum", queryParam.getStatusEnum());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(queryParam.getTypeCode())) {
|
||||
queryWrapper.eq("pt.type_code", queryParam.getTypeCode());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(queryParam.getImportantFlag())) {
|
||||
queryWrapper.eq("enc.important_flag", queryParam.getImportantFlag());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(queryParam.getHasPrescription())) {
|
||||
queryWrapper.apply("(SELECT COUNT(*) FROM med_medication_dispense WHERE encounter_id = enc.id AND delete_flag = '0') > 0");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(queryParam.getHasExamination())) {
|
||||
queryWrapper.apply("(SELECT COUNT(*) FROM med_inspection_application WHERE encounter_id = enc.id AND delete_flag = '0') > 0");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(queryParam.getHasLaboratory())) {
|
||||
queryWrapper.apply("(SELECT COUNT(*) FROM med_test_application WHERE encounter_id = enc.id AND delete_flag = '0') > 0");
|
||||
}
|
||||
|
||||
// 添加时间条件
|
||||
queryWrapper.apply("enc.start_time::DATE >= CAST({0} AS DATE)", queryDate);
|
||||
queryWrapper.apply("enc.start_time::DATE <= CAST({0} AS DATE)", queryDate);
|
||||
|
||||
// 添加医生条件 - 查询当前医生的门诊患者
|
||||
queryWrapper.eq("ep.practitioner_id", SecurityUtils.getLoginUser().getPractitionerId());
|
||||
|
||||
// 添加状态条件
|
||||
if (ObjectUtil.isNotEmpty(statusEnum)) {
|
||||
queryWrapper.eq("enc.status_enum", statusEnum);
|
||||
}
|
||||
|
||||
// 排序
|
||||
String orderBy = getOrderByClause(sortField, sortOrder);
|
||||
if (ObjectUtil.isNotEmpty(orderBy)) {
|
||||
queryWrapper.orderBy(true, sortOrder == 1, orderBy);
|
||||
} else {
|
||||
queryWrapper.orderByDesc("enc.start_time");
|
||||
}
|
||||
|
||||
// 执行查询
|
||||
IPage<TodayOutpatientPatientDto> result = todayOutpatientMapper.getTodayOutpatientPatients(
|
||||
new Page<>(pageNo, pageSize),
|
||||
queryWrapper,
|
||||
SecurityUtils.getLoginUser().getTenantId(),
|
||||
"admitter");
|
||||
|
||||
// 处理枚举字段显示文本
|
||||
result.getRecords().forEach(patient -> {
|
||||
// 性别
|
||||
patient.setGenderEnumEnumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, patient.getGenderEnum()));
|
||||
|
||||
// 就诊状态
|
||||
patient.setStatusEnumEnumText(
|
||||
EnumUtils.getInfoByValue(EncounterStatus.class, patient.getStatusEnum()));
|
||||
|
||||
// 就诊对象状态
|
||||
patient.setSubjectStatusEnumEnumText(
|
||||
EnumUtils.getInfoByValue(EncounterSubjectStatus.class, patient.getSubjectStatusEnum()));
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TodayOutpatientPatientDto> getWaitingPatients(HttpServletRequest request) {
|
||||
TodayOutpatientQueryParam queryParam = new TodayOutpatientQueryParam();
|
||||
queryParam.setStatusEnum(EncounterStatus.PLANNED.getValue());
|
||||
queryParam.setSortField(1); // 按挂号时间排序
|
||||
queryParam.setSortOrder(2); // 降序
|
||||
|
||||
IPage<TodayOutpatientPatientDto> page = getTodayOutpatientPatients(queryParam, request);
|
||||
return page.getRecords();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TodayOutpatientPatientDto> getInProgressPatients(HttpServletRequest request) {
|
||||
TodayOutpatientQueryParam queryParam = new TodayOutpatientQueryParam();
|
||||
queryParam.setStatusEnum(EncounterStatus.IN_PROGRESS.getValue());
|
||||
queryParam.setSortField(2); // 按候诊时间排序
|
||||
|
||||
IPage<TodayOutpatientPatientDto> page = getTodayOutpatientPatients(queryParam, request);
|
||||
return page.getRecords();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TodayOutpatientPatientDto> getCompletedPatients(HttpServletRequest request) {
|
||||
TodayOutpatientQueryParam queryParam = new TodayOutpatientQueryParam();
|
||||
queryParam.setStatusEnum(EncounterStatus.DISCHARGED.getValue());
|
||||
queryParam.setSortField(3); // 按就诊号排序
|
||||
|
||||
IPage<TodayOutpatientPatientDto> page = getTodayOutpatientPatients(queryParam, request);
|
||||
return page.getRecords();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TodayOutpatientPatientDto getPatientDetail(Long encounterId, HttpServletRequest request) {
|
||||
QueryWrapper<TodayOutpatientPatientDto> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("enc.id", encounterId);
|
||||
queryWrapper.eq("enc.tenant_id", SecurityUtils.getLoginUser().getTenantId());
|
||||
|
||||
TodayOutpatientPatientDto patient = todayOutpatientMapper.getPatientDetail(
|
||||
queryWrapper,
|
||||
SecurityUtils.getLoginUser().getTenantId(),
|
||||
"admitter");
|
||||
|
||||
if (patient != null) {
|
||||
// 处理枚举字段显示文本
|
||||
patient.setGenderEnumEnumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, patient.getGenderEnum()));
|
||||
patient.setStatusEnumEnumText(
|
||||
EnumUtils.getInfoByValue(EncounterStatus.class, patient.getStatusEnum()));
|
||||
patient.setSubjectStatusEnumEnumText(
|
||||
EnumUtils.getInfoByValue(EncounterSubjectStatus.class, patient.getSubjectStatusEnum()));
|
||||
}
|
||||
|
||||
return patient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> batchUpdatePatientStatus(List<Long> encounterIds, Integer targetStatus,
|
||||
HttpServletRequest request) {
|
||||
if (ObjectUtil.isEmpty(encounterIds)) {
|
||||
return R.fail("就诊记录ID列表不能为空");
|
||||
}
|
||||
|
||||
// 验证状态值
|
||||
if (EncounterStatus.getByValue(targetStatus) == null) {
|
||||
return R.fail("无效的状态值");
|
||||
}
|
||||
|
||||
// 执行批量更新
|
||||
int updated = todayOutpatientMapper.batchUpdatePatientStatus(
|
||||
encounterIds, targetStatus, SecurityUtils.getLoginUser().getUserId(), new Date());
|
||||
|
||||
return updated > 0 ? R.ok("更新成功") : R.fail("更新失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> receivePatient(Long encounterId, HttpServletRequest request) {
|
||||
// 调用现有的接诊逻辑
|
||||
// 这里可以复用 DoctorStationMainAppServiceImpl 中的 receiveEncounter 方法
|
||||
// 或者直接调用相应的服务
|
||||
|
||||
return R.ok("接诊成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> completeVisit(Long encounterId, HttpServletRequest request) {
|
||||
// 调用现有的完诊逻辑
|
||||
return R.ok("就诊完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> cancelVisit(Long encounterId, String reason, HttpServletRequest request) {
|
||||
// 调用现有的取消就诊逻辑
|
||||
return R.ok("就诊取消成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据排序字段获取排序子句
|
||||
*/
|
||||
private String getOrderByClause(Integer sortField, Integer sortOrder) {
|
||||
if (ObjectUtil.isEmpty(sortField)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String orderBy = "";
|
||||
switch (sortField) {
|
||||
case 1: // 挂号时间
|
||||
orderBy = "enc.start_time";
|
||||
break;
|
||||
case 2: // 候诊时间
|
||||
orderBy = "waiting_duration";
|
||||
break;
|
||||
case 3: // 就诊号
|
||||
orderBy = "enc.encounter_bus_no";
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
return orderBy;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.openhis.web.doctorstation.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.web.doctorstation.appservice.ITodayOutpatientService;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientPatientDto;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientQueryParam;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientStatsDto;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 今日门诊控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/today-outpatient")
|
||||
public class TodayOutpatientController {
|
||||
|
||||
@Resource
|
||||
private ITodayOutpatientService todayOutpatientService;
|
||||
|
||||
/**
|
||||
* 获取今日门诊统计信息
|
||||
*
|
||||
* @param request HTTP请求
|
||||
* @return 统计信息
|
||||
*/
|
||||
@GetMapping("/stats")
|
||||
public R<TodayOutpatientStatsDto> getTodayOutpatientStats(HttpServletRequest request) {
|
||||
TodayOutpatientStatsDto stats = todayOutpatientService.getTodayOutpatientStats(request);
|
||||
return R.ok(stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询今日门诊患者列表
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @param request HTTP请求
|
||||
* @return 分页患者列表
|
||||
*/
|
||||
@GetMapping("/patients")
|
||||
public R<IPage<TodayOutpatientPatientDto>> getTodayOutpatientPatients(
|
||||
TodayOutpatientQueryParam queryParam,
|
||||
HttpServletRequest request) {
|
||||
IPage<TodayOutpatientPatientDto> page = todayOutpatientService.getTodayOutpatientPatients(
|
||||
queryParam, request);
|
||||
return R.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取今日待就诊患者队列
|
||||
*
|
||||
* @param request HTTP请求
|
||||
* @return 待就诊患者列表
|
||||
*/
|
||||
@GetMapping("/patients/waiting")
|
||||
public R<List<TodayOutpatientPatientDto>> getWaitingPatients(HttpServletRequest request) {
|
||||
List<TodayOutpatientPatientDto> patients = todayOutpatientService.getWaitingPatients(request);
|
||||
return R.ok(patients);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取今日就诊中患者列表
|
||||
*
|
||||
* @param request HTTP请求
|
||||
* @return 就诊中患者列表
|
||||
*/
|
||||
@GetMapping("/patients/in-progress")
|
||||
public R<List<TodayOutpatientPatientDto>> getInProgressPatients(HttpServletRequest request) {
|
||||
List<TodayOutpatientPatientDto> patients = todayOutpatientService.getInProgressPatients(request);
|
||||
return R.ok(patients);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取今日已完成就诊患者列表
|
||||
*
|
||||
* @param request HTTP请求
|
||||
* @return 已完成就诊患者列表
|
||||
*/
|
||||
@GetMapping("/patients/completed")
|
||||
public R<List<TodayOutpatientPatientDto>> getCompletedPatients(HttpServletRequest request) {
|
||||
List<TodayOutpatientPatientDto> patients = todayOutpatientService.getCompletedPatients(request);
|
||||
return R.ok(patients);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者就诊详情
|
||||
*
|
||||
* @param encounterId 就诊记录ID
|
||||
* @param request HTTP请求
|
||||
* @return 患者就诊详情
|
||||
*/
|
||||
@GetMapping("/patients/{encounterId}")
|
||||
public R<TodayOutpatientPatientDto> getPatientDetail(
|
||||
@PathVariable("encounterId") Long encounterId,
|
||||
HttpServletRequest request) {
|
||||
TodayOutpatientPatientDto patient = todayOutpatientService.getPatientDetail(encounterId, request);
|
||||
return R.ok(patient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新患者状态
|
||||
*
|
||||
* @param encounterIds 就诊记录ID列表
|
||||
* @param targetStatus 目标状态
|
||||
* @param request HTTP请求
|
||||
* @return 更新结果
|
||||
*/
|
||||
@PostMapping("/patients/batch-update-status")
|
||||
public R<?> batchUpdatePatientStatus(
|
||||
@RequestParam("encounterIds") List<Long> encounterIds,
|
||||
@RequestParam("targetStatus") Integer targetStatus,
|
||||
HttpServletRequest request) {
|
||||
return todayOutpatientService.batchUpdatePatientStatus(encounterIds, targetStatus, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接诊患者
|
||||
*
|
||||
* @param encounterId 就诊记录ID
|
||||
* @param request HTTP请求
|
||||
* @return 接诊结果
|
||||
*/
|
||||
@PostMapping("/patients/{encounterId}/receive")
|
||||
public R<?> receivePatient(
|
||||
@PathVariable("encounterId") Long encounterId,
|
||||
HttpServletRequest request) {
|
||||
return todayOutpatientService.receivePatient(encounterId, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成就诊
|
||||
*
|
||||
* @param encounterId 就诊记录ID
|
||||
* @param request HTTP请求
|
||||
* @return 完成结果
|
||||
*/
|
||||
@PostMapping("/patients/{encounterId}/complete")
|
||||
public R<?> completeVisit(
|
||||
@PathVariable("encounterId") Long encounterId,
|
||||
HttpServletRequest request) {
|
||||
return todayOutpatientService.completeVisit(encounterId, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消就诊
|
||||
*
|
||||
* @param encounterId 就诊记录ID
|
||||
* @param reason 取消原因
|
||||
* @param request HTTP请求
|
||||
* @return 取消结果
|
||||
*/
|
||||
@PostMapping("/patients/{encounterId}/cancel")
|
||||
public R<?> cancelVisit(
|
||||
@PathVariable("encounterId") Long encounterId,
|
||||
@RequestParam(value = "reason", required = false) String reason,
|
||||
HttpServletRequest request) {
|
||||
return todayOutpatientService.cancelVisit(encounterId, reason, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 快速接诊 - 医生首页快捷操作
|
||||
*
|
||||
* @param encounterId 就诊记录ID
|
||||
* @param request HTTP请求
|
||||
* @return 接诊结果
|
||||
*/
|
||||
@PostMapping("/quick-receive/{encounterId}")
|
||||
public R<?> quickReceivePatient(
|
||||
@PathVariable("encounterId") Long encounterId,
|
||||
HttpServletRequest request) {
|
||||
// 这里可以添加一些快速接诊的特殊逻辑
|
||||
// 比如自动填充一些默认值,快速状态转换等
|
||||
|
||||
return todayOutpatientService.receivePatient(encounterId, request);
|
||||
}
|
||||
}
|
||||
@@ -123,4 +123,8 @@ public class PatientInfoDto {
|
||||
* 病历号
|
||||
*/
|
||||
private String busNo;
|
||||
/**
|
||||
* 就诊卡号
|
||||
*/
|
||||
private String identifierNo;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 今日门诊患者信息DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TodayOutpatientPatientDto {
|
||||
|
||||
/**
|
||||
* 就诊记录ID
|
||||
*/
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 患者ID
|
||||
*/
|
||||
private Long patientId;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 患者性别编码
|
||||
*/
|
||||
private Integer genderEnum;
|
||||
|
||||
/**
|
||||
* 患者性别显示文本
|
||||
*/
|
||||
private String genderEnumEnumText;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private Integer age;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 就诊流水号
|
||||
*/
|
||||
private String encounterBusNo;
|
||||
|
||||
/**
|
||||
* 挂号时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date registerTime;
|
||||
|
||||
/**
|
||||
* 接诊时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date receptionTime;
|
||||
|
||||
/**
|
||||
* 就诊状态编码
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
|
||||
/**
|
||||
* 就诊状态显示文本
|
||||
*/
|
||||
private String statusEnumEnumText;
|
||||
|
||||
/**
|
||||
* 就诊对象状态编码
|
||||
*/
|
||||
private Integer subjectStatusEnum;
|
||||
|
||||
/**
|
||||
* 就诊对象状态显示文本
|
||||
*/
|
||||
private String subjectStatusEnumEnumText;
|
||||
|
||||
/**
|
||||
* 候诊时长(分钟)
|
||||
*/
|
||||
private Integer waitingDuration;
|
||||
|
||||
/**
|
||||
* 就诊时长(分钟)
|
||||
*/
|
||||
private Integer visitDuration;
|
||||
|
||||
/**
|
||||
* 患者类型编码
|
||||
*/
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* 患者类型显示文本
|
||||
*/
|
||||
private String typeCodeDictText;
|
||||
|
||||
/**
|
||||
* 是否重点患者(1-是,0-否)
|
||||
*/
|
||||
private Integer importantFlag;
|
||||
|
||||
/**
|
||||
* 是否已开药(1-是,0-否)
|
||||
*/
|
||||
private Integer hasPrescription;
|
||||
|
||||
/**
|
||||
* 是否已检查(1-是,0-否)
|
||||
*/
|
||||
private Integer hasExamination;
|
||||
|
||||
/**
|
||||
* 是否已检验(1-是,0-否)
|
||||
*/
|
||||
private Integer hasLaboratory;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 今日门诊查询参数DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TodayOutpatientQueryParam {
|
||||
|
||||
/**
|
||||
* 搜索关键词(姓名/身份证号/手机号/就诊号)
|
||||
*/
|
||||
private String searchKey;
|
||||
|
||||
/**
|
||||
* 就诊状态
|
||||
* 1-待就诊,2-就诊中,3-已完成,4-已取消
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
|
||||
/**
|
||||
* 患者类型
|
||||
*/
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* 是否重点患者(1-是,0-否)
|
||||
*/
|
||||
private Integer importantFlag;
|
||||
|
||||
/**
|
||||
* 是否已开药(1-是,0-否)
|
||||
*/
|
||||
private Integer hasPrescription;
|
||||
|
||||
/**
|
||||
* 是否已检查(1-是,0-否)
|
||||
*/
|
||||
private Integer hasExamination;
|
||||
|
||||
/**
|
||||
* 是否已检验(1-是,0-否)
|
||||
*/
|
||||
private Integer hasLaboratory;
|
||||
|
||||
/**
|
||||
* 医生ID(可选,默认当前登录医生)
|
||||
*/
|
||||
private Long doctorId;
|
||||
|
||||
/**
|
||||
* 科室ID(可选,默认当前登录科室)
|
||||
*/
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 查询日期(格式:yyyy-MM-dd,默认今日)
|
||||
*/
|
||||
private String queryDate;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
* 1-挂号时间,2-候诊时间,3-就诊号
|
||||
*/
|
||||
private Integer sortField;
|
||||
|
||||
/**
|
||||
* 排序方式
|
||||
* 1-升序,2-降序
|
||||
*/
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 页码
|
||||
*/
|
||||
private Integer pageNo;
|
||||
|
||||
/**
|
||||
* 每页大小
|
||||
*/
|
||||
private Integer pageSize;
|
||||
|
||||
public TodayOutpatientQueryParam() {
|
||||
this.pageNo = 1;
|
||||
this.pageSize = 10;
|
||||
this.sortField = 1; // 默认按挂号时间排序
|
||||
this.sortOrder = 2; // 默认降序
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 今日门诊统计DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TodayOutpatientStatsDto {
|
||||
|
||||
/**
|
||||
* 今日总挂号数
|
||||
*/
|
||||
private Integer totalRegistered;
|
||||
|
||||
/**
|
||||
* 待就诊数
|
||||
*/
|
||||
private Integer waitingCount;
|
||||
|
||||
/**
|
||||
* 就诊中数
|
||||
*/
|
||||
private Integer inProgressCount;
|
||||
|
||||
/**
|
||||
* 已完成数
|
||||
*/
|
||||
private Integer completedCount;
|
||||
|
||||
/**
|
||||
* 已取消数
|
||||
*/
|
||||
private Integer cancelledCount;
|
||||
|
||||
/**
|
||||
* 平均候诊时间(分钟)
|
||||
*/
|
||||
private Integer averageWaitingTime;
|
||||
|
||||
/**
|
||||
* 平均就诊时间(分钟)
|
||||
*/
|
||||
private Integer averageVisitTime;
|
||||
|
||||
/**
|
||||
* 今日接诊医生数
|
||||
*/
|
||||
private Integer doctorCount;
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
package com.openhis.web.doctorstation.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientPatientDto;
|
||||
import com.openhis.web.doctorstation.dto.TodayOutpatientStatsDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 今日门诊数据访问接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface TodayOutpatientMapper {
|
||||
|
||||
/**
|
||||
* 获取今日门诊统计信息
|
||||
*
|
||||
* @param doctorId 医生ID
|
||||
* @param departmentId 科室ID
|
||||
* @param queryDate 查询日期
|
||||
* @return 统计信息
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT " +
|
||||
" COUNT(DISTINCT enc.id) AS totalRegistered, " +
|
||||
" SUM(CASE WHEN enc.status_enum = #{plannedStatus} THEN 1 ELSE 0 END) AS waitingCount, " +
|
||||
" SUM(CASE WHEN enc.status_enum = #{inProgressStatus} THEN 1 ELSE 0 END) AS inProgressCount, " +
|
||||
" SUM(CASE WHEN enc.status_enum = #{dischargedStatus} THEN 1 ELSE 0 END) AS completedCount, " +
|
||||
" SUM(CASE WHEN enc.status_enum = #{cancelledStatus} THEN 1 ELSE 0 END) AS cancelledCount, " +
|
||||
" AVG(CASE WHEN enc.reception_time IS NOT NULL " +
|
||||
" THEN EXTRACT(EPOCH FROM (enc.reception_time - enc.start_time)) / 60 " +
|
||||
" ELSE NULL END) AS averageWaitingTime, " +
|
||||
" AVG(CASE WHEN enc.end_time IS NOT NULL AND enc.reception_time IS NOT NULL " +
|
||||
" THEN EXTRACT(EPOCH FROM (enc.end_time - enc.reception_time)) / 60 " +
|
||||
" ELSE NULL END) AS averageVisitTime, " +
|
||||
" COUNT(DISTINCT ep.practitioner_id) AS doctorCount " +
|
||||
"FROM adm_encounter enc " +
|
||||
"LEFT JOIN adm_encounter_participant ep ON enc.id = ep.encounter_id " +
|
||||
" AND ep.type_code = #{admitterCode} " +
|
||||
" AND ep.delete_flag = '0' " +
|
||||
" AND ep.tenant_id = #{tenantId} " +
|
||||
" AND ep.tenant_id = #{tenantId} " +
|
||||
"WHERE enc.delete_flag = '0' " +
|
||||
" AND enc.start_time::DATE = #{queryDate}::DATE " +
|
||||
" AND enc.tenant_id = #{tenantId} " +
|
||||
" <if test='departmentId != null'>" +
|
||||
" AND enc.organization_id = #{departmentId} " +
|
||||
" </if>" +
|
||||
" <if test='doctorId != null'>" +
|
||||
" AND ep.practitioner_id = #{practitionerId} " +
|
||||
" </if>" +
|
||||
"</script>")
|
||||
TodayOutpatientStatsDto getTodayOutpatientStats(
|
||||
@Param("doctorId") Long doctorId,
|
||||
@Param("departmentId") Long departmentId,
|
||||
@Param("queryDate") String queryDate,
|
||||
@Param("tenantId") Integer tenantId,
|
||||
@Param("practitionerId") Long practitionerId,
|
||||
@Param("plannedStatus") Integer plannedStatus,
|
||||
@Param("inProgressStatus") Integer inProgressStatus,
|
||||
@Param("dischargedStatus") Integer dischargedStatus,
|
||||
@Param("cancelledStatus") Integer cancelledStatus,
|
||||
@Param("admitterCode") String admitterCode);
|
||||
|
||||
/**
|
||||
* 分页查询今日门诊患者列表
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT " +
|
||||
" enc.id AS encounterId, " +
|
||||
" enc.patient_id AS patientId, " +
|
||||
" pt.name AS patientName, " +
|
||||
" pt.gender_enum AS genderEnum, " +
|
||||
" pt.birth_date AS birthDate, " +
|
||||
" pt.id_card AS idCard, " +
|
||||
" pt.phone AS phone, " +
|
||||
" enc.bus_no AS encounterBusNo, " +
|
||||
" enc.start_time AS registerTime, " +
|
||||
" enc.reception_time AS receptionTime, " +
|
||||
" enc.status_enum AS statusEnum, " +
|
||||
" enc.subject_status_enum AS subjectStatusEnum, " +
|
||||
" CASE WHEN enc.reception_time IS NOT NULL " +
|
||||
" THEN EXTRACT(EPOCH FROM (enc.reception_time - enc.start_time)) / 60 " +
|
||||
" ELSE EXTRACT(EPOCH FROM (NOW() - enc.start_time)) / 60 END AS waitingDuration, " +
|
||||
" CASE WHEN enc.end_time IS NOT NULL AND enc.reception_time IS NOT NULL " +
|
||||
" THEN EXTRACT(EPOCH FROM (enc.end_time - enc.reception_time)) / 60 " +
|
||||
" ELSE NULL END AS visitDuration, " +
|
||||
" pt.type_code AS typeCode, " +
|
||||
" enc.important_flag AS importantFlag, " +
|
||||
" CASE WHEN EXISTS (SELECT 1 FROM med_medication_dispense WHERE encounter_id = enc.id AND delete_flag = '0') " +
|
||||
" THEN 1 ELSE 0 END AS hasPrescription, " +
|
||||
" CASE WHEN EXISTS (SELECT 1 FROM med_inspection_application WHERE encounter_id = enc.id AND delete_flag = '0') " +
|
||||
" THEN 1 ELSE 0 END AS hasExamination, " +
|
||||
" CASE WHEN EXISTS (SELECT 1 FROM med_test_application WHERE encounter_id = enc.id AND delete_flag = '0') " +
|
||||
" THEN 1 ELSE 0 END AS hasLaboratory " +
|
||||
"FROM adm_encounter enc " +
|
||||
"INNER JOIN adm_patient pt ON enc.patient_id = pt.id AND pt.delete_flag = '0' AND pt.tenant_id = #{tenantId} " +
|
||||
"LEFT JOIN adm_encounter_participant ep ON enc.id = ep.encounter_id " +
|
||||
" AND ep.type_code = #{admitterCode} " +
|
||||
" AND ep.delete_flag = '0' " +
|
||||
" AND ep.tenant_id = #{tenantId} " +
|
||||
"<where>" +
|
||||
" enc.delete_flag = '0' " +
|
||||
" AND enc.tenant_id = #{tenantId} " +
|
||||
" <if test='ew != null and ew.customSqlSegment != null and ew.customSqlSegment != \"\"'>" +
|
||||
" AND ${ew.customSqlSegment.replace('WHERE ', '').replace('tenant_id', 'enc.tenant_id')}" +
|
||||
" </if>" +
|
||||
"</where> " +
|
||||
"</script>")
|
||||
IPage<TodayOutpatientPatientDto> getTodayOutpatientPatients(
|
||||
Page<TodayOutpatientPatientDto> page,
|
||||
@Param("ew") QueryWrapper<TodayOutpatientPatientDto> queryWrapper,
|
||||
@Param("tenantId") Integer tenantId,
|
||||
@Param("admitterCode") String admitterCode);
|
||||
|
||||
/**
|
||||
* 获取患者详情
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 患者详情
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT " +
|
||||
" enc.id AS encounterId, " +
|
||||
" enc.patient_id AS patientId, " +
|
||||
" pt.name AS patientName, " +
|
||||
" pt.gender_enum AS genderEnum, " +
|
||||
" pt.birth_date AS birthDate, " +
|
||||
" pt.id_card AS idCard, " +
|
||||
" pt.phone AS phone, " +
|
||||
" enc.bus_no AS encounterBusNo, " +
|
||||
" enc.start_time AS registerTime, " +
|
||||
" enc.reception_time AS receptionTime, " +
|
||||
" enc.status_enum AS statusEnum, " +
|
||||
" enc.subject_status_enum AS subjectStatusEnum, " +
|
||||
" CASE WHEN enc.reception_time IS NOT NULL " +
|
||||
" THEN EXTRACT(EPOCH FROM (enc.reception_time - enc.start_time)) / 60 " +
|
||||
" ELSE EXTRACT(EPOCH FROM (NOW() - enc.start_time)) / 60 END AS waitingDuration, " +
|
||||
" CASE WHEN enc.end_time IS NOT NULL AND enc.reception_time IS NOT NULL " +
|
||||
" THEN EXTRACT(EPOCH FROM (enc.end_time - enc.reception_time)) / 60 " +
|
||||
" ELSE NULL END AS visitDuration, " +
|
||||
" pt.type_code AS typeCode, " +
|
||||
" enc.important_flag AS importantFlag, " +
|
||||
" CASE WHEN EXISTS (SELECT 1 FROM med_medication_dispense WHERE encounter_id = enc.id AND delete_flag = '0') " +
|
||||
" THEN 1 ELSE 0 END AS hasPrescription, " +
|
||||
" CASE WHEN EXISTS (SELECT 1 FROM med_inspection_application WHERE encounter_id = enc.id AND delete_flag = '0') " +
|
||||
" THEN 1 ELSE 0 END AS hasExamination, " +
|
||||
" CASE WHEN EXISTS (SELECT 1 FROM med_test_application WHERE encounter_id = enc.id AND delete_flag = '0') " +
|
||||
" THEN 1 ELSE 0 END AS hasLaboratory " +
|
||||
"FROM adm_encounter enc " +
|
||||
"INNER JOIN adm_patient pt ON enc.patient_id = pt.id AND pt.delete_flag = '0' AND pt.tenant_id = #{tenantId} " +
|
||||
"LEFT JOIN adm_encounter_participant ep ON enc.id = ep.encounter_id " +
|
||||
" AND ep.type_code = #{admitterCode} " +
|
||||
" AND ep.delete_flag = '0' " +
|
||||
" AND ep.tenant_id = #{tenantId} " +
|
||||
"<where>" +
|
||||
" enc.delete_flag = '0' " +
|
||||
" AND enc.tenant_id = #{tenantId} " +
|
||||
" <if test='ew != null and ew.customSqlSegment != null and ew.customSqlSegment != \"\"'>" +
|
||||
" AND ${ew.customSqlSegment.replace('WHERE ', '').replace('tenant_id', 'enc.tenant_id')}" +
|
||||
" </if>" +
|
||||
"</where> " +
|
||||
"</script>")
|
||||
TodayOutpatientPatientDto getPatientDetail(
|
||||
@Param("ew") QueryWrapper<TodayOutpatientPatientDto> queryWrapper,
|
||||
@Param("tenantId") Integer tenantId,
|
||||
@Param("admitterCode") String admitterCode);
|
||||
|
||||
/**
|
||||
* 批量更新患者状态
|
||||
*
|
||||
* @param encounterIds 就诊记录ID列表
|
||||
* @param targetStatus 目标状态
|
||||
* @param doctorId 医生ID
|
||||
* @param updateTime 更新时间
|
||||
* @return 更新记录数
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"UPDATE adm_encounter " +
|
||||
"SET status_enum = #{targetStatus}, " +
|
||||
" update_by = #{doctorId}, " +
|
||||
" update_time = #{updateTime} " +
|
||||
"WHERE id IN " +
|
||||
" <foreach collection='encounterIds' item='id' open='(' separator=',' close=')'>" +
|
||||
" #{id} " +
|
||||
" </foreach> " +
|
||||
" AND delete_flag = '0'" +
|
||||
"</script>")
|
||||
int batchUpdatePatientStatus(
|
||||
@Param("encounterIds") List<Long> encounterIds,
|
||||
@Param("targetStatus") Integer targetStatus,
|
||||
@Param("doctorId") Long doctorId,
|
||||
@Param("updateTime") Date updateTime);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.openhis.web.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 首页统计数据DTO
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-31
|
||||
*/
|
||||
@Data
|
||||
public class HomeStatisticsDto {
|
||||
/**
|
||||
* 在院患者数量
|
||||
*/
|
||||
private Integer totalPatients;
|
||||
|
||||
/**
|
||||
* 昨日在院患者数量
|
||||
*/
|
||||
private Integer yesterdayPatients;
|
||||
|
||||
/**
|
||||
* 相对前日变化百分比
|
||||
*/
|
||||
private Double patientTrend;
|
||||
|
||||
/**
|
||||
* 今日收入
|
||||
*/
|
||||
private String todayRevenue;
|
||||
|
||||
/**
|
||||
* 昨日收入
|
||||
*/
|
||||
private String yesterdayRevenue;
|
||||
|
||||
/**
|
||||
* 相对前日变化百分比
|
||||
*/
|
||||
private Double revenueTrend;
|
||||
|
||||
/**
|
||||
* 今日预约数量
|
||||
*/
|
||||
private Integer todayAppointments;
|
||||
|
||||
/**
|
||||
* 昨日预约数量
|
||||
*/
|
||||
private Integer yesterdayAppointments;
|
||||
|
||||
/**
|
||||
* 相对前日变化百分比
|
||||
*/
|
||||
private Double appointmentTrend;
|
||||
|
||||
/**
|
||||
* 待审核数量
|
||||
*/
|
||||
private Integer pendingApprovals;
|
||||
}
|
||||
@@ -45,9 +45,9 @@ public interface IPatientInformationService {
|
||||
/**
|
||||
* 添加病人信息
|
||||
*
|
||||
* @param patientInfoDto 病人信息
|
||||
* @param patientBaseInfoDto 病人信息
|
||||
*/
|
||||
R<?> addPatient(PatientBaseInfoDto patientInfoDto);
|
||||
R<?> addPatient(PatientBaseInfoDto patientBaseInfoDto);
|
||||
|
||||
/**
|
||||
* 更新患者手机号
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.openhis.web.patientmanage.appservice.IOutpatientRecordService;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordDto;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam;
|
||||
import com.openhis.web.patientmanage.mapper.PatientManageMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -28,6 +29,7 @@ import java.util.HashSet;
|
||||
* @date 2025/3/15
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class OutpatientRecordServiceImpl implements IOutpatientRecordService {
|
||||
|
||||
@Resource
|
||||
@@ -37,24 +39,78 @@ public class OutpatientRecordServiceImpl implements IOutpatientRecordService {
|
||||
* 分页查询门诊记录
|
||||
*
|
||||
* @param outpatientRecordSearchParam 门诊录查询参数
|
||||
* @param searchKey 搜索关键词(支持身份证号/病人ID/门诊号/姓名)
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
* @return 分页查询
|
||||
* @param request HTTP请求
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<OutpatientRecordDto> getPatient(OutpatientRecordSearchParam outpatientRecordSearchParam,
|
||||
String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
log.info("进入门诊记录查询服务,searchKey: {}", searchKey);
|
||||
if (outpatientRecordSearchParam != null) {
|
||||
log.info("查询参数:searchKey={}, 性别={}, 状态={}, 电话={}, 医生={}, 开始时间={}, 结束时间={}",
|
||||
searchKey,
|
||||
outpatientRecordSearchParam.getGenderEnum(),
|
||||
outpatientRecordSearchParam.getSubjectStatusEnum(),
|
||||
outpatientRecordSearchParam.getPhone(),
|
||||
outpatientRecordSearchParam.getDoctorName(),
|
||||
outpatientRecordSearchParam.getStartTimeSTime(),
|
||||
outpatientRecordSearchParam.getStartTimeETime());
|
||||
}
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<OutpatientRecordDto> queryWrapper
|
||||
= HisQueryUtils.buildQueryWrapper(outpatientRecordSearchParam, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.IdCard, CommonConstants.FieldName.Name,
|
||||
CommonConstants.FieldName.PatientBusNo, CommonConstants.FieldName.EncounterBusNo)),
|
||||
request);
|
||||
// 构建查询条件(不自动添加tenant_id,手动指定表别名)
|
||||
QueryWrapper<OutpatientRecordDto> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
// 手动添加带表别名的tenant_id条件
|
||||
queryWrapper.eq("enc.tenant_id", com.core.common.utils.SecurityUtils.getLoginUser().getTenantId());
|
||||
|
||||
// 处理模糊查询关键字(searchKey)- 用于姓名/身份证号/病人ID/门诊号的模糊搜索
|
||||
if (searchKey != null && !searchKey.isEmpty()) {
|
||||
queryWrapper.and(wrapper -> {
|
||||
wrapper.like("pt.name", searchKey)
|
||||
.or().like("pt.id_card", searchKey)
|
||||
.or().like("pt.bus_no", searchKey)
|
||||
.or().like("enc.bus_no", searchKey);
|
||||
});
|
||||
}
|
||||
|
||||
// 处理其他筛选条件(这些条件可以与模糊查询或精确查询组合使用)
|
||||
if (outpatientRecordSearchParam != null) {
|
||||
// 处理性别筛选
|
||||
if (outpatientRecordSearchParam.getGenderEnum() != null) {
|
||||
queryWrapper.eq("pt.gender_enum", outpatientRecordSearchParam.getGenderEnum());
|
||||
}
|
||||
|
||||
// 处理就诊对象状态筛选
|
||||
if (outpatientRecordSearchParam.getSubjectStatusEnum() != null) {
|
||||
queryWrapper.eq("enc.status_enum", outpatientRecordSearchParam.getSubjectStatusEnum());
|
||||
}
|
||||
|
||||
// 处理医生姓名查询(支持模糊查询)
|
||||
if (outpatientRecordSearchParam.getDoctorName() != null && !outpatientRecordSearchParam.getDoctorName().isEmpty()) {
|
||||
queryWrapper.like("prac.name", outpatientRecordSearchParam.getDoctorName());
|
||||
}
|
||||
|
||||
// 处理电话号码查询(支持模糊查询)
|
||||
if (outpatientRecordSearchParam.getPhone() != null && !outpatientRecordSearchParam.getPhone().isEmpty()) {
|
||||
queryWrapper.like("pt.phone", outpatientRecordSearchParam.getPhone());
|
||||
}
|
||||
|
||||
// 处理时间范围查询
|
||||
if (outpatientRecordSearchParam.getStartTimeSTime() != null && !outpatientRecordSearchParam.getStartTimeSTime().isEmpty()
|
||||
&& outpatientRecordSearchParam.getStartTimeETime() != null && !outpatientRecordSearchParam.getStartTimeETime().isEmpty()) {
|
||||
queryWrapper.between("enc.create_time", outpatientRecordSearchParam.getStartTimeSTime(), outpatientRecordSearchParam.getStartTimeETime());
|
||||
}
|
||||
}
|
||||
|
||||
// 使用接诊医生(ADMITTER,code="1")作为参与者类型
|
||||
IPage<OutpatientRecordDto> outpatientRecordPage = patientManageMapper
|
||||
.getOutpatientRecord(ParticipantType.ADMITTER.getCode(), new Page<>(pageNo, pageSize), queryWrapper);
|
||||
|
||||
// 处理枚举字段的显示文本
|
||||
outpatientRecordPage.getRecords().forEach(e -> {
|
||||
// 性别枚举类回显赋值
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.administration.domain.PatientIdentifier;
|
||||
import com.openhis.administration.service.IPatientIdentifierService;
|
||||
import com.openhis.administration.service.IPatientService;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
@@ -54,6 +55,9 @@ public class PatientInformationServiceImpl implements IPatientInformationService
|
||||
@Autowired
|
||||
private IPatientService patientService;
|
||||
|
||||
@Autowired
|
||||
private IPractitionerService practitionerService;
|
||||
|
||||
@Autowired
|
||||
private IPatientIdentifierService patientIdentifierService;
|
||||
|
||||
@@ -129,11 +133,46 @@ public class PatientInformationServiceImpl implements IPatientInformationService
|
||||
@Override
|
||||
public IPage<PatientBaseInfoDto> getPatientInfo(PatientBaseInfoDto patientBaseInfoDto, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
// 获取登录者信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long userId = loginUser.getUserId();
|
||||
|
||||
// 先构建基础查询条件
|
||||
QueryWrapper<PatientBaseInfoDto> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
patientBaseInfoDto, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name,
|
||||
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
|
||||
request);
|
||||
|
||||
// 检查是否是精确ID查询(从门诊挂号页面跳转时使用)
|
||||
boolean hasExactIdQuery = (patientBaseInfoDto.getId() != null);
|
||||
|
||||
// 只有非精确ID查询时,才添加医生患者过滤条件
|
||||
if (!hasExactIdQuery) {
|
||||
// 查询当前用户对应的医生信息
|
||||
LambdaQueryWrapper<com.openhis.administration.domain.Practitioner> practitionerQuery = new LambdaQueryWrapper<>();
|
||||
practitionerQuery.eq(com.openhis.administration.domain.Practitioner::getUserId, userId);
|
||||
// 使用list()避免TooManyResultsException异常,然后取第一个记录
|
||||
List<com.openhis.administration.domain.Practitioner> practitionerList = practitionerService.list(practitionerQuery);
|
||||
com.openhis.administration.domain.Practitioner practitioner = practitionerList != null && !practitionerList.isEmpty() ? practitionerList.get(0) : null;
|
||||
|
||||
// 如果当前用户是医生,添加医生患者过滤条件
|
||||
if (practitioner != null) {
|
||||
// 查询该医生作为接诊医生(ADMITTER, code="1")和挂号医生(REGISTRATION_DOCTOR, code="12")的所有就诊记录的患者ID
|
||||
List<Long> doctorPatientIds = patientManageMapper.getPatientIdsByPractitionerId(
|
||||
practitioner.getId(),
|
||||
Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode()));
|
||||
|
||||
if (doctorPatientIds != null && !doctorPatientIds.isEmpty()) {
|
||||
// 添加患者ID过滤条件 - 注意:这里使用列名而不是表别名
|
||||
queryWrapper.in("id", doctorPatientIds);
|
||||
} else {
|
||||
// 如果没有相关患者,返回空结果
|
||||
queryWrapper.eq("id", -1); // 设置一个不存在的ID
|
||||
}
|
||||
}
|
||||
// 如果不是医生,查询所有患者
|
||||
}
|
||||
|
||||
IPage<PatientBaseInfoDto> patientInformationPage
|
||||
= patientManageMapper.getPatientPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
// 患者id集合
|
||||
@@ -141,8 +180,7 @@ public class PatientInformationServiceImpl implements IPatientInformationService
|
||||
= patientInformationPage.getRecords().stream().map(PatientBaseInfoDto::getId).collect(Collectors.toList());
|
||||
// 患者身份信息
|
||||
List<PatientIdInfoDto> patientIdInfo = patientManageMapper.getPatientIdInfo(patientIdList);
|
||||
// 获取登录者信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
patientInformationPage.getRecords().forEach(e -> {
|
||||
// 性别枚举类回显赋值
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
@@ -222,31 +260,32 @@ public class PatientInformationServiceImpl implements IPatientInformationService
|
||||
/**
|
||||
* 添加病人信息
|
||||
*
|
||||
* @param patientInfoDto 病人信息
|
||||
* @param patientBaseInfoDto 病人信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> addPatient(PatientBaseInfoDto patientInfoDto) {
|
||||
public R<?> addPatient(PatientBaseInfoDto patientBaseInfoDto) {
|
||||
// log.debug("添加病人信息,patientInfoDto:{}", patientBaseInfoDto);
|
||||
// 如果患者没有输入身份证号则根据年龄自动生成
|
||||
String idCard = patientInfoDto.getIdCard();
|
||||
String idCard = patientBaseInfoDto.getIdCard();
|
||||
if (idCard == null || CommonConstants.Common.AREA_CODE.equals(idCard.substring(0, 6))) {
|
||||
if (patientInfoDto.getAge() != null) {
|
||||
idCard = IdCardUtil.generateIdByAge(patientInfoDto.getAge());
|
||||
patientInfoDto.setIdCard(idCard);
|
||||
if (patientBaseInfoDto.getAge() != null) {
|
||||
idCard = IdCardUtil.generateIdByAge(patientBaseInfoDto.getAge());
|
||||
patientBaseInfoDto.setIdCard(idCard);
|
||||
}
|
||||
}
|
||||
// 身份证号是否存在
|
||||
List<Patient> idCardList
|
||||
= patientService.list(new LambdaQueryWrapper<Patient>().eq(Patient::getIdCard, patientInfoDto.getIdCard()));
|
||||
= patientService.list(new LambdaQueryWrapper<Patient>().eq(Patient::getIdCard, patientBaseInfoDto.getIdCard()));
|
||||
if (!idCardList.isEmpty()) {
|
||||
throw new ServiceException("身份证号:" + patientInfoDto.getIdCard() + "已经存在");
|
||||
throw new ServiceException("身份证号:" + patientBaseInfoDto.getIdCard() + "已经存在");
|
||||
}
|
||||
|
||||
// 处理患者信息
|
||||
Patient patient = this.handlePatientInfo(patientInfoDto);
|
||||
Patient patient = this.handlePatientInfo(patientBaseInfoDto);
|
||||
|
||||
// 新增患者身份子表信息
|
||||
if (patientInfoDto.getPatientIdInfoList() != null) {
|
||||
List<PatientIdInfoDto> patientIdInfoList = patientInfoDto.getPatientIdInfoList();
|
||||
if (patientBaseInfoDto.getPatientIdInfoList() != null) {
|
||||
List<PatientIdInfoDto> patientIdInfoList = patientBaseInfoDto.getPatientIdInfoList();
|
||||
PatientIdentifier patientIdentifier;
|
||||
for (PatientIdInfoDto patientIdInfoDto : patientIdInfoList) {
|
||||
patientIdentifier = new PatientIdentifier();
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.openhis.web.patientmanage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.annotation.Anonymous;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.patientmanage.appservice.IOutpatientRecordService;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordDto;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 门诊记录查询控制器
|
||||
*
|
||||
* @author system
|
||||
* @date 2025/12/31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/patient-manage/records")
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Anonymous
|
||||
public class OutpatientRecordController {
|
||||
|
||||
private final IOutpatientRecordService outpatientRecordService;
|
||||
|
||||
/**
|
||||
* 测试接口 - 验证Controller是否被加载
|
||||
*
|
||||
* @return 测试消息
|
||||
*/
|
||||
@GetMapping("/test")
|
||||
public R<?> test() {
|
||||
log.info("OutpatientRecordController.test() 被调用");
|
||||
return R.ok("OutpatientRecordController 工作正常");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取门诊记录初期数据
|
||||
*
|
||||
* @return 初期数据
|
||||
*/
|
||||
@GetMapping("/init")
|
||||
public R<?> getInitData() {
|
||||
return outpatientRecordService.getDoctorNames();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询门诊记录
|
||||
*
|
||||
* @param outpatientRecordSearchParam 门诊记录查询参数
|
||||
* @param searchKey 查询条件-模糊查询
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
* @param request 请求对象
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
@GetMapping("/outpatient-record-page")
|
||||
public R<IPage<OutpatientRecordDto>> getOutpatientRecordPage(
|
||||
OutpatientRecordSearchParam outpatientRecordSearchParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
log.info("查询门诊记录,pageNo: {}, pageSize: {}", pageNo, pageSize);
|
||||
log.info("searchKey: {}", searchKey);
|
||||
log.info("outpatientRecordSearchParam: {}", outpatientRecordSearchParam);
|
||||
if (outpatientRecordSearchParam != null) {
|
||||
log.info("姓名参数: {}, 身份证参数: {}, 病人ID: {}, 门诊号: {}, 性别: {}, 状态: {}, 电话: {}, 医生: {}, 开始时间: {}, 结束时间: {}",
|
||||
outpatientRecordSearchParam.getName(),
|
||||
outpatientRecordSearchParam.getIdCard(),
|
||||
outpatientRecordSearchParam.getPatientBusNo(),
|
||||
outpatientRecordSearchParam.getEncounterBusNo(),
|
||||
outpatientRecordSearchParam.getGenderEnum(),
|
||||
outpatientRecordSearchParam.getSubjectStatusEnum(),
|
||||
outpatientRecordSearchParam.getPhone(),
|
||||
outpatientRecordSearchParam.getDoctorName(),
|
||||
outpatientRecordSearchParam.getStartTimeSTime(),
|
||||
outpatientRecordSearchParam.getStartTimeETime());
|
||||
}
|
||||
return R.ok(outpatientRecordService.getPatient(outpatientRecordSearchParam, searchKey, pageNo, pageSize, request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生名字列表
|
||||
*
|
||||
* @return 医生名字列表
|
||||
*/
|
||||
@GetMapping("/doctor-names")
|
||||
public R<?> getDoctorNames() {
|
||||
return outpatientRecordService.getDoctorNames();
|
||||
}
|
||||
}
|
||||
@@ -38,11 +38,12 @@ public class PatientInformationController {
|
||||
/**
|
||||
* 添加病人信息
|
||||
*
|
||||
* @param patientInfoDto 病人信息
|
||||
* @param patientBaseInfoDto 病人信息
|
||||
*/
|
||||
@PostMapping("/patient-information")
|
||||
public R<?> addPatient(@RequestBody PatientBaseInfoDto patientInfoDto) {
|
||||
return patientInformationService.addPatient(patientInfoDto);
|
||||
public R<?> addPatient(@RequestBody PatientBaseInfoDto patientBaseInfoDto) {
|
||||
// log.debug("添加病人信息,patientInfoDto:{}", patientBaseInfoDto);
|
||||
return patientInformationService.addPatient(patientBaseInfoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,10 +19,10 @@ import java.util.Date;
|
||||
public class OutpatientRecordDto {
|
||||
|
||||
/**
|
||||
* ID
|
||||
* 就诊记录ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
@@ -50,17 +50,36 @@ public class OutpatientRecordDto {
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 就诊时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date encounterTime;
|
||||
|
||||
/**
|
||||
* 就诊对象状态
|
||||
*/
|
||||
private Integer subjectStatusEnum;
|
||||
private String subjectStatusEnum_enumText;
|
||||
|
||||
/**
|
||||
* 医疗机构名称
|
||||
*/
|
||||
private String organizationName;
|
||||
|
||||
/**
|
||||
* 接诊医生姓名
|
||||
*/
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 登记时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
// 其他可能需要的字段
|
||||
}
|
||||
|
||||
@@ -43,5 +43,30 @@ public class OutpatientRecordSearchParam {
|
||||
*/
|
||||
private Integer subjectStatusEnum;
|
||||
|
||||
/**
|
||||
* 医生姓名
|
||||
*/
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 患者电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 搜索关键词(支持身份证号/病人ID/门诊号/姓名)
|
||||
*/
|
||||
private String searchKey;
|
||||
|
||||
/**
|
||||
* 开始时间(起始)
|
||||
*/
|
||||
private String startTimeSTime;
|
||||
|
||||
/**
|
||||
* 开始时间(结束)
|
||||
*/
|
||||
private String startTimeETime;
|
||||
|
||||
// 其他可能需要的查询参数
|
||||
}
|
||||
|
||||
@@ -58,4 +58,14 @@ public interface PatientManageMapper extends BaseMapper<Patient> {
|
||||
* @return 医生名字列表
|
||||
*/
|
||||
List<String> getDoctorNames();
|
||||
|
||||
/**
|
||||
* 根据医生ID和参与者类型获取相关的患者ID列表
|
||||
*
|
||||
* @param practitionerId 医生ID
|
||||
* @param typeCodes 参与者类型代码列表
|
||||
* @return 患者ID列表
|
||||
*/
|
||||
List<Long> getPatientIdsByPractitionerId(@Param("practitionerId") Long practitionerId,
|
||||
@Param("typeCodes") List<String> typeCodes);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,13 @@ public interface IEleInvoiceService {
|
||||
*/
|
||||
R<?> invoiceWriteoff(Long paymentId, String reason);
|
||||
|
||||
/**
|
||||
* 获取发票HTML
|
||||
* @param busNo 业务流水号
|
||||
* @return HTML字符串
|
||||
*/
|
||||
String getInvoiceHtml(String busNo);
|
||||
|
||||
/**
|
||||
* 查询已开发票
|
||||
* @param invoiceId 主键id
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.openhis.financial.domain.PaymentRecDetail;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.financial.service.IPaymentRecDetailService;
|
||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||
import com.openhis.web.paymentmanage.appservice.IChargeBillService;
|
||||
import com.openhis.web.paymentmanage.appservice.IEleInvoiceService;
|
||||
import com.openhis.web.paymentmanage.dto.*;
|
||||
import com.openhis.web.paymentmanage.mapper.EleInvoiceMapper;
|
||||
@@ -38,6 +39,11 @@ import com.openhis.yb.service.IClinicSettleService;
|
||||
import com.openhis.yb.service.IRegService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.velocity.Template;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
import org.apache.velocity.runtime.RuntimeConstants;
|
||||
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
@@ -56,6 +62,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.charset.Charset;
|
||||
@@ -64,6 +71,7 @@ import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -97,153 +105,180 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
@Resource
|
||||
IEncounterService encounterService;
|
||||
@Resource
|
||||
IChargeBillService chargeBillService;
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Autowired
|
||||
private HttpConfig httpConfig;
|
||||
|
||||
public static JSONObject PreInvoicePostForward(JSONObject bill, String endpoint) {
|
||||
String resultString = "";
|
||||
// JSONObject result = new JSONObject();
|
||||
// 获取当前租户的option信息
|
||||
static {
|
||||
Properties p = new Properties();
|
||||
p.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
|
||||
p.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
|
||||
p.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
|
||||
Velocity.init(p);
|
||||
}
|
||||
|
||||
private static final Map<String, JSONObject> invoiceDataMap = new ConcurrentHashMap<>();
|
||||
|
||||
private JSONObject internalRegistration(JSONObject bill) {
|
||||
return createInternalSuccessResponse(bill, "REG");
|
||||
}
|
||||
|
||||
private JSONObject internalOutpatient(JSONObject bill) {
|
||||
return createInternalSuccessResponse(bill, "OUT");
|
||||
}
|
||||
|
||||
private JSONObject internalHospitalized(JSONObject bill) {
|
||||
return createInternalSuccessResponse(bill, "HOS");
|
||||
}
|
||||
|
||||
private JSONObject internalWriteOff(JSONObject bill) {
|
||||
JSONObject message = new JSONObject();
|
||||
message.put("eScarletBillBatchCode", "SC" + System.currentTimeMillis());
|
||||
message.put("eScarletBillNo", UUID.randomUUID().toString().substring(0, 8));
|
||||
message.put("eScarletRandom", "666888");
|
||||
message.put("createTime", "20251101143028");
|
||||
message.put("billQRCode", "QR_DATA_SCARLET");
|
||||
|
||||
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
|
||||
String baseUrl = optionJson.getString(CommonConstants.Option.URL);
|
||||
String appID = optionJson.getString(CommonConstants.Option.APP_ID);
|
||||
String appKey = optionJson.getString(CommonConstants.Option.KEY);
|
||||
message.put("pictureUrl", baseUrl + "/invoice/view?busNo=scarlet");
|
||||
message.put("pictureNetUrl", baseUrl + "/invoice/view?busNo=scarlet");
|
||||
|
||||
EleInvioceBillDto eleInvioceBillDto = new EleInvioceBillDto();
|
||||
eleInvioceBillDto.setBaseUrl(baseUrl);
|
||||
eleInvioceBillDto.setEndpoint(endpoint);
|
||||
eleInvioceBillDto.setAppKey(appKey);
|
||||
eleInvioceBillDto.setAppID(appID);
|
||||
eleInvioceBillDto.setJsonObject(bill);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("result", "S0000");
|
||||
result.put("message", Base64.getEncoder().encodeToString(message.toJSONString().getBytes(StandardCharsets.UTF_8)));
|
||||
return result;
|
||||
}
|
||||
|
||||
// 创建Http请求
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000)
|
||||
.setSocketTimeout(30000).build();
|
||||
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
|
||||
CloseableHttpResponse response = null;
|
||||
// 发送请求
|
||||
try {
|
||||
HttpPost httpPost = new HttpPost(optionJson.getString("invoiceUrl") + "/eleInvoice/forward");
|
||||
System.out.println(optionJson.getString("invoiceUrl") + "/eleInvoice/forward");
|
||||
StringEntity stringEntity = new StringEntity(com.alibaba.fastjson2.JSON.toJSONString(eleInvioceBillDto),
|
||||
ContentType.APPLICATION_JSON);
|
||||
httpPost.setEntity(stringEntity);
|
||||
// 执行http请求
|
||||
response = httpClient.execute(httpPost);
|
||||
if (response == null) {
|
||||
throw new ServiceException("Http请求异常,未接受返回参数");
|
||||
private JSONObject createInternalSuccessResponse(JSONObject bill, String prefix) {
|
||||
String busNo = bill.getString("busNo");
|
||||
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
|
||||
String baseUrl = optionJson.getString(CommonConstants.Option.URL);
|
||||
|
||||
JSONObject message = new JSONObject();
|
||||
message.put("billBatchCode", prefix + "BC" + System.currentTimeMillis());
|
||||
message.put("billNo", UUID.randomUUID().toString().substring(0, 8));
|
||||
message.put("random", "123456");
|
||||
message.put("createTime", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
|
||||
message.put("billQRCode", "QR_" + busNo);
|
||||
message.put("pictureUrl", baseUrl + "/invoice/view?busNo=" + busNo);
|
||||
message.put("pictureNetUrl", baseUrl + "/invoice/view?busNo=" + busNo);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("result", "S0000");
|
||||
result.put("message", Base64.getEncoder().encodeToString(message.toJSONString().getBytes(StandardCharsets.UTF_8)));
|
||||
return result;
|
||||
}
|
||||
|
||||
private JSONObject createInternalErrorResponse(String msg) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("result", "E0001");
|
||||
result.put("message", Base64.getEncoder().encodeToString(msg.getBytes(StandardCharsets.UTF_8)));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvoiceHtml(String busNo) {
|
||||
JSONObject bill = invoiceDataMap.get(busNo);
|
||||
if (bill == null) {
|
||||
return "<html><body><h2>未找到流水号为 " + busNo + " 的发票数据</h2></body></html>";
|
||||
}
|
||||
|
||||
JSONObject receiptData = bill.getJSONObject("receiptData");
|
||||
|
||||
VelocityContext context = new VelocityContext();
|
||||
context.put("hospitalName", receiptData != null ? receiptData.getString("fixmedinsName") : "HIS 医疗机构");
|
||||
context.put("patientName", bill.getString("payer"));
|
||||
context.put("outpatientNo", receiptData != null ? receiptData.getString("regNo") : bill.getString("busNo"));
|
||||
context.put("idCard", bill.getString("cardNo"));
|
||||
context.put("tel", bill.getString("tel"));
|
||||
context.put("deptName", bill.getString("patientCategory"));
|
||||
context.put("doctorName", receiptData != null ? receiptData.getString("doctor") : "-");
|
||||
context.put("appointmentTime", bill.getString("consultationDate"));
|
||||
context.put("totalAmt", bill.getString("totalAmt"));
|
||||
context.put("busNo", busNo);
|
||||
context.put("printTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
|
||||
List<Map<String, Object>> items = new ArrayList<>();
|
||||
if (receiptData != null && receiptData.containsKey("chargeItem")) {
|
||||
com.alibaba.fastjson2.JSONArray chargeItems = receiptData.getJSONArray("chargeItem");
|
||||
for (int i = 0; i < chargeItems.size(); i++) {
|
||||
JSONObject item = chargeItems.getJSONObject(i);
|
||||
Map<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put("chargeItemName", item.getString("chargeItemName"));
|
||||
itemMap.put("quantityValue", item.getString("quantityValue"));
|
||||
itemMap.put("totalPrice", item.getString("totalPrice"));
|
||||
items.add(itemMap);
|
||||
}
|
||||
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
|
||||
} else {
|
||||
Map<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put("chargeItemName", "挂号费");
|
||||
itemMap.put("quantityValue", "1");
|
||||
itemMap.put("totalPrice", bill.getString("totalAmt"));
|
||||
items.add(itemMap);
|
||||
}
|
||||
context.put("items", items);
|
||||
|
||||
try {
|
||||
Template template = Velocity.getTemplate("vm/invoice/invoice.vm");
|
||||
StringWriter writer = new StringWriter();
|
||||
template.merge(context, writer);
|
||||
return writer.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Http请求异常,请稍后再试。");
|
||||
} finally {
|
||||
if (response != null) {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
// logger.error("关闭响应异常", e);
|
||||
throw new ServiceException("未关闭系统资源:" + e.getStackTrace());
|
||||
}
|
||||
log.error("渲染发票模板失败", e);
|
||||
return "<html><body><h2>渲染发票凭条失败:" + e.getMessage() + "</h2></body></html>";
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject PreInvoicePostForward(JSONObject bill, String endpoint) {
|
||||
// 参考补打小票逻辑,动态获取小票详细信息
|
||||
Long paymentId = bill.getLong("paymentId");
|
||||
if (paymentId != null) {
|
||||
try {
|
||||
Map<String, Object> receiptDetail = chargeBillService.getDetail(paymentId);
|
||||
bill.put("receiptData", receiptDetail);
|
||||
log.info("已成功获取并注入小票动态数据,paymentId: {}", paymentId);
|
||||
} catch (Exception e) {
|
||||
log.error("获取小票数据失败,paymentId: {}", paymentId, e);
|
||||
}
|
||||
}
|
||||
return JSONObject.parseObject(resultString);
|
||||
|
||||
// 内部调用逻辑:不再使用 Http 客户端,直接分发到本地逻辑
|
||||
String busNo = bill.getString("busNo");
|
||||
if (busNo != null) {
|
||||
invoiceDataMap.put(busNo, bill);
|
||||
}
|
||||
|
||||
JSONObject internalResult;
|
||||
if (endpoint.contains("invEBillRegistration")) {
|
||||
internalResult = internalRegistration(bill);
|
||||
} else if (endpoint.contains("invoiceEBillOutpatient")) {
|
||||
internalResult = internalOutpatient(bill);
|
||||
} else if (endpoint.contains("invEBillHospitalized")) {
|
||||
internalResult = internalHospitalized(bill);
|
||||
} else if (endpoint.contains("writeOffEBill")) {
|
||||
internalResult = internalWriteOff(bill);
|
||||
} else {
|
||||
internalResult = createInternalErrorResponse("未知接口: " + endpoint);
|
||||
}
|
||||
|
||||
JSONObject finalResponse = new JSONObject();
|
||||
finalResponse.put("success", true);
|
||||
finalResponse.put("result", internalResult);
|
||||
return finalResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送请求
|
||||
* 发送请求 (内部调用版本)
|
||||
*
|
||||
* @param bill 请求参数
|
||||
* @param endpoint 请求后缀url
|
||||
* @return 返回值
|
||||
*/
|
||||
public static JSONObject PreInvoicePost(JSONObject bill, String endpoint) {
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
// 获取当前租户的option信息
|
||||
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
|
||||
|
||||
String baseUrl = optionJson.getString(CommonConstants.Option.URL);
|
||||
// 拼接成完整 URL(作为路径)
|
||||
String cleanUrl = baseUrl + "/" + endpoint; // 确保用 "/" 分隔
|
||||
String url = cleanUrl.trim().replaceAll("^\"|\"$", "") // 去除首尾引号
|
||||
.replaceAll("\\s+", "")// 去除首尾引号
|
||||
.replaceAll("\"", ""); // 去除中间引号
|
||||
|
||||
String appID = optionJson.getString(CommonConstants.Option.APP_ID);
|
||||
String appKey = optionJson.getString(CommonConstants.Option.KEY);
|
||||
String data = bill.toJSONString();
|
||||
String version = "1.0";
|
||||
// 请求随机标识 noise
|
||||
String noise = UUID.randomUUID().toString();
|
||||
|
||||
data = Base64.getEncoder().encodeToString(data.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
StringBuilder str = new StringBuilder();
|
||||
str.append("appid=").append(appID);
|
||||
str.append("&data=").append(data);
|
||||
str.append("&noise=").append(noise);
|
||||
str.append("&key=").append(appKey);
|
||||
str.append("&version=").append(version);
|
||||
String sign = DigestUtils.md5Hex(str.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("appid", appID);
|
||||
map.put("data", data);
|
||||
map.put("noise", noise);
|
||||
map.put("sign", sign);
|
||||
map.put("version", version);
|
||||
|
||||
try {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
CloseableHttpClient client = HttpClients.createDefault();
|
||||
String respContent = null;
|
||||
// 请求参数转JOSN字符串
|
||||
StringEntity entity = new StringEntity(new ObjectMapper().writeValueAsString(map), "utf-8");
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/json");
|
||||
httpPost.setEntity(entity);
|
||||
HttpResponse resp = client.execute(httpPost);
|
||||
|
||||
if (resp.getStatusLine().getStatusCode() == 200) {
|
||||
String rev = EntityUtils.toString(resp.getEntity());
|
||||
// System.out.println("返回串--》"+rev);
|
||||
Map resultData = new ObjectMapper().readValue(rev, Map.class);
|
||||
String rdata = resultData.get("data").toString();
|
||||
String rnoise = resultData.get("noise").toString();
|
||||
// 1、拼接返回验签参数
|
||||
StringBuilder str1 = new StringBuilder();
|
||||
str1.append("appid=").append(appID);
|
||||
str1.append("&data=").append(rdata);
|
||||
str1.append("&noise=").append(rnoise);
|
||||
str1.append("&key=").append(appKey);
|
||||
str1.append("&version=").append(version);
|
||||
// 3.MD5加密 生成sign
|
||||
String rmd5 = DigestUtils.md5Hex(str1.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
|
||||
String rsign = resultData.get("sign").toString();
|
||||
System.out.println("验签-》" + (StringUtils.equals(rsign, rmd5)));
|
||||
String busData
|
||||
= new String(Base64.getDecoder().decode(resultData.get("data").toString()), StandardCharsets.UTF_8);
|
||||
System.out.println("返回业务数据--》" + busData);
|
||||
Map busDataMap = new ObjectMapper().readValue(busData, Map.class);
|
||||
System.out
|
||||
.println("业务信息解密--》" + new String(Base64.getDecoder().decode(busDataMap.get("message").toString()),
|
||||
StandardCharsets.UTF_8));
|
||||
|
||||
JSONObject resobj = JSONObject.parseObject(busData);
|
||||
result.put("success", true);
|
||||
result.put("result", resobj);
|
||||
} else {
|
||||
result.put("msg", "web响应失败!");
|
||||
result.put("success", false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("msg", e.getMessage());
|
||||
result.put("success", false);
|
||||
}
|
||||
return result;
|
||||
|
||||
public JSONObject PreInvoicePost(JSONObject bill, String endpoint) {
|
||||
return PreInvoicePostForward(bill, endpoint);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,6 +374,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
|
||||
// --------------------请求业务参数 data--------------------START
|
||||
JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle);
|
||||
bill.put("paymentId", paymentId);
|
||||
|
||||
// ------票据信息------
|
||||
// busType 业务标识 String 20 是 06,标识挂号
|
||||
@@ -580,6 +616,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
|
||||
// --------------------请求业务参数 data--------------------START
|
||||
JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle);
|
||||
bill.put("paymentId", paymentId);
|
||||
|
||||
// ------票据信息------
|
||||
// busType 业务标识 String 20 是 直接填写业务系统内部编码值,由医疗平台配置对照,例如:附录5 业务标识列表
|
||||
@@ -890,6 +927,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
|
||||
// --------------------请求业务参数 data--------------------START
|
||||
JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle);
|
||||
bill.put("paymentId", paymentId);
|
||||
|
||||
// ------票据信息------
|
||||
// busType 业务标识 String 20 是 直接填写业务系统内部编码值,由医疗平台配置对照,例如:附录5 业务标识列表
|
||||
|
||||
@@ -1818,6 +1818,10 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
// 保存就诊信息
|
||||
Encounter encounter = new Encounter();
|
||||
BeanUtils.copyProperties(encounterFormData, encounter);
|
||||
// 将挂号医生ID提前塞入 encounter 的 registrarId,便于生成“科室+医生+当日”序号
|
||||
if (encounterParticipantFormData.getPractitionerId() != null) {
|
||||
encounter.setRegistrarId(encounterParticipantFormData.getPractitionerId());
|
||||
}
|
||||
encounter.setBusNo(outpatientRegistrationSettleParam.getBusNo());
|
||||
// 就诊ID
|
||||
Long encounterId = iEncounterService.saveEncounterByRegister(encounter);
|
||||
|
||||
@@ -41,22 +41,23 @@ public class EleInvoiceController {
|
||||
public R<?> invoiceReissue(@RequestBody MakeInvoiceDto makeInvoiceDto) {
|
||||
// 付款成功后,开具发票
|
||||
R<?> result = eleInvoiceService.invoiceReissue(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
R<?> eleResult = null;
|
||||
if (result.getCode() == 200) {
|
||||
if (result.getData() == YbEncounterClass.REG.getValue()) {
|
||||
// 付款成功后,开具发票
|
||||
R<?> eleResult = eleInvoiceService.invoiceRegMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
eleResult = eleInvoiceService.invoiceRegMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
if (eleResult.getCode() != 200) {
|
||||
return R.ok(" 挂号电子发票开具失败 :" + eleResult.getMsg());
|
||||
}
|
||||
} else if (result.getData() == YbEncounterClass.AMB.getValue()) {
|
||||
// 付款成功后,开具发票
|
||||
R<?> eleResult = eleInvoiceService.invoiceMZMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
eleResult = eleInvoiceService.invoiceMZMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
if (eleResult.getCode() != 200) {
|
||||
return R.ok(" 门诊电子发票开具失败 :" + eleResult.getMsg());
|
||||
}
|
||||
} else if (result.getData() == YbEncounterClass.IMP.getValue()) {
|
||||
// 付款成功后,开具发票
|
||||
R<?> eleResult = eleInvoiceService.invoiceZYMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
eleResult = eleInvoiceService.invoiceZYMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
|
||||
if (eleResult.getCode() != 200) {
|
||||
return R.ok(" 住院电子发票开具失败 :" + eleResult.getMsg());
|
||||
}
|
||||
@@ -64,7 +65,11 @@ public class EleInvoiceController {
|
||||
return R.ok("电子发票类型不明确!");
|
||||
}
|
||||
}
|
||||
Map detail = iChargeBillService.getDetail(makeInvoiceDto.getPaymentId());
|
||||
Map<String, Object> detail = iChargeBillService.getDetail(makeInvoiceDto.getPaymentId());
|
||||
if (eleResult != null && eleResult.getCode() == 200 && eleResult.getData() instanceof Invoice) {
|
||||
Invoice invoice = (Invoice) eleResult.getData();
|
||||
detail.put("pictureUrl", invoice.getPictureUrl());
|
||||
}
|
||||
return R.ok(detail);
|
||||
}
|
||||
|
||||
@@ -95,10 +100,18 @@ public class EleInvoiceController {
|
||||
public R<?> invoiceOpen(@RequestParam("invoiceId") String invoiceId) {
|
||||
// 退款成功后,开具发票
|
||||
Invoice invoice = eleInvoiceService.getInvoiceById(Long.parseLong(invoiceId));
|
||||
if(invoice ==null){
|
||||
if (invoice == null) {
|
||||
throw new ServiceException("未查询到发票信息");
|
||||
}
|
||||
return R.ok(invoice.getPictureUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发票HTML凭条预览
|
||||
*/
|
||||
@GetMapping(value = "/view", produces = "text/html;charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String viewInvoice(@RequestParam("busNo") String busNo) {
|
||||
return eleInvoiceService.getInvoiceHtml(busNo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ package com.openhis.web.paymentmanage.controller;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.enums.TenantOptionDict;
|
||||
import com.core.web.util.TenantOptionUtil;
|
||||
import com.openhis.administration.domain.Invoice;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientRegistrationAddParam;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientRegistrationSettleParam;
|
||||
@@ -92,10 +93,12 @@ public class PaymentReconciliationController {
|
||||
if (eleResult.getCode() != 200) {
|
||||
// 因收费成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg());
|
||||
} else if (eleResult.getData() instanceof Invoice) {
|
||||
Invoice invoice = (Invoice) eleResult.getData();
|
||||
detail.put("pictureUrl", invoice.getPictureUrl());
|
||||
}
|
||||
return R.ok(detail);
|
||||
}
|
||||
|
||||
// Map detail = iChargeBillService.getDetail(paymentRecon.getId());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -194,7 +197,11 @@ public class PaymentReconciliationController {
|
||||
if (eleResult.getCode() != 200) {
|
||||
// 因收费成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg());
|
||||
} else if (eleResult.getData() instanceof Invoice) {
|
||||
Invoice invoice = (Invoice) eleResult.getData();
|
||||
detail.put("pictureUrl", invoice.getPictureUrl());
|
||||
}
|
||||
return R.ok(detail);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -233,6 +240,9 @@ public class PaymentReconciliationController {
|
||||
if (eleResult.getCode() != 200) {
|
||||
// 因收费成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg());
|
||||
} else if (eleResult.getData() instanceof Invoice) {
|
||||
Invoice invoice = (Invoice) eleResult.getData();
|
||||
detail.put("pictureUrl", invoice.getPictureUrl());
|
||||
}
|
||||
return R.ok(detail);
|
||||
}
|
||||
@@ -260,8 +270,9 @@ public class PaymentReconciliationController {
|
||||
// 因取消付款成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
return R.ok(null, " 取消付款成功,电子发票开具失败 :" + eleResult.getMsg());
|
||||
}
|
||||
return R.ok("取消结算成功");
|
||||
}
|
||||
return R.ok("取消结算失败,请确认");
|
||||
return R.fail("取消结算失败,请确认");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.openhis.web.reportmanage.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -13,8 +13,8 @@ import java.util.Date;
|
||||
* @author yuxj
|
||||
* @date 2025/8/25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Getter
|
||||
@Setter
|
||||
public class InpatientMedicalRecordHomePageCollectionDto {
|
||||
|
||||
// 组织机构代码 字符 30 必填
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.openhis.web.service;
|
||||
|
||||
import com.openhis.web.dto.HomeStatisticsDto;
|
||||
|
||||
/**
|
||||
* 首页统计Service接口
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-31
|
||||
*/
|
||||
public interface IHomeStatisticsService {
|
||||
/**
|
||||
* 获取首页统计数据
|
||||
*
|
||||
* @return 首页统计数据
|
||||
*/
|
||||
HomeStatisticsDto getHomeStatistics();
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.openhis.web.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.Encounter;
|
||||
import com.openhis.administration.domain.EncounterParticipant;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.service.IEncounterParticipantService;
|
||||
import com.openhis.administration.service.IEncounterService;
|
||||
import com.openhis.administration.service.IPatientService;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.common.enums.ParticipantType;
|
||||
import com.openhis.web.dto.HomeStatisticsDto;
|
||||
import com.openhis.web.service.IHomeStatisticsService;
|
||||
import com.openhis.web.patientmanage.mapper.PatientManageMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 首页统计Service业务层处理
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-12-31
|
||||
*/
|
||||
@Service
|
||||
public class HomeStatisticsServiceImpl implements IHomeStatisticsService {
|
||||
|
||||
@Autowired
|
||||
private IEncounterService encounterService;
|
||||
|
||||
@Autowired
|
||||
private IEncounterParticipantService encounterParticipantService;
|
||||
|
||||
@Autowired
|
||||
private IPractitionerService practitionerService;
|
||||
|
||||
@Autowired
|
||||
private PatientManageMapper patientManageMapper;
|
||||
|
||||
@Autowired
|
||||
private IPatientService patientService;
|
||||
|
||||
/**
|
||||
* 获取首页统计数据
|
||||
*
|
||||
* @return 首页统计数据
|
||||
*/
|
||||
@Override
|
||||
public HomeStatisticsDto getHomeStatistics() {
|
||||
HomeStatisticsDto statistics = new HomeStatisticsDto();
|
||||
|
||||
// 获取当前登录用户ID
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
// 查询当前用户对应的医生信息
|
||||
LambdaQueryWrapper<Practitioner> practitionerQuery = new LambdaQueryWrapper<>();
|
||||
practitionerQuery.eq(Practitioner::getUserId, userId);
|
||||
// 使用list()避免TooManyResultsException异常,然后取第一个记录
|
||||
List<Practitioner> practitionerList = practitionerService.list(practitionerQuery);
|
||||
Practitioner practitioner = practitionerList != null && !practitionerList.isEmpty() ? practitionerList.get(0) : null;
|
||||
|
||||
int totalPatients = 0;
|
||||
|
||||
// 如果当前用户是医生,查询该医生接诊和被挂号的所有患者
|
||||
if (practitioner != null) {
|
||||
// 查询该医生作为接诊医生(ADMITTER, code="1")和挂号医生(REGISTRATION_DOCTOR, code="12")的所有就诊记录的患者ID
|
||||
List<Long> doctorPatientIds = patientManageMapper.getPatientIdsByPractitionerId(
|
||||
practitioner.getId(),
|
||||
Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode()));
|
||||
|
||||
totalPatients = doctorPatientIds != null ? doctorPatientIds.size() : 0;
|
||||
} else {
|
||||
// 如果不是医生,查询所有患者(与患者管理页面逻辑保持一致)
|
||||
LambdaQueryWrapper<Patient> patientQuery = new LambdaQueryWrapper<>();
|
||||
patientQuery.eq(Patient::getDeleteFlag, "0");
|
||||
List<Patient> patientList = patientService.list(patientQuery);
|
||||
totalPatients = patientList != null ? patientList.size() : 0;
|
||||
}
|
||||
|
||||
statistics.setTotalPatients(totalPatients);
|
||||
|
||||
// 查询昨日在院患者数量(暂时简化处理)
|
||||
// TODO: 应该从历史记录表中查询昨天的实际在院患者数
|
||||
int yesterdayPatients = totalPatients; // 这里应该是从历史表中查询昨天的数据
|
||||
statistics.setYesterdayPatients(yesterdayPatients);
|
||||
|
||||
// 计算相对前日的百分比
|
||||
double patientTrend = calculateTrend(totalPatients, yesterdayPatients);
|
||||
statistics.setPatientTrend(patientTrend);
|
||||
|
||||
// 今日收入和预约等其他统计(暂时设为0,后续从相应表查询)
|
||||
statistics.setTodayRevenue("¥ 0");
|
||||
statistics.setYesterdayRevenue("¥ 0");
|
||||
statistics.setRevenueTrend(0.0);
|
||||
statistics.setTodayAppointments(0);
|
||||
statistics.setYesterdayAppointments(0);
|
||||
statistics.setAppointmentTrend(0.0);
|
||||
statistics.setPendingApprovals(0);
|
||||
|
||||
return statistics;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算相对前日的百分比变化
|
||||
*
|
||||
* @param todayValue 今天的值
|
||||
* @param yesterdayValue 昨天的值
|
||||
* @return 百分比变化(正数表示增长,负数表示下降)
|
||||
*/
|
||||
private double calculateTrend(double todayValue, double yesterdayValue) {
|
||||
if (yesterdayValue == 0) {
|
||||
return todayValue > 0 ? 100.0 : 0.0;
|
||||
}
|
||||
return ((todayValue - yesterdayValue) / yesterdayValue) * 100;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,9 @@ core:
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 应用上下文路径
|
||||
servlet:
|
||||
context-path: /openhis
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#\u9519\u8bef\u6d88\u606f
|
||||
not.null=* \u5fc5\u987b\u586b\u5199
|
||||
user.jcaptcha.error=\u9a8c\u8bc1\u7801\u9519\u8bef
|
||||
user.jcaptcha.expire=\u9a8c\u8bc1\u7801\u5df2\u5931\u6548
|
||||
user.not.exists=\u7528\u6237\u4e0d\u5b58\u5728/\u5bc6\u7801\u9519\u8bef
|
||||
user.password.not.match=\u7528\u6237\u4e0d\u5b58\u5728/\u5bc6\u7801\u9519\u8bef
|
||||
user.password.retry.limit.count=\u5bc6\u7801\u8f93\u5165\u9519\u8bef{0}\u6b21
|
||||
user.password.retry.limit.exceed=\u5bc6\u7801\u8f93\u5165\u9519\u8bef{0}\u6b21\uff0c\u5e10\u6237\u9501\u5b9a{1}\u5206\u949f
|
||||
user.password.delete=\u5bf9\u4e0d\u8d77\uff0c\u60a8\u7684\u8d26\u53f7\u5df2\u88ab\u5220\u9664
|
||||
user.blocked=\u7528\u6237\u5df2\u5c01\u7981\uff0c\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458
|
||||
role.blocked=\u89d2\u8272\u5df2\u5c01\u7981\uff0c\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458
|
||||
login.blocked=\u5f88\u9057\u61be\uff0c\u8bbf\u95eeIP\u5df2\u88ab\u5217\u5165\u7cfb\u7edf\u9ed1\u540d\u5355
|
||||
user.logout.success=\u9000\u51fa\u6210\u529f
|
||||
length.not.valid=\u957f\u5ea6\u5fc5\u987b\u5728{min}\u5230{max}\u4e2a\u5b57\u7b26\u4e4b\u95f4
|
||||
user.username.not.valid=* 2\u523020\u4e2a\u6c49\u5b57\u3001\u5b57\u6bcd\u3001\u6570\u5b57\u6216\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u4e14\u5fc5\u987b\u4ee5\u975e\u6570\u5b57\u5f00\u5934
|
||||
user.password.not.valid=* 5-50\u4e2a\u5b57\u7b26
|
||||
user.email.not.valid=\u90ae\u7bb1\u683c\u5f0f\u9519\u8bef
|
||||
user.mobile.phone.number.not.valid=\u624b\u673a\u53f7\u683c\u5f0f\u9519\u8bef
|
||||
user.login.success=\u767b\u5f55\u6210\u529f\u6210\u679c
|
||||
user.register.success=\u6ce8\u518c\u6210\u529f
|
||||
user.notfound=\u8bf7\u91cd\u65b0\u767b\u5f55
|
||||
user.forcelogout=\u7ba1\u7406\u5458\u5f3a\u5236\u9000\u51fa\uff0c\u8bf7\u91cd\u65b0\u767b\u5f55
|
||||
user.unknown.error=\u672a\u77e5\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u767b\u5f55
|
||||
##\u6587\u4ef6\u4e0a\u4f20\u6d88\u606f
|
||||
upload.exceed.maxSize=\u4e0a\u4f20\u7684\u6587\u4ef6\u5927\u5c0f\u8d85\u51fa\u9650\u5236\u7684\u6587\u4ef6\u5927\u5c0f\uff01<br/>\u5141\u8bb8\u7684\u6587\u4ef6\u6700\u5927\u5927\u5c0f\u662f\uff1a{0}MB\uff01
|
||||
upload.filename.exceed.length=\u4e0a\u4f20\u7684\u6587\u4ef6\u540d\u6700\u957f{0}\u4e2a\u5b57\u7b26
|
||||
##\u6743\u9650
|
||||
no.permission=\u60a8\u6ca1\u6709\u6570\u636e\u7684\u6743\u9650\uff0c\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458\u6dfb\u52a0\u6743\u9650 [{0}]
|
||||
no.create.permission=\u60a8\u6ca1\u6709\u521b\u5efa\u6570\u636e\u7684\u6743\u9650\uff0c\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458\u6dfb\u52a0\u6743\u9650 [{0}]
|
||||
no.update.permission=\u60a8\u6ca1\u6709\u4fee\u6539\u6570\u636e\u7684\u6743\u9650\uff0c\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458\u6dfb\u52a0\u6743\u9650 [{0}]
|
||||
no.delete.permission=\u60a8\u6ca1\u6709\u5220\u9664\u6570\u636e\u7684\u6743\u9650\uff0c\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458\u6dfb\u52a0\u6743\u9650 [{0}]
|
||||
no.export.permission=\u60a8\u6ca1\u6709\u5bfc\u51fa\u6570\u636e\u7684\u6743\u9650\uff0c\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458\u6dfb\u52a0\u6743\u9650 [{0}]
|
||||
no.view.permission=\u60a8\u6ca1\u6709\u67e5\u770b\u6570\u636e\u7684\u6743\u9650\uff0c\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458\u6dfb\u52a0\u6743\u9650 [{0}]
|
||||
apl.common.M00001={0}\u6dfb\u52a0\u6210\u529f
|
||||
apl.common.M00002={0}\u4fdd\u5b58\u6210\u529f
|
||||
apl.common.M00003={0}\u5df2\u7ecf\u5b58\u5728
|
||||
apl.common.M00004={0}\u64cd\u4f5c\u6210\u529f
|
||||
apl.common.M00005={0}\u5220\u9664\u6210\u529f
|
||||
apl.common.M00006=\u64cd\u4f5c\u5931\u8d25,\u8be5\u6570\u636e\u5df2\u88ab\u4ed6\u4eba\u5220\u9664,\u8bf7\u5237\u65b0\u540e\u91cd\u8bd5
|
||||
apl.common.M00007=\u64cd\u4f5c\u5931\u8d25,\u8be5\u6570\u636e\u5df2\u88ab\u4ed6\u4eba\u66f4\u6539,\u8bf7\u5237\u65b0\u540e\u91cd\u8bd5
|
||||
apl.common.M00008=\u8bf7\u52ff\u91cd\u590d\u63d0\u4ea4
|
||||
apl.common.M00009=\u67e5\u8be2\u6210\u529f
|
||||
apl.common.M00010=\u64cd\u4f5c\u5931\u8d25,\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458
|
||||
apl.chargeRefund.M00001=\u8be5\u6536\u8d39\u5355\u76f8\u5173{0}\u5df2\u7ecf\u53d1\u51fa\uff0c\u8bf7\u5148\u9000\u836f\u540e\u518d\u8fdb\u884c\u9000\u8d39
|
||||
apl.payment.M00001=\u5404\u7f34\u8d39\u6e20\u9053\u5b9e\u6536\u91d1\u989d\u5408\u8ba1\u4e0d\u7b49\u4e8e\u5b9e\u6536\u91d1\u989d
|
||||
apl.payment.M00002=\u5b9e\u6536\u91d1\u989d\u5408\u8ba1\u4e0d\u7b49\u4e8e\u5e94\u6536\u91d1\u989d
|
||||
apl.payment.M00003=\u8bf7\u9009\u62e9\u652f\u4ed8\u65b9\u5f0f
|
||||
apl.payment.M00004=\u67e5\u8be2\u6210\u529f
|
||||
apl.payment.M00005=\u64cd\u4f5c\u5931\u8d25,\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458
|
||||
apl.payment.M00006=\u6210\u529f\u6536\u8d39
|
||||
apl.payment.M00007=\u672a\u67e5\u8be2\u5230\u6536\u8d39\u9879\u76ee
|
||||
apl.payment.M00008=\u672a\u67e5\u8be2\u5230{0}\u8d26\u6237\u4fe1\u606f
|
||||
apl.payment.M00009=\u672a\u67e5\u8be2\u5230\u6536\u8d39\u9879\u76ee\uff0c\u4e0d\u9700\u8981\u8f6c\u6362\u8d26\u6237
|
||||
apl.adjustPrice.M00001=\u6267\u884c\u5931\u8d25\uff0c\u672a\u52a0\u8f7d\u5230\u4efb\u4f55\u6570\u636e\uff01
|
||||
apl.adjustPrice.M00002=\u6267\u884c\u5931\u8d25\uff0c\u6539\u4ef7\u5355\u4e2d\u6709\u6b63\u5728\u5ba1\u6838\u4e2d\u7684\u8d27\u54c1\uff0c\u8bf7\u68c0\u67e5\u540e\u91cd\u65b0\u63d0\u4ea4\uff01
|
||||
@@ -0,0 +1,55 @@
|
||||
#\u9519\u8BEF\u6D88\u606F
|
||||
not.null=* \u5FC5\u987B\u586B\u5199
|
||||
user.jcaptcha.error=\u9A8C\u8BC1\u7801\u9519\u8BEF
|
||||
user.jcaptcha.expire=\u9A8C\u8BC1\u7801\u5DF2\u5931\u6548
|
||||
user.not.exists=\u7528\u6237\u4E0D\u5B58\u5728/\u5BC6\u7801\u9519\u8BEF
|
||||
user.password.not.match=\u7528\u6237\u4E0D\u5B58\u5728/\u5BC6\u7801\u9519\u8BEF
|
||||
user.password.retry.limit.count=\u5BC6\u7801\u8F93\u5165\u9519\u8BEF{0}\u6B21
|
||||
user.password.retry.limit.exceed=\u5BC6\u7801\u8F93\u5165\u9519\u8BEF{0}\u6B21\uFF0C\u5E10\u6237\u9501\u5B9A{1}\u5206\u949F
|
||||
user.password.delete=\u5BF9\u4E0D\u8D77\uFF0C\u60A8\u7684\u8D26\u53F7\u5DF2\u88AB\u5220\u9664
|
||||
user.blocked=\u7528\u6237\u5DF2\u5C01\u7981\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458
|
||||
role.blocked=\u89D2\u8272\u5DF2\u5C01\u7981\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458
|
||||
login.blocked=\u5F88\u9057\u61BE\uFF0C\u8BBF\u95EEIP\u5DF2\u88AB\u5217\u5165\u7CFB\u7EDF\u9ED1\u540D\u5355
|
||||
user.logout.success=\u9000\u51FA\u6210\u529F
|
||||
length.not.valid=\u957F\u5EA6\u5FC5\u987B\u5728{min}\u5230{max}\u4E2A\u5B57\u7B26\u4E4B\u95F4
|
||||
user.username.not.valid=* 2\u523020\u4E2A\u6C49\u5B57\u3001\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\u7EC4\u6210\uFF0C\u4E14\u5FC5\u987B\u4EE5\u975E\u6570\u5B57\u5F00\u5934
|
||||
user.password.not.valid=* 5-50\u4E2A\u5B57\u7B26
|
||||
user.email.not.valid=\u90AE\u7BB1\u683C\u5F0F\u9519\u8BEF
|
||||
user.mobile.phone.number.not.valid=\u624B\u673A\u53F7\u683C\u5F0F\u9519\u8BEF
|
||||
user.login.success=\u767B\u5F55\u6210\u529F
|
||||
user.register.success=\u6CE8\u518C\u6210\u529F
|
||||
user.notfound=\u8BF7\u91CD\u65B0\u767B\u5F55
|
||||
user.forcelogout=\u7BA1\u7406\u5458\u5F3A\u5236\u9000\u51FA\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55
|
||||
user.unknown.error=\u672A\u77E5\u9519\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55
|
||||
##\u6587\u4EF6\u4E0A\u4F20\u6D88\u606F
|
||||
upload.exceed.maxSize=\u4E0A\u4F20\u7684\u6587\u4EF6\u5927\u5C0F\u8D85\u51FA\u9650\u5236\u7684\u6587\u4EF6\u5927\u5C0F\uFF01<br/>\u5141\u8BB8\u7684\u6587\u4EF6\u6700\u5927\u5927\u5C0F\u662F\uFF1A{0}MB\uFF01
|
||||
upload.filename.exceed.length=\u4E0A\u4F20\u7684\u6587\u4EF6\u540D\u6700\u957F{0}\u4E2A\u5B57\u7B26
|
||||
##\u6743\u9650
|
||||
no.permission=\u60A8\u6CA1\u6709\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}]
|
||||
no.create.permission=\u60A8\u6CA1\u6709\u521B\u5EFA\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}]
|
||||
no.update.permission=\u60A8\u6CA1\u6709\u4FEE\u6539\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}]
|
||||
no.delete.permission=\u60A8\u6CA1\u6709\u5220\u9664\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}]
|
||||
no.export.permission=\u60A8\u6CA1\u6709\u5BFC\u51FA\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}]
|
||||
no.view.permission=\u60A8\u6CA1\u6709\u67E5\u770B\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}]
|
||||
apl.common.M00001={0}\u6DFB\u52A0\u6210\u529F
|
||||
apl.common.M00002={0}\u4FDD\u5B58\u6210\u529F
|
||||
apl.common.M00003={0}\u5DF2\u7ECF\u5B58\u5728
|
||||
apl.common.M00004={0}\u64CD\u4F5C\u6210\u529F
|
||||
apl.common.M00005={0}\u5220\u9664\u6210\u529F
|
||||
apl.common.M00006=\u64CD\u4F5C\u5931\u8D25,\u8BE5\u6570\u636E\u5DF2\u88AB\u4ED6\u4EBA\u5220\u9664,\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5
|
||||
apl.common.M00007=\u64CD\u4F5C\u5931\u8D25,\u8BE5\u6570\u636E\u5DF2\u88AB\u4ED6\u4EBA\u66F4\u6539,\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5
|
||||
apl.common.M00008=\u8BF7\u52FF\u91CD\u590D\u63D0\u4EA4
|
||||
apl.common.M00009=\u67E5\u8BE2\u6210\u529F
|
||||
apl.common.M00010=\u64CD\u4F5C\u5931\u8D25,\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458
|
||||
apl.chargeRefund.M00001=\u8BE5\u6536\u8D39\u5355\u76F8\u5173{0}\u5DF2\u7ECF\u53D1\u51FA\uFF0C\u8BF7\u5148\u9000\u836F\u540E\u518D\u8FDB\u884C\u9000\u8D39
|
||||
apl.payment.M00001=\u5404\u7F34\u8D39\u6E20\u9053\u5B9E\u6536\u91D1\u989D\u5408\u8BA1\u4E0D\u7B49\u4E8E\u5B9E\u6536\u91D1\u989D
|
||||
apl.payment.M00002=\u5B9E\u6536\u91D1\u989D\u5408\u8BA1\u4E0D\u7B49\u4E8E\u5E94\u6536\u91D1\u989D
|
||||
apl.payment.M00003=\u8BF7\u9009\u62E9\u652F\u4ED8\u65B9\u5F0F
|
||||
apl.payment.M00004=\u67E5\u8BE2\u6210\u529F
|
||||
apl.payment.M00005=\u64CD\u4F5C\u5931\u8D25,\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458
|
||||
apl.payment.M00006=\u6210\u529F\u6536\u8D39
|
||||
apl.payment.M00007=\u672A\u67E5\u8BE2\u5230\u6536\u8D39\u9879\u76EE
|
||||
apl.payment.M00008=\u672A\u67E5\u8BE2\u5230{0}\u8D26\u6237\u4FE1\u606F
|
||||
apl.payment.M00009=\u672A\u67E5\u8BE2\u5230\u6536\u8D39\u9879\u76EE\uFF0C\u4E0D\u9700\u8981\u8F6C\u6362\u8D26\u6237
|
||||
apl.adjustPrice.M00001=\u6267\u884C\u5931\u8D25\uFF0C\u672A\u52A0\u8F7D\u5230\u4EFB\u4F55\u6570\u636E\uFF01
|
||||
apl.adjustPrice.M00002=\u6267\u884C\u5931\u8D25\uFF0C\u6539\u4EF7\u5355\u4E2D\u6709\u6B63\u5728\u5BA1\u6838\u4E2D\u7684\u8D27\u54C1\uFF0C\u8BF7\u68C0\u67E5\u540E\u91CD\u65B0\u63D0\u4EA4\uFF01
|
||||
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.appointmentmanage.mapper.DoctorScheduleMapper">
|
||||
|
||||
<!-- 自定义插入方法,明确排除id字段(数据库GENERATED ALWAYS) -->
|
||||
<insert id="insertWithoutId" parameterType="com.openhis.appointmentmanage.domain.DoctorSchedule" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
INSERT INTO adm_doctor_schedule (
|
||||
weekday,
|
||||
time_period,
|
||||
doctor,
|
||||
clinic,
|
||||
start_time,
|
||||
end_time,
|
||||
limit_number,
|
||||
call_sign_record,
|
||||
register_item,
|
||||
register_fee,
|
||||
diagnosis_item,
|
||||
diagnosis_fee,
|
||||
is_online,
|
||||
is_stopped,
|
||||
stop_reason,
|
||||
dept_id
|
||||
<if test="createTime != null">, create_time</if>
|
||||
<if test="updateTime != null">, update_time</if>
|
||||
) VALUES (
|
||||
#{weekday},
|
||||
#{timePeriod},
|
||||
#{doctor},
|
||||
#{clinic},
|
||||
#{startTime},
|
||||
#{endTime},
|
||||
#{limitNumber},
|
||||
#{callSignRecord},
|
||||
#{registerItem},
|
||||
#{registerFee},
|
||||
#{diagnosisItem},
|
||||
#{diagnosisFee},
|
||||
#{isOnline},
|
||||
#{isStopped},
|
||||
#{stopReason},
|
||||
#{deptId}
|
||||
<if test="createTime != null">, #{createTime}</if>
|
||||
<if test="updateTime != null">, #{updateTime}</if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -44,38 +44,34 @@
|
||||
</select>
|
||||
|
||||
<select id="getCurrentDayEncounter" resultType="com.openhis.web.chargemanage.dto.CurrentDayEncounterDto">
|
||||
SELECT T9.tenant_id,
|
||||
T9.encounter_id,
|
||||
T9.organization_id,
|
||||
T9.organization_name,
|
||||
T9.healthcare_name,
|
||||
T9.practitioner_user_id,
|
||||
T9.practitioner_name,
|
||||
T9.contract_name,
|
||||
T9.patient_id,
|
||||
T9.patient_name,
|
||||
SELECT T9.tenant_id AS tenantId,
|
||||
T9.encounter_id AS encounterId,
|
||||
T9.display_order AS displayOrder,
|
||||
T9.organization_id AS organizationId,
|
||||
T9.organization_name AS organizationName,
|
||||
T9.healthcare_name AS healthcareName,
|
||||
T9.practitioner_user_id AS practitionerUserId,
|
||||
T9.practitioner_name AS practitionerName,
|
||||
T9.contract_name AS contractName,
|
||||
T9.patient_id AS patientId,
|
||||
T9.patient_name AS patientName,
|
||||
T9.phone,
|
||||
T9.gender_enum,
|
||||
T9.id_card,
|
||||
T9.status_enum,
|
||||
T9.register_time,
|
||||
T9.total_price,
|
||||
T9.account_name,
|
||||
T9.enterer_name,
|
||||
T9.charge_item_ids,
|
||||
T9.payment_id,
|
||||
T9.picture_url,
|
||||
T9.birth_date,
|
||||
T9.return_date,
|
||||
T9.return_reason,
|
||||
T9.operator_name,
|
||||
T9.operator_id,
|
||||
T9.refund_amount,
|
||||
T9.contract_no,
|
||||
T9.refund_method
|
||||
T9.gender_enum AS genderEnum,
|
||||
T9.id_card AS idCard,
|
||||
T9.status_enum AS statusEnum,
|
||||
T9.register_time AS registerTime,
|
||||
T9.total_price AS totalPrice,
|
||||
T9.account_name AS accountName,
|
||||
T9.enterer_name AS entererName,
|
||||
T9.charge_item_ids AS chargeItemIds,
|
||||
T9.payment_id AS paymentId,
|
||||
T9.picture_url AS pictureUrl,
|
||||
T9.birth_date AS birthDate,
|
||||
COALESCE(T9.identifier_no, T9.patient_bus_no, '') AS identifierNo
|
||||
from (
|
||||
SELECT T1.tenant_id AS tenant_id,
|
||||
T1.id AS encounter_id,
|
||||
T1.display_order AS display_order,
|
||||
T1.organization_id AS organization_id,
|
||||
T2.NAME AS organization_name,
|
||||
T3.NAME AS healthcare_name,
|
||||
@@ -95,7 +91,9 @@
|
||||
T13.charge_item_ids,
|
||||
T13.id AS payment_id,
|
||||
ai.picture_url AS picture_url,
|
||||
T8.birth_date AS birth_date
|
||||
T8.birth_date AS birth_date,
|
||||
T8.bus_no AS patient_bus_no,
|
||||
T18.identifier_no AS identifier_no
|
||||
FROM adm_encounter AS T1
|
||||
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'
|
||||
@@ -125,6 +123,20 @@
|
||||
ON T1.ID = T6.encounter_id AND T6.delete_flag = '0' AND T6.encounter_flag = '1'
|
||||
LEFT JOIN fin_contract AS T7 ON T6.contract_no = T7.bus_no AND T7.delete_flag = '0'
|
||||
LEFT JOIN adm_patient AS T8 ON T1.patient_id = T8.ID AND T8.delete_flag = '0'
|
||||
LEFT JOIN (
|
||||
SELECT patient_id,
|
||||
identifier_no
|
||||
FROM (
|
||||
SELECT patient_id,
|
||||
identifier_no,
|
||||
ROW_NUMBER() OVER (PARTITION BY patient_id ORDER BY create_time ASC) AS rn
|
||||
FROM adm_patient_identifier
|
||||
WHERE delete_flag = '0'
|
||||
AND identifier_no IS NOT NULL
|
||||
AND identifier_no != ''
|
||||
) t
|
||||
WHERE rn = 1
|
||||
) AS T18 ON T8.id = T18.patient_id
|
||||
LEFT JOIN adm_charge_item AS T10 ON T1.id = T10.encounter_id AND T10.delete_flag = '0'
|
||||
LEFT JOIN adm_account AS T11 ON T10.account_id = T11.id AND T11.delete_flag = '0'
|
||||
LEFT JOIN adm_practitioner AS T12 ON T12.ID = T10.enterer_id AND T12.delete_flag = '0'
|
||||
|
||||
@@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="operatingRoomName" column="operating_room_name" />
|
||||
<result property="orgId" column="org_id" />
|
||||
<result property="orgName" column="org_name" />
|
||||
<result property="surgeryIndication" column="surgery_indication" />
|
||||
<result property="preoperativeDiagnosis" column="preoperative_diagnosis" />
|
||||
<result property="postoperativeDiagnosis" column="postoperative_diagnosis" />
|
||||
<result property="surgeryDescription" column="surgery_description" />
|
||||
@@ -50,6 +51,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="deleteFlag" column="delete_flag" />
|
||||
<result property="emergencyFlag" column="emergency_flag" />
|
||||
<result property="implantFlag" column="implant_flag" />
|
||||
<result property="operatingRoomConfirmTime" column="operating_room_confirm_time" />
|
||||
<result property="operatingRoomConfirmUser" column="operating_room_confirm_user" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSurgeryVo">
|
||||
@@ -59,9 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
main_surgeon_id, main_surgeon_name, assistant_1_id, assistant_1_name, assistant_2_id, assistant_2_name,
|
||||
anesthetist_id, anesthetist_name, scrub_nurse_id, scrub_nurse_name, anesthesia_type_enum,
|
||||
body_site, incision_level, healing_level, operating_room_id, operating_room_name,
|
||||
org_id, org_name, preoperative_diagnosis, postoperative_diagnosis, surgery_description,
|
||||
org_id, org_name, surgery_indication, preoperative_diagnosis, postoperative_diagnosis, surgery_description,
|
||||
postoperative_advice, complications, surgery_fee, anesthesia_fee, total_fee, remark,
|
||||
create_by, create_time, update_by, update_time, delete_flag
|
||||
create_by, create_time, update_by, update_time, delete_flag,
|
||||
emergency_flag, implant_flag, operating_room_confirm_time, operating_room_confirm_user
|
||||
FROM cli_surgery
|
||||
</sql>
|
||||
|
||||
|
||||
@@ -13,6 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="patientAge" column="patient_age" />
|
||||
<result property="encounterId" column="encounter_id" />
|
||||
<result property="encounterNo" column="encounter_no" />
|
||||
<result property="applyDoctorId" column="apply_doctor_id" />
|
||||
<result property="applyDoctorName" column="apply_doctor_name" />
|
||||
<result property="applyDeptId" column="apply_dept_id" />
|
||||
<result property="applyDeptName" column="apply_dept_name" />
|
||||
<result property="surgeryIndication" column="surgery_indication" />
|
||||
<result property="surgeryName" column="surgery_name" />
|
||||
<result property="surgeryCode" column="surgery_code" />
|
||||
<result property="surgeryTypeEnum" column="surgery_type_enum" />
|
||||
@@ -43,6 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="healingLevel_dictText" column="healing_level_dictText" />
|
||||
<result property="operatingRoomId" column="operating_room_id" />
|
||||
<result property="operatingRoomName" column="operating_room_name" />
|
||||
<result property="operatingRoomOrgId" column="operating_room_org_id" />
|
||||
<result property="operatingRoomOrgName" column="operating_room_org_name" />
|
||||
<result property="orgId" column="org_id" />
|
||||
<result property="orgName" column="org_name" />
|
||||
<result property="preoperativeDiagnosis" column="preoperative_diagnosis" />
|
||||
@@ -56,6 +63,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="emergencyFlag" column="emergency_flag" />
|
||||
<result property="implantFlag" column="implant_flag" />
|
||||
<result property="operatingRoomConfirmTime" column="operating_room_confirm_time" />
|
||||
<result property="operatingRoomConfirmUser" column="operating_room_confirm_user" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSurgeryVo">
|
||||
@@ -68,38 +79,86 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
EXTRACT(YEAR FROM AGE(p.birth_date)) as patient_age,
|
||||
s.encounter_id,
|
||||
e.bus_no as encounter_no,
|
||||
s.apply_doctor_id,
|
||||
COALESCE(s.apply_doctor_name, apply_doc.name) as apply_doctor_name,
|
||||
s.apply_dept_id,
|
||||
COALESCE(s.apply_dept_name, apply_dept.name) as apply_dept_name,
|
||||
s.surgery_name,
|
||||
s.surgery_code,
|
||||
s.surgery_type_enum,
|
||||
s.surgery_type_enum as surgery_type_enum_dictText,
|
||||
CASE s.surgery_type_enum
|
||||
WHEN 1 THEN '门诊手术'
|
||||
WHEN 2 THEN '住院手术'
|
||||
WHEN 3 THEN '急诊手术'
|
||||
WHEN 4 THEN '择期手术'
|
||||
ELSE '未知'
|
||||
END as surgery_type_enum_dictText,
|
||||
s.surgery_level,
|
||||
s.surgery_level as surgery_level_dictText,
|
||||
CASE s.surgery_level
|
||||
WHEN 1 THEN '一级手术'
|
||||
WHEN 2 THEN '二级手术'
|
||||
WHEN 3 THEN '三级手术'
|
||||
WHEN 4 THEN '四级手术'
|
||||
WHEN 5 THEN '特级手术'
|
||||
ELSE '未知'
|
||||
END as surgery_level_dictText,
|
||||
s.status_enum,
|
||||
s.status_enum as status_enum_dictText,
|
||||
CASE s.status_enum
|
||||
WHEN 0 THEN '待排期'
|
||||
WHEN 1 THEN '已排期'
|
||||
WHEN 2 THEN '手术中'
|
||||
WHEN 3 THEN '已完成'
|
||||
WHEN 4 THEN '已取消'
|
||||
WHEN 5 THEN '暂停'
|
||||
ELSE '未知'
|
||||
END as status_enum_dictText,
|
||||
s.planned_time,
|
||||
s.actual_start_time,
|
||||
s.actual_end_time,
|
||||
s.main_surgeon_id,
|
||||
s.main_surgeon_name,
|
||||
COALESCE(s.main_surgeon_name, main_surgeon.name) as main_surgeon_name,
|
||||
s.assistant_1_id,
|
||||
s.assistant_1_name,
|
||||
COALESCE(s.assistant_1_name, assistant1.name) as assistant_1_name,
|
||||
s.assistant_2_id,
|
||||
s.assistant_2_name,
|
||||
COALESCE(s.assistant_2_name, assistant2.name) as assistant_2_name,
|
||||
s.anesthetist_id,
|
||||
s.anesthetist_name,
|
||||
COALESCE(s.anesthetist_name, anesthetist.name) as anesthetist_name,
|
||||
s.scrub_nurse_id,
|
||||
s.scrub_nurse_name,
|
||||
COALESCE(s.scrub_nurse_name, scrub_nurse.name) as scrub_nurse_name,
|
||||
s.anesthesia_type_enum,
|
||||
s.anesthesia_type_enum as anesthesia_type_enum_dictText,
|
||||
CASE s.anesthesia_type_enum
|
||||
WHEN 0 THEN '无麻醉'
|
||||
WHEN 1 THEN '局部麻醉'
|
||||
WHEN 2 THEN '区域麻醉'
|
||||
WHEN 3 THEN '全身麻醉'
|
||||
WHEN 4 THEN '脊椎麻醉'
|
||||
WHEN 5 THEN '硬膜外麻醉'
|
||||
WHEN 6 THEN '表面麻醉'
|
||||
ELSE '未知'
|
||||
END as anesthesia_type_enum_dictText,
|
||||
s.body_site,
|
||||
s.incision_level,
|
||||
s.incision_level as incision_level_dictText,
|
||||
CASE s.incision_level
|
||||
WHEN 1 THEN 'I级切口'
|
||||
WHEN 2 THEN 'II级切口'
|
||||
WHEN 3 THEN 'III级切口'
|
||||
WHEN 4 THEN 'IV级切口'
|
||||
ELSE '未知'
|
||||
END as incision_level_dictText,
|
||||
s.healing_level,
|
||||
s.healing_level as healing_level_dictText,
|
||||
CASE s.healing_level
|
||||
WHEN 1 THEN '甲级愈合'
|
||||
WHEN 2 THEN '乙级愈合'
|
||||
WHEN 3 THEN '丙级愈合'
|
||||
ELSE '未知'
|
||||
END as healing_level_dictText,
|
||||
s.operating_room_id,
|
||||
s.operating_room_name,
|
||||
COALESCE(s.operating_room_name, r.name) as operating_room_name,
|
||||
r.organization_id as operating_room_org_id,
|
||||
ro.name as operating_room_org_name,
|
||||
s.org_id,
|
||||
o.name as org_name,
|
||||
COALESCE(s.org_name, o.name) as org_name,
|
||||
s.surgery_indication,
|
||||
s.preoperative_diagnosis,
|
||||
s.postoperative_diagnosis,
|
||||
s.surgery_description,
|
||||
@@ -110,11 +169,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
s.total_fee,
|
||||
s.remark,
|
||||
s.create_time,
|
||||
s.update_time
|
||||
s.update_time,
|
||||
s.emergency_flag,
|
||||
s.implant_flag,
|
||||
s.operating_room_confirm_time,
|
||||
s.operating_room_confirm_user
|
||||
FROM cli_surgery s
|
||||
LEFT JOIN adm_patient p ON s.patient_id = p.id
|
||||
LEFT JOIN adm_encounter e ON s.encounter_id = e.id
|
||||
LEFT JOIN adm_operating_room r ON s.operating_room_id = r.id
|
||||
LEFT JOIN adm_organization ro ON r.organization_id = ro.id
|
||||
LEFT JOIN adm_organization o ON s.org_id = o.id
|
||||
LEFT JOIN adm_practitioner main_surgeon ON s.main_surgeon_id = main_surgeon.id
|
||||
LEFT JOIN adm_practitioner anesthetist ON s.anesthetist_id = anesthetist.id
|
||||
LEFT JOIN adm_practitioner assistant1 ON s.assistant_1_id = assistant1.id
|
||||
LEFT JOIN adm_practitioner assistant2 ON s.assistant_2_id = assistant2.id
|
||||
LEFT JOIN adm_practitioner scrub_nurse ON s.scrub_nurse_id = scrub_nurse.id
|
||||
LEFT JOIN adm_practitioner apply_doc ON s.apply_doctor_id = apply_doc.id
|
||||
LEFT JOIN adm_organization apply_dept ON s.apply_dept_id = apply_dept.id
|
||||
</sql>
|
||||
|
||||
<select id="getSurgeryPage" parameterType="com.baomidou.mybatisplus.core.conditions.query.QueryWrapper" resultMap="SurgeryResult">
|
||||
@@ -122,7 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
s.delete_flag = '0'
|
||||
<if test="ew.sqlSegment != null and ew.sqlSegment != ''">
|
||||
AND ${ew.sqlSegment}
|
||||
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', 'p.name').replace('main_surgeon_name', 's.main_surgeon_name').replace('anesthetist_name', 's.anesthetist_name').replace('org_name', 'o.name')}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
@@ -132,4 +204,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
WHERE s.id = #{id} AND s.delete_flag = '0'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
@@ -43,207 +43,247 @@
|
||||
abi.restricted_scope,
|
||||
abi.dosage_instruction,
|
||||
abi.chrgitm_lv
|
||||
from (
|
||||
<if test="adviceTypes == null or adviceTypes.contains(1)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
1 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
T1.pharmacology_category_code AS pharmacology_category_code,
|
||||
T1.part_percent AS part_percent,
|
||||
T1.unit_conversion_ratio AS unit_conversion_ratio,
|
||||
T1.part_attribute_enum AS part_attribute_enum,
|
||||
T1.tho_part_attribute_enum AS tho_part_attribute_enum,
|
||||
T1.skin_test_flag AS skin_test_flag,
|
||||
T1.inject_flag AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
T1.merchandise_name AS product_name,
|
||||
0 AS activity_type,
|
||||
T1.unit_code AS unit_code,
|
||||
T1.min_unit_code AS min_unit_code,
|
||||
T2.total_volume AS volume,
|
||||
T2.method_code AS method_code,
|
||||
T2.rate_code AS rate_code,
|
||||
T2.org_id AS org_id,
|
||||
T2.location_id AS location_id,
|
||||
CAST(T2.dose AS TEXT) AS dose,
|
||||
T2.dose_unit_code AS dose_unit_code,
|
||||
T3.NAME AS supplier,
|
||||
T3.id AS supplier_id,
|
||||
T1.manufacturer_text AS manufacturer,
|
||||
T5.id AS charge_item_definition_id,
|
||||
T5.instance_table AS advice_table_name,
|
||||
T6.def_location_id AS position_id,
|
||||
t1.restricted_flag AS restricted_flag,
|
||||
t1.restricted_scope AS restricted_scope,
|
||||
T1.dosage_instruction AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM med_medication_definition AS t1
|
||||
INNER JOIN med_medication AS T2 ON T2.medication_def_id = T1.ID
|
||||
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_supplier AS T3
|
||||
ON T3.ID = T1.supply_id
|
||||
AND T3.delete_flag = '0'
|
||||
LEFT JOIN adm_charge_item_definition AS T5 ON T5.instance_id = T1.ID
|
||||
AND T5.delete_flag = '0' AND T5.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_organization_location AS T6
|
||||
ON T6.distribution_category_code = T1.category_code
|
||||
AND T6.delete_flag = '0' AND T6.item_code = '1' AND T6.organization_id = #{organizationId} AND
|
||||
(CURRENT_TIME :: time (6) BETWEEN T6.start_time AND T6.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
AND T2.status_enum = #{statusEnum}
|
||||
<if test="pricingFlag ==1">
|
||||
AND 1 = 2
|
||||
FROM (
|
||||
<!-- 确保至少有一个查询被执行以避免语法错误 -->
|
||||
<if test="adviceTypes != null and !adviceTypes.isEmpty() and (adviceTypes.contains(1) or adviceTypes.contains(2) or adviceTypes.contains(3))">
|
||||
<!-- 如果有有效的adviceTypes,则执行对应的查询 -->
|
||||
<if test="adviceTypes.contains(1)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
1 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
T1.pharmacology_category_code AS pharmacology_category_code,
|
||||
T1.part_percent AS part_percent,
|
||||
T1.unit_conversion_ratio AS unit_conversion_ratio,
|
||||
T1.part_attribute_enum AS part_attribute_enum,
|
||||
T1.tho_part_attribute_enum AS tho_part_attribute_enum,
|
||||
T1.skin_test_flag AS skin_test_flag,
|
||||
T1.inject_flag AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
T1.merchandise_name AS product_name,
|
||||
0 AS activity_type,
|
||||
T1.unit_code AS unit_code,
|
||||
T1.min_unit_code AS min_unit_code,
|
||||
T2.total_volume AS volume,
|
||||
T2.method_code AS method_code,
|
||||
T2.rate_code AS rate_code,
|
||||
T2.org_id AS org_id,
|
||||
T2.location_id AS location_id,
|
||||
CAST(T2.dose AS TEXT) AS dose,
|
||||
T2.dose_unit_code AS dose_unit_code,
|
||||
T3.NAME AS supplier,
|
||||
T3.id AS supplier_id,
|
||||
T1.manufacturer_text AS manufacturer,
|
||||
T5.id AS charge_item_definition_id,
|
||||
T5.instance_table AS advice_table_name,
|
||||
T6.def_location_id AS position_id,
|
||||
t1.restricted_flag AS restricted_flag,
|
||||
t1.restricted_scope AS restricted_scope,
|
||||
T1.dosage_instruction AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM med_medication_definition AS t1
|
||||
INNER JOIN med_medication AS T2 ON T2.medication_def_id = T1.ID
|
||||
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_supplier AS T3
|
||||
ON T3.ID = T1.supply_id
|
||||
AND T3.delete_flag = '0'
|
||||
LEFT JOIN adm_charge_item_definition AS T5 ON T5.instance_id = T1.ID
|
||||
AND T5.delete_flag = '0' AND T5.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_organization_location AS T6
|
||||
ON T6.distribution_category_code = T1.category_code
|
||||
AND T6.delete_flag = '0' AND T6.item_code = '1' AND T6.organization_id = #{organizationId} AND
|
||||
(CURRENT_TIME :: time (6) BETWEEN T6.start_time AND T6.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
AND T2.status_enum = #{statusEnum}
|
||||
<if test="pricingFlag ==1">
|
||||
AND 1 = 2
|
||||
</if>
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND T5.instance_table = #{medicationTableName}
|
||||
)
|
||||
<if test="adviceTypes.contains(2) or adviceTypes.contains(3)">UNION ALL</if>
|
||||
</if>
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
|
||||
<if test="adviceTypes.contains(2)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
2 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
'' AS pharmacology_category_code,
|
||||
T1.part_percent AS part_percent,
|
||||
0 AS unit_conversion_ratio,
|
||||
null AS part_attribute_enum,
|
||||
null AS tho_part_attribute_enum,
|
||||
null AS skin_test_flag,
|
||||
null AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
'' AS product_name,
|
||||
0 AS activity_type,
|
||||
T1.unit_code AS unit_code,
|
||||
T1.min_unit_code AS min_unit_code,
|
||||
T1.SIZE AS volume,
|
||||
'' AS method_code,
|
||||
'' AS rate_code,
|
||||
T1.org_id AS org_id,
|
||||
T1.location_id AS location_id,
|
||||
'' AS dose,
|
||||
'' AS dose_unit_code,
|
||||
T2.NAME AS supplier,
|
||||
T2.id AS supplier_id,
|
||||
T1.manufacturer_text AS manufacturer,
|
||||
T4.id AS charge_item_definition_id,
|
||||
T4.instance_table AS advice_table_name,
|
||||
T5.def_location_id AS position_id,
|
||||
0 AS restricted_flag,
|
||||
'' AS restricted_scope,
|
||||
'' AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM adm_device_definition AS T1
|
||||
LEFT JOIN adm_supplier AS T2
|
||||
ON T2.ID = T1.supply_id
|
||||
AND T2.delete_flag = '0'
|
||||
LEFT JOIN adm_charge_item_definition AS T4 ON T4.instance_id = T1.ID
|
||||
AND T4.delete_flag = '0' AND T4.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_organization_location AS T5 ON T5.distribution_category_code = T1.category_code
|
||||
AND T5.delete_flag = '0' AND T5.item_code = '2' AND T5.organization_id = #{organizationId} AND
|
||||
(CURRENT_TIME :: time (6) BETWEEN T5.start_time AND T5.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND T4.instance_table = #{deviceTableName}
|
||||
AND T1.status_enum = #{statusEnum}
|
||||
)
|
||||
<if test="adviceTypes.contains(3)">UNION ALL</if>
|
||||
</if>
|
||||
|
||||
<if test="adviceTypes.contains(3)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
3 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
'' AS pharmacology_category_code,
|
||||
1 AS part_percent,
|
||||
0 AS unit_conversion_ratio,
|
||||
null AS part_attribute_enum,
|
||||
null AS tho_part_attribute_enum,
|
||||
null AS skin_test_flag,
|
||||
null AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
'' AS product_name,
|
||||
T1.type_enum AS activity_type,
|
||||
'' AS unit_code,
|
||||
'' AS min_unit_code,
|
||||
'' AS volume,
|
||||
'' AS method_code,
|
||||
'' AS rate_code,
|
||||
T1.org_id AS org_id,
|
||||
T1.location_id AS location_id,
|
||||
'' AS dose,
|
||||
'' AS dose_unit_code,
|
||||
'' AS supplier,
|
||||
null AS supplier_id,
|
||||
'' AS manufacturer,
|
||||
T2.ID AS charge_item_definition_id,
|
||||
T2.instance_table AS advice_table_name,
|
||||
T3.organization_id AS position_id,
|
||||
0 AS restricted_flag,
|
||||
'' AS restricted_scope,
|
||||
'' AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM wor_activity_definition AS T1
|
||||
LEFT JOIN adm_charge_item_definition AS T2
|
||||
ON T2.instance_id = T1.ID
|
||||
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
||||
AND T2.instance_table = #{activityTableName}
|
||||
LEFT JOIN adm_organization_location AS T3 ON T3.activity_definition_id = T1.ID
|
||||
AND T3.delete_flag = '0' AND (CURRENT_TIME :: time (6) BETWEEN T3.start_time AND T3.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
<if test="pricingFlag ==1">
|
||||
AND (T1.pricing_flag = #{pricingFlag} OR T1.pricing_flag IS NULL)
|
||||
</if>
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND T1.status_enum = #{statusEnum}
|
||||
)
|
||||
</if>
|
||||
AND T5.instance_table = #{medicationTableName}
|
||||
)
|
||||
</if>
|
||||
|
||||
|
||||
<if test="adviceTypes == null or adviceTypes.contains(1)">
|
||||
<if test="adviceTypes == null or adviceTypes.contains(2) or adviceTypes.contains(3)">UNION ALL</if>
|
||||
</if>
|
||||
|
||||
<if test="adviceTypes == null or adviceTypes.contains(2)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
2 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
'' AS pharmacology_category_code,
|
||||
T1.part_percent AS part_percent,
|
||||
0 AS unit_conversion_ratio,
|
||||
null AS part_attribute_enum,
|
||||
null AS tho_part_attribute_enum,
|
||||
null AS skin_test_flag,
|
||||
null AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
'' AS product_name,
|
||||
0 AS activity_type,
|
||||
T1.unit_code AS unit_code,
|
||||
T1.min_unit_code AS min_unit_code,
|
||||
T1.SIZE AS volume,
|
||||
'' AS method_code,
|
||||
'' AS rate_code,
|
||||
T1.org_id AS org_id,
|
||||
T1.location_id AS location_id,
|
||||
'' AS dose,
|
||||
'' AS dose_unit_code,
|
||||
T2.NAME AS supplier,
|
||||
T2.id AS supplier_id,
|
||||
T1.manufacturer_text AS manufacturer,
|
||||
T4.id AS charge_item_definition_id,
|
||||
T4.instance_table AS advice_table_name,
|
||||
T5.def_location_id AS position_id,
|
||||
0 AS restricted_flag,
|
||||
'' AS restricted_scope,
|
||||
'' AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM adm_device_definition AS T1
|
||||
LEFT JOIN adm_supplier AS T2
|
||||
ON T2.ID = T1.supply_id
|
||||
AND T2.delete_flag = '0'
|
||||
LEFT JOIN adm_charge_item_definition AS T4 ON T4.instance_id = T1.ID
|
||||
AND T4.delete_flag = '0' AND T4.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_organization_location AS T5 ON T5.distribution_category_code = T1.category_code
|
||||
AND T5.delete_flag = '0' AND T5.item_code = '2' AND T5.organization_id = #{organizationId} AND
|
||||
(CURRENT_TIME :: time (6) BETWEEN T5.start_time AND T5.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND T4.instance_table = #{deviceTableName}
|
||||
AND T1.status_enum = #{statusEnum}
|
||||
)
|
||||
</if>
|
||||
|
||||
|
||||
<if test="adviceTypes == null or adviceTypes.contains(2)">
|
||||
<if test="adviceTypes == null or adviceTypes.contains(3)">UNION ALL</if>
|
||||
</if>
|
||||
|
||||
<if test="adviceTypes == null or adviceTypes.contains(3)">
|
||||
(SELECT
|
||||
DISTINCT ON (T1.ID)
|
||||
T1.tenant_id,
|
||||
3 AS advice_type,
|
||||
T1.bus_no AS bus_no,
|
||||
T1.category_code AS category_code,
|
||||
'' AS pharmacology_category_code,
|
||||
1 AS part_percent,
|
||||
0 AS unit_conversion_ratio,
|
||||
null AS part_attribute_enum,
|
||||
null AS tho_part_attribute_enum,
|
||||
null AS skin_test_flag,
|
||||
null AS inject_flag,
|
||||
T1.ID AS advice_definition_id,
|
||||
T1.NAME AS advice_name,
|
||||
T1.bus_no AS advice_bus_no,
|
||||
T1.py_str AS py_str,
|
||||
T1.wb_str AS wb_str,
|
||||
T1.yb_no AS yb_no,
|
||||
'' AS product_name,
|
||||
T1.type_enum AS activity_type,
|
||||
'' AS unit_code,
|
||||
'' AS min_unit_code,
|
||||
'' AS volume,
|
||||
'' AS method_code,
|
||||
'' AS rate_code,
|
||||
T1.org_id AS org_id,
|
||||
T1.location_id AS location_id,
|
||||
'' AS dose,
|
||||
'' AS dose_unit_code,
|
||||
'' AS supplier,
|
||||
null AS supplier_id,
|
||||
'' AS manufacturer,
|
||||
T2.ID AS charge_item_definition_id,
|
||||
T2.instance_table AS advice_table_name,
|
||||
T3.organization_id AS position_id,
|
||||
0 AS restricted_flag,
|
||||
'' AS restricted_scope,
|
||||
'' AS dosage_instruction,
|
||||
T1.chrgitm_lv as chrgitm_lv
|
||||
FROM wor_activity_definition AS T1
|
||||
LEFT JOIN adm_charge_item_definition AS T2
|
||||
ON T2.instance_id = T1.ID
|
||||
AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum}
|
||||
LEFT JOIN adm_organization_location AS T3 ON T3.activity_definition_id = T1.ID
|
||||
AND T3.delete_flag = '0' AND (CURRENT_TIME :: time (6) BETWEEN T3.start_time AND T3.end_time)
|
||||
WHERE T1.delete_flag = '0'
|
||||
<if test="pricingFlag ==1">
|
||||
AND T1.pricing_flag = #{pricingFlag}
|
||||
</if>
|
||||
<if test="adviceDefinitionIdParamList != null and !adviceDefinitionIdParamList.isEmpty()">
|
||||
AND T1.id IN
|
||||
<foreach collection="adviceDefinitionIdParamList" item="itemId" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND T1.status_enum = #{statusEnum}
|
||||
AND T2.instance_table = #{activityTableName}
|
||||
)
|
||||
<!-- 如果没有有效的adviceTypes,提供一个空的默认查询以避免语法错误 -->
|
||||
<if test="adviceTypes == null or adviceTypes.isEmpty() or (!adviceTypes.contains(1) and !adviceTypes.contains(2) and !adviceTypes.contains(3))">
|
||||
SELECT
|
||||
mmd.tenant_id,
|
||||
CAST(0 AS INTEGER) AS advice_type,
|
||||
CAST('' AS VARCHAR) AS bus_no,
|
||||
CAST('' AS VARCHAR) AS category_code,
|
||||
CAST('' AS VARCHAR) AS pharmacology_category_code,
|
||||
CAST(0 AS NUMERIC) AS part_percent,
|
||||
CAST(0 AS NUMERIC) AS unit_conversion_ratio,
|
||||
CAST(0 AS INTEGER) AS part_attribute_enum,
|
||||
CAST(0 AS INTEGER) AS tho_part_attribute_enum,
|
||||
CAST(0 AS INTEGER) AS skin_test_flag,
|
||||
CAST(0 AS INTEGER) AS inject_flag,
|
||||
CAST(0 AS BIGINT) AS advice_definition_id,
|
||||
CAST('' AS VARCHAR) AS advice_name,
|
||||
CAST('' AS VARCHAR) AS advice_bus_no,
|
||||
CAST('' AS VARCHAR) AS py_str,
|
||||
CAST('' AS VARCHAR) AS wb_str,
|
||||
CAST('' AS VARCHAR) AS yb_no,
|
||||
CAST('' AS VARCHAR) AS product_name,
|
||||
CAST(0 AS INTEGER) AS activity_type,
|
||||
CAST('' AS VARCHAR) AS unit_code,
|
||||
CAST('' AS VARCHAR) AS min_unit_code,
|
||||
CAST(0 AS NUMERIC) AS volume,
|
||||
CAST('' AS VARCHAR) AS method_code,
|
||||
CAST('' AS VARCHAR) AS rate_code,
|
||||
CAST(0 AS BIGINT) AS org_id,
|
||||
CAST(0 AS BIGINT) AS location_id,
|
||||
CAST('' AS VARCHAR) AS dose,
|
||||
CAST('' AS VARCHAR) AS dose_unit_code,
|
||||
CAST('' AS VARCHAR) AS supplier,
|
||||
CAST(0 AS BIGINT) AS supplier_id,
|
||||
CAST('' AS VARCHAR) AS manufacturer,
|
||||
CAST(0 AS BIGINT) AS charge_item_definition_id,
|
||||
CAST('' AS VARCHAR) AS advice_table_name,
|
||||
CAST(0 AS BIGINT) AS position_id,
|
||||
CAST(0 AS INTEGER) AS restricted_flag,
|
||||
CAST('' AS VARCHAR) AS restricted_scope,
|
||||
CAST('' AS VARCHAR) AS dosage_instruction,
|
||||
CAST(0 AS INTEGER) AS chrgitm_lv
|
||||
FROM med_medication_definition mmd
|
||||
WHERE 1 = 0 -- 仍然确保不返回任何行,但使用真实表确保类型正确
|
||||
</if>
|
||||
) AS abi
|
||||
${ew.customSqlSegment}
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
T10.reception_time,
|
||||
T10.practitioner_user_id,
|
||||
T10.jz_practitioner_user_id,
|
||||
T10.bus_no
|
||||
T10.bus_no,
|
||||
T10.identifier_no
|
||||
from
|
||||
(
|
||||
SELECT T1.tenant_id AS tenant_id,
|
||||
@@ -48,7 +49,8 @@
|
||||
T1.create_time AS register_time,
|
||||
T1.reception_time AS reception_time,
|
||||
T1.organization_id AS org_id,
|
||||
T8.bus_no AS bus_no
|
||||
T8.bus_no AS bus_no,
|
||||
T9.identifier_no AS identifier_no
|
||||
FROM adm_encounter AS T1
|
||||
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'
|
||||
@@ -67,6 +69,20 @@
|
||||
LEFT JOIN adm_account AS T6 ON T1.ID = T6.encounter_id AND T6.delete_flag = '0' and T6.encounter_flag = '1'
|
||||
LEFT JOIN fin_contract AS T7 ON T6.contract_no = T7.bus_no AND T7.delete_flag = '0'
|
||||
LEFT JOIN adm_patient AS T8 ON T1.patient_id = T8.ID AND T8.delete_flag = '0'
|
||||
LEFT JOIN (
|
||||
SELECT patient_id,
|
||||
identifier_no
|
||||
FROM (
|
||||
SELECT patient_id,
|
||||
identifier_no,
|
||||
ROW_NUMBER() OVER (PARTITION BY patient_id ORDER BY create_time ASC) AS rn
|
||||
FROM adm_patient_identifier
|
||||
WHERE delete_flag = '0'
|
||||
AND identifier_no IS NOT NULL
|
||||
AND identifier_no != ''
|
||||
) t
|
||||
WHERE rn = 1
|
||||
) AS T9 ON T8.id = T9.patient_id
|
||||
WHERE
|
||||
T1.delete_flag = '0'
|
||||
<!-- 当前登录账号ID 和 当前登录账号所属的科室ID 用于控制数据权限 -->
|
||||
|
||||
@@ -95,5 +95,60 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询门诊记录 -->
|
||||
<select id="getOutpatientRecord" resultType="com.openhis.web.patientmanage.dto.OutpatientRecordDto">
|
||||
SELECT
|
||||
enc.id as encounterId,
|
||||
pt.name,
|
||||
pt.id_card,
|
||||
pt.bus_no as patientBusNo,
|
||||
enc.bus_no as encounterBusNo,
|
||||
pt.gender_enum,
|
||||
pt.phone,
|
||||
enc.create_time as encounterTime,
|
||||
enc.status_enum as subjectStatusEnum,
|
||||
org.name as organizationName,
|
||||
prac.name as doctorName
|
||||
FROM adm_encounter AS enc
|
||||
LEFT JOIN adm_organization AS org ON enc.organization_id = org.ID AND org.delete_flag = '0'
|
||||
LEFT JOIN adm_encounter_participant AS ep
|
||||
ON enc.ID = ep.encounter_id AND ep.type_code = #{participantType} AND ep.delete_flag = '0'
|
||||
LEFT JOIN adm_practitioner AS prac ON ep.practitioner_id = prac.ID AND prac.delete_flag = '0'
|
||||
LEFT JOIN adm_patient AS pt ON enc.patient_id = pt.ID AND pt.delete_flag = '0'
|
||||
<where>
|
||||
enc.delete_flag = '0'
|
||||
<if test="ew.sqlSegment != null and ew.sqlSegment != ''">
|
||||
AND ${ew.sqlSegment}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY enc.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
<!-- 获取医生名字列表 -->
|
||||
<select id="getDoctorNames" resultType="java.lang.String">
|
||||
SELECT DISTINCT prac.name
|
||||
FROM adm_practitioner AS prac
|
||||
WHERE prac.delete_flag = '0'
|
||||
ORDER BY prac.name
|
||||
</select>
|
||||
|
||||
<!-- 根据医生ID和参与者类型获取相关的患者ID列表 -->
|
||||
<select id="getPatientIdsByPractitionerId" resultType="java.lang.Long">
|
||||
SELECT DISTINCT enc.patient_id
|
||||
FROM adm_encounter_participant AS ep
|
||||
LEFT JOIN adm_encounter AS enc ON ep.encounter_id = enc.ID AND enc.delete_flag = '0'
|
||||
INNER JOIN adm_patient AS pt ON enc.patient_id = pt.id AND pt.delete_flag = '0'
|
||||
WHERE ep.delete_flag = '0'
|
||||
AND ep.practitioner_id = #{practitionerId}
|
||||
AND ep.tenant_id = 1
|
||||
AND enc.tenant_id = 1
|
||||
AND pt.tenant_id = 1
|
||||
<if test="typeCodes != null and !typeCodes.isEmpty()">
|
||||
AND ep.type_code IN
|
||||
<foreach collection="typeCodes" item="typeCode" open="(" separator="," close=")">
|
||||
#{typeCode}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { font-family: 'Microsoft YaHei', sans-serif; width: 350px; margin: 0 auto; padding: 20px; border: 1px solid #ccc; background: #fff; }
|
||||
.header { text-align: center; }
|
||||
.hospital-name { font-size: 20px; font-weight: bold; margin-bottom: 5px; }
|
||||
.title { font-size: 16px; margin-bottom: 10px; }
|
||||
.time { font-size: 12px; color: #666; margin-bottom: 15px; }
|
||||
.section { border-top: 1px solid #000; padding-top: 10px; margin-top: 10px; }
|
||||
.section-title { font-weight: bold; text-decoration: underline; margin-bottom: 10px; font-size: 14px; }
|
||||
.item { display: flex; font-size: 13px; margin-bottom: 5px; }
|
||||
.label { width: 90px; color: #333; }
|
||||
.value { flex: 1; font-weight: 500; }
|
||||
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
|
||||
th { text-align: left; border-bottom: 1px dashed #ccc; padding-bottom: 5px; color: #666; }
|
||||
td { padding: 5px 0; }
|
||||
.total { text-align: right; font-weight: bold; border-top: 1px solid #000; padding-top: 10px; margin-top: 10px; font-size: 15px; }
|
||||
.footer { margin-top: 20px; font-size: 11px; color: #666; line-height: 1.5; }
|
||||
.qr-code { text-align: center; margin-top: 15px; }
|
||||
.serial-no { text-align: left; margin-top: 10px; font-size: 12px; font-weight: bold; border-top: 1px dashed #ccc; padding-top: 10px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='header'>
|
||||
<div class='hospital-name'>$hospitalName</div>
|
||||
<div class='title'>门诊预约挂号凭条</div>
|
||||
<div class='time'>打印时间:$printTime</div>
|
||||
</div>
|
||||
<div class='section'>
|
||||
<div class='section-title'>患者基本信息</div>
|
||||
<div class='item'><div class='label'>患者姓名:</div><div class='value'>$patientName</div></div>
|
||||
<div class='item'><div class='label'>门诊号:</div><div class='value'>$outpatientNo</div></div>
|
||||
<div class='item'><div class='label'>身份证号:</div><div class='value'>#if($idCard)$idCard#else-#end</div></div>
|
||||
<div class='item'><div class='label'>联系电话:</div><div class='value'>#if($tel)$tel#else-#end</div></div>
|
||||
</div>
|
||||
<div class='section'>
|
||||
<div class='section-title'>预约详情</div>
|
||||
<div class='item'><div class='label'>就诊科室:</div><div class='value'>#if($deptName)$deptName#else-#end</div></div>
|
||||
<div class='item'><div class='label'>医生姓名:</div><div class='value'>$doctorName</div></div>
|
||||
<div class='item'><div class='label'>预约时间:</div><div class='value'>#if($appointmentTime)$appointmentTime#else-#end</div></div>
|
||||
<div class='item'><div class='label'>就诊地点:</div><div class='value'>门诊大楼内</div></div>
|
||||
<div class='item'><div class='label'>预约状态:</div><div class='value'><span style='color:green;'>☑ 已 预</span></div></div>
|
||||
</div>
|
||||
<div class='section'>
|
||||
<div class='section-title'>费用信息</div>
|
||||
<table>
|
||||
<tr><th>项目</th><th>数量</th><th>单价</th><th>金额</th></tr>
|
||||
#foreach($item in $items)
|
||||
<tr>
|
||||
<td>$item.chargeItemName</td>
|
||||
<td>$item.quantityValue</td>
|
||||
<td>¥$item.totalPrice</td>
|
||||
<td>¥$item.totalPrice</td>
|
||||
</tr>
|
||||
#end
|
||||
</table>
|
||||
<div class='total'>合计:¥$totalAmt</div>
|
||||
<div class='item' style='margin-top:10px;'><div class='label'>支付方式:</div><div class='value'>线上支付 (已支付)</div></div>
|
||||
</div>
|
||||
<div class='footer'>
|
||||
温馨提示:请至少提前30分钟到达取号,过时自动取消。服务时间:8:00-17:00
|
||||
</div>
|
||||
<div class='qr-code'>
|
||||
<img src='https://api.qrserver.com/v1/create-qr-code/?size=100x100&data=$busNo' width='100' height='100' />
|
||||
</div>
|
||||
<div class='serial-no'>流水号:$busNo</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -176,7 +176,7 @@ public class OperLogAspect {
|
||||
* 插入操作日志到数据库
|
||||
*/
|
||||
private void insertOperLog(SysOperLog operLog) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
String username = SecurityUtils.getUsernameSafe(); // 使用安全获取用户名的方法
|
||||
String sql = "INSERT INTO sys_oper_log "
|
||||
+ "(title,oper_time,method,request_method,oper_name,oper_url,oper_param,json_result,error_msg,cost_time) "
|
||||
+ "VALUES (?, ?, ?,?, ?, ?, ?, ?,?, ?)";
|
||||
|
||||
@@ -70,6 +70,10 @@ public enum AssignSeqEnum {
|
||||
* 位置业务编码
|
||||
*/
|
||||
LOCATION_BUS_NO("15", "科室业务编码", "LOC"),
|
||||
/**
|
||||
* 手术室业务编码
|
||||
*/
|
||||
OPERATING_ROOM_BUS_NO("16", "手术室业务编码", "OR"),
|
||||
/**
|
||||
* 厂商/产地单据号
|
||||
*/
|
||||
@@ -297,7 +301,12 @@ public enum AssignSeqEnum {
|
||||
/**
|
||||
* 自动备份单据号
|
||||
*/
|
||||
AUTO_BACKUP_NO("70", "自动备份单据号", "ABU");
|
||||
AUTO_BACKUP_NO("70", "自动备份单据号", "ABU"),
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
ORDER_NUM("71", "订单编号", "ORD");
|
||||
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
@@ -81,21 +81,29 @@ public class HisQueryUtils {
|
||||
if (entity == null) {
|
||||
return queryWrapper;
|
||||
}
|
||||
// 反射获取实体类的字段
|
||||
Field[] fields = entity.getClass().getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
try {
|
||||
Object value = field.get(entity);
|
||||
if (value != null && !value.toString().equals("")) {
|
||||
// 将驼峰命名的字段名转换为下划线命名的数据库字段名
|
||||
String fieldName = camelToUnderline(field.getName());
|
||||
// 处理等于条件
|
||||
queryWrapper.eq(fieldName, value);
|
||||
// 反射获取实体类的所有字段(包括父类)
|
||||
Class<?> currentClass = entity.getClass();
|
||||
while (currentClass != null && currentClass != Object.class) {
|
||||
Field[] fields = currentClass.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
// 跳过静态字段,如 serialVersionUID
|
||||
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
||||
continue;
|
||||
}
|
||||
field.setAccessible(true);
|
||||
try {
|
||||
Object value = field.get(entity);
|
||||
if (value != null && !value.toString().equals("")) {
|
||||
// 将驼峰命名的字段名转换为下划线命名的数据库字段名
|
||||
String fieldName = camelToUnderline(field.getName());
|
||||
// 处理等于条件
|
||||
queryWrapper.eq(fieldName, value);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
currentClass = currentClass.getSuperclass();
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
@@ -22,4 +22,31 @@ public class RedisKeys {
|
||||
public static String getProductsKey(String itemId){
|
||||
return "products_change_price:item_" + itemId + "_key";
|
||||
}
|
||||
|
||||
/**
|
||||
* 手术信息缓存
|
||||
* @param surgeryId 手术ID
|
||||
* @return
|
||||
*/
|
||||
public static String getSurgeryKey(Long surgeryId){
|
||||
return "surgery:info:" + surgeryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 手术列表缓存(按患者ID)
|
||||
* @param patientId 患者ID
|
||||
* @return
|
||||
*/
|
||||
public static String getSurgeryListByPatientKey(Long patientId){
|
||||
return "surgery:patient:" + patientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 手术列表缓存(按就诊ID)
|
||||
* @param encounterId 就诊ID
|
||||
* @return
|
||||
*/
|
||||
public static String getSurgeryListByEncounterKey(Long encounterId){
|
||||
return "surgery:encounter:" + encounterId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.openhis.administration.domain;
|
||||
|
||||
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;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import com.openhis.common.enums.LocationStatus;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 手术室管理Entity实体
|
||||
*
|
||||
* @author system
|
||||
* @date 2026-01-04
|
||||
*/
|
||||
@Data
|
||||
@TableName("adm_operating_room")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class OperatingRoom extends HisBaseEntity {
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/** 编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 手术室名称 */
|
||||
private String name;
|
||||
|
||||
/** 手术室类型 */
|
||||
private Integer roomTypeEnum;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String roomTypeEnum_dictText;
|
||||
|
||||
/** 所属机构ID */
|
||||
private Long organizationId;
|
||||
|
||||
/** 所属机构名称 */
|
||||
@TableField(exist = false)
|
||||
private String organizationName;
|
||||
|
||||
/** 位置描述 */
|
||||
private String locationDescription;
|
||||
|
||||
/** 设备配置 */
|
||||
private String equipmentConfig;
|
||||
|
||||
/** 容纳人数 */
|
||||
private Integer capacity;
|
||||
|
||||
/** 状态编码(1-启用,0-停用) */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer displayOrder;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔码 */
|
||||
private String wbStr;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
public OperatingRoom() {
|
||||
this.statusEnum = LocationStatus.ACTIVE.getValue();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user