775 lines
24 KiB
Vue
Raw Normal View History

2025-05-20 16:34:38 +08:00
<template>
<div class="app-container">
2025-09-26 17:26:06 +08:00
<el-row :gutter="10">
<el-col :span="13">
<div class="box-shadow">
2025-10-29 18:02:33 +08:00
<el-form :model="queryParams" ref="queryRef" :inline="true" :size="aotuSize" :rules="rules"
class="compact-form">
<el-row :gutter="5">
<el-col :span="6">
2025-11-26 18:09:02 +08:00
<el-form-item label="" prop="ybh">
<div class="next_box">
2025-12-03 18:06:10 +08:00
<el-button type="primary" class="jt_btn" :size="aotuSize" icon="ArrowUpBold"
@click="handlePrev"></el-button>
2025-11-26 18:09:02 +08:00
<el-input v-model="queryParams.ybh" placeholder="样本编号" @keyup.enter="handleQuery"
style="width:100%" />
2025-12-03 18:06:10 +08:00
<el-button type="primary" class="jt_btn" :size="aotuSize" icon="ArrowDownBold"
@click="handleNext"></el-button>
2025-11-26 18:09:02 +08:00
</div>
2025-10-29 18:02:33 +08:00
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="日期:" prop="jyrq">
2025-10-31 15:24:11 +08:00
<el-date-picker v-model="queryParams.jyrq" type="date" label-width="1.25rem" placeholder="检验日期"
2025-10-29 18:02:33 +08:00
value-format="YYYY-MM-DD" :clearable="false" @change="fetchlabPatList"
style="width:100%"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="部门:" prop="instrGroup">
<SelectTable v-model:data="queryParams.instrGroup" :fields="instrGroupFields"
:tableData="instrGroupOptions" label="zdmc" value="zddh" objKey="zddh" :border="true" width="9rem"
placeholder="请选择部门" @getDataValue="handleinstrGroupChange" :clearable="false" :size="aotuSize" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="仪器:" prop="yq">
<SelectTable v-model:data="queryParams.yq" :fields="yqFields" :tableData="instrOptions" label="yqmc"
value="yq" objKey="yq" :border="true" width="9rem" placeholder="请选择仪器" :clearable="false"
:size="aotuSize" @getDataValue="yqHandleChange" />
</el-form-item>
</el-col>
</el-row>
2025-10-16 11:20:50 +08:00
<!-- <el-form-item>
2025-09-26 17:26:06 +08:00
<el-icon color="#3c80d9" size="20" style="margin-right: 10px;" class="cp">
<Search @click="fetchlabPatList" />
</el-icon>
<el-icon color="#3c80d9" size="20" class="cp" @click="selectJob(labPat)">
<Refresh />
</el-icon>
2025-10-16 11:20:50 +08:00
</el-form-item> -->
2025-09-26 17:26:06 +08:00
</el-form>
<el-row :gutter="5">
<el-col :span="8">
2025-10-21 09:55:56 +08:00
<LabPat ref="labPatRef" v-model:labPat="labPat" :labPatKey="queryParams" :labSysList="labInputcolList"
2025-11-06 18:13:17 +08:00
:userList="userList" @changeStatus="changeStatus" @batchShow="handleBatchScan" />
2025-05-20 16:34:38 +08:00
</el-col>
2025-09-26 17:26:06 +08:00
<el-col :span="16">
2025-11-06 09:20:22 +08:00
<LabResult ref="labResultRef" :labPat="labPat" :tableData="labResuts" :tableKey="queryParams"
2025-11-26 18:09:02 +08:00
@update:tableKey="queryParams = $event" :userList="userList" :resultSysList="resultConfig"
@fetchLabResults="resultsHandle" :dictData="dictData" @changeStatus="changeStatus"
@previewHandle="previewHandle" />
2025-05-20 16:34:38 +08:00
</el-col>
2025-09-26 17:26:06 +08:00
</el-row>
</div>
2025-05-20 16:34:38 +08:00
</el-col>
2025-09-26 17:26:06 +08:00
<el-col :span="11">
<div>
2025-10-22 17:36:25 +08:00
<tabView :tabList="tabList" v-model:activeTab="activeTab" />
2025-10-31 15:24:11 +08:00
<div class="box-shadow right_box">
2025-11-06 09:20:22 +08:00
<template v-if="activeTab == 'LabPatList'">
2025-10-31 15:24:11 +08:00
<div class="flex-between">
2025-10-16 11:20:50 +08:00
<div>
2025-12-03 18:06:10 +08:00
<el-button type="primary" :size="aotuSize" icon="RefreshRight" circle
@click="fetchlabPatList"></el-button>
<el-button type="danger" :size="aotuSize" icon="Delete" circle @click="delSampleHd"></el-button>
<el-button class="btn_green" :size="aotuSize" icon="top" circle @click="handlePrev"></el-button>
<el-button class="btn_green mr5" :size="aotuSize" icon="bottom" circle
@click="handleNext"></el-button>
2025-10-30 18:16:57 +08:00
<PatientQueryForm :initial-params="initialParams" @query="handleQueryResult" @reset="handleReset"
2025-12-03 18:06:10 +08:00
width="14rem" :size="aotuSize" placeholder="查询条件" :dict-data="dictData" :clearable="true" />
<el-input v-model="searchText" clearable :size="aotuSize" @keyup.enter="searchQuery" class="ml10"
@clear="clearSearch" style="width: 10rem" />
2025-10-16 11:20:50 +08:00
</div>
2025-12-03 18:06:10 +08:00
2025-10-16 11:20:50 +08:00
<div>
2025-10-29 18:02:33 +08:00
<el-checkbox v-model="lbFlag" :size="aotuSize"> 列表翻页 </el-checkbox>
2025-10-16 11:20:50 +08:00
</div>
2025-09-26 17:26:06 +08:00
</div>
2025-10-16 11:20:50 +08:00
<LabPatList ref="labPatListRef" :labPatList="labPatList" :loading="loading" @select="selectJob"
2025-10-21 09:55:56 +08:00
:tableKey="queryParams" :dictData="dictData" @search="searchJobs" />
2025-10-16 11:20:50 +08:00
<div class="button-group">
<div class="text1">样本总数:<span>{{ ybs }}</span></div>
<div class="text2">未审:<span>{{ ws }}</span></div>
<div class="text3">危:<span>{{ wjs }}</span></div>
2025-09-26 17:26:06 +08:00
</div>
2025-10-16 11:20:50 +08:00
</template>
2025-11-06 09:20:22 +08:00
2025-12-03 18:06:10 +08:00
<!-- tab栏 内容 -->
2025-11-06 09:20:22 +08:00
<component :is="activeTabName" :queryParams="queryParams" :dictData="dictData" :instrOptions="instrOptions"
@fetchResults="fetchLabResults" :tablekey="queryParams" />
2025-09-26 17:26:06 +08:00
</div>
</div>
2025-05-20 16:34:38 +08:00
</el-col>
</el-row>
2025-11-06 18:13:17 +08:00
<!-- 批量扫码弹窗 -->
<BatchCode ref="batchRef" v-model:labPat="labPat" :labPatKey="queryParams" :dictData="dictData"
:totalCount="labPatList.length" @goNext="handleNext" @goPrev="handlePrev" @goLast="handleLast"
@queryYbh="ybhChangeTb" @changeStatus="changeStatus" />
2025-09-26 17:26:06 +08:00
2025-09-29 17:30:02 +08:00
<el-dialog v-model="previewShow" title="预览" width="90vw" :close-on-click-modal="false">
<iFrame v-if="pdfUrl" :src="pdfUrl" />
</el-dialog>
2025-05-20 16:34:38 +08:00
</div>
</template>
2025-09-26 17:26:06 +08:00
<script setup lang="ts">
import { ref, nextTick, onMounted, toRaw } from 'vue';
2025-12-02 18:06:39 +08:00
import LabPat from './labpat.vue';
2025-09-29 17:30:02 +08:00
import SelectTable from '@/components/SelectTable/index.vue';
2025-10-22 17:36:25 +08:00
import tabView from '@/components/tabViews/index.vue';
2025-09-29 17:30:02 +08:00
// @ts-ignore
import iFrame from "@/components/iFrame/index.vue";
2025-09-26 17:26:06 +08:00
// @ts-ignore
2025-12-02 18:06:39 +08:00
import LabResult from './labresult.vue';
import LabPatList from './labpatlist.vue';
2025-09-26 17:26:06 +08:00
// @ts-ignore
import { comDict } from '@/utils/dict'
2025-10-24 11:25:23 +08:00
import { queryLabPatList, queryLabResults, loadDefault, queryLabPat, instrdconfig, delSample, getGroupInstrdList } from "@/api/liswork/work/LisWork";
2025-09-26 17:26:06 +08:00
import { getComDicts, queryComDictListService } from "@/api/liswork/dict/ComDict";
import { ElMessage, ElMessageBox } from "element-plus";
2025-11-21 18:01:14 +08:00
import History from '../components/history/index.vue'
2025-12-03 18:06:10 +08:00
import OthersResult from '../components/othersResult/index.vue'
2025-11-21 18:01:14 +08:00
import Reexamination from '../components/reexamination/index.vue'
import Charge from '../components/charge/index.vue'
import Combination from '../components/combination/index.vue'
import Clinical from '../components/clinical/index.vue'
import Sample from '../components/sample/index.vue'
2025-12-03 18:06:10 +08:00
import OtherInformation from '../components/otherInformation/index.vue'
2025-11-21 18:01:14 +08:00
import ResultGraph from '../components/resultGraph/index.vue'
2025-10-16 11:20:50 +08:00
import { getNextNumber, getPreviousNumber } from "@/utils/getNextNumber";
2025-10-28 17:22:53 +08:00
import { useCommonStore } from '@/store/modules/commonStore';
2025-10-29 18:02:33 +08:00
import { classCom } from '@/utils/classCom';
2025-10-30 18:16:57 +08:00
import PatientQueryForm from '@/components/selectSearch/index.vue'
2025-11-06 18:13:17 +08:00
import BatchCode from './components/batchCode.vue';
2025-11-03 18:07:51 +08:00
// @ts-ignore
import { listUser } from '@/api/system/user.js'
2025-10-22 17:36:25 +08:00
2025-10-30 18:16:57 +08:00
const aotuSize = classCom.useAutoSize();
2025-11-20 18:17:09 +08:00
import { initWebSocket, sendWebSocketMessage, closeWebSocket, getWebSocketState } from '@/utils/webSocket';
2025-09-29 17:30:02 +08:00
const previewShow = ref(false);
2025-10-16 11:20:50 +08:00
const lbFlag = ref(false);
2025-09-26 17:26:06 +08:00
const queryParams = ref({
2025-10-22 17:36:25 +08:00
jyrq: '2025-08-20',
2025-10-24 11:25:23 +08:00
yq: '46',
2025-09-26 17:26:06 +08:00
ybh: '1',
2025-10-10 17:35:28 +08:00
instrGroup: '02',
2025-09-26 17:26:06 +08:00
problemId: 0,
2025-11-18 18:12:34 +08:00
days: 0,
2025-11-26 18:09:02 +08:00
yhdh: ''
2025-09-26 17:26:06 +08:00
})
const ybs = ref(0)
const ws = ref(0)
const wjs = ref(0)
2025-11-06 09:20:22 +08:00
const activeTab = ref('LabPatList')
2025-09-26 17:26:06 +08:00
const tabList = ref([
2025-11-06 09:20:22 +08:00
{ label: '标本列表', value: 'LabPatList' },
{ label: '结果图形', value: 'ResultGraph' },
{ label: '历史对照', value: 'History' },
2025-12-03 18:06:10 +08:00
{ label: '其他结果', value: 'OthersResult' },
2025-11-06 09:20:22 +08:00
{ label: '结果复查', value: 'Reexamination' },
{ label: '收费信息', value: 'Charge' },
{ label: '组合项目', value: 'Combination' },
{ label: '临床意义', value: 'Clinical' },
{ label: '样本流转', value: 'Sample' },
2025-12-03 18:06:10 +08:00
{ label: '其他信息', value: 'OtherInformation' },
2025-09-26 17:26:06 +08:00
])
2025-11-06 09:20:22 +08:00
const activeTabMap = {
ResultGraph,
History,
2025-12-03 18:06:10 +08:00
OthersResult,
2025-11-06 09:20:22 +08:00
Reexamination,
Charge,
Combination,
Clinical,
2025-12-03 18:06:10 +08:00
Sample,
OtherInformation
2025-11-06 09:20:22 +08:00
}
const activeTabName = computed(() => activeTabMap[activeTab.value as keyof typeof activeTabMap] || 'LabPatList');
const labPat = ref<any>({})
2025-09-26 17:26:06 +08:00
const labPatList = ref<Array<{ ybh: string; jgbz: string }>>([]);
2025-10-30 18:16:57 +08:00
const originalLabPatList = ref([]) //原始数据
2025-09-26 17:26:06 +08:00
const loading = ref(false)
2025-10-30 18:16:57 +08:00
const searchText = ref('')
2025-09-17 10:19:20 +08:00
2025-09-26 17:26:06 +08:00
const rules = ref([])
2025-09-29 17:30:02 +08:00
const instrGroupOptions = ref<any[]>([])
2025-10-16 11:20:50 +08:00
const instrOptions = ref<{ yq: string; yqmc: string }[]>([])
2025-09-17 10:19:20 +08:00
2025-09-29 17:30:02 +08:00
const pdfUrl = ref('')
2025-10-30 18:16:57 +08:00
// 初始查询参数(可选)
const initialParams = {}
// 定义查询参数类型
interface QueryParams {
brly?: string | number
jgbz?: string | number
dybz?: string | number
alarmflag?: string | number
jzbz?: string | number
finish?: string | number
autojgbz?: string | number
}
// 模糊查询
const searchQuery = () => {
let filterMhList = [...originalLabPatList.value];
if (searchText.value) {
const searchStr = searchText.value.trim().toLowerCase();
filterMhList = filterMhList.filter((item: any) => {
// 处理 zjf大写转为小写
const matchZjf = item.zjf && typeof item.zjf === 'string'
? item.zjf.toLowerCase().includes(searchStr)
: false; const matchBrxm = item.brxm && typeof item.brxm === 'string' && item.brxm.includes(searchStr);
const matchSqh = item.sqh && typeof item.sqh === 'string' && item.sqh.includes(searchStr);
return matchZjf || matchBrxm || matchSqh;
});
}
labPatList.value = filterMhList;
getTotals();
if (filterMhList.length > 0) {
highlightRowIndex.value = 0;
const firstRow = filterMhList[0];
labPatListRef.value.setCurrentRow(firstRow);
selectJob(firstRow);
} else {
labPat.value = {};
labResuts.value = [];
highlightRowIndex.value = -1;
}
};
const clearSearch = () => {
searchText.value = ''
searchQuery()
}
// 多条件查询
const handleQueryResult = (params: QueryParams) => {
// console.log('查询参数:', params);
// 复制原始列表作为筛选基础
let filteredList = [...originalLabPatList.value];
// 遍历所有查询参数,进行筛选
Object.entries(params).forEach(([key, value]) => {
filteredList = filteredList.filter((item: any) => {
if (value == 0) {
return item[key] == null;
} else {
return item[key] == value;
}
});
});
labPatList.value = filteredList;
getTotals();
if (filteredList.length > 0) {
highlightRowIndex.value = 0;
const firstRow = filteredList[0];
labPatListRef.value.setCurrentRow(firstRow);
selectJob(firstRow);
} else {
labPat.value = {};
labResuts.value = [];
highlightRowIndex.value = -1;
}
};
// 处理重置
const handleReset = () => {
labPatList.value = [...originalLabPatList.value];
getTotals();
}
2025-09-29 17:30:02 +08:00
const previewHandle = (url: string) => {
if (!url) return ElMessage.warning('未查询到文件')
pdfUrl.value = `data:application/pdf;base64,${url}`
previewShow.value = true
}
2025-10-13 17:28:33 +08:00
const handleinstrGroupChange = (val: any) => {
2025-09-26 17:26:06 +08:00
queryParams.value.yq = ''
2025-10-13 17:28:33 +08:00
// labResuts.value = []
// labPat.value = {}
2025-09-26 17:26:06 +08:00
getYqConfig()
}
2025-10-28 17:22:53 +08:00
const mbStore = useCommonStore();
2025-10-13 17:28:33 +08:00
const yqHandleChange = (val: any) => {
2025-09-26 17:26:06 +08:00
labResuts.value = []
labPat.value = {}
2025-10-28 17:22:53 +08:00
mbStore.setLxsrList([]);
2025-10-16 11:20:50 +08:00
getSysList()
2025-09-26 17:26:06 +08:00
fetchlabPatList()
2025-05-20 16:34:38 +08:00
}
2025-09-29 17:30:02 +08:00
const instrGroupFields = ref([
{ prop: 'zddh', label: '代号', width: 80, enablePinyinSearch: true },
{ prop: 'zdmc', label: '名称', width: 150, enablePinyinSearch: true },
])
2025-09-26 17:26:06 +08:00
// 部门
const loadinstrGroupOptions = () => {
getComDicts({ zdlb: 'GROUP' }).then((res: any) => {
instrGroupOptions.value = res.data
2025-10-22 17:36:25 +08:00
instrGroupOptions.value.push({ zddh: 'ALL', zdmc: '所有仪器' })
2025-10-10 17:35:28 +08:00
queryParams.value.instrGroup = '02'
2025-10-24 11:25:23 +08:00
queryParams.value.yq = '46'
2025-09-26 17:26:06 +08:00
getYqConfig()
2025-05-20 16:34:38 +08:00
});
}
2025-09-29 17:30:02 +08:00
const yqFields = ref([
{ prop: 'yq', label: '代号', width: 80, enablePinyinSearch: true },
{ prop: 'yqmc', label: '名称', width: 150, enablePinyinSearch: true },
])
2025-09-26 17:26:06 +08:00
// 仪器
const getYqConfig = () => {
2025-10-24 11:25:23 +08:00
getGroupInstrdList({ lisgroup: queryParams.value.instrGroup })
2025-09-26 17:26:06 +08:00
.then((res: any) => {
2025-10-24 11:25:23 +08:00
if (res.code == 0) {
instrOptions.value = res.data.map((item: any) => ({
2025-09-29 17:30:02 +08:00
yq: item.yq.trim(),
yqmc: item.yqmc
2025-09-26 17:26:06 +08:00
}))
}
})
2025-05-20 16:34:38 +08:00
}
2025-09-26 17:26:06 +08:00
2025-11-06 09:20:22 +08:00
const resultsHandle = (flag: boolean) => {
if (flag) {
fetchLabPat();
}
fetchLabResults()
}
2025-09-26 17:26:06 +08:00
const highlightRowIndex = ref(-1)
const labPatListRef = ref()
//样本列表点击切换样本信息,同步载入左边样本信息表单和中间结果表单
const selectJob = (job: any) => {
2025-10-21 09:55:56 +08:00
lastRow.value = job;
2025-09-26 17:26:06 +08:00
// 复制选中的job数据到当前编辑状态
// Object.assign(labPat.value, {...job})
queryParams.value.jyrq = job.jyrq;
queryParams.value.yq = job.yq.trim();
queryParams.value.ybh = job.ybh;
2025-11-06 09:20:22 +08:00
fetchLabPat();
2025-09-26 17:26:06 +08:00
fetchLabResults();
2025-10-16 11:20:50 +08:00
highlightRowIndex.value = labPatList.value.findIndex((item: any) => item.ybh == queryParams.value.ybh);
2025-05-20 16:34:38 +08:00
}
2025-09-26 17:26:06 +08:00
const labResuts = ref([])
2025-05-20 16:34:38 +08:00
//载入样本结果表单(中间labresult.vue组件)
const fetchLabResults = async () => {
2025-09-26 17:26:06 +08:00
queryLabResults({ jyrq: queryParams.value.jyrq, yq: queryParams.value.yq, ybh: queryParams.value.ybh }).then((response: any) => {
2025-05-20 16:34:38 +08:00
labResuts.value = response.data;
2025-09-26 17:26:06 +08:00
})
2025-05-20 16:34:38 +08:00
}
2025-09-26 17:26:06 +08:00
//载入样本编辑表单(左边labpat.vue组件)
const fetchLabPat = () => {
queryLabPat(queryParams.value).then((response: any) => {
2025-11-06 09:20:22 +08:00
labPat.value = response.data;
2025-09-26 17:26:06 +08:00
})
2025-05-20 16:34:38 +08:00
}
2025-10-21 09:55:56 +08:00
const lastRow: any = ref({})
2025-11-06 18:13:17 +08:00
// 批量扫码ybh同步样本编号
const ybhChangeTb = (val: string) => {
console.log('val==>', val);
queryParams.value.ybh = val
handleQuery();
}
2025-09-26 17:26:06 +08:00
const handleQuery = () => {
if (!labPatList.value.length) return
if (!queryParams.value.ybh) {
highlightRowIndex.value = -1;
2025-10-21 09:55:56 +08:00
ElMessage.warning('请输入样本编号')
queryParams.value.ybh = lastRow.value.ybh
2025-09-26 17:26:06 +08:00
return;
2025-05-20 16:34:38 +08:00
}
2025-10-22 17:36:25 +08:00
queryParams.value = { ...queryParams.value };
2025-09-26 17:26:06 +08:00
// 查找匹配的行
2025-10-16 11:20:50 +08:00
const matchedIndex = labPatList.value.findIndex((item: any) => item.ybh == queryParams.value.ybh);
2025-09-26 17:26:06 +08:00
const row = labPatList.value[matchedIndex]
2025-10-21 09:55:56 +08:00
2025-09-26 17:26:06 +08:00
if (matchedIndex !== -1) {
highlightRowIndex.value = matchedIndex;
// 等待DOM更新后滚动到目标行
nextTick(() => {
labPatListRef.value.setCurrentRow(row);
});
2025-10-16 11:20:50 +08:00
selectJob(row);
2025-05-20 16:34:38 +08:00
} else {
2025-10-16 11:20:50 +08:00
handleCreate()
2025-09-26 17:26:06 +08:00
highlightRowIndex.value = -1;
2025-05-20 16:34:38 +08:00
}
2025-10-16 11:20:50 +08:00
2025-05-20 16:34:38 +08:00
}
2025-10-16 11:20:50 +08:00
// 创建新样本
const handleCreate = () => {
loadDefault(queryParams.value).then((response: any) => {
if (response.code == 0) {
labPat.value = response.data;
labPat.value.id = `temp_${Date.now()}_${Math.random().toString(36).substr(2, 8)}`;
labResuts.value = []
labPatListRef.value?.clearCurrentRow();
2025-10-24 15:23:13 +08:00
fetchLabResults()
2025-10-16 11:20:50 +08:00
}
});
}
2025-10-21 09:55:56 +08:00
// 删除样本
const delSampleHd = () => {
if (lastRow.value.jgbz == '2') return ElMessage.warning('标本已审核,不能删除!')
const data = {
jyrq: lastRow.value.jyrq,
yq: lastRow.value.yq.trim(),
ybh: lastRow.value.ybh,
}
ElMessageBox.confirm(
`确定删除当前${lastRow.value.ybh}号标本?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
delSample(data).then((res: any) => {
if (res.code == 0) {
ElMessage.success('删除成功')
labPatList.value = labPatList.value.filter((item: any) => item.ybh != lastRow.value.ybh)
getTotals()
2025-11-06 18:13:17 +08:00
// 删除跳当前页面下一个样本
// handleNext()
if (highlightRowIndex.value > labPatList.value.length - 1) {
highlightRowIndex.value--;
}
const row = labPatList.value[highlightRowIndex.value];
labPatListRef.value.setCurrentRow(row);
selectJob(row);
2025-10-21 09:55:56 +08:00
}
})
})
.catch(() => {
})
2025-10-16 11:20:50 +08:00
}
// 上一个样本
2025-09-26 17:26:06 +08:00
const handlePrev = () => {
2025-10-16 11:20:50 +08:00
if (!lbFlag.value) {
const ybh = getPreviousNumber(queryParams.value.ybh) as string;
queryParams.value.ybh = ybh;
const index = labPatList.value.findIndex((item: any) => item.ybh == ybh)
if (index !== -1) {
highlightRowIndex.value = index;
const row = labPatList.value[index];
2025-11-27 17:50:31 +08:00
if (activeTab.value == 'LabPatList') {
labPatListRef.value.setCurrentRow(row);
}
2025-10-16 11:20:50 +08:00
selectJob(row);
} else {
handleCreate();
}
} else {
if (highlightRowIndex.value > 0) {
highlightRowIndex.value--;
const row = labPatList.value[highlightRowIndex.value];
2025-11-27 17:50:31 +08:00
if (activeTab.value == 'LabPatList') {
labPatListRef.value.setCurrentRow(row);
}
2025-10-16 11:20:50 +08:00
selectJob(row);
}
2025-09-26 17:26:06 +08:00
}
2025-10-16 11:20:50 +08:00
2025-05-20 16:34:38 +08:00
}
2025-10-16 11:20:50 +08:00
// 下一个样本
2025-09-26 17:26:06 +08:00
const handleNext = () => {
2025-10-16 11:20:50 +08:00
if (!lbFlag.value) {
const ybh = getNextNumber(queryParams.value.ybh) as string;
queryParams.value.ybh = ybh;
const index = labPatList.value.findIndex((item: any) => item.ybh == ybh)
if (index !== -1) {
highlightRowIndex.value = index;
const row = labPatList.value[index];
2025-11-27 17:50:31 +08:00
if (activeTab.value == 'LabPatList') {
labPatListRef.value.setCurrentRow(row);
}
2025-10-16 11:20:50 +08:00
selectJob(row);
} else {
handleCreate();
}
} else {
if (highlightRowIndex.value < labPatList.value.length - 1) {
highlightRowIndex.value++;
const row = labPatList.value[highlightRowIndex.value];
2025-11-27 17:50:31 +08:00
if (activeTab.value == 'LabPatList') {
labPatListRef.value.setCurrentRow(row);
}
2025-10-16 11:20:50 +08:00
selectJob(row);
} else {
queryParams.value.ybh = getNextNumber(queryParams.value.ybh) as string;
handleCreate();
}
2025-09-26 17:26:06 +08:00
}
2025-05-20 16:34:38 +08:00
}
2025-11-06 18:13:17 +08:00
// 最后一个样本
const handleLast = () => {
2025-11-07 17:53:20 +08:00
queryParams.value.ybh = labPatList.value[labPatList.value.length - 1].ybh;
handleNext();
2025-11-06 18:13:17 +08:00
}
const batchRef = ref()
// 批量扫码
const handleBatchScan = () => {
batchRef.value.open()
}
2025-09-26 17:26:06 +08:00
// 改变样本列表中样本状态
2025-10-21 09:55:56 +08:00
const changeStatus = (updatedPat: any, flag: boolean) => {
queryLabPat(queryParams.value).then((response: any) => {
if (response.code == 0) {
2025-11-06 09:20:22 +08:00
labPat.value = response.data;
2025-10-21 09:55:56 +08:00
const index = labPatList.value.findIndex((item: any) => item.ybh == updatedPat.ybh);
if (index !== -1) {
labPatList.value = labPatList.value.map((item, i) =>
i === index ? { ...labPat.value } : item
);
highlightRowIndex.value = index;
nextTick(() => {
labPatListRef.value.setCurrentRow(labPat.value);
});
2025-10-28 17:22:53 +08:00
// 条码号输入后操作
if (flag) {
setTimeout(() => { handleNext() }, 10)
} else {
fetchLabResults()
}
} else {
2025-10-21 09:55:56 +08:00
// 条码号输入后操作
if (flag) {
setTimeout(() => { handleNext() }, 10)
2025-10-28 17:22:53 +08:00
} else {
fetchLabResults()
2025-10-21 09:55:56 +08:00
}
2025-10-28 17:22:53 +08:00
labPatList.value.push(labPat.value)
setTimeout(() => {
nextTick(() => {
labPatListRef.value.setCurrentRow(labPat.value);
});
}, 10)
getTotals()
2025-10-21 09:55:56 +08:00
}
}
});
2025-09-26 17:26:06 +08:00
};
2025-05-20 16:34:38 +08:00
//样本列表检索时刷新列表信息
2025-09-26 17:26:06 +08:00
const searchJobs = async (text: string, page: number, size: number) => {
fetchlabPatList()
2025-05-20 16:34:38 +08:00
}
2025-09-17 10:19:20 +08:00
2025-09-26 17:26:06 +08:00
//载入样本列表(右边labpatlist.vue组件)
const fetchlabPatList = () => {
2025-10-21 09:55:56 +08:00
if (!queryParams.value.jyrq) {
queryParams.value.jyrq = lastRow.value.jyrq
return ElMessage.warning('请选择检验日期')
}
2025-09-26 17:26:06 +08:00
loading.value = true;
queryLabPatList(queryParams.value).then((res: any) => {
if (res.code == 0) {
labPatList.value = res.data;
2025-10-30 18:16:57 +08:00
originalLabPatList.value = res.data
2025-09-17 10:19:20 +08:00
loading.value = false;
2025-09-26 17:26:06 +08:00
if (res.data.length > 0) {
highlightRowIndex.value = 0;
2025-10-21 09:55:56 +08:00
setTimeout(() => { labPatListRef.value.setCurrentRow(res.data[0]); }, 100)
2025-09-26 17:26:06 +08:00
selectJob(res.data[0])
2025-10-21 09:55:56 +08:00
getTotals()
} else {
ybs.value = 0
ws.value = 0
wjs.value = 0
2025-09-17 10:19:20 +08:00
}
2025-09-26 17:26:06 +08:00
}
})
}
2025-10-21 09:55:56 +08:00
// 计算样本数
const getTotals = () => {
ybs.value = labPatList.value.length
ws.value = labPatList.value.filter((item: any) => item.jgbz != 2).length
wjs.value = labPatList.value.filter((item: any) => item.alarmflag == 1).length
}
2025-09-17 10:19:20 +08:00
2025-08-20 09:25:12 +08:00
2025-09-26 17:26:06 +08:00
loadinstrGroupOptions()
fetchlabPatList()
2025-09-17 10:19:20 +08:00
2025-09-26 17:26:06 +08:00
interface DictData {
PT?: Array<any>;
AU?: Array<any>;
SX?: Array<any>;
DP?: Array<any>;
BT?: Array<any>;
SRD?: Array<any>;
2025-10-10 17:35:28 +08:00
HOS?: Array<any>;
2025-10-16 11:20:50 +08:00
ST?: Array<any>;
2025-09-26 17:26:06 +08:00
[key: string]: any[] | undefined; // 添加索引签名以支持动态访问
2025-09-17 10:19:20 +08:00
}
2025-09-26 17:26:06 +08:00
// 字典数据存储
const dictData = ref<DictData>({});
2025-10-16 11:20:50 +08:00
const labInputcolList = ref([])
2025-10-21 09:55:56 +08:00
const resultConfig = ref([])
2025-10-16 11:20:50 +08:00
// 获取参数配置
const getSysList = () => {
instrdconfig({ yq: queryParams.value.yq }).then((res: any) => {
if (res.code == 0) {
2025-10-28 17:22:53 +08:00
labInputcolList.value = res.data.labInputcolList.filter((item: any) => item.mrts != "年龄单位" && item.mrts != "!")
2025-10-21 09:55:56 +08:00
resultConfig.value = res.data.ResultConfig
2025-10-16 11:20:50 +08:00
}
});
2025-10-28 17:22:53 +08:00
mbStore.setLxsrList([]);
2025-10-16 11:20:50 +08:00
}
getSysList()
2025-10-29 18:02:33 +08:00
2025-11-03 18:07:51 +08:00
const userList = ref([]);
2025-09-26 17:26:06 +08:00
onMounted(async () => {
2025-11-03 18:07:51 +08:00
const data = { status: 0, del_flag: 0, pageSize: 1000, pageNum: 1 }
listUser(data).then((res: any) => {
userList.value = res.rows;
});
2025-10-21 09:55:56 +08:00
// 加载病人来源字典
const dictRefs = await comDict('PT', 'AU', 'SX', 'DP', 'BT', 'SRD', 'HOS', 'ST');
// 从 ref 中获取实际数据
dictData.value = {
PT: toRaw(dictRefs.PT.value) || [],
AU: toRaw(dictRefs.AU.value) || [],
SX: toRaw(dictRefs.SX.value) || [],
DP: toRaw(dictRefs.DP.value) || [],
BT: toRaw(dictRefs.BT.value) || [],
SRD: toRaw(dictRefs.SRD.value) || [],
HOS: toRaw(dictRefs.HOS.value) || [],
ST: toRaw(dictRefs.ST.value) || [],
};
2025-11-20 18:17:09 +08:00
// 初始化Socket
initSocket()
2025-09-26 17:26:06 +08:00
});
2025-11-20 18:17:09 +08:00
const initSocket = () => {
initWebSocket({
2025-11-26 18:09:02 +08:00
fullUrl: `ws://47.97.125.165:8904/ws/instr/${mbStore.fingerprint}`,
2025-11-20 18:17:09 +08:00
onOpen: () => {
console.log('WebSocket连接成功');
},
onMessage: (data) => {
console.log(`收到消息: `, JSON.parse(data));
},
onError: (error) => {
console.log(`连接错误: ${error.type}`);
},
onClose: () => {
console.log('WebSocket连接已关闭');
},
reconnectInterval: 3000 // 重连间隔(毫秒)
});
}
// 页面卸载时清理
onUnmounted(() => {
closeWebSocket();
});
// 发送消息
const sendMessage = () => {
const isSuccess = sendWebSocketMessage({ yq: queryParams.value.yq });
if (isSuccess) {
console.log(`发送消息`);
} else {
console.log('发送失败:连接未建立');
}
};
2025-09-26 17:26:06 +08:00
</script>
2025-09-17 10:19:20 +08:00
2025-09-26 17:26:06 +08:00
<style scoped lang="scss">
.app-container {
background: #F0F3F8;
}
2025-09-17 10:19:20 +08:00
2025-09-26 17:26:06 +08:00
.box-shadow {
box-shadow: 2px 2px 4px 0px rgba(206, 217, 234, 0.7);
2025-10-31 09:50:50 +08:00
border-radius: .75rem;
2025-10-31 15:24:11 +08:00
padding: .5rem;
2025-09-26 17:26:06 +08:00
background-color: #fff;
2025-10-31 15:24:11 +08:00
.flex-between {
margin-bottom: .5rem;
}
}
.right_box {
height: calc(90vh - 3.4rem);
2025-09-26 17:26:06 +08:00
}
2025-09-17 10:19:20 +08:00
2025-09-26 17:26:06 +08:00
.compact-form {
border-bottom: 1px solid #E1E9F7;
2025-10-29 18:02:33 +08:00
margin-bottom: 0.5rem;
2025-10-21 09:55:56 +08:00
.el-form-item--default {
2025-10-31 09:50:50 +08:00
margin-bottom: .3125rem !important;
2025-10-21 09:55:56 +08:00
}
2025-10-29 18:02:33 +08:00
.el-form-item--small {
2025-10-31 09:50:50 +08:00
margin-bottom: .3125rem !important;
2025-10-29 18:02:33 +08:00
}
2025-09-26 17:26:06 +08:00
}
2025-05-20 16:34:38 +08:00
2025-09-26 17:26:06 +08:00
.card-content {
2025-10-31 09:50:50 +08:00
max-height: 28.125rem;
2025-09-26 17:26:06 +08:00
/* 设置最大高度 */
overflow-y: auto;
/* 超出高度时显示垂直滚动条 */
2025-10-31 09:50:50 +08:00
padding: .3125rem;
2025-09-26 17:26:06 +08:00
/* 保持与卡片默认一致的内边距 */
}
2025-09-17 10:19:20 +08:00
2025-05-20 16:34:38 +08:00
2025-09-26 17:26:06 +08:00
.button-group {
display: flex;
justify-content: space-around;
font-family: SourceHanSansCN, SourceHanSansCN;
font-weight: 500;
2025-10-31 09:50:50 +08:00
font-size: 1rem;
2025-09-26 17:26:06 +08:00
color: #28BDBB;
2025-10-21 09:55:56 +08:00
// margin-top: 20px;
2025-09-17 10:19:20 +08:00
2025-05-20 16:34:38 +08:00
2025-09-26 17:26:06 +08:00
.text2 {
color: #1F33FF;
}
2025-05-20 16:34:38 +08:00
2025-09-26 17:26:06 +08:00
.text3 {
color: #FF0000;
}
2025-09-17 10:19:20 +08:00
}
2025-05-20 16:34:38 +08:00
</style>