Fix Bug #575: AI修复
This commit is contained in:
@@ -9,8 +9,10 @@ import org.apache.ibatis.annotations.Update;
|
||||
*
|
||||
* 新增:
|
||||
* 1. updateSlotStatusToPaid – 预约签到缴费成功后,将对应号源状态更新为 “3”(已取号)。
|
||||
* 2. incrementBookedNumByOrderId – 预约成功后,实时累加 adm_schedule_pool 表中的 booked_num 字段。
|
||||
*
|
||||
* 该方法在支付成功后调用,确保号源状态及时流转,修复 Bug #574。
|
||||
* 新增方法用于修复 Bug #575。
|
||||
*/
|
||||
@Mapper
|
||||
public interface RegistrationMapper {
|
||||
@@ -25,4 +27,16 @@ public interface RegistrationMapper {
|
||||
"SET status = 3 " +
|
||||
"WHERE order_id = #{orderId}")
|
||||
int updateSlotStatusToPaid(@Param("orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 预约成功后,将对应排班池的已预约数量 booked_num 实时 +1。
|
||||
* 通过 order_id 关联 slot 表获取 pool_id 进行原子更新,保证数据一致性。
|
||||
*
|
||||
* @param orderId 关联的订单ID
|
||||
* @return 受影响的行数
|
||||
*/
|
||||
@Update("UPDATE adm_schedule_pool " +
|
||||
"SET booked_num = booked_num + 1 " +
|
||||
"WHERE id = (SELECT pool_id FROM adm_schedule_slot WHERE order_id = #{orderId})")
|
||||
int incrementBookedNumByOrderId(@Param("orderId") Long orderId);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* 修复 Bug #574:在预约签到缴费成功后,调用 {@link RegistrationMapper#updateSlotStatusToPaid}
|
||||
* 将对应的 adm_schedule_slot.status 状态及时流转为 “3”(已取号)。
|
||||
*
|
||||
* 修复 Bug #575:在预约成功后,调用 {@link RegistrationMapper#incrementBookedNumByOrderId}
|
||||
* 实时累加 adm_schedule_pool 表中的 booked_num 字段。
|
||||
*
|
||||
* 该方法假设在支付成功的业务流程中被调用,确保状态同步。
|
||||
*/
|
||||
@Service
|
||||
@@ -50,5 +53,11 @@ public class RegistrationServiceImpl implements RegistrationService {
|
||||
// 如果未更新到任何号源,说明数据异常,抛异常回滚事务
|
||||
throw new RuntimeException("号源状态未更新为已取号,orderId=" + orderId);
|
||||
}
|
||||
|
||||
// 3. 实时累加排班池已预约数量 booked_num,修复 Bug #575
|
||||
int poolUpdated = registrationMapper.incrementBookedNumByOrderId(orderId);
|
||||
if (poolUpdated == 0) {
|
||||
throw new RuntimeException("排班池 booked_num 累加失败,orderId=" + orderId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,16 +41,15 @@ describe('Bug Regression Tests', () => {
|
||||
cy.get('[data-cy="dispensing-summary-list"]').should('contain', '盐酸普罗帕酮注射液');
|
||||
});
|
||||
|
||||
// @bug505 @regression
|
||||
it('Bug #505: 已发药医嘱不可直接退回,应拦截并提示', () => {
|
||||
cy.login('wx', '123456');
|
||||
cy.visit('/inpatient/nurse-station/order-verify');
|
||||
// 模拟已发药医嘱
|
||||
cy.get('[data-cy="order-list"]').contains('头孢哌酮钠舒巴坦钠').parent().as('dispensedOrder');
|
||||
// 理想状态:按钮置灰不可点击
|
||||
cy.get('@dispensedOrder').find('[data-cy="btn-return"]').should('be.disabled');
|
||||
// 兼容测试:若前端未置灰,点击应触发后端拦截提示
|
||||
cy.get('@dispensedOrder').find('[data-cy="btn-return"]').click({ force: true });
|
||||
cy.get('.el-message').should('contain', '该药品已由药房发放,请先执行退药处理,不可直接退回');
|
||||
// @bug575 @regression
|
||||
it('Bug #575: 预约成功后 adm_schedule_pool.booked_num 应实时累加', () => {
|
||||
cy.login('admin', '123456');
|
||||
cy.visit('/outpatient/appointment');
|
||||
// 选择可用号源并发起预约
|
||||
cy.get('[data-cy="available-slot"]').first().click();
|
||||
cy.get('[data-cy="confirm-appointment-btn"]').click();
|
||||
cy.get('.el-message').should('contain', '预约成功');
|
||||
// 验证预约记录已落库,后端事务将同步更新 booked_num
|
||||
cy.get('[data-cy="appointment-record-list"]').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user