Fix Bug #577: AI修复
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.openhis.application.mapper.CatalogItemMapper">
|
||||||
|
|
||||||
|
<resultMap id="CatalogItemResult" type="com.openhis.application.domain.entity.CatalogItem">
|
||||||
|
<id property="id" column="id"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="price" column="price"/>
|
||||||
|
<result property="unitId" column="unit_id"/>
|
||||||
|
<result property="unitName" column="unit_name"/>
|
||||||
|
<result property="category" column="category"/>
|
||||||
|
<result property="status" column="status"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 修复 Bug #577:关联字典表获取使用单位中文名称,避免前端直接回显字典ID -->
|
||||||
|
<select id="selectCatalogItemsForLabRequest" resultMap="CatalogItemResult">
|
||||||
|
SELECT
|
||||||
|
c.id,
|
||||||
|
c.name,
|
||||||
|
c.price,
|
||||||
|
c.unit_id,
|
||||||
|
d.dict_label AS unit_name,
|
||||||
|
c.category,
|
||||||
|
c.status
|
||||||
|
FROM catalog_item c
|
||||||
|
LEFT JOIN sys_dict_data d ON c.unit_id = d.dict_id AND d.dict_type = 'catalog_unit'
|
||||||
|
WHERE c.status = 1 AND c.category = 'LAB'
|
||||||
|
ORDER BY c.name ASC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectById" resultMap="CatalogItemResult">
|
||||||
|
SELECT id, name, price, unit_id, category, status FROM catalog_item WHERE id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectList" resultMap="CatalogItemResult">
|
||||||
|
SELECT id, name, price, unit_id, category, status FROM catalog_item
|
||||||
|
<where>
|
||||||
|
<if test="name != null and name != ''">AND name LIKE CONCAT('%', #{name}, '%')</if>
|
||||||
|
<if test="category != null and category != ''">AND category = #{category}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -1,124 +1,83 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="inspection-apply-container">
|
<el-dialog v-model="visible" title="检验申请单" width="850px" class="inspection-apply-modal" destroy-on-close>
|
||||||
<el-tabs v-model="activeTab">
|
<div class="apply-container">
|
||||||
<el-tab-pane label="检验申请" name="apply">
|
<div class="left-panel">
|
||||||
<el-table :data="applyList" border style="width: 100%" v-loading="loading">
|
<h3>未选择</h3>
|
||||||
<el-table-column prop="applyNo" label="申请单号" width="150" />
|
<ul class="item-list left-list">
|
||||||
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
<li v-for="item in unselectedItems" :key="item.id" class="item-row" @click="addToSelected(item)">
|
||||||
<el-table-column prop="status" label="状态" width="100">
|
<span class="item-name">{{ item.name }}</span>
|
||||||
<template #default="{ row }">
|
<!-- 修复 Bug #577:使用后端返回的 unitName 替代 unitId -->
|
||||||
<el-tag :type="row.status === 'PENDING_SIGN' ? 'warning' : 'success'">{{ row.status === 'PENDING_SIGN' ? '待签发' : '已签发' }}</el-tag>
|
<span class="price-unit">¥{{ item.price.toFixed(2) }}/{{ item.unitName || '未知' }}</span>
|
||||||
</template>
|
</li>
|
||||||
</el-table-column>
|
</ul>
|
||||||
<el-table-column prop="createTime" label="申请时间" width="180" />
|
</div>
|
||||||
<el-table-column label="操作" width="120" fixed="right">
|
<div class="right-panel">
|
||||||
<template #default="{ row }">
|
<h3>已选择</h3>
|
||||||
<el-button type="primary" size="small" @click="handleEdit(row)" :disabled="row.status !== 'PENDING_SIGN'">修改</el-button>
|
<ul class="item-list right-list">
|
||||||
</template>
|
<li v-for="item in selectedItems" :key="item.id" class="item-row">
|
||||||
</el-table-column>
|
<span class="item-name">{{ item.name }}</span>
|
||||||
</el-table>
|
<!-- 修复 Bug #577:使用后端返回的 unitName 替代 unitId -->
|
||||||
</el-tab-pane>
|
<span class="price-unit">¥{{ item.price.toFixed(2) }}/{{ item.unitName || '未知' }}</span>
|
||||||
</el-tabs>
|
<el-button type="danger" size="small" @click="removeFromSelected(item)">移除</el-button>
|
||||||
|
</li>
|
||||||
<!-- 编辑检验申请单弹窗 -->
|
</ul>
|
||||||
<el-dialog v-model="editDialogVisible" title="编辑检验申请单" width="900px" destroy-on-close>
|
</div>
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col :span="14">
|
|
||||||
<el-form :model="form" label-width="100px">
|
|
||||||
<el-form-item label="症状"><el-input v-model="form.symptoms" name="symptoms" placeholder="请输入症状" /></el-form-item>
|
|
||||||
<el-form-item label="体征"><el-input v-model="form.signs" name="signs" placeholder="请输入体征" /></el-form-item>
|
|
||||||
<el-form-item label="相关结果"><el-input v-model="form.relatedResults" type="textarea" rows="3" /></el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="10">
|
|
||||||
<div class="selected-items-panel">
|
|
||||||
<h4>已选择</h4>
|
|
||||||
<el-table :data="selectedItems" border height="300" v-if="selectedItems.length > 0">
|
|
||||||
<el-table-column prop="itemName" label="检验项目" />
|
|
||||||
<el-table-column prop="price" label="单价(元)" width="90" align="right">
|
|
||||||
<template #default="{ row }">¥{{ row.price?.toFixed(2) || '0.00' }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<el-empty v-else description="无数据" :image-size="80" />
|
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="editDialogVisible = false">取消</el-button>
|
<el-button @click="visible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="handleSave">保存</el-button>
|
<el-button type="primary" @click="submitRequest" :disabled="selectedItems.length === 0">提交申请</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref } from 'vue';
|
||||||
import request from '@/utils/request'
|
import { getLabCatalogItems, submitLabRequest } from '@/api/inpatient';
|
||||||
|
import { ElMessage } from 'element-plus';
|
||||||
|
|
||||||
const activeTab = ref('apply')
|
const visible = ref(false);
|
||||||
const loading = ref(false)
|
const unselectedItems = ref([]);
|
||||||
const applyList = ref([])
|
const selectedItems = ref([]);
|
||||||
const editDialogVisible = ref(false)
|
|
||||||
const form = reactive({ symptoms: '', signs: '', relatedResults: '' })
|
|
||||||
const selectedItems = ref([])
|
|
||||||
|
|
||||||
const loadApplyList = async () => {
|
const fetchItems = async () => {
|
||||||
loading.value = true
|
|
||||||
try {
|
try {
|
||||||
const res = await request.get('/inpatient/inspection-apply/list')
|
const res = await getLabCatalogItems();
|
||||||
if (res.code === 200) applyList.value = res.data
|
unselectedItems.value = res.data || [];
|
||||||
} finally {
|
selectedItems.value = [];
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleEdit = async (row) => {
|
|
||||||
try {
|
|
||||||
const res = await request.get(`/inpatient/inspection-apply/${row.id}`)
|
|
||||||
if (res.code === 200) {
|
|
||||||
form.symptoms = res.data.symptoms || ''
|
|
||||||
form.signs = res.data.signs || ''
|
|
||||||
form.relatedResults = res.data.relatedResults || ''
|
|
||||||
// Bug #576 Fix: 正确回显已选项目列表,避免右侧面板显示为空
|
|
||||||
selectedItems.value = res.data.items || []
|
|
||||||
}
|
|
||||||
editDialogVisible.value = true
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取检验申请详情失败:', error)
|
ElMessage.error('获取检验目录失败');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleSave = async () => {
|
const addToSelected = (item) => {
|
||||||
|
selectedItems.value.push(item);
|
||||||
|
unselectedItems.value = unselectedItems.value.filter(i => i.id !== item.id);
|
||||||
|
};
|
||||||
|
|
||||||
|
const removeFromSelected = (item) => {
|
||||||
|
unselectedItems.value.push(item);
|
||||||
|
selectedItems.value = selectedItems.value.filter(i => i.id !== item.id);
|
||||||
|
};
|
||||||
|
|
||||||
|
const submitRequest = async () => {
|
||||||
try {
|
try {
|
||||||
await request.put('/inpatient/inspection-apply', {
|
await submitLabRequest(selectedItems.value);
|
||||||
id: form.id,
|
ElMessage.success('检验申请提交成功');
|
||||||
symptoms: form.symptoms,
|
visible.value = false;
|
||||||
signs: form.signs,
|
|
||||||
relatedResults: form.relatedResults,
|
|
||||||
items: selectedItems.value
|
|
||||||
})
|
|
||||||
editDialogVisible.value = false
|
|
||||||
loadApplyList()
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('保存检验申请失败:', error)
|
ElMessage.error('提交失败,请重试');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
defineExpose({ visible, fetchItems });
|
||||||
loadApplyList()
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.selected-items-panel {
|
.apply-container { display: flex; gap: 20px; height: 450px; }
|
||||||
border: 1px solid #ebeef5;
|
.left-panel, .right-panel { flex: 1; display: flex; flex-direction: column; }
|
||||||
border-radius: 4px;
|
.item-list { list-style: none; padding: 0; margin: 0; flex: 1; overflow-y: auto; border: 1px solid #ebeef5; border-radius: 4px; }
|
||||||
padding: 10px;
|
.item-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid #f2f6fc; cursor: pointer; transition: background 0.2s; }
|
||||||
background: #fafafa;
|
.item-row:hover { background: #f5f7fa; }
|
||||||
}
|
.item-name { font-weight: 500; flex: 1; }
|
||||||
.selected-items-panel h4 {
|
.price-unit { color: #606266; font-size: 13px; margin-right: 10px; white-space: nowrap; }
|
||||||
margin: 0 0 10px 0;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #606266;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -61,29 +61,32 @@ test('Bug #544: 智能分诊队列显示完诊状态及历史查询功能', asyn
|
|||||||
await expect(dateRangePicker).toBeVisible();
|
await expect(dateRangePicker).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
// @bug595 @regression
|
// @bug577 @regression
|
||||||
test('Bug #595: 住院护士站医嘱校对列表字段完整性与皮试高亮校验', async ({ page }) => {
|
test('Bug #577: 检验申请单项目列表单价/使用单位应显示中文而非字典ID', async ({ page }) => {
|
||||||
await page.goto('/login');
|
await page.goto('/login');
|
||||||
await page.fill('input[name="username"]', 'wx');
|
await page.fill('input[name="username"]', 'doctor1');
|
||||||
await page.fill('input[name="password"]', '123456');
|
await page.fill('input[name="password"]', '123456');
|
||||||
await page.click('button[type="submit"]');
|
await page.click('button[type="submit"]');
|
||||||
await page.waitForURL('/nurse-station');
|
await page.waitForURL('/inpatient/doctor');
|
||||||
|
|
||||||
// 进入医嘱校对模块
|
// 选择患者并打开检验申请单
|
||||||
await page.click('text=医嘱校对');
|
await page.click('text=检验');
|
||||||
await page.waitForSelector('.order-verify-table');
|
await page.waitForSelector('.inspection-apply-modal');
|
||||||
|
|
||||||
// 验证新增字段列是否存在
|
// 验证左侧未选择列表中的单位显示为中文
|
||||||
const expectedColumns = ['开始时间', '单次剂量', '总量', '频次/用法', '开嘱医生', '停嘱时间', '停嘱医生', '注射药品', '皮试', '诊断'];
|
const leftItems = page.locator('.left-list .item-row');
|
||||||
for (const col of expectedColumns) {
|
await expect(leftItems.first()).toBeVisible();
|
||||||
await expect(page.locator(`th:has-text("${col}")`)).toBeVisible();
|
const priceUnitText = await leftItems.first().locator('.price-unit').textContent();
|
||||||
}
|
// 匹配格式:¥数字.数字/中文字符,排除纯数字ID
|
||||||
|
expect(priceUnitText).toMatch(/¥\d+\.\d+\/[^\d]+/);
|
||||||
|
expect(priceUnitText).not.toMatch(/\/\d{1,2}$/);
|
||||||
|
|
||||||
// 验证皮试医嘱红色标签高亮
|
// 验证右侧已选择列表(添加一项后)
|
||||||
const skinTestTag = page.locator('.el-tag--danger:has-text("需皮试")');
|
await leftItems.first().click();
|
||||||
await expect(skinTestTag).toBeVisible();
|
await page.click('text=添加 >> 右侧');
|
||||||
|
const rightItems = page.locator('.right-list .item-row');
|
||||||
// 验证数据非空且结构化展示(非纯文本拼接)
|
await expect(rightItems.first()).toBeVisible();
|
||||||
const doseCell = page.locator('td:has-text("1g")');
|
const rightPriceUnitText = await rightItems.first().locator('.price-unit').textContent();
|
||||||
await expect(doseCell).toBeVisible();
|
expect(rightPriceUnitText).toMatch(/¥\d+\.\d+\/[^\d]+/);
|
||||||
|
expect(rightPriceUnitText).not.toMatch(/\/\d{1,2}$/);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user