eight
2024-11-07 a156ddbb26693b8040f9dbbd7582a12c1fc8d61b
预约序号
已修改13个文件
123 ■■■■■ 文件已修改
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/config/MySpringEventListener.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentConfirmReqVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/QueueSaveReqVO.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueDO.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queuesequence/QueueSequenceMapper.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/config/EcgConfigService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/config/EcgConfigServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
@@ -56,4 +56,8 @@
    ErrorCode CHECK_TYPE_NOT_EXISTS = new ErrorCode(1_010_009_000, "检查类型不存在");
    ErrorCode QUEUE_SEQUENCE_NOT_EXISTS = new ErrorCode(1_010_010_000, "当天序号不存在");
    ErrorCode QUEUE_SEQUENCE_TIMESLOT_FULL = new ErrorCode(1_010_010_002, "本时段序号已满");
    ErrorCode QUEUE_SEQUENCE_TIMESLOT_EXCEPTION = new ErrorCode(1_010_010_002, "本时段序号异常");
    ErrorCode QUEUE_SEQUENCE_TIMESLOT_VIP_FULL = new ErrorCode(1_010_010_003, "本时段VIP序号已满");
    ErrorCode QUEUE_SEQUENCE_TIMESLOT_VIP_EXCEPTION = new ErrorCode(1_010_010_003, "本时段VIP序号异常");
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/config/MySpringEventListener.java
@@ -43,6 +43,8 @@
        queueService.initCheckType();
        ecgConfigService.readTimeSlotConfig();
        BigScreenConfig bigScreenConfig = new BigScreenConfig();
