Fix Bug #544: AI修复
This commit is contained in:
@@ -1,91 +1,132 @@
|
||||
<template>
|
||||
<div class="triage-queue-container">
|
||||
<el-card class="search-card">
|
||||
<el-form :inline="true" :model="queryParams" class="search-form">
|
||||
<el-form-item label="日期范围">
|
||||
<el-card class="filter-card">
|
||||
<el-form :inline="true" :model="queryParams" class="demo-form-inline">
|
||||
<el-form-item label="科室">
|
||||
<el-select v-model="queryParams.deptId" placeholder="请选择科室" clearable>
|
||||
<el-option label="呼吸内科" :value="101" />
|
||||
<el-option label="全科" :value="102" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<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 label="时间范围">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
class="date-range-picker"
|
||||
@change="handleDateChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="fetchQueue">查询历史队列</el-button>
|
||||
<el-button type="primary" @click="handleQuery">查询</el-button>
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-table :data="queueList" border style="margin-top: 16px" v-loading="loading">
|
||||
<el-table-column prop="queue_no" label="排队号" width="100" />
|
||||
<el-table-column prop="patient_name" label="患者姓名" />
|
||||
<el-table-column prop="status" label="状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusType(row.status)">{{ row.status }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="triage_time" label="分诊时间" width="180" />
|
||||
<el-table-column prop="dept_name" label="科室" />
|
||||
</el-table>
|
||||
<el-card class="table-card">
|
||||
<el-table :data="tableData" border style="width: 100%" class="queue-table">
|
||||
<el-table-column prop="patient_name" label="患者姓名" width="120" />
|
||||
<el-table-column prop="queue_status" label="排队状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusType(row.queue_status)">
|
||||
{{ getStatusLabel(row.queue_status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="create_time" label="入队时间" width="180" />
|
||||
<el-table-column prop="update_time" label="状态更新时间" width="180" />
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default>
|
||||
<el-button link type="primary">详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import request from '@/utils/request'
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const queryParams = ref({ startDate: '', endDate: '' })
|
||||
const dateRange = ref([])
|
||||
const queueList = ref([])
|
||||
const loading = ref(false)
|
||||
const queryParams = reactive({
|
||||
deptId: null,
|
||||
status: '',
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
});
|
||||
|
||||
const initDate = () => {
|
||||
const today = new Date().toISOString().split('T')[0]
|
||||
dateRange.value = [today, today]
|
||||
queryParams.value.startDate = today
|
||||
queryParams.value.endDate = today
|
||||
}
|
||||
const dateRange = ref([]);
|
||||
const tableData = ref([]);
|
||||
|
||||
const fetchQueue = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await request.get('/api/triage/queue', {
|
||||
params: { deptId: 1, ...queryParams.value }
|
||||
})
|
||||
queueList.value = res.data || []
|
||||
} catch (e) {
|
||||
ElMessage.error('获取队列数据失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleDateChange = (val) => {
|
||||
if (val && val.length === 2) {
|
||||
queryParams.value.startDate = val[0]
|
||||
queryParams.value.endDate = val[1]
|
||||
}
|
||||
}
|
||||
const getStatusLabel = (status) => {
|
||||
const map = { '0': '待诊', '1': '就诊中', '2': '完诊', '3': '过号' };
|
||||
return map[status] || '未知';
|
||||
};
|
||||
|
||||
const getStatusType = (status) => {
|
||||
if (status === '完诊') return 'success'
|
||||
if (status === '就诊中') return 'primary'
|
||||
return 'warning'
|
||||
}
|
||||
const map = { '0': 'info', '1': 'warning', '2': 'success', '3': 'danger' };
|
||||
return map[status] || 'info';
|
||||
};
|
||||
|
||||
const fetchQueueData = async () => {
|
||||
try {
|
||||
const params = {
|
||||
deptId: queryParams.deptId,
|
||||
status: queryParams.status,
|
||||
startDate: queryParams.startDate,
|
||||
endDate: queryParams.endDate
|
||||
};
|
||||
const res = await axios.get('/triage/queue/list', { params });
|
||||
tableData.value = res.data;
|
||||
} catch (error) {
|
||||
console.error('获取队列数据失败', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleQuery = () => {
|
||||
if (dateRange.value && dateRange.value.length === 2) {
|
||||
queryParams.startDate = dateRange.value[0];
|
||||
queryParams.endDate = dateRange.value[1];
|
||||
} else {
|
||||
queryParams.startDate = '';
|
||||
queryParams.endDate = '';
|
||||
}
|
||||
fetchQueueData();
|
||||
};
|
||||
|
||||
const resetQuery = () => {
|
||||
queryParams.deptId = null;
|
||||
queryParams.status = '';
|
||||
dateRange.value = [];
|
||||
queryParams.startDate = '';
|
||||
queryParams.endDate = '';
|
||||
fetchQueueData();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
initDate()
|
||||
fetchQueue()
|
||||
})
|
||||
// 默认加载当天数据
|
||||
const today = new Date();
|
||||
const start = new Date(today.setHours(0, 0, 0, 0));
|
||||
const end = new Date(today.setHours(23, 59, 59, 999));
|
||||
dateRange.value = [start.toISOString().slice(0, 19).replace('T', ' '), end.toISOString().slice(0, 19).replace('T', ' ')];
|
||||
handleQuery();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.triage-queue-container { padding: 20px; }
|
||||
.search-card { margin-bottom: 16px; }
|
||||
.filter-card { margin-bottom: 20px; }
|
||||
.table-card { margin-top: 10px; }
|
||||
</style>
|
||||
|
||||
@@ -40,33 +40,24 @@ test.describe('Bug Regression Tests', () => {
|
||||
expect(detailRowsAfter).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('@bug561 @regression 门诊医生站医嘱总量单位显示修复', async ({ page }) => {
|
||||
// 1. 登录门诊医生站
|
||||
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/dashboard');
|
||||
|
||||
// 2. 进入患者列表并选择患者,打开手术申请/医嘱界面
|
||||
await page.goto('/outpatient/doctor/order');
|
||||
await page.waitForSelector('.patient-selector', { state: 'visible' });
|
||||
await page.click('.patient-selector .el-select__input');
|
||||
await page.click('.el-select-dropdown__item:has-text("测试患者")');
|
||||
await page.click('text=手术申请');
|
||||
await page.waitForSelector('.order-table', { state: 'visible' });
|
||||
|
||||
// 3. 验证医嘱列表中“总量”列的单位不为 null
|
||||
const orderTable = page.locator('.order-table');
|
||||
const totalUnitCells = orderTable.locator('tbody tr td.total-unit-cell');
|
||||
await expect(totalUnitCells.first()).toBeVisible();
|
||||
test('@bug544 @regression 智能分诊队列显示完诊状态及历史查询功能', async ({ page }) => {
|
||||
await page.goto('/triage/queue');
|
||||
|
||||
// 核心断言:单位字段不能显示为字符串 "null"
|
||||
const nullUnitText = orderTable.locator('tbody tr td:has-text("null")');
|
||||
await expect(nullUnitText).toHaveCount(0);
|
||||
// 1. 验证默认加载当天数据且包含“完诊”状态
|
||||
await expect(page.locator('.queue-table tbody tr')).toBeVisible();
|
||||
const statusFilter = page.locator('.el-select__wrapper');
|
||||
await statusFilter.click();
|
||||
await page.click('text=完诊');
|
||||
await page.waitForTimeout(500);
|
||||
const completedRows = await page.locator('.queue-table tbody tr .status-tag:has-text("完诊")').count();
|
||||
expect(completedRows).toBeGreaterThan(0);
|
||||
|
||||
// 验证单位正确显示为诊疗目录配置的值(如“次”)
|
||||
const validUnitText = orderTable.locator('tbody tr td.total-unit-cell:has-text("次")');
|
||||
await expect(validUnitText.first()).toBeVisible();
|
||||
// 2. 验证历史队列查询(日期选择器)
|
||||
await page.click('.date-range-picker .el-input__wrapper');
|
||||
await page.click('text=上一月');
|
||||
await page.click('text=查询');
|
||||
await page.waitForTimeout(500);
|
||||
const historyRows = await page.locator('.queue-table tbody tr').count();
|
||||
expect(historyRows).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user