diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/service/AppointmentService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/service/AppointmentService.java index d09207078..06f008db9 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/service/AppointmentService.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/service/AppointmentService.java @@ -1,59 +1,27 @@ package com.openhis.web.outpatient.service; -import com.openhis.web.outpatient.mapper.AppointmentMapper; -import com.openhis.web.outpatient.mapper.ScheduleSlotMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - /** * 门诊预约业务服务 * - * 修复 Bug #574: - * 预约签到缴费成功后,数据库表 adm_schedule_slot.status 未及时流转为 “3”(已取号)。 - * 原因是缴费成功后仅更新了 his_appointment 表的状态,而没有同步更新对应的排班槽状态。 - * 现在在缴费成功的业务流程中,统一使用事务并显式调用 ScheduleSlotMapper.updateSlotStatus - * 将对应的 slot 状态更新为 3,确保前端排班显示与实际业务保持一致。 + * 门诊预约业务接口 + * + * 修复 Bug #574:定义 confirmPaymentAndTake 接口方法, + * 预约签到缴费成功后通过 AppointmentServiceImpl 将号源状态流转为已取号(3)。 */ -@Service -public class AppointmentService { - - @Autowired - private AppointmentMapper appointmentMapper; - - @Autowired - private ScheduleSlotMapper scheduleSlotMapper; +public interface AppointmentService { /** - * 预约签到并完成缴费 + * 预约号源 * - * @param appointmentId 预约主键ID - * @param payAmount 实际缴费金额 - * @return true 表示缴费成功并完成状态流转 + * @param slotId 号源ID + * @param orderId 预约订单ID */ - @Transactional(rollbackFor = Exception.class) - public boolean signInAndPay(Long appointmentId, Double payAmount) { - // 1. 校验预约是否存在且未缴费 - Integer count = appointmentMapper.checkCanPay(appointmentId); - if (count == null || count == 0) { - return false; - } + void bookSlot(Long slotId, Long orderId); - // 2. 更新预约表的缴费状态、缴费时间、实际金额 - int upd = appointmentMapper.updatePaymentInfo(appointmentId, payAmount); - if (upd <= 0) { - return false; - } - - // 3. 获取对应的排班槽ID(adm_schedule_slot.id) - Long slotId = appointmentMapper.selectSlotIdByAppointmentId(appointmentId); - if (slotId != null) { - // 4. 将排班槽状态更新为 “3”(已取号) - scheduleSlotMapper.updateSlotStatus(slotId, 3); - } - - // 5. 若还有后续业务(如生成取号记录),在同一事务内完成 - // 这里预留扩展点,当前仅返回成功标识 - return true; - } + /** + * 预约签到缴费成功后,将号源状态更新为已取号(3) + * + * @param slotId 号源ID + */ + void confirmPaymentAndTake(Long slotId); }