Files
his/com/openhis/web/outpatient/mapper/RegistrationMapper.java
2026-05-27 00:45:22 +08:00

46 lines
1.6 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.openhis.web.outpatient.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
/**
* 门诊挂号相关数据访问层
*
* 新增:
* 1. {@link #updateSlotStatusToPaid(Long)} 在预约签到缴费成功后,将对应的号源
* {@code adm_schedule_slot} 表的 {@code status} 字段更新为 3已取号
* 解决 Bug #574。
* 2. {@link #incrementBookedNumByOrderId(Long)} 在预约成功后实时累加
* {@code adm_schedule_pool.booked_num},用于 Bug #575已在其他提交中实现
*/
@Mapper
public interface RegistrationMapper {
/**
* 将对应的号源状态更新为已取号status = 3
*
* @param slotId 号源主键 ID
* @return 受影响的行数
*/
@Update("UPDATE adm_schedule_slot SET status = 3 WHERE id = #{slotId}")
int updateSlotStatusToPaid(@Param("slotId") Long slotId);
/**
* 预约成功后,累加对应排班池的已预约数量。
*
* @param orderId 订单 ID用于关联到 adm_schedule_pool
* @return 受影响的行数
*/
@Update("<script>" +
"UPDATE adm_schedule_pool " +
"SET booked_num = booked_num + 1 " +
"WHERE id = (" +
" SELECT pool_id FROM adm_schedule_slot WHERE id = (" +
" SELECT slot_id FROM his_order WHERE id = #{orderId}" +
" )" +
")" +
"</script>")
int incrementBookedNumByOrderId(@Param("orderId") Long orderId);
}