Files
his/com/openhis/web/outpatient/service/impl/RegistrationServiceImpl.java
2026-05-27 00:59:43 +08:00

47 lines
1.5 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.service.impl;
import com.openhis.web.outpatient.mapper.OrderMapper;
import com.openhis.web.outpatient.service.RegistrationService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
/**
* 门诊挂号业务实现
*
* 关键修复:
* - 在预约缴费成功后,调用 {@link OrderMapper#updateScheduleSlotStatusToFinished(Long)} 将
* 对应的排班号adm_schedule_slot状态更新为 “3”已取号解决 Bug #574。
*/
@Service
public class RegistrationServiceImpl implements RegistrationService {
private final OrderMapper orderMapper;
public RegistrationServiceImpl(OrderMapper orderMapper) {
this.orderMapper = orderMapper;
}
/**
* 预约挂号缴费成功后调用。
*
* @param orderId 医嘱订单ID
* @param slotId 对应的排班号ID
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void handlePaymentSuccess(Long orderId, Long slotId) {
// 1. 更新订单状态为已支付
String now = LocalDateTime.now().toString();
orderMapper.updateOrderStatusToPaid(orderId, now, OrderMapper.ORDER_STATUS_PAID);
// 2. 更新排班号状态为已取号(状态码 3
if (slotId != null) {
orderMapper.updateScheduleSlotStatusToFinished(slotId);
}
}
// 其余业务方法保持不变
}