Fix Bug #570: AI修复

This commit is contained in:
2026-05-27 08:43:35 +08:00
parent 74cd551e2b
commit fd7ee53a97
4 changed files with 226 additions and 26 deletions

View File

@@ -0,0 +1,104 @@
<template>
<div class="appointment-container">
<el-card class="filter-card">
<el-form :inline="true" class="query-form">
<el-form-item label="预约状态" class="status-filter">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option label="可预约" :value="0" />
<el-option label="已预约" :value="1" />
<el-option label="已取消" :value="2" />
<el-option label="已就诊" :value="3" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="table-card">
<template #header>
<div class="card-header">
<span>门诊预约挂号列表</span>
</div>
</template>
<el-table :data="slotList" border v-loading="loading">
<el-table-column prop="slotNo" label="号源编号" width="120" />
<el-table-column prop="doctorName" label="医生" width="120" />
<el-table-column prop="scheduleTime" label="就诊时间" width="180" />
<el-table-column prop="status" label="状态" width="100">
<template #default="{ row }">
<el-tag :type="getStatusType(row.status)">{{ getStatusName(row.status) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template #default="{ row }">
<el-button
v-if="row.status === 0"
type="primary"
size="small"
@click="handleBook(row.id)"
>预约</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { ElMessage } from 'element-plus';
import { getSlotList, bookSlot } from '@/api/outpatient';
const loading = ref(false);
const slotList = ref([]);
const queryParams = reactive({ status: null });
const statusMap = {
0: { name: '可预约', type: 'success' },
1: { name: '已预约', type: 'primary' },
2: { name: '已取消', type: 'info' },
3: { name: '已就诊', type: 'warning' }
};
const getStatusName = (code) => statusMap[code]?.name || '未知';
const getStatusType = (code) => statusMap[code]?.type || 'info';
const fetchList = async () => {
loading.value = true;
try {
const res = await getSlotList(queryParams);
slotList.value = res.data || [];
} catch (e) {
ElMessage.error('查询失败');
} finally {
loading.value = false;
}
};
const handleQuery = () => fetchList();
const resetQuery = () => {
queryParams.status = null;
fetchList();
};
const handleBook = async (slotId) => {
try {
await bookSlot(slotId);
ElMessage.success('预约成功');
fetchList();
} catch (e) {
ElMessage.error(e.message || '预约失败');
}
};
onMounted(() => fetchList());
</script>
<style scoped>
.appointment-container { padding: 20px; }
.filter-card { margin-bottom: 20px; }
.table-card { margin-top: 10px; }
</style>

View File

@@ -4,34 +4,29 @@ import { test, expect } from '@playwright/test';
// @bug503 @regression
test('Bug #503: 住院发退药明细与汇总单触发时机同步校验', async ({ page }) => {
// 1. 登录护士站,模拟配置为“需申请模式”
await page.goto('/login');
await page.fill('input[name="username"]', 'wx');
await page.fill('input[name="password"]', '123456');
await page.click('button[type="submit"]');
await page.waitForURL('/nurse-station');
// 2. 护士执行一条临时医嘱
await page.click('text=执行医嘱');
await page.click('text=盐酸普罗帕酮注射液');
await page.click('text=确认执行');
await page.waitForTimeout(1000);
// 3. 切换至药房端,验证需申请模式下:执行后明细单与汇总单均不显示
await page.goto('/pharmacy/dispensing');
const detailRows = await page.locator('.dispensing-detail-table tbody tr').count();
const summaryRows = await page.locator('.dispensing-summary-table tbody tr').count();
expect(detailRows).toBe(0);
expect(summaryRows).toBe(0);
// 4. 返回护士站,执行“汇总发药申请”
await page.goto('/nurse-station/dispensing-apply');
await page.check('input[type="checkbox"]'); // 勾选待申请记录
await page.check('input[type="checkbox"]');
await page.click('text=汇总发药申请');
await page.click('text=确认提交');
await page.waitForTimeout(1500);
// 5. 再次切换至药房端,验证明细单与汇总单同步出现且数据一致
await page.goto('/pharmacy/dispensing');
await page.waitForSelector('.dispensing-detail-table tbody tr');
const newDetailRows = await page.locator('.dispensing-detail-table tbody tr').count();
@@ -39,7 +34,6 @@ test('Bug #503: 住院发退药明细与汇总单触发时机同步校验', asyn
expect(newDetailRows).toBeGreaterThan(0);
expect(newSummaryRows).toBeGreaterThan(0);
// 验证业务脱节风险已消除:汇总单与明细单数量/状态同步
expect(newDetailRows).toBe(newSummaryRows);
});
@@ -51,21 +45,37 @@ test('Bug #544: 智能分诊队列显示完诊状态及历史查询功能', asyn
await page.click('button[type="submit"]');
await page.waitForURL('/triage/queue');
// 1. 验证默认加载当天队列,且列表包含“完诊”状态患者
await page.locator('text=智能队列(全科)').waitFor();
const completedRow = page.locator('tr:has-text("完诊")');
await expect(completedRow).toBeVisible({ timeout: 5000 });
// 2. 验证历史队列查询入口存在且默认时间为当天
const dateRangePicker = page.locator('.el-date-editor--daterange');
await expect(dateRangePicker).toBeVisible();
const today = new Date().toISOString().split('T')[0];
await expect(dateRangePicker).toHaveValue(new RegExp(today));
// 3. 模拟切换历史日期并查询,验证列表正常刷新无报错
await page.click('.el-date-editor--daterange input');
await page.click('text=上一月');
await page.click('text=查询');
await page.waitForTimeout(1000);
await expect(page.locator('.queue-table tbody tr').first()).toBeVisible();
});
// @bug570 @regression
test('Bug #570: 门诊预约挂号状态显示及查询逻辑修复', 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/appointment');
// 1. 执行预约操作
await page.click('button:has-text("预约")').first();
await page.click('text=确认预约');
await page.waitForTimeout(1000);
// 2. 验证预约成功后状态显示为“已预约”而非“已锁定”
const statusTag = page.locator('.el-table__body tr:first-child .el-tag');
await expect(statusTag).toHaveText('已预约');
// 3. 验证筛选“已预约”状态能正常查询到数据
await page.click('.status-filter .el-select');
await page.click('text=已预约');
await page.click('text=查询');
await page.waitForTimeout(500);
const rows = await page.locator('.el-table__body tr').count();
expect(rows).toBeGreaterThan(0);
});