eight
2024-10-15 be29e4df82e7f6425db15b03f09aaee1cd9cfb1d
大屏.小屏 叫号逻辑
已修改6个文件
67 ■■■■ 文件已修改
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/CallController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/call/CallMapper.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallService.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallServiceImpl.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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));
    }
}
    @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));
    }
}
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();
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();
}
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 分页查询
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;
    }
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 芋道源码
 */