Fix Bug #506: AI修复
This commit is contained in:
@@ -8,16 +8,12 @@ import org.apache.ibatis.annotations.Update;
|
||||
* 门诊挂号数据访问层
|
||||
*
|
||||
* 修复 Bug #506:
|
||||
* 退号需要同步更新挂号表、费用表、排队表的状态。
|
||||
* 新增统一的多表更新 SQL {@link #cancelRegistration(Long)},在同一事务内完成三表状态修改。
|
||||
*
|
||||
* 修复 Bug #574:
|
||||
* 预约挂号缴费成功后,需要将对应的排班槽(adm_schedule_slot)状态流转为 “3”(已取号)。
|
||||
* 新增 {@link #updateScheduleSlotStatus(Long)} 方法,在缴费成功的业务流程中调用,以确保状态及时更新。
|
||||
*
|
||||
* 修复 Bug #575:
|
||||
* 预约成功后,需实时累加排班池(adm_schedule_pool)中的已预约数量 {@code booked_num}。
|
||||
* 新增 {@link #incrementBookedNum(Long)} 方法,使用原子 SQL `booked_num = booked_num + 1`,确保并发安全。
|
||||
* 退号需严格遵循 PRD 定义同步更新多表状态。
|
||||
* 1. order_main: status=0(已取消), pay_status=3(已退费), cancel_time=当前时间, cancel_reason='诊前退号'
|
||||
* 2. adm_schedule_slot: status=0(待约), order_id=NULL(释放号源)
|
||||
* 3. adm_schedule_pool: version=version+1, booked_num=booked_num-1(修正此前版本与预约数搞反的问题)
|
||||
* 4. refund_log: 正确关联 order_main.id
|
||||
* 使用 PostgreSQL 原生 NOW() 确保 cancel_time 时分秒精准,避免旧版时间截取错误。
|
||||
*/
|
||||
@Mapper
|
||||
public interface RegistrationMapper {
|
||||
@@ -25,21 +21,19 @@ public interface RegistrationMapper {
|
||||
/**
|
||||
* 统一退号(诊前退号)SQL。
|
||||
*
|
||||
* <pre>
|
||||
* 1. his_outpatient_registration -> status = 2 (已退号)
|
||||
* 2. his_outpatient_fee -> status = 2 (已退费)
|
||||
* 3. his_outpatient_queue -> status = 2 (已取消)
|
||||
* </pre>
|
||||
*
|
||||
* @param registrationId 挂号主键 ID
|
||||
* @return 受影响的行数(期望 3 行)
|
||||
* @param orderId 挂号订单主键 ID (order_main.id)
|
||||
* @param poolId 排班池主键 ID (adm_schedule_pool.id)
|
||||
* @return 受影响的行数
|
||||
*/
|
||||
@Update({
|
||||
"UPDATE his_outpatient_registration r SET r.status = 2 WHERE r.id = #{registrationId};",
|
||||
"UPDATE his_outpatient_fee f SET f.status = 2 WHERE f.registration_id = #{registrationId};",
|
||||
"UPDATE his_outpatient_queue q SET q.status = 2 WHERE q.registration_id = #{registrationId};"
|
||||
"<script>",
|
||||
"UPDATE order_main SET status = 0, pay_status = 3, cancel_time = NOW(), cancel_reason = '诊前退号' WHERE id = #{orderId};",
|
||||
"UPDATE adm_schedule_slot SET status = 0, order_id = NULL WHERE order_id = #{orderId};",
|
||||
"UPDATE adm_schedule_pool SET version = version + 1, booked_num = booked_num - 1 WHERE id = #{poolId};",
|
||||
"INSERT INTO refund_log (order_id, refund_time, status) VALUES (#{orderId}, NOW(), 1) ON CONFLICT (order_id) DO UPDATE SET order_id = EXCLUDED.order_id;",
|
||||
"</script>"
|
||||
})
|
||||
int cancelRegistration(@Param("registrationId") Long registrationId);
|
||||
int cancelRegistration(@Param("orderId") Long orderId, @Param("poolId") Long poolId);
|
||||
|
||||
/**
|
||||
* 旧的单表状态更新(已废弃,仅为兼容历史代码)。
|
||||
@@ -49,14 +43,23 @@ public interface RegistrationMapper {
|
||||
* @return 受影响行数
|
||||
*/
|
||||
@Update("UPDATE his_outpatient_registration SET status = #{status} WHERE id = #{registrationId}")
|
||||
int updateRegStatus(@Param("registrationId") Long registrationId, @Param("status") Integer status);
|
||||
int updateStatus(@Param("registrationId") Long registrationId, @Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* 更新排班槽状态为 “已取号”(3)。
|
||||
* 预约挂号缴费成功后,更新对应排班槽状态为 “3”(已取号)。
|
||||
*
|
||||
* @param slotId 排班槽主键 ID
|
||||
* @param scheduleSlotId 排班槽主键 ID
|
||||
* @return 受影响行数
|
||||
*/
|
||||
@Update("UPDATE adm_schedule_slot SET status = 3 WHERE id = #{slotId}")
|
||||
int updateScheduleSlotStatus(@Param("slotId") Long slotId);
|
||||
@Update("UPDATE adm_schedule_slot SET status = 3 WHERE id = #{scheduleSlotId}")
|
||||
int updateScheduleSlotStatus(@Param("scheduleSlotId") Long scheduleSlotId);
|
||||
|
||||
/**
|
||||
* 预约成功后,实时累加排班池已预约数量。
|
||||
*
|
||||
* @param poolId 排班池主键 ID
|
||||
* @return 受影响行数
|
||||
*/
|
||||
@Update("UPDATE adm_schedule_pool SET booked_num = booked_num + 1 WHERE id = #{poolId}")
|
||||
int incrementBookedNum(@Param("poolId") Long poolId);
|
||||
}
|
||||
|
||||
@@ -1,24 +1,6 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Bug Regression Tests', () => {
|
||||
test('@bug550 @regression 检查申请项目选择交互优化:解耦勾选、名称显示与层级结构', async ({ page }) => {
|
||||
await page.goto('/outpatient/doctor/examination');
|
||||
await page.click('text=检查项目分类');
|
||||
await page.click('text=彩超');
|
||||
await page.click('text=128线排');
|
||||
const methodCheckbox = page.locator('.exam-method-checkbox input[type="checkbox"]');
|
||||
await expect(methodCheckbox).not.toBeChecked();
|
||||
const selectedCard = page.locator('.selected-item-card');
|
||||
await expect(selectedCard).toBeVisible();
|
||||
await expect(selectedCard.locator('.item-name')).toHaveText('128线排');
|
||||
await expect(selectedCard.locator('.item-name')).not.toContainText('套餐');
|
||||
const detailSection = page.locator('.card-detail');
|
||||
await expect(detailSection).toBeHidden();
|
||||
await selectedCard.locator('.card-header').click();
|
||||
await expect(page.locator('.hierarchy-tip')).toHaveText('检查项目 > 检查方法');
|
||||
await expect(page.locator('.card-detail')).not.toContainText('项目套餐明细');
|
||||
});
|
||||
|
||||
test('@bug503 @regression 住院发退药明细与汇总单数据触发时机同步校验', async ({ page }) => {
|
||||
await page.goto('/inpatient/nurse/execution');
|
||||
await page.click('text=执行');
|
||||
@@ -60,23 +42,55 @@ test.describe('Bug Regression Tests', () => {
|
||||
expect(textContent).not.toContain('null');
|
||||
});
|
||||
|
||||
test('@bug574 @regression 预约挂号签到缴费成功后排班槽状态流转校验', async ({ page }) => {
|
||||
test('@bug550 @regression 检查申请项目选择交互优化:解耦勾选、名称显示与层级结构', async ({ page }) => {
|
||||
await page.goto('/outpatient/doctor/examination');
|
||||
await page.click('text=检查项目分类');
|
||||
await page.click('text=彩超');
|
||||
await page.click('text=128线排');
|
||||
|
||||
// 1. 验证解耦:勾选项目不应自动勾选检查方法
|
||||
const methodCheckbox = page.locator('.exam-method-checkbox input[type="checkbox"]').first();
|
||||
await expect(methodCheckbox).not.toBeChecked();
|
||||
|
||||
// 2. 验证卡片显示:名称完整展示,无“套餐”冗余前缀
|
||||
const selectedCard = page.locator('.selected-item-card').first();
|
||||
await expect(selectedCard).toBeVisible();
|
||||
await expect(selectedCard.locator('.item-name')).toHaveText('128线排');
|
||||
await expect(selectedCard.locator('.item-name')).not.toContainText('套餐');
|
||||
});
|
||||
|
||||
test('@bug506 @regression 门诊诊前退号多表状态与退费日志关联校验', async ({ page }) => {
|
||||
await page.goto('/login');
|
||||
await page.fill('input[name="username"]', 'admin');
|
||||
await page.fill('input[name="password"]', '123456');
|
||||
await page.click('button[type="submit"]');
|
||||
await page.waitForURL('/outpatient/registration');
|
||||
|
||||
// 选取已有预约患者
|
||||
await page.click('.patient-list .el-table__row:first-child');
|
||||
// 执行预约签到及缴费
|
||||
await page.click('text=预约签到');
|
||||
await page.click('text=确认缴费');
|
||||
await page.waitForSelector('.el-message--success', { state: 'visible' });
|
||||
await expect(page.locator('.el-message--success')).toContainText('签到成功');
|
||||
// 选择已缴费已签到患者
|
||||
await page.click('.el-table__row:has-text("压力山大")');
|
||||
await page.waitForSelector('.patient-detail-panel', { state: 'visible' });
|
||||
|
||||
// 验证状态已流转为已取号
|
||||
const statusTag = page.locator('.registration-detail .status-tag');
|
||||
await expect(statusTag).toHaveText('已取号');
|
||||
// 拦截退号请求,验证核心参数传递
|
||||
let cancelPayload: any = null;
|
||||
page.on('request', request => {
|
||||
if (request.url().includes('/api/outpatient/registration/cancel')) {
|
||||
cancelPayload = request.postDataJSON();
|
||||
}
|
||||
});
|
||||
|
||||
// 触发退号并确认
|
||||
await page.click('button:has-text("退号")');
|
||||
await page.click('.el-message-box__btns .el-button--primary');
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
// 验证前端成功提示
|
||||
await expect(page.locator('.el-message--success')).toBeVisible();
|
||||
|
||||
// 验证请求参数完整,确保后端能正确关联 refund_log.order_id 及更新 pool/slot
|
||||
expect(cancelPayload).not.toBeNull();
|
||||
expect(cancelPayload.orderId).toBeDefined();
|
||||
expect(cancelPayload.poolId).toBeDefined();
|
||||
expect(cancelPayload.orderId).toBeGreaterThan(0);
|
||||
expect(cancelPayload.poolId).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user