From be29e4df82e7f6425db15b03f09aaee1cd9cfb1d Mon Sep 17 00:00:00 2001 From: eight <641137800@qq.com> Date: 星期二, 15 十月 2024 16:32:39 +0800 Subject: [PATCH] 大屏.小屏 叫号逻辑 --- jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/CallController.java | 17 +++++++- jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/call/CallMapper.java | 11 ++++- jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java | 2 + jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallService.java | 9 ++++ jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenService.java | 2 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallServiceImpl.java | 26 ++++++++++++ 6 files changed, 59 insertions(+), 8 deletions(-) diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/CallController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/CallController.java index 3f238d7..db75928 100644 --- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/CallController.java +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/CallController.java @@ -1,5 +1,6 @@ package cn.lihu.jh.module.ecg.controller.admin.call; +import cn.hutool.extra.servlet.ServletUtil; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; @@ -27,6 +28,7 @@ import javax.annotation.Resource; import javax.annotation.security.PermitAll; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; @@ -73,11 +75,22 @@ } @GetMapping("/next") - @Operation(summary = "鑾峰緱涓嬩竴涓彨鍙�") + @Operation(summary = "澶у睆..鑾峰緱涓嬩竴涓彨鍙�") @PermitAll public CommonResult<CallRespVO> nextCall() { CallDO call = callService.getNextCall(); return success(BeanUtils.toBean(call, CallRespVO.class)); } -} \ No newline at end of file + @GetMapping("/next-install") + @Operation(summary = "璇婇棿灞�..鑾峰緱涓嬩竴涓彨鍙�") + @PermitAll + public CommonResult<CallRespVO> nextInstallCall(HttpServletRequest request) { + String reqIp = ServletUtil.getClientIP(request); + + CallDO call = callService.getNextInstallCall(reqIp); + return success(BeanUtils.toBean(call, CallRespVO.class)); + } + +} + diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java index e95b414..f372601 100644 --- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java @@ -59,9 +59,11 @@ List<Byte> queueStatusList = new ArrayList<>(); queueStatusList.add(QueueStatusEnum.RECALLED.getStatus()); + queueStatusList.add(QueueStatusEnum.RECALLED_INSTALL.getStatus()); queueStatusList.add(QueueStatusEnum.READY.getStatus()); queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); + queueStatusList.add(QueueStatusEnum.PASSED_INSTALL.getStatus()); List<QueueDO> queueDOList = callingScreenService.getRoomQueue(reqIp, queueStatusList); List<QueueDO> passedList = queueDOList.stream().filter(queue -> queue.getStatus() == QueueStatusEnum.PASSED.getStatus()).toList(); diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/call/CallMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/call/CallMapper.java index c253f62..e6cdbdf 100644 --- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/call/CallMapper.java +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/call/CallMapper.java @@ -37,10 +37,15 @@ @Select("select * from lihu.call_patient where pat_id = #{patId} order by id desc limit 1") CallDO getLatestPatientCall(@Param("patId") String patId); - @Select("select * from lihu.call_patient where called = 0 order by id limit 1") - CallDO getNextCall(); + // call_type 0 澶у睆 + @Select("select * from lihu.call_patient where called = 0 and call_type = 0 order by id limit 1") + CallDO getNextCall( ); - //@Update("TRUNCATE TABLE lihu.call_patient") + // call_type 1 璇婇棿灞� + @Select("select * from lihu.call_patient where called = 0 and call_type = 1 and room_id = #{roomId} order by id limit 1") + CallDO getNextInstallCall(@Param("roomId") Long roomId); + + //@Update("TRUNCATE TABLE lihu.call_patient") 淇濇寔褰撳ぉ鏁版嵁 @Delete("delete from lihu.call_patient where TO_DAYS(book_date) != TO_DAYS(NOW())") void clearCall(); } diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallService.java index 119d4be..559b68d 100644 --- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallService.java +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallService.java @@ -46,13 +46,20 @@ CallDO getCall(Integer id); /** - * 鑾峰緱涓嬩竴涓彨鍙� + * 澶у睆..鑾峰緱涓嬩竴涓彨鍙� * * @return 鍙彿 */ CallDO getNextCall(); /** + * 璇婇棿灞�..鑾峰緱涓嬩竴涓彨鍙� + * @param reqIp + * @return + */ + CallDO getNextInstallCall(String reqIp); + + /** * 鑾峰緱鍙彿鍒嗛〉 * * @param pageReqVO 鍒嗛〉鏌ヨ diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallServiceImpl.java index 08f348c..d42a4a6 100644 --- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallServiceImpl.java +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallServiceImpl.java @@ -1,6 +1,10 @@ package cn.lihu.jh.module.ecg.service.call; +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.room.RoomMapper; import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; import org.springframework.validation.annotation.Validated; import cn.lihu.jh.module.ecg.controller.admin.call.vo.*; @@ -11,6 +15,10 @@ import cn.lihu.jh.module.ecg.dal.mysql.call.CallMapper; import javax.annotation.Resource; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*; @@ -26,6 +34,9 @@ @Resource private CallMapper callMapper; + + @Resource + private RoomMapper roomMapper; @Override public Integer createCall(CallSaveReqVO createReqVO) { @@ -66,7 +77,20 @@ @Override public CallDO getNextCall() { - CallDO callDO = callMapper.getNextCall(); + CallDO callDO = callMapper.getNextCall(); // 澶у睆 + return callDO; + } + + @Override + public CallDO getNextInstallCall(String reqIp) { + List<RoomDO> roomDOList = roomMapper.queueByIp(reqIp); + Optional<RoomDO> optionalQueueDO = roomDOList.stream().filter(item -> StringUtils.hasLength(item.getIp())).findFirst(); + if (!optionalQueueDO.isPresent()) { + return null; + } + + Long roomId = optionalQueueDO.get().getRoomId(); + CallDO callDO = callMapper.getNextInstallCall( roomId ); // 璇婇棿灞� return callDO; } diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenService.java index 73fbb60..ff02fdc 100644 --- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenService.java +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenService.java @@ -15,7 +15,7 @@ import java.util.Map; /** - * 鎺掗槦 Service 鎺ュ彛 + * 鍙彿灞� Service 鎺ュ彛 * * @author 鑺嬮亾婧愮爜 */ -- Gitblit v1.9.3