Compare commits
103 Commits
b5ce854eb6
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| a3dce8de60 | |||
| f81dd54f0c | |||
| 803e4d0bb5 | |||
| deebcde41f | |||
| 095c43bbf3 | |||
| aa3beb848b | |||
|
|
ae96bbd0bb | ||
|
|
1a2c444269 | ||
|
|
9cba8fea12 | ||
| 9e4a010a8d | |||
| 7e76083c37 | |||
| de105adbdc | |||
| f3eeee7405 | |||
| 97f04d0b15 | |||
| 5667e04d12 | |||
| 59157fda56 | |||
| 2fe6d45ad4 | |||
| 982ee316f7 | |||
| 64c7db68e8 | |||
| cb6b6ced67 | |||
|
|
8fcfb481c9 | ||
|
|
be0514bc08 | ||
|
|
2b3add4808 | ||
| b33cb6f9a1 | |||
| 072e71b025 | |||
| 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 | |||
| 61f4020487 | |||
| aeb6b95970 | |||
| cf5dbc6133 | |||
| 5f6fa50000 | |||
| 08b2e76d47 | |||
| 5ffeab8999 |
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;
|
||||
|
||||
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. 性能优化:
|
||||
- 表格数据分页加载
|
||||
- 模态框使用懒加载
|
||||
387
md/需求/95-门诊医生站开立会诊申请单界面PRD_2026-01-15.md
Normal file
387
md/需求/95-门诊医生站开立会诊申请单界面PRD_2026-01-15.md
Normal file
@@ -0,0 +1,387 @@
|
||||
## 门诊医生站开立会诊申请单界面PRD文档
|
||||
|
||||
### 一、页面概述
|
||||
|
||||
**页面名称**:门诊医生站开立会诊申请单界面**页面目标**:帮助门诊医生完成会诊申请单的创建、编辑、提交和作废操作,实现多科室会诊流程的电子化管理**适用场景**:
|
||||
|
||||
1. 门诊医生需要邀请其他科室专家进行会诊时
|
||||
2. 会诊申请单需要修改或补充信息时
|
||||
3. 会诊流程需要跟踪管理时
|
||||
**页面类型**:表单页+列表页复合型界面
|
||||
|
||||
**核心功能**:
|
||||
|
||||
1. 会诊申请单的新增、保存、提交、作废功能
|
||||
2. 会诊科室/专家可视化选择
|
||||
3. 申请单数据表格展示与交互
|
||||
4. 表单数据自动填充与校验
|
||||
5. 申请单打印输出
|
||||
|
||||
**用户价值**:
|
||||
|
||||
- 规范会诊申请流程,减少纸质单据使用
|
||||
- 通过智能填充减少医生重复录入
|
||||
- 实时查看会诊申请状态(新开/已提交/已确认/已签名/已完成/已取消)
|
||||
|
||||
原型图地址:https://static.pm-ai.cn/prototype/20260115/4eb1bd5367f9d5610b32c0ecc6c793f5/index.html
|
||||
|
||||
流程图:
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
%% ---------- 开始 ----------
|
||||
START(["开始"]) --> A["医生进入会诊申请单界面"]
|
||||
|
||||
%% ---------- 操作选择 ----------
|
||||
A --> B{"操作选择"}
|
||||
B -->|"打印"| C["选择已有申请单"]
|
||||
B -->|"提交/取消提交"| D{"校验状态为“已提交”?"}
|
||||
B -->|"删除"| E["弹出确认对话框"]
|
||||
B -->|"结束"| F{"校验状态为“已提交”?"}
|
||||
B -->|"编辑"| G["修改表单内容"]
|
||||
B -->|"新增"| H["清空表单(保留患者信息)"]
|
||||
|
||||
%% ---------- 打印分支 ----------
|
||||
C --> I["高亮选中行"]
|
||||
I --> J["生成打印视图"]
|
||||
J --> K["输出打印样式"]
|
||||
K --> L(["取消"])
|
||||
|
||||
%% ---------- 提交/取消提交分支 ----------
|
||||
D -->|"不通过"| M["提示“请完善必填信息”"]
|
||||
D -->|"通过"| N["更新状态为“已提交/新开”"]
|
||||
|
||||
%% ---------- 删除分支 ----------
|
||||
E --> O{"确认?"}
|
||||
O -->|"是"| P["标记状态为“已取消”"]
|
||||
O -->|"否"| L
|
||||
|
||||
%% ---------- 结束分支 ----------
|
||||
F -->|"不通过"| Q["提示“请先提交申请”"]
|
||||
F -->|"通过"| R["标记状态为“已完成”"]
|
||||
|
||||
%% ---------- 编辑分支 ----------
|
||||
G --> S{"校验必填字段"}
|
||||
S -->|"不通过"| M
|
||||
S -->|"通过"| T["保存到表格"]
|
||||
|
||||
%% ---------- 新增/保存通用路径 ----------
|
||||
H --> U["填写表单"]
|
||||
U --> V["选择会诊科室/专家"]
|
||||
V --> W["自动填充邀请对象"]
|
||||
W --> X["填写病史及目的"]
|
||||
X --> Y["点击保存"]
|
||||
Y --> Z{"校验必填字段"}
|
||||
Z -->|"不通过"| M
|
||||
Z -->|"通过"| AA["生成会诊申请记录"]
|
||||
AA --> AB["保存到表格"]
|
||||
AB --> AC["新增/更新记录"]
|
||||
|
||||
%% ---------- 循环 ----------
|
||||
AC --> A
|
||||
N --> A
|
||||
P --> A
|
||||
R --> A
|
||||
T --> A
|
||||
M --> A
|
||||
Q --> A
|
||||
L --> A
|
||||
```
|
||||
|
||||
### 二、整体布局分析
|
||||
|
||||
**页面宽度**:自适应宽度(主内容区采用7:3比例分割)
|
||||
**主要区域划分**:
|
||||
|
||||
1. 顶部操作栏(48px固定高度)
|
||||
2. 会诊申请单列表区(高度自适应)
|
||||
3. 主内容区(分左右结构,7:3比例)
|
||||
|
||||
- 左侧:会诊申请单表单区
|
||||
- 右侧:会诊科室/专家选择区
|
||||
**布局特点**:响应式上下+左右混合布局,主要对齐方式为左对齐
|
||||
|
||||
### 三、页面区域详细描述
|
||||
|
||||
#### 1. 顶部操作栏区域
|
||||
|
||||
**区域位置**:页面顶部固定位置**区域尺寸**:高度48px,宽度100%**区域功能**:提供全局操作功能入口**包含元素**:
|
||||
|
||||
- **打印按钮**
|
||||
- 元素类型:操作按钮
|
||||
- 显示内容:“打印”
|
||||
- 交互行为:点击后生成A4打印视图,自动适配医院抬头格式
|
||||
- 样式特征:绿色背景(\#13C2C2),圆角4px,32px高度
|
||||
- **新增按钮**
|
||||
- 元素类型:操作按钮
|
||||
- 显示内容:“新增”
|
||||
- 交互行为:点击清空表单(保留当前患者基本信息)
|
||||
- 样式特征:蓝色背景(\#1890FF)
|
||||
- **结束按钮**
|
||||
- 元素类型:危险操作按钮
|
||||
- 显示内容:“结束”
|
||||
- 交互行为:点击结束已提交的会诊流程,标记申请单状态为"已结束",禁用后续操作
|
||||
- 样式特征:红色背景(\#FF4D4F)
|
||||
- 限制条件:需先选中已提交的会诊单
|
||||
- **保存按钮**
|
||||
- 元素类型:主要操作按钮
|
||||
- 显示内容:“保存”
|
||||
- 交互行为:点击保存当前表单数据,校验必填字段后保存至表格,自动生成时间戳
|
||||
- 样式特征:绿色背景(\#52C41A)
|
||||
|
||||
#### 2. 会诊申请单列表区
|
||||
|
||||
**区域位置**:顶部操作栏下方**区域尺寸**:高度自适应,宽度100%**区域功能**:展示当前医生的会诊申请记录**包含元素**:
|
||||
|
||||
- **申请单表格**
|
||||
- 展示方式:带边框表格
|
||||
- 数据字段:
|
||||
|
||||
- 序号:文本 - 自增序号 - 不可操作
|
||||
- 急:布尔 - ✓表示紧急 - 不可操作
|
||||
- 申请单号:文本 - CS20260105001 - 不可操作
|
||||
- 会诊时间:日期 - 2026-01-05 15:08 - 不可操作
|
||||
- 邀请对象:文本 - 吴院长 - 不可操作
|
||||
- 申请科室:文本 - 内科 - 不可操作
|
||||
- 申请医师:文本 - 张医生 - 不可操作
|
||||
- 申请时间:日期 - 2026-01-05 15:08 - 不可操作
|
||||
- 提交状态:布尔 - 复选框 - 仅查看
|
||||
- 结束状态:布尔 - 复选框 - 仅查看
|
||||
- 操作功能:
|
||||
|
||||
- - o 提交/取消提交按钮
|
||||
|
||||
```
|
||||
样式要求:蓝色小按钮,禁用状态显示灰色
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
交互行为:切换提交状态,需二次确认
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
o 删除图标
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
样式要求:红色垃圾桶图标,hover时放大10%
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
交互行为:弹出确认对话框后作废该记录
|
||||
```
|
||||
|
||||
|
||||
[删除]**将状态改为“已取消”****
|
||||
|
||||
UPDATE ConsultationRequest
|
||||
SET ConsultationStatus = 50,cancelnatureDate = <作废会诊时间>
|
||||
WHERE ConsultationID = <会诊申请单ID> and ConsultationStatus <> 40 ;
|
||||
|
||||
- 交互特性:
|
||||
- 行点击选中效果(蓝色高亮+左侧边框)
|
||||
- 行hover浅灰色背景
|
||||
- 提交按钮状态联动(切换提交状态,需二次确认)
|
||||
|
||||
#### 3. 会诊申请单表单区
|
||||
|
||||
**区域位置**:主内容区左侧**区域尺寸**:占主内容区70%宽度**区域功能**:会诊申请单的详细表单填写**包含元素**:
|
||||
|
||||
- **基础信息区**
|
||||
- 申请单号:只读文本,【保存】时自动生成规则CS+年月日时分秒+4位随机数
|
||||
- 申请时间:只读文本,自动获取系统当前时间
|
||||
- 病人信息:病人姓名/性别/年龄/就诊卡号/申请医师/申请科室(不可编辑),自动获取当前患者档案信息。
|
||||
- **会诊信息区**
|
||||
- 会诊时间:时间控件可编辑
|
||||
- 紧急标识:复选框控件
|
||||
- 申请医师:默认当前登录医生
|
||||
- 申请科室:默认当前医生登录的开单科室
|
||||
- 门诊诊断:自动获取医生开立的门诊诊断(主诊断)
|
||||
- **病史及目的**
|
||||
- 多行文本域,最小高度100px
|
||||
- **会诊邀请**
|
||||
- 会诊邀请对象:支持多选(逗号分隔)-》(可从右侧会诊邀请对象选择)
|
||||
- **会诊记录区**
|
||||
- 会诊意见:只读文本域
|
||||
- 会诊确认参加医师:只读字段
|
||||
- 所属医生、代表科室、签名医生、签名时间:只读字段
|
||||
|
||||
#### 4. 会诊邀请对象选择区(侧边栏)
|
||||
|
||||
**区域位置**:主内容区右侧**区域尺寸**:占主内容区30%宽度**区域功能**:快速选择会诊科室和专家**包含元素**:
|
||||
|
||||
- **会诊科室列表**
|
||||
- 展示方式:带边框可滚动列表
|
||||
- 交互行为:选择科室后动态加载对应专家
|
||||
- **会诊专家列表**
|
||||
- 展示方式:带边框可滚动列表
|
||||
- 交互行为:点击专家自动填入会诊邀请对象字段(防重复:已选专家提示"请勿重复选择")
|
||||
- 特殊逻辑:支持多选(自动用逗号分隔)
|
||||
|
||||
### 四、交互功能详细说明
|
||||
|
||||
#### 1. 会诊申请单提交流程
|
||||
|
||||
**功能描述**:完成会诊申请单的提交操作**触发条件**:点击表格行的"提交"按钮**操作流程**:
|
||||
|
||||
1. 医生点击行内"提交"按钮
|
||||
2. 系统校验必填字段(会诊时间、邀请对象)
|
||||
3. 提交状态复选框变为已勾选
|
||||
4. 按钮文字变为"取消提交"
|
||||
5. 禁用该行编辑功能
|
||||
|
||||
【提交】**将状态从“新开”改为“已提交”**
|
||||
|
||||
UPDATE ConsultationRequest
|
||||
SET ConsultationStatus = 10,ConfirmingPhysician = <提交会诊医生姓名> ,ConfirmingPhysicianID = <提交会诊医生ID> ,ConfirmingDate = <提交会诊时间>
|
||||
WHERE ConsultationID = <会诊申请单ID> and ConsultationStatus = 0 ;
|
||||
|
||||
【取消提交】**将状态从“已提交”改为“新开”**
|
||||
|
||||
UPDATE ConsultationRequest
|
||||
SET ConsultationStatus = 0,ConfirmingPhysician = '',ConfirmingPhysicianID = '',ConfirmingDate = ''
|
||||
WHERE ConsultationID = <会诊申请单ID> and ConsultationStatus = 10 ;
|
||||
|
||||
**异常处理**:
|
||||
|
||||
- 必填字段缺失:弹出"请完善会诊时间和邀请对象信息"
|
||||
- 重复提交:提示"该申请已提交,请勿重复操作"
|
||||
|
||||
#### 2. 会诊流程结束功能
|
||||
|
||||
**功能描述**:标记会诊流程已结束**触发条件**:选中已提交的申请单后点击顶部"结束"按钮**操作流程**:
|
||||
|
||||
1. 医生选中已提交的申请单(行高亮)
|
||||
2. 点击顶部"结束"按钮
|
||||
3. 系统校验提交状态为已提交
|
||||
4. 结束状态复选框变为已勾选
|
||||
5. 禁用该行的取消提交功能
|
||||
|
||||
【结束】**将状态从“已签名”改为“已完成”**
|
||||
|
||||
UPDATE ConsultationRequest
|
||||
SET ConsultationStatus = 40,Signature = <结束会诊医生姓名> ,SignatureDate=<结束会诊时间>
|
||||
WHERE ConsultationID = <会诊申请单ID> and ConsultationStatus = 30 ;
|
||||
|
||||
**异常处理**:
|
||||
|
||||
- 未选中记录:提示"请先选择要结束的会诊申请"
|
||||
- 未提交记录:提示"请先提交该会诊申请"
|
||||
|
||||
#### 3. 申请单保存功能
|
||||
|
||||
**功能描述**:保存会诊申请单数据**触发条件**:点击顶部"保存"按钮**操作流程**:
|
||||
|
||||
1. 系统自动生成申请单号(如为空)
|
||||
2. 保存当前表单所有字段值
|
||||
3. 新增记录插入表格末尾
|
||||
4. 已有记录更新对应行数据
|
||||
|
||||
【保存】
|
||||
|
||||
①、写入门诊医嘱表(医嘱状态为新开,医嘱名称为"门诊会诊")
|
||||
|
||||
②、写入门诊会诊申请单表(ConsultationRequest)
|
||||
|
||||
**数据校验**:
|
||||
|
||||
- 必填字段:病人姓名、会诊时间、申请科室、会诊时间、会诊邀请对象、简要病史及会诊目的
|
||||
- 未选会诊对象:提示"请至少选择1位会诊专家"
|
||||
- 过期时间:提示"会诊时间不能早于当前时间"
|
||||
|
||||
#### 4. 会诊邀请对象选择联动
|
||||
|
||||
**触发方式**:点击科室列表项
|
||||
**数据联动**:
|
||||
|
||||
1. 根据选中会诊科室过滤会诊专家列表
|
||||
2. 记忆已选专家(跨科室切换时不丢失)
|
||||
|
||||
**技术要点**:
|
||||
|
||||
- 使用对象存储会诊科室-会诊专家映射关系
|
||||
- 采用事件委托处理动态生成的列表项
|
||||
|
||||
### 五、数据结构说明
|
||||
|
||||
门诊会诊申请单表(ConsultationRequest)
|
||||
|
||||
|
||||
| **字段名称** | **数据类型** | **长度** | **描述** | **取值范围** |
|
||||
|-----------------------------| ------------ | -------- |----------------| --------------------------------------------------------- |
|
||||
| **PatientID** | Text | 20 | 患者唯一标识 | 患者就诊卡号 (取值患者档案) |
|
||||
| **ConsultationID** | Text | 20 | 会诊申请单唯一标识 | 系统自动生成的唯一编号,生成规则CS+年月日时分秒+4位随机数 |
|
||||
| **VisitID** | BIGINT | 20 | 门诊就诊流水号(逻辑外键) | 取值于本次门诊就诊记录表的主键 |
|
||||
| **OrderID** | BIGINT | 20 | 门诊医嘱表主键(一对一外键) | 门诊医嘱表 |
|
||||
| **PatientName** | Text | 50 | 患者姓名 | 患者的姓名 (取值患者档案) |
|
||||
| **Gender** | Text | 10 | 患者性别 | 男/女/其他 (取值患者档案) |
|
||||
| **Age** | Integer | - | 患者年龄 | 取值患者档案 |
|
||||
| **Department** | Text | 50 | 申请会诊的科室 | 当前科室名称 |
|
||||
| **RequestingPhysician** | Text | 50 | 申请会诊的医生 | 当前医生姓名 |
|
||||
| **ConsultationrequestDate** | DateTime | - | 会诊申请时间 | YYYY-MM-DD HH:MM:SS
|
||||
| **ConsultationPurpose** | Text | 255 | 简要病史及会诊目的 | 文本描述,自定义编辑 |
|
||||
| **ProvisionalDiagnosis** | Text | 255 | 门诊诊断 | 文本描述,自动获取医生开立的门诊诊断(主诊断) |
|
||||
| **ConsultationDate** | DateTime | - | 会诊时间 | YYYY-MM-DD HH:MM:SS |
|
||||
| **ConsultationStatus** | Text | 20 | 会诊状态 | 新开/已提交/已确认/已签名/已完成/已取消 |
|
||||
| **ConsultationUrgency** | Text | 20 | 是否紧急 | 勾选框:一般/紧急 |
|
||||
| **ConsultationOpinion** | Text | 255 | 会诊意见 | 文本描述 |
|
||||
| **ConfirmingPhysician** | Text | 50 | 提交会诊的医生 | 医生姓名 |
|
||||
| **ConfirmingPhysicianID** | Text | 20 | 提交会诊的医生ID | 医生唯一标识 |
|
||||
| **ConfirmingDate** | DateTime | - | 提交会诊日期 | YYYY-MM-DD HH:MM:SS |
|
||||
| **Signature** | Text | 50 | 结束会诊医生 | 医生姓名 |
|
||||
| **SignatureDate** | DateTime | - | 结束会诊日期 | YYYY-MM-DD HH:MM:SS |
|
||||
| **cancelnatureDate** | DateTime | - | 作废会诊日期 | YYYY-MM-DD HH:MM:SS |
|
||||
| InvitedObject | Text | 50 | 会诊邀请对象 | |
|
||||
|
||||
**诊状态用于记录会诊申请在不同阶段的状态,以下是常见的会诊状态及其说明:**
|
||||
|
||||
|
||||
| **状态名称** | **状态值** | **描述** |
|
||||
| ------------ | ---------- | ---------------------------------------------------------------------- |
|
||||
| **新开** | 0 | 会诊申请单已保存 |
|
||||
| **已提交** | 10 | 会诊申请已提交,但尚未被会诊医生确认。 |
|
||||
| **已确认** | 20 | 会诊医生已确认会诊申请,并准备进行会诊。 |
|
||||
| **已签名** | 30 | 会诊完成后进行签名 |
|
||||
| **已完成** | 40 | 会诊已经完成,会诊意见已记录。 |
|
||||
| **已取消** | 50 | 会诊申请被取消,可能由于患者情况变化或其他原因,申请医生进行作废操作。 |
|
||||
|
||||
**门诊医嘱表在相关会诊操作步骤的相关事务**
|
||||
|
||||
把“门诊会诊申请”当成**一种特殊医嘱**(OrderType = 'Consult')由系统**在同一事务内**自动插入 门诊医嘱表,再挂到 `ConsultationRequest` **注意:按照现有系统的门诊医嘱表进行设置相关字段的值**
|
||||
|
||||
|
||||
| **节点** | **是否自动** | **说明** |
|
||||
| --------------------- | ------------ | --------------------------------------------------------------------------------------------------- |
|
||||
| 医生点击【保存】 | ✅ | 后台事务:先插门诊医嘱表(医嘱状态为“新开”),再插`ConsultationRequest`.Status=0 |
|
||||
| 医生点击【提交】 | ✅ | 仅更新两表状态 → 门诊医嘱表的医嘱状态和`ConsultationRequest.Status=10` (已提交),不重复生成医嘱 |
|
||||
| 医生点击【作废/删除】 | ✅ | 自动将门诊医嘱表的医嘱状态字段置为“作废”,级联`ConsultationRequest.Status=50` |
|
||||
| 医生点击【结束】 | ✅ | 将 门诊医嘱表的医嘱状态字段置为“已完成”,同时写`ConsultationRequest.Status=40` |
|
||||
|
||||
### 六、开发实现要点
|
||||
|
||||
**样式规范**:
|
||||
|
||||
- **主色调**:\#1890FF(操作按钮)
|
||||
- **辅助色**:\#13C2C2(打印)、\#52C41A(保存)、\#FF4D4F(结束)
|
||||
- **字体规范**:14px/1.5,中文字体优先使用"PingFang SC"
|
||||
- **间距系统**:16px基准,表单行间距12px
|
||||
- **组件样式**:
|
||||
- 按钮:4px圆角,32px高度
|
||||
- 输入框:4px圆角,1px \#D9D9D9边框
|
||||
- 表格行:选中状态\#E6F7FF背景+左侧3px蓝色边框
|
||||
|
||||
**技术要求**:
|
||||
|
||||
- **浏览器兼容**:支持Chrome/Firefox/Edge最新版
|
||||
- **性能要求**:表单提交响应时间\<1秒
|
||||
|
||||
**注意事项**:
|
||||
|
||||
1. 时间字段需统一处理为YYYY-MM-DD HH:mm:ss格式
|
||||
2. 申请单号生成需加锁防止重复
|
||||
3. 移动端需优化表格横向滚动体验
|
||||
4. 打印功能需特殊样式处理(隐藏操作按钮)
|
||||
310
md/需求/96-门诊医生站会诊申请确认界面_2026-01-15.md
Normal file
310
md/需求/96-门诊医生站会诊申请确认界面_2026-01-15.md
Normal file
@@ -0,0 +1,310 @@
|
||||
## 门诊医生站会诊申请确认界面PRD文档
|
||||
|
||||
### 一、页面概述
|
||||
|
||||
**页面名称**:门诊医生站会诊申请确认界面
|
||||
**页面目标**:帮助医生完成会诊申请的确认、签名和打印操作,展示会诊申请详细信息
|
||||
**适用场景**:医生在收到会诊申请后,查看申请信息并给出会诊意见
|
||||
**页面类型**:表单页+列表页复合型页面
|
||||
|
||||
**核心功能**:
|
||||
|
||||
1. 会诊申请单列表展示与选择
|
||||
2. 会诊确认与取消确认功能
|
||||
3. 签名功能
|
||||
4. 会诊记录单打印
|
||||
5. 会诊意见编辑与保存
|
||||
|
||||
**用户价值**:
|
||||
|
||||
- 规范会诊申请流程
|
||||
- 电子化确认和签名提高效率
|
||||
- 完整记录会诊意见便于后续诊疗
|
||||
- 打印功能满足纸质存档需求
|
||||
**原型图地址:**https://static.pm-ai.cn/prototype/20260115/7c45e175239257e0f04c9081bf2ca204/index.html
|
||||
**流程图:**
|
||||
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
Start(["医生进入会诊申请确认界面"]) --> LoadList["加载会诊申请列表"]
|
||||
LoadList --> HasUntreated{"是否有未处理申请?"}
|
||||
|
||||
HasUntreated -- "否" --> ShowNoTip["显示无申请提示"]
|
||||
HasUntreated -- "是" --> SelectApp["医生选择会诊申请"]
|
||||
|
||||
SelectApp --> ShowDetail["显示会诊申请详情"]
|
||||
ShowDetail --> EditOpinion["医生编辑会诊意见"]
|
||||
|
||||
EditOpinion --> ConfirmClick{"点击确认按钮?"}
|
||||
ConfirmClick -- "否" --> SignClick{"点击签名按钮?"}
|
||||
ConfirmClick -- "是" --> ValidateConfirm{"校验必填字段"}
|
||||
|
||||
ValidateConfirm -- "不通过" --> TipFill["提示\n请先填写会诊意见"]
|
||||
ValidateConfirm -- "通过" --> CheckConfirmed{"是否已确认?"}
|
||||
|
||||
CheckConfirmed -- "是" --> UpdateConfirmed["更新状态为\n已确认"]
|
||||
UpdateConfirmed --> AutoFill["自动填充医生科室信息"]
|
||||
AutoFill --> DisableCancel["禁用取消确认功能"]
|
||||
|
||||
CheckConfirmed -- "否" --> KeepState["保持当前状态"]
|
||||
|
||||
SignClick -- "否" --> PrintClick{"点击打印按钮?"}
|
||||
SignClick -- "是" --> ValidateSign{"校验通过?"}
|
||||
|
||||
ValidateSign -- "不通过" --> TipConfirmFirst["提示\n请先确认会诊申请"]
|
||||
ValidateSign -- "通过" --> UpdateSigned["更新状态为\n已签名"]
|
||||
UpdateSigned --> RecordSign["记录签名医生和时间"]
|
||||
|
||||
PrintClick -- "否" --> RefreshClick{"点击刷新按钮?"}
|
||||
PrintClick -- "是" --> GenPrintView["生成打印优化视图"]
|
||||
GenPrintView --> BrowserPrint["调用浏览器打印功能"]
|
||||
|
||||
RefreshClick -- "是" --> LoadList
|
||||
RefreshClick -- "否" --> KeepState
|
||||
|
||||
TipFill --> EditOpinion
|
||||
TipConfirmFirst --> EditOpinion
|
||||
KeepState --> End(["结束"])
|
||||
BrowserPrint --> End
|
||||
DisableCancel --> End
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
### 二、整体布局分析
|
||||
|
||||
**页面宽度**:自适应布局
|
||||
**主要区域划分**:
|
||||
|
||||
1. 顶部标签导航(高度48px)
|
||||
2. 操作按钮区(高度36px+间距)
|
||||
3. 会诊申请列表区(高度自适应)
|
||||
4. 会诊记录单表单区(高度自适应)
|
||||
**布局特点**:上下布局,采用网格系统对齐,左侧对齐为主
|
||||
|
||||
### 三、页面区域详细描述
|
||||
|
||||
#### 1. 顶部标签导航区域
|
||||
|
||||
**区域位置**:页面顶部
|
||||
**区域尺寸**:高度48px,宽度100%
|
||||
**区域功能**:页面导航标识
|
||||
**包含元素**:
|
||||
|
||||
- **会诊确认标签**
|
||||
- 元素类型:文本标签
|
||||
- 显示内容:“会诊确认”
|
||||
- 交互行为:无点击交互(当前页面)
|
||||
- 样式特征:蓝色下划线,16px字体,700字重
|
||||
|
||||
#### 2. 操作按钮区域
|
||||
|
||||
**区域位置**:标签导航下方
|
||||
**区域尺寸**:高度36px,宽度100%
|
||||
**区域功能**:提供页面主要操作入口
|
||||
**包含元素**:
|
||||
|
||||
- **打印按钮**
|
||||
- 元素类型:操作按钮
|
||||
- 显示内容:“打印”
|
||||
- 交互行为:点击触发打印会诊记录单
|
||||
- 样式特征:绿色背景,白色文字,圆角6px
|
||||
- **刷新按钮**
|
||||
- 元素类型:操作按钮
|
||||
- 显示内容:“刷新”
|
||||
- 交互行为:点击重新加载页面数据
|
||||
- 样式特征:白色背景,灰色边框,黑色文字
|
||||
- **确认按钮**
|
||||
- 元素类型:状态切换按钮
|
||||
- 显示内容:“确认”/“取消确认”
|
||||
- 交互行为:
|
||||
- 点击后变为"取消确认"状态(红色样式)
|
||||
- 已签名时禁用取消操作
|
||||
- 样式特征:蓝色背景,白色文字
|
||||
- 限制条件:需选中表格行才可操作
|
||||
- **签名按钮**
|
||||
- 元素类型:操作按钮
|
||||
- 显示内容:“签名”
|
||||
- 交互行为:
|
||||
- 需先确认才能签名
|
||||
- 签名后自动记录签名时间和签名医生
|
||||
- 样式特征:蓝色背景,白色文字
|
||||
- 限制条件:需先完成确认操作
|
||||
|
||||
#### 3. 会诊申请列表区域
|
||||
|
||||
**区域位置**:按钮区域下方
|
||||
**区域尺寸**:高度自适应,宽度100%
|
||||
**区域功能**:展示待处理的会诊申请列表
|
||||
**包含元素**:
|
||||
|
||||
- **申请列表表格** (取值于门诊会诊申请单表(ConsultationRequest))
|
||||
- 检索要求:医生登录门诊医生站打开会诊申请确认界面时只能检索出当前登录医生姓名包含在会诊邀请对象内(只能查看自己受会诊邀请对象)
|
||||
- 展示方式:带斑马纹表格
|
||||
- 表头字段:
|
||||
- 序号 \| 紧急 \| 申请单号 \| 病人姓名 \| 会诊时间 \| 邀请对象 \| 申请科室 \| 申请医师 \| 申请时间 \| 确认 \| 签名
|
||||
- 数据字段:
|
||||
- 序号:文本 - 自动编号 - “1” - 不可操作
|
||||
- 紧急:复选框 - 布尔值 - 未勾选 - 可操作
|
||||
- 申请单号:文本 - 字符串 - “CS20250812001” - 不可操作
|
||||
- 病人姓名:文本 - 字符串 - “陈明” - 不可操作
|
||||
- 会诊时间:日期 - 日期时间 - “2025-08-12 17:48” - 不可操作
|
||||
- 邀请对象:文本 - 字符串 - “演示测试” - 不可操作
|
||||
- 申请科室:文本 - 字符串 - “内科” - 不可操作
|
||||
- 申请医师:文本 - 字符串 - “徐斌” - 不可操作
|
||||
- 申请时间:日期 - 日期时间 - “2025-08-12 17:48” - 不可操作
|
||||
- 确认:复选框 - 布尔值 - 勾选框 – 不可操作
|
||||
- 签名:复选框 - 布尔值 - 勾选框 – 不可操作
|
||||
- 操作功能:点击行选中查看会诊申请详情
|
||||
- 样式特征:斑马纹交替背景,悬停高亮
|
||||
|
||||
#### 4. 会诊记录单表单区域
|
||||
|
||||
**区域位置**:列表区域下方
|
||||
**区域尺寸**:高度自适应,宽度100%
|
||||
**区域功能**:展示和编辑会诊详细信息
|
||||
**包含元素**:
|
||||
|
||||
- **基础信息区**
|
||||
- 布局方式:8列网格
|
||||
- 包含字段:
|
||||
- 病人姓名/性别/年龄/就诊卡号
|
||||
- 申请单号/申请科室
|
||||
- 会诊时间/紧急标志
|
||||
- 会诊邀请对象
|
||||
- 提交医生/提交时间
|
||||
- **病史及目的区**
|
||||
- 元素类型:文本区域
|
||||
- 显示内容:患者主诉和会诊目的
|
||||
- 交互行为:只读展示
|
||||
- **会诊确认参加医师**
|
||||
- **会诊意见区**
|
||||
- 元素类型:可编辑文本域
|
||||
- 显示内容:会诊意见文本
|
||||
- 交互行为:支持多行编辑
|
||||
- 样式特征:浅灰色背景,120px最小高度
|
||||
- **确认/签名信息区**
|
||||
- 包含字段:
|
||||
- 所属医生/代表科室(确认后自动填充当前医生和科室)
|
||||
- 签名医生/签名时间(自动填充签名医生和签名时间(系统当前时间))
|
||||
|
||||
### 四、交互功能详细说明
|
||||
|
||||
#### 1. 会诊申请选择功能
|
||||
|
||||
**触发方式**:点击表格行
|
||||
**执行流程**:
|
||||
|
||||
1. 高亮选中行(浅蓝色背景)
|
||||
2. 同步该行数据到下方表单
|
||||
3. 根据确认状态更新按钮文字
|
||||
4. 加载存储的会诊意见到文本域
|
||||
|
||||
**异常处理**:
|
||||
|
||||
- 无选中行时禁用确认/签名按钮
|
||||
- 已签名行禁止取消确认
|
||||
|
||||
#### 2. 会诊确认功能
|
||||
|
||||
**触发方式**:点击确认按钮
|
||||
|
||||
**执行流程**:
|
||||
|
||||
1. 校验必填字段(会诊意见、会诊确认参加医师)
|
||||
2. 保存会诊意见等相关内容到行数据(写入门诊会诊申请确认表(ConsultationConfirmation))
|
||||
3. 勾选确认复选框
|
||||
4. 更新按钮为"取消确认"状态
|
||||
5. 所属医生和代表科室(自动填充当前医生和科室)
|
||||
|
||||
**异常处理**:
|
||||
|
||||
- 未填写会诊意见时提示"请先填写会诊意见"
|
||||
- 保存失败时保持原状态并提示错误
|
||||
|
||||
#### 2. 电子签名功能
|
||||
|
||||
**功能描述**:医生对确认的会诊进行电子签名
|
||||
**触发条件**:已确认的会诊申请点击"签名"按钮
|
||||
**操作流程**:
|
||||
|
||||
1. 医生确认会诊申请
|
||||
2. 点击"签名"按钮
|
||||
3. 校验确认状态
|
||||
4. 表格中"签名"列复选框被勾选
|
||||
5. 自动记录签名医生(当前用户)
|
||||
6. 自动填充签名时间为系统时间
|
||||
7. 禁用取消确认功能
|
||||
**成功反馈**:表单区显示签名信息
|
||||
**失败处理**:提示"请先确认会诊申请"
|
||||
|
||||
#### 3. 打印会诊记录单
|
||||
|
||||
**功能描述**:打印格式化的会诊记录
|
||||
**触发条件**:点击"打印"按钮
|
||||
**操作流程**:
|
||||
|
||||
1. 点击"打印"按钮
|
||||
2. 系统生成打印优化视图
|
||||
3. 调用浏览器打印功能
|
||||
**特殊处理**:隐藏交互元素,优化打印布局
|
||||
|
||||
### 五、数据结构说明
|
||||
|
||||
**门诊会诊申请确认表(**ConsultationConfirmation**)**
|
||||
|
||||
| **字段名称** | **数据类型** | **长度** | **描述** | **约束/说明** |
|
||||
|-----------------------------|--------------|----------|--------------------|------------------------------------------------------------------------------------|
|
||||
| **ConsultationID** | INTEGER | 20 | 会诊申请单唯一标识 | FOREIGN KEY REFERENCES ConsultationRequest(ConsultationID) |
|
||||
| **ConfirmingPhysicianID** | TEXT | -20 | 确认会诊的医生ID | 操作【确认】按钮的当前医生ID |
|
||||
| **ConfirmingPhysicianName** | TEXT | -20 | 确认会诊的医生姓名 | 操作【确认】按钮的当前医生姓名 |
|
||||
| **ConfirmingDeptName** | TEXT | 20 | 代表科室 | 操作【确认】按钮的当前开单科室 |
|
||||
| **ConfirmingDate** | DateTime | - | 确认会诊的日期 | 操作【确认】按钮当前系统时间 |
|
||||
| **ConsultationStatus** | TEXT | 20 | 会诊状态 | CHECK (ConsultationStatus IN ('已确认', '取消确认', '已签名', '已完成')), NOT NULL |
|
||||
| **ConsultationOpinion** | TEXT | 500 | 会诊意见 | |
|
||||
| **ConfirmingPhysician** | TEXT | 100 | 会诊确认参加医师 | |
|
||||
| **Signature** | TEXT | 20 | 签名医生 | |
|
||||
| **SignatureDate** | DateTime | - | 签名时间 | - |
|
||||
|
||||
ConsultationConfirmation.ConsultationStatu会诊状态
|
||||
|
||||
| **状态值** | **状态名** | **描述** |
|
||||
|------------|------------|-----------------------------------|
|
||||
| **0** | 取消确认 | 作废 |
|
||||
| **20** | 已确认 | 会诊医生已查看/同意,可写初步意见 |
|
||||
| **30** | 已签名 | 已电子签名,意见最终生效 |
|
||||
| **40** | 已完成 | 会诊报告已回写,流程关闭 |
|
||||
|
||||
**按钮涉及的事务**
|
||||
|
||||
| **按钮** | **涉及表** | **执行事务** | **锁/并发** | **成功状态** | **失败处理** |
|
||||
|--------------|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|------------------|--------------------------|
|
||||
| **确认** | 1、ConsultationRequest<br>2、门诊医嘱<br>3、ConsultationConfirmation | 1、ConsultationRequest.ConsultationStatus =20<br>2、医嘱 状态='已执行'<br>3、写入ConsultationConfirmation表相关的数据 | SELECT ... FOR UPDATE | 已提交 → 已确认 | 任何异常 → 整体 ROLLBACK |
|
||||
| **取消确认** | 1、ConsultationRequest<br>2、门诊医嘱<br>3、ConsultationConfirmation | 1、ConsultationRequest.ConsultationStatus =10<br>2、医嘱 状态='已提交'<br>3、ConsultationConfirmation. ConsultationStatus = 0 | 同上 | 已确认→ 取消确认 | 同上回滚 |
|
||||
| **签名** | 1、ConsultationRequest<br>2、门诊医嘱<br>3、ConsultationConfirmation | 1、ConsultationRequest.ConsultationStatus =30<br>2、医嘱 Status='已完成'<br>3、写入ConsultationConfirmation. Signature, SignatureDate,ConsultationStatus =30 | 同上 | 已确认 → 已签名 | 同上回滚 |
|
||||
|
||||
### 六、开发实现要点
|
||||
|
||||
**样式规范**:
|
||||
|
||||
- **主色调**:\#4A89DC(按钮蓝色)
|
||||
- **辅助色**:\#4CAF50(成功绿色)
|
||||
- **字体规范**:14px/1.5 常规,16px 标题
|
||||
- **间距系统**:8px基础间距,24px区块间距
|
||||
- **组件样式**:
|
||||
- 按钮:6px圆角,1px边框
|
||||
- 输入框:4px圆角,1px \#E0E0E0边框
|
||||
|
||||
**技术要求**:
|
||||
|
||||
- **浏览器兼容**:Chrome/Firefox/Edge最新版
|
||||
- **性能要求**:列表加载时间\<1s
|
||||
|
||||
**注意事项**:
|
||||
|
||||
1. 确认和签名状态需要联动控制
|
||||
2. 打印功能需要特殊样式处理
|
||||
3. 时间字段需统一使用YYYY-MM-DD HH:mm:ss格式
|
||||
4. 移动端需优化表单布局
|
||||
267
md/需求/97-门诊会诊申请管理界面_2026-1-19.md
Normal file
267
md/需求/97-门诊会诊申请管理界面_2026-1-19.md
Normal file
@@ -0,0 +1,267 @@
|
||||
## 门诊会诊申请管理界面PRD文档
|
||||
|
||||
### 一、页面概述
|
||||
|
||||
**页面名称**:门诊会诊申请管理界面
|
||||
**页面目标**:提供会诊申请的全流程管理功能,包括申请记录查询、编辑申请、查看详情、状态变更等核心操作
|
||||
**适用场景**:门诊医生需要查看会诊申请或管理已有申请记录时使用
|
||||
**页面类型**:列表页+表单弹窗复合型页面
|
||||
|
||||
**核心功能**:
|
||||
|
||||
1. 多条件组合筛选会诊申请记录
|
||||
2. 会诊申请表格展示与操作(编辑/查看/删除)
|
||||
3. 会诊申请单的填写与提交
|
||||
4. 会诊状态标记(提交/结束)
|
||||
**用户价值**:规范会诊申请流程,减少纸质单据流转,提高多科室协作效率
|
||||
原型图地址:https://static.pm-ai.cn/prototype/20260116/aed1f102d614677f100c0d1fe3104999/index.html
|
||||
**流程图:**
|
||||
```mermaid
|
||||
flowchart TD
|
||||
Start([Start]) --> A[进入门诊会诊申请管理界面]
|
||||
A --> B{用户操作类型}
|
||||
B -->|筛选查询| C[设置筛选条件]
|
||||
B -->|编辑申请| D[点击编辑按钮]
|
||||
B -->|查看详情| E[点击查看按钮]
|
||||
B -->|删除申请| G[点击删除按钮]
|
||||
|
||||
C --> H{验证筛选条件}
|
||||
H -->|有效| I[展示筛选结果]
|
||||
H -->|无效| J[显示错误提示]
|
||||
J --> C
|
||||
|
||||
I --> K[用户浏览列表]
|
||||
|
||||
D --> L{检查会诊状态}
|
||||
L -->|未结束| M[打开编辑弹窗]
|
||||
L -->|已结束| N[提示不可编辑]
|
||||
N --> O[关闭弹窗]
|
||||
|
||||
M --> P[修改表单内容]
|
||||
P --> Q{表单验证}
|
||||
Q -->|通过| R[保存修改]
|
||||
Q -->|不通过| S[标红错误字段]
|
||||
S --> P
|
||||
|
||||
E --> T{检查会诊状态}
|
||||
T -->|未结束| U[打开只读弹窗]
|
||||
T -->|已结束| U
|
||||
|
||||
G --> Z{删除验证}
|
||||
Z -->|可删除| AA[确认删除]
|
||||
Z -->|不可删除| AB[提示删除失败]
|
||||
AB --> K
|
||||
|
||||
AA --> AC[更新状态为已取消]
|
||||
AC --> AD[更新列表显示]
|
||||
|
||||
R --> AD
|
||||
AD --> K
|
||||
K --> AE([End])
|
||||
```
|
||||
|
||||
### 二、整体布局分析
|
||||
|
||||
**页面宽度**:自适应布局
|
||||
**主要区域划分**:
|
||||
|
||||
1. 顶部筛选区(高度自适应,约80px)
|
||||
2. 表格展示区(高度自适应,占主要空间)
|
||||
3. 底部页码区(固定高度56px)
|
||||
**布局特点**:上下布局+弹性布局,采用左右对齐方式
|
||||
|
||||
### 三、页面区域详细描述
|
||||
|
||||
#### 1. 顶部筛选区
|
||||
|
||||
**区域位置**:页面顶部
|
||||
**区域尺寸**:100%宽度,高度自适应
|
||||
**区域功能**:提供多维度筛选和快速搜索功能
|
||||
**包含元素**:
|
||||
|
||||
- **时间类型选择器**
|
||||
- 元素类型:下拉选择框
|
||||
- 显示内容:默认"会诊时间",可选"申请时间"
|
||||
- 交互行为:点击展开下拉选项
|
||||
- 样式特征:宽度120px,高度32px,圆角4px
|
||||
- **时间范围选择器**(开始/结束时间)
|
||||
- 元素类型:日期时间输入框
|
||||
- 显示内容:placeholder提示"开始时间"/“结束时间”
|
||||
- 交互行为:点击弹出日期选择面板
|
||||
- 样式特征:宽度180px,高度32px
|
||||
- **申请科室/申请医生选择器**
|
||||
- 元素类型:带datalist的输入框
|
||||
- 显示内容:placeholder提示"选择或输入科室/医生"
|
||||
- 交互行为:输入时显示匹配选项
|
||||
- 数据来源:动态生成申请科室/医生候选列表,取值于门诊会诊申请单表(ConsultationRequest.Department/ RequestingPhysician)
|
||||
- **会诊状态筛选器**
|
||||
- 元素类型:下拉选择框
|
||||
- 可选值:全部/未提交/提交/结束
|
||||
- 默认值:全部
|
||||
- **病人姓名搜索框**
|
||||
- 元素类型:文本输入框
|
||||
- 显示内容:placeholder提示"病人姓名"
|
||||
- 交互行为:支持模糊搜索
|
||||
- **操作按钮组**
|
||||
- 查询按钮
|
||||
- 样式:蓝色背景,带搜索图标
|
||||
- 交互:触发筛选条件应用
|
||||
- 重置按钮
|
||||
- 样式:灰色背景,带刷新图标
|
||||
- 交互:清空所有筛选条件
|
||||
- 打印按钮
|
||||
- 样式:深灰色背景,带打印图标
|
||||
- 交互:调起浏览器打印功能
|
||||
|
||||
#### 2. 表格展示区
|
||||
|
||||
**区域位置**:页面中部
|
||||
**区域尺寸**:100%宽度,高度自适应
|
||||
**区域功能**:展示会诊申请列表数据,支持行内操作
|
||||
**包含元素**:
|
||||
|
||||
取值于门诊会诊申请单表(ConsultationRequest)和门诊会诊申请单表(ConsultationRequest)
|
||||
|
||||
- **数据表格**
|
||||
- 展示方式:11列固定表头表格
|
||||
- 数据字段:
|
||||
- ID:文本 - 15 -申请单号
|
||||
- 急:复选框 - 布尔值 - 示例false – 不可编辑
|
||||
- 病人姓名:文本 - 朱某某 - 红色高亮
|
||||
- 会诊时间:日期 - 2026-01-05 15:08
|
||||
- 申请科室:文本 - 内科
|
||||
- 邀请对象:文本 - 吴院长
|
||||
- 申请时间:日期 - 2026-01-05 15:08
|
||||
- 申请医师:文本 - 演示测试
|
||||
- 提交:复选框 - 布尔值 - 示例false
|
||||
- 结束:复选框 - 布尔值 - 示例false
|
||||
- 操作功能:
|
||||
- 编辑按钮(✏️):点击打开编辑弹窗
|
||||
- 查看按钮(👁️):点击打开只读弹窗
|
||||
- 删除按钮(🗑️):点击确认删除
|
||||
- 【删除】将状态改为“已取消”
|
||||
- UPDATE ConsultationRequest
|
||||
- SET ConsultationStatus = 50,cancelnatureDate = \<作废会诊时间\>
|
||||
- WHERE ConsultationID = \<会诊申请单ID\> and ConsultationStatus \<\> 40 ;
|
||||
- 交互行为:
|
||||
- 行悬停效果:浅蓝色背景
|
||||
- 复选框点击:即时更新状态(需防抖处理)
|
||||
|
||||
#### 3. 底部页码区
|
||||
|
||||
**区域位置**:页面底部
|
||||
**区域尺寸**:100%宽度,固定高度56px
|
||||
**区域功能**:分页控制和数据统计
|
||||
**包含元素**:
|
||||
|
||||
- **总数统计**:总数统计文本(如:“总数:15”)
|
||||
- **分页控制器**:
|
||||
- 上一页按钮(\<)
|
||||
- 当前页按钮(1)active状态
|
||||
- 下一页按钮(\>)
|
||||
- 交互反馈:hover时边框变蓝
|
||||
|
||||
#### 4. 会诊申请弹窗(模态框)
|
||||
|
||||
**触发方式**:点击表格行操作列的编辑/查看按钮
|
||||
**区域功能**:展示/编辑会诊申请详细信息
|
||||
**包含元素**:
|
||||
|
||||
- 头部区域
|
||||
- 标题:“会诊申请单”
|
||||
- 关闭按钮(×图标)
|
||||
- 表单区域(分两栏布局)
|
||||
- 基础信息区:
|
||||
- 申请单号(只读)
|
||||
- 申请时间(不可编辑)
|
||||
- 病人姓名(不可编辑)
|
||||
- 性别/年龄(不可编辑)
|
||||
- 就诊卡号(不可编辑)
|
||||
- 会诊信息区:
|
||||
- 会诊时间(日期时间选择器)
|
||||
- 申请医师(不可编辑)
|
||||
- 紧急程度(复选框)
|
||||
- 申请科室(不可编辑)
|
||||
- 门诊诊断(不可编辑)
|
||||
- 会诊邀请对象
|
||||
- 会诊确认参加医师
|
||||
- 所属医生
|
||||
- 代表科室
|
||||
- 签名医生
|
||||
- 签名时间
|
||||
- 文本域:
|
||||
- 病史及会诊目的(多行文本)
|
||||
- 会诊意见(多行文本)
|
||||
- 底部按钮区:
|
||||
- 取消按钮(左对齐)
|
||||
- 保存按钮(右对齐,蓝色)
|
||||
|
||||
### 四、交互功能详细说明
|
||||
|
||||
#### 1. 会诊申请编辑功能
|
||||
|
||||
**功能描述**:修改已有会诊申请信息
|
||||
**触发条件**:点击表格行中的"✏️"按钮
|
||||
**操作流程**:
|
||||
|
||||
1. 检查会诊状态是否为"结束",若已结束则提示不可编辑
|
||||
2. 弹出会诊申请编辑弹窗,填充当前行数据的会诊申请和确认相关的数据
|
||||
3. 用户修改表单内容(必填字段校验)
|
||||
4. 点击"保存"按钮提交修改
|
||||
**异常处理**:
|
||||
- 必填字段为空时,标红提示
|
||||
- 保存失败时显示toast提示"保存失败,请重试"
|
||||
|
||||
#### 2. 会诊申请查看功能
|
||||
|
||||
**功能描述**:查看会诊申请详细信息
|
||||
**触发条件**:点击表格行中的"👁️"按钮
|
||||
**操作流程**:
|
||||
|
||||
1. 弹出只读弹窗,显示完整申请信息
|
||||
2. 所有字段禁用编辑
|
||||
3. 仅显示"取消"按钮用于关闭弹窗
|
||||
|
||||
#### 3. 数据筛选功能
|
||||
|
||||
**功能描述**:多条件组合查询会诊记录
|
||||
**触发条件**:点击"查询"按钮
|
||||
**数据过滤逻辑**:
|
||||
|
||||
- 时间范围:根据选择的时间类型(会诊/申请)进行筛选
|
||||
- 申请科室/申请医生:支持模糊匹配
|
||||
- 会诊状态筛选:支持多选逻辑(未提交/提交/结束)
|
||||
1. 收集所有筛选条件值
|
||||
2. 发起异步请求(示例中为前端过滤)
|
||||
3. 更新表格数据展示
|
||||
**异常处理**:
|
||||
- 时间范围不合法:提示"结束时间不能早于开始时间"
|
||||
- 无查询结果:显示空白表格+提示文字
|
||||
**性能优化**:前端本地缓存数据,减少服务器请求
|
||||
|
||||
### 五、数据结构说明
|
||||
|
||||
门诊会诊申请单表(ConsultationRequest)和门诊会诊申请单表(ConsultationRequest)
|
||||
|
||||
### 六、开发实现要点
|
||||
|
||||
**样式规范**:
|
||||
|
||||
- **主色调**:\#5D9CEC(按钮/交互元素)
|
||||
- **辅助色**:\#8E8E8E(次要按钮)
|
||||
- **字体规范**:14px/1.5(主要内容),16px/1.5(标题)
|
||||
- **间距系统**:16px(元素间距),24px(区块间距)
|
||||
- **组件样式**:
|
||||
- 按钮:圆角6px,内边距0 16px
|
||||
- 输入框:1px实线边框\#D9D9D9,圆角4px
|
||||
|
||||
**技术要求**:
|
||||
|
||||
- **浏览器兼容**:支持Chrome/Firefox/Edge最新版
|
||||
- **性能要求**:列表数据筛选响应时间\<200ms
|
||||
|
||||
**注意事项**:
|
||||
|
||||
1. 状态变更逻辑:已结束的记录不可编辑
|
||||
2. 时间字段需要做时区转换处理
|
||||
3. 申请科室/申请医生选择器需要支持拼音首字母检索
|
||||
@@ -1,2 +0,0 @@
|
||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">OpenHis v0.0.1</h1>
|
||||
|
||||
@@ -61,7 +61,25 @@ public class SysConfigController extends BaseController {
|
||||
*/
|
||||
@GetMapping(value = "/configKey/{configKey}")
|
||||
public AjaxResult getConfigKey(@PathVariable String configKey) {
|
||||
return success(configService.selectConfigByKey(configKey));
|
||||
String configValue = configService.selectConfigByKey(configKey);
|
||||
// 确保即使返回 null 或空字符串,也明确设置 data 字段
|
||||
// 如果 configValue 是 null,转换为空字符串
|
||||
if (configValue == null) {
|
||||
configValue = "";
|
||||
}
|
||||
// 直接创建 AjaxResult 并明确设置 data 字段,确保 data 字段始终存在
|
||||
AjaxResult result = new AjaxResult();
|
||||
result.put("code", 200);
|
||||
result.put("msg", "操作成功");
|
||||
result.put("data", configValue); // 明确设置 data 字段,即使值为空字符串
|
||||
System.out.println("=== getConfigKey 调试信息 ===");
|
||||
System.out.println("configKey: " + configKey);
|
||||
System.out.println("configValue: [" + configValue + "]");
|
||||
System.out.println("result.data: " + result.get("data"));
|
||||
System.out.println("result.msg: " + result.get("msg"));
|
||||
System.out.println("result.code: " + result.get("code"));
|
||||
System.out.println("============================");
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -21,13 +21,15 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
<arg>--add-modules</arg>
|
||||
<arg>java.base</arg>
|
||||
</compilerArgs>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -54,12 +54,35 @@
|
||||
<artifactId>oshi-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- spring security 安全认证 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
<groupId>com.core</groupId>
|
||||
<artifactId>core-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.core</groupId>
|
||||
<artifactId>core-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MyBatis-Plus 支持 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</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()) {
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- MyBatis-Plus 支持 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- velocity代码生成使用模板 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
@@ -36,6 +42,24 @@
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Lombok 支持 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON工具类 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackson 注解支持 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -23,6 +23,12 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- MyBatis-Plus 支持 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.core</groupId>
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 是否存在菜单子节点
|
||||
*
|
||||
|
||||
@@ -69,8 +69,25 @@ public class SysConfigServiceImpl implements ISysConfigService {
|
||||
config.setConfigKey(configKey);
|
||||
SysConfig retConfig = configMapper.selectConfig(config);
|
||||
if (StringUtils.isNotNull(retConfig)) {
|
||||
redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
|
||||
return retConfig.getConfigValue();
|
||||
String dbValue = retConfig.getConfigValue();
|
||||
System.out.println("=== selectConfigByKey 调试信息 ===");
|
||||
System.out.println("configKey: " + configKey);
|
||||
System.out.println("retConfig: " + retConfig);
|
||||
System.out.println("configId: " + retConfig.getConfigId());
|
||||
System.out.println("configName: " + retConfig.getConfigName());
|
||||
System.out.println("configValue from DB: [" + dbValue + "]");
|
||||
System.out.println("configValue is null: " + (dbValue == null));
|
||||
System.out.println("configValue is empty: " + StringUtils.isEmpty(dbValue));
|
||||
System.out.println("================================");
|
||||
if (StringUtils.isNotEmpty(dbValue)) {
|
||||
redisCache.setCacheObject(getCacheKey(configKey), dbValue);
|
||||
return dbValue;
|
||||
} else {
|
||||
System.out.println("警告: configValue 为空,返回空字符串");
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
} else {
|
||||
System.out.println("警告: 数据库中未找到 configKey=" + configKey + " 的记录");
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.net.UnknownHostException;
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author system 1
|
||||
* @author system 1,2,3,4
|
||||
*/
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.core", "com.openhis"})
|
||||
@EnableConfigurationProperties(YbServiceConfig.class)
|
||||
|
||||
@@ -28,7 +28,10 @@ import com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam;
|
||||
import com.openhis.web.datadictionary.mapper.ActivityDefinitionManageMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -45,6 +48,8 @@ import java.util.List;
|
||||
@Service
|
||||
public class LisConfigManageAppServiceImpl implements ILisConfigManageAppService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(LisConfigManageAppServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private ActivityDefinitionManageMapper activityDefinitionManageMapper;
|
||||
@Resource
|
||||
@@ -120,31 +125,73 @@ public class LisConfigManageAppServiceImpl implements ILisConfigManageAppServic
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public R<?> saveAll(LisConfigManageDto manageDto) {
|
||||
//先全部删除项目下详情
|
||||
activityDefDeviceDefMapper.delete(new QueryWrapper<ActivityDefDeviceDef>().eq("activity_definition_id", manageDto.getId()));
|
||||
activityDefObservationDefMapper.delete(new QueryWrapper<ActivityDefObservationDef>().eq("activity_definition_id", manageDto.getId()));
|
||||
activityDefSpecimenDefMapper.delete(new QueryWrapper<ActivityDefSpecimenDef>().eq("activity_definition_id", manageDto.getId()));
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
// 根据ID查询【诊疗目录】详情
|
||||
DiagnosisTreatmentDto diseaseTreatmentOne = activityDefinitionManageMapper.getDiseaseTreatmentOne(manageDto.getId(), tenantId);
|
||||
manageDto.getActivityDefDeviceDefs().forEach(activityDefDeviceDef -> {
|
||||
activityDefDeviceDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefDeviceDef.setActivityDefinitionName(diseaseTreatmentOne.getName());
|
||||
activityDefDeviceDefMapper.insert(activityDefDeviceDef);
|
||||
});
|
||||
manageDto.getActivityDefObservationDefs().forEach(activityDefObservationDef -> {
|
||||
activityDefObservationDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefObservationDef.setActivityDefinitionName(diseaseTreatmentOne.getName());
|
||||
activityDefObservationDefMapper.insert(activityDefObservationDef);
|
||||
});
|
||||
manageDto.getActivityDefSpecimenDefs().forEach(activityDefSpecimenDef -> {
|
||||
activityDefSpecimenDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefSpecimenDef.setActivityDefinitionName(diseaseTreatmentOne.getName());
|
||||
activityDefSpecimenDefMapper.insert(activityDefSpecimenDef);
|
||||
});
|
||||
|
||||
return R.ok();
|
||||
try {
|
||||
// 先全部删除项目下详情
|
||||
activityDefDeviceDefMapper.delete(new QueryWrapper<ActivityDefDeviceDef>().eq("activity_definition_id", manageDto.getId()));
|
||||
activityDefObservationDefMapper.delete(new QueryWrapper<ActivityDefObservationDef>().eq("activity_definition_id", manageDto.getId()));
|
||||
activityDefSpecimenDefMapper.delete(new QueryWrapper<ActivityDefSpecimenDef>().eq("activity_definition_id", manageDto.getId()));
|
||||
|
||||
// 获取租户ID并验证
|
||||
Integer tenantId = null;
|
||||
try {
|
||||
tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
} catch (Exception e) {
|
||||
log.warn("获取租户ID失败,使用默认值", e);
|
||||
}
|
||||
|
||||
// 根据ID查询【诊疗目录】详情
|
||||
DiagnosisTreatmentDto diseaseTreatmentOne = activityDefinitionManageMapper.getDiseaseTreatmentOne(manageDto.getId(), tenantId);
|
||||
if (diseaseTreatmentOne == null) {
|
||||
log.warn("未找到诊疗目录:id={}, tenantId={}", manageDto.getId(), tenantId);
|
||||
// 即使未找到诊疗目录,也继续保存,使用ID作为名称
|
||||
String activityDefinitionName = String.valueOf(manageDto.getId());
|
||||
|
||||
manageDto.getActivityDefDeviceDefs().forEach(activityDefDeviceDef -> {
|
||||
activityDefDeviceDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefDeviceDef.setActivityDefinitionName(activityDefinitionName);
|
||||
activityDefDeviceDefMapper.insert(activityDefDeviceDef);
|
||||
});
|
||||
manageDto.getActivityDefObservationDefs().forEach(activityDefObservationDef -> {
|
||||
activityDefObservationDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefObservationDef.setActivityDefinitionName(activityDefinitionName);
|
||||
activityDefObservationDefMapper.insert(activityDefObservationDef);
|
||||
});
|
||||
manageDto.getActivityDefSpecimenDefs().forEach(activityDefSpecimenDef -> {
|
||||
activityDefSpecimenDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefSpecimenDef.setActivityDefinitionName(activityDefinitionName);
|
||||
activityDefSpecimenDefMapper.insert(activityDefSpecimenDef);
|
||||
});
|
||||
} else {
|
||||
// 正常保存
|
||||
manageDto.getActivityDefDeviceDefs().forEach(activityDefDeviceDef -> {
|
||||
activityDefDeviceDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefDeviceDef.setActivityDefinitionName(diseaseTreatmentOne.getName());
|
||||
activityDefDeviceDefMapper.insert(activityDefDeviceDef);
|
||||
});
|
||||
manageDto.getActivityDefObservationDefs().forEach(activityDefObservationDef -> {
|
||||
activityDefObservationDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefObservationDef.setActivityDefinitionName(diseaseTreatmentOne.getName());
|
||||
activityDefObservationDefMapper.insert(activityDefObservationDef);
|
||||
});
|
||||
manageDto.getActivityDefSpecimenDefs().forEach(activityDefSpecimenDef -> {
|
||||
activityDefSpecimenDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefSpecimenDef.setActivityDefinitionName(diseaseTreatmentOne.getName());
|
||||
activityDefSpecimenDefMapper.insert(activityDefSpecimenDef);
|
||||
});
|
||||
}
|
||||
|
||||
log.info("保存检验项目设置成功:id={}, deviceCount={}, observationCount={}, specimenCount={}",
|
||||
manageDto.getId(),
|
||||
manageDto.getActivityDefDeviceDefs().size(),
|
||||
manageDto.getActivityDefObservationDefs().size(),
|
||||
manageDto.getActivityDefSpecimenDefs().size());
|
||||
return R.ok("保存成功");
|
||||
} catch (Exception e) {
|
||||
log.error("保存检验项目设置失败:id={}, error={}", manageDto.getId(), e.getMessage(), e);
|
||||
return R.fail("保存失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,8 @@ import com.openhis.web.Inspection.dto.ObservationDefManageDto;
|
||||
import com.openhis.web.Inspection.dto.ObservationDefManageInitDto;
|
||||
import com.openhis.web.Inspection.dto.ObservationDefSelParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -42,6 +44,8 @@ import java.util.stream.Stream;
|
||||
@RequiredArgsConstructor
|
||||
public class ObservationManageAppServiceImpl implements IObservationManageAppService
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(ObservationManageAppServiceImpl.class);
|
||||
|
||||
private final ObservationDefinitionMapper observationDefinitionMapper;
|
||||
|
||||
private final IObservationDefinitionService observationDefinitionService;
|
||||
@@ -88,9 +92,23 @@ public class ObservationManageAppServiceImpl implements IObservationManageAppSer
|
||||
|
||||
@Override
|
||||
public R<?> updateOrAddObservationDef(ObservationDefinition Observation) {
|
||||
Observation.setDeleteFlag(DelFlag.NO.getCode());
|
||||
observationDefinitionService.saveOrUpdate(Observation);
|
||||
return R.ok(" 添加成功");
|
||||
try {
|
||||
Observation.setDeleteFlag(DelFlag.NO.getCode());
|
||||
boolean result = observationDefinitionService.saveOrUpdate(Observation);
|
||||
if (result) {
|
||||
log.info("保存检验项目成功:name={}, code={}, id={}",
|
||||
Observation.getName(), Observation.getCode(), Observation.getId());
|
||||
return R.ok("添加成功");
|
||||
} else {
|
||||
log.warn("保存检验项目失败:name={}, code={}",
|
||||
Observation.getName(), Observation.getCode());
|
||||
return R.fail("添加失败:保存操作未成功");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("保存检验项目异常:name={}, code={}, error={}",
|
||||
Observation.getName(), Observation.getCode(), e.getMessage(), e);
|
||||
return R.fail("添加失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public interface IOrganizationAppService {
|
||||
* @param request 请求数据
|
||||
* @return 机构树分页列表
|
||||
*/
|
||||
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, Integer classEnum,
|
||||
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, String classEnum,
|
||||
String sortField, String sortOrder, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Override
|
||||
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, Integer classEnum,
|
||||
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, String classEnum,
|
||||
String sortField, String sortOrder, HttpServletRequest request) {
|
||||
// 创建查询条件
|
||||
LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
@@ -51,8 +51,24 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
if (typeEnum != null) {
|
||||
queryWrapper.eq(Organization::getTypeEnum, typeEnum);
|
||||
}
|
||||
if (classEnum != null) {
|
||||
queryWrapper.eq(Organization::getClassEnum, classEnum);
|
||||
if (StringUtils.isNotEmpty(classEnum)) {
|
||||
// 对于多选,需要处理逗号分隔的值
|
||||
queryWrapper.and(wrapper -> {
|
||||
String[] classEnums = classEnum.split(",");
|
||||
for (String cls : classEnums) {
|
||||
String trimmedCls = cls.trim();
|
||||
// 使用OR连接多个条件来匹配逗号分隔的值
|
||||
wrapper.or().and(subWrapper -> {
|
||||
subWrapper.eq(Organization::getClassEnum, trimmedCls)
|
||||
.or()
|
||||
.likeRight(Organization::getClassEnum, trimmedCls + ",")
|
||||
.or()
|
||||
.likeLeft(Organization::getClassEnum, "," + trimmedCls)
|
||||
.or()
|
||||
.like(Organization::getClassEnum, "," + trimmedCls + ",");
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 创建Page对象
|
||||
@@ -89,7 +105,7 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
OrganizationDto node = new OrganizationDto();
|
||||
BeanUtils.copyProperties(record, node);
|
||||
node.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, node.getTypeEnum()));
|
||||
node.setClassEnum_dictText(EnumUtils.getInfoByValue(OrganizationClass.class, node.getClassEnum()));
|
||||
node.setClassEnum_dictText(formatClassEnumDictText(node.getClassEnum()));
|
||||
node.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, node.getActiveFlag()));
|
||||
// 将当前节点加入映射
|
||||
nodeMap.put(bNo, node);
|
||||
@@ -130,7 +146,7 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
OrganizationDto organizationDto = new OrganizationDto();
|
||||
BeanUtils.copyProperties(organization, organizationDto);
|
||||
organizationDto.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, organizationDto.getTypeEnum()));
|
||||
organizationDto.setClassEnum_dictText(EnumUtils.getInfoByValue(OrganizationClass.class, organizationDto.getClassEnum()));
|
||||
organizationDto.setClassEnum_dictText(formatClassEnumDictText(organizationDto.getClassEnum()));
|
||||
organizationDto.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, organizationDto.getActiveFlag()));
|
||||
|
||||
return R.ok(organizationDto, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息查询"}));
|
||||
@@ -221,6 +237,35 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"机构信息停用"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化多选的分类字典文本
|
||||
*/
|
||||
private String formatClassEnumDictText(String classEnum) {
|
||||
if (StringUtils.isEmpty(classEnum)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String[] classEnums = classEnum.split(",");
|
||||
List<String> dictTexts = new ArrayList<>();
|
||||
|
||||
for (String cls : classEnums) {
|
||||
String trimmedCls = cls.trim();
|
||||
if (StringUtils.isNotEmpty(trimmedCls)) {
|
||||
try {
|
||||
Integer enumValue = Integer.parseInt(trimmedCls);
|
||||
String dictText = EnumUtils.getInfoByValue(OrganizationClass.class, enumValue);
|
||||
if (dictText != null) {
|
||||
dictTexts.add(dictText);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果转换失败,跳过该值
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return String.join(",", dictTexts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验字段是否为指定类中的有效属性
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class OrganizationController {
|
||||
@RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize,
|
||||
@RequestParam(value = "name", required = false) String name,
|
||||
@RequestParam(value = "typeEnum", required = false) Integer typeEnum,
|
||||
@RequestParam(value = "classEnum", required = false) Integer classEnum,
|
||||
@RequestParam(value = "classEnum", required = false) String classEnum,
|
||||
@RequestParam(value = "sortField", required = false) String sortField,
|
||||
@RequestParam(value = "sortOrder", required = false) String sortOrder, HttpServletRequest request) {
|
||||
Page<OrganizationDto> organizationTree =
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
@@ -39,7 +40,8 @@ public class OrganizationDto {
|
||||
private String typeEnum_dictText;
|
||||
|
||||
/** 机构分类枚举 */
|
||||
private Integer classEnum;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private String classEnum;
|
||||
private String classEnum_dictText;
|
||||
|
||||
/** 拼音码 */
|
||||
|
||||
@@ -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());
|
||||
@@ -147,7 +157,7 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
||||
@Override
|
||||
public List<OrgMetadata> getOrgMetadata() {
|
||||
List<Organization> list =
|
||||
iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
|
||||
iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), String.valueOf(OrganizationClass.CLINIC.getValue()));
|
||||
List<OrgMetadata> orgMetadataList = new ArrayList<>();
|
||||
OrgMetadata orgMetadata;
|
||||
for (Organization organization : list) {
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 查询诊疗目录分页列表
|
||||
*
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.openhis.web.datadictionary.dto.*;
|
||||
import com.openhis.web.datadictionary.mapper.ActivityDefinitionManageMapper;
|
||||
import com.openhis.workflow.domain.ActivityDefinition;
|
||||
import com.openhis.workflow.domain.ServiceRequest;
|
||||
import com.openhis.workflow.mapper.ActivityDefinitionMapper;
|
||||
import com.openhis.workflow.service.IActivityDefinitionService;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
@@ -63,6 +64,8 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
|
||||
@Resource
|
||||
private ActivityDefinitionManageMapper activityDefinitionManageMapper;
|
||||
@Resource
|
||||
private ActivityDefinitionMapper activityDefinitionMapper;
|
||||
@Resource
|
||||
private IItemDefinitionService itemDefinitionService;
|
||||
@Resource
|
||||
private ISysDictTypeService sysDictTypeService;
|
||||
@@ -157,6 +160,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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询诊疗目录分页列表
|
||||
*
|
||||
@@ -222,7 +237,11 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
|
||||
|
||||
ActivityDefinition activityDefinition = new ActivityDefinition();
|
||||
BeanUtils.copyProperties(diagnosisTreatmentUpDto, activityDefinition);
|
||||
|
||||
|
||||
// 显式设置新增的字段
|
||||
activityDefinition.setSortOrder(diagnosisTreatmentUpDto.getSortOrder());
|
||||
activityDefinition.setServiceRange(diagnosisTreatmentUpDto.getServiceRange());
|
||||
|
||||
// 拼音码
|
||||
activityDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(activityDefinition.getName()));
|
||||
// 五笔码
|
||||
@@ -240,12 +259,31 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
|
||||
}
|
||||
}
|
||||
|
||||
// 查询现有的价格定义
|
||||
LambdaQueryWrapper<ChargeItemDefinition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ChargeItemDefinition::getInstanceId, diagnosisTreatmentUpDto.getId())
|
||||
.eq(ChargeItemDefinition::getInstanceTable, CommonConstants.TableName.WOR_ACTIVITY_DEFINITION);
|
||||
ChargeItemDefinition existingItem = chargeItemDefinitionService.getOne(queryWrapper);
|
||||
|
||||
ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition();
|
||||
chargeItemDefinition.setYbType(diagnosisTreatmentUpDto.getYbType())
|
||||
.setTypeCode(diagnosisTreatmentUpDto.getItemTypeCode())
|
||||
.setInstanceTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION)
|
||||
chargeItemDefinition.setInstanceTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION)
|
||||
.setInstanceId(diagnosisTreatmentUpDto.getId()).setPrice(diagnosisTreatmentUpDto.getRetailPrice())
|
||||
.setPriceCode(diagnosisTreatmentUpDto.getPriceCode()).setChargeName(diagnosisTreatmentUpDto.getName());
|
||||
|
||||
// 如果前端没有提交财务类别,则保留原有的值
|
||||
if (StringUtils.isEmpty(diagnosisTreatmentUpDto.getItemTypeCode()) && existingItem != null) {
|
||||
chargeItemDefinition.setTypeCode(existingItem.getTypeCode());
|
||||
} else {
|
||||
chargeItemDefinition.setTypeCode(diagnosisTreatmentUpDto.getItemTypeCode());
|
||||
}
|
||||
|
||||
// 如果前端没有提交医保类别,则保留原有的值
|
||||
if (StringUtils.isEmpty(diagnosisTreatmentUpDto.getYbType()) && existingItem != null) {
|
||||
chargeItemDefinition.setYbType(existingItem.getYbType());
|
||||
} else {
|
||||
chargeItemDefinition.setYbType(diagnosisTreatmentUpDto.getYbType());
|
||||
}
|
||||
|
||||
// 插入操作记录
|
||||
operationRecordService.addEntityOperationRecord(DbOpType.UPDATE.getCode(),
|
||||
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, activityDefinition);
|
||||
@@ -255,9 +293,12 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
|
||||
// 更新子表,修改零售价,条件:单位
|
||||
boolean upItemDetail1 = itemDefinitionService.updateItemDetail(chargeItemDefinition,
|
||||
diagnosisTreatmentUpDto.getRetailPrice(), ConditionCode.UNIT.getCode());
|
||||
// 更新子表,修改最高零售价,条件:限制
|
||||
boolean upItemDetail2 = itemDefinitionService.updateItemDetail(chargeItemDefinition,
|
||||
diagnosisTreatmentUpDto.getMaximumRetailPrice(), ConditionCode.LIMIT.getCode());
|
||||
// 更新子表,修改最高零售价,条件:限制(只有当最高零售价不为null时才更新)
|
||||
boolean upItemDetail2 = true;
|
||||
if (diagnosisTreatmentUpDto.getMaximumRetailPrice() != null) {
|
||||
upItemDetail2 = itemDefinitionService.updateItemDetail(chargeItemDefinition,
|
||||
diagnosisTreatmentUpDto.getMaximumRetailPrice(), ConditionCode.LIMIT.getCode());
|
||||
}
|
||||
|
||||
// 更新价格表
|
||||
return upItemDef && upItemDetail1 && upItemDetail2
|
||||
@@ -341,9 +382,16 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
|
||||
|
||||
ActivityDefinition activityDefinition = new ActivityDefinition();
|
||||
BeanUtils.copyProperties(diagnosisTreatmentUpDto, activityDefinition);
|
||||
// 使用10位数基础采番
|
||||
String code = assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_DEFINITION_NUM.getPrefix(), 10);
|
||||
activityDefinition.setBusNo(code);
|
||||
|
||||
// 显式设置新增的字段
|
||||
activityDefinition.setSortOrder(diagnosisTreatmentUpDto.getSortOrder());
|
||||
activityDefinition.setServiceRange(diagnosisTreatmentUpDto.getServiceRange());
|
||||
|
||||
// 如果前端没有传入编码,则使用10位数基础采番
|
||||
if (StringUtils.isEmpty(activityDefinition.getBusNo())) {
|
||||
String code = assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_DEFINITION_NUM.getPrefix(), 10);
|
||||
activityDefinition.setBusNo(code);
|
||||
}
|
||||
// 拼音码
|
||||
activityDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(activityDefinition.getName()));
|
||||
// 五笔码
|
||||
@@ -351,6 +399,16 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
|
||||
|
||||
// 新增外来诊疗目录
|
||||
activityDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
|
||||
// 检查编码是否已存在
|
||||
List<ActivityDefinition> existingDefinitions = activityDefinitionMapper.selectList(
|
||||
new LambdaQueryWrapper<ActivityDefinition>()
|
||||
.eq(ActivityDefinition::getBusNo, activityDefinition.getBusNo())
|
||||
);
|
||||
if (!existingDefinitions.isEmpty()) {
|
||||
return R.fail(null, "诊疗编码已存在:" + activityDefinition.getBusNo());
|
||||
}
|
||||
|
||||
if (activityDefinitionService.addDiagnosisTreatment(activityDefinition)) {
|
||||
// 调用医保目录对照接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询诊疗目录分页列表
|
||||
*
|
||||
|
||||
@@ -125,4 +125,9 @@ public class DiagnosisTreatmentDto {
|
||||
*/
|
||||
private String priceCode;
|
||||
|
||||
/** 序号 */
|
||||
private Integer sortOrder;
|
||||
|
||||
/** 服务范围 */
|
||||
private String serviceRange;
|
||||
}
|
||||
|
||||
@@ -112,4 +112,9 @@ public class DiagnosisTreatmentUpDto {
|
||||
*/
|
||||
private String priceCode;
|
||||
|
||||
/** 序号 */
|
||||
private Integer sortOrder;
|
||||
|
||||
/** 服务范围 */
|
||||
private String serviceRange;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DoctorPhraesAppServiceImpl implements IDoctorPhraseAppService {
|
||||
public class DoctorPhraseAppServiceImpl implements IDoctorPhraseAppService {
|
||||
|
||||
@Resource
|
||||
private IDoctorPhraseService doctorPhraseService;
|
||||
@@ -38,6 +38,7 @@ import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.workflow.service.IDeviceRequestService;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -92,6 +93,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
@Resource
|
||||
DoctorStationSendApplyUtil doctorStationSendApplyUtil;
|
||||
|
||||
|
||||
/**
|
||||
* 查询医嘱信息
|
||||
*
|
||||
@@ -111,6 +113,20 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
public IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
|
||||
List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize,
|
||||
Integer pricingFlag, List<Integer> adviceTypes, String orderPricing) {
|
||||
|
||||
// 生成缓存键,处理可能的null值
|
||||
String safeSearchKey = searchKey != null ? searchKey : "";
|
||||
String safeAdviceTypesStr = "";
|
||||
if (adviceTypes != null && !adviceTypes.isEmpty()) {
|
||||
safeAdviceTypesStr = String.join(",", adviceTypes.stream().map(String::valueOf).collect(Collectors.toList()));
|
||||
}
|
||||
String safeOrganizationId = organizationId != null ? organizationId.toString() : "";
|
||||
String safePricingFlag = pricingFlag != null ? pricingFlag.toString() : "";
|
||||
String safePageNo = pageNo != null ? pageNo.toString() : "";
|
||||
String safePageSize = pageSize != null ? pageSize.toString() : "";
|
||||
|
||||
log.info("从数据库查询医嘱基础信息");
|
||||
|
||||
// 设置默认科室 (不取前端传的了)
|
||||
organizationId = SecurityUtils.getLoginUser().getOrgId();
|
||||
|
||||
@@ -172,98 +188,190 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
.add(cfg.getLocationId());
|
||||
}
|
||||
}
|
||||
// 费用定价子表信息
|
||||
List<AdvicePriceDto> childCharge = doctorStationAdviceAppMapper
|
||||
.getChildCharge(ConditionCode.LOT_NUMBER_PRICE.getCode(), chargeItemDefinitionIdList);
|
||||
// 费用定价主表信息
|
||||
List<AdvicePriceDto> mainCharge
|
||||
= doctorStationAdviceAppMapper.getMainCharge(chargeItemDefinitionIdList, PublicationStatus.ACTIVE.getValue());
|
||||
// 费用定价子表信息 - 使用分批处理避免大量参数问题
|
||||
List<AdvicePriceDto> childCharge = new ArrayList<>();
|
||||
if (chargeItemDefinitionIdList != null && !chargeItemDefinitionIdList.isEmpty()) {
|
||||
// 分批处理,每批最多1000个ID,增加批次大小以减少查询次数
|
||||
int batchSize = 1000;
|
||||
for (int i = 0; i < chargeItemDefinitionIdList.size(); i += batchSize) {
|
||||
int endIndex = Math.min(i + batchSize, chargeItemDefinitionIdList.size());
|
||||
List<Long> batch = chargeItemDefinitionIdList.subList(i, endIndex);
|
||||
childCharge.addAll(doctorStationAdviceAppMapper
|
||||
.getChildCharge(ConditionCode.LOT_NUMBER_PRICE.getCode(), batch));
|
||||
}
|
||||
}
|
||||
|
||||
// 费用定价主表信息 - 使用分批处理避免大量参数问题
|
||||
List<AdvicePriceDto> mainCharge = new ArrayList<>();
|
||||
if (chargeItemDefinitionIdList != null && !chargeItemDefinitionIdList.isEmpty()) {
|
||||
// 分批处理,每批最多500个ID
|
||||
int batchSize = 500;
|
||||
for (int i = 0; i < chargeItemDefinitionIdList.size(); i += batchSize) {
|
||||
int endIndex = Math.min(i + batchSize, chargeItemDefinitionIdList.size());
|
||||
List<Long> batch = chargeItemDefinitionIdList.subList(i, endIndex);
|
||||
mainCharge.addAll(doctorStationAdviceAppMapper.getMainCharge(batch, PublicationStatus.ACTIVE.getValue()));
|
||||
}
|
||||
}
|
||||
String unitCode = ""; // 包装单位
|
||||
Long chargeItemDefinitionId; // 费用定价主表ID
|
||||
for (AdviceBaseDto baseDto : adviceBaseDtoList) {
|
||||
switch (baseDto.getAdviceTableName()) {
|
||||
case CommonConstants.TableName.MED_MEDICATION_DEFINITION: // 药品
|
||||
// 是否皮试
|
||||
baseDto
|
||||
.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, baseDto.getSkinTestFlag()));
|
||||
// 是否为注射药物
|
||||
baseDto.setInjectFlag_enumText(EnumUtils.getInfoByValue(Whether.class, baseDto.getInjectFlag()));
|
||||
case CommonConstants.TableName.ADM_DEVICE_DEFINITION: // 耗材
|
||||
// 每一条医嘱的库存集合信息 , 包装单位库存前端计算
|
||||
List<AdviceInventoryDto> inventoryList = adviceInventory.stream().filter(e -> baseDto
|
||||
.getAdviceDefinitionId().equals(e.getItemId())
|
||||
&& baseDto.getAdviceTableName().equals(e.getItemTable())
|
||||
&& (pharmacyMultipleChoice
|
||||
|| (baseDto.getPositionId() == null || baseDto.getPositionId().equals(e.getLocationId()))))
|
||||
.collect(Collectors.toList());
|
||||
// 库存信息
|
||||
baseDto.setInventoryList(inventoryList);
|
||||
// 设置默认产品批号
|
||||
if (!inventoryList.isEmpty()) {
|
||||
// 库存大于0
|
||||
List<AdviceInventoryDto> hasInventoryList = inventoryList.stream()
|
||||
.filter(e -> e.getQuantity().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
|
||||
if (!hasInventoryList.isEmpty()) {
|
||||
baseDto.setDefaultLotNumber(hasInventoryList.get(0).getLotNumber());
|
||||
}
|
||||
}
|
||||
if (!inventoryList.isEmpty() && !medLocationConfig.isEmpty()) {
|
||||
// 第一步:在medLocationConfig中匹配categoryCode
|
||||
AdviceInventoryDto result1 = medLocationConfig.stream()
|
||||
.filter(dto -> baseDto.getCategoryCode().equals(dto.getCategoryCode())).findFirst()
|
||||
.orElse(null);
|
||||
if (result1 != null) {
|
||||
// 第二步:在inventoryList中匹配locationId
|
||||
AdviceInventoryDto result2 = inventoryList.stream()
|
||||
.filter(dto -> result1.getLocationId().equals(dto.getLocationId())).findFirst()
|
||||
.orElse(null);
|
||||
if (result2 != null && result2.getLotNumber() != null) {
|
||||
baseDto.setDefaultLotNumber(result2.getLotNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
String tableName = baseDto.getAdviceTableName();
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(tableName)) { // 药品
|
||||
// 是否皮试
|
||||
baseDto
|
||||
.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, baseDto.getSkinTestFlag()));
|
||||
// 是否为注射药物
|
||||
baseDto.setInjectFlag_enumText(EnumUtils.getInfoByValue(Whether.class, baseDto.getInjectFlag()));
|
||||
|
||||
unitCode = baseDto.getUnitCode();
|
||||
chargeItemDefinitionId = baseDto.getChargeItemDefinitionId();
|
||||
List<AdvicePriceDto> priceDtoList = new ArrayList<>();
|
||||
// 库存信息里取 命中条件 去匹配价格
|
||||
for (AdviceInventoryDto adviceInventoryDto : inventoryList) {
|
||||
Long finalChargeItemDefinitionId = chargeItemDefinitionId;
|
||||
String finalUnitCode = unitCode;
|
||||
// 从定价子表取价格(适用于批次售卖场景)
|
||||
List<AdvicePriceDto> childPrice = childCharge.stream()
|
||||
.filter(e -> e.getDefinitionId().equals(finalChargeItemDefinitionId)
|
||||
&& e.getConditionValue().equals(adviceInventoryDto.getLotNumber()))
|
||||
.peek(e -> e.setUnitCode(finalUnitCode)) // 设置 unitCode
|
||||
.collect(Collectors.toList());
|
||||
// 从定价主表取价格(适用于统一零售价场景)
|
||||
List<AdvicePriceDto> mainPrice = mainCharge.stream()
|
||||
.filter(e -> baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId()))
|
||||
.collect(Collectors.toList());
|
||||
// 按批次售价
|
||||
if (OrderPricingSource.BATCH_SELLING_PRICE.getCode().equals(orderPricingSource)) {
|
||||
priceDtoList.addAll(childPrice);
|
||||
} else {
|
||||
priceDtoList.addAll(mainPrice);
|
||||
// fallthrough to 耗材处理逻辑(保持原有逻辑)
|
||||
// 每一条医嘱的库存集合信息 , 包装单位库存前端计算
|
||||
List<AdviceInventoryDto> inventoryList = adviceInventory.stream().filter(e ->
|
||||
baseDto.getAdviceDefinitionId() != null && e.getItemId() != null
|
||||
&& baseDto.getAdviceDefinitionId().equals(e.getItemId())
|
||||
&& baseDto.getAdviceTableName() != null && e.getItemTable() != null
|
||||
&& baseDto.getAdviceTableName().equals(e.getItemTable())
|
||||
&& (pharmacyMultipleChoice
|
||||
|| (baseDto.getPositionId() == null || (e.getLocationId() != null && baseDto.getPositionId().equals(e.getLocationId())))))
|
||||
.collect(Collectors.toList());
|
||||
// 库存信息
|
||||
baseDto.setInventoryList(inventoryList);
|
||||
// 设置默认产品批号
|
||||
if (!inventoryList.isEmpty()) {
|
||||
// 库存大于0
|
||||
List<AdviceInventoryDto> hasInventoryList = inventoryList.stream()
|
||||
.filter(e -> e.getQuantity().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
|
||||
if (!hasInventoryList.isEmpty()) {
|
||||
baseDto.setDefaultLotNumber(hasInventoryList.get(0).getLotNumber());
|
||||
}
|
||||
}
|
||||
if (!inventoryList.isEmpty() && !medLocationConfig.isEmpty()) {
|
||||
// 第一步:在medLocationConfig中匹配categoryCode
|
||||
AdviceInventoryDto result1 = medLocationConfig.stream()
|
||||
.filter(dto -> baseDto.getCategoryCode() != null && dto.getCategoryCode() != null
|
||||
&& baseDto.getCategoryCode().equals(dto.getCategoryCode())).findFirst()
|
||||
.orElse(null);
|
||||
if (result1 != null) {
|
||||
// 第二步:在inventoryList中匹配locationId
|
||||
AdviceInventoryDto result2 = inventoryList.stream()
|
||||
.filter(dto -> result1.getLocationId() != null && dto.getLocationId() != null
|
||||
&& result1.getLocationId().equals(dto.getLocationId())).findFirst()
|
||||
.orElse(null);
|
||||
if (result2 != null && result2.getLotNumber() != null) {
|
||||
baseDto.setDefaultLotNumber(result2.getLotNumber());
|
||||
}
|
||||
}
|
||||
// 价格信息
|
||||
baseDto.setPriceList(priceDtoList);
|
||||
break;
|
||||
case CommonConstants.TableName.WOR_ACTIVITY_DEFINITION: // 诊疗
|
||||
List<AdvicePriceDto> priceList
|
||||
= mainCharge.stream().filter(e -> baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId()))
|
||||
.collect(Collectors.toList());
|
||||
// 价格信息
|
||||
baseDto.setPriceList(priceList);
|
||||
// 活动类型
|
||||
baseDto.setActivityType_enumText(
|
||||
EnumUtils.getInfoByValue(ActivityType.class, baseDto.getActivityType()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
unitCode = baseDto.getUnitCode();
|
||||
chargeItemDefinitionId = baseDto.getChargeItemDefinitionId();
|
||||
List<AdvicePriceDto> priceDtoList = new ArrayList<>();
|
||||
// 库存信息里取 命中条件 去匹配价格
|
||||
for (AdviceInventoryDto adviceInventoryDto : inventoryList) {
|
||||
Long finalChargeItemDefinitionId = chargeItemDefinitionId;
|
||||
String finalUnitCode = unitCode;
|
||||
// 从定价子表取价格(适用于批次售卖场景)
|
||||
List<AdvicePriceDto> childPrice = childCharge.stream()
|
||||
.filter(e -> e.getDefinitionId() != null && finalChargeItemDefinitionId != null
|
||||
&& e.getDefinitionId().equals(finalChargeItemDefinitionId)
|
||||
&& e.getConditionValue() != null && adviceInventoryDto.getLotNumber() != null
|
||||
&& e.getConditionValue().equals(adviceInventoryDto.getLotNumber()))
|
||||
.peek(e -> e.setUnitCode(finalUnitCode)) // 设置 unitCode
|
||||
.collect(Collectors.toList());
|
||||
// 从定价主表取价格(适用于统一零售价场景)
|
||||
List<AdvicePriceDto> mainPrice = mainCharge.stream()
|
||||
.filter(e -> baseDto.getChargeItemDefinitionId() != null && e.getDefinitionId() != null
|
||||
&& baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId()))
|
||||
.collect(Collectors.toList());
|
||||
// 按批次售价
|
||||
if (OrderPricingSource.BATCH_SELLING_PRICE.getCode().equals(orderPricingSource)) {
|
||||
priceDtoList.addAll(childPrice);
|
||||
} else {
|
||||
priceDtoList.addAll(mainPrice);
|
||||
}
|
||||
}
|
||||
// 价格信息
|
||||
baseDto.setPriceList(priceDtoList);
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(tableName)) { // 耗材
|
||||
// 每一条医嘱的库存集合信息 , 包装单位库存前端计算
|
||||
List<AdviceInventoryDto> inventoryList = adviceInventory.stream().filter(e ->
|
||||
baseDto.getAdviceDefinitionId() != null && e.getItemId() != null
|
||||
&& baseDto.getAdviceDefinitionId().equals(e.getItemId())
|
||||
&& baseDto.getAdviceTableName() != null && e.getItemTable() != null
|
||||
&& baseDto.getAdviceTableName().equals(e.getItemTable())
|
||||
&& (pharmacyMultipleChoice
|
||||
|| (baseDto.getPositionId() == null || (e.getLocationId() != null && baseDto.getPositionId().equals(e.getLocationId())))))
|
||||
.collect(Collectors.toList());
|
||||
// 库存信息
|
||||
baseDto.setInventoryList(inventoryList);
|
||||
// 设置默认产品批号
|
||||
if (!inventoryList.isEmpty()) {
|
||||
// 库存大于0
|
||||
List<AdviceInventoryDto> hasInventoryList = inventoryList.stream()
|
||||
.filter(e -> e.getQuantity().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
|
||||
if (!hasInventoryList.isEmpty()) {
|
||||
baseDto.setDefaultLotNumber(hasInventoryList.get(0).getLotNumber());
|
||||
}
|
||||
}
|
||||
if (!inventoryList.isEmpty() && !medLocationConfig.isEmpty()) {
|
||||
// 第一步:在medLocationConfig中匹配categoryCode
|
||||
AdviceInventoryDto result1 = medLocationConfig.stream()
|
||||
.filter(dto -> baseDto.getCategoryCode() != null && dto.getCategoryCode() != null
|
||||
&& baseDto.getCategoryCode().equals(dto.getCategoryCode())).findFirst()
|
||||
.orElse(null);
|
||||
if (result1 != null) {
|
||||
// 第二步:在inventoryList中匹配locationId
|
||||
AdviceInventoryDto result2 = inventoryList.stream()
|
||||
.filter(dto -> result1.getLocationId() != null && dto.getLocationId() != null
|
||||
&& result1.getLocationId().equals(dto.getLocationId())).findFirst()
|
||||
.orElse(null);
|
||||
if (result2 != null && result2.getLotNumber() != null) {
|
||||
baseDto.setDefaultLotNumber(result2.getLotNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unitCode = baseDto.getUnitCode();
|
||||
chargeItemDefinitionId = baseDto.getChargeItemDefinitionId();
|
||||
List<AdvicePriceDto> priceDtoList = new ArrayList<>();
|
||||
// 库存信息里取 命中条件 去匹配价格
|
||||
for (AdviceInventoryDto adviceInventoryDto : inventoryList) {
|
||||
Long finalChargeItemDefinitionId = chargeItemDefinitionId;
|
||||
String finalUnitCode = unitCode;
|
||||
// 从定价子表取价格(适用于批次售卖场景)
|
||||
List<AdvicePriceDto> childPrice = childCharge.stream()
|
||||
.filter(e -> e.getDefinitionId() != null && finalChargeItemDefinitionId != null
|
||||
&& e.getDefinitionId().equals(finalChargeItemDefinitionId)
|
||||
&& e.getConditionValue() != null && adviceInventoryDto.getLotNumber() != null
|
||||
&& e.getConditionValue().equals(adviceInventoryDto.getLotNumber()))
|
||||
.peek(e -> e.setUnitCode(finalUnitCode)) // 设置 unitCode
|
||||
.collect(Collectors.toList());
|
||||
// 从定价主表取价格(适用于统一零售价场景)
|
||||
List<AdvicePriceDto> mainPrice = mainCharge.stream()
|
||||
.filter(e -> baseDto.getChargeItemDefinitionId() != null && e.getDefinitionId() != null
|
||||
&& baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId()))
|
||||
.collect(Collectors.toList());
|
||||
// 按批次售价
|
||||
if (OrderPricingSource.BATCH_SELLING_PRICE.getCode().equals(orderPricingSource)) {
|
||||
priceDtoList.addAll(childPrice);
|
||||
} else {
|
||||
priceDtoList.addAll(mainPrice);
|
||||
}
|
||||
}
|
||||
// 价格信息
|
||||
baseDto.setPriceList(priceDtoList);
|
||||
} else if (CommonConstants.TableName.WOR_ACTIVITY_DEFINITION.equals(tableName)) { // 诊疗
|
||||
List<AdvicePriceDto> priceList
|
||||
= mainCharge.stream().filter(e -> baseDto.getChargeItemDefinitionId() != null && e.getDefinitionId() != null
|
||||
&& baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId()))
|
||||
.collect(Collectors.toList());
|
||||
// 价格信息
|
||||
baseDto.setPriceList(priceList);
|
||||
// 活动类型
|
||||
baseDto.setActivityType_enumText(
|
||||
EnumUtils.getInfoByValue(ActivityType.class, baseDto.getActivityType()));
|
||||
}
|
||||
}
|
||||
|
||||
return adviceBaseInfo;
|
||||
}
|
||||
|
||||
@@ -288,83 +396,99 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
*/
|
||||
@Override
|
||||
public R<?> saveAdvice(AdviceSaveParam adviceSaveParam, String adviceOpType) {
|
||||
// 患者挂号对应的科室id
|
||||
Long organizationId = adviceSaveParam.getOrganizationId();
|
||||
// 医嘱分类信息
|
||||
List<AdviceSaveDto> adviceSaveList = adviceSaveParam.getAdviceSaveList();
|
||||
// 药品
|
||||
List<AdviceSaveDto> medicineList = adviceSaveList.stream()
|
||||
.filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
|
||||
// 耗材
|
||||
List<AdviceSaveDto> deviceList = adviceSaveList.stream()
|
||||
.filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
|
||||
// 诊疗活动
|
||||
List<AdviceSaveDto> activityList = adviceSaveList.stream()
|
||||
.filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
|
||||
try {
|
||||
// 患者挂号对应的科室id
|
||||
Long organizationId = adviceSaveParam.getOrganizationId();
|
||||
// 医嘱分类信息
|
||||
List<AdviceSaveDto> adviceSaveList = adviceSaveParam.getAdviceSaveList();
|
||||
// 药品
|
||||
List<AdviceSaveDto> medicineList = adviceSaveList.stream()
|
||||
.filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
|
||||
// 耗材
|
||||
List<AdviceSaveDto> deviceList = adviceSaveList.stream()
|
||||
.filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
|
||||
// 诊疗活动
|
||||
List<AdviceSaveDto> activityList = adviceSaveList.stream()
|
||||
.filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
|
||||
|
||||
/**
|
||||
* 保存时,校验库存
|
||||
*/
|
||||
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
|
||||
List<AdviceSaveDto> medUpdateList
|
||||
= medicineList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
|
||||
List<AdviceSaveDto> devUpdateList
|
||||
= deviceList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
|
||||
// 编辑时,释放本身占用的库存发放
|
||||
for (AdviceSaveDto adviceSaveDto : medUpdateList) {
|
||||
iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId());
|
||||
/**
|
||||
* 保存时,校验库存
|
||||
*/
|
||||
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
|
||||
List<AdviceSaveDto> medUpdateList
|
||||
= medicineList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
|
||||
List<AdviceSaveDto> devUpdateList
|
||||
= deviceList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
|
||||
// 编辑时,释放本身占用的库存发放
|
||||
for (AdviceSaveDto adviceSaveDto : medUpdateList) {
|
||||
iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId());
|
||||
}
|
||||
for (AdviceSaveDto adviceSaveDto : devUpdateList) {
|
||||
iDeviceDispenseService.deleteDeviceDispense(adviceSaveDto.getRequestId());
|
||||
}
|
||||
|
||||
List<AdviceSaveDto> needCheckList
|
||||
= adviceSaveList.stream().filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType())
|
||||
&& !ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
|
||||
// 校验库存
|
||||
String tipRes = adviceUtils.checkInventory(needCheckList);
|
||||
if (tipRes != null) {
|
||||
return R.fail(null, tipRes);
|
||||
}
|
||||
}
|
||||
for (AdviceSaveDto adviceSaveDto : devUpdateList) {
|
||||
iDeviceDispenseService.deleteDeviceDispense(adviceSaveDto.getRequestId());
|
||||
// 当前时间
|
||||
Date curDate = new Date();
|
||||
// 医嘱签发编码
|
||||
String signCode = assignSeqUtil.getSeq(AssignSeqEnum.ADVICE_SIGN.getPrefix(), 10);
|
||||
|
||||
/**
|
||||
* 处理药品请求
|
||||
*/
|
||||
List<String> medRequestIdList
|
||||
= this.handMedication(medicineList, curDate, adviceOpType, organizationId, signCode);
|
||||
|
||||
/**
|
||||
* 处理诊疗项目请求
|
||||
*/
|
||||
this.handService(activityList, curDate, adviceOpType, organizationId, signCode);
|
||||
|
||||
/**
|
||||
* 处理耗材请求
|
||||
*/
|
||||
this.handDevice(deviceList, curDate, adviceOpType);
|
||||
|
||||
// 签发时,把草稿状态的账单更新为待收费
|
||||
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {
|
||||
// 签发的医嘱id集合
|
||||
List<Long> requestIds = adviceSaveList.stream()
|
||||
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null)
|
||||
.collect(Collectors.toList()).stream().map(AdviceSaveDto::getRequestId).collect(Collectors.toList());
|
||||
// 就诊id
|
||||
Long encounterId = adviceSaveList.get(0).getEncounterId();
|
||||
iChargeItemService.update(new LambdaUpdateWrapper<ChargeItem>()
|
||||
.set(ChargeItem::getStatusEnum, ChargeItemStatus.PLANNED.getValue())
|
||||
.eq(ChargeItem::getEncounterId, encounterId)
|
||||
.eq(ChargeItem::getStatusEnum, ChargeItemStatus.DRAFT.getValue())
|
||||
.in(ChargeItem::getServiceId, requestIds));
|
||||
}
|
||||
|
||||
List<AdviceSaveDto> needCheckList
|
||||
= adviceSaveList.stream().filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType())
|
||||
&& !ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
|
||||
// 校验库存
|
||||
String tipRes = adviceUtils.checkInventory(needCheckList);
|
||||
if (tipRes != null) {
|
||||
return R.fail(null, tipRes);
|
||||
}
|
||||
// 数据变更后清理相关缓存
|
||||
clearRelatedCache();
|
||||
|
||||
return R.ok(medRequestIdList,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"门诊医嘱"}));
|
||||
} catch (Exception e) {
|
||||
// 异常处理
|
||||
throw e;
|
||||
}
|
||||
// 当前时间
|
||||
Date curDate = new Date();
|
||||
// 医嘱签发编码
|
||||
String signCode = assignSeqUtil.getSeq(AssignSeqEnum.ADVICE_SIGN.getPrefix(), 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理药品请求
|
||||
*/
|
||||
List<String> medRequestIdList
|
||||
= this.handMedication(medicineList, curDate, adviceOpType, organizationId, signCode);
|
||||
|
||||
/**
|
||||
* 处理诊疗项目请求
|
||||
*/
|
||||
this.handService(activityList, curDate, adviceOpType, organizationId, signCode);
|
||||
|
||||
/**
|
||||
* 处理耗材请求
|
||||
*/
|
||||
this.handDevice(deviceList, curDate, adviceOpType);
|
||||
|
||||
// 签发时,把草稿状态的账单更新为待收费
|
||||
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {
|
||||
// 签发的医嘱id集合
|
||||
List<Long> requestIds = adviceSaveList.stream()
|
||||
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null)
|
||||
.collect(Collectors.toList()).stream().map(AdviceSaveDto::getRequestId).collect(Collectors.toList());
|
||||
// 就诊id
|
||||
Long encounterId = adviceSaveList.get(0).getEncounterId();
|
||||
iChargeItemService.update(new LambdaUpdateWrapper<ChargeItem>()
|
||||
.set(ChargeItem::getStatusEnum, ChargeItemStatus.PLANNED.getValue())
|
||||
.eq(ChargeItem::getEncounterId, encounterId)
|
||||
.eq(ChargeItem::getStatusEnum, ChargeItemStatus.DRAFT.getValue())
|
||||
.in(ChargeItem::getServiceId, requestIds));
|
||||
}
|
||||
|
||||
return R.ok(medRequestIdList,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"门诊医嘱"}));
|
||||
/**
|
||||
* 清理相关缓存
|
||||
*/
|
||||
private void clearRelatedCache() {
|
||||
// 目前不使用缓存,此方法为空实现
|
||||
// 如果将来启用缓存,可以在这里实现缓存清理逻辑
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -956,15 +1080,23 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
*/
|
||||
@Override
|
||||
public R<?> getProofResult(Long encounterId) {
|
||||
// 检查参数
|
||||
if (encounterId == null) {
|
||||
log.warn("获取检验结果时就诊ID为空");
|
||||
return R.ok(new ArrayList<>());
|
||||
}
|
||||
|
||||
// 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);
|
||||
@@ -978,15 +1110,23 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
*/
|
||||
@Override
|
||||
public R<?> getTestResult(Long encounterId) {
|
||||
// 检查参数
|
||||
if (encounterId == null) {
|
||||
log.warn("获取检查结果时就诊ID为空");
|
||||
return R.ok(new ArrayList<>());
|
||||
}
|
||||
|
||||
// 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,8 +22,11 @@ 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 org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
@@ -33,6 +36,7 @@ import java.util.stream.Collectors;
|
||||
* 医生站-主页面 应用实现类
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppService {
|
||||
|
||||
@Resource
|
||||
@@ -55,6 +59,9 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
|
||||
@Resource
|
||||
IDoctorStationChineseMedicalAppService iDoctorStationChineseMedicalAppService;
|
||||
|
||||
@Resource
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
/**
|
||||
* 查询就诊患者信息
|
||||
*
|
||||
@@ -158,11 +165,51 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
*/
|
||||
@Override
|
||||
public R<?> completeEncounter(Long encounterId) {
|
||||
// 1. 检查当前患者状态是否为就诊中(20)
|
||||
Encounter encounter = encounterMapper.selectById(encounterId);
|
||||
if (encounter == null) {
|
||||
return R.fail("就诊记录不存在");
|
||||
}
|
||||
|
||||
// 检查状态是否为就诊中
|
||||
if (!EncounterStatus.IN_PROGRESS.getValue().equals(encounter.getStatusEnum())) {
|
||||
return R.fail("当前患者不在就诊中状态");
|
||||
}
|
||||
|
||||
// 2. 更新状态为已完成(30),并写入完成时间
|
||||
Date now = new Date();
|
||||
int update = encounterMapper.update(null,
|
||||
new LambdaUpdateWrapper<Encounter>().eq(Encounter::getId, encounterId)
|
||||
.set(Encounter::getStatusEnum, EncounterStatus.DISCHARGED.getValue())
|
||||
.set(Encounter::getSubjectStatusEnum, EncounterSubjectStatus.DEPARTED.getValue()));
|
||||
return update > 0 ? R.ok() : R.fail();
|
||||
.set(Encounter::getSubjectStatusEnum, EncounterSubjectStatus.DEPARTED.getValue())
|
||||
.set(Encounter::getEndTime, now));
|
||||
|
||||
if (update <= 0) {
|
||||
return R.fail("更新状态失败");
|
||||
}
|
||||
|
||||
// 3. 写入审计日志
|
||||
try {
|
||||
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) "
|
||||
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
jdbcTemplate.update(sql,
|
||||
"完诊操作",
|
||||
now,
|
||||
"DoctorStationMainAppServiceImpl.completeEncounter()",
|
||||
"POST",
|
||||
username,
|
||||
"/doctorstation/main/complete-encounter",
|
||||
"{\"encounterId\": " + encounterId + "}",
|
||||
"{\"code\": 200, \"msg\": \"就诊完成\", \"data\": null}");
|
||||
} catch (Exception e) {
|
||||
log.error("写入完诊审计日志失败", e);
|
||||
// 审计日志失败不影响主流程
|
||||
}
|
||||
|
||||
return R.ok("就诊完成");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,6 +34,10 @@ public class DoctorStationPtDetailsAppServiceImpl implements IDoctorStationPtDet
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPtDetails(Long encounterId) {
|
||||
// 检查参数
|
||||
if (encounterId == null) {
|
||||
return R.fail("就诊ID不能为空");
|
||||
}
|
||||
|
||||
// 收费状态List(1:待收费,2:待结算,5:已结算)
|
||||
List<Integer> statusList = new ArrayList<>();
|
||||
@@ -49,6 +53,10 @@ public class DoctorStationPtDetailsAppServiceImpl implements IDoctorStationPtDet
|
||||
ChargeItemContext.ACTIVITY.getValue(), ClinicalStatus.ACTIVE.getValue(), LocationForm.BED.getValue(),
|
||||
ParticipantType.ADMITTER.getCode(), statusList);
|
||||
|
||||
if (patientDetailsDto == null) {
|
||||
return R.fail("未找到患者详情信息");
|
||||
}
|
||||
|
||||
// 住院的场合,获取现在时间,计算住院天数
|
||||
if (patientDetailsDto.getClassEnum() == EncounterClass.IMP.getValue()) {
|
||||
// 截至时间,用于计算当前时刻下显示的住院天数
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public class DoctorStationAdviceController {
|
||||
* @return 医嘱请求数据
|
||||
*/
|
||||
@GetMapping(value = "/request-base-info")
|
||||
public R<?> getRequestBaseInfo(@RequestParam Long encounterId) {
|
||||
public R<?> getRequestBaseInfo(@RequestParam(required = false) Long encounterId) {
|
||||
return iDoctorStationAdviceAppService.getRequestBaseInfo(encounterId);
|
||||
}
|
||||
|
||||
@@ -114,10 +114,11 @@ public class DoctorStationAdviceController {
|
||||
* 查询历史医嘱请求数据
|
||||
*
|
||||
* @param patientId 病人id
|
||||
* @param encounterId 就诊id
|
||||
* @return 历史医嘱请求数据
|
||||
*/
|
||||
@GetMapping(value = "/request-history-info")
|
||||
public R<?> getRequestHistoryInfo(@RequestParam Long patientId, Long encounterId) {
|
||||
public R<?> getRequestHistoryInfo(@RequestParam Long patientId, @RequestParam(required = false) Long encounterId) {
|
||||
return iDoctorStationAdviceAppService.getRequestHistoryInfo(patientId, encounterId);
|
||||
}
|
||||
|
||||
@@ -138,7 +139,7 @@ public class DoctorStationAdviceController {
|
||||
* @return 就诊费用性质
|
||||
*/
|
||||
@GetMapping(value = "/get-encounter-contract")
|
||||
public R<?> getEncounterContract(@RequestParam Long encounterId) {
|
||||
public R<?> getEncounterContract(@RequestParam(required = false) Long encounterId) {
|
||||
return iDoctorStationAdviceAppService.getEncounterContract(encounterId);
|
||||
}
|
||||
|
||||
@@ -162,7 +163,7 @@ public class DoctorStationAdviceController {
|
||||
* @return 检验url相关参数
|
||||
*/
|
||||
@GetMapping(value = "/proof-result")
|
||||
public R<?> getProofResult(@RequestParam(value = "encounterId") Long encounterId) {
|
||||
public R<?> getProofResult(@RequestParam(value = "encounterId", required = false) Long encounterId) {
|
||||
return iDoctorStationAdviceAppService.getProofResult(encounterId);
|
||||
}
|
||||
|
||||
@@ -173,7 +174,7 @@ public class DoctorStationAdviceController {
|
||||
* @return 检查url相关参数
|
||||
*/
|
||||
@GetMapping(value = "/test-result")
|
||||
public R<?> getTestResult(@RequestParam(value = "encounterId") Long encounterId) {
|
||||
public R<?> getTestResult(@RequestParam(value = "encounterId", required = false) Long encounterId) {
|
||||
return iDoctorStationAdviceAppService.getTestResult(encounterId);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public class DoctorStationChineseMedicalController {
|
||||
* @return 中医就诊诊断信息
|
||||
*/
|
||||
@GetMapping(value = "/get-tcm-encounter-diagnosis")
|
||||
public R<?> getTcmEncounterDiagnosis(@RequestParam Long encounterId) {
|
||||
public R<?> getTcmEncounterDiagnosis(@RequestParam(required = false) Long encounterId) {
|
||||
return iDoctorStationChineseMedicalAppService.getTcmEncounterDiagnosis(encounterId);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class DoctorStationChineseMedicalController {
|
||||
* @return 医嘱请求数据
|
||||
*/
|
||||
@GetMapping(value = "/tcm-request-base-info")
|
||||
public R<?> getTcmRequestBaseInfo(@RequestParam Long encounterId) {
|
||||
public R<?> getTcmRequestBaseInfo(@RequestParam(required = false) Long encounterId) {
|
||||
return iDoctorStationChineseMedicalAppService.getTcmRequestBaseInfo(encounterId);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public class DoctorStationChineseMedicalController {
|
||||
* @return 中医历史医嘱请求数据
|
||||
*/
|
||||
@GetMapping(value = "/tcm-request-history-info")
|
||||
public R<?> getTcmRequestHistoryInfo(@RequestParam Long patientId, Long encounterId) {
|
||||
public R<?> getTcmRequestHistoryInfo(@RequestParam Long patientId, @RequestParam(required = false) Long encounterId) {
|
||||
return iDoctorStationChineseMedicalAppService.getTcmRequestHistoryInfo(patientId, encounterId);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,12 +162,12 @@ public class DoctorStationDiagnosisController {
|
||||
|
||||
/**
|
||||
* 查询就诊诊断信息
|
||||
*
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 就诊诊断信息
|
||||
*/
|
||||
@GetMapping(value = "/get-encounter-diagnosis")
|
||||
public R<?> getEncounterDiagnosis(@RequestParam Long encounterId) {
|
||||
public R<?> getEncounterDiagnosis(@RequestParam(required = false) Long encounterId) {
|
||||
return iDoctorStationDiagnosisAppService.getEncounterDiagnosis(encounterId);
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ public class DoctorStationDiagnosisController {
|
||||
* @return 就诊诊断信息
|
||||
*/
|
||||
@GetMapping(value = "/get-encounter-diagnosis-ele")
|
||||
public R<?> getEncounterDiagnosisByEncounterId(@RequestParam Long encounterId,@RequestParam String searchKey) {
|
||||
public R<?> getEncounterDiagnosisByEncounterId(@RequestParam(required = false) Long encounterId,@RequestParam String searchKey) {
|
||||
return iDoctorStationDiagnosisAppService.getEncounterDiagnosisByEncounterId(encounterId,searchKey);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class DoctorStationEmrController {
|
||||
* @return 病历详情
|
||||
*/
|
||||
@GetMapping("/emr-detail")
|
||||
public R<?> getEmrDetail(@RequestParam(value = "encounterId") Long encounterId) {
|
||||
public R<?> getEmrDetail(@RequestParam(value = "encounterId", required = false) Long encounterId) {
|
||||
return iDoctorStationEmrAppService.getEmrDetail(encounterId);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,8 +64,16 @@ public class DoctorStationMainController {
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping(value = "/receive-encounter")
|
||||
public R<?> receiveEncounter(@RequestParam Long encounterId) {
|
||||
return iDoctorStationMainAppService.receiveEncounter(encounterId);
|
||||
public R<?> receiveEncounter(@RequestParam(value = "encounterId", required = false) String encounterId) {
|
||||
if (encounterId == null || "undefined".equals(encounterId) || "null".equals(encounterId)) {
|
||||
return R.fail("就诊ID不能为空");
|
||||
}
|
||||
try {
|
||||
Long id = Long.parseLong(encounterId);
|
||||
return iDoctorStationMainAppService.receiveEncounter(id);
|
||||
} catch (NumberFormatException e) {
|
||||
return R.fail("就诊ID格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,8 +83,16 @@ public class DoctorStationMainController {
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping(value = "/leave-encounter")
|
||||
public R<?> leaveEncounter(@RequestParam Long encounterId) {
|
||||
return iDoctorStationMainAppService.leaveEncounter(encounterId);
|
||||
public R<?> leaveEncounter(@RequestParam(value = "encounterId", required = false) String encounterId) {
|
||||
if (encounterId == null || "undefined".equals(encounterId) || "null".equals(encounterId)) {
|
||||
return R.fail("就诊ID不能为空");
|
||||
}
|
||||
try {
|
||||
Long id = Long.parseLong(encounterId);
|
||||
return iDoctorStationMainAppService.leaveEncounter(id);
|
||||
} catch (NumberFormatException e) {
|
||||
return R.fail("就诊ID格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,8 +102,16 @@ public class DoctorStationMainController {
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping(value = "/complete-encounter")
|
||||
public R<?> completeEncounter(@RequestParam Long encounterId) {
|
||||
return iDoctorStationMainAppService.completeEncounter(encounterId);
|
||||
public R<?> completeEncounter(@RequestParam(value = "encounterId", required = false) String encounterId) {
|
||||
if (encounterId == null || "undefined".equals(encounterId) || "null".equals(encounterId)) {
|
||||
return R.fail("就诊ID不能为空");
|
||||
}
|
||||
try {
|
||||
Long id = Long.parseLong(encounterId);
|
||||
return iDoctorStationMainAppService.completeEncounter(id);
|
||||
} catch (NumberFormatException e) {
|
||||
return R.fail("就诊ID格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,8 +121,16 @@ public class DoctorStationMainController {
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping(value = "/cancel-encounter")
|
||||
public R<?> cancelEncounter(@RequestParam Long encounterId) {
|
||||
return iDoctorStationMainAppService.cancelEncounter(encounterId);
|
||||
public R<?> cancelEncounter(@RequestParam(value = "encounterId", required = false) String encounterId) {
|
||||
if (encounterId == null || "undefined".equals(encounterId) || "null".equals(encounterId)) {
|
||||
return R.fail("就诊ID不能为空");
|
||||
}
|
||||
try {
|
||||
Long id = Long.parseLong(encounterId);
|
||||
return iDoctorStationMainAppService.cancelEncounter(id);
|
||||
} catch (NumberFormatException e) {
|
||||
return R.fail("就诊ID格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@ public class DoctorStationPtDetailsController {
|
||||
* @return 患者详情
|
||||
*/
|
||||
@GetMapping(value = "/patient-details")
|
||||
public R<?> getPtDetails(@RequestParam Long encounterId) {
|
||||
public R<?> getPtDetails(@RequestParam(required = false) Long encounterId) {
|
||||
|
||||
return doctorStationPtDetailsAppService.getPtDetails(encounterId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
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) {
|
||||
if (encounterId == null) {
|
||||
return R.fail("就诊记录ID不能为空");
|
||||
}
|
||||
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;
|
||||
}
|
||||
@@ -293,11 +293,8 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
|
||||
if (admissionPatientInfoDto.getPriorityEnum() != null) {
|
||||
// 更新患者病情
|
||||
encounterService.updatePriorityEnumById(encounterId, admissionPatientInfoDto.getPriorityEnum());
|
||||
// 将之前的住院参与者更新为已完成
|
||||
Integer result = encounterParticipantService.updateEncounterParticipantsStatus(encounterId);
|
||||
if (result == 0) {
|
||||
return R.fail("患者信息更新失败,请联系管理员");
|
||||
}
|
||||
// 将之前的住院参与者更新为已完成(如果存在的话)
|
||||
encounterParticipantService.updateEncounterParticipantsStatus(encounterId);
|
||||
// 更新住院参与者
|
||||
// 住院医生
|
||||
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
|
||||
|
||||
@@ -187,7 +187,7 @@ public class PatientHomeAppServiceImpl implements IPatientHomeAppService {
|
||||
@Override
|
||||
public List<OrgMetadata> getCaty() {
|
||||
List<Organization> list = iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(),
|
||||
OrganizationClass.INPATIENT.getValue());
|
||||
OrganizationClass.INPATIENT.getCode());
|
||||
List<OrgMetadata> orgMetadataList = new ArrayList<>();
|
||||
OrgMetadata orgMetadata;
|
||||
for (Organization organization : list) {
|
||||
@@ -265,16 +265,19 @@ public class PatientHomeAppServiceImpl implements IPatientHomeAppService {
|
||||
encounterService.saveOrUpdateEncounter(encounter);
|
||||
|
||||
// 2.就诊位置表变更
|
||||
// 就诊位置ID变更
|
||||
// 直接更新指定ID的就诊位置记录
|
||||
EncounterLocation encounterLocation = new EncounterLocation();
|
||||
encounterLocation.setId(encounterLocationId)
|
||||
// 设置就诊ID
|
||||
.setEncounterId(encounterId)
|
||||
// 设置位置ID
|
||||
.setLocationId(locationId)
|
||||
// 设置状态枚举
|
||||
.setStatusEnum(EncounterActivityStatus.COMPLETED.getValue())
|
||||
// 设置物理枚举为 8:病床
|
||||
.setFormEnum(LocationForm.BED.getValue());
|
||||
encounterLocationService.saveOrUpdateEncounterLocation(encounterLocation);
|
||||
// 直接更新指定ID的记录
|
||||
encounterSuccess = encounterLocationService.updateById(encounterLocation);
|
||||
|
||||
// 3.位置表
|
||||
// 旧病床状态变更(空闲)
|
||||
|
||||
@@ -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();
|
||||
@@ -269,12 +308,20 @@ public class PatientInformationServiceImpl implements IPatientInformationService
|
||||
* @return 患者信息
|
||||
*/
|
||||
private Patient handlePatientInfo(PatientBaseInfoDto patientInfoDto) {
|
||||
Patient patient = new Patient();
|
||||
patient.setId(patientInfoDto.getId());
|
||||
if (patientInfoDto.getId() == null) {
|
||||
Patient patient;
|
||||
if (patientInfoDto.getId() != null) {
|
||||
// 更新现有患者信息
|
||||
patient = patientService.getById(patientInfoDto.getId());
|
||||
if (patient == null) {
|
||||
throw new ServiceException("患者信息不存在,无法更新");
|
||||
}
|
||||
} else {
|
||||
// 新增患者信息
|
||||
patient = new Patient();
|
||||
patient.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.PATIENT_NUM.getPrefix(), 10));
|
||||
patientInfoDto.setActiveFlag(PublicationStatus.ACTIVE.getValue()); // 默认启用
|
||||
patient.setActiveFlag(PublicationStatus.ACTIVE.getValue()); // 默认启用
|
||||
}
|
||||
|
||||
patient.setName(patientInfoDto.getName()); // 患者姓名
|
||||
patient.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(patientInfoDto.getName())); // 拼音首拼
|
||||
patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patientInfoDto.getName())); // 五笔首拼
|
||||
@@ -298,7 +345,14 @@ public class PatientInformationServiceImpl implements IPatientInformationService
|
||||
patient.setDeceasedDate(patientInfoDto.getDeceasedDate()); // 死亡时间
|
||||
patient.setNationalityCode(patientInfoDto.getNationalityCode());// 民族
|
||||
patient.setActiveFlag(patientInfoDto.getActiveFlag());// 活动标识
|
||||
patientService.saveOrUpdate(patient);
|
||||
|
||||
if (patientInfoDto.getId() != null) {
|
||||
// 更新操作
|
||||
patientService.updateById(patient);
|
||||
} else {
|
||||
// 新增操作
|
||||
patientService.save(patient);
|
||||
}
|
||||
|
||||
return patient;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user