From 971bd30b611531464d7a878352e453ab4511f93f Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 19 六月 2025 19:36:24 +0800
Subject: [PATCH] 代码提交

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentRespVO.java    |   25 ++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueDO.java                         |    3 
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java                       |  164 +++++++++++++++-----------------
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentPageReqVO.java |   17 +++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentSaveReqVO.java |   22 ++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/QueueRespVO.java                |    6 +
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/appointment/AppointmentDO.java             |   20 ++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java              |    3 
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java           |   34 +++---
 9 files changed, 190 insertions(+), 104 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentPageReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentPageReqVO.java
index b37b303..68d046c 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentPageReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentPageReqVO.java
@@ -85,4 +85,21 @@
     @Schema(description = "宸蹭粯娆�")
     private Integer paid;
 
+    private String tolerance;
+
+    /**
+     *浣忛櫌鍙�
+     */
+    private String hospitalNo;
+
+    /**
+     * 鍖讳繚鍗″彿
+     */
+    private String medicalCard;
+
+    /**
+     * 闂ㄨ瘖鍙�
+     */
+    private String outpatientNo;
+
 }
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentRespVO.java
index 985bad8..340247a 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentRespVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentRespVO.java
@@ -110,4 +110,27 @@
     @Schema(description = "宸蹭粯娆�")
     @ExcelProperty("宸蹭粯娆�")
     private Integer paid;
-}
\ No newline at end of file
+
+    //    @TableField(exist = false)
+    private String status;
+
+    /**
+     * 鑰愯嵂鎬э細 鏄惁澶氳��1浠h〃鏄紝0浠h〃涓嶆槸
+     */
+    private String tolerance;
+
+    /**
+     *浣忛櫌鍙�
+     */
+    private String hospitalNo;
+
+    /**
+     * 鍖讳繚鍗″彿
+     */
+    private String medicalCard;
+
+    /**
+     * 闂ㄨ瘖鍙�
+     */
+    private String outpatientNo;
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentSaveReqVO.java
index 4643cf1..fffaa04 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentSaveReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentSaveReqVO.java
@@ -89,6 +89,26 @@
     @Schema(description = "宸蹭粯娆�")
     private Integer paid;
 
-//    @TableField(exist = false)
+    //    @TableField(exist = false)
     private String status;
+
+    /**
+     * 鑰愯嵂鎬э細 鏄惁澶氳��1浠h〃鏄紝0浠h〃涓嶆槸
+     */
+    private String tolerance;
+
+    /**
+     * 浣忛櫌鍙�
+     */
+    private String hospitalNo;
+
+    /**
+     * 鍖讳繚鍗″彿
+     */
+    private String medicalCard;
+
+    /**
+     * 闂ㄨ瘖鍙�
+     */
+    private String outpatientNo;
 }
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/QueueRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/QueueRespVO.java
index 88ce74a..3e17185 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/QueueRespVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/QueueRespVO.java
@@ -1,6 +1,7 @@
 package cn.lihu.jh.module.ecg.controller.admin.queue.vo;
 
 import cn.lihu.jh.module.ecg.dal.dataobject.patient.PatDetails;
+import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 
@@ -99,4 +100,7 @@
     @ExcelProperty("鍒涘缓鏃堕棿")
     private LocalDateTime createTime;
 
-}
\ No newline at end of file
+    @TableField(exist = false)
+    private String tolerance;
+
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/appointment/AppointmentDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/appointment/AppointmentDO.java
index 62ec996..6cecf69 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/appointment/AppointmentDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/appointment/AppointmentDO.java
@@ -139,4 +139,24 @@
 
     private String status;
 
+    /**
+     * 鑰愯嵂鎬э細 鏄惁澶氳��1浠h〃鏄紝0浠h〃涓嶆槸
+     */
+    private String tolerance;
+
+    /**
+     *浣忛櫌鍙�
+     */
+    private String hospitalNo;
+
+    /**
+     * 鍖讳繚鍗″彿
+     */
+    private String medicalCard;
+
+    /**
+     * 闂ㄨ瘖鍙�
+     */
+    private String outpatientNo;
+
 }
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueDO.java
index 5a251aa..a85cfbf 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueDO.java
@@ -115,5 +115,8 @@
      * 璇婄枟搴婄紪鍙�
      */
     private String bedNo;
+
+    @TableField(exist = false)
+    private String tolerance;
 }
 
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java
index 0065aa4..d34608d 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java
@@ -48,6 +48,9 @@
     @Select("select * from lihu.appointment where pat_id = #{patId} and to_days(book_date) = to_days(Now())")
     List<AppointmentDO> getCurrentPatId(String patId);
 
+    @Select("select * from lihu.appointment where (apply_no = #{code} or episode_id= #{code} or hospital_no =#{code} or pat_identity_id=#{code}) and to_days(book_date) = to_days(Now())")
+    List<AppointmentDO> getCurrentCode(String code);
+
     @Select("select * from lihu.appointment where pat_id = #{patId} and book_check_type = #{checkType} and to_days(book_date) = to_days(Now()) limit 1")
     AppointmentDO getByPatAndCheckTypeAndBookDate(@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 8060822..4badfac 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
@@ -110,21 +110,7 @@
         String action = "S0405";
         ApplicationTemplate app = new ApplicationTemplate();
         String statusName = AppointmentTypeEnum.getByType(appointment.getStatus());
-        String message = app.getXML(
-            appointment.getApplyNo(),
-            appointment.getStatus(),
-            statusName,
-            null,
-            appointment.getPatDeptCode(),
-            appointment.getPatDeptDesc(),
-            appointment.getPatWardCode(),
-            appointment.getPatWardDesc(),
-            appointment.getPatBedNo(),
-            appointment.getEpisodeId(),
-            String.valueOf(appointment.getBookSrc()),
-            appointment.getPatId(),
-            appointment.getPatName()
-        );
+        String message = app.getXML(appointment.getApplyNo(), appointment.getStatus(), statusName, null, appointment.getPatDeptCode(), appointment.getPatDeptDesc(), appointment.getPatWardCode(), appointment.getPatWardDesc(), appointment.getPatBedNo(), appointment.getEpisodeId(), String.valueOf(appointment.getBookSrc()), appointment.getPatId(), appointment.getPatName());
 
         try {
             String response = webServiceClient.callJHFWTYRK(action, "", message);
@@ -174,7 +160,7 @@
     @Override
     public List<AppointmentDO> queryAndCreateAppointmentByPatId(String patCode) {
         // 浠庡尰闄㈠钩鍙版煡璇�
-        List<AppointmentDO> appointmentExtermalList = getAppointmentExtermal(patCode);
+        List<AppointmentDO> appointmentExtermalList = appointmentMapper.getCurrentCode(patCode);
 
         for (int appointmentIndex = 0; appointmentIndex < appointmentExtermalList.size(); appointmentIndex++) {
             AppointmentDO appointmentExtermal = appointmentExtermalList.get(appointmentIndex);
@@ -358,6 +344,13 @@
 
             Optional.ofNullable(encounter.get("location")).map(location -> (Map<String, Object>) location).map(location -> (Map<String, Object>) location.get("serviceDeliveryLocation")).map(serviceDeliveryLocation -> (Map<String, Object>) serviceDeliveryLocation.get("location")).map(location -> (Map<String, Object>) location.get("id")).map(id -> (Map<String, Object>) id.get("item")).map(item -> (String) item.get("extension")).ifPresent(appointment::setPatBedNo);
 
+            Optional.ofNullable(dataMap.get("controlActProcess")).map(controlActProcess -> (Map<String, Object>) controlActProcess).map(controlActProcess -> (Map<String, Object>) controlActProcess.get("subject")).map(subject -> (Map<String, Object>) subject.get("observationRequest")).map(observationRequest -> (Map<String, Object>) observationRequest.get("zdy")).map(zdy -> {
+                Object ISDN = zdy.get("ISDN");
+                if (ISDN != null) {
+                    return ISDN.toString();
+                }
+                return null;
+            }).ifPresent(appointment::setTolerance);
 
             // 璁剧疆鎮h�呮潵婧愮被鍨�
             Optional.ofNullable(encounter.get("code")).map(code -> (Map<String, Object>) code).map(code -> (String) code.get("code")).map(Integer::parseInt).ifPresent(appointment::setPatSrc);
@@ -366,6 +359,12 @@
             Optional.ofNullable(encounter.get("subject")).map(subject -> (Map<String, Object>) subject).map(subject -> (Map<String, Object>) subject.get("patient")).map(patient -> (Map<String, Object>) patient.get("patientPerson")).ifPresent(patientPerson -> {
                 // 璁剧疆鎮h�匢D
                 Optional.ofNullable(encounter.get("subject")).map(subject -> (Map<String, Object>) subject).map(subject -> (Map<String, Object>) subject.get("patient")).map(patient -> (Map<String, Object>) patient.get("id")).map(id -> (Map<String, Object>) id).map(id -> (List<?>) id.get("item")).filter(items -> items.size() > 1).map(items -> (Map<String, Object>) items.get(1)).map(item -> (String) item.get("extension")).ifPresent(appointment::setPatId);
+
+                // 璁剧疆鎮h�呴棬璇婂彿
+                Optional.ofNullable(encounter.get("subject")).map(subject -> (Map<String, Object>) subject).map(subject -> (Map<String, Object>) subject.get("patient")).map(patient -> (Map<String, Object>) patient.get("id")).map(id -> (Map<String, Object>) id).map(id -> (List<?>) id.get("item")).filter(items -> items.size() > 1).map(items -> (Map<String, Object>) items.get(2)).map(item -> (String) item.get("extension")).ifPresent(appointment::setOutpatientNo);
+
+                // 璁剧疆鎮h�呬綇闄㈠彿
+                Optional.ofNullable(encounter.get("subject")).map(subject -> (Map<String, Object>) subject).map(subject -> (Map<String, Object>) subject.get("patient")).map(patient -> (Map<String, Object>) patient.get("id")).map(id -> (Map<String, Object>) id).map(id -> (List<?>) id.get("item")).filter(items -> items.size() > 1).map(items -> (Map<String, Object>) items.get(2)).map(item -> (String) item.get("extension")).ifPresent(appointment::setHospitalNo);
 
                 // 璁剧疆鎮h�呭鍚�
                 Optional.ofNullable(patientPerson.get("name")).map(name -> (Map<String, Object>) name).map(name -> (Map<String, Object>) name.get("item")).map(item -> (Map<String, Object>) item.get("part")).map(part -> (String) part.get("value")).ifPresent(appointment::setPatName);
@@ -387,6 +386,9 @@
 
                 // 璁剧疆鎮h�呰韩浠借瘉鍙�
                 Optional.ofNullable(patientPerson.get("id")).map(id -> (Map<String, Object>) id).map(id -> (List<?>) id.get("item")).filter(items -> !items.isEmpty()).map(items -> (Map<String, Object>) items.get(0)).map(item -> (String) item.get("extension")).ifPresent(appointment::setPatIdentityId);
+
+                //鎮h�呭尰淇濆崱
+                Optional.ofNullable(patientPerson.get("id")).map(id -> (Map<String, Object>) id).map(id -> (List<?>) id.get("item")).filter(items -> !items.isEmpty()).map(items -> (Map<String, Object>) items.get(1)).map(item -> (String) item.get("extension")).ifPresent(appointment::setMedicalCard);
             });
 
             // 璁剧疆绉戝鍜岀梾鍖轰俊鎭�
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 42ad66f..4926a0b 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
@@ -8,11 +8,12 @@
 import cn.lihu.jh.module.ecg.controller.admin.room.vo.MonitorInfoVO;
 import cn.lihu.jh.module.ecg.dal.dataobject.checktype.CheckTypeDO;
 import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO;
-import cn.lihu.jh.module.ecg.dal.mysql.call.CallMapper;
+import cn.lihu.jh.module.ecg.dal.mysql.appointment.AppointmentMapper;
 import cn.lihu.jh.module.ecg.dal.mysql.devrent.DevRentMapper;
 import cn.lihu.jh.module.ecg.enums.DevRentStateEnum;
 import cn.lihu.jh.module.system.api.oauth2.OAuth2TokenApi;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.cxf.common.util.CollectionUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
@@ -29,6 +30,7 @@
 import cn.lihu.jh.framework.common.pojo.PageResult;
 import cn.lihu.jh.framework.common.util.object.BeanUtils;
 import cn.lihu.jh.module.ecg.dal.mysql.queue.QueueMapper;
+
 import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
 import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.lihu.jh.framework.common.pojo.CommonResult.error;
@@ -57,7 +59,7 @@
     private RoomMapper roomMapper;
 
     @Resource
-    private CallMapper callMapper;
+    private AppointmentMapper appointmentMapper;
 
     @Resource
     private DevRentMapper devRentMapper;
@@ -94,7 +96,7 @@
 
     @Override
     public ErrorCode startBedOpen(Long roomId, String roomName, String bedNo) {
-        Future<ErrorCode> future = singleThreadExecutor.submit( new BedOpenCallable(queueServiceTxFunctions, roomId, roomName, bedNo));
+        Future<ErrorCode> future = singleThreadExecutor.submit(new BedOpenCallable(queueServiceTxFunctions, roomId, roomName, bedNo));
 
         try {
             ErrorCode ret = future.get();
@@ -111,7 +113,7 @@
 
     @Override
     public ErrorCode startBedClose(Long roomId, String bedNo) {
-        Future<ErrorCode> future = singleThreadExecutor.submit( new BedCloseCallable(queueServiceTxFunctions, roomId, bedNo));
+        Future<ErrorCode> future = singleThreadExecutor.submit(new BedCloseCallable(queueServiceTxFunctions, roomId, bedNo));
 
         try {
             ErrorCode ret = future.get();
@@ -128,9 +130,7 @@
 
     @Override
     public ErrorCode startBedDoctorPause(Long roomId, String bedNo, Long docId, String docName) {
-        Future<ErrorCode> future = singleThreadExecutor.submit(
-            new BedDoctorPauseCallable(queueServiceTxFunctions, roomId, bedNo, docId, docName)
-        );
+        Future<ErrorCode> future = singleThreadExecutor.submit(new BedDoctorPauseCallable(queueServiceTxFunctions, roomId, bedNo, docId, docName));
 
         try {
             ErrorCode ret = future.get();
@@ -147,9 +147,7 @@
 
     @Override
     public ErrorCode startBedDoctorResume(Long roomId, String bedNo, Long docId, String docName) {
-        Future<ErrorCode> future = singleThreadExecutor.submit(
-            new BedDoctorResumeCallable(queueServiceTxFunctions, roomId, bedNo, docId, docName)
-        );
+        Future<ErrorCode> future = singleThreadExecutor.submit(new BedDoctorResumeCallable(queueServiceTxFunctions, roomId, bedNo, docId, docName));
 
         try {
             ErrorCode ret = future.get();
@@ -166,9 +164,7 @@
 
     @Override
     public ErrorCode startBedDoctorOn(Long roomId, String bedNo, Long docId, String docName) {
-        Future<ErrorCode> future = singleThreadExecutor.submit(
-            new BedDoctorOnCallable(queueServiceTxFunctions, roomId, bedNo, docId, docName)
-        );
+        Future<ErrorCode> future = singleThreadExecutor.submit(new BedDoctorOnCallable(queueServiceTxFunctions, roomId, bedNo, docId, docName));
 
         try {
             ErrorCode ret = future.get();
@@ -185,9 +181,7 @@
 
     @Override
     public ErrorCode startBedDoctorOff(Long roomId, String bedNo, Long docId, String docName) {
-        Future<ErrorCode> future = singleThreadExecutor.submit(
-            new BedDoctorOffCallable(queueServiceTxFunctions, roomId, bedNo, docId, docName)
-        );
+        Future<ErrorCode> future = singleThreadExecutor.submit(new BedDoctorOffCallable(queueServiceTxFunctions, roomId, bedNo, docId, docName));
 
         try {
             ErrorCode ret = future.get();
@@ -204,9 +198,7 @@
 
     @Override
     public ErrorCode startNextPatient(Long roomId, String bedNo) {
-        Future<ErrorCode> future = singleThreadExecutor.submit(
-                new BedDoctorNextPatientCallable(queueServiceTxFunctions, roomId, bedNo)
-        );
+        Future<ErrorCode> future = singleThreadExecutor.submit(new BedDoctorNextPatientCallable(queueServiceTxFunctions, roomId, bedNo));
 
         try {
             ErrorCode ret = future.get();
@@ -223,9 +215,7 @@
 
     @Override
     public ErrorCode startNextInstallPatient(Long roomId, String bedNo) {
-        Future<ErrorCode> future = singleThreadExecutor.submit(
-                new BedDoctorNextInstallPatientCallable(queueServiceTxFunctions, roomId, bedNo)
-        );
+        Future<ErrorCode> future = singleThreadExecutor.submit(new BedDoctorNextInstallPatientCallable(queueServiceTxFunctions, roomId, bedNo));
 
         try {
             ErrorCode ret = future.get();
@@ -242,21 +232,21 @@
 
     @Override
     public void startHurryUpOneBed(Long roomId, String bedNo) {
-        singleThreadExecutor.execute( () -> {
+        singleThreadExecutor.execute(() -> {
             queueServiceTxFunctions.hurryupOneBed(roomId, bedNo);
         });
     }
 
     @Override
     public void startHurryUpOneCheckType(Integer checkType) {
-        singleThreadExecutor.execute( () -> {
-            queueServiceTxFunctions.hurryupOneCheckType( checkType );
+        singleThreadExecutor.execute(() -> {
+            queueServiceTxFunctions.hurryupOneCheckType(checkType);
         });
     }
 
     @Override
     public void startBedReload() {
-        singleThreadExecutor.execute( () -> {
+        singleThreadExecutor.execute(() -> {
             queueServiceTxFunctions.bedReload();
             queueServiceTxFunctions.hurryupAllBed();
             queueServiceTxFunctions.monitorInfo();
@@ -265,7 +255,7 @@
 
     @Override
     public void startResetRoom(Boolean needCloseBed) {
-        singleThreadExecutor.execute( () -> {
+        singleThreadExecutor.execute(() -> {
             queueServiceTxFunctions.resetRoom(needCloseBed);
             queueServiceTxFunctions.bedReload();
             queueServiceTxFunctions.monitorInfo();
@@ -307,12 +297,17 @@
 
     @Override
     public PageResult<QueueDO> getqueuePage(QueuePageReqVO pageReqVO) {
-        return queueMapper.selectPage(pageReqVO);
+        PageResult<QueueDO> queueDOPageResult = queueMapper.selectPage(pageReqVO);
+        queueDOPageResult.getList().forEach(queueDO -> {
+            queueDO.setTolerance(appointmentMapper.getByApplyNo(queueDO.getApplyNo()).getTolerance());
+        });
+        return queueDOPageResult;
     }
 
 
     /**
      * 棰勭害纭鍚庣殑鎺掗槦
+     *
      * @param queueSaveReqVO
      */
     @Override
@@ -322,8 +317,8 @@
         queueSaveReqVO.setStatus(QueueStatusEnum.WAITING.getStatus());
 
         // 澶勭悊 妫�鏌ラ」鐩�.浜插拰鎬� 閫昏緫
-        CheckTypeDO checkTypeDO = queueServiceTxFunctions.getCheckTypeItem( queueSaveReqVO.getBookCheckType() );
-        if ( checkTypeDO.getAffinityCheckTypes().length > 0) {
+        CheckTypeDO checkTypeDO = queueServiceTxFunctions.getCheckTypeItem(queueSaveReqVO.getBookCheckType());
+        if (checkTypeDO.getAffinityCheckTypes().length > 0) {
             procAffinityWhenQueue(/*IN,OUT*/queueSaveReqVO, checkTypeDO.getAffinityCheckTypes());
         }
 
@@ -331,19 +326,19 @@
         queueMapper.insert(queue);
 
         DevRentDO devRent = BeanUtils.toBean(queueSaveReqVO, DevRentDO.class);
-        devRent.setApplyNo( queueSaveReqVO.getApplyNo() );
-        devRent.setEpisodeId( queueSaveReqVO.getEpisodeId() );
-        devRent.setState( DevRentStateEnum.FREE.getState() );
-        devRent.setPatDetails( queueSaveReqVO.getPatDetails() );
-        devRent.setCheckType( queueSaveReqVO.getBookCheckType() );
+        devRent.setApplyNo(queueSaveReqVO.getApplyNo());
+        devRent.setEpisodeId(queueSaveReqVO.getEpisodeId());
+        devRent.setState(DevRentStateEnum.FREE.getState());
+        devRent.setPatDetails(queueSaveReqVO.getPatDetails());
+        devRent.setCheckType(queueSaveReqVO.getBookCheckType());
         devRentMapper.insert(devRent);
 
-        startHurryUpOneCheckType( queue.getBookCheckType() );
+        startHurryUpOneCheckType(queue.getBookCheckType());
     }
 
     @Override
     public List<QueueDO> selectBookSeqNumByAppointIdList(List<Long> appointIdList) {
-        return queueMapper.selectBookSeqNumByAppointIdList( appointIdList );
+        return queueMapper.selectBookSeqNumByAppointIdList(appointIdList);
     }
 
     // 甯歌妫�鏌� 鍙彿
@@ -357,8 +352,7 @@
         List<Integer> queueStatusList = new ArrayList<>();
         queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
         Integer num = queueMapper.bedQueueStatisticByStatus(roomId, bedNo, queueStatusList);
-        if ( num != null && num > 0)
-            return;
+        if (num != null && num > 0) return;
 
         startNextPatient(roomId, bedNo);
     }
@@ -370,8 +364,7 @@
         List<Integer> queueStatusList = new ArrayList<>();
         queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
         Integer num = queueMapper.bedQueueStatisticByStatus(roomId, bedNo, queueStatusList);
-        if ( num != null && num > 0)
-            return;
+        if (num != null && num > 0) return;
 
         startNextPatient(roomId, bedNo);
     }
@@ -383,8 +376,7 @@
         List<Integer> queueStatusList = new ArrayList<>();
         queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus());
         Integer num = queueMapper.bedQueueStatisticByStatus(roomId, bedNo, queueStatusList);
-        if ( num != null && num > 0)
-            return;
+        if (num != null && num > 0) return;
 
         startNextInstallPatient(roomId, bedNo);
     }
@@ -392,14 +384,12 @@
     @Override
     public void passWaitingPatient(String patId, Integer bookCheckType) {
         // 浠� DB 鎶� 鎺掗槦涓殑浜� 璁剧疆涓� 杩囧彿-鎺掗槦涓�
-        Integer ret =  queueMapper.updatePatientQueueStatus(patId, bookCheckType,
-                QueueStatusEnum.WAITING.getStatus(), QueueStatusEnum.PASSED_WAITING.getStatus());
+        Integer ret = queueMapper.updatePatientQueueStatus(patId, bookCheckType, QueueStatusEnum.WAITING.getStatus(), QueueStatusEnum.PASSED_WAITING.getStatus());
     }
 
     public void passNextPatient(Long roomId, String bedNo) {
         // 浠� DB 鎶� 灏辫瘖涓殑浜� 璁剧疆涓鸿繃鍙�
-        Integer ret =  queueMapper.updateBedQueueStatus(roomId, bedNo,
-                QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.PASSED.getStatus());
+        Integer ret = queueMapper.updateBedQueueStatus(roomId, bedNo, QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.PASSED.getStatus());
 
         startNextPatient(roomId, bedNo);
     }
@@ -407,20 +397,30 @@
     @Override
     public void passInstallNextPatient(Long roomId, String bedNo) {
         // 浠� DB 鎶� [瀹夎涓璢鐨勪汉 璁剧疆涓� [杩囧彿-瀹夎]
-        Integer ret =  queueMapper.updateBedQueueStatus(roomId, bedNo,
-                QueueStatusEnum.INSTALLING.getStatus(), QueueStatusEnum.PASSED_INSTALL.getStatus());
+        Integer ret = queueMapper.updateBedQueueStatus(roomId, bedNo, QueueStatusEnum.INSTALLING.getStatus(), QueueStatusEnum.PASSED_INSTALL.getStatus());
 
         startNextPatient(roomId, bedNo);
     }
 
     public List<QueueDO> getBedQueueByStatus(Long roomId, String bedNo, List<Integer> statusList) {
         List<QueueDO> queueDOList = queueMapper.getBedQueueByStatus(roomId, bedNo, statusList);
+        if (!CollectionUtils.isEmpty(queueDOList)) {
+            queueDOList.forEach(queueDO -> {
+                queueDO.setTolerance(appointmentMapper.getByApplyNo(queueDO.getApplyNo()).getTolerance());
+            });
+        }
         return queueDOList;
     }
 
     @Override
+
     public List<QueueDO> getRoomQueueByStatus(Long roomId, List<Integer> statusList) {
         List<QueueDO> queueDOList = queueMapper.getRoomQueueByStatus(roomId, statusList);
+        if (!CollectionUtils.isEmpty(queueDOList)) {
+            queueDOList.forEach(queueDO -> {
+                queueDO.setTolerance(appointmentMapper.getByApplyNo(queueDO.getApplyNo()).getTolerance());
+            });
+        }
         return queueDOList;
     }
 
@@ -461,11 +461,11 @@
         });
 
         // 瑁呮満鐣岄潰锛氱粺璁� 璇ヨ瘖瀹� [宸查鐢╙ 鐨勬暟閲�, 鍥犱负瀹夎宸ヤ綅鐪嬩笉鍒� [宸查鐢╙ 鎮h�咃紝鎵�浠ユ棤娉曟牴鎹鏈哄伐浣嶆潵缁熻锛屽彧鑳芥寜璇婂缁熻
-        patientStatisticVO.setReceivedNum( 0 );
+        patientStatisticVO.setReceivedNum(0);
         List<BedQueueStatisticDO> roomQueueStatisticDOList = queueMapper.roomQueueStatistic(roomId);
         roomQueueStatisticDOList.forEach(item -> {
             if (QueueStatusEnum.RECEIVED.getStatus() == item.getStatus()) {
-                patientStatisticVO.setReceivedNum( patientStatisticVO.getReceivedNum() + item.getTotalInStatus() );
+                patientStatisticVO.setReceivedNum(patientStatisticVO.getReceivedNum() + item.getTotalInStatus());
             }
         });
 
@@ -475,8 +475,7 @@
     @Override
     public Integer recallPassWaitingPatient(String patId, Integer bookCheckType) {
         // 浠� DB 鎶� 杩囧彿-鎺掗槦涓殑浜� 璁剧疆涓� 鎺掗槦涓�
-        Integer ret =  queueMapper.updatePatientQueueStatus(patId, bookCheckType,
-                QueueStatusEnum.PASSED_WAITING.getStatus(), QueueStatusEnum.WAITING.getStatus());
+        Integer ret = queueMapper.updatePatientQueueStatus(patId, bookCheckType, QueueStatusEnum.PASSED_WAITING.getStatus(), QueueStatusEnum.WAITING.getStatus());
 
         return ret;
     }
@@ -493,15 +492,15 @@
         });
 
         // 棰嗙敤鐣岄潰锛氱粺璁� 璇ヨ瘖瀹� [宸查鐢╙ 鐨勬暟閲�, 鍥犱负瀹夎鏃舵偅鑰呭綊灞炲伐浣嶄粠棰嗙敤宸ヤ綅鍙樻洿鍒板畨瑁呭伐浣嶏紝鎵�浠ユ棤娉曟牴鎹鐢ㄥ伐浣嶆潵缁熻锛屽彧鑳芥寜璇婂缁熻
-        patientStatisticVO.setReceivedNum( 0 );
+        patientStatisticVO.setReceivedNum(0);
         List<BedQueueStatisticDO> roomQueueStatisticDOList = queueMapper.roomQueueStatistic(roomId);
         roomQueueStatisticDOList.forEach(item -> {
             if (QueueStatusEnum.RECEIVED.getStatus() == item.getStatus()) {
-                patientStatisticVO.setReceivedNum( patientStatisticVO.getReceivedNum() + item.getTotalInStatus() );
+                patientStatisticVO.setReceivedNum(patientStatisticVO.getReceivedNum() + item.getTotalInStatus());
             } else if (QueueStatusEnum.INSTALLING.getStatus() == item.getStatus()) {
-                patientStatisticVO.setReceivedNum( patientStatisticVO.getReceivedNum() + item.getTotalInStatus() );
+                patientStatisticVO.setReceivedNum(patientStatisticVO.getReceivedNum() + item.getTotalInStatus());
             } else if (QueueStatusEnum.FINISH.getStatus() == item.getStatus()) {
-                patientStatisticVO.setReceivedNum(patientStatisticVO.getReceivedNum() + item.getTotalInStatus() );
+                patientStatisticVO.setReceivedNum(patientStatisticVO.getReceivedNum() + item.getTotalInStatus());
             }
         });
 
@@ -517,12 +516,11 @@
     }
 
     public void initCheckType() {
-        queueServiceTxFunctions.initCheckType( );
+        queueServiceTxFunctions.initCheckType();
     }
 
     public void startBiz() {
-        if (1 == queueServiceTxFunctions.getOpeningFlag())
-            return;
+        if (1 == queueServiceTxFunctions.getOpeningFlag()) return;
 
         queueServiceTxFunctions.setOpeningFlag(1);
         startBedReload();
@@ -535,8 +533,7 @@
 
     @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 = queueMapper.recallPassedPatient(roomId, bedNo, patId, checkType, QueueStatusEnum.PASSED.getStatus(), QueueStatusEnum.RECALLED.getStatus());
 
         // 妫�鏌ラ」鐩�.浜插拰鎬� 涓嶉渶瑕佸湪杩欓噷澶勭悊
         // 浼氬湪 HurryUpOnBed 閲岄潰澶勭悊 妫�鏌ラ」鐩�.浜插拰鎬�
@@ -547,13 +544,12 @@
 
     @Override
     public Integer recallInstallPatient(Long roomId, String bedNo, String patId, Integer checkType, Long roomId_operator, String bedNo_operator) {
-        Integer updateNum = queueMapper.recallPassedInstallPatient(roomId, bedNo_operator, patId, checkType,
-                QueueStatusEnum.PASSED_INSTALL.getStatus(), QueueStatusEnum.RECALLED_INSTALL.getStatus());
+        Integer updateNum = queueMapper.recallPassedInstallPatient(roomId, bedNo_operator, patId, checkType, QueueStatusEnum.PASSED_INSTALL.getStatus(), QueueStatusEnum.RECALLED_INSTALL.getStatus());
 
         // 妫�鏌ラ」鐩�.浜插拰鎬� 澶勭悊
         if (null != updateNum && 1 == updateNum) {
-            CheckTypeDO checkTypeDO = queueServiceTxFunctions.getCheckTypeItem( checkType );
-            if ( checkTypeDO.getAffinityCheckTypes().length > 0) {
+            CheckTypeDO checkTypeDO = queueServiceTxFunctions.getCheckTypeItem(checkType);
+            if (checkTypeDO.getAffinityCheckTypes().length > 0) {
                 procAffinityWhenInstallRecall(patId, checkTypeDO.getAffinityCheckTypes(), roomId_operator, bedNo_operator);
             }
         }
@@ -565,6 +561,7 @@
 
     /**
      * 鍔犳��
+     *
      * @param patId
      * @param jumped
      * @return
@@ -585,6 +582,7 @@
 
     /**
      * 鑾峰彇 鎸囧畾宸ヤ綅  銆愭鏌棰嗙敤銆戠浉鍏崇殑鎮h��
+     *
      * @param roomId
      * @param bedNo
      * @return
@@ -609,9 +607,9 @@
                 affinityWaitingList.add(item);
             }
         }
-        affinityWaitingList.forEach( affinityWaitingItem -> {
-            for (int i = queueDOList.size()-1; i >= 0; i--) {
-                if ( affinityWaitingItem.getSeqNum() == queueDOList.get(i).getSeqNum() ) {
+        affinityWaitingList.forEach(affinityWaitingItem -> {
+            for (int i = queueDOList.size() - 1; i >= 0; i--) {
+                if (affinityWaitingItem.getSeqNum() == queueDOList.get(i).getSeqNum()) {
                     queueDOList.add(i + 1, affinityWaitingItem);
                     break;
                 }
@@ -623,6 +621,7 @@
 
     /**
      * 鑾峰彇 鎸囧畾宸ヤ綅  銆愬畨瑁呫�戠浉鍏崇殑鎮h��
+     *
      * @param roomId
      * @param bedNo
      * @return
@@ -638,7 +637,7 @@
 
         queueStatusList.clear();
         queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus());
-        queueDOList.addAll(0, getBedQueueByStatus(roomId, bedNo, queueStatusList) ); // 褰撳墠宸ヤ綅鐨�
+        queueDOList.addAll(0, getBedQueueByStatus(roomId, bedNo, queueStatusList)); // 褰撳墠宸ヤ綅鐨�
 
         //鎶� [浜插拰鐨刔 鎸埌涓婚」鍚庨潰
         List<QueueDO> affinityReceivedList = new ArrayList<>();
@@ -650,9 +649,9 @@
                 affinityReceivedList.add(item);
             }
         }
-        affinityReceivedList.forEach( affinityReceivedItem -> {
-            for (int i = queueDOList.size()-1; i >= 0; i--) {
-                if ( affinityReceivedItem.getSeqNum() == queueDOList.get(i).getSeqNum() ) {
+        affinityReceivedList.forEach(affinityReceivedItem -> {
+            for (int i = queueDOList.size() - 1; i >= 0; i--) {
+                if (affinityReceivedItem.getSeqNum() == queueDOList.get(i).getSeqNum()) {
                     queueDOList.add(i + 1, affinityReceivedItem);
                     break;
                 }
@@ -663,9 +662,8 @@
     }
 
     private RoomDO getRoomDO(Long roomId, String bedNo) {
-        RoomDO roomDO = mapRoomBed.get( Utils.formatRoomBed(roomId, bedNo) );
-        if ( null == roomDO)
-            roomDO = roomMapper.getRoom(roomId, bedNo);
+        RoomDO roomDO = mapRoomBed.get(Utils.formatRoomBed(roomId, bedNo));
+        if (null == roomDO) roomDO = roomMapper.getRoom(roomId, bedNo);
 
         return roomDO;
     }
@@ -674,12 +672,11 @@
      * 瑁呮満鍙洖锛屾槸鎶㈠崰寮忕殑锛屼細鏀瑰彉瑁呮満宸ヤ綅
      */
     private void procAffinityWhenInstallRecall(String patId, Integer[] affinityCheckTypes, Long roomId_operator, String bedNo_operator) {
-        List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatus(
-                        patId, affinityCheckTypes, QueueStatusEnum.AFFINITY_INSTALL.getStatus());
+        List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatus(patId, affinityCheckTypes, QueueStatusEnum.AFFINITY_INSTALL.getStatus());
         for (int i = 0; i < affinityItems.size(); i++) {
             QueueDO queueItem = affinityItems.get(i);
-            queueItem.setRoomId( roomId_operator );
-            queueItem.setBedNo( bedNo_operator );
+            queueItem.setRoomId(roomId_operator);
+            queueItem.setBedNo(bedNo_operator);
             //queueItem.setSeqNum( preemptQueueItem.getSeqNum() );  // 瑁呮満鏃� 鍐呴儴搴忓彿涓嶅彉 鏁呬笉闇�鏇存柊
             queueMapper.updateById(queueItem);
         }
@@ -690,14 +687,11 @@
      */
     private void procAffinityWhenQueue(/*IN, OUT*/QueueSaveReqVO queueSaveReqVO, Integer[] affinityCheckTypes) {
         // 濡傛灉瀛樺湪 [鍊欒瘖涓璢 [灏辫瘖涓璢 [杩囧彿] [宸插彫鍥瀅 鑳借渚濋檮鐨勬鏌ラ」锛屽垯渚濋檮鍒板叾涓竴涓�
-        List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatusList(
-                queueSaveReqVO.getPatId(), affinityCheckTypes,
-                List.of(QueueStatusEnum.READY.getStatus(), QueueStatusEnum.ONSTAGE.getStatus(),
-                        QueueStatusEnum.PASSED.getStatus(), QueueStatusEnum.RECALLED.getStatus()));
+        List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatusList(queueSaveReqVO.getPatId(), affinityCheckTypes, List.of(QueueStatusEnum.READY.getStatus(), QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.PASSED.getStatus(), QueueStatusEnum.RECALLED.getStatus()));
         if (!affinityItems.isEmpty()) {
             QueueDO queueItem = affinityItems.get(0);
             queueSaveReqVO.setStatus(QueueStatusEnum.AFFINITY.getStatus()); // [浜插拰-鎺掗槦] 鐘舵��
-            queueSaveReqVO.setAffinityItem( 1 );
+            queueSaveReqVO.setAffinityItem(1);
             queueSaveReqVO.setRoomId(queueItem.getRoomId());
             queueSaveReqVO.setRoomName(queueItem.getRoomName());
             queueSaveReqVO.setBedNo(queueItem.getBedNo());

--
Gitblit v1.9.3