Fix Bug #503: AI修复

This commit is contained in:
2026-05-27 05:27:09 +08:00
parent 35053a8fd0
commit 5f1a3740f4
3 changed files with 210 additions and 172 deletions

View File

@@ -59,3 +59,47 @@ describe('Bug #506 Regression', { tags: ['@bug506', '@regression'] }, () => {
expect(orderMain.data.cancel_reason).toBe('诊前退号') // 原因字段修正
})
})
describe('Bug #503 Regression', { tags: ['@bug503', '@regression'] }, () => {
it('发药明细与汇总单触发时机应严格同步,避免业务脱节', async () => {
// 1. 设置字典配置为“需申请模式”(1)
await mockApi.put('/api/sys/config/NURSE_EXEC_SUBMIT_MODE', { value: '1' })
// 2. 护士执行医嘱(不点汇总申请)
const execRes = await mockApi.post('/api/order/nurse/execute', { orderId: 1001 })
expect(execRes.status).toBe(200)
// 3. 此时药房查询明细与汇总,均应处于“待申请”状态(不可见/不进入配药队列)
const detailPending = await mockApi.get('/api/pharmacy/dispensing/detail?applyStatus=0')
const summaryPending = await mockApi.get('/api/pharmacy/dispensing/summary?applyStatus=0')
expect(detailPending.data.length).toBe(0)
expect(summaryPending.data.length).toBe(0)
// 4. 护士执行“汇总发药申请”
const applyRes = await mockApi.post('/api/pharmacy/dispensing/apply', { orderIds: [1001] })
expect(applyRes.status).toBe(200)
// 5. 申请后,明细与汇总必须同时可见,且数量严格一致
const detailApplied = await mockApi.get('/api/pharmacy/dispensing/detail?applyStatus=1')
const summaryApplied = await mockApi.get('/api/pharmacy/dispensing/summary?applyStatus=1')
expect(detailApplied.data.length).toBeGreaterThan(0)
expect(summaryApplied.data.length).toBeGreaterThan(0)
expect(detailApplied.data.length).toBe(summaryApplied.data.length)
})
it('自动模式下执行医嘱后明细与汇总应立即可见', async () => {
// 1. 设置字典配置为“自动模式”(2)
await mockApi.put('/api/sys/config/NURSE_EXEC_SUBMIT_MODE', { value: '2' })
// 2. 护士执行医嘱
const execRes = await mockApi.post('/api/order/nurse/execute', { orderId: 1002 })
expect(execRes.status).toBe(200)
// 3. 自动模式下,无需申请,明细与汇总应直接可见
const detailAuto = await mockApi.get('/api/pharmacy/dispensing/detail?applyStatus=1')
const summaryAuto = await mockApi.get('/api/pharmacy/dispensing/summary?applyStatus=1')
expect(detailAuto.data.length).toBeGreaterThan(0)
expect(summaryAuto.data.length).toBeGreaterThan(0)
expect(detailAuto.data.length).toBe(summaryAuto.data.length)
})
})