| | |
| | | ErrorCode APPOINTMENT_NOT_BILLING = new ErrorCode(1_010_001_040, "查询不到开单信息"); |
| | | ErrorCode APPOINTMENT_CREATE_FAIL = new ErrorCode(1_010_001_050, "申请单创建失败"); |
| | | ErrorCode APPOINTMENT_UPDATE_FAIL = new ErrorCode(1_010_001_060, "申请单更新失败"); |
| | | ErrorCode APPOINTMENT_STATUS_UPDATE_FAIL = new ErrorCode(1_010_001_070, "申请单状态更新"); |
| | | ErrorCode APPOINTMENT_STATUS_UPDATE_FAIL = new ErrorCode(1_010_001_070, "申请单状态更新失败"); |
| | | ErrorCode APPOINTMENT_STATUS_REGISTER_UPDATE_FAIL = new ErrorCode(1_010_001_080, "申请单登记状态更新失败"); |
| | | |
| | | ErrorCode ROOM_NOT_EXISTS = new ErrorCode(1_010_002_000, "诊室和诊疗床不存在"); |
| | | ErrorCode ROOM_NOT_SIT = new ErrorCode(1_010_002_001, "请重新就座"); |
| | |
| | | return success(BeanUtils.toBean(appointmentList.get(0), AppointmentRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @PostMapping("/page") |
| | | @Operation(summary = "获得预约分页") |
| | | @PreAuthorize("@ss.hasPermission('ecg:appointment:query')") |
| | | public CommonResult<PageResult<AppointmentRespVO>> getAppointmentPage(@Valid AppointmentPageReqVO pageReqVO) { |
| | | public CommonResult<PageResult<AppointmentRespVO>> getAppointmentPage(@RequestBody AppointmentPageReqVO pageReqVO) { |
| | | pageReqVO.setOrderCreateTime("1"); |
| | | PageResult<AppointmentDO> pageResult = appointmentService.getAppointmentPage(pageReqVO); |
| | | return success(BeanUtils.toBean(pageResult, AppointmentRespVO.class)); |
| | |
| | | * 登记时间 |
| | | */ |
| | | private Date registerDate; |
| | | private Date registerDateStart; |
| | | private Date registerDateEnd; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private LocalDateTime createTime; |
| | | private Date createTimeStart; |
| | | private Date createTimeEnd; |
| | | |
| | | /** |
| | | * 登记时间(查询条件) |
| | |
| | | ActionTypeEnum.S0202ECG, appointmentService::handleAppointmentUpdate, |
| | | ActionTypeEnum.S040501HIS, appointmentService::handleAppointmentStateUpdate, |
| | | ActionTypeEnum.S050401, appointmentService::handleCheckAppointmentUpdate, |
| | | ActionTypeEnum.S0405, appointmentService::handleAppointmentStatusUpdate, |
| | | ActionTypeEnum.S050501, appointmentService::handleCheckAppointmentUpdate |
| | | ); |
| | | |
| | |
| | | public interface AppointmentMapper extends BaseMapperX<AppointmentDO> { |
| | | |
| | | default PageResult<AppointmentDO> selectPage(AppointmentPageReqVO reqVO) { |
| | | LambdaQueryWrapperX<AppointmentDO> wrapper = (LambdaQueryWrapperX<AppointmentDO>) new LambdaQueryWrapperX<AppointmentDO>() |
| | | .eqIfPresent(AppointmentDO::getPatId, reqVO.getPatId()) |
| | | .likeIfPresent(AppointmentDO::getPatName, reqVO.getPatName()) |
| | | .eqIfPresent(AppointmentDO::getPatGender, reqVO.getPatGender()) |
| | | .eqIfPresent(AppointmentDO::getPatBirthday, reqVO.getPatBirthday()) |
| | | .eqIfPresent(AppointmentDO::getPatMobile, reqVO.getPatMobile()) |
| | | .eqIfPresent(AppointmentDO::getPatPhone, reqVO.getPatPhone()) |
| | | .eqIfPresent(AppointmentDO::getPatIdentityId, reqVO.getPatIdentityId()) |
| | | .eqIfPresent(AppointmentDO::getPatAddr, reqVO.getPatAddr()) |
| | | .eqIfPresent(AppointmentDO::getPatDeptCode, reqVO.getPatDeptCode()) |
| | | .eqIfPresent(AppointmentDO::getPatDeptDesc, reqVO.getPatDeptDesc()) |
| | | .eqIfPresent(AppointmentDO::getPatWardCode, reqVO.getPatWardCode()) |
| | | .eqIfPresent(AppointmentDO::getPatWardDesc, reqVO.getPatWardDesc()) |
| | | .eqIfPresent(AppointmentDO::getBookDate, reqVO.getBookDate()) |
| | | .eqIfPresent(AppointmentDO::getBookTimeslot, reqVO.getBookTimeslot()) |
| | | .eqIfPresent(AppointmentDO::getBookCheckType, reqVO.getBookCheckType()) |
| | | .eqIfPresent(AppointmentDO::getBookSrc, reqVO.getBookSrc()) |
| | | .eqIfPresent(AppointmentDO::getPaid, reqVO.getPaid()) |
| | | .eqIfPresent(AppointmentDO::getApplyNo, reqVO.getApplyNo()) |
| | | .eqIfPresent(AppointmentDO::getEpisodeId, reqVO.getEpisodeId()) |
| | | .inIfPresent(AppointmentDO::getStatus, reqVO.getStatus()) |
| | | // 时间范围查询,注意这里强制指定类型为 LambdaQueryWrapperX |
| | | .and(reqVO.getRegisterTime() != null, w -> { |
| | | LocalDate today = LocalDate.now(); |
| | | if ("上午".equals(reqVO.getRegisterTime())) { |
| | | w.between(AppointmentDO::getRegisterDate, today.atTime(5, 0, 0), today.atTime(13, 0, 0)); |
| | | } else if ("下午".equals(reqVO.getRegisterTime())) { |
| | | w.between(AppointmentDO::getRegisterDate, today.atTime(13, 0, 1), today.atTime(22, 0, 0)); |
| | | } |
| | | }); |
| | | |
| | | LambdaQueryWrapperX<AppointmentDO> wrapper = (LambdaQueryWrapperX<AppointmentDO>) new LambdaQueryWrapperX<AppointmentDO>().eqIfPresent(AppointmentDO::getPatId, reqVO.getPatId()).likeIfPresent(AppointmentDO::getPatName, reqVO.getPatName()).eqIfPresent(AppointmentDO::getPatGender, reqVO.getPatGender()).eqIfPresent(AppointmentDO::getPatBirthday, reqVO.getPatBirthday()).eqIfPresent(AppointmentDO::getPatMobile, reqVO.getPatMobile()).eqIfPresent(AppointmentDO::getPatPhone, reqVO.getPatPhone()).eqIfPresent(AppointmentDO::getPatIdentityId, reqVO.getPatIdentityId()).eqIfPresent(AppointmentDO::getPatAddr, reqVO.getPatAddr()).eqIfPresent(AppointmentDO::getPatDeptCode, reqVO.getPatDeptCode()).eqIfPresent(AppointmentDO::getPatDeptDesc, reqVO.getPatDeptDesc()).eqIfPresent(AppointmentDO::getPatWardCode, reqVO.getPatWardCode()).eqIfPresent(AppointmentDO::getPatWardDesc, reqVO.getPatWardDesc()).eqIfPresent(AppointmentDO::getBookDate, reqVO.getBookDate()).eqIfPresent(AppointmentDO::getBookTimeslot, reqVO.getBookTimeslot()).eqIfPresent(AppointmentDO::getBookCheckType, reqVO.getBookCheckType()).eqIfPresent(AppointmentDO::getBookSrc, reqVO.getBookSrc()).eqIfPresent(AppointmentDO::getPaid, reqVO.getPaid()).eqIfPresent(AppointmentDO::getApplyNo, reqVO.getApplyNo()).eqIfPresent(AppointmentDO::getEpisodeId, reqVO.getEpisodeId()).inIfPresent(AppointmentDO::getStatus, reqVO.getStatus()) |
| | | // ✅ 新增:createTime 区间查询 |
| | | .betweenIfPresent(AppointmentDO::getCreateTime, reqVO.getCreateTimeStart(), reqVO.getCreateTimeEnd()).betweenIfPresent(AppointmentDO::getRegisterDate, reqVO.getRegisterDateStart(), reqVO.getRegisterDateEnd()); |
| | | // 动态排序 |
| | | if (reqVO.getOrderCreateTime() != null) { |
| | | wrapper.orderByDesc(AppointmentDO::getCreateTime); |
| | | } else { |
| | | wrapper.orderByAsc(AppointmentDO::getRegisterDate) |
| | | .orderByAsc(AppointmentDO::getPatWardDesc); |
| | | wrapper.orderByAsc(AppointmentDO::getRegisterDate).orderByAsc(AppointmentDO::getPatWardDesc); |
| | | } |
| | | return selectPage(reqVO, wrapper); |
| | | } |
| | |
| | | @Select("select * from lihu.appointment where pat_id = #{patId} and book_check_type = #{checkType} and to_days(book_date) = to_days(Now()) limit 1") |
| | | AppointmentDO getByPatAndCheckTypeAndBookDate(@Param("patId") String patId, @Param("checkType") Integer checkType); |
| | | |
| | | @Update("update lihu.appointment set status = #{status} " + "<if test='registerDate != null'>" + ", register_date = #{registerDate} " + "</if>" + "where apply_no = #{applyNo};") |
| | | Integer updateStatusByApplyNo(@Param("applyNo") String applyNo, @Param("status") String status, @Param("registerDate") Date registerDate); |
| | | |
| | | @Select("select * from lihu.appointment where episode_id = #{episodeId} and apply_no = #{applyNo} limit 1") |
| | |
| | | S0202ECG("S0202ECG", "申请单更新"), |
| | | S040501HIS("S040501HIS", "预约更新"), |
| | | S050401("S050401", "检查预约状态新增"), |
| | | S0405("S0405", "申请单登记状态更新"), |
| | | S050501("S050501", "检查预约状态修改"); |
| | | |
| | | |
| | |
| | | void handleCheckAppointmentUpdate(Map<String, Object> dataMap); |
| | | |
| | | /** |
| | | * 登记状态更新 |
| | | * |
| | | * @param dataMap |
| | | */ |
| | | void handleAppointmentStatusUpdate(Map<String, Object> dataMap); |
| | | |
| | | /** |
| | | * 获得当天的预约 根据PatID and CheckType |
| | | * |
| | | * @param patId 编号 |
| | |
| | | import cn.lihu.jh.module.ecg.service.queuesequence.QueueSequenceService; |
| | | import cn.lihu.jh.module.ecg.webservice.WebServiceClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | // 医生开单时间 |
| | | Optional.ofNullable(dataMap.get("controlActProcess")).map(controlActProcess -> (Map<String, Object>) controlActProcess).map(controlActProcess -> (Map<String, Object>) controlActProcess.get("subject")).map(subject -> (Map<String, Object>) subject.get("observationRequest")).map(observationRequest -> (Map<String, Object>) observationRequest.get("author")).map(author -> (Map<String, Object>) author.get("time")).map(time -> (String) time.get("value")).map(str -> { |
| | | try { |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(str); |
| | | return new SimpleDateFormat("yyyyMMddHHmmss").parse(str); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | |
| | | appointmentMapper.updateById(appointment); |
| | | } |
| | | |
| | | @Override |
| | | public void handleAppointmentStatusUpdate(Map<String, Object> dataMap) { |
| | | if (dataMap == null) { |
| | | throw exception(APPOINTMENT_STATUS_REGISTER_UPDATE_FAIL); |
| | | } |
| | | //获取applyNo |
| | | Map<String, Object> controlActProcess = (Map<String, Object>) dataMap.get("controlActProcess"); |
| | | Map<String, Object> subject = (Map<String, Object>) controlActProcess.get("subject"); |
| | | Map<String, Object> placerGroup = (Map<String, Object>) subject.get("placerGroup"); |
| | | Map<String, Object> component2 = (Map<String, Object>) placerGroup.get("component2"); |
| | | Map<String, Object> observationRequest = (Map<String, Object>) component2.get("observationRequest"); |
| | | Map<String, Object> id = (Map<String, Object>) observationRequest.get("id"); |
| | | String applyNo = String.valueOf(id.get("extension")); |
| | | |
| | | //获取status |
| | | Map<String, Object> component1 = (Map<String, Object>) observationRequest.get("component1"); |
| | | Map<String, Object> processStep = (Map<String, Object>) component1.get("processStep"); |
| | | Map<String, Object> codeMap = (Map<String, Object>) processStep.get("code"); |
| | | String status = String.valueOf(codeMap.get("code")); |
| | | |
| | | //状态更新 |
| | | Integer i = appointmentMapper.updateStatusByApplyNo(applyNo, status, null); |
| | | log.info("申请单登记applyNo:{},状态status:{},更新结果:{}", applyNo, status, i); |
| | | |
| | | } |
| | | |
| | | public AppointmentDO getByApplyNo(String applyNo) { |
| | | return appointmentMapper.getByApplyNo(applyNo); |
| | | } |
| | |
| | | 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ |
| | | --> |
| | | |
| | | </mapper> |
| | | <update id="updateStatusByApplyNo"> |
| | | update lihu.appointment |
| | | set status = #{status} |
| | | <if test="registerDate != null"> |
| | | , register_date = #{registerDate} |
| | | </if> |
| | | where apply_no = #{applyNo} |
| | | </update> |
| | | |
| | | </mapper> |