eight
2024-08-27 dde48b28846af614af49d9e569d12dd69ec910a9
update
已修改9个文件
172 ■■■■■ 文件已修改
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedCloseCallable.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedDoctorOffCallable.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedDoctorOnCallable.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedDoctorPauseCallable.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedOpenCallable.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java 81 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
@@ -9,7 +9,11 @@
 */
public interface ErrorCodeConstants {
    ErrorCode APPOINTMENT_NOT_EXISTS = new ErrorCode(1_010_000_000, "预约不存在");
    ErrorCode ROOM_NOT_EXISTS = new ErrorCode(1_010_001_000, "诊室和诊疗床不存在");
    ErrorCode QUEUE_NOT_EXISTS = new ErrorCode(1_010_002_000, "排队不存在");
    ErrorCode ECG_INNER_ERROR = new ErrorCode(1_010_000_000, "ECG内部错误");
    ErrorCode APPOINTMENT_NOT_EXISTS = new ErrorCode(1_010_001_000, "预约不存在");
    ErrorCode ROOM_NOT_EXISTS = new ErrorCode(1_010_002_000, "诊室和诊疗床不存在");
    ErrorCode ROOM_INVALID_STATUS = new ErrorCode(1_010_002_001, "诊室和诊疗床状态异常");
    ErrorCode QUEUE_NOT_EXISTS = new ErrorCode(1_010_003_000, "排队不存在");
    ErrorCode QUEUE_BED_ABNORMAL = new ErrorCode(1_010_003_001, "工位队列不存在");
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java
@@ -17,6 +17,7 @@
import cn.lihu.jh.framework.common.pojo.CommonResult;
import cn.lihu.jh.framework.common.util.object.BeanUtils;
import static cn.lihu.jh.framework.common.exception.enums.GlobalErrorCodeConstants.SUCCESS;
import static cn.lihu.jh.framework.common.pojo.CommonResult.error;
import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
@@ -103,11 +104,11 @@
        @RequestParam("roomId") Long roomId,
        @RequestParam("bedNo") String bedNo)
    {
        Integer result = queueService.startBedOpen(roomId, bedNo);
        if (null == result || 0 == result)
        ErrorCode result = queueService.startBedOpen(roomId, bedNo);
        if (result.equals(SUCCESS))
            return success(0);
        return error(new ErrorCode(result, "出错了"));
        return error(result);
    }
    @GetMapping("/bed-close")
@@ -117,11 +118,11 @@
        @RequestParam("roomId") Long roomId,
        @RequestParam("bedNo") String bedNo)
    {
        Integer result = queueService.startBedClose(roomId, bedNo);
        if (null == result || 0 == result)
        ErrorCode result = queueService.startBedClose(roomId, bedNo);
        if (result.equals(SUCCESS))
            return success(0);
        return error(new ErrorCode(result, "出错了"));
        return error(result);
    }
    @GetMapping("/bed-doctor-pause")
@@ -136,11 +137,11 @@
        Long userId = SecurityFrameworkUtils.getLoginUserId();
        String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
        Integer result = queueService.startBedDoctorPause(roomId, bedNo, userId, userNickname);
        if (null == result || 0 == result)
        ErrorCode result = queueService.startBedDoctorPause(roomId, bedNo, userId, userNickname);
        if (result.equals(SUCCESS))
            return success(0);
        return error(new ErrorCode(result, "出错了"));
        return error(result);
    }
    @GetMapping("/bed-doctor-on")
@@ -153,11 +154,11 @@
        Long userId = SecurityFrameworkUtils.getLoginUserId();
        String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
        Integer result = queueService.startBedDoctorOn(roomId, bedNo, userId, userNickname);
        if (null == result || 0 == result)
        ErrorCode result = queueService.startBedDoctorOn(roomId, bedNo, userId, userNickname);
        if (result.equals(SUCCESS))
            return success(0);
        return error(new ErrorCode(result, "出错了"));
        return error(result);
    }
    @GetMapping("/bed-doctor-off")
