From 111ded437886aa10072434f8b0a459da24f8545a Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期五, 11 十月 2024 18:55:51 +0800
Subject: [PATCH] update

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java                 |    6 +++---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java                    |    5 ++++-
 jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/QueueStatusEnum.java                          |    3 ++-
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java   |    7 +++++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenServiceImpl.java |    4 ++--
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java     |   12 +++++++++---
 jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/queue/queueMapper.xml                                         |    2 +-
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java             |   10 +++++++++-
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java          |    4 ++--
 9 files changed, 39 insertions(+), 14 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 0a1b466..74e6c76 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
@@ -21,7 +21,8 @@
     RECALLED((byte)15, "宸插彫鍥�"),
     READY((byte)20, "鍊欒瘖涓�"),
     ONSTAGE((byte)30, "灏辫瘖涓�"),
-    FINISH((byte)40, "宸插氨璇�");
+    RECEIVED((byte)40, "宸查鐢�"),
+    FINISH((byte)50, "宸插氨璇�");
 
     public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(QueueStatusEnum::getStatus).toArray();
 
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java
index 3b15946..738f5c4 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java
@@ -3,6 +3,7 @@
 import cn.lihu.jh.framework.common.util.exception.ExceptionUtils;
 import cn.lihu.jh.module.ecg.dal.dataobject.devmanage.DeviceDO;
 import cn.lihu.jh.module.ecg.service.devmanage.DeviceService;
+import cn.lihu.jh.module.ecg.service.queue.QueueService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
@@ -46,15 +47,20 @@
     @Resource
     private DeviceService deviceService;
 
+    @Resource
+    private QueueService queueService;
+
     @PostMapping("/dev-ready")
-    @Operation(summary = "璁惧鍑嗗")
+    @Operation(summary = "璁惧棰嗙敤")
     @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
     public CommonResult<Long> devReady(@Valid @RequestBody DevRentSaveReqVO createReqVO) {
         try {
-            return devRentService.readyOperation(createReqVO);
+            CommonResult<Long> result = devRentService.readyOperation(createReqVO);
+            queueService.startHurryUpOneBed(createReqVO.getRoomId(), createReqVO.getBedNo());
+            return result;
         } catch ( RuntimeException runtimeException ) {
             String err = ExceptionUtils.formatException( runtimeException );
-            log.error("devInstall: " + err);
+            log.error("devReady: " + err);
             return CommonResult.error(DEV_INSTALL_EXCEPTION);
         }
     }
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java
index 7dcc3b3..9556e54 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java
@@ -3,6 +3,7 @@
 import com.alibaba.excel.annotation.ExcelProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import javax.validation.constraints.NotEmpty;
 import java.time.LocalDateTime;
@@ -52,4 +53,10 @@
 
     @Schema(description = "宸蹭粯娆�")
     private Integer paid;
+
+    @Schema(description = "璇婂缂栧彿")
+    Long roomId;
+
+    @Schema(description = "璇婂簥缂栧彿")
+    String bedNo;
 }
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/queueMapper2.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java
similarity index 95%
rename from jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/queueMapper2.java
rename to jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java
index aecc549..32f7f2d 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/queueMapper2.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java
@@ -17,7 +17,7 @@
  * @author 鑺嬮亾婧愮爜
  */
 @Mapper
