From ae24af77aaa940a64281f9f1bf2fe5ab3f9c68b8 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期五, 30 八月 2024 16:48:41 +0800
Subject: [PATCH] update

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java |   37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

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 5b7e2ac..f6ca95c 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
@@ -109,6 +109,7 @@
             e.printStackTrace();
         }
 
+        System.out.println("startBedOpen ========");
         return ECG_INNER_ERROR;
     }
 
@@ -125,6 +126,7 @@
             e.printStackTrace();
         }
 
+        System.out.println("startBedClose ========");
         return ECG_INNER_ERROR;
     }
 
@@ -143,6 +145,7 @@
             e.printStackTrace();
         }
 
+        System.out.println("startBedDoctorPause ========");
         return ECG_INNER_ERROR;
     }
 
@@ -161,6 +164,7 @@
             e.printStackTrace();
         }
 
+        System.out.println("startBedDoctorResume ========");
         return ECG_INNER_ERROR;
     }
 
@@ -179,6 +183,7 @@
             e.printStackTrace();
         }
 
+        System.out.println("startBedDoctorOn ========");
         return ECG_INNER_ERROR;
     }
 
@@ -197,6 +202,26 @@
             e.printStackTrace();
         }
 
+        System.out.println("startBedDoctorOff ========");
+        return ECG_INNER_ERROR;
+    }
+
+    @Override
+    public ErrorCode startNextPatient(Long roomId, String bedNo) {
+        Future<ErrorCode> future = singleThreadExecutor.submit(
+                new BedDoctorNextPatientCallable(this, roomId, bedNo)
+        );
+
+        try {
+            ErrorCode ret = future.get();
+            return ret;
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        } catch (ExecutionException e) {
+            e.printStackTrace();
+        }
+
+        System.out.println("startNextPatient ========");
         return ECG_INNER_ERROR;
     }
 
@@ -491,14 +516,15 @@
         startHurryUp();
     }
 
-    private void nextPatient(Long roomId, String bedNo) {
+    @Override
+    public ErrorCode nextPatient(Long roomId, String bedNo) {
         // 浠� DB 鎶� 搴忓彿鏈�灏忕殑 灏辫瘖鍑嗗涓殑浜� 璁剧疆涓哄氨璇婁腑
         Integer updateNum = queueMapper.updateQueueStatus(roomId, bedNo,
                 QueueStatusEnum.READY.getStatus(), QueueStatusEnum.ONSTAGE.getStatus());
 
         // 璇ュ伐浣� 娌℃湁 灏辫瘖鍑嗗涓� 浜哄憳
         if (null == updateNum || 0 == updateNum) {
-            return;
+            return QUEUE_NOT_READY_PATIENT;
         }
 
         // 浼樺厛闃熷垪涓� 璇ュ伐浣� 灏辫瘖鍑嗗涓汉鐨勬暟閲� 鍑忎竴
@@ -507,7 +533,8 @@
         priorityQueue.remove(bo);
         priorityQueue.offer(bo);
 
-        startHurryUp();
+        hurryup();
+        return SUCCESS;
     }
 
     public void finishNextPatient(Long roomId, String bedNo) {
@@ -515,7 +542,7 @@
         Integer ret =  queueMapper.updateQueueStatus(roomId, bedNo,
                 QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.FINISH.getStatus());
 
-        nextPatient(roomId, bedNo);
+        startNextPatient(roomId, bedNo);
     }
 
     public void passNextPatient(Long roomId, String bedNo) {
@@ -523,7 +550,7 @@
         Integer ret =  queueMapper.updateQueueStatus(roomId, bedNo,
                 QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.PASSED.getStatus());
 
-        nextPatient(roomId, bedNo);
+        startNextPatient(roomId, bedNo);
     }
 
     public List<QueueDO> getDoctorQueueByStatus(Long roomId, String bedNo, List<Byte> statusList) {

--
Gitblit v1.9.3