@@ -170,11 +171,11 @@
        Long userId = SecurityFrameworkUtils.getLoginUserId();
        String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
        Integer result = queueService.startBedDoctorOff(roomId, bedNo, userId, userNickname);
        if (null == result || 0 == result)
        ErrorCode result = queueService.startBedDoctorOff(roomId, bedNo, userId, userNickname);
        if (result.equals(SUCCESS))
            return success(0);
        return error(new ErrorCode(result, "出错了"));
        return error(result);
    }
    @GetMapping("/startbiz")
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedCloseCallable.java
@@ -1,8 +1,10 @@
package cn.lihu.jh.module.ecg.service.queue;
import cn.lihu.jh.framework.common.exception.ErrorCode;
import java.util.concurrent.Callable;
public class BedCloseCallable implements Callable<Integer> {
public class BedCloseCallable implements Callable<ErrorCode> {
    QueueService queueService;
    private Long roomId;
@@ -16,7 +18,7 @@
        this.queueService = queueService;
    }
    public Integer call() throws Exception {
    public ErrorCode call() throws Exception {
        return queueService.bedClose(roomId, bedNo);
    }
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedDoctorOffCallable.java
@@ -1,8 +1,10 @@
package cn.lihu.jh.module.ecg.service.queue;
import cn.lihu.jh.framework.common.exception.ErrorCode;
import java.util.concurrent.Callable;
public class BedDoctorOffCallable implements Callable<Integer> {
public class BedDoctorOffCallable implements Callable<ErrorCode> {
    QueueService queueService;
    private Long roomId;
@@ -20,7 +22,7 @@
        this.docName = docName;
    }
    public Integer call() throws Exception {
    public ErrorCode call() throws Exception {
        return queueService.bedDoctorOff(roomId, bedNo, docId, docName);
    }
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedDoctorOnCallable.java
@@ -1,8 +1,10 @@
package cn.lihu.jh.module.ecg.service.queue;
import cn.lihu.jh.framework.common.exception.ErrorCode;
import java.util.concurrent.Callable;
public class BedDoctorOnCallable implements Callable<Integer> {
public class BedDoctorOnCallable implements Callable<ErrorCode> {
    QueueService queueService;
    private Long roomId;
@@ -20,7 +22,7 @@
        this.docName = docName;
    }
    public Integer call() throws Exception {
    public ErrorCode call() throws Exception {
        return queueService.bedDoctorOn(roomId, bedNo, docId, docName);
    }
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedDoctorPauseCallable.java
@@ -1,8 +1,10 @@
package cn.lihu.jh.module.ecg.service.queue;
import cn.lihu.jh.framework.common.exception.ErrorCode;
import java.util.concurrent.Callable;
public class BedDoctorPauseCallable implements Callable<Integer> {
public class BedDoctorPauseCallable implements Callable<ErrorCode> {
    QueueService queueService;
    private Long roomId;
@@ -20,7 +22,7 @@
        this.docName = docName;
    }
    public Integer call() throws Exception {
    public ErrorCode call() throws Exception {
        return queueService.bedDoctorPause(roomId, bedNo, docId, docName);
    }
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedOpenCallable.java
@@ -1,5 +1,6 @@
package cn.lihu.jh.module.ecg.service.queue;
import cn.lihu.jh.framework.common.exception.ErrorCode;
import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
import cn.lihu.jh.module.ecg.dal.mysql.queue.queueMapper;
import cn.lihu.jh.module.ecg.dal.mysql.room.RoomMapper;
@@ -15,7 +16,7 @@
import static cn.lihu.jh.module.ecg.service.queue.QueueService.MAX_QUEUE_NUM;
public class BedOpenCallable implements Callable<Integer> {
public class BedOpenCallable implements Callable<ErrorCode> {
    QueueService queueService;
    private Long roomId;
@@ -29,7 +30,7 @@
        this.queueService = queueService;
    }
    public Integer call() throws Exception {
    public ErrorCode call() throws Exception {
        return queueService.bedOpen(roomId, bedNo);
    }
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java
@@ -1,5 +1,6 @@
package cn.lihu.jh.module.ecg.service.queue;
import cn.lihu.jh.framework.common.exception.ErrorCode;
import cn.lihu.jh.module.ecg.controller.admin.queue.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
import cn.lihu.jh.framework.common.pojo.PageResult;
@@ -44,17 +45,17 @@
    /**
     *
     */
    Integer startBedOpen(Long roomId, String bedNo);
    Integer startBedClose(Long roomId, String bedNo);
    Integer startBedDoctorPause(Long roomId, String bedNo, Long docId, String docName);
    Integer startBedDoctorOn(Long roomId, String bedNo, Long docId, String docName);
    Integer startBedDoctorOff(Long roomId, String bedNo, Long docId, String docName);
    ErrorCode startBedOpen(Long roomId, String bedNo);
    ErrorCode startBedClose(Long roomId, String bedNo);
    ErrorCode startBedDoctorPause(Long roomId, String bedNo, Long docId, String docName);
    ErrorCode startBedDoctorOn(Long roomId, String bedNo, Long docId, String docName);
    ErrorCode startBedDoctorOff(Long roomId, String bedNo, Long docId, String docName);
    Integer bedOpen(Long roomId, String bedNo);
    Integer bedClose(Long roomId, String bedNo);
    Integer bedDoctorPause(Long roomId, String bedNo, Long docId, String docName);
    Integer bedDoctorOn(Long roomId, String bedNo, Long docId, String docName);
    Integer bedDoctorOff(Long roomId, String bedNo, Long docId, String docName);
    ErrorCode bedOpen(Long roomId, String bedNo);
    ErrorCode bedClose(Long roomId, String bedNo);
    ErrorCode bedDoctorPause(Long roomId, String bedNo, Long docId, String docName);
    ErrorCode bedDoctorOn(Long roomId, String bedNo, Long docId, String docName);
    ErrorCode bedDoctorOff(Long roomId, String bedNo, Long docId, String docName);
    /**
     * 获得排队
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java
@@ -1,10 +1,12 @@
package cn.lihu.jh.module.ecg.service.queue;
import cn.lihu.jh.framework.common.exception.ErrorCode;
import cn.lihu.jh.module.ecg.dal.dataobject.queue.BedQueueStatisticDO;
import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueStatisticDO;
import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO;
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.ErrorCodeConstants;
import cn.lihu.jh.module.ecg.enums.QueueStatusEnum;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@@ -22,6 +24,7 @@
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import static cn.lihu.jh.framework.common.exception.enums.GlobalErrorCodeConstants.SUCCESS;
import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
@@ -77,11 +80,11 @@
    }
    @Override
    public Integer startBedOpen(Long roomId, String bedNo) {
        Future<Integer> future = singleThreadExecutor.submit( new BedOpenCallable(this, roomId, bedNo));
    public ErrorCode startBedOpen(Long roomId, String bedNo) {
        Future<ErrorCode> future = singleThreadExecutor.submit( new BedOpenCallable(this, roomId, bedNo));
        try {
            Integer ret = future.get();
            ErrorCode ret = future.get();
            return ret;
        } catch (InterruptedException e) {
            e.printStackTrace();
@@ -89,15 +92,15 @@
            e.printStackTrace();
        }
        return 100;
        return ECG_INNER_ERROR;
    }
    @Override
    public Integer startBedClose(Long roomId, String bedNo) {
        Future<Integer> future = singleThreadExecutor.submit( new BedCloseCallable(this, roomId, bedNo));
    public ErrorCode startBedClose(Long roomId, String bedNo) {
        Future<ErrorCode> future = singleThreadExecutor.submit( new BedCloseCallable(this, roomId, bedNo));
        try {
            Integer ret = future.get();
            ErrorCode ret = future.get();
            return ret;
        } catch (InterruptedException e) {
            e.printStackTrace();
@@ -105,17 +108,17 @@
            e.printStackTrace();
        }
        return 100;
        return ECG_INNER_ERROR;
    }
    @Override
    public Integer startBedDoctorPause(Long roomId, String bedNo, Long docId, String docName) {
        Future<Integer> future = singleThreadExecutor.submit(
    public ErrorCode startBedDoctorPause(Long roomId, String bedNo, Long docId, String docName) {
        Future<ErrorCode> future = singleThreadExecutor.submit(
            new BedDoctorPauseCallable(this, roomId, bedNo, docId, docName)
        );
        try {
            Integer ret = future.get();
            ErrorCode ret = future.get();
            return ret;
        } catch (InterruptedException e) {
            e.printStackTrace();
@@ -123,17 +126,17 @@
            e.printStackTrace();
        }
        return 100;
        return ECG_INNER_ERROR;
    }
    @Override
    public Integer startBedDoctorOn(Long roomId, String bedNo, Long docId, String docName) {
        Future<Integer> future = singleThreadExecutor.submit(
    public ErrorCode startBedDoctorOn(Long roomId, String bedNo, Long docId, String docName) {
        Future<ErrorCode> future = singleThreadExecutor.submit(
            new BedDoctorOnCallable(this, roomId, bedNo, docId, docName)
        );
        try {
            Integer ret = future.get();
            ErrorCode ret = future.get();
            return ret;
        } catch (InterruptedException e) {
            e.printStackTrace();
@@ -141,17 +144,17 @@
            e.printStackTrace();
        }
        return 100;
        return ECG_INNER_ERROR;
    }
    @Override
    public Integer startBedDoctorOff(Long roomId, String bedNo, Long docId, String docName) {
        Future<Integer> future = singleThreadExecutor.submit(
    public ErrorCode startBedDoctorOff(Long roomId, String bedNo, Long docId, String docName) {
        Future<ErrorCode> future = singleThreadExecutor.submit(
            new BedDoctorOffCallable(this, roomId, bedNo, docId, docName)
        );
        try {
            Integer ret = future.get();
            ErrorCode ret = future.get();
            return ret;
        } catch (InterruptedException e) {
            e.printStackTrace();
@@ -159,7 +162,7 @@
            e.printStackTrace();
        }
        return 100;
        return ECG_INNER_ERROR;
    }
@@ -170,7 +173,7 @@
     * @return
     */
    @Override
    public Integer bedOpen(Long roomId, String bedNo) {
    public ErrorCode bedOpen(Long roomId, String bedNo) {
        // DB update
        List statusList = new ArrayList<BedStatusEnum>();
        statusList.add(BedStatusEnum.CLOSED);
@@ -178,7 +181,7 @@
        Integer updateNum = roomMapper.setBedStatus(roomId, bedNo,
                BedStatusEnum.OPENING, statusList);
        if ( null==updateNum || 0 == updateNum )
            return 310;
            return ROOM_INVALID_STATUS;
        List<Byte> queueStatusList = new ArrayList<>();
        queueStatusList.add(QueueStatusEnum.READY.getStatus());
@@ -192,14 +195,14 @@
        bedQueueBO.setQueueNum(new AtomicInteger(queueDOList.size()));
        priorityQueue.offer(bedQueueBO);
        mapBedVsQueue.put(String.format("%09d%s", roomId, bedNo), bedQueueBO);
        return 0;
        return SUCCESS;
    }
    @Override
    public Integer bedClose(Long roomId, String bedNo) {
    public ErrorCode bedClose(Long roomId, String bedNo) {
        BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
        if (null == bedQueueBO)
            return 320;
            return QUEUE_BED_ABNORMAL;
        // DB update
        List statusList = new ArrayList<BedStatusEnum>();
@@ -209,16 +212,16 @@
        Integer updateNum = roomMapper.setBedStatus(roomId, bedNo,
                BedStatusEnum.CLOSING, statusList);
        if ( null==updateNum || 0 == updateNum )
            return 321;
            return ROOM_INVALID_STATUS;
        return 0;
        return SUCCESS;
    }
    @Override
    public Integer bedDoctorPause(Long roomId, String bedNo, Long docId, String docName) {
    public ErrorCode bedDoctorPause(Long roomId, String bedNo, Long docId, String docName) {
        BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
        if (null == bedQueueBO)
            return 320;
            return QUEUE_BED_ABNORMAL;
        // DB update
        List statusList = new ArrayList<BedStatusEnum>();
@@ -226,16 +229,16 @@
        Integer updateNum = roomMapper.setBedDoctorPause(roomId, bedNo, docId, docName,
                BedStatusEnum.PAUSE, statusList);
        if ( null==updateNum || 0 == updateNum )
            return 331;
            return ROOM_INVALID_STATUS;
        return 0;
        return SUCCESS;
    }
    @Override
    public Integer bedDoctorOn(Long roomId, String bedNo, Long docId, String docName) {
    public ErrorCode bedDoctorOn(Long roomId, String bedNo, Long docId, String docName) {
        BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
        if (null == bedQueueBO)
            return 320;
            return QUEUE_BED_ABNORMAL;
        // DB update
        List statusList = new ArrayList<BedStatusEnum>();
@@ -243,16 +246,16 @@
        Integer updateNum = roomMapper.setBedDoctorOn(roomId, bedNo, docId, docName,
                BedStatusEnum.DOCTOR_ON, statusList);
        if ( null==updateNum || 0 == updateNum )
            return 341;
            return ROOM_INVALID_STATUS;
        return 0;
        return SUCCESS;
    }
    @Override
    public Integer bedDoctorOff(Long roomId, String bedNo, Long docId, String docName) {
    public ErrorCode bedDoctorOff(Long roomId, String bedNo, Long docId, String docName) {
        BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
        if (null == bedQueueBO)
            return 320;
            return QUEUE_BED_ABNORMAL;
        // DB update
        List statusList = new ArrayList<BedStatusEnum>();
@@ -260,9 +263,9 @@
        Integer updateNum = roomMapper.setBedDoctorOff(roomId, bedNo, docId, docName,
                BedStatusEnum.OPENING, statusList);
        if ( null==updateNum || 0 == updateNum )
            return 351;
            return ROOM_INVALID_STATUS;
        return 0;
        return SUCCESS;
    }
    private void validatequeueExists(Integer id) {