311 lines
12 KiB
Vue
Raw Normal View History

2026-02-09 17:37:03 +08:00
<!-- 批量审核 -->
<template>
2026-02-10 17:36:00 +08:00
<div class="app-container">
2026-02-11 17:19:40 +08:00
<el-form ref="form" :model="formData" class="form" label-width="80px" :rules="rules" inline size="small">
<el-form-item label="仪器分组" prop="lisgroup">
<SelectTable v-model:data="formData.lisgroup" size="small" :fields="fields" width="150px" dict-type="GROUP" />
2026-02-10 17:36:00 +08:00
</el-form-item>
<el-form-item label="医疗机构" prop="yljg">
2026-02-11 17:19:40 +08:00
<SelectTable v-model:data="formData.yljg" size="small" :fields="fields" width="150px" dict-type="HOS" />
2026-02-10 17:36:00 +08:00
</el-form-item>
<el-form-item label="申请科室" prop="ksdh">
2026-02-11 17:19:40 +08:00
<SelectTable v-model:data="formData.ksdh" size="small" :fields="fields" width="150px" dict-type="DP" />
2026-02-10 17:36:00 +08:00
</el-form-item>
<el-form-item label="检验仪器" prop="yq">
2026-02-11 17:19:40 +08:00
<YQSelectTable v-model:data="formData.yq" size="small" width="150px" clearable @get-data-value="getYQList" />
2026-02-10 17:36:00 +08:00
</el-form-item>
<el-form-item label="检验医师" prop="yhdh">
2026-02-11 17:19:40 +08:00
<el-input placeholder="请填写检验医师" v-model="formData.yhdh" width="150px"></el-input>
2026-02-10 17:36:00 +08:00
</el-form-item>
<el-form-item label="病人来源" prop="brly">
2026-02-11 17:19:40 +08:00
<SelectTable v-model:data="formData.brly" size="small" :fields="fields" width="150px" dict-type="PT" />
</el-form-item>
<el-form-item label="标本日期" prop="jyrq">
<el-date-picker v-model="formData.jyrq1" type="date" style="width: 150px;" /> - <el-date-picker
v-model="formData.jyrq2" type="date" style="width: 150px;" />
2026-02-10 17:36:00 +08:00
</el-form-item>
<el-form-item label="标本号" prop="ybh">
<el-input placeholder="请输入开始标本号" v-model="formData.ybh1" style="width: 120px;"></el-input> - <el-input
placeholder="请输入结束标本号" v-model="formData.ybh2" style="width: 120px;"></el-input>
</el-form-item>
<el-form-item label="审核标志">
2026-02-11 17:19:40 +08:00
<el-select v-model="formData.jgbz" style="width: 150px" clearable>
2026-02-10 17:36:00 +08:00
<el-option v-for="item in jgbzOption" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-checkbox v-model="formData.jzbz" label="急诊报告" true-value="1" false-value="0"></el-checkbox>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList">查询</el-button>
<el-button type="primary" @click="checkData">批量审核</el-button>
<el-button type="primary" @click="cancelCheck">取消审核</el-button>
</el-form-item>
</el-form>
<h3>{{ msg }}</h3>
<div class="table-container">
2026-02-11 17:19:40 +08:00
<el-row :gutter="0">
<el-col :span="18">
2026-02-12 16:40:57 +08:00
<CustomTable ref="tableRef" :data="tableData" :columns="columns" :config="tableConfig" :loading="loading"
2026-02-11 17:19:40 +08:00
v-on:row-click="tableRowClick">
<template #jgbz="{ row }">
<span>{{ displayJGBZ(row.jgbz) }}</span>
</template>
<template #brly="{ row }">
<span>{{ formatDict(row.brly, 'PT') }}</span>
</template>
<template #brxb="{ row }">
<span>{{ displayBRXB(row.brxb) }}</span>
</template>
<template #brnl="{ row }">
<span>{{ displayBRNL(row.nl, row.nldw) }}</span>
</template>
<template #ksdh="{ row }">
<span>{{ formatDict(row.ksdh, 'DP') }}</span>
</template>
<template #sjys="{ row }">
<span>{{ formatDict(row.sjys, 'SRD') }}</span>
</template>
<template #yblx="{ row }">
<span>{{ formatDict(row.yblx, 'BT') }}</span>
</template>
<template #dybz="{ row }">
<span>{{ row.dybz === "1" ? "已打印" : "未打印" }}</span>
</template>
</CustomTable>
</el-col>
<el-col :span="6">
<LabResult v-model="paramObj" v-if="!isXJY" />
<LabResultMed v-model="paramObj" v-if="isXJY" />
</el-col>
</el-row>
2026-02-10 17:36:00 +08:00
</div>
</div>
2026-02-09 17:37:03 +08:00
</template>
<script setup lang="ts">
import CustomTable from '@/components/elTable/index.vue'
import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue';
import SelectTable from '@/components/SelectTable/index.vue';
2026-02-10 17:36:00 +08:00
import { batchCheckService, queryBatchCheckListService, cancelBatchCheckService } from '@/api/liswork/batchCheck/batchCheckApi';
import dayjs from 'dayjs';
import { formatDict, getDictData } from '@/hooks'
import { displayBRNL, displayBRXB } from '@/utils/czUtil/lisUtil'
2026-02-11 17:19:40 +08:00
//@ts-ignore
import useUserStore from '@/store/modules/user';
import LabResult from './LabResult.vue';
import LabResultMed from './LabResultMed.vue';
2026-02-09 17:37:03 +08:00
2026-02-10 17:36:00 +08:00
const formData = ref({
lisgroup: '', //仪器分组
yljg: '', //医疗机构
ksdh: '', //申请科室
yq: '', //检验仪器
jyrq1: '', //标本日期开始
jyrq2: '', //标本日期结束
yhdh: '', //检验医师
brly: '', //病人来源
ybh1: '', //标本号开始
ybh2: '', //标本号结束
jgbz: '0', //审核标志
jzbz: 0 //急诊标志
})
2026-02-09 17:37:03 +08:00
const tableRef = ref();
2026-02-10 17:36:00 +08:00
const form = ref();
const msg = ref('') //审核后结果显示
2026-02-09 17:37:03 +08:00
const tableData = ref()
2026-02-11 17:19:40 +08:00
const userStore = useUserStore()
const paramObj = ref<any>(null) // 用于传递给 LabResult 组件的参数对象
const isXJY = ref(false)
2026-02-12 16:40:57 +08:00
const loading = ref(false)
2026-02-09 17:37:03 +08:00
const columns = ref([
2026-02-10 17:36:00 +08:00
{ type: 'selection', title: '选择', visible: true, align: 'center', width: 40 },
{ prop: 'jgbz', label: '审核标志', visible: true, align: 'center', slot: 'jgbz' },
{ prop: 'yqmc', label: '检验仪器', visible: true, align: 'center', width: 150 },
{ prop: 'jyrq', label: '检验日期', visible: true, align: 'center', width: 150 },
2026-02-09 17:37:03 +08:00
{ prop: 'ybh', label: '样本号', visible: true, align: 'center' },
{ prop: 'brxm', label: '姓名', visible: true, align: 'center' },
2026-02-10 17:36:00 +08:00
{ prop: 'brdh', label: '住院号', visible: true, align: 'center' },
2026-02-09 17:37:03 +08:00
{ prop: 'sqh', label: '申请号', visible: true, align: 'center' },
2026-02-10 17:36:00 +08:00
{ prop: 'brly', label: '病人类型', visible: true, align: 'center', slot: 'brly' },
{ prop: 'brxb', label: '性别', visible: true, align: 'center', slot: 'brxb' },
{ prop: 'brnl', label: '年龄', visible: true, align: 'center', slot: 'brnl' },
{ prop: 'ksdh', label: '科室', visible: true, align: 'center', slot: 'ksdh' },
2026-02-09 17:37:03 +08:00
{ prop: 'ch', label: '床号', visible: true, align: 'center' },
2026-02-10 17:36:00 +08:00
{ prop: 'sjys', label: '送检医生', visible: true, align: 'center', slot: 'sjys' },
2026-02-11 17:19:40 +08:00
{ prop: 'sqsj', label: '送检时间', visible: true, align: 'center', width: 150 },
{ prop: 'cyrq', label: '采样时间', visible: true, align: 'center', width: 150 },
2026-02-10 17:36:00 +08:00
{ prop: 'yhdhmc', label: '检验医师', visible: true, align: 'center' },
{ prop: 'dysj', label: '报告日期', visible: true, align: 'center', width: 150 },
2026-02-11 17:19:40 +08:00
{ prop: 'yblx', label: '样本类型', visible: true, align: 'center', slot: 'yblx' },
2026-02-10 17:36:00 +08:00
{ prop: 'hdysmc', label: '核对医生', visible: true, align: 'center' },
2026-02-11 17:19:40 +08:00
{ prop: 'dybz', label: '打印标志', visible: true, align: 'center', slot: 'dybz' },
2026-02-09 17:37:03 +08:00
{ prop: 'zd', label: '临床诊断', visible: true, align: 'center' },
{ prop: 'bz', label: '备注', visible: true, align: 'center' },
2026-02-10 17:36:00 +08:00
{ prop: 'confirmermc', label: '审核人', visible: true, align: 'center' },
{ prop: 'confirmdt', label: '审核时间', visible: true, align: 'center', width: 150 },
2026-02-09 17:37:03 +08:00
]);
const jgbzOption = ref([
{ value: '0', label: '未审核' },
{ value: '2', label: '已审核' },
{ value: '1', label: '初审' },
])
const tableConfig = ref({
border: true, // 边框
2026-02-10 17:36:00 +08:00
height: 'calc(100vh - 220px)', // 高度,
2026-02-09 17:37:03 +08:00
highlightCurrentRow: true, // 高亮当前行
// cellStyle: cellStyleHd
})
const fields = ref(
[
{ prop: 'value', label: '代号', width: 80, enablePinyinSearch: true },
{ prop: 'label', label: '名称', width: 150, enablePinyinSearch: true },
]
)
2026-02-10 17:36:00 +08:00
const displayJGBZ = (jgbz: string) => {
const option = jgbzOption.value.find((opt) => opt.value === jgbz)
return option ? option.label : jgbz
}
const validateYbhRange = (rule: any, value: any, callback: any) => {
const { ybh1, ybh2 } = formData.value // 同时获取两个输入框的值
// 场景1:两个都必填
if (!ybh1 && !ybh2) {
callback(new Error('开始和结束标本号不能为空'))
return
}
if (!ybh1) {
callback(new Error('请输入开始标本号'))
return
}
if (!ybh2) {
callback(new Error('请输入结束标本号'))
return
}
// 校验通过:必须调用空的callback()
callback()
}
2026-02-09 17:37:03 +08:00
2026-02-10 17:36:00 +08:00
const validateJYRQRange = (rule: any, value: any, callback: any) => {
const { jyrq1, jyrq2 } = formData.value
if (!jyrq1 || !jyrq2) {
callback(new Error('标本日期范围不能为空'))
return false
}
if (new Date(jyrq1) > new Date(jyrq2)) {
callback(new Error('标本日期范围不正确,开始日期不能大于结束日期'))
return false
}
return true
2026-02-09 17:37:03 +08:00
}
2026-02-10 17:36:00 +08:00
const rules = ref({
yljg: [{ required: true, message: '请选择医疗机构', trigger: 'blur' }],
ybh: [{ validator: validateYbhRange, trigger: 'blur' }],
yq: [{ required: true, message: '请选择检验仪器', trigger: 'blur' }],
jyrq: [{ validator: validateJYRQRange, trigger: 'blur' }],
})
const getList = async () => {
await form.value.validate()
formData.value.jyrq1 = dayjs(formData.value.jyrq1).format('YYYY-MM-DD HH:mm:ss')
formData.value.jyrq2 = dayjs(formData.value.jyrq2).format('YYYY-MM-DD HH:mm:ss')
const res = await queryBatchCheckListService(formData.value)
tableData.value = res.data
}
const checkData = async () => {
const selected = tableRef.value?.getSelectionRows
? tableRef.value.getSelectionRows()
: (tableRef.value?.tableRef?.getSelectionRows ? tableRef.value.tableRef.getSelectionRows() : [])
const paramList = (selected || []).map((item: any) => ({
2026-02-11 17:19:40 +08:00
userId: userStore.name || '',
2026-02-10 17:36:00 +08:00
yq: String(item.yq).trim(),
jyrq: dayjs(item.jyrq).format('YYYY-MM-DD HH:mm:ss'),
ybh: item.ybh,
}))
if (!paramList.length) {
msg.value = '请先选择要审核的行'
return
}
2026-02-12 16:40:57 +08:00
loading.value = true
2026-02-10 17:36:00 +08:00
const ret = await batchCheckService(paramList)
if (ret && ret.code === 200) {
2026-02-12 16:40:57 +08:00
msg.value = '批量审核成功:' + ret.msg
} else {
msg.value = '批量审核失败:' + ret.msg
2026-02-10 17:36:00 +08:00
}
2026-02-12 16:40:57 +08:00
getList()
loading.value = false
2026-02-10 17:36:00 +08:00
}
const cancelCheck = async () => {
2026-02-11 17:19:40 +08:00
const selected = tableRef.value?.getSelectionRows
? tableRef.value.getSelectionRows()
: (tableRef.value?.tableRef?.getSelectionRows ? tableRef.value.tableRef.getSelectionRows() : [])
const paramList = (selected || []).map((item: any) => ({
userId: userStore.name || '',
yq: String(item.yq).trim(),
jyrq: dayjs(item.jyrq).format('YYYY-MM-DD HH:mm:ss'),
ybh: item.ybh,
}))
if (!paramList.length) {
msg.value = '请先选择要审核的行'
return
}
2026-02-12 16:40:57 +08:00
loading.value = true
2026-02-10 17:36:00 +08:00
const ret = await cancelBatchCheckService(paramList)
if (ret.code === 200) {
2026-02-12 16:40:57 +08:00
msg.value = '取消审核成功:' + ret.msg
} else {
msg.value = '取消审核失败:' + ret.msg
2026-02-10 17:36:00 +08:00
}
2026-02-12 16:40:57 +08:00
getList()
loading.value = false
2026-02-10 17:36:00 +08:00
}
2026-02-11 17:19:40 +08:00
const tableRowClick = (row: any) => {
paramObj.value = {
yq: String(row.yq).trim(),
jyrq: dayjs(row.jyrq).format('YYYY-MM-DD'),
ybh: row.ybh,
}
}
const getYQList = (val: { yq: string; yqmc: string; yqdl: string } | null) => {
isXJY.value = String(val?.yqdl ?? '').trim() === '细菌仪';
2026-02-12 16:40:57 +08:00
//console.log('选择的仪器大类:', val?.yqdl, '是否是细菌仪:', isXJY.value)
2026-02-11 17:19:40 +08:00
}
2026-02-10 17:36:00 +08:00
onMounted(() => {
2026-02-11 17:19:40 +08:00
getDictData('DP', 'SRD', 'BT', 'PT')
2026-02-10 17:36:00 +08:00
})
2026-02-09 17:37:03 +08:00
</script>
2026-02-10 17:36:00 +08:00
<style scoped lang="scss">
.table-container {
height: calc(100vh - 220px);
overflow: auto;
/* 如果表格高度超出,显示滚动条 */
padding-bottom: 12px;
/* 给底部留出空间,避免被遮挡 */
box-sizing: border-box;
}
</style>