925 lines
28 KiB
Vue
Raw Normal View History

2025-11-11 18:17:47 +08:00
<template>
2025-11-18 18:12:34 +08:00
<div class="app-container">
<el-row :gutter="10">
<el-col :span="13">
<div class="box-shadow">
<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">
<div class="jtIcon" @click="handlePrev">
<el-icon>
<ArrowUpBold />
</el-icon>
</div>
2025-11-28 18:01:14 +08:00
<el-input v-model="queryParams.ybh" placeholder="样本编号" @keyup.enter="handleQuery"
style="width:100%" />
2025-11-26 18:09:02 +08:00
<div class="jtIcon" @click="handleNext">
<el-icon>
<ArrowDownBold />
</el-icon>
</div>
</div>
2025-11-18 18:12:34 +08:00
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="日期:" prop="jyrq">
2025-11-28 18:01:14 +08:00
<el-date-picker v-model="ybJyrq" type="date" label-width="1.25rem" placeholder="检验日期"
2025-12-01 18:00:53 +08:00
value-format="YYYY-MM-DD" :clearable="false" @change="jyrqChange" ref="datePickerRef"
style="width:100%" />
2025-11-18 18:12:34 +08:00
</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>
<!-- <el-form-item>
<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>
</el-form-item> -->
</el-form>
<el-row :gutter="5">
<el-col :span="8">
<LabPat ref="labPatRef" v-model:labPat="labPat" :labPatKey="queryParams" :labSysList="labInputcolList"
:userList="userList" @changeStatus="changeStatus" @batchShow="handleBatchScan" />
</el-col>
<el-col :span="16">
2025-11-21 18:01:14 +08:00
<el-tabs v-model="activeName" type="card" class="demo-tabs">
<el-tab-pane label="鉴定(终报)结果" name="first">
2025-12-01 18:00:53 +08:00
<ZbReport ref="labResultRef" v-model:labPat="labPat" :labPatKey="queryParams"
2025-11-26 18:09:02 +08:00
@update:labPatKey="queryParams = $event" :dictData="dictData" :labResutsData="zbLabResuts"
@fetchLabResults="resultsHandle" @changeStatus="changeStatus" @previewHandle="previewHandle" />
2025-11-21 18:01:14 +08:00
</el-tab-pane>
<el-tab-pane label="初级和二级报告" name="second">
2025-12-01 18:00:53 +08:00
<CbReport v-model:labPat="labPat" :labPatKey="queryParams" @update:labPatKey="queryParams = $event"
2025-11-26 18:09:02 +08:00
:instrdComOpt="instrdComOpt" :dictData="dictData" @changeStatus="changeStatus" :userList="userList"
@previewHandle="previewHandle" />
2025-11-21 18:01:14 +08:00
</el-tab-pane>
<el-tab-pane label="培养基接种" name="third">
2025-11-28 18:01:14 +08:00
<Pyj :labPat="labPat" :labPatKey="queryParams" :userList="userList" />
2025-11-21 18:01:14 +08:00
</el-tab-pane>
<el-tab-pane label="操作记录" name="fourth">
2025-12-01 18:00:53 +08:00
<Record :labPat="labPat" :labPatKey="queryParams" />
2025-11-21 18:01:14 +08:00
</el-tab-pane>
</el-tabs>
2025-11-18 18:12:34 +08:00
</el-col>
</el-row>
</div>
</el-col>
<el-col :span="11">
<div>
<tabView :tabList="tabList" v-model:activeTab="activeTab" />
<div class="box-shadow right_box">
<template v-if="activeTab == 'LabPatList'">
<div class="flex-between">
<div>
<el-button type="primary" :size="aotuSize" icon="RefreshRight" @click="fetchlabPatList">刷新</el-button>
<el-button type="danger" :size="aotuSize" @click="delSampleHd">删除</el-button>
<el-button class="btn_green" :size="aotuSize" icon="top" @click="handlePrev">上一个</el-button>
<el-button class="btn_green mr5" :size="aotuSize" icon="bottom" @click="handleNext">下一个</el-button>
<PatientQueryForm :initial-params="initialParams" @query="handleQueryResult" @reset="handleReset"
width="9rem" :size="aotuSize" placeholder="查询条件" :dict-data="dictData" :clearable="true" />
<el-input v-model="searchText" clearable :size="aotuSize" @keyup.enter="searchQuery"
@clear="clearSearch" style="width: 6rem" />
</div>
<div>
<el-checkbox v-model="lbFlag" :size="aotuSize"> 列表翻页 </el-checkbox>
</div>
</div>
2025-11-19 18:07:30 +08:00
<div class="radio_box">
2025-11-24 18:03:52 +08:00
<el-radio-group v-model="queryParams.days" @change="fetchlabPatList" :size="aotuSize">
<el-radio :value="-1">所有</el-radio>
2025-11-19 18:07:30 +08:00
<el-radio :value="30">近30天</el-radio>
<el-radio :value="60">近60天</el-radio>
<el-radio :value="90">近90天</el-radio>
<el-radio :value="7">近7天</el-radio>
2025-11-27 17:50:31 +08:00
<el-radio :value="0">此日
<el-icon>
<Right />
</el-icon>
</el-radio>
2025-11-19 18:07:30 +08:00
</el-radio-group>
2025-11-24 18:03:52 +08:00
<el-date-picker v-model="queryParams.jyrq" type="date" :size="aotuSize" @change="fetchlabPatList"
style="width: 9.375rem;" />
2025-11-19 18:07:30 +08:00
</div>
2025-11-18 18:12:34 +08:00
<LabPatList ref="labPatListRef" :labPatList="labPatList" :loading="loading" @select="selectJob"
:tableKey="queryParams" :dictData="dictData" @search="searchJobs" />
<div class="button-group">
2025-11-19 18:07:30 +08:00
<el-pagination v-model:current-page="queryParams.pageNum" v-model:page-size="queryParams.pageSize"
:page-sizes="[300, 600, 1000]" :size="aotuSize" background
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange"
@current-change="handleCurrentChange" />
2025-11-18 18:12:34 +08:00
</div>
</template>
2025-12-01 18:00:53 +08:00
<component :is="activeTabName" :queryParams="{ ...queryParams, jyrq: ybJyrq }" :dictData="dictData"
:instrOptions="instrOptions" @fetchResults="fetchLabResults" :tablekey="labPat" />
2025-11-18 18:12:34 +08:00
</div>
</div>
</el-col>
</el-row>
2025-11-28 18:01:14 +08:00
<!-- 校验用户 -->
<CheckUser ref="checkUserRef" @onConfirm="handleCheckUserConfirm" @onCancel="checkUserCancel" />
2025-11-18 18:12:34 +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" />
<el-dialog v-model="previewShow" title="预览" width="90vw" :close-on-click-modal="false">
<iFrame v-if="pdfUrl" :src="pdfUrl" />
</el-dialog>
2025-11-11 18:17:47 +08:00
</div>
</template>
<script setup lang="ts">
2025-11-18 18:12:34 +08:00
import { ref, nextTick, onMounted, toRaw } from 'vue';
import LabPat from './labpat.vue';
import SelectTable from '@/components/SelectTable/index.vue';
import tabView from '@/components/tabViews/index.vue';
// @ts-ignore
import iFrame from "@/components/iFrame/index.vue";
import LabPatList from './labpatlist.vue';
2025-11-21 18:01:14 +08:00
import History from '../components/history/index.vue'
import Others from '../components/others/index.vue'
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'
import ResultGraph from '../components/resultGraph/index.vue'
2025-11-28 18:01:14 +08:00
import CheckUser from '../work/components/CheckUser.vue';
2025-11-21 18:01:14 +08:00
// 中间部分
import ZbReport from './labresult/zbReport.vue';
import CbReport from './labresult/cbReport.vue';
2025-11-27 17:50:31 +08:00
import Pyj from './labresult/pyj.vue';
2025-11-21 18:01:14 +08:00
import Record from './labresult/record.vue';
2025-11-18 18:12:34 +08:00
// @ts-ignore
import { comDict } from '@/utils/dict'
2025-11-28 18:01:14 +08:00
import { queryLabResults, loadDefault, queryLabPat, instrdconfig, delSample, getGroupInstrdList, checkuser, updateLabPat } from "@/api/liswork/work/LisWork";
2025-12-01 18:00:53 +08:00
import { wswsamplelistpage, sampleMedInfo, changepatjyrq } from "@/api/liswork/micro/index";
2025-11-18 18:12:34 +08:00
import { getComDicts, queryComDictListService } from "@/api/liswork/dict/ComDict";
import { ElMessage, ElMessageBox } from "element-plus";
import BatchCode from '../work/components/batchCode.vue';
import { getNextNumber, getPreviousNumber } from "@/utils/getNextNumber";
import { useCommonStore } from '@/store/modules/commonStore';
import { classCom } from '@/utils/classCom';
import PatientQueryForm from '@/components/selectSearch/index.vue'
// @ts-ignore
import { listUser } from '@/api/system/user.js'
2025-11-19 18:07:30 +08:00
import dayjs from 'dayjs'
2025-11-18 18:12:34 +08:00
const aotuSize = classCom.useAutoSize();
2025-11-20 18:17:09 +08:00
import { initWebSocket, sendWebSocketMessage, closeWebSocket, getWebSocketState } from '@/utils/webSocket';
2025-12-01 18:00:53 +08:00
import Labpat from './labpat.vue';
2025-11-18 18:12:34 +08:00
const previewShow = ref(false);
const lbFlag = ref(false);
const queryParams = ref({
2025-11-19 18:07:30 +08:00
jyrq: dayjs().format('YYYY-MM-DD'),
2025-11-18 18:12:34 +08:00
yq: 'PHOENI',
2025-11-21 18:01:14 +08:00
ybh: '',
2025-11-18 18:12:34 +08:00
instrGroup: '04',
problemId: 0,
2025-11-24 18:03:52 +08:00
days: -1,
2025-11-19 18:07:30 +08:00
pageSize: 600,
2025-11-26 18:09:02 +08:00
pageNum: 1,
yhdh: ''
2025-11-18 18:12:34 +08:00
})
2025-11-19 18:07:30 +08:00
2025-11-21 18:01:14 +08:00
2025-11-27 17:50:31 +08:00
const activeName = ref('first');
2025-11-21 18:01:14 +08:00
2025-11-19 18:07:30 +08:00
const total = ref(0)
2025-11-18 18:12:34 +08:00
const ybs = ref(0)
const ws = ref(0)
const wjs = ref(0)
const activeTab = ref('LabPatList')
const tabList = ref([
{ label: '标本列表', value: 'LabPatList' },
{ label: '结果图形', value: 'ResultGraph' },
{ label: '历史对照', value: 'History' },
{ label: '其他结果', value: 'Others' },
{ label: '结果复查', value: 'Reexamination' },
{ label: '收费信息', value: 'Charge' },
{ label: '组合项目', value: 'Combination' },
{ label: '临床意义', value: 'Clinical' },
{ label: '样本流转', value: 'Sample' },
])
const activeTabMap = {
2025-11-20 18:17:09 +08:00
ResultGraph,
History,
Others,
Reexamination,
Charge,
Combination,
Clinical,
Sample
2025-11-18 18:12:34 +08:00
}
const activeTabName = computed(() => activeTabMap[activeTab.value as keyof typeof activeTabMap] || 'LabPatList');
const labPat = ref<any>({})
const labPatList = ref<Array<{ ybh: string; jgbz: string }>>([]);
const originalLabPatList = ref([]) //原始数据
const loading = ref(false)
const searchText = ref('')
const rules = ref([])
const instrGroupOptions = ref<any[]>([])
const instrOptions = ref<{ yq: string; yqmc: string }[]>([])
const pdfUrl = ref('')
// 初始查询参数(可选)
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
}
2025-11-28 18:01:14 +08:00
const ybJyrq = ref('')
2025-11-21 18:01:14 +08:00
watch(() => labPat.value, (newValue) => {
queryParams.value.ybh = newValue.ybh;
2025-11-28 18:01:14 +08:00
ybJyrq.value = newValue.jyrq;
2025-11-21 18:01:14 +08:00
}, { deep: true });
2025-11-28 18:01:14 +08:00
const checkUserRef = ref()
2025-12-01 18:00:53 +08:00
const datePickerRef = ref()
2025-11-28 18:01:14 +08:00
const jyrqChange = (val: string) => {
2025-12-01 18:00:53 +08:00
datePickerRef.value?.blur();
2025-11-28 18:01:14 +08:00
ElMessageBox.confirm(
`确定修改当前样本检验日期?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
if (!queryParams.value.yhdh) {
checkUserRef.value.open();
} else {
updateJyrq()
}
}).catch(() => {
fetchLabPat();
2025-12-01 18:00:53 +08:00
datePickerRef.value?.blur();
2025-11-28 18:01:14 +08:00
})
};
const handleCheckUserConfirm = (info: { yhdh: string, mm: string }) => {
checkuser({ yhdh: info.yhdh, mm: info.mm }).then((response: any) => {
if (response.code == 0) {
queryParams.value.yhdh = info.yhdh;
updateJyrq()
} else {
fetchLabPat();
2025-12-01 18:00:53 +08:00
datePickerRef.value?.blur();
2025-11-28 18:01:14 +08:00
}
})
};
const checkUserCancel = () => {
fetchLabPat();
};
// 更新检验日期
const updateJyrq = () => {
2025-12-01 18:00:53 +08:00
changepatjyrq({ ...queryParams.value, jyrq: ybJyrq.value }).then((response: any) => {
if (response.code == 0) {
ElMessage.success('检验日期修改成功');
changeStatus(
{
jyrq: ybJyrq.value,
ybh: labPat.value.ybh,
yq: labPat.value.yq
}, false
)
datePickerRef.value?.blur();
}
});
2025-11-28 18:01:14 +08:00
};
2025-11-18 18:12:34 +08:00
// 模糊查询
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;
if (filterMhList.length > 0) {
highlightRowIndex.value = 0;
const firstRow = filterMhList[0];
labPatListRef.value.setCurrentRow(firstRow);
selectJob(firstRow);
} else {
labPat.value = {};
2025-11-24 18:03:52 +08:00
zbLabResuts.value = [];
2025-11-18 18:12:34 +08:00
highlightRowIndex.value = -1;
}
};
2025-11-21 18:01:14 +08:00
2025-11-18 18:12:34 +08:00
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;
if (filteredList.length > 0) {
highlightRowIndex.value = 0;
const firstRow = filteredList[0];
labPatListRef.value.setCurrentRow(firstRow);
selectJob(firstRow);
} else {
labPat.value = {};
2025-11-24 18:03:52 +08:00
zbLabResuts.value = [];
2025-11-18 18:12:34 +08:00
highlightRowIndex.value = -1;
}
};
// 处理重置
const handleReset = () => {
labPatList.value = [...originalLabPatList.value];
}
const previewHandle = (url: string) => {
if (!url) return ElMessage.warning('未查询到文件')
pdfUrl.value = `data:application/pdf;base64,${url}`
previewShow.value = true
}
const handleinstrGroupChange = (val: any) => {
queryParams.value.yq = ''
getYqConfig()
}
const mbStore = useCommonStore();
const yqHandleChange = (val: any) => {
2025-11-24 18:03:52 +08:00
zbLabResuts.value = [];
2025-11-18 18:12:34 +08:00
labPat.value = {}
mbStore.setLxsrList([]);
getSysList()
fetchlabPatList()
2025-11-20 18:17:09 +08:00
sendMessage()
2025-11-18 18:12:34 +08:00
}
const instrGroupFields = ref([
{ prop: 'zddh', label: '代号', width: 80, enablePinyinSearch: true },
{ prop: 'zdmc', label: '名称', width: 150, enablePinyinSearch: true },
])
// 部门
const loadinstrGroupOptions = () => {
getComDicts({ zdlb: 'GROUP' }).then((res: any) => {
instrGroupOptions.value = res.data
instrGroupOptions.value.push({ zddh: 'ALL', zdmc: '所有仪器' })
queryParams.value.instrGroup = '04'
queryParams.value.yq = 'PHOENI'
getYqConfig()
});
}
const yqFields = ref([
{ prop: 'yq', label: '代号', width: 80, enablePinyinSearch: true },
{ prop: 'yqmc', label: '名称', width: 150, enablePinyinSearch: true },
])
// 仪器
const getYqConfig = () => {
getGroupInstrdList({ lisgroup: queryParams.value.instrGroup })
.then((res: any) => {
if (res.code == 0) {
instrOptions.value = res.data.map((item: any) => ({
yq: item.yq.trim(),
yqmc: item.yqmc
}))
}
})
}
const resultsHandle = (flag: boolean) => {
if (flag) {
fetchLabPat();
}
fetchLabResults()
}
2025-11-19 18:07:30 +08:00
const labInfo: any = ref({})
2025-11-18 18:12:34 +08:00
const highlightRowIndex = ref(-1)
const labPatListRef = ref()
//样本列表点击切换样本信息,同步载入左边样本信息表单和中间结果表单
const selectJob = (job: any) => {
2025-11-19 18:07:30 +08:00
labInfo.value = { ...job }
2025-11-18 18:12:34 +08:00
lastRow.value = job;
fetchLabPat();
fetchLabResults();
2025-11-19 18:07:30 +08:00
highlightRowIndex.value = labPatList.value.findIndex((item: any) => item.ybh == labInfo.value.ybh);
2025-11-18 18:12:34 +08:00
}
2025-11-24 18:03:52 +08:00
const zbLabResuts = ref([])
2025-11-18 18:12:34 +08:00
//载入样本结果表单(中间labresult.vue组件)
2025-11-28 18:01:14 +08:00
const fetchLabResults = () => {
2025-11-21 18:01:14 +08:00
sampleMedInfo({ jyrq: labInfo.value.jyrq ? labInfo.value.jyrq : queryParams.value.jyrq, yq: labInfo.value.yq, ybh: labInfo.value.ybh }).then((response: any) => {
2025-11-24 18:03:52 +08:00
zbLabResuts.value = response.data;
2025-11-18 18:12:34 +08:00
})
}
//载入样本编辑表单(左边labpat.vue组件)
const fetchLabPat = () => {
2025-11-19 18:07:30 +08:00
const data = {
jyrq: labInfo.value.jyrq,
yq: labInfo.value.yq,
ybh: labInfo.value.ybh
}
queryLabPat(data).then((response: any) => {
2025-11-18 18:12:34 +08:00
labPat.value = response.data;
})
}
2025-11-11 18:17:47 +08:00
2025-11-18 18:12:34 +08:00
const lastRow: any = ref({})
// 批量扫码ybh同步样本编号
const ybhChangeTb = (val: string) => {
2025-11-20 18:17:09 +08:00
// console.log('val==>', val);
2025-12-01 18:00:53 +08:00
labPat.value.ybh = val
2025-11-27 17:50:31 +08:00
queryParams.value.ybh = val
2025-11-18 18:12:34 +08:00
handleQuery();
}
const handleQuery = () => {
if (!labPatList.value.length) return
2025-12-01 18:00:53 +08:00
if (!labPat.value.ybh) {
2025-11-18 18:12:34 +08:00
highlightRowIndex.value = -1;
ElMessage.warning('请输入样本编号')
2025-12-01 18:00:53 +08:00
labPat.value.ybh = lastRow.value.ybh
2025-11-27 17:50:31 +08:00
queryParams.value.ybh = lastRow.value.ybh
2025-11-18 18:12:34 +08:00
return;
}
2025-11-19 18:07:30 +08:00
// queryParams.value = { ...queryParams.value };
2025-11-18 18:12:34 +08:00
// 查找匹配的行
2025-12-01 18:00:53 +08:00
const matchedIndex = labPatList.value.findIndex((item: any) => item.ybh == labPat.value.ybh);
2025-11-18 18:12:34 +08:00
const row = labPatList.value[matchedIndex]
if (matchedIndex !== -1) {
highlightRowIndex.value = matchedIndex;
// 等待DOM更新后滚动到目标行
nextTick(() => {
labPatListRef.value.setCurrentRow(row);
});
selectJob(row);
} else {
handleCreate()
highlightRowIndex.value = -1;
}
}
// 创建新样本
const handleCreate = () => {
2025-11-28 18:01:14 +08:00
ybJyrq.value = ''
2025-11-21 18:01:14 +08:00
loadDefault({ ...queryParams.value }).then((response: any) => {
2025-11-18 18:12:34 +08:00
if (response.code == 0) {
labPat.value = response.data;
labPat.value.id = `temp_${Date.now()}_${Math.random().toString(36).substr(2, 8)}`;
2025-11-24 18:03:52 +08:00
zbLabResuts.value = [];
2025-11-18 18:12:34 +08:00
labPatListRef.value?.clearCurrentRow();
fetchLabResults()
}
});
}
// 删除样本
const delSampleHd = () => {
2025-12-01 18:00:53 +08:00
if (labPat.value.jgbz == '2') return ElMessage.warning('标本已审核,不能删除!')
2025-11-18 18:12:34 +08:00
const data = {
2025-12-01 18:00:53 +08:00
jyrq: labPat.value.jyrq,
yq: labPat.value.yq.trim(),
ybh: labPat.value.ybh,
2025-11-18 18:12:34 +08:00
}
ElMessageBox.confirm(
2025-12-01 18:00:53 +08:00
`确定删除当前${labPat.value.ybh}号标本?`,
2025-11-18 18:12:34 +08:00
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
delSample(data).then((res: any) => {
if (res.code == 0) {
ElMessage.success('删除成功')
2025-12-01 18:00:53 +08:00
labPatList.value = labPatList.value.filter((item: any) => item.ybh != labPat.value.ybh)
2025-11-18 18:12:34 +08:00
// 删除跳当前页面下一个样本
// handleNext()
if (highlightRowIndex.value > labPatList.value.length - 1) {
highlightRowIndex.value--;
}
const row = labPatList.value[highlightRowIndex.value];
labPatListRef.value.setCurrentRow(row);
selectJob(row);
}
})
})
.catch(() => {
})
}
// 上一个样本
const handlePrev = () => {
if (!lbFlag.value) {
2025-12-01 18:00:53 +08:00
const ybh = getPreviousNumber(labPat.value.ybh) as string;
2025-11-27 17:50:31 +08:00
queryParams.value.ybh = ybh;
2025-11-18 18:12:34 +08:00
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-11-18 18:12:34 +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-11-18 18:12:34 +08:00
selectJob(row);
}
}
}
// 下一个样本
const handleNext = () => {
if (!lbFlag.value) {
2025-12-01 18:00:53 +08:00
const ybh = getNextNumber(labPat.value.ybh) as string;
2025-11-27 17:50:31 +08:00
queryParams.value.ybh = ybh;
2025-11-18 18:12:34 +08:00
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-11-18 18:12:34 +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-11-18 18:12:34 +08:00
selectJob(row);
} else {
2025-12-01 18:00:53 +08:00
queryParams.value.ybh = labPat.value.ybh;
2025-11-18 18:12:34 +08:00
handleCreate();
}
}
}
// 最后一个样本
const handleLast = () => {
2025-11-27 17:50:31 +08:00
queryParams.value.ybh = labPatList.value[labPatList.value.length - 1].ybh;
2025-11-18 18:12:34 +08:00
handleNext();
}
const batchRef = ref()
// 批量扫码
const handleBatchScan = () => {
batchRef.value.open()
}
// 改变样本列表中样本状态
const changeStatus = (updatedPat: any, flag: boolean) => {
2025-11-19 18:07:30 +08:00
const data = {
jyrq: updatedPat.jyrq,
yq: updatedPat.yq.trim(),
ybh: updatedPat.ybh,
}
queryLabPat(data).then((response: any) => {
2025-11-18 18:12:34 +08:00
if (response.code == 0) {
labPat.value = response.data;
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);
});
// 条码号输入后操作
if (flag) {
setTimeout(() => { handleNext() }, 10)
} else {
fetchLabResults()
}
} else {
// 条码号输入后操作
if (flag) {
setTimeout(() => { handleNext() }, 10)
} else {
fetchLabResults()
}
labPatList.value.push(labPat.value)
setTimeout(() => {
nextTick(() => {
labPatListRef.value.setCurrentRow(labPat.value);
});
}, 10)
}
}
});
};
//样本列表检索时刷新列表信息
const searchJobs = async (text: string, page: number, size: number) => {
fetchlabPatList()
}
2025-11-19 18:07:30 +08:00
const handleSizeChange = (size: number) => {
queryParams.value.pageSize = size
fetchlabPatList()
}
const handleCurrentChange = (page: number) => {
queryParams.value.pageNum = page
fetchlabPatList()
}
2025-11-18 18:12:34 +08:00
//载入样本列表(右边labpatlist.vue组件)
const fetchlabPatList = () => {
2025-11-19 18:07:30 +08:00
// if (!queryParams.value.jyrq) {
// queryParams.value.jyrq = lastRow.value.jyrq
// return ElMessage.warning('请选择检验日期')
// }
2025-11-18 18:12:34 +08:00
loading.value = true;
2025-11-19 18:07:30 +08:00
wswsamplelistpage(queryParams.value).then((res: any) => {
if (res.code == 200) {
labPatList.value = res.rows;
originalLabPatList.value = res.rows;
total.value = res.total;
2025-11-18 18:12:34 +08:00
loading.value = false;
2025-11-19 18:07:30 +08:00
if (res.rows.length > 0) {
2025-11-18 18:12:34 +08:00
highlightRowIndex.value = 0;
2025-11-25 18:05:18 +08:00
setTimeout(() => { labPatListRef.value.setCurrentRow(res.rows[0]) }, 10)
2025-11-19 18:07:30 +08:00
selectJob(res.rows[0])
2025-11-18 18:12:34 +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
}
loadinstrGroupOptions()
fetchlabPatList()
interface DictData {
PT?: Array<any>;
AU?: Array<any>;
SX?: Array<any>;
DP?: Array<any>;
BT?: Array<any>;
SRD?: Array<any>;
HOS?: Array<any>;
ST?: Array<any>;
[key: string]: any[] | undefined; // 添加索引签名以支持动态访问
}
// 字典数据存储
const dictData = ref<DictData>({});
const labInputcolList = ref([])
const resultConfig = ref([])
2025-11-25 18:05:18 +08:00
const instrdComOpt = ref({}) //仪器通用配置
2025-11-18 18:12:34 +08:00
// 获取参数配置
const getSysList = () => {
instrdconfig({ yq: queryParams.value.yq }).then((res: any) => {
if (res.code == 0) {
labInputcolList.value = res.data.labInputcolList.filter((item: any) => item.mrts != "年龄单位" && item.mrts != "!")
resultConfig.value = res.data.ResultConfig
2025-11-25 18:05:18 +08:00
instrdComOpt.value = res.data.instrdComOpt
2025-11-18 18:12:34 +08:00
}
});
mbStore.setLxsrList([]);
}
getSysList()
const userList = ref([]);
onMounted(async () => {
const data = { status: 0, del_flag: 0, pageSize: 1000, pageNum: 1 }
listUser(data).then((res: any) => {
userList.value = res.rows;
});
// 加载病人来源字典
2025-11-21 18:01:14 +08:00
const dictRefs = await comDict('PT', 'AU', 'SX', 'DP', 'BT', 'SRD', 'HOS', 'ST', 'germclass', 'GMC');
2025-11-18 18:12:34 +08:00
// 从 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
germclass: toRaw(dictRefs.germclass.value) || [],
2025-11-21 18:01:14 +08:00
GMC: toRaw(dictRefs.GMC.value) || [],
2025-11-18 18:12:34 +08:00
};
2025-11-20 18:17:09 +08:00
// 初始化Socket
2025-11-25 18:05:18 +08:00
initSocket()
2025-11-20 18:17:09 +08:00
});
const initSocket = () => {
initWebSocket({
2025-11-25 18:05:18 +08:00
fullUrl: `ws://47.97.125.165:8904/ws/instr/${mbStore.fingerprint}`,
// fullUrl: `ws://192.168.1.151:9801/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();
2025-11-18 18:12:34 +08:00
});
2025-11-20 18:17:09 +08:00
// 发送消息
const sendMessage = () => {
const isSuccess = sendWebSocketMessage({ yq: queryParams.value.yq });
if (isSuccess) {
console.log(`发送消息`);
} else {
console.log('发送失败:连接未建立');
}
};
2025-11-11 18:17:47 +08:00
</script>
2025-11-18 18:12:34 +08:00
<style scoped lang="scss">
.app-container {
background: #F0F3F8;
}
2025-11-26 18:09:02 +08:00
2025-11-21 18:01:14 +08:00
:deep(.el-tabs--card>.el-tabs__header) {
height: 1.875rem !important;
margin-bottom: 0px;
font-size: .875rem;
.el-tabs__item {
height: 1.875rem !important;
padding: 0 .625rem;
&.is-active {
border-bottom: .125rem solid #409eff !important;
background-color: #e9f1fb;
}
}
}
2025-11-18 18:12:34 +08:00
.box-shadow {
box-shadow: 2px 2px 4px 0px rgba(206, 217, 234, 0.7);
border-radius: .75rem;
padding: .5rem;
background-color: #fff;
2025-11-19 18:07:30 +08:00
}
.radio_box {
display: flex;
align-items: center;
margin: .125rem 0;
.el-radio {
2025-11-24 18:03:52 +08:00
margin-right: .3125rem;
2025-11-18 18:12:34 +08:00
}
}
.right_box {
height: calc(90vh - 3.4rem);
2025-11-19 18:07:30 +08:00
2025-11-18 18:12:34 +08:00
}
.compact-form {
border-bottom: 1px solid #E1E9F7;
margin-bottom: 0.5rem;
.el-form-item--default {
margin-bottom: .3125rem !important;
}
.el-form-item--small {
margin-bottom: .3125rem !important;
}
}
.card-content {
max-height: 28.125rem;
/* 设置最大高度 */
overflow-y: auto;
/* 超出高度时显示垂直滚动条 */
padding: .3125rem;
/* 保持与卡片默认一致的内边距 */
}
.button-group {
2025-11-19 18:07:30 +08:00
// display: flex;
// justify-content: space-around;
// font-family: SourceHanSansCN, SourceHanSansCN;
// font-weight: 500;
// font-size: 1rem;
// color: #28BDBB;
width: 100%;
margin-top: .1875rem;
text-align: right;
2025-11-18 18:12:34 +08:00
.text2 {
color: #1F33FF;
}
.text3 {
color: #FF0000;
}
}
</style>