//        Integer waitingSize = Integer.valueOf(configApi.getConfigValueByKey(ECG_SCREEN_PANE_WAITING_KEY));
//        Integer passedSize = Integer.valueOf(configApi.getConfigValueByKey(ECG_SCREEN_PANE_PASSED_KEY));
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
@@ -143,9 +143,19 @@
    @PostMapping("/confirm")
    @Operation(summary = "预约确认")
    @PreAuthorize("@ss.hasPermission('ecg:appointment:confirm')")
    public CommonResult<String> appointmentConfirm(@RequestBody AppointmentConfirmReqVO confirmReqVO) {
        appointmentService.appoitmentConfirm( confirmReqVO );
        return success("确认成功");
    public CommonResult<Integer> appointmentConfirm(@RequestBody AppointmentConfirmReqVO confirmReqVO) {
        confirmReqVO.setIsVip(0);
        Integer newSeqNo = appointmentService.appoitmentConfirm( confirmReqVO );
        return success(newSeqNo);
    }
    @PostMapping("/confirm-vip")
    @Operation(summary = "VIP预约确认")
    @PreAuthorize("@ss.hasPermission('ecg:appointment:confirm')")
    public CommonResult<Integer> appointmentConfirmVip(@RequestBody AppointmentConfirmReqVO confirmReqVO) {
        confirmReqVO.setIsVip(1);
        Integer newSeqNo = appointmentService.appoitmentConfirm( confirmReqVO );
        return success(newSeqNo);
    }
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentConfirmReqVO.java
@@ -42,4 +42,6 @@
    //@NotNull(message = "预约检查类型不能为空")
    private Integer bookCheckType;
    private Integer isVip;
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/QueueSaveReqVO.java
@@ -40,6 +40,14 @@
    @Schema(description = "预约检查类型", example = "1")
    private Integer bookCheckType;
    @Schema(description = "预约序号", requiredMode = Schema.RequiredMode.REQUIRED)
    //@NotNull(message = "预约序号不能为空")
    private Integer bookSeqNum;
    @Schema(description = "是否VIP", requiredMode = Schema.RequiredMode.REQUIRED)
    //@NotNull(message = "是否VIP")
    private Integer isVip;
    @Schema(description = "排队序号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "排队序号不能为空")
    private Integer seqNum;
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueDO.java
@@ -55,6 +55,14 @@
     */
    private Integer bookCheckType;
    /**
     * 预约序号
     */
    private Integer bookSeqNum;
    /**
     * 是否VIP
     */
    private Integer isVip;
    /**
     * 排队序号
     */
    private Integer seqNum;
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queuesequence/QueueSequenceMapper.java
@@ -6,9 +6,8 @@
import cn.lihu.jh.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.lihu.jh.framework.mybatis.core.mapper.BaseMapperX;
import cn.lihu.jh.module.ecg.dal.dataobject.queuesequence.QueueSequenceDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.*;
import cn.lihu.jh.module.ecg.controller.admin.queuesequence.vo.*;
import org.apache.ibatis.annotations.Update;
/**
 * 当天序号 Mapper
@@ -33,4 +32,15 @@
    @Update("truncate table lihu.queue_sequence")
    void clearQueueSequenceTable();
    @Select("select queue_no from lihu.queue_sequence where check_type=#{checkType} and time_slot=#{timeslot} and queue_no < queue_full for update; ")
    Integer selectQueueNoForUpdate(@Param("checkType") Integer checkType, @Param("timeslot") Integer timeslot);
    @Update("update lihu.queue_sequence set queue_no = queue_no + 1 where check_type=#{checkType} and time_slot=#{timeslot} and queue_no=#{curQueueNo} and queue_no < queue_full; ")
    Integer updateGivenCheckTypeTimeslotSeqNo(@Param("checkType") Integer checkType, @Param("timeslot") Integer timeslot, @Param("curQueueNo") Integer curQueueNo);
    @Select("select queue_vip_no from lihu.queue_sequence where check_type=#{checkType} and time_slot=#{timeslot} and queue_no < queue_full for update; ")
    Integer selectQueueVipNoForUpdate(@Param("checkType") Integer checkType, @Param("timeslot") Integer timeslot);
    @Update("update lihu.queue_sequence set queue_vip_no = queue_vip_no + 1 where check_type=#{checkType} and time_slot=#{timeslot} and queue_vip_no=#{curQueueVipNo} and queue_vip_no < queue_vip_full; ")
    Integer updateGivenCheckTypeTimeslotVipSeqNo(@Param("checkType") Integer checkType, @Param("timeslot") Integer timeslot, @Param("curQueueVipNo") Integer curQueueVipNo);
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentService.java
@@ -70,5 +70,5 @@
    List<AppointmentDO> getAppointmentExtermal(String patId);
    String appoitmentConfirm(AppointmentConfirmReqVO appointmentConfirmReqVO);
    Integer appoitmentConfirm(AppointmentConfirmReqVO appointmentConfirmReqVO);
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
@@ -7,7 +7,9 @@
import cn.lihu.jh.module.ecg.feign.RestApiReqBodyVo;
import cn.lihu.jh.module.ecg.feign.RestApiResult;
import cn.lihu.jh.module.ecg.feign.dto.AppointmentExternal;
import cn.lihu.jh.module.ecg.service.config.EcgConfigService;
import cn.lihu.jh.module.ecg.service.queue.QueueService;
import cn.lihu.jh.module.ecg.service.queuesequence.QueueSequenceService;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -42,7 +44,13 @@
public class AppointmentServiceImpl implements AppointmentService {
    @Resource
    private EcgConfigService ecgConfigService;
    @Resource
    private RemoteDataService remoteDataService;
    @Resource
    private QueueSequenceService queueSequenceService;
    @Resource
    private QueueService queueService;
@@ -175,7 +183,7 @@
            if (null != appointmentExternal.getReqExtBooktime() ) {
                appointmentDO.setBookDate(DateUtils.ofUTC(appointmentExternal.getReqExtBooktime()).toLocalDate());
                LocalDateTime bookStartTime = DateUtils.ofUTC(appointmentExternal.getReqExtBooktime());
                LocalDateTime bookEndTime = bookStartTime.plusMinutes(30);
                LocalDateTime bookEndTime = bookStartTime.plusMinutes( ecgConfigService.getTimeslotLength());
                appointmentDO.setBookTimeslot((bookStartTime.getHour() * 100 + bookStartTime.getMinute()) * 10000 + bookEndTime.getHour() * 100 + bookEndTime.getMinute());
            }
@@ -190,13 +198,21 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String appoitmentConfirm(AppointmentConfirmReqVO confirmReqVO) {
    public Integer appoitmentConfirm(AppointmentConfirmReqVO confirmReqVO) {
        AppointmentDO appointment = getAppointment(confirmReqVO.getId());
        if (null == appointment)
            throw exception(PATIENT_NOT_EXISTS);
        if ( !DateUtils.isToday(appointment.getBookDate()) )
            throw exception( APPOINTMENT_NOT_TODAY);
        Integer newSeqNo = null;
        if (confirmReqVO.getIsVip() == 0) {
            newSeqNo = queueSequenceService.distributeSeqNo(confirmReqVO.getBookCheckType(), confirmReqVO.getBookTimeslot());
        } else {
            newSeqNo = queueSequenceService.distributeVipSeqNo(confirmReqVO.getBookCheckType(), confirmReqVO.getBookTimeslot());
        }
        try {
            QueueSaveReqVO queueSaveReqVO = new QueueSaveReqVO();
@@ -206,6 +222,8 @@
            queueSaveReqVO.setBookDate(appointment.getBookDate());
            queueSaveReqVO.setBookTimeslot(appointment.getBookTimeslot());
            queueSaveReqVO.setBookCheckType(appointment.getBookCheckType());
            queueSaveReqVO.setBookSeqNum( newSeqNo );
            queueSaveReqVO.setIsVip( confirmReqVO.getIsVip() );
            queueSaveReqVO.setPassed((byte) 0);
            queueSaveReqVO.setExpired((byte) 0);
            queueSaveReqVO.setPatDetails( appointment.getPatDeptDesc() + "-" + appointment.getPatWardDesc() + "-" + appointment.getPatBedNo());
@@ -214,7 +232,7 @@
            throw exception(APPOINTMENT_HAVE_QUEUED);
        }
        return "确认成功";
        return newSeqNo;
    }
    private Integer getCorrespondingCheckType(String strPlanDefItemcode) {
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/config/EcgConfigService.java
@@ -7,4 +7,5 @@
    void resetScheduler();
    void readTimeSlotConfig();
    List<LocalTime> listTimeslot();
    Integer getTimeslotLength();
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/config/EcgConfigServiceImpl.java
@@ -39,6 +39,7 @@
    private QueueSequenceService queueSequenceService;
    List<LocalTime> timeslotList = null;
    Integer timeslotLength = 0;
    ScheduledTask startBizTask = null;
    ScheduledTask closeBizTask = null;
@@ -85,6 +86,7 @@
    @Override
    public void readTimeSlotConfig() {
        String strBookTimeslotLength = configApi.getConfigValueByKey(BOOK_TIMESLOT_LENGTH);
        timeslotLength = Integer.valueOf(strBookTimeslotLength);
        //String strBookTimeslotList = configApi.getConfigValueByKey(BOOK_TIMESLOT_LIST);
        //timeslotList = Utils.parseTimeSlotList(strBookTimeslotList, Integer.valueOf(strBookTimeslotLength));
    }
@@ -94,4 +96,9 @@
        return  timeslotList;
    }
    @Override
    public Integer getTimeslotLength() {
        return timeslotLength;
    }
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceService.java
@@ -54,4 +54,7 @@
    PageResult<QueueSequenceDO> getQueueSequencePage(QueueSequencePageReqVO pageReqVO);
    void  resetQueueSequence();
    Integer distributeSeqNo(Integer checkType, Integer timeslot);
    Integer distributeVipSeqNo(Integer checkType, Integer timeslot);
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java
@@ -119,5 +119,37 @@
        });
    }
    @Override
    @Transactional
    public Integer distributeSeqNo(Integer checkType, Integer timeslot) {
        Integer curSeqNo = queueSequenceMapper.selectQueueNoForUpdate(checkType, timeslot);
        if (null == curSeqNo) {
            throw exception(QUEUE_SEQUENCE_TIMESLOT_FULL);
        }
        Integer updateRowNum = queueSequenceMapper.updateGivenCheckTypeTimeslotSeqNo(checkType, timeslot, curSeqNo);
        if (null == updateRowNum || updateRowNum == 0) {
            throw exception(QUEUE_SEQUENCE_TIMESLOT_EXCEPTION);
        }
        return curSeqNo + 1;
    }
    @Override
    @Transactional
    public Integer distributeVipSeqNo(Integer checkType, Integer timeslot) {
        Integer curVipSeqNo = queueSequenceMapper.selectQueueVipNoForUpdate(checkType, timeslot);
        if (null == curVipSeqNo) {
            throw exception(QUEUE_SEQUENCE_TIMESLOT_FULL);
        }
        Integer updateRowNum = queueSequenceMapper.updateGivenCheckTypeTimeslotVipSeqNo(checkType, timeslot, curVipSeqNo);
        if (null == updateRowNum || updateRowNum == 0) {
            throw exception(QUEUE_SEQUENCE_TIMESLOT_EXCEPTION);
        }
        return curVipSeqNo + 1;
    }
}