From 28322b650e29e06d5276742979615691fd233d07 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期四, 28 十一月 2024 18:04:34 +0800
Subject: [PATCH] 排队中  允许过号操作

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java |   30 ++++++++++++++++++++++++++++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java           |   16 ++++++++++++++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java              |    3 +++
 jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/QueueStatusEnum.java                    |    2 +-
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java               |    7 +++++++
 5 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/QueueStatusEnum.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/QueueStatusEnum.java
index aa26b8d..de8d201 100644
--- a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/QueueStatusEnum.java
+++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/QueueStatusEnum.java
@@ -15,7 +15,7 @@
 @AllArgsConstructor
 public enum QueueStatusEnum implements IntArrayValuable {
 
-    //5:杩囧彿 10:鎺掗槦涓� 15:宸插彫鍥� 20:鍊欒瘖鍑嗗 30:灏辫瘖涓� 40:灏辫瘖瀹屾垚
+    PASSED_WAITING(3, "宸茶繃鍙�-鎺掗槦涓�"),
     PASSED(5, "宸茶繃鍙�"),
     PASSED_INSTALL(7, "宸茶繃鍙�-瀹夎"),
     WAITING(10, "鎺掗槦涓�"),
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
index 47bf81c..e89911a 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
@@ -205,6 +205,20 @@
     }
 
     // 甯歌妫�鏌ヨ繃鍙枫�侀鐢ㄨ繃鍙�
+    @GetMapping("/pass-waiting-patient")
+    @Operation(summary = "杩囧彿鎺掗槦涓偅鑰�")
+    @Parameter(name = "patId", description = "鎮h�呯紪鍙�", required = true, example = "20247845")
+    @Parameter(name = "checkType", description = "棰勭害妫�鏌ョ被鍨�", required = true, example = "100")
+    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
+    public CommonResult<Integer> passWaitingPatient(
+            @RequestParam("patId") String patId,
+            @RequestParam("checkType") Integer checkType)
+    {
+        queueService.passWaitingPatient( patId, checkType );
+        return success(0);
+    }
+
+    // 甯歌妫�鏌ヨ繃鍙枫�侀鐢ㄨ繃鍙�
     @GetMapping("/pass-next-patient")
     @Operation(summary = "杩囧彿銆佷笅涓�浣嶆偅鑰�")
     @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116")
@@ -381,6 +395,22 @@
         return success(patientStatisticVO);
     }
 
+    @GetMapping("/recall-pass-waiting-patient")
+    @Operation(summary = "杩囧彿-鎺掗槦涓� 鎮h�呭彫鍥�")
+    @Parameter(name = "patId", description = "鎮h�呯紪鍙�", required = true, example = "B2")
+    @Parameter(name = "checkType", description = "棰勭害妫�鏌ョ被鍨�", required = true, example = "100")
+    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
+    public CommonResult<String> recallPatient(
+            @RequestParam("patId") String patId,
+            @RequestParam("checkType") Integer checkType)
+    {
+        Integer result = queueService.recallPassWaitingPatient(patId, checkType);
+        if (null == result || 0 == result)
+            return error(PATIENT_NOT_EXISTS);
+
+        return success("鎿嶄綔鎴愬姛");
+    }
+
     @GetMapping("/recall-patient")
     @Operation(summary = "杩囧彿鐥呬汉鍙洖")
     @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116")
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 b29be78..ffea211 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
@@ -210,6 +210,9 @@
                                        @Param("curStatus")Integer curStatus);
 */
 
+    @Update("update lihu.queue set status = #{newStatus} where pat_id = #{patId} and book_check_type = #{checkType} and status = #{curStatus}; " )
+    Integer updatePatientQueueStatus(@Param("patId")String patId, @Param("checkType")Integer checkType, @Param("curStatus")Integer curStatus, @Param("newStatus")Integer newStatus);
+
     @Update("update lihu.queue set status = #{newStatus} where status = #{curStatus} and seq_num = \n" +
             "(select a.min_seq_num from \n" +
             " (select min(seq_num) as min_seq_num from lihu.queue where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus}) a )")
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java
index 660ea09..a064f63 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java
@@ -107,6 +107,11 @@
     void finishInstallNextPatient(Long roomId, String bedNo);
 
     /**
+     * 杩囧彿鎺掗槦涓偅鑰�
+     */
+    void passWaitingPatient( String patId, Integer bookCheckType );
+
+    /**
      * 甯歌杩囧彿銆侀鐢ㄨ繃鍙�
      */
     void passNextPatient(Long roomId, String bedNo);
@@ -126,6 +131,8 @@
 
     PatientStatisticVO getBedDevInstallStatistic(Long roomId, String bedNo);
 
+    Integer recallPassWaitingPatient(String patId, Integer checkType);
+
     Integer recallPatient(Long roomId, String bedNo, String patId, Integer checkType);
 
     Integer recallInstallPatient(Long roomId, String bedNo, String patId, Integer checkType, Long roomId_operator, String bedNo_operator);
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 cb90a2d..d44becf 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
@@ -387,6 +387,13 @@
         startNextInstallPatient(roomId, bedNo);
     }
 
+    @Override
+    public void passWaitingPatient(String patId, Integer bookCheckType) {
+        // 浠� DB 鎶� 鎺掗槦涓殑浜� 璁剧疆涓� 杩囧彿-鎺掗槦涓�
+        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,
@@ -463,6 +470,15 @@
         return patientStatisticVO;
     }
 
+    @Override
+    public Integer recallPassWaitingPatient(String patId, Integer bookCheckType) {
+        // 浠� DB 鎶� 杩囧彿-鎺掗槦涓殑浜� 璁剧疆涓� 鎺掗槦涓�
+        Integer ret =  queueMapper.updatePatientQueueStatus(patId, bookCheckType,
+                QueueStatusEnum.PASSED_WAITING.getStatus(), QueueStatusEnum.WAITING.getStatus());
+
+        return ret;
+    }
+
     public PatientStatisticVO getBedDevReadyStatistic(Long roomId, String bedNo) {
         PatientStatisticVO patientStatisticVO = new PatientStatisticVO();
         List<BedQueueStatisticDO> bedQueueStatisticDOList = queueMapper.bedQueueStatistic(roomId, bedNo);

--
Gitblit v1.9.3