门诊采血增加病人列表查询
This commit is contained in:
parent
8ac8eecb5c
commit
59a4df23ab
@ -23,10 +23,10 @@ export function printBarcodeall(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 查询采样登记详细
|
||||
export function getReqmain(sqh) {
|
||||
// 查询病人列表
|
||||
export function queryPatList() {
|
||||
return request({
|
||||
url: '/system/reqmain/' + sqh,
|
||||
url: '/mzcx/queryPatList',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ const service = axios.create({
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: import.meta.env.VITE_APP_BASE_API,
|
||||
// 超时
|
||||
timeout: 10000
|
||||
timeout: 60000
|
||||
})
|
||||
|
||||
// request拦截器
|
||||
@ -121,6 +121,16 @@ service.interceptors.response.use(res => {
|
||||
} else if (code === 601) {
|
||||
ElMessage({ message: msg, type: 'warning' })
|
||||
return Promise.reject(new Error(msg))
|
||||
} else if (code === 3) {
|
||||
//提示并成功
|
||||
ElMessage({ message: msg, type: 'warning' })
|
||||
return Promise.resolve(res.data)
|
||||
} else if (code === 2) {
|
||||
//选择是否后续操作
|
||||
ElMessageBox.confirm(msg, '系统提示', { confirmButtonText: '是', cancelButtonText: '否', type: 'warning' }).then(() => {
|
||||
return Promise.resolve(res.data);
|
||||
})
|
||||
return Promise.reject('error');
|
||||
} else if (code !== 200 && code !== 0) {
|
||||
ElNotification.error({ title: msg })
|
||||
return Promise.reject('error')
|
||||
|
||||
179
src/views/mzcx/cydj/components/OutPatList.vue
Normal file
179
src/views/mzcx/cydj/components/OutPatList.vue
Normal file
@ -0,0 +1,179 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button
|
||||
@click="handleClick"
|
||||
>查询病人</el-button>
|
||||
|
||||
<!-- 病人选择弹窗 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="props.dialogTitle"
|
||||
width="500px"
|
||||
@close="handleDialogClose"
|
||||
>
|
||||
<el-input
|
||||
v-model="searchKey"
|
||||
placeholder="搜索(支持姓名、病人ID、简拼)..."
|
||||
class="mb-4"
|
||||
clearable
|
||||
@clear="filteredPatData"
|
||||
@input="filteredPatData"
|
||||
@keyup.down="navigateTable('down')"
|
||||
@keyup.up="navigateTable('up')"
|
||||
@keyup.enter="selectActiveItem"
|
||||
/>
|
||||
|
||||
<el-table
|
||||
:data="filteredPatData"
|
||||
height="300px"
|
||||
border
|
||||
@row-click="selectItem"
|
||||
@row-dblclick="selectItem"
|
||||
class="compact-form my-table"
|
||||
>
|
||||
<template #empty>
|
||||
<div v-if="isPatLoading">加载中...</div>
|
||||
<div v-else>没有匹配的病人数据</div>
|
||||
</template>
|
||||
|
||||
<el-table-column prop="pid" label="病人ID" width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="name" label="姓名" width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="xb" label="性别" width="80" show-overflow-tooltip/>
|
||||
<el-table-column prop="nl" label="年龄" width="80" show-overflow-tooltip/>
|
||||
<el-table-column prop="ks" label="科室" width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="ch" label="床号" width="80" show-overflow-tooltip/>
|
||||
<el-table-column prop="pinyin" label="简拼" width="150" show-overflow-tooltip/>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch, onMounted } from 'vue';
|
||||
import {queryPatList} from "@/api/mzcx/cydj.js";
|
||||
import { getFirstLetter } from '@/api/pinyin.js'; // 引入拼音处理工具
|
||||
// 组件参数
|
||||
const props = defineProps({
|
||||
pidValue: { type: [String, Number], default: '' },
|
||||
PatType: { type: String, required: true },
|
||||
placeholder: { type: String, default: '请输入或双击选择' },
|
||||
clearable: { type: Boolean, default: true },
|
||||
disabled: { type: Boolean, default: false },
|
||||
dialogTitle: { type: String, default: '选择病人' }
|
||||
});
|
||||
|
||||
// 组件事件
|
||||
const emit = defineEmits(['update:pidValue', 'select']);
|
||||
|
||||
// 内部状态
|
||||
const dialogVisible = ref(false);
|
||||
const searchKey = ref('');
|
||||
const PatData = ref([]); // 存储带简拼的病人数据
|
||||
const isPatLoading = ref(true);
|
||||
const activeRowIndex = ref(-1); // 键盘导航选中行索引
|
||||
|
||||
|
||||
// 加载病人数据
|
||||
const loadPatData = async () => {
|
||||
isPatLoading.value = true;
|
||||
queryPatList().then(response => {
|
||||
// console.log('response:', response.data);
|
||||
PatData.value = (response.data || []).map(item => ({
|
||||
...item,
|
||||
pinyin: getFirstLetter(item.name)
|
||||
}));
|
||||
}).catch (() =>{
|
||||
console.error(`加载病人列表失败:`, error);
|
||||
PatData.value = [];
|
||||
}).finally (() =>{
|
||||
isPatLoading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
// 过滤病人数据(使用 computed 提高性能)
|
||||
const filteredPatData = computed(() => {
|
||||
const key = searchKey.value.trim().toLowerCase();
|
||||
if (!key) return PatData.value;
|
||||
|
||||
return PatData.value.filter(item => {
|
||||
const matchName = item.name.toLowerCase().includes(key);
|
||||
const matchPid = String(item.pid).toLowerCase().includes(key);
|
||||
const matchPinyin = item.pinyin.toLowerCase().includes(key);
|
||||
|
||||
return matchName || matchPid || matchPinyin;
|
||||
});
|
||||
});
|
||||
|
||||
// 点击按钮事件处理
|
||||
const handleClick = () => {
|
||||
loadPatData();
|
||||
// if (!props.disabled && !isPatLoading.value) {
|
||||
dialogVisible.value = true;
|
||||
searchKey.value = '';
|
||||
activeRowIndex.value = -1;
|
||||
// }
|
||||
};
|
||||
|
||||
// 选择病人项
|
||||
const selectItem = (item) => {
|
||||
emit('update:pidValue', item.pid);
|
||||
emit('select', item.pid);
|
||||
dialogVisible.value = false;
|
||||
};
|
||||
|
||||
// 键盘导航
|
||||
const navigateTable = (direction) => {
|
||||
if (!filteredPatData.value.length) return;
|
||||
|
||||
if (direction === 'down') {
|
||||
activeRowIndex.value = (activeRowIndex.value + 1) % filteredPatData.value.length;
|
||||
} else if (direction === 'up') {
|
||||
activeRowIndex.value = (activeRowIndex.value - 1 + filteredPatData.value.length) % filteredPatData.value.length;
|
||||
}
|
||||
};
|
||||
|
||||
// 选择当前活动行
|
||||
const selectActiveItem = () => {
|
||||
if (activeRowIndex.value >= 0 && activeRowIndex.value < filteredPatData.value.length) {
|
||||
selectItem(filteredPatData.value[activeRowIndex.value]);
|
||||
}
|
||||
};
|
||||
|
||||
// 关闭弹窗
|
||||
const handleDialogClose = () => {
|
||||
dialogVisible.value = false;
|
||||
activeRowIndex.value = -1;
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 可选:添加活动行样式 */
|
||||
:deep(.el-table__row.active) {
|
||||
background-color: #e6f7ff !important;
|
||||
}
|
||||
::v-deep .my-table .el-table__row td {
|
||||
padding: 1px 0; /* 减小行高 */
|
||||
}
|
||||
::v-deep .my-table .el-table__header-wrapper th {
|
||||
padding: 6px 0; /* 表头内边距 */
|
||||
background-color: #b3d8ff !important; /* 表头背景色(保留之前的设置) */
|
||||
color: #333; /* 文字颜色加深,提升可读性 */
|
||||
font-weight: 500; /* 文字加粗 */
|
||||
}
|
||||
::v-deep .my-table .el-table__cell {
|
||||
padding: 0 2px; /* 减小列间距 */
|
||||
}
|
||||
|
||||
/* 可选:调整表格整体样式 */
|
||||
::v-deep .my-table {
|
||||
font-size: 13px; /* 适当减小字体 */
|
||||
}
|
||||
|
||||
::v-deep .my-table .el-table__cell,
|
||||
::v-deep .my-table .el-table__header-wrapper th {
|
||||
border-width: 1px;
|
||||
border-color: #ebeef5;
|
||||
}
|
||||
</style>
|
||||
@ -35,10 +35,10 @@
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">读卡</el-button>
|
||||
<el-button type="primary" icon="Search" @click="readCard">读卡</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="Refresh" @click="resetQuery">查找病人</el-button>
|
||||
<PatSearchDialog @select="handlePatientSelect"/>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -166,13 +166,11 @@
|
||||
<script setup>
|
||||
import {
|
||||
querySQD,
|
||||
getReqmain,
|
||||
delReqmain,
|
||||
addReqmain,
|
||||
updateReqmain,
|
||||
queryPatList,
|
||||
printBarcode,
|
||||
printBarcodeall
|
||||
} from "@/api/mzcx/cydj.js";
|
||||
import PatSearchDialog from './components/OutPatList.vue'
|
||||
const comDict = inject('comDict');
|
||||
// 字典数据存储
|
||||
const dictData = ref({});
|
||||
@ -299,6 +297,7 @@ function getList() {
|
||||
querySQD(queryParams.value).then(response => {
|
||||
if (isEmptyData(response.data)) proxy.$modal.alert("没有检索的数据!");
|
||||
reqmainList.value = response.data;
|
||||
// console.log('response:', response.data);
|
||||
loading.value = false;
|
||||
single.value=false;
|
||||
// 新增:数据加载完成后触发全选
|
||||
@ -369,20 +368,24 @@ function reset() {
|
||||
function handleQuery() {
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
function readCard() {
|
||||
//getList();
|
||||
}
|
||||
|
||||
|
||||
// 处理病人选择事件
|
||||
const handlePatientSelect = (patient) => {
|
||||
// console.log('选中的病人:', patient);
|
||||
queryParams.value.brdh=patient
|
||||
// 处理选中的病人数据
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
if (isAutoSelect.value) return;
|
||||
selectedRows.value = selection;
|
||||
ids.value = selection.map(item => item.sqh);
|
||||
//console.log('ids:', ids.value);
|
||||
// console.log('selectedRows:', selectedRows.value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user