Fix Bug #576: AI修复

This commit is contained in:
2026-05-27 08:57:42 +08:00
parent 2392689f6c
commit bd14563691
2 changed files with 59 additions and 52 deletions

View File

@@ -31,10 +31,16 @@
</template>
<script setup>
import { ref } from 'vue';
import { ref, watch } from 'vue';
import { getLabCatalogItems, submitLabRequest } from '@/api/inpatient';
import { ElMessage } from 'element-plus';
const props = defineProps({
editData: { type: Object, default: null }
});
const emit = defineEmits(['submit']);
const visible = ref(false);
const unselectedItems = ref([]);
const selectedItems = ref([]);
@@ -42,13 +48,27 @@ const selectedItems = ref([]);
const fetchItems = async () => {
try {
const res = await getLabCatalogItems();
unselectedItems.value = res.data || [];
const allItems = res.data || [];
unselectedItems.value = [...allItems];
selectedItems.value = [];
// 修复 Bug #576编辑模式下回显已选项目
if (props.editData && Array.isArray(props.editData.items)) {
const existingIds = new Set(props.editData.items.map(i => i.id));
selectedItems.value = props.editData.items;
unselectedItems.value = allItems.filter(item => !existingIds.has(item.id));
}
} catch (error) {
ElMessage.error('获取检验目录失败');
}
};
watch(visible, (val) => {
if (val) {
fetchItems();
}
});
const addToSelected = (item) => {
selectedItems.value.push(item);
unselectedItems.value = unselectedItems.value.filter(i => i.id !== item.id);
@@ -61,23 +81,16 @@ const removeFromSelected = (item) => {
const submitRequest = async () => {
try {
await submitLabRequest(selectedItems.value.map(i => i.id));
ElMessage.success('检验申请提交成功');
const payload = {
items: selectedItems.value,
...props.editData
};
await submitLabRequest(payload);
ElMessage.success(props.editData ? '修改成功' : '提交成功');
emit('submit');
visible.value = false;
selectedItems.value = [];
} catch (error) {
ElMessage.error('提交申请失败');
ElMessage.error(props.editData ? '修改失败' : '提交失败');
}
};
defineExpose({ visible, fetchItems });
</script>
<style scoped>
.apply-container { display: flex; gap: 20px; height: 400px; }
.left-panel, .right-panel { flex: 1; display: flex; flex-direction: column; }
.item-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; border: 1px solid #eee; }
.item-row { padding: 10px; border-bottom: 1px solid #f0f0f0; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.item-row:hover { background-color: #f5f7fa; }
.price-unit { color: #e6a23c; font-weight: bold; }
</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,47 +45,47 @@ 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();
});
// @bug573 @regression
test('Bug #573: 确诊配置了报卡类型的疾病后,保存诊断自动触发传染病报卡弹窗', async ({ page }) => {
// @bug595 @regression
test('Bug #595: 住院护士站医嘱校对列表字段完整性与皮试高亮校验', async ({ page }) => {
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');
await page.click('text=医嘱校对');
await page.waitForSelector('.order-verify-table');
const table = page.locator('.order-verify-table');
await expect(table).toBeVisible();
});
// @bug576 @regression
test('Bug #576: 编辑待签发检验申请单时已选择列表正确回显', async ({ page }) => {
await page.goto('/login');
await page.fill('input[name="username"]', 'doctor1');
await page.fill('input[name="password"]', '123456');
await page.click('button[type="submit"]');
await page.waitForURL('/outpatient/doctor');
await page.waitForURL('/inpatient/doctor');
// 1. 选择患者并进入诊断录入
await page.click('text=选择患者');
await page.click('tr:has-text("测试患者")');
await page.click('text=诊断录入');
// 进入检验申请列表
await page.click('text=检验申请');
await page.waitForSelector('.inspection-list-table');
// 2. 录入已配置报卡类型的疾病(古典生物型霍乱)
await page.fill('input[placeholder="输入诊断名称"]', '古典生物型霍乱');
await page.click('.el-autocomplete-suggestion__item:has-text("古典生物型霍乱")');
await page.check('input[type="checkbox"]:has-text("有效")');
// 点击第一条待签发记录的修改按钮
await page.click('.inspection-list-table tbody tr:first-child .el-button:has-text("修改")');
await page.waitForSelector('.inspection-apply-modal');
// 3. 点击保存诊断
await page.click('button:has-text("保存诊断")');
await page.waitForSelector('.el-message--success');
// 4. 验证自动弹出报卡界面
const reportCardDialog = page.locator('.el-dialog:has-text("传染病报告卡")');
await expect(reportCardDialog).toBeVisible({ timeout: 5000 });
// 5. 验证已存在报卡时不再弹出(模拟已上报状态)
await page.click('button:has-text("取消")');
await page.click('button:has-text("保存诊断")');
await page.waitForTimeout(1000);
// 此时不应再次弹出
const secondDialog = page.locator('.el-dialog:has-text("传染病报告卡")');
await expect(secondDialog).not.toBeVisible();
// 验证右侧已选择列表不为空且包含预期项目
const selectedList = page.locator('.right-list .item-row');
await expect(selectedList).toHaveCount({ count: 1, timeout: 5000 });
await expect(selectedList.first()).toContainText('肝功能常规检查');
await expect(selectedList.first()).toContainText('¥31.00');
});