-public interface queueMapper2 extends BaseMapperX<QueueDO> {
+public interface QueueMapper extends BaseMapperX<QueueDO> {
 
     default PageResult<QueueDO> selectPage(QueuePageReqVO reqVO) {
         return selectPage(reqVO, new LambdaQueryWrapperX<QueueDO>()
@@ -112,6 +112,9 @@
             " (select min(seq_num) as min_seq_num from lihu.queue where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus}) a )")
     Integer updateQueueStatus(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus);
 
+    @Update("update lihu.queue set status = #{newStatus} where pat_id = #{patId} and status = #{curStatus}")
+    Integer updatePatientQueueStatus(@Param("patId")String patId, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus);
+
     @Update("update lihu.queue set status = #{newStatus}, room_id = #{roomId}, room_name = #{roomName}, \n" +
             " bed_no = #{bedNo}, seq_num = #{seqNum} where id = \n" +
             "  (select a.id from \n" +
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 011f0ff..f73da77 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
@@ -2,7 +2,7 @@
 
 import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
 import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO;
-import cn.lihu.jh.module.ecg.dal.mysql.queue.queueMapper2;
+import cn.lihu.jh.module.ecg.dal.mysql.queue.QueueMapper;
 import cn.lihu.jh.module.ecg.dal.mysql.room.RoomMapper;
 import cn.lihu.jh.module.ecg.enums.QueueStatusEnum;
 import lombok.extern.slf4j.Slf4j;
@@ -24,7 +24,7 @@
 public class CallingScreenServiceImpl implements CallingScreenService {
 
     @Resource
-    private queueMapper2 queueMapper;
+    private QueueMapper queueMapper;
 
     @Resource
     private RoomMapper roomMapper;
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 4664496..980551d 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
@@ -7,8 +7,10 @@
 import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO;
 import cn.lihu.jh.module.ecg.dal.mysql.devmanage.DeviceMapper;
 import cn.lihu.jh.module.ecg.dal.mysql.jobrecord.JobRecordMapper;
+import cn.lihu.jh.module.ecg.dal.mysql.queue.QueueMapper;
 import cn.lihu.jh.module.ecg.enums.DevRentStateEnum;
 import cn.lihu.jh.module.ecg.enums.DevStateEnum;
+import cn.lihu.jh.module.ecg.enums.QueueStatusEnum;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.transaction.annotation.Transactional;
@@ -119,7 +121,8 @@
         }
 
         // 鎮h�呮帓闃熺姸鎬� 鏇存柊涓� 宸查鐢�
-        queueMapper.
+        queueMapper.updatePatientQueueStatus( createReqVO.getPatId(),
+                QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.RECEIVED.getStatus());
 
         return CommonResult.success(rent_id);
     }
@@ -185,6 +188,11 @@
             jobRecordDO.setUpdateTime(LocalDateTime.now());
             jobRecordMapper.updateById(jobRecordDO);
         }
+
+        // 鎮h�呮帓闃熺姸鎬� 鏇存柊涓� 宸插氨璇�
+        queueMapper.updatePatientQueueStatus( createReqVO.getPatId(),
+                QueueStatusEnum.RECEIVED.getStatus(), QueueStatusEnum.FINISH.getStatus());
+
         return CommonResult.success(rent_id);
     }
 
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 5c37b7b..f26af26 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
@@ -26,7 +26,7 @@
 import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
 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.queueMapper2;
+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;
@@ -49,7 +49,7 @@
     private OAuth2TokenApi oAuth2TokenApi;
 
     @Resource
-    private queueMapper2 queueMapper;
+    private QueueMapper queueMapper;
 
     @Resource
     private RoomMapper roomMapper;
@@ -303,7 +303,7 @@
         devRent.setState( DevRentStateEnum.FREE.getState() );
         devRentMapper.insert(devRent);
 
-        startHurryUpOneCheckType(Integer.valueOf(queue.getBookCheckType()));
+        startHurryUpOneCheckType( queue.getBookCheckType() );
     }
 
     public void finishNextPatient(Long roomId, String bedNo) {
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 bf0d6cb..fef9abe 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
@@ -11,7 +11,7 @@
 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;
-import cn.lihu.jh.module.ecg.dal.mysql.queue.queueMapper2;
+import cn.lihu.jh.module.ecg.dal.mysql.queue.QueueMapper;
 import cn.lihu.jh.module.ecg.dal.mysql.room.RoomMapper;
 import cn.lihu.jh.module.ecg.enums.BedStatusEnum;
 import cn.lihu.jh.module.ecg.enums.QueueStatusEnum;
@@ -44,7 +44,7 @@
     private OAuth2TokenApi oAuth2TokenApi;
 
     @Resource
-    private queueMapper2 queueMapper;
+    private QueueMapper queueMapper;
 
     @Resource
     private RoomMapper roomMapper;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/queue/queueMapper.xml b/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/queue/queueMapper.xml
index 6c5f4e9..b053939 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/queue/queueMapper.xml
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/queue/queueMapper.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.lihu.jh.module.ecg.dal.mysql.queue.queueMapper2">
+<mapper namespace="cn.lihu.jh.module.ecg.dal.mysql.queue.QueueMapper">
 
     <!--
         涓�鑸儏鍐典笅锛屽敖鍙兘浣跨敤 Mapper 杩涜 CRUD 澧炲垹鏀规煡鍗冲彲銆�

--
Gitblit v1.9.3