From db6ffd6a99b46bd27173503c10aa4cd1afc9c775 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期三, 25 十一月 2026 11:16:33 +0800
Subject: [PATCH] 算税优化
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java | 11
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java | 11
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devmanage/DeviceDO.java | 5
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devmanage/DeviceMapper.java | 1
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java | 192 ++++++++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java | 61 +++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java | 40 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceRespVO.java | 4
jh-server/src/main/resources/application.yaml | 4
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java | 12
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java | 328 +++++++++++++++++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/checktype/CheckTypeDO.java | 19 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java | 15
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypeSaveReqVO.java | 6
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DevicePageReqVO.java | 3
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java | 2
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/PatientStatisticVO.java | 3
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java | 106 ++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenServiceImpl.java | 42 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypeRespVO.java | 8
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypePageReqVO.java | 3
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceSaveReqVO.java | 3
22 files changed, 832 insertions(+), 47 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
index b2c27c4..40dbb7b 100644
--- a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
+++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
@@ -98,6 +98,8 @@
ErrorCode ROUTINE_CHECK_EXIST = new ErrorCode(1_010_006_022, "褰撳ぉ宸叉湁妫�鏌�");
ErrorCode JOB_RECORD_NOT_EXISTS = new ErrorCode(1_010_007_000, "宸ヤ綔璁板綍涓嶅瓨鍦�");
+ /** 宸ヤ綔閲忕粺璁★細浣滀笟鏃堕棿鑼冨洿鏄繀濉紙鍘熷疄鐜扮洿鎺ュ彇 jobTime[0]銆乯obTime[1]锛岀己鍙傛椂 NPE 鈫� 鈥滅郴缁熷紓甯糕�濓級 */
+ ErrorCode JOB_STATISTIC_TIME_REQUIRED = new ErrorCode(1_010_007_001, "璇峰厛閫夋嫨浣滀笟鏃堕棿鑼冨洿");
ErrorCode CALL_NOT_EXISTS = new ErrorCode(1_010_008_000, "鍙彿涓嶅瓨鍦�");
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypePageReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypePageReqVO.java
index 9012d06..8fcdd16 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypePageReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypePageReqVO.java
@@ -24,6 +24,9 @@
@Schema(description = "鍏佽鍑嗗涓汉鏁�")
private Integer readyNum;
+ @Schema(description = "鍏变韩鍊欒瘖姹狅細1=涓嶉鍏堢粦瀹氳瘖瀹わ紝杩涘叡浜睜锛屽彨鍙锋椂缁戝畾")
+ private Boolean sharePool;
+
@Schema(description = "鍒涘缓鏃堕棿")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypeRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypeRespVO.java
index 2a970e5..dbc7823 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypeRespVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypeRespVO.java
@@ -30,6 +30,10 @@
@ExcelProperty("鍏佽鍑嗗涓汉鏁�")
private Integer readyNum;
+ @Schema(description = "鍏变韩鍊欒瘖姹狅細1=涓嶉鍏堢粦瀹氳瘖瀹わ紝杩涘叡浜睜锛屽彨鍙锋椂缁戝畾")
+ @ExcelProperty("鍏变韩鍊欒瘖姹�")
+ private Boolean sharePool;
+
@Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("鍒涘缓鏃堕棿")
private LocalDateTime createTime;
@@ -71,6 +75,10 @@
@ExcelProperty("棰勭害搴忓彿鏄剧ず鍓嶇紑")
private String seqPrefix;
+ @Schema(description = "鍏变韩鎺掗槦鍙风粍锛氶潪绌烘椂涓庡悓缁勯」鐩叡鐢ㄥ簭鍙疯鏁板櫒", example = "100")
+ @ExcelProperty("鍏变韩鎺掗槦鍙风粍")
+ private Integer seqGroup;
+
@Schema(description = "鎺掗槦搴忓彿瑙勫垯锛�0=棰勭害鍙�, 1=绛惧埌搴忓彿, 2=鏃舵鍙凤紙榛樿锛�", example = "2")
@ExcelProperty("鎺掗槦搴忓彿瑙勫垯")
private Integer seqRule;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypeSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypeSaveReqVO.java
index 9fb216c..28d46ec 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypeSaveReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/checktype/vo/CheckTypeSaveReqVO.java
@@ -21,6 +21,9 @@
@Schema(description = "鍏佽鍑嗗涓汉鏁�")
private Integer readyNum;
+ @Schema(description = "鍏变韩鍊欒瘖姹狅細1=涓嶉鍏堢粦瀹氳瘖瀹わ紝杩涘叡浜睜锛屽彨鍙锋椂缁戝畾")
+ private Boolean sharePool;
+
@Schema(description = "闇�瑕佽澶囬鐢�")
private Integer needDevReady;
@@ -48,6 +51,9 @@
@Schema(description = "棰勭害搴忓彿鏄剧ず鍓嶇紑")
private String seqPrefix;
+ @Schema(description = "鍏变韩鎺掗槦鍙风粍锛氶潪绌烘椂涓庡悓缁勯」鐩叡鐢ㄥ簭鍙疯鏁板櫒", example = "100")
+ private Integer seqGroup;
+
@Schema(description = "鎺掗槦搴忓彿瑙勫垯锛�0=棰勭害鍙�, 1=绛惧埌搴忓彿, 2=鏃舵鍙凤紙榛樿锛�", example = "2")
private Integer seqRule;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DevicePageReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DevicePageReqVO.java
index a1ddbaa..9422d17 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DevicePageReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DevicePageReqVO.java
@@ -39,6 +39,9 @@
@Schema(description = "鍨嬪彿")
private String model;
+ @Schema(description = "璁惧鐘舵�侊細姝e父/寰呬慨/宸插瘎淇�/寰呮姤鎹�/澶囩敤")
+ private String devState;
+
@Schema(description = "閲囪喘鏃ユ湡")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] purchaseDate;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceRespVO.java
index 5094dff..c4ba5f5 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceRespVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceRespVO.java
@@ -51,6 +51,10 @@
@ExcelProperty("閲囪喘鏃ユ湡")
private LocalDate purchaseDate;
+ @Schema(description = "璁惧鐘舵�侊細姝e父/寰呬慨/宸插瘎淇�/寰呮姤鎹�/澶囩敤")
+ @ExcelProperty("璁惧鐘舵��")
+ private String devState;
+
@Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("鍒涘缓鏃堕棿")
private LocalDateTime createTime;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceSaveReqVO.java
index 247f0d5..ea39192 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceSaveReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceSaveReqVO.java
@@ -46,6 +46,9 @@
@Schema(description = "閲囪喘鏃ユ湡")
private LocalDate purchaseDate;
+ @Schema(description = "璁惧鐘舵�侊細姝e父/寰呬慨/宸插瘎淇�/寰呮姤鎹�/澶囩敤")
+ private String devState;
+
@Schema(description = "鐘舵�佹棩鏈�")
private LocalDate stateDate;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java
index 8892479..e908205 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java
@@ -11,6 +11,7 @@
import java.util.*;
import java.io.IOException;
+import java.time.LocalDateTime;
import cn.lihu.jh.framework.common.pojo.PageParam;
import cn.lihu.jh.framework.common.pojo.PageResult;
@@ -31,6 +32,9 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
+
+import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.JOB_STATISTIC_TIME_REQUIRED;
@Tag(name = "绠$悊鍚庡彴 - 宸ヤ綔璁板綍")
@RestController
@@ -126,7 +130,12 @@
@Operation(summary = "宸ヤ綔閲忕粺璁�")
@PreAuthorize("@ss.hasPermission('ecg:job-record:statistic')")
public CommonResult<List<JobRecordStatisticVO>> getJobStatistic(@Valid JobRecordPageReqVO pageReqVO) {
- List<JobRecordStatisticDO> statisticDOList = jobRecordService.getJobStatistic(pageReqVO.getJobTime()[0], pageReqVO.getJobTime()[1]);
+ // 浣滀笟鏃堕棿鑼冨洿蹇呭~锛氬師瀹炵幇鐩存帴鍙� jobTime[0]/[1]锛岀己鍙傛椂 ArrayIndexOutOfBounds/NullPointer 鈫� 鍓嶇鍙湅鍒扳�滅郴缁熷紓甯糕��
+ LocalDateTime[] jobTime = pageReqVO.getJobTime();
+ if (jobTime == null || jobTime.length < 2 || jobTime[0] == null || jobTime[1] == null) {
+ throw exception(JOB_STATISTIC_TIME_REQUIRED);
+ }
+ List<JobRecordStatisticDO> statisticDOList = jobRecordService.getJobStatistic(jobTime[0], jobTime[1]);
return success(BeanUtils.toBean(statisticDOList, JobRecordStatisticVO.class));
}
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java
index 9ace751..9cadcaf 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java
@@ -20,6 +20,17 @@
@ExcelProperty("浣滀笟绫诲瀷")
private Integer jobType;
+ /**
+ * 妫�鏌ラ」鐩紙check_type.value锛夈��
+ *
+ * <p>銆�2026-11-25 闇�姹傘�戝伐浣滃彴銆屽凡瀹屾垚鍒楄〃銆嶈鎶婃鏌ラ」鐩垪鍑烘潵 鈥斺��
+ * 鍚屼竴涓偅鑰呬竴澶╁彲鑳藉仛澶氫釜妫�鏌ラ」鐩紝鍙樉绀哄鍚嶆棤娉曞尯鍒嗘槸鍝竴鏉¤褰�
+ * 锛堟挙閿�鏃朵篃闇�瑕侀潬瀹冨畾浣嶉槦鍒楄锛夈��
+ */
+ @Schema(description = "妫�鏌ラ」鐩�", example = "100")
+ @ExcelProperty("妫�鏌ラ」鐩�")
+ private Integer checkType;
+
@Schema(description = "鍖荤敓缂栧彿", requiredMode = Schema.RequiredMode.REQUIRED, example = "24197")
@ExcelProperty("鍖荤敓缂栧彿")
private Long docId;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/PatientStatisticVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/PatientStatisticVO.java
index db59e55..f71a424 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/PatientStatisticVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/PatientStatisticVO.java
@@ -16,4 +16,7 @@
private Integer passedNum;
private Integer queuingNum;
+
+ /** 鍏变韩鍊欒瘖姹犱腑銆屽噯澶囦腑銆嶇殑浜烘暟锛堝叡浜」鐩彨鍙锋椂鍙洿鎺ュ彇锛� */
+ private Integer sharedReadyNum;
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/checktype/CheckTypeDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/checktype/CheckTypeDO.java
index efe9daf..ba7491b 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/checktype/CheckTypeDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/checktype/CheckTypeDO.java
@@ -40,6 +40,16 @@
* 鍏佽鍑嗗涓汉鏁�
*/
private Integer readyNum;
+
+ /**
+ * 鍏变韩鍊欒瘖姹狅細1=璇ラ」鐩殑鎮h�呬笉棰勫厛缁戝畾璇婂锛岃繘鍏变韩姹狅紝鐢卞紑灞曡椤圭洰鐨勮瘖瀹ゅ彨鍙锋椂缁戝畾銆�
+ *
+ * <p>鑳屾櫙锛氬父瑙勫績鐢靛浘(100)/蹇冪數鍚戦噺鍥�(1100)/搴婅竟蹇冪數鍥�(1000) 鍦� 1/2/3 璇婂閮借兘鍋氾紝
+ * 浣嗙幇鍦虹粡甯稿彧鏈変竴涓瘖瀹ゆ湁鍖荤敓銆傞鍏堝垎鍒版病浜鸿瘖瀹ょ殑鎮h�呬細涓�鐩磋疆涓嶅埌锛屾晠鏀逛负鍏变韩姹犮��
+ *
+ * <p>鍏变韩姹犲閲� = 鍏变韩璇婂鍚勮嚜銆屽�欒瘖鍑嗗浜烘暟銆嶇殑鏈�澶у�硷紙瑙� QueueServiceTxFunctions#hurryupSharedPool锛夈��
+ */
+ private Boolean sharePool;
/**
* 闇�瑕佽澶囬鐢�
*
@@ -80,6 +90,15 @@
private String seqPrefix;
/**
+ * 鍏变韩鎺掗槦鍙风粍锛氶潪绌烘椂锛屾湰椤圭洰鐨勩�岀鍒板簭鍙枫�嶄笌鍚岀粍椤圭洰鍏辩敤鍚屼竴涓鏁板櫒
+ * 锛堣鏁板櫒 key 鍙栨湰鍒楀�硷紝渚嬪 100/1100/1000 閮藉~ 100锛夈��
+ *
+ * <p>浣滅敤锛氬叡浜�欒瘖姹犻噷鐨勬偅鑰呰浠庡悓涓�濂楀彿閲屽彇鍙凤紝鎵嶈兘鎸夊彿鎺掓垚涓�鏉¢槦鍒楋紱
+ * 涓虹┖鏃朵粛鎸夊悇鑷殑 check_type 璁℃暟锛堝師琛屼负锛夈��
+ */
+ private Integer seqGroup;
+
+ /**
* 鎺掗槦搴忓彿瑙勫垯锛堥渶姹傦細绛惧埌鏃跺浣曠粰鎮h�呮帓闃熷簭鍙凤級
*
* <p>鍙栧�艰 {@link cn.lihu.jh.module.ecg.enums.SeqRuleEnum}锛�
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devmanage/DeviceDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devmanage/DeviceDO.java
index 65dc924..e1e8288 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devmanage/DeviceDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devmanage/DeviceDO.java
@@ -65,6 +65,11 @@
private LocalDate purchaseDate;
/**
+ * 璁惧鐘舵�侊細姝e父 / 寰呬慨 / 宸插瘎淇� / 寰呮姤鎹� / 澶囩敤
+ */
+ private String devState;
+
+ /**
* 鐘舵�佹棩鏈�
*/
@TableField(updateStrategy = FieldStrategy.ALWAYS)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devmanage/DeviceMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devmanage/DeviceMapper.java
index 3c84343..8c11ec8 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devmanage/DeviceMapper.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devmanage/DeviceMapper.java
@@ -31,6 +31,7 @@
.eqIfPresent(DeviceDO::getCategory, reqVO.getCategory())
.eqIfPresent(DeviceDO::getBrand, reqVO.getBrand())
.eqIfPresent(DeviceDO::getModel, reqVO.getModel())
+ .eqIfPresent(DeviceDO::getDevState, reqVO.getDevState())
.betweenIfPresent(DeviceDO::getPurchaseDate, reqVO.getPurchaseDate())
.betweenIfPresent(DeviceDO::getCreateTime, reqVO.getCreateTime())
.orderByAsc(DeviceDO::getDevId));
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java
index dd978bb..bf01f25 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java
@@ -53,7 +53,17 @@
@Select("SELECT count(1) FROM lihu.job_record where pat_id=#{patId} and TO_DAYS(job_time)=TO_DAYS(#{jobTime}) and job_type=#{jobType} ")
Integer getPatientJobNum(@Param("patId") String patId, @Param("jobTime") LocalDateTime jobTime, @Param("jobType") Integer jobType );
- @Select("select year(job_time) as year, month(job_time) as month, doc_id, doc_name, job_type, count(1) as job_count from lihu.job_record " +
+ /**
+ * 宸ヤ綔閲忕粺璁★紙鎸� 骞�/鏈�/鍖荤敓/浣滀笟绫诲瀷 姹囨�伙級銆�
+ *
+ * <p>銆怬NLY_FULL_GROUP_BY銆慸oc_name 鏄� job_record 涓婄殑鍐椾綑鍒楋紝涓嶅弬涓庡垎缁勶紝
+ * 鐩存帴 select 浼氬湪 MySQL 8 榛樿 sql_mode锛堝惈 ONLY_FULL_GROUP_BY锛変笅鎶�
+ * 鈥淓xpression #4 of SELECT list is not in GROUP BY clause ...鈥濓紝椤甸潰琛ㄧ幇涓衡�滅郴缁熷紓甯糕�濄��
+ * 鏈満搴撶殑 sql_mode 鎭板ソ娌″紑 ONLY_FULL_GROUP_BY锛屾墍浠ユ湰鍦颁竴鐩存甯搞�佹祴璇曞簱鎵嶇偢銆�
+ * 杩欓噷鐢� ANY_VALUE(doc_name) 鍙栧悓缁勪换鎰忎竴鏉″悕绉帮細鏃㈡弧瓒� ONLY_FULL_GROUP_BY锛�
+ * 鍙堜繚鎸佲�滀竴涓尰鐢熶竴涓湀涓�琛屸�濓紙鎶� doc_name 鍔犺繘 group by 浼氬洜鏀瑰悕鎷嗘垚涓よ锛夈��
+ */
+ @Select("select year(job_time) as year, month(job_time) as month, doc_id, ANY_VALUE(doc_name) as doc_name, job_type, count(1) as job_count from lihu.job_record " +
"where job_time >= #{jobTimeFrom} and job_time < #{jobTimeTo} \n" +
"group by year(job_time), month(job_time), doc_id, job_type;")
List<JobRecordStatisticDO> getJobStatistic(@Param("jobTimeFrom") LocalDateTime jobTimeFrom, @Param("jobTimeTo") LocalDateTime jobTimeTo);
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java
index 14c7549..4dd2914 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java
@@ -285,6 +285,55 @@
@Param("curStatus")Integer curStatus);
/**
+ * 鎸夈�屽伐浣� + 鎮h�� + 妫�鏌ョ被鍨� + 鐘舵��**闆嗗悎**銆嶅彇涓�琛岋紙浠婃棩锛屽彿鏈�灏忥級銆�
+ *
+ * <p>銆愭湰闇�姹偮蜂笉鍙彿鐩存帴妫�鏌ャ�戠敤浜庛�屾鏌ュ畬鎴愩�嶆椂鏀跺熬**浠栬嚜宸辩殑**鎺掗槦琛岋細
+ * 浠庡伐浣滃彴鍙充晶鍒楄〃鐐广�屾鏌ャ�嶅姞杞界殑鎮h�咃紝鍏ㄧ▼涓嶄細琚疆涓恒�屽氨璇婁腑(30)銆�
+ * 锛堝洜涓鸿姹備笉涓婂ぇ灞忋�佷笉鍙彿锛夛紝瀹屾垚妫�鏌ユ椂灏辨病鏈� 30 鐨勮鍙互鏀� 40锛�
+ * 鑻ヤ笉澶勭悊浠栦細涓�鐩寸暀鍦ㄥ�欒瘖鍒楄〃鍜屽ぇ灞忎笂銆�
+ *
+ * <p>鍏佽鐨勭姸鎬侊細鎺掗槦涓�(10)/宸插彫鍥�(15)/鍑嗗涓�(20)鈥斺�旈兘鏄�"杩樻病鍋氬畬"鐨勭姸鎬併��
+ */
+ @Select("<script>" +
+ "SELECT * from lihu.queue " +
+ "where room_id = #{roomId} and bed_no = #{bedNo} " +
+ " and pat_id = #{patId} and book_check_type = #{checkType} " +
+ " and status in ( " +
+ " <foreach collection='statusList' separator=',' item='_status'>#{_status}</foreach> " +
+ " ) " +
+ " and TO_DAYS(book_date) = TO_DAYS(NOW()) " +
+ "order by seq_num limit 1" +
+ "</script>")
+ @Results({
+ @Result(property = "patDetails", column = "pat_details", typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class)
+ })
+ QueueDO getBedQueueItemByPatAndStatuses(@Param("roomId")Long roomId, @Param("bedNo")String bedNo,
+ @Param("patId")String patId, @Param("checkType")Integer checkType,
+ @Param("statusList")List<Integer> statusList);
+
+ /**
+ * 鍙栥�岃繕娌″垎閰嶅伐浣嶃�嶇殑鎺掗槦琛岋紙{@code bed_no} 涓虹┖锛屼粖鏃ワ紝鍙锋渶灏忥級銆�
+ *
+ * <p>鍦烘櫙鍚屼笂锛氬尰鐢熷湪銆屾湰璇婂鎺掗槦涓紙鏈垎閰嶅伐浣嶏級銆嶉噷鐩存帴鐐广�屾鏌ャ�嶅仛鎺夋煇浣嶆偅鑰咃紝
+ * 璇ヨ娌℃湁 room/bed锛屽畬鎴愭鏌ユ椂瑕佹寜鎮h�� + 妫�鏌ラ」鐩妸瀹冩敹灏俱��
+ */
+ @Select("<script>" +
+ "SELECT * from lihu.queue " +
+ "where pat_id = #{patId} and book_check_type = #{checkType} " +
+ " and (bed_no is null or trim(bed_no) = '') " +
+ " and status in ( " +
+ " <foreach collection='statusList' separator=',' item='_status'>#{_status}</foreach> " +
+ " ) " +
+ " and TO_DAYS(book_date) = TO_DAYS(NOW()) " +
+ "order by seq_num limit 1" +
+ "</script>")
+ @Results({
+ @Result(property = "patDetails", column = "pat_details", typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class)
+ })
+ QueueDO getUnassignedQueueItemByPatAndStatuses(@Param("patId")String patId, @Param("checkType")Integer checkType,
+ @Param("statusList")List<Integer> statusList);
+
+ /**
* 鎸夊伐浣� + 鐘舵�� + 浠婃棩鍙�**鏈�杩戞洿鏂�**鐨勪竴鏉°��
* <p>
* 姣斻�宻eq_num 鏈�灏忋�嶆洿璐村悎"褰撳墠姝e湪灏辫瘖/瑁呮満鐨勯偅浣嶆偅鑰�"锛歴eq_num 鏈�灏忔槸鏈椂娈垫渶鏃╂帓闃熺殑锛�
@@ -447,6 +496,27 @@
@Param("bedNo")String bedNo, @Param("curStatus")Integer curStatus, @Param("newStatus")Integer newStatus);
/**
+ * 銆愪慨澶嵚风幇鍦洪棶棰樸�戞妸鏌愬伐浣嶄笂鐨勩�屽噯澶囦腑/宸插彫鍥�/浜插拰銆嶆偅鑰�**閫�鍥炪�屾帓闃熶腑銆�**锛屽苟娓呯┖璇婂/宸ヤ綅銆�
+ *
+ * <p>鐢ㄤ簬銆岀鐞嗗憳娓呯┖宸ヤ綅銆嶄笌銆岄棴璇娿�嶃�傚師瀹炵幇鍙敼 `clinic_room`锛屾偅鑰呬粛鎸傚湪杩欎釜宸ヤ綅涓婏紝
+ * 鑰屽伐浣嶅凡缁忔病浜轰簡 鈥斺�� 浠栦滑鏃笉鍦ㄤ换浣曞尰鐢熺殑鍊欒瘖鍒楄〃閲岋紝涔熶笉鍦�
+ * 銆屾湰璇婂鎺掗槦涓紙鏈垎閰嶏級銆嶉噷锛堥偅涓垪琛ㄥ彧鏌� {@code status=10 涓� bed_no 涓虹┖}锛夛紝
+ * 绛変簬"娑堝け"锛屽彧鑳界瓑姣忔棩閲嶇疆銆傞��鍥炲悗鍗冲彲琚叾瀹冨紑璇婂伐浣嶉噸鏂板垎娴� / 鎵嬪伐銆屾媺鍏ャ�嶃��
+ *
+ * <p>鍚屾椂鎶� {@code affinity_item} 澶嶄綅涓� 0锛氫翰鍜岄」閲嶆柊鍙樻垚鐙珛鐨勬帓闃熸偅鑰咃紝
+ * 涓嬫琚垎娴佹椂浼氱敱浜插拰閫昏緫閲嶆柊鎸傚埌涓婚」涓婏紙{@code procAffinityWhenPreempt}锛夈��
+ */
+ @Update("<script>" +
+ "update lihu.queue " +
+ "set status = #{newStatus}, room_id = 0, room_name = '', bed_no = null, affinity_item = 0 " +
+ "where room_id = #{roomId} and bed_no = #{bedNo} and deleted = 0 " +
+ " and status in ( <foreach collection='statusList' separator=',' item='_status'>#{_status}</foreach> )" +
+ "</script>")
+ Integer releaseBedPatientsToWaiting(@Param("roomId") Long roomId, @Param("bedNo") String bedNo,
+ @Param("newStatus") Integer newStatus,
+ @Param("statusList") List<Integer> statusList);
+
+ /**
* 銆愭湰闇�姹偮峰苟鍙戝姞鍥恒�戞寜涓婚敭 + **褰撳墠鐘舵��**鏉′欢鎺ㄨ繘鐘舵�侊紙鍙彿锛氬�欒瘖涓�(20) 鈫� 灏辫瘖涓�(30)锛夈��
*
* <p>涓轰粈涔堥渶瑕佸畠锛歿@code nextPatient} 鍘熸潵鏄�"鍏堟煡鏈�灏忓彿鐨勫�欒瘖琛� 鈫� updateById"锛�
@@ -546,5 +616,127 @@
//@Update("TRUNCATE TABLE lihu.queue")
@Delete("delete from lihu.queue where TO_DAYS(book_date) != TO_DAYS(NOW())")
void clearQueue();
+
+ // ========================================================================
+ // 鍏变韩鍊欒瘖姹狅紙check_type.share_pool = 1锛岃瑙� _prep/鏂规-1-2璇婂鍏变韩鍊欒瘖姹�.md锛�
+ //
+ // 姹犱腑鎮h�呯殑鍒ゅ畾锛歴tatus = 20(鍑嗗涓�) 涓� **鏈粦瀹氳瘖瀹�**锛坆ed_no 涓虹┖锛夈��
+ // 涓�"宸茬粦瀹氭煇宸ヤ綅鐨� 20"鍖哄垎锛氬悗鑰� room_id/bed_no 鏈夊�硷紝浠嶆寜宸ヤ綅鏌ャ��
+ // ========================================================================
+
+ /**
+ * 鍙栧叡浜睜/鍏变韩鎺掗槦涓�屽彿鏈�灏忋�嶇殑涓�浣嶏紙浠婃棩锛屾湭缁戝畾璇婂锛夈��
+ *
+ * <p>{@code curStatus}=20 鍙�"鍑嗗涓�"锛�=10 鍙�"鎺掗槦涓�"锛堟睜绌烘椂鍙彿鐨勫厹搴曪級銆�
+ * 鎺掑簭涓庣幇鏈夊彨鍙蜂竴鑷达細鍔犳�ヤ紭鍏� 鈫� 鎺掗槦鍙� 鈫� 鏃舵 鈫� 鍒涘缓鏃堕棿銆�
+ */
+ @Select("<script>" +
+ "SELECT * FROM lihu.queue WHERE deleted = 0 AND status = #{curStatus} " +
+ " AND (bed_no IS NULL OR TRIM(bed_no) = '') " +
+ " AND book_check_type IN ( " +
+ " <foreach collection='checkTypeArray' separator=',' item='_t'>#{_t}</foreach> " +
+ " ) " +
+ " AND TO_DAYS(book_date) = TO_DAYS(NOW()) " +
+ "ORDER BY jump_flag DESC, CASE WHEN seq_num IS NULL THEN 1 ELSE 0 END, seq_num, book_timeslot, create_time " +
+ "LIMIT 1" +
+ "</script>")
+ @Results({
+ @Result(property = "patDetails", column = "pat_details", typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class)
+ })
+ QueueDO selectSharedFirst(@Param("curStatus") Integer curStatus,
+ @Param("checkTypeArray") Integer[] checkTypeArray);
+
+ /**
+ * 鍙栧叡浜睜/鍏变韩鎺掗槦涓殑鎮h�呭垪琛紙宸ヤ綔鍙般�屽叡浜�欒瘖鍖恒�嶇敤锛夈��
+ */
+ @Select("<script>" +
+ "SELECT * FROM lihu.queue WHERE deleted = 0 AND status = #{curStatus} " +
+ " AND (bed_no IS NULL OR TRIM(bed_no) = '') " +
+ " AND book_check_type IN ( " +
+ " <foreach collection='checkTypeArray' separator=',' item='_t'>#{_t}</foreach> " +
+ " ) " +
+ " AND TO_DAYS(book_date) = TO_DAYS(NOW()) " +
+ "ORDER BY jump_flag DESC, CASE WHEN seq_num IS NULL THEN 1 ELSE 0 END, seq_num, book_timeslot, create_time" +
+ "</script>")
+ @Results({
+ @Result(property = "patDetails", column = "pat_details", typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class)
+ })
+ List<QueueDO> selectSharedList(@Param("curStatus") Integer curStatus,
+ @Param("checkTypeArray") Integer[] checkTypeArray);
+
+ /**
+ * 缁熻鍏变韩姹犲綋鍓嶃�屽噯澶囦腑涓旀湭缁戝畾銆嶇殑浜烘暟锛堢敤浜庢睜瀹归噺鎺у埗锛夈��
+ */
+ @Select("<script>" +
+ "SELECT COUNT(1) FROM lihu.queue WHERE deleted = 0 AND status = 20 " +
+ " AND (bed_no IS NULL OR TRIM(bed_no) = '') " +
+ " AND book_check_type IN ( " +
+ " <foreach collection='checkTypeArray' separator=',' item='_t'>#{_t}</foreach> " +
+ " ) " +
+ " AND TO_DAYS(book_date) = TO_DAYS(NOW())" +
+ "</script>")
+ Integer countSharedPool(@Param("checkTypeArray") Integer[] checkTypeArray);
+
+ /**
+ * 鎶娿�屾帓闃熶腑(10)銆嶆彁鍗囦负鍏变韩姹犮�屽噯澶囦腑(20)銆嶏紝淇濇寔涓嶇粦瀹氳瘖瀹ゃ��
+ * <p>{@code and status = 10} 淇濊瘉骞跺彂涓嬪彧鏈変竴鏂规姠鍒拌琛屻��
+ */
+ @Update("update lihu.queue set status = 20, room_id = 0, room_name = '', bed_no = null " +
+ " where id = #{id} and status = 10 and deleted = 0")
+ Integer promoteToSharedPool(@Param("id") Integer id);
+
+ /**
+ * 銆屾媺鍏ャ�嶅叡浜睜鎮h�咃細鎶婃睜涓�屽噯澶囦腑(20) 鏈粦瀹氥�嶇殑琛岀粦瀹氬埌鏈伐浣嶏紙鐘舵�佷粛涓� 20锛夈��
+ * <p>{@code bed_no 涓虹┖} 鏄苟鍙戜繚鎶わ細姹犱腑鍚屼竴琛屽彧浼氳涓�涓瘖瀹ゆ媺璧般��
+ */
+ @Update("update lihu.queue set room_id = #{roomId}, room_name = #{roomName}, bed_no = #{bedNo} " +
+ " where id = #{id} and status = 20 and (bed_no is null or trim(bed_no) = '') and deleted = 0")
+ Integer bindSharedPoolItem(@Param("id") Integer id, @Param("roomId") Long roomId,
+ @Param("roomName") String roomName, @Param("bedNo") String bedNo);
+
+ /**
+ * 鍙彿锛氭妸鍏变韩姹�(20)/鍏变韩鎺掗槦涓�(10)鐨勬偅鑰呮敼涓恒�屽氨璇婁腑(30)銆嶅苟缁戝畾鍒板彨鍙疯瘖瀹ゃ��
+ * <p>{@code and status = #{curStatus}} 淇濊瘉涓や釜璇婂鍚屾椂鍙悓涓�浜烘椂鍙湁涓�涓垚鍔熴��
+ */
+ @Update("update lihu.queue set status = 30, room_id = #{roomId}, room_name = #{roomName}, bed_no = #{bedNo} " +
+ " where id = #{id} and status = #{curStatus} and deleted = 0")
+ Integer callSharedItem(@Param("id") Integer id, @Param("roomId") Long roomId,
+ @Param("roomName") String roomName, @Param("bedNo") String bedNo,
+ @Param("curStatus") Integer curStatus);
+
+ /**
+ * 闂瘖/璺ㄥぉ鏀跺熬锛氭妸鍏变韩姹犻噷鏈粦瀹氱殑銆屽噯澶囦腑(20)銆嶉��鍥炪�屾帓闃熶腑(10)銆嶃��
+ */
+ @Update("update lihu.queue set status = 10, room_id = 0, room_name = '', bed_no = null " +
+ " where status = 20 and (bed_no is null or trim(bed_no) = '') and deleted = 0")
+ Integer releaseSharedPoolToWaiting();
+
+ /**
+ * 鍏变韩椤圭洰銆岃繃鍙�(5)銆嶅彫鍥烇細**鍥炲叡浜睜**锛堟竻绌鸿瘖瀹�/宸ヤ綅锛岀疆涓烘帓闃熶腑(10)锛夛紝
+ * 闅忓悗鐢辨睜濉厖鍣ㄦ寜瀹归噺鎻愬崌涓哄噯澶囦腑锛屼换涓�璇婂閮藉彲鍙��
+ */
+ @Update("update lihu.queue set status = #{newStatus}, passed = 1, room_id = 0, room_name = '', bed_no = null " +
+ " where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus} " +
+ " and pat_id = #{patId} and book_check_type = #{checkType} and deleted = 0")
+ Integer recallPassedPatientToPool(@Param("roomId") Long roomId, @Param("bedNo") String bedNo,
+ @Param("patId") String patId, @Param("checkType") Integer checkType,
+ @Param("curStatus") Integer curStatus, @Param("newStatus") Integer newStatus);
+
+ /**
+ * 鍏变韩椤圭洰銆屾挙閿�鍙彿銆嶏細灏辫瘖涓�(30) 鈫� 鎺掗槦涓�(10)锛屽苟娓呯┖璇婂/宸ヤ綅锛堝洖鍏变韩姹狅級銆�
+ */
+ @Update("update lihu.queue set status = 10, room_id = 0, room_name = '', bed_no = null " +
+ " where id = #{id} and status = 30 and deleted = 0")
+ Integer undoCallToSharedPool(@Param("id") Integer id);
+
+ /**
+ * 鍏变韩椤圭洰銆屾挙閿�瀹屾垚銆嶏細宸插氨璇�(40) 鈫� 鎺掗槦涓�(10)锛屽苟娓呯┖璇婂/宸ヤ綅锛堝洖鍏变韩姹狅級銆�
+ */
+ @Update("update lihu.queue set status = 10, passed = 0, room_id = 0, room_name = '', bed_no = null " +
+ " where room_id = #{roomId} and bed_no = #{bedNo} and status = 40 " +
+ " and pat_id = #{patId} and book_check_type = #{checkType} " +
+ " and TO_DAYS(book_date) = TO_DAYS(NOW())")
+ Integer undoFinishToSharedPool(@Param("roomId") Long roomId, @Param("bedNo") String bedNo,
+ @Param("patId") String patId, @Param("checkType") Integer checkType);
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
index 6df4631..e94b105 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
@@ -429,14 +429,14 @@
// 銆愭湰闇�姹傘�戦潪褰撳ぉ棰勭害鐨勭鍒帮細鍏堟彁閱掋�佺‘璁ゅ悗鍏佽绛惧叆锛堝墠绔脊绐楃‘璁ゅ悗甯� forceCheckIn=true锛�
// 鈶� 鏈‘璁わ紙鍓嶇杩樻病璁╃敤鎴风‘璁わ級鈫� 浠嶈繑鍥� APPOINTMENT_NOT_TODAY锛屽墠绔嵁姝ゅ脊銆岄潪褰撳ぉ锛屾槸鍚︾鍒般�嶏紱
- // 鈶� 宸茬‘璁� 鈫� 鍏佽绛惧叆锛屽苟涓�**寮哄埗璧伴鐣欏彿閫氶亾**锛岄伩鍏嶅崰鐢ㄥ綋澶╁悓鏃舵鐨勬甯搁绾﹀彿锛�
+ // 鈶� 宸茬‘璁� 鈫� 鍏佽绛惧叆锛�**鎸夊綋澶╂甯稿彿搴忓彇鍙�**锛堜笌褰撳ぉ灏辫瘖鎮h�呰繛鍙凤紝瑙佷笅鏂� vip 璁$畻锛夛紱
// 鈶� 棰勭害鏃ユ湡鏀瑰啓涓哄綋澶╋細闃熷垪/澶у睆/宸ヤ綔鍙伴兘鎸� book_date = 浠婂ぉ 杩囨护锛�
// 鑻ヤ繚鐣欏師鏃ユ湡锛屾偅鑰呯鍏ュ悗涓嶄細鍑虹幇鍦ㄤ换浣曞垪琛ㄩ噷銆�
if (!bookDateIsToday) {
if (!forceCheckIn) {
throw exception(APPOINTMENT_NOT_TODAY);
}
- log.info("[appoitmentConfirm] 闈炲綋澶╅绾︾鍏ワ紙鏀圭敤棰勭暀鍙凤紝棰勭害鏃ユ湡鏀逛粖澶╋級. appointmentId={} 鍘熼绾︽棩鏈�={} checkType={} timeslot={}",
+ log.info("[appoitmentConfirm] 闈炲綋澶╅绾︾鍏ワ紙鎸夊綋澶╂甯稿彿搴忓彇鍙凤紝棰勭害鏃ユ湡鏀逛粖澶╋級. appointmentId={} 鍘熼绾︽棩鏈�={} checkType={} timeslot={}",
appointment.getId(), appointment.getBookDate(), confirmReqVO.getBookCheckType(),
confirmReqVO.getBookTimeslot());
appointment.setBookDate(LocalDate.now());
@@ -448,11 +448,16 @@
// 2=鏃舵鍙凤紙鎸� bookTimeslot 浠庡彿姹犲彇鍙� 鈥斺�� 鏀归�犲墠鐨勫師鏈夎涓猴紝涔熸槸鏈厤缃椂鐨勯粯璁わ級
//
// 銆愭湰闇�姹傦細鎸夋椂娈甸绾︺�戝鍔� VIP/鍔犲彿鏍囪锛�
- // 路 VIP/鍔犲彿/闈炲綋澶╃鍏� 鈫� 鏈棰勭暀鍙� 鈫� 鎬婚鐣欐睜锛坱ime_slot=0锛�
- // 路 鏅�� 鈫� 鏈鏅�氬彿 鈫� 鏈棰勭暀鍙� 鈫� 鎬婚鐣欐睜
+ // 路 VIP/鍔犲彿/鍔犳�� 鈫� 鏈棰勭暀鍙� 鈫� 鎬婚鐣欐睜锛坱ime_slot=0锛�
+ // 路 鏅�氾紙鍚�**闈炲綋澶╅绾︾殑琛ョ**锛夆啋 鏈鏅�氬彿 鈫� 鏈棰勭暀鍙� 鈫� 鎬婚鐣欐睜
// 娌℃湁棰勭害鏃舵锛坆ookTimeslot 涓虹┖/0/瀛楀吀澶栵級鏃朵篃鑳界鍒帮細鐩存帴钀藉埌鎬婚鐣欐睜銆�
+ //
+ // 銆�2026-11-25 淇銆戦潪褰撳ぉ棰勭害鐨勮ˉ绛�**涓嶅啀**褰撲綔 VIP/棰勭暀鍙凤細
+ // 鍘熷厛 `vip = ... || !bookDateIsToday` 浼氳琛ョ鎮h�呮嬁鍒伴鐣欏彿锛�10銆�20銆�30鈥︼級锛�
+ // 鐜板満琛ㄧ幇涓哄悓涓�澶╃鍒扮殑涓や釜浜烘嬁鍒� A50銆丄60 杩欑"璺冲彿"锛屽尰鐢熻涓烘槸閲嶅彿/閿欏彿銆�
+ // 鐜板湪琛ョ鎮h�呬笌褰撳ぉ鎮h�呰蛋鍚屼竴鏉″彿搴忥紙绛惧埌搴忓彿瑙勫垯涓嬪氨鏄� A22銆丄23鈥� 杩炵画鍙凤級銆�
boolean urgent = isHisUrgent(appointment);
- boolean vip = isVipFlag || urgent || !bookDateIsToday;
+ boolean vip = isVipFlag || urgent;
Integer newSeqNo = queueSequenceService.distributeSeqNoByRule(
confirmReqVO.getBookCheckType(),
confirmReqVO.getBookTimeslot(),
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenServiceImpl.java
index 49812b1..6317fc4 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenServiceImpl.java
@@ -1,6 +1,7 @@
package cn.lihu.jh.module.ecg.service.callingscreen;
import cn.lihu.jh.framework.common.pojo.PageResult;
+import cn.lihu.jh.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.lihu.jh.module.ecg.Utils;
import cn.lihu.jh.module.ecg.controller.admin.checktype.vo.CheckTypePageReqVO;
import cn.lihu.jh.module.ecg.dal.dataobject.checktype.CheckTypeDO;
@@ -204,6 +205,18 @@
queueStatusList.add(QueueStatusEnum.PASSED_WAITING.getStatus());
queueStatusList.add(QueueStatusEnum.AFFINITY.getStatus());
List<QueueDO> queueDOList = queueMapper.getRoomQueueByStatus(roomId, queueStatusList);
+
+ // 銆愬叡浜�欒瘖姹犮�戝叡浜」鐩紙濡� 100/1100/1000锛夊噯澶囦腑鏃朵笉缁戝畾璇婂锛坮oom_id=0锛夛紝
+ // 涓婇潰鐨勬寜 room_id 鏌ヨ鏌ヤ笉鍒颁粬浠� 鈫� 1/2 璇婂灞忎細"鐪嬩笉鍒板噯澶囦腑鐨勭梾浜�"锛�2026-11-25 鍙嶉锛夈��
+ // 杩欓噷鎸夋湰璇婂寮�灞曠殑鍏变韩椤圭洰鎶婃睜涓�屽噯澶囦腑(20)銆嶈ˉ杩涙潵锛屾帓鍦ㄥ垪琛ㄦ渶鍓嶉潰銆�
+ Integer[] sharedOfRoom = getSharedCheckTypesOfRoom(roomId);
+ if (sharedOfRoom.length > 0) {
+ List<QueueDO> poolList = queueMapper.selectSharedList(QueueStatusEnum.READY.getStatus(), sharedOfRoom);
+ if (null != poolList && !poolList.isEmpty()) {
+ queueDOList.addAll(0, poolList);
+ }
+ }
+
// 闇�姹�1锛氬洖濉偅鑰呬俊鎭紙璇婇棿灞�-妫�鏌ラ槦鍒楋級
queueService.fillAppointmentInfo(queueDOList);
@@ -223,6 +236,35 @@
}
/**
+ * 鏈瘖瀹ゅ紑灞曠殑銆屽叡浜�欒瘖姹犮�嶆鏌ラ」鐩� = 鏈瘖瀹や换涓�宸ヤ綅鐨� check_types 鈭� check_type.share_pool=1銆�
+ * 鐢ㄤ簬鎶婃睜涓湭缁戝畾璇婂鐨勩�屽噯澶囦腑銆嶆偅鑰呰ˉ杩涜瘖闂村睆鍒楄〃銆�
+ */
+ private Integer[] getSharedCheckTypesOfRoom(Long roomId) {
+ if (null == roomId) {
+ return new Integer[0];
+ }
+ try {
+ List<CheckTypeDO> sharedList = checkTypeMapper.selectList(
+ new LambdaQueryWrapperX<CheckTypeDO>().eq(CheckTypeDO::getSharePool, true));
+ if (null == sharedList || sharedList.isEmpty()) {
+ return new Integer[0];
+ }
+ List<Integer> sharedValues = sharedList.stream().map(CheckTypeDO::getValue)
+ .filter(Objects::nonNull).toList();
+ List<RoomDO> beds = roomMapper.selectList(
+ new LambdaQueryWrapperX<RoomDO>().eq(RoomDO::getRoomId, roomId));
+ if (null == beds || beds.isEmpty() || null == beds.get(0).getCheckTypes()) {
+ return new Integer[0];
+ }
+ return Arrays.stream(beds.get(0).getCheckTypes()).filter(sharedValues::contains)
+ .distinct().toArray(Integer[]::new);
+ } catch (Exception e) {
+ log.warn("[getSharedCheckTypesOfRoom] 璇诲彇璇婂鍏变韩椤圭洰澶辫触锛屾寜鏃犲叡浜」鐩鐞�. roomId={}", roomId, e);
+ return new Integer[0];
+ }
+ }
+
+ /**
* 璇婇棿灞� 瀹夎鎮h�呭垪琛�
*/
@Override
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
index 8b21939..b76aa37 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
@@ -213,26 +213,65 @@
// 姝ゆ椂璁惧褰掕繕銆佷綔涓氳褰曠瓑浠嶄細姝e父淇濆瓨锛堟暟鎹笉涓級锛屼粎闃熷垪鐘舵�佹湭鍙樸��
QueueDO onStageQueueItem = null;
- // 鈶� 绮剧‘瀹氫綅锛堢敤 Spring 鐨� StringUtils锛岄伩鍏嶉澶栦緷璧栵紱
- // 鏈ā鍧楁湭寮曞叆 commons-lang3锛屽嬁鐢� org.apache.commons.lang3.StringUtils锛�
- if (org.springframework.util.StringUtils.hasText(createReqVO.getPatId())
- && null != createReqVO.getCheckType()) {
+ // 銆愭槸鍚﹀甫榻�"鎮h�� + 妫�鏌ラ」鐩�"銆戔�斺�斿喅瀹氫簡鑳戒笉鑳界簿纭攣瀹�"浠栨湰浜虹殑閭d竴琛�"
+ final boolean hasPatAndType = org.springframework.util.StringUtils.hasText(createReqVO.getPatId())
+ && null != createReqVO.getCheckType();
+
+ // 鈶� 绮剧‘瀹氫綅銆屽氨璇婁腑銆嶏紙姝e父鍙彿璺緞锛�
+ // 鐢� Spring 鐨� StringUtils锛岄伩鍏嶉澶栦緷璧栵紱鏈ā鍧楁湭寮曞叆 commons-lang3
+ if (hasPatAndType) {
onStageQueueItem = queueMapper.getBedQueueItemByPatAndStatus(
createReqVO.getRoomId(), createReqVO.getBedNo(),
createReqVO.getPatId(), createReqVO.getCheckType(),
QueueStatusEnum.ONSTAGE.getStatus());
}
- // 鈶� 閫�鍖栵細鍙栬宸ヤ綅浠婃棩鏈�杩戞洿鏂扮殑涓�鏉�"灏辫瘖涓�"
- if (null == onStageQueueItem) {
+ // 鈶燽 銆愭湰闇�姹偮蜂笉鍙彿鐩存帴妫�鏌ャ�戣鎮h��**娌℃湁**銆屽氨璇婁腑銆嶏紝浣嗘湰宸ヤ綅杩樻湁浠栫殑鎺掗槦琛�
+ // 锛堝噯澶囦腑 20 / 宸插彫鍥� 15 / 鎺掗槦涓� 10锛夆�斺�� 浠庡伐浣滃彴鍙充晶鍒楄〃鐐广�屾鏌ャ�嶅姞杞界殑鎮h�呭氨鏄繖绉嶏細
+ // 鍏ㄧ▼涓嶇疆 30锛堣姹備笉涓婂ぇ灞忋�佷笉鍙彿锛夛紝瀹屾垚妫�鏌ユ椂蹇呴』鎶婅繖鏉℃帓闃熻鏀跺熬锛�
+ // 鍚﹀垯浠栦細涓�鐩寸暀鍦ㄥ�欒瘖鍒楄〃鍜屽ぇ灞忎笂锛岃繕鍙兘琚埆浜哄啀鍙竴娆°��
+ if (null == onStageQueueItem && hasPatAndType) {
+ onStageQueueItem = queueMapper.getBedQueueItemByPatAndStatuses(
+ createReqVO.getRoomId(), createReqVO.getBedNo(),
+ createReqVO.getPatId(), createReqVO.getCheckType(),
+ List.of(QueueStatusEnum.WAITING.getStatus(),
+ QueueStatusEnum.RECALLED.getStatus(),
+ QueueStatusEnum.READY.getStatus()));
+ if (null != onStageQueueItem) {
+ log.info("[routineFinish] 璇ユ偅鑰呴潪銆屽氨璇婁腑銆�(褰撳墠鐘舵��={})锛屾寜鏈伐浣嶆帓闃熻鏀跺熬(鈫掑凡灏辫瘖). "
+ + "roomId={} bedNo={} patId={} checkType={}",
+ onStageQueueItem.getStatus(), createReqVO.getRoomId(), createReqVO.getBedNo(),
+ createReqVO.getPatId(), createReqVO.getCheckType());
+ }
+ }
+
+ // 鈶燾 銆愭湰闇�姹偮蜂笉鍙彿鐩存帴妫�鏌ャ�戝悓涓婏紝浣嗘偅鑰�**杩樻病鍒嗛厤宸ヤ綅**锛坆ed_no 涓虹┖锛夛細
+ // 鍖荤敓鍦ㄣ�屾湰璇婂鎺掗槦涓紙鏈垎閰嶅伐浣嶏級銆嶉噷鐩存帴鐐广�屾鏌ャ�嶅仛鎺夌殑閭d綅銆�
+ if (null == onStageQueueItem && hasPatAndType) {
+ onStageQueueItem = queueMapper.getUnassignedQueueItemByPatAndStatuses(
+ createReqVO.getPatId(), createReqVO.getCheckType(),
+ List.of(QueueStatusEnum.WAITING.getStatus()));
+ if (null != onStageQueueItem) {
+ log.info("[routineFinish] 鎮h�呭皻鏈垎閰嶅伐浣嶏紝鎸夋湭鍒嗛厤鎺掗槦琛屾敹灏�(鈫掑凡灏辫瘖). "
+ + "roomId={} bedNo={} patId={} checkType={}",
+ createReqVO.getRoomId(), createReqVO.getBedNo(),
+ createReqVO.getPatId(), createReqVO.getCheckType());
+ }
+ }
+
+ // 鈶� 閫�鍖栧厹搴曪細**浠呭綋璇锋眰娌″甫 patId/checkType 鏃�**鎵嶆寜宸ヤ綅鍙�"鏈�杩戜竴鏉″氨璇婁腑"銆�
+ //
+ // 銆愪负浠�涔堟敹绱с�戝師瀹炵幇鍙鎸� patId 娌″懡涓氨閫�鍖� 鈥斺�� 涓�鏃﹀尰鐢熸鍦ㄧ粰 A 鍋氭鏌ワ紙A 鏄氨璇婁腑锛夛紝
+ // 鍚屾椂鐢�"绱ф�ュ姞鍋� / 鍙充晶妫�鏌ユ寜閽�"缁� B 鍋氾紙B 娌℃湁灏辫瘖涓姸鎬侊級锛孊 瀹屾垚鏃跺氨浼氭妸 **A** 缃负
+ // 宸插氨璇�(40)锛屼汉杩樺湪搴婁笂鍋氱潃妫�鏌ュ嵈琚爣鎴愬仛瀹屼簡銆�
+ if (null == onStageQueueItem && !hasPatAndType) {
onStageQueueItem = queueMapper.getBedLatestQueueItemByStatus(
createReqVO.getRoomId(), createReqVO.getBedNo(), QueueStatusEnum.ONSTAGE.getStatus());
if (null != onStageQueueItem) {
- log.warn("[routineFinish] 鏈寜 patId 鍛戒腑锛岄��鍖栦负鎸夊伐浣嶅彇鏈�杩戝氨璇婁腑鎮h��. "
- + "roomId={} bedNo={} reqPatId={} reqCheckType={} 瀹為檯patId={} checkType={}",
- createReqVO.getRoomId(), createReqVO.getBedNo(), createReqVO.getPatId(),
- createReqVO.getCheckType(), onStageQueueItem.getPatId(),
- onStageQueueItem.getBookCheckType());
+ log.warn("[routineFinish] 璇锋眰鏈甫 patId/checkType锛岄��鍖栦负鎸夊伐浣嶅彇鏈�杩戝氨璇婁腑鎮h��. "
+ + "roomId={} bedNo={} 瀹為檯patId={} checkType={}",
+ createReqVO.getRoomId(), createReqVO.getBedNo(),
+ onStageQueueItem.getPatId(), onStageQueueItem.getBookCheckType());
}
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java
index e97c3eb..67575e9 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java
@@ -212,8 +212,16 @@
roomId, bedNo);
return new ArrayList<>();
}
- return queueMapper.selectUnassignedWaitingByCheckTypes(
- QueueStatusEnum.WAITING.getStatus(), bed.getCheckTypes());
+ List<QueueDO> result = new ArrayList<>();
+ // 銆愬叡浜�欒瘖姹犮�戝厛鏀炬睜涓�屽噯澶囦腑(20)鏈粦瀹氥�嶇殑鎮h�咃紙涓変釜璇婂鍏变韩锛�
+ Integer[] sharedOfBed = getSharedTypesOf(bed.getCheckTypes());
+ if (sharedOfBed.length > 0) {
+ result.addAll(queueMapper.selectSharedList(QueueStatusEnum.READY.getStatus(), sharedOfBed));
+ }
+ // 鍐嶆斁銆屾帓闃熶腑(10)鏈垎閰嶃�嶏紝淇濇寔鍘熷彛寰勶紙鏈伐浣嶅叏閮ㄦ鏌ラ」鐩級锛屼緵銆屾媺鍏ャ��
+ result.addAll(queueMapper.selectUnassignedWaitingByCheckTypes(
+ QueueStatusEnum.WAITING.getStatus(), bed.getCheckTypes()));
+ return result;
}
/**
@@ -687,6 +695,15 @@
}
patientStatisticVO.setQueuingNum(queuingNum);
+ // 銆愬叡浜�欒瘖姹犮�戞湰宸ヤ綅椤圭洰閲屻�佹睜涓�屽噯澶囦腑(20)鏈粦瀹氥�嶇殑浜烘暟锛堝彨鍙锋椂鍙洿鎺ュ彇锛�
+ Integer[] sharedOfBed = getSharedTypesOf(checkTypes);
+ if (sharedOfBed.length > 0) {
+ Integer sharedReady = queueMapper.countSharedPool(sharedOfBed);
+ patientStatisticVO.setSharedReadyNum(null == sharedReady ? 0 : sharedReady);
+ } else {
+ patientStatisticVO.setSharedReadyNum(0);
+ }
+
return patientStatisticVO;
}
@@ -788,6 +805,16 @@
public void closeBiz() {
queueServiceTxFunctions.setOpeningFlag(0);
+ // 銆愬叡浜�欒瘖姹犮�戦棴璇婃椂鎶婃睜閲屻�屽噯澶囦腑(20)鏈粦瀹氥�嶇殑鎮h�呴��鍥炴帓闃熶腑锛岄伩鍏嶈法澶╂粸鐣�
+ try {
+ Integer released = queueMapper.releaseSharedPoolToWaiting();
+ if (null != released && released > 0) {
+ log.info("[闂瘖] 鍏变韩鍊欒瘖姹犱腑 {} 浣嶃�屽噯澶囦腑銆嶆偅鑰呭凡閫�鍥炴帓闃熶腑", released);
+ }
+ } catch (Exception e) {
+ log.error("[闂瘖] 閫�鍥炲叡浜�欒瘖姹犲け璐ワ紙涓嶅奖鍝嶉棴璇婏級", e);
+ }
+
// 銆愭湰娆¢渶姹傘�戦棴璇婃椂娓呯┖褰撶彮宸ヤ綅锛坉oc_id / doc_name 缃┖锛岀姸鎬佹敼鍥炵┖闂诧級銆�
//
// 鑳屾櫙锛氬伐浣嶄笉鍐嶅洜銆岀┖闂茶秴鏃� / 浠ょ墝澶辨晥 / 鍒锋柊椤甸潰銆嶈閲婃斁锛堥伩鍏嶅尰鐢熺寮�涓�浼氬効灏变涪宸ヤ綅锛夛紝
@@ -805,7 +832,19 @@
@Override
public Integer recallPatient(Long roomId, String bedNo, String patId, Integer checkType) {
- Integer updateNum = queueMapper.recallPassedPatient(roomId, bedNo, patId, checkType, QueueStatusEnum.PASSED.getStatus(), QueueStatusEnum.RECALLED.getStatus());
+ // 銆愬叡浜�欒瘖姹犮�戝叡浜」鐩繃鍙峰彫鍥烇細涓嶅啀鍥炲師璇婂锛岃�屾槸鍥炲埌鍏变韩姹狅紙浠讳竴璇婂閮借兘鍙級
+ Integer updateNum;
+ if (isSharedCheckType(checkType)) {
+ updateNum = queueMapper.recallPassedPatientToPool(roomId, bedNo, patId, checkType,
+ QueueStatusEnum.PASSED.getStatus(), QueueStatusEnum.WAITING.getStatus());
+ if (null != updateNum && updateNum > 0) {
+ log.info("[recallPatient] 鍏变韩椤圭洰杩囧彿鍙洖锛氬凡鍥炲叡浜睜. 宸ヤ綅={}/{} patId={} checkType={}",
+ roomId, bedNo, patId, checkType);
+ }
+ } else {
+ updateNum = queueMapper.recallPassedPatient(roomId, bedNo, patId, checkType,
+ QueueStatusEnum.PASSED.getStatus(), QueueStatusEnum.RECALLED.getStatus());
+ }
// 妫�鏌ラ」鐩�.浜插拰鎬� 涓嶉渶瑕佸湪杩欓噷澶勭悊
// 浼氬湪 HurryUpOnBed 閲岄潰澶勭悊 妫�鏌ラ」鐩�.浜插拰鎬�
@@ -848,8 +887,11 @@
*/
@Override
public Integer undoFinishPatient(Long roomId, String bedNo, String patId, Integer checkType) {
- Integer updateNum = queueMapper.undoFinishPatient(roomId, bedNo, patId, checkType,
- QueueStatusEnum.FINISH.getStatus(), QueueStatusEnum.READY.getStatus());
+ // 銆愬叡浜�欒瘖姹犮�戝叡浜」鐩挙閿�瀹屾垚锛氬洖鍏变韩姹狅紙娓呯┖璇婂/宸ヤ綅锛夛紝涓嶅啀鎸傚湪鏈伐浣嶅�欒瘖鍖�
+ Integer updateNum = isSharedCheckType(checkType)
+ ? queueMapper.undoFinishToSharedPool(roomId, bedNo, patId, checkType)
+ : queueMapper.undoFinishPatient(roomId, bedNo, patId, checkType,
+ QueueStatusEnum.FINISH.getStatus(), QueueStatusEnum.READY.getStatus());
if (null != updateNum && updateNum > 0) {
startHurryUpOneBed(roomId, bedNo);
}
@@ -863,8 +905,17 @@
*/
@Override
public Integer undoCallPatient(Long roomId, String bedNo) {
- Integer updateNum = queueMapper.undoCallPatient(roomId, bedNo,
- QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.READY.getStatus());
+ // 銆愬叡浜�欒瘖姹犮�戝叡浜」鐩挙閿�鍙彿锛氬洖鍏变韩姹狅紙娓呯┖璇婂/宸ヤ綅锛夛紝鍏跺畠椤圭洰缁存寔鍘熼�昏緫锛堝洖鏈伐浣嶅�欒瘖鍖猴級
+ Integer updateNum;
+ List<QueueDO> onstageList = queueMapper.getBedQueueByStatus(roomId, bedNo,
+ Collections.singletonList(QueueStatusEnum.ONSTAGE.getStatus()));
+ if (null != onstageList && !onstageList.isEmpty()
+ && isSharedCheckType(onstageList.get(0).getBookCheckType())) {
+ updateNum = queueMapper.undoCallToSharedPool(onstageList.get(0).getId());
+ } else {
+ updateNum = queueMapper.undoCallPatient(roomId, bedNo,
+ QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.READY.getStatus());
+ }
if (null != updateNum && updateNum > 0) {
startHurryUpOneBed(roomId, bedNo);
}
@@ -1075,6 +1126,47 @@
return roomDO;
}
+ // ==================== 鍏变韩鍊欒瘖姹犺緟鍔╋紙璇﹁ _prep/鏂规-1-2璇婂鍏变韩鍊欒瘖姹�.md锛� ====================
+
+ /**
+ * 宸ヤ綅妫�鏌ラ」鐩腑灞炰簬銆屽叡浜�欒瘖姹犮�嶇殑閮ㄥ垎锛涙棤鍏变韩椤圭洰鏃惰繑鍥炵┖鏁扮粍銆�
+ */
+ private Integer[] getSharedTypesOf(Integer[] bedCheckTypes) {
+ if (null == bedCheckTypes || 0 == bedCheckTypes.length) {
+ return new Integer[0];
+ }
+ try {
+ List<CheckTypeDO> sharedList = checkTypeMapper.selectList(
+ new LambdaQueryWrapperX<CheckTypeDO>().eq(CheckTypeDO::getSharePool, true));
+ if (null == sharedList || sharedList.isEmpty()) {
+ return new Integer[0];
+ }
+ List<Integer> sharedValues = sharedList.stream().map(CheckTypeDO::getValue)
+ .filter(Objects::nonNull).toList();
+ return Arrays.stream(bedCheckTypes).filter(sharedValues::contains).distinct().toArray(Integer[]::new);
+ } catch (Exception e) {
+ log.warn("[getSharedTypesOf] 璇诲彇鍏变韩鍊欒瘖椤圭洰澶辫触锛屾寜鏃犲叡浜」鐩鐞�", e);
+ return new Integer[0];
+ }
+ }
+
+ /**
+ * 璇ユ鏌ラ」鐩槸鍚﹀睘浜庡叡浜�欒瘖姹狅紙鍏变韩椤圭洰涓嶉鍏堢粦瀹氳瘖瀹わ紝鍙彿鏃舵墠缁戝畾锛夈��
+ */
+ private boolean isSharedCheckType(Integer checkType) {
+ if (null == checkType) {
+ return false;
+ }
+ try {
+ CheckTypeDO checkTypeDO = checkTypeMapper.getCheckTypeByValue(checkType);
+ return null != checkTypeDO && Boolean.TRUE.equals(checkTypeDO.getSharePool());
+ } catch (Exception e) {
+ log.warn("[isSharedCheckType] 璇诲彇妫�鏌ラ」鐩厤缃け璐ワ紝鎸夐潪鍏变韩澶勭悊. checkType={}", checkType, e);
+ return false;
+ }
+ }
+
+
/**
* 瑁呮満鍙洖锛屾槸鎶㈠崰寮忕殑锛屼細鏀瑰彉瑁呮満宸ヤ綅
*/
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java
index a30c9b0..00b1a6d 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java
@@ -8,6 +8,7 @@
import cn.lihu.jh.module.ecg.dal.dataobject.checktype.CheckTypeDO;
import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO;
+import cn.lihu.jh.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.lihu.jh.module.ecg.dal.mysql.call.CallMapper;
import cn.lihu.jh.module.ecg.dal.mysql.checktype.CheckTypeMapper;
import cn.lihu.jh.module.ecg.dal.mysql.devrent.DevRentMapper;
@@ -354,11 +355,14 @@
log.warn("[pullWaitingPatient] 鎺掗槦琛屼笉瀛樺湪. queueId={}", queueId);
return QUEUE_NOT_EXISTS;
}
- if (!QueueStatusEnum.WAITING.getStatus().equals(item.getStatus())) {
- log.warn("[pullWaitingPatient] 璇ユ偅鑰呭凡涓嶅湪鎺掗槦涓�. queueId={} patId={} status={}",
+ if (!QueueStatusEnum.WAITING.getStatus().equals(item.getStatus())
+ && !isUnboundReady(item)) {
+ log.warn("[pullWaitingPatient] 璇ユ偅鑰呭凡涓嶅湪鎺掗槦涓�/鍏变韩姹�. queueId={} patId={} status={}",
queueId, item.getPatId(), item.getStatus());
return QUEUE_NOT_WAITING;
}
+ // 銆愬叡浜�欒瘖姹犮�戞睜涓�屽噯澶囦腑(20)鏈粦瀹氥�嶄篃鍏佽鎷夊叆锛氱洿鎺ョ粦瀹氬埌鏈伐浣嶏紙鐘舵�佷繚鎸� 20锛�
+ boolean fromSharedPool = isUnboundReady(item);
Integer[] bedCheckTypes = bed.getCheckTypes();
if (null == bedCheckTypes || 0 == bedCheckTypes.length
|| null == item.getBookCheckType()
@@ -368,8 +372,10 @@
return QUEUE_CHECK_TYPE_NOT_MATCH;
}
- Integer updateNum = queueMapper.preemptWaitingPatientById(queueId, roomId, bed.getRoomName(), bedNo,
- QueueStatusEnum.WAITING.getStatus(), QueueStatusEnum.READY.getStatus());
+ Integer updateNum = fromSharedPool
+ ? queueMapper.bindSharedPoolItem(queueId, roomId, bed.getRoomName(), bedNo)
+ : queueMapper.preemptWaitingPatientById(queueId, roomId, bed.getRoomName(), bedNo,
+ QueueStatusEnum.WAITING.getStatus(), QueueStatusEnum.READY.getStatus());
if (null == updateNum || 0 == updateNum) {
log.warn("[pullWaitingPatient] 鎷夊叆鏈敓鏁堬紙宸茶鍏朵粬宸ヤ綅鎷夎蛋锛�. queueId={}", queueId);
return QUEUE_NOT_WAITING;
@@ -392,9 +398,23 @@
log.error("[pullWaitingPatient] 浜插拰椤瑰鐞嗗け璐ワ紙涓婚」宸叉媺鍏ワ級. queueId={}", queueId, e);
}
- log.info("[pullWaitingPatient] 宸叉墜宸ユ媺鍏�. roomId={} bedNo={} queueId={} patId={} seqNum={}",
- roomId, bedNo, queueId, item.getPatId(), item.getSeqNum());
+ log.info("[pullWaitingPatient] 宸叉墜宸ユ媺鍏�. roomId={} bedNo={} queueId={} patId={} seqNum={} 鏉ヨ嚜鍏变韩姹�={}",
+ roomId, bedNo, queueId, item.getPatId(), item.getSeqNum(), fromSharedPool);
+
+ // 鍏变韩姹犻噷灏戜簡涓�浣嶏紝绔嬪埢琛ユ睜锛堥潪鍏变韩椤圭洰璋冪敤涔熸棤鍓綔鐢級
+ try {
+ hurryupSharedPool();
+ } catch (Exception e) {
+ log.error("[pullWaitingPatient] 琛ュ叡浜睜澶辫触锛堜笉褰卞搷鎷夊叆缁撴灉锛�. roomId={} bedNo={}", roomId, bedNo, e);
+ }
return GlobalErrorCodeConstants.SUCCESS;
+ }
+
+ /** 姹犱腑銆屽噯澶囦腑(20) 涓旀湭缁戝畾璇婂銆嶇殑琛� */
+ private boolean isUnboundReady(QueueDO item) {
+ return null != item
+ && QueueStatusEnum.READY.getStatus().equals(item.getStatus())
+ && (null == item.getBedNo() || item.getBedNo().trim().isEmpty());
}
/** 鎷间竴琛屽伐浣嶅叧閿瓧娈碉紝渚涙棩蹇�/鎺掓煡蹇�熷姣旓紙灏ゅ叾鐪� bed_no 鏄惁涓庤姹備竴鑷达級 */
@@ -454,6 +474,9 @@
removeBedFromRoutingQueue(bedBO);
bedBO.setStatus(BedStatusEnum.OPENING.getStatus());
+ // 銆愪慨澶嵚风幇鍦洪棶棰樸�戞竻绌哄伐浣嶅悗蹇呴』鎶婃偅鑰呴��鍥炪�屾帓闃熶腑銆嶏紝
+ // 鍚﹀垯浠栦滑浼�"鎸�"鍦ㄤ竴涓病浜哄潗鐨勫伐浣嶄笂锛氬埆鐨勮瘖瀹ょ湅涓嶅埌锛堝凡涓嶆槸鎺掗槦涓級銆佷篃鎷変笉鍔ㄣ��
+ releaseBedPatientsToQueue(roomId, bedNo);
log.info("[绠$悊鍛樻竻绌哄伐浣峕 roomId={} bedNo={} 宸茬疆涓虹┖闂�", roomId, bedNo);
return GlobalErrorCodeConstants.SUCCESS;
}
@@ -479,6 +502,9 @@
|| Objects.equals(BedStatusEnum.DOCTOR_PAUSE.getStatus(), bedBO.getStatus())) {
removeBedFromRoutingQueue(bedBO);
bedBO.setStatus(BedStatusEnum.OPENING.getStatus());
+ // 銆愪慨澶嵚风幇鍦洪棶棰樸�戦棴璇婂悗宸ヤ綅灏辨病浜轰簡锛屾偅鑰呭繀椤婚��鍥炪�屾帓闃熶腑銆嶏紝
+ // 鍚﹀垯鏁存櫄"澶辫釜"锛岀浜屽ぉ寮�璇婁篃鍙兘骞茬瓑銆�
+ releaseBedPatientsToQueue(bedBO.getRoomId(), bedBO.getBedNo());
}
}
log.info("[闂瘖] 宸叉竻绌哄綋鐝伐浣� {} 涓紙doc_id / doc_name 缃┖锛岀姸鎬佹敼涓虹┖闂诧級",
@@ -549,7 +575,11 @@
// 璇ュ伐浣嶆棦娌℃湁 [鍊欒瘖涓璢 涔熸病鏈� [宸插彫鍥瀅 浜哄憳
if (null == firstQueueItem) {
- return QUEUE_NOT_READY_PATIENT;
+ // 銆愬叡浜�欒瘖姹犮�戞湰宸ヤ綅娌℃湁宸茬粦瀹氱殑鍊欒瘖/宸插彫鍥炴椂锛屼粠鍏变韩姹犲彇浜猴細
+ // 鍏堝彇銆屽噯澶囦腑(20) 鏈粦瀹氥�嶏紝姹犵┖鍐嶅彇銆屾帓闃熶腑(10) 鏈粦瀹氥�嶅厹搴曘��
+ // 鍙栧埌浜烘椂鐢ㄤ竴娆″師瀛愭洿鏂扮粦瀹氭湰宸ヤ綅锛堜袱涓瘖瀹ゅ悓鏃跺彨涔熶笉浼氶噸澶嶏級銆�
+ ErrorCode sharedResult = takeSharedPoolPatient(roomId, bedNo);
+ return null != sharedResult ? sharedResult : QUEUE_NOT_READY_PATIENT;
}
// 鈶� READY / RECALLED => ONSTAGE锛氱敤銆屼富閿� + 褰撳墠鐘舵�併�嶆潯浠舵洿鏂帮紙骞跺彂鍔犲浐锛夛紝
@@ -635,6 +665,18 @@
&& !Boolean.TRUE.equals(item.getStopReady())) {
addBedToRoutingQueue(item);
}
+
+ // 銆愪慨澶嵚风幇鍦洪棶棰� 2026-11-11銆戙�屽凡寮�閫氫絾娌′汉銆嶇殑宸ヤ綅**涓嶅簲璇ユ寔鏈夋偅鑰�**銆�
+ //
+ // 鍘嗗彶閬楃暀锛堟棫鐗堟湰鐨勬暣浣撹ˉ浜轰笉鐪嬫湁娌℃湁鍖荤敓锛変細鎶婃偅鑰呮帹杩涚┖宸ヤ綅锛屼箣鍚庝粬浠�
+ // 鏃笉鍦ㄤ换浣曞尰鐢熺殑鍊欒瘖鍒楄〃閲岋紝涔熶笉鍦ㄣ�屾湰璇婂鎺掗槦涓紙鏈垎閰嶏級銆嶉噷锛屾媺涔熸媺涓嶅姩
+ // 鈥斺�� 鍙兘绛夋瘡鏃ラ噸缃�傝繖閲屽湪姣忔寮�璇�/閲嶅惎瑁呰浇鏃舵妸杩欑被"瀛ゅ効鎮h��"閫�鍥炴帓闃熸睜锛�
+ // 鐢遍殢鍚庣殑 hurryupAllBed() 閲嶆柊鍒嗙粰**鐪熸鏈夊尰鐢熷湪搴�**鐨勫伐浣嶃��
+ //
+ // 鍙鐞嗐�屽凡寮�閫�(OPENING)銆嶏細鍖荤敓鍙槸銆屾殏鍋溿�嶆椂浜鸿繕鍦紝鎮h�呭簲鐣欑粰浠栥��
+ if (Objects.equals(BedStatusEnum.OPENING.getStatus(), item.getStatus())) {
+ releaseBedPatientsToQueue(item.getRoomId(), item.getBedNo());
+ }
});
// 銆愬彿缁熶竴锛堟湰闇�姹傦級銆戜笉鍐嶅垵濮嬪寲鍐呭瓨璁℃暟鍣� curSeqNum锛�
@@ -704,9 +746,36 @@
return;
}
+ // 銆愬叡浜�欒瘖姹犮�戜笌鍏蜂綋宸ヤ綅鏃犲叧锛氫换浣曡ˉ浜鸿Е鍙戦兘椤哄甫琛ヤ竴娆℃睜銆�
+ // 鍐呴儴浼氬垽鏂�"鏄惁鏈夊叡浜瘖瀹ゅ湪搴�"锛屾病鏈夊尰鐢熷湪搴ф椂涓嶄細棰勫憡鍑嗗鎮h�呫��
+ try {
+ hurryupSharedPool();
+ } catch (Exception e) {
+ log.error("[琛ヤ汉] 濉厖鍏变韩鍊欒瘖姹犲け璐ワ紙涓嶅奖鍝嶆湰宸ヤ綅琛ヤ汉锛�. 宸ヤ綅={}/{}", roomId, bedNo, e);
+ }
+
BedBO bedBO = getBedQueueBO(roomId, bedNo);
if (null == bedBO) {
log.warn("[琛ヤ汉] 宸ヤ綅涓嶅湪銆屽凡寮�璇婂伐浣嶃�嶅垪琛ㄤ腑锛岃烦杩�. 宸ヤ綅={}/{}", roomId, bedNo);
+ return;
+ }
+
+ // ========================================================================
+ // 銆愪慨澶嵚风幇鍦洪棶棰� 2026-11-11銆戝彧鏈夈�屽尰鐢熷湪搴�(DOCTOR_ON)銆嶇殑宸ヤ綅鎵嶈ˉ浜恒��
+ //
+ // 鏈柟娉曚細琚� 寮�璇� / 鏈嶅姟閲嶅惎 / 鍗曞伐浣嶅紑璇� / 鍙彿 / 妫�鏌ュ畬鎴� 瑙﹀彂锛�
+ // 鍘熷疄鐜�**涓嶇湅宸ヤ綅鏈夋病鏈夊尰鐢�**锛屼簬鏄�"宸插紑閫氫絾娌′汉"鐨勫伐浣嶄篃浼氳濉炴弧鍊欒瘖鎮h�呫��
+ // 鐜板満瀹炰緥锛�2026-11-11 閲嶅惎鍚庣殑鏁翠綋琛ヤ汉锛屾妸 2 浣嶅父瑙勫績鐢靛浘鎮h�呮帹杩涗簡
+ // 绌虹潃鐨勩��1璇婂 A1銆嶁�斺�擜1 鏃犱汉锛屽埆鐨勮瘖瀹ゆ棦鐪嬩笉鍒颁粬浠紙宸蹭笉鏄�"鎺掗槦涓�"锛�
+ // 涓嶅湪銆屾湰璇婂鎺掗槦涓紙鏈垎閰嶏級銆嶉噷锛夛紝涔熴�屾媺鍏ャ�嶄笉浜嗭紙鎷夊叆鍙帴鍙楁帓闃熶腑锛夛紝
+ // 鎮h�呯瓑浜�"娑堝け"锛屽彧鑳界瓑姣忔棩閲嶇疆銆�
+ //
+ // 涓� addBedToRoutingQueue() 鍙敹 DOCTOR_ON 鐨勫彛寰勪繚鎸佷竴鑷达細
+ // 鏈湪搴�(OPENING) / 鏆傚仠(DOCTOR_PAUSE) 涓�寰嬩笉琛ヤ汉銆�
+ // ========================================================================
+ if (!Objects.equals(BedStatusEnum.DOCTOR_ON.getStatus(), bedBO.getStatus())) {
+ log.debug("[琛ヤ汉] 宸ヤ綅闈炪�屽尰鐢熷湪搴с��(status={})锛岃烦杩囪嚜鍔ㄨˉ浜�. 宸ヤ綅={}/{}",
+ bedBO.getStatus(), roomId, bedNo);
return;
}
@@ -771,6 +840,14 @@
// 鍙鏈変汉棰勭害纭 / 鍔犳�ワ紝鎮h�呬粛浼氳鎺ㄨ繘鍊欒瘖鍖恒��
if (0 == openingFlag.get())
return;
+
+ // 銆愬叡浜�欒瘖姹犮�戝叡浜」鐩笉鍙備笌"鎸夋鏌ラ」鐩姠鍗犲伐浣�"锛岀粺涓�杩涘叡浜睜锛�
+ // 鐢卞紑灞曡椤圭洰鐨勮瘖瀹ゅ湪鍙彿鏃剁粦瀹氾紙璇﹁ _prep/鏂规-1-2璇婂鍏变韩鍊欒瘖姹�.md锛夈��
+ Integer[] sharedValues = getSharedCheckTypeValues();
+ if (Arrays.asList(sharedValues).contains(checkType)) {
+ hurryupSharedPool();
+ return;
+ }
PriorityBlockingQueue<BedBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
if (null == routingQueue)
@@ -901,13 +978,18 @@
return;
}
int pulledNum = 0;
+ // 銆愬叡浜�欒瘖姹犮�戞湰宸ヤ綅鍙"闈炲叡浜」鐩�"鍋氳嚜鍔ㄥ垎娴侊紱鍏变韩椤圭洰缁熶竴杩涙睜銆佸彨鍙锋椂鎵嶇粦瀹氥��
+ Integer[] routableCheckTypes = getRoutableCheckTypes(bedBO.getCheckTypes(), getSharedCheckTypeValues());
+ if (0 == routableCheckTypes.length) {
+ return;
+ }
while (bedBO.getReadyPatNum() < bedBO.getMaxReadyPatNum()) {
// 鎶㈠崰 鏄惁鏈夋帓闃熶腑鐨勬偅鑰�
//
// 銆愬彿缁熶竴锛堟湰闇�姹傦級銆戜笌 hurryupOneCheckType 鐩稿悓锛氬彧鎼縼鐘舵�侊紝**涓嶅啀鍒嗛厤鎺掗槦鍙�**銆�
QueueDO preemptQueueItem = queueMapper.getFirstWaitingByCheckTypes(
QueueStatusEnum.WAITING.getStatus(),
- bedBO.checkTypes);
+ routableCheckTypes);
// 娌℃湁鎺掗槦涓殑鎮h��
if (null == preemptQueueItem) {
@@ -999,6 +1081,11 @@
data.put("缁撹", "鏈伐浣嶅紑浜嗐�屽仠姝㈠�欒瘖銆嶏紝鏈鏈ˉ浜猴紱濡傞渶鎺ユ敹鎮h�呰鍏抽棴璇ュ紑鍏�");
return data;
}
+ if (!Objects.equals(BedStatusEnum.DOCTOR_ON.getStatus(), bedBO.getStatus())) {
+ data.put("缁撹", "鏈伐浣嶅綋鍓嶄笉鏄�屽尰鐢熷湪搴с�嶇姸鎬侊紙status=" + bedBO.getStatus()
+ + "锛夛紝涓嶄細琛ヤ汉锛涜鍏堝叆搴ц宸ヤ綅");
+ return data;
+ }
hurryupOneBed(roomId, bedNo);
@@ -1074,7 +1161,13 @@
* </ul>
*/
private Integer getBedReadyMax(BedBO bedBO) {
- Integer[] checkTypes = bedBO.getCheckTypes();
+ return getReadyMaxByCheckTypes(bedBO.getCheckTypes());
+ }
+
+ /**
+ * 涓�缁勬鏌ラ」鐩殑銆屽�欒瘖鍑嗗浜烘暟銆嶆渶澶у�硷紙鍘� {@link #getBedReadyMax} 鐨勯�昏緫锛岃劚绂� BedBO锛屼緵鍏变韩姹犵畻瀹归噺澶嶇敤锛夈��
+ */
+ private Integer getReadyMaxByCheckTypes(Integer[] checkTypes) {
if (null == checkTypes || 0 == checkTypes.length) {
return 0;
}
@@ -1087,19 +1180,185 @@
checkTypeDO = getCheckTypeItem(checkType);
}
if (null == checkTypeDO) {
- log.warn("[getBedReadyMax] 妫�鏌ラ」鐩湪 check_type 閲屼笉瀛樺湪锛岃烦杩囷紙鎸� 0 璁★級. checkType={} 宸ヤ綅={}/{}",
- checkType, bedBO.getRoomId(), bedBO.getBedNo());
+ log.warn("[getReadyMaxByCheckTypes] 妫�鏌ラ」鐩湪 check_type 閲屼笉瀛樺湪锛岃烦杩囷紙鎸� 0 璁★級. checkType={}",
+ checkType);
continue;
}
Integer tmp = checkTypeDO.getReadyNum();
if (null == tmp) {
- log.warn("[getBedReadyMax] 妫�鏌ラ」鐩甗鍊欒瘖鍑嗗浜烘暟]涓虹┖锛岃烦杩�. checkType={} name={}",
+ log.warn("[getReadyMaxByCheckTypes] 妫�鏌ラ」鐩甗鍊欒瘖鍑嗗浜烘暟]涓虹┖锛岃烦杩�. checkType={} name={}",
checkType, checkTypeDO.getName());
continue;
}
ret = Math.max(ret, tmp); //銆愬�欒瘖涓�戞暟閲� 鍙栧ぇ鍊�
}
return ret;
+ }
+
+ // ==================== 鍏变韩鍊欒瘖姹狅紙check_type.share_pool = 1锛� ====================
+ // 璇﹁ _prep/鏂规-1-2璇婂鍏变韩鍊欒瘖姹�.md锛�
+ // 鍏变韩椤圭洰鐨勬偅鑰呬笉棰勫厛缁戝畾璇婂锛岃�屾槸鍋滅暀鍦ㄥ叡浜睜锛坰tatus=20銆乥ed_no 涓虹┖锛夛紝
+ // 鐢卞紑灞曡椤圭洰鐨勪换涓�璇婂鍦ㄣ�屽彨鍙枫�嶆椂鐢ㄥ師瀛愭洿鏂扮粦瀹氳瘖瀹ゃ��
+
+ /**
+ * 鍏变韩姹犻」鐩殑 check_type 鍊奸泦鍚堬紙瀹炴椂璇诲簱锛涙煡涓嶅埌杩斿洖绌烘暟缁勶級銆�
+ */
+ private Integer[] getSharedCheckTypeValues() {
+ try {
+ List<CheckTypeDO> list = checkTypeMapper.selectList(
+ new LambdaQueryWrapperX<CheckTypeDO>().eq(CheckTypeDO::getSharePool, true));
+ if (null == list || list.isEmpty()) {
+ return new Integer[0];
+ }
+ return list.stream().map(CheckTypeDO::getValue).filter(Objects::nonNull).distinct()
+ .toArray(Integer[]::new);
+ } catch (Exception e) {
+ log.warn("[getSharedCheckTypeValues] 璇诲彇鍏变韩鍊欒瘖椤圭洰澶辫触锛屾湰娆℃寜鏃犲叡浜」鐩鐞�", e);
+ return new Integer[0];
+ }
+ }
+
+ /**
+ * 宸ヤ綅妫�鏌ラ」鐩腑灞炰簬鍏变韩姹犵殑閮ㄥ垎銆�
+ */
+ private Integer[] getSharedCheckTypesOf(Integer[] bedCheckTypes, Integer[] sharedValues) {
+ if (null == bedCheckTypes || 0 == bedCheckTypes.length
+ || null == sharedValues || 0 == sharedValues.length) {
+ return new Integer[0];
+ }
+ List<Integer> sharedList = Arrays.asList(sharedValues);
+ return Arrays.stream(bedCheckTypes).filter(sharedList::contains).distinct().toArray(Integer[]::new);
+ }
+
+ /**
+ * 宸ヤ綅鍙嚜鍔ㄥ垎娴佺殑妫�鏌ラ」鐩� = 鍏ㄩ儴椤圭洰 - 鍏变韩椤圭洰锛堝叡浜」鐩敱鍏变韩姹犵粺涓�绠$悊锛夈��
+ */
+ private Integer[] getRoutableCheckTypes(Integer[] bedCheckTypes, Integer[] sharedValues) {
+ if (null == bedCheckTypes || 0 == bedCheckTypes.length) {
+ return new Integer[0];
+ }
+ if (null == sharedValues || 0 == sharedValues.length) {
+ return bedCheckTypes;
+ }
+ List<Integer> sharedList = Arrays.asList(sharedValues);
+ return Arrays.stream(bedCheckTypes).filter(t -> !sharedList.contains(t)).distinct().toArray(Integer[]::new);
+ }
+
+ /**
+ * 鍏变韩姹犲閲� = 鍚勫叡浜瘖瀹ゃ�屽�欒瘖鍑嗗浜烘暟銆嶇殑鏈�澶у�笺��
+ *
+ * <p>杩斿洖 0 鐨勪袱绉嶆儏鍐碉紙姝ゆ椂涓嶉鍑嗗鎮h�咃級锛�
+ * <ul>
+ * <li>娌℃湁浠讳綍鍏变韩璇婂锛�</li>
+ * <li>娌℃湁浠讳綍鍏变韩璇婂澶勪簬銆屾湁鍖荤敓鍦ㄥ骇(DOCTOR_ON)銆嶁�斺�� 娌″尰鐢熸椂涓嶅線姹犻噷鍑嗗浜恒��</li>
+ * </ul>
+ */
+ private int getSharedPoolCap(Integer[] sharedValues) {
+ if (null == sharedValues || 0 == sharedValues.length) {
+ return 0;
+ }
+ List<Integer> sharedList = Arrays.asList(sharedValues);
+ int cap = 0;
+ boolean anyDoctorOn = false;
+ List<RoomDO> rooms = roomMapper.selectList(new LambdaQueryWrapperX<RoomDO>());
+ if (null == rooms) {
+ return 0;
+ }
+ for (RoomDO room : rooms) {
+ Integer[] types = room.getCheckTypes();
+ if (null == types || 0 == types.length) {
+ continue;
+ }
+ if (Arrays.stream(types).noneMatch(sharedList::contains)) {
+ continue;
+ }
+ cap = Math.max(cap, getReadyMaxByCheckTypes(types));
+ if (Objects.equals(BedStatusEnum.DOCTOR_ON.getStatus(), room.getStatus())) {
+ anyDoctorOn = true;
+ }
+ }
+ return anyDoctorOn ? cap : 0;
+ }
+
+ /**
+ * 濉厖鍏变韩鍊欒瘖姹狅細鎶娿�屾帓闃熶腑(10)銆嶆彁鍗囦负銆屽噯澶囦腑(20)銆嶏紙涓嶇粦瀹氳瘖瀹わ級锛屾渶澶� poolCap 浜恒��
+ *
+ * <p>瑙﹀彂锛氬紑璇� / 鍙彿 / 妫�鏌ュ畬鎴� / 鍙洖 / 鎾ら攢 / 鍛ㄦ湡鍏滃簳锛堢粺涓�鐢� hurryupOneBed 瑙﹀彂锛夈��
+ * <p>骞跺彂锛氭彁鍗囩敤 {@code update ... where id=? and status=10}锛屾姠涓嶅埌灏卞彇涓嬩竴浣嶃��
+ */
+ public void hurryupSharedPool() {
+ if (0 == openingFlag.get()) {
+ return;
+ }
+ Integer[] sharedValues = getSharedCheckTypeValues();
+ if (0 == sharedValues.length) {
+ return;
+ }
+ int cap = getSharedPoolCap(sharedValues);
+ if (cap <= 0) {
+ return;
+ }
+ Integer poolNum = queueMapper.countSharedPool(sharedValues);
+ int n = null == poolNum ? 0 : poolNum;
+ int guard = 0;
+ while (n < cap && guard++ < cap + 5) {
+ QueueDO item = queueMapper.selectSharedFirst(QueueStatusEnum.WAITING.getStatus(), sharedValues);
+ if (null == item) {
+ return;
+ }
+ Integer updated = queueMapper.promoteToSharedPool(item.getId());
+ if (null == updated || 0 == updated) {
+ continue; // 琚叾瀹冪嚎绋嬫姠璧帮紝鍙栦笅涓�浣�
+ }
+ n++;
+ log.info("[鍏变韩姹燷 鎻愬崌涓哄噯澶囦腑. queueId={} patId={} checkType={} seqNum={} 姹犲唴={}/{}",
+ item.getId(), item.getPatId(), item.getBookCheckType(), item.getSeqNum(), n, cap);
+ }
+ }
+
+ /**
+ * 浠庡叡浜睜鍙栦汉鍙彿锛堜緵 {@link #nextPatient} 鍦ㄣ�屾湰宸ヤ綅鏃犲凡缁戝畾鍊欒瘖/宸插彫鍥炪�嶆椂璋冪敤锛夈��
+ *
+ * @return 鎴愬姛杩斿洖 SUCCESS锛涙湰宸ヤ綅娌℃湁鍏变韩椤圭洰杩斿洖 {@code null}锛堣璋冪敤鏂硅蛋鍘熸湁"鏃犳偅鑰�"鍒嗘敮锛夛紱
+ * 姹犱笌鎺掗槦涓兘娌℃湁浜鸿繑鍥� QUEUE_NOT_READY_PATIENT銆�
+ */
+ private ErrorCode takeSharedPoolPatient(Long roomId, String bedNo) {
+ Integer[] sharedValues = getSharedCheckTypeValues();
+ if (0 == sharedValues.length) {
+ return null;
+ }
+ RoomDO room = roomMapper.getRoom(roomId, bedNo);
+ if (null == room) {
+ return null;
+ }
+ Integer[] sharedOfBed = getSharedCheckTypesOf(room.getCheckTypes(), sharedValues);
+ if (0 == sharedOfBed.length) {
+ return null;
+ }
+ // 骞跺彂涓嬫睜閲岄偅涓�琛屽彲鑳藉垰琚彟涓�涓瘖瀹ゅ彨璧帮紝鏈�澶氶噸璇� 3 娆�
+ for (int attempt = 0; attempt < 3; attempt++) {
+ QueueDO item = queueMapper.selectSharedFirst(QueueStatusEnum.READY.getStatus(), sharedOfBed);
+ int expect = QueueStatusEnum.READY.getStatus();
+ if (null == item) {
+ item = queueMapper.selectSharedFirst(QueueStatusEnum.WAITING.getStatus(), sharedOfBed);
+ expect = QueueStatusEnum.WAITING.getStatus();
+ }
+ if (null == item) {
+ return QUEUE_NOT_READY_PATIENT;
+ }
+ Integer updated = queueMapper.callSharedItem(item.getId(), roomId, room.getRoomName(), bedNo, expect);
+ if (null != updated && updated > 0) {
+ log.info("[nextPatient] 浠庡叡浜睜鍙彿. 宸ヤ綅={}/{} patId={} checkType={} seqNum={} 鏉ユ簮鐘舵��={}",
+ roomId, bedNo, item.getPatId(), item.getBookCheckType(), item.getSeqNum(), expect);
+ try {
+ hurryupSharedPool(); // 鍙蛋涓�浣嶏紝绔嬪埢琛ユ睜
+ } catch (Exception e) {
+ log.error("[nextPatient] 鍙彿鍚庤ˉ鍏变韩姹犲け璐ワ紙涓嶅奖鍝嶅彨鍙风粨鏋滐級. 宸ヤ綅={}/{}", roomId, bedNo, e);
+ }
+ return GlobalErrorCodeConstants.SUCCESS;
+ }
+ }
+ return QUEUE_NOT_READY_PATIENT;
}
/**
@@ -1156,7 +1415,9 @@
null == bedBO.getCheckTypes() ? "[]" : java.util.Arrays.toString(bedBO.getCheckTypes()));
Integer[] checkTypes = bedBO.getCheckTypes();
- Arrays.stream(checkTypes).forEach(checkType -> {
+ // 銆愬叡浜�欒瘖姹犮�戝叡浜」鐩笉杩�"鎸夋鏌ラ」鐩殑鍒嗘祦闃熷垪"锛屽惁鍒欎細琚嚜鍔ㄥ垎鍒版棤浜鸿瘖瀹�
+ List<Integer> sharedCheckTypeList = Arrays.asList(getSharedCheckTypeValues());
+ Arrays.stream(checkTypes).filter(checkType -> !sharedCheckTypeList.contains(checkType)).forEach(checkType -> {
CheckTypeDO checkTypeDO = mapCheckTypeVsReadyMax.get(checkType);
PriorityBlockingQueue<BedBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
if (null == routingQueue) {
@@ -1172,6 +1433,47 @@
});
}
+ /**
+ * 銆愪慨澶嵚风幇鍦洪棶棰� 2026-11-11銆戞妸鏌愬伐浣嶄笂銆岃繕娌″仛瀹屻�嶇殑鎮h��**閫�鍥炪�屾帓闃熶腑銆�**锛屼緵鍏跺畠璇婂閲嶆柊鍒嗘祦銆�
+ *
+ * <p>鑳屾櫙锛氬伐浣嶄竴鏃︽病浜猴紙绠$悊鍛樻竻绌� / 闂瘖锛夛紝鎸傚湪瀹冧笂闈㈢殑銆屽噯澶囦腑(20)銆嶆偅鑰呭氨鎴愪簡"瀛ゅ効"锛�
+ * <ul>
+ * <li>涓嶅湪浠讳綍鍖荤敓鐨勫�欒瘖鍒楄〃閲岋紙閭d簺鍒楄〃鎸� {@code room_id + bed_no} 鏌ワ級锛�</li>
+ * <li>涔熶笉鍦ㄣ�屾湰璇婂鎺掗槦涓紙鏈垎閰嶏級銆嶉噷锛堥偅涓垎鍖哄彧鏌� {@code status=10 涓� bed_no 涓虹┖}锛夛紱</li>
+ * <li>銆屾媺鍏ャ�嶄篃鎷変笉鍔紙{@code pullWaitingPatient} 鍙帴鍙� {@code status=10}锛夈��</li>
+ * </ul>
+ * 缁撴灉鍙兘绛夋瘡鏃ラ噸缃紝鐜板満琛ㄧ幇灏辨槸"鎮h�呭嚟绌烘秷澶�"銆�
+ *
+ * <p>閲婃斁鑼冨洿锛氬噯澶囦腑(20)銆佸凡鍙洖(15)銆佷翰鍜�(12)銆�
+ * 浜插拰椤瑰悓鏃舵妸 {@code affinity_item} 澶嶄綅涓� 0锛屼笅娆¤鍒嗘祦鏃朵細鐢变翰鍜岄�昏緫閲嶆柊鎸傚埌涓婚」涓娿��
+ * <b>涓嶅姩</b>銆屽氨璇婁腑(30)銆嶁�斺�旀鍦ㄥ仛鐨勭梾浜轰笉鑳借鎮勬倓閫�闃燂紱姝ゆ椂涔熶笉璇ユ竻绌哄伐浣嶃��
+ *
+ * @return 閫�鍥炵殑鎮h�呮潯鏁�
+ */
+ private int releaseBedPatientsToQueue(Long roomId, String bedNo) {
+ List<Integer> statusList = new ArrayList<>();
+ statusList.add(QueueStatusEnum.READY.getStatus()); // 鍑嗗涓�
+ statusList.add(QueueStatusEnum.RECALLED.getStatus()); // 宸插彫鍥�
+ statusList.add(QueueStatusEnum.AFFINITY.getStatus()); // 浜插拰锛堣窡闅忎富椤癸級
+
+ Integer released = queueMapper.releaseBedPatientsToWaiting(
+ roomId, bedNo, QueueStatusEnum.WAITING.getStatus(), statusList);
+
+ // 鍐呭瓨璁℃暟鍚屾锛堝惁鍒欏垎娴佷紭鍏堢骇杩樻寜鏃х殑鍊欒瘖浜烘暟绠楋級
+ BedBO bedBO = mapOpeningBed.get(Utils.formatRoomBed(roomId, bedNo));
+ if (null != bedBO) {
+ bedBO.setReadyPatNum(0);
+ refreshBedPriorityLevelInRoutingQueue(bedBO);
+ }
+
+ if (null != released && released > 0) {
+ log.info("[閲婃斁宸ヤ綅鎮h�匽 宸ヤ綅={}/{} 涓� {} 浣嶃�屽噯澶囦腑/宸插彫鍥炪�嶆偅鑰呭凡閫�鍥炪�屾帓闃熶腑銆�"
+ + "锛堝彲琚叾瀹冨紑璇婂伐浣嶉噸鏂板垎娴侊紝鎴栧湪銆屾湰璇婂鎺掗槦涓�嶉噷鎵嬪伐鎷夊叆锛�",
+ roomId, bedNo, released);
+ }
+ return null == released ? 0 : released;
+ }
+
private void removeBedFromRoutingQueue(BedBO bedBO) {
// 瑁呮満宸ヤ綅 涓嶈繘 鍒嗘祦闃熷垪锛屼笉鎺ユ敹 銆愭帓闃熶腑銆戞偅鑰呭垎娴�
if (Objects.equals(BedOpTypeEnum.OP_INSTALL.getOpType(), bedBO.getOpType()))
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java
index 1305092..cd62713 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java
@@ -539,14 +539,18 @@
private Integer nextCheckInSeqNo(Integer checkType, boolean urgent) {
final LocalDate today = LocalDate.now();
+ // 銆愬叡浜帓闃熷彿銆戝悓缁勯」鐩叡鐢ㄤ竴涓鏁板櫒锛坈heck_type.seq_group锛屼緥濡� 100/1100/1000 閮藉~ 100锛夈��
+ // 杩欐牱鍏变韩鍊欒瘖姹犻噷涓変釜椤圭洰鐨勬偅鑰呬粠鍚屼竴濂楀彿閲屽彇鍙凤紝姹犲唴鍙洿鎺ユ寜 seq_num 鎺掓垚涓�鏉¢槦鍒椼��
+ final Integer counterKey = resolveSeqCounterKey(checkType);
+
// 鐢ㄦ樉寮忎簨鍔℃妸銆屾帹杩涖�嶄笌銆岃鍥炪�嶅寘鍦ㄤ竴璧凤紙@Transactional 鍦ㄦ澶勪笉鐢熸晥锛岃鏂规硶娉ㄩ噴锛�
Integer assigned = counterTransactionTemplate.execute(status -> {
if (urgent) {
- queueSequenceMapper.advanceReservedSeq(checkType, today);
+ queueSequenceMapper.advanceReservedSeq(counterKey, today);
} else {
- queueSequenceMapper.advanceNormalSeq(checkType, today);
+ queueSequenceMapper.advanceNormalSeq(counterKey, today);
}
- SeqCounterDO counter = queueSequenceMapper.getSeqCounter(checkType, today);
+ SeqCounterDO counter = queueSequenceMapper.getSeqCounter(counterKey, today);
if (null == counter) {
return null;
}
@@ -556,16 +560,38 @@
if (null == assigned) {
// 鐞嗚涓婁笉浼氬彂鐢燂紙鍒氭帹杩涜繃锛夛紱淇濆畧鍥為��锛岄伩鍏嶆姏閿欓樆鏂鍒�
assigned = urgent ? SeqRuleEnum.ROUND_SIZE : 1;
- log.error("[nextCheckInSeqNo] 璁℃暟鍣ㄨ鍙栧け璐ワ紝鍥為��涓洪粯璁ゅ彿. checkType={} 鍔犳��={} 鍥為��鍙�={}",
- checkType, urgent, assigned);
+ log.error("[nextCheckInSeqNo] 璁℃暟鍣ㄨ鍙栧け璐ワ紝鍥為��涓洪粯璁ゅ彿. checkType={} 璁℃暟鍣╧ey={} 鍔犳��={} 鍥為��鍙�={}",
+ checkType, counterKey, urgent, assigned);
}
- log.info("[nextCheckInSeqNo] 瑙勫垯=绛惧埌搴忓彿. checkType={} 鍔犳��={} 鏈鍒嗛厤={}",
- checkType, urgent, assigned);
+ log.info("[nextCheckInSeqNo] 瑙勫垯=绛惧埌搴忓彿. checkType={} 璁℃暟鍣╧ey={} 鍔犳��={} 鏈鍒嗛厤={}",
+ checkType, counterKey, urgent, assigned);
return assigned;
}
/**
+ * 瑙f瀽銆岀鍒板簭鍙枫�嶈鏁板櫒浣跨敤鐨� key锛�
+ * 閰嶄簡 {@code check_type.seq_group} 鐨勯」鐩叡鐢ㄥ悓涓�涓鏁板櫒锛坘ey=seq_group锛夛紝鍚﹀垯鐢ㄨ嚜韬� check_type銆�
+ *
+ * <p>浠呭奖鍝嶃�岀鍒板簭鍙�(seq_rule=1)銆嶈鍒欙紱鏃舵鍙�/棰勭害鍙蜂笉璧拌繖閲屻��
+ * 鏌ヤ笉鍒伴厤缃椂鍥為��涓鸿嚜韬� check_type锛堜繚鎸佸師琛屼负锛夈��
+ */
+ private Integer resolveSeqCounterKey(Integer checkType) {
+ if (null == checkType) {
+ return null;
+ }
+ try {
+ CheckTypeDO checkTypeDO = checkTypeMapper.getCheckTypeByValue(checkType);
+ if (null != checkTypeDO && null != checkTypeDO.getSeqGroup()) {
+ return checkTypeDO.getSeqGroup();
+ }
+ } catch (Exception e) {
+ log.warn("[resolveSeqCounterKey] 璇诲彇妫�鏌ラ」鐩叡浜彿缁勫け璐ワ紝鎸夎嚜韬紪鍙疯鏁�. checkType={}", checkType, e);
+ }
+ return checkType;
+ }
+
+ /**
* 鍚戝悗鏌ユ壘涓�涓�**浠嶆湁浣欓噺**鐨勯绾︽椂娈点��
* <p>
* 涓庢棫鐨� {@code getNextTimeSlot} 鐨勫尯鍒細
diff --git a/jh-server/src/main/resources/application.yaml b/jh-server/src/main/resources/application.yaml
index f6f7674..d216a8a 100644
--- a/jh-server/src/main/resources/application.yaml
+++ b/jh-server/src/main/resources/application.yaml
@@ -3,8 +3,8 @@
name: jh-server
profiles:
- active: local
-# active: prod
+# active: local
+ active: prod
main:
allow-circular-references: true # 鍏佽寰幆渚濊禆锛屽洜涓洪」鐩槸涓夊眰鏋舵瀯锛屾棤娉曢伩鍏嶈繖涓儏鍐点��
--
Gitblit v1.9.3