批量扫码
This commit is contained in:
parent
817aceee78
commit
229198c53b
225
src/views/liswork/work/components/batchCode.vue
Normal file
225
src/views/liswork/work/components/batchCode.vue
Normal file
@ -0,0 +1,225 @@
|
||||
<template>
|
||||
<el-dialog v-model="show" title="申请信息条形码自动输入" width="800px" :close-on-click-modal="false" :draggable="true"
|
||||
@close="handleClose">
|
||||
<div class="container">
|
||||
<el-form inline class="compact-form">
|
||||
<el-form-item label="样本号:">
|
||||
<el-input v-model="ybh" @keyup.enter="ybhChange" />
|
||||
</el-form-item>
|
||||
<el-form-item label="条形码:">
|
||||
<el-input ref="sqhRef" v-model="newSqh" @keyup.enter="handleEnter" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-button-group class="mb-4">
|
||||
<el-button type="default" @click="goPrev">上一个</el-button>
|
||||
<el-button type="default" @click="goNext">下一个</el-button>
|
||||
<el-button type="default" @click="goLast">最后</el-button>
|
||||
<el-button @click="show = false">退出</el-button>
|
||||
<el-button type="primary" @click="printHandle">打印列表</el-button>
|
||||
</el-button-group>
|
||||
|
||||
<div class="prev-specimen-info p-2 border">
|
||||
<div class="title">上一标本信息</div>
|
||||
<el-form inline :model="prevSpecimen" label-width="80px" class="compact-form">
|
||||
<el-form-item label="样本号:">
|
||||
<div class="text"> {{ prevSpecimen.ybh }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请号:">
|
||||
<div class="text"> {{ prevSpecimen.sqh }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="姓名:">
|
||||
<div class="text"> {{ prevSpecimen.brxm }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="科室:">
|
||||
<div class="text"> {{ formatDict(prevSpecimen.ksdh, 'DP') }} </div>
|
||||
</el-form-item>
|
||||
<el-form-item label="性别:">
|
||||
<div class="text"> {{ formatDict(prevSpecimen.brxb, 'SX') }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="年龄:">
|
||||
<div class="text"> {{ prevSpecimen.nl }} {{ formatDict(prevSpecimen.nldw, 'AU') }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="床号:">
|
||||
<div class="text"> {{ prevSpecimen.ch }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请项目:">
|
||||
<div class="text"> {{ prevSpecimen.jymd }}</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between">
|
||||
<div class="sum">
|
||||
本次扫描 <span class="c_text">{{ currentScanCount }}</span> 个,当天样本总数 <span class="sum_text"> {{ totalCount
|
||||
}}</span> 个
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-table :data="tableData" border class="mt-4 w-full" height="400px">
|
||||
<el-table-column prop="ybh" label="样本号" />
|
||||
<el-table-column prop="sqh" label="条码" />
|
||||
<el-table-column prop="brxm" label="姓名" />
|
||||
<el-table-column prop="brdh" label="病历号" />
|
||||
<el-table-column prop="jymd" label="项目" width="300" />
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { updateLabPat } from "@/api/liswork/work/LisWork";
|
||||
import emitter from "@/utils/mitt";
|
||||
import { ElMessage } from "element-plus";
|
||||
const props = defineProps({
|
||||
labPat: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
totalCount: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
labPatKey: {
|
||||
type: Object,
|
||||
default: () => { }
|
||||
},
|
||||
dictData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
const { labPat, totalCount, labPatKey } = toRefs(props);
|
||||
|
||||
watch(() => labPat.value, () => {
|
||||
if (labPat.value.ybh) {
|
||||
ybh.value = labPat.value.ybh
|
||||
}
|
||||
})
|
||||
|
||||
const sqhRef = ref()
|
||||
const newSqh = ref('')
|
||||
const show = ref(false);
|
||||
const ybh = ref('')
|
||||
// 上一标本信息
|
||||
const prevSpecimen: any = ref({});
|
||||
|
||||
// 表格数据
|
||||
const tableData: any = ref([]);
|
||||
|
||||
|
||||
const currentScanCount = ref(0);
|
||||
|
||||
const emit = defineEmits(['goPrev', 'goNext', 'update:labPat', 'changeStatus', 'queryYbh', 'goLast']);
|
||||
|
||||
const ybhChange = () => {
|
||||
if (!ybh.value.trim()) return ElMessage.warning('请输入样本号!')
|
||||
emit('queryYbh', ybh.value)
|
||||
|
||||
}
|
||||
// 处理Enter键添加数据并跳转到下一个标本
|
||||
const handleEnter = () => {
|
||||
if (!newSqh.value.trim()) return ElMessage.warning('请录入条形码!')
|
||||
const index = tableData.value.findIndex((item: any) => item.sqh == newSqh.value)
|
||||
if (index > -1) return ElMessage.warning('条形码已录入!')
|
||||
|
||||
emitter.emit('saveLab');
|
||||
updateLabPat({ ...labPatKey.value, ...labPat.value, sqh: newSqh.value }).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
newSqh.value = ''
|
||||
sqhRef.value.focus()
|
||||
if (res.data) {
|
||||
emit('update:labPat', res.data)
|
||||
emit("changeStatus", res.data, true);
|
||||
} else {
|
||||
emit("changeStatus", labPat.value, true);
|
||||
}
|
||||
prevSpecimen.value = res.data
|
||||
tableData.value.push(res.data)
|
||||
currentScanCount.value++;
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
// 上一个标本
|
||||
const goPrev = () => {
|
||||
emit('goPrev');
|
||||
};
|
||||
|
||||
// 下一个标本
|
||||
const goNext = () => {
|
||||
emit('goNext');
|
||||
};
|
||||
|
||||
// 最后一个标本
|
||||
const goLast = () => {
|
||||
emit('goLast');
|
||||
};
|
||||
|
||||
const printHandle = () => {
|
||||
if (!tableData.value.length) return ElMessage.warning('样本打印数据为空')
|
||||
};
|
||||
|
||||
const open = () => {
|
||||
ybh.value = labPat.value.ybh
|
||||
show.value = true;
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
ybh.value = ''
|
||||
newSqh.value = ''
|
||||
prevSpecimen.value = {};
|
||||
tableData.value = [];
|
||||
currentScanCount.value = 0;
|
||||
};
|
||||
|
||||
const formatDict = (v: string, dictType: string) => {
|
||||
return props.dictData[dictType]?.find((item: any) => item.value == v)?.label || v;
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.prev-specimen-info {
|
||||
background-color: #e6f7ff;
|
||||
position: relative;
|
||||
padding: 20px 0;
|
||||
|
||||
.text {
|
||||
width: 12.5rem;
|
||||
}
|
||||
|
||||
.title {
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
font-family: SourceHanSansCN, SourceHanSansCN;
|
||||
padding-left: 30px;
|
||||
margin-bottom: 5px;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
|
||||
.sum {
|
||||
font-family: SourceHanSansCN, SourceHanSansCN;
|
||||
font-size: 16px;
|
||||
|
||||
.c_text {
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
.sum_text {
|
||||
color: #0000ff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -3,7 +3,7 @@
|
||||
<div class="flex-between mb5">
|
||||
<el-input v-model="sqhValue" placeholder="条码号" ref="sqhRef" :size="aotuSize" class="mr10" style="width:100%"
|
||||
@keyup.enter="handleInputFocus" />
|
||||
<el-button type="primary" :size="aotuSize">打印条码</el-button>
|
||||
<el-button type="primary" :size="aotuSize" @click="batchHandle">扫码</el-button>
|
||||
</div>
|
||||
<el-form :model="labPat" label-width="5rem" class="compact-form" label-position="right">
|
||||
<div :class="['sh_box', getColor(lastJgbz)]" v-if="lastJgbz != null && lastJgbz != 0 && lastJgbz != 'C'">
|
||||
@ -73,11 +73,11 @@ import { changepatcolumn, updateLabPat, checkYsUser } from "@/api/liswork/work/L
|
||||
import SelectTable from '@/components/SelectTable/index.vue';
|
||||
import YhVerification from './yhVerification.vue';
|
||||
|
||||
import { PropType } from 'vue';
|
||||
import emitter from '@/utils/mitt';
|
||||
import { classCom } from '@/utils/classCom';
|
||||
import { use } from 'vxe-pc-ui';
|
||||
const aotuSize = classCom.useAutoSize();
|
||||
|
||||
|
||||
interface LabSysItem {
|
||||
kj: string;
|
||||
dict: string;
|
||||
@ -118,7 +118,7 @@ watch(() => props.labPat, (newVal) => {
|
||||
sqhValue.value = '';
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:labPat', 'changeStatus']);
|
||||
const emit = defineEmits(['update:labPat', 'changeStatus', 'batchShow']);
|
||||
const lastValue = ref('');
|
||||
|
||||
const brlyFields = ref([
|
||||
@ -155,6 +155,10 @@ const handleInputFocus = () => {
|
||||
// 表单引用
|
||||
const formRef = ref();
|
||||
|
||||
// 批量扫码
|
||||
const batchHandle = () => {
|
||||
emit('batchShow')
|
||||
};
|
||||
// 处理确定按钮点击
|
||||
const handleConfirm = async () => {
|
||||
form.value.mm = ''
|
||||
@ -219,6 +223,7 @@ const handleFieldChange = async () => {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 保存病人信息
|
||||
const saveLabPat = async (changedField: any) => {
|
||||
if (props.labPat.id) {
|
||||
|
||||
@ -1059,6 +1059,7 @@ const handleCsjgEnter = async (row) => {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (!row) return
|
||||
if (row && row.id) {
|
||||
emitter.emit('saveResult');
|
||||
newresult(row).then(response => {
|
||||
|
||||
@ -42,18 +42,22 @@ import * as echarts from 'echarts';
|
||||
import { historyInfo } from '@/api/liswork/work/LisWork'
|
||||
import dayjs from 'dayjs';
|
||||
import CustomTable from '@/components/elTable/index.vue'
|
||||
|
||||
import { getGroupInstrdList } from '@/api/liswork/work/LisWork'
|
||||
const props = defineProps({
|
||||
// 主键
|
||||
queryParams: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}
|
||||
},
|
||||
dictData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
})
|
||||
|
||||
// 解构 props
|
||||
const { queryParams } = toRefs(props);
|
||||
|
||||
const instrOptions = ref<Array<{ yq: string, yqmc: string }>>([])
|
||||
const tableData: any = ref([]);
|
||||
const tableRef = ref();
|
||||
const columns = ref([
|
||||
@ -119,13 +123,23 @@ const formatHeader = (column: any, prefix: string) => {
|
||||
const yljgKey = `${prefix}yljg`;
|
||||
const dateKey = `${prefix}Date`;
|
||||
const ybhKey = `${prefix}ybh`;
|
||||
const yqdlKey = `${prefix}yqdl`;
|
||||
const yqKey = `${prefix}yq`;
|
||||
const brxbKey = `${prefix}brxb`;
|
||||
const nlKey = `${prefix}nl`;
|
||||
const item = tableData.value[index];
|
||||
return `${item[yljgKey]} <br /> ${item[dateKey]} <br /> ${item[yqdlKey]}(${item[ybhKey]})`;
|
||||
return `${item[yljgKey]} <br /> ${item[dateKey]} <br /> ${formatYq(item[yqKey])}(${item[ybhKey]}) <br /> ${item[brxbKey]},${item[nlKey]}`;
|
||||
}
|
||||
return column.label;
|
||||
};
|
||||
|
||||
const formatDict = (v: string, dictType: string) => {
|
||||
return props.dictData[dictType]?.find((item: any) => item.value == v)?.label || v;
|
||||
}
|
||||
|
||||
const formatYq = (yq: string) => {
|
||||
return instrOptions.value?.find((item: any) => item.yq == yq.trim())?.yqmc || yq;
|
||||
}
|
||||
|
||||
const getList = () => {
|
||||
historyInfo(queryParams.value).then((res: any) => {
|
||||
const periods = ['first', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
|
||||
@ -139,13 +153,15 @@ const getList = () => {
|
||||
map.set(item.xmdh, {
|
||||
csjg: item.csjg,
|
||||
jyrq: dayjs(item.jyrq).format('YY/MM/DD'),
|
||||
yqdl: item.yqdl,
|
||||
yq: item.yq,
|
||||
ybh: item.ybh,
|
||||
yljg: item.yljg,
|
||||
result_flag: item.result_flag,
|
||||
xmmc: item.xmmc,
|
||||
cksx: item.cksx,
|
||||
ckxx: item.ckxx
|
||||
ckxx: item.ckxx,
|
||||
brxb: item.brxb,
|
||||
nl: item.nl,
|
||||
});
|
||||
});
|
||||
dataMaps.set(period, map);
|
||||
@ -168,9 +184,11 @@ const getList = () => {
|
||||
if (item) {
|
||||
row[`${period}Csjg`] = item.csjg;
|
||||
row[`${period}Date`] = item.jyrq;
|
||||
row[`${period}yqdl`] = item.yqdl;
|
||||
row[`${period}yq`] = item.yq;
|
||||
row[`${period}ybh`] = item.ybh;
|
||||
row[`${period}yljg`] = item.yljg;
|
||||
row[`${period}brxb`] = item.brxb;
|
||||
row[`${period}nl`] = item.nl;
|
||||
row[`${period}ResultFlag`] = item.result_flag;
|
||||
|
||||
if (!row.xmmc) {
|
||||
@ -196,7 +214,6 @@ watch(() => props.queryParams, (newValue) => {
|
||||
}, { immediate: true })
|
||||
|
||||
const handleRowClick = (row: any) => {
|
||||
console.log('row==>', row);
|
||||
nextTick(() => {
|
||||
getEcharts(row)
|
||||
})
|
||||
@ -204,10 +221,10 @@ const handleRowClick = (row: any) => {
|
||||
|
||||
const myEcharts = ref()
|
||||
const getEcharts = (data: any) => {
|
||||
const periods = ['first', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
|
||||
const periods = ['nine', 'eight', 'seven', 'six', 'five', 'four', 'three', 'two', 'one', 'first']
|
||||
|
||||
const xData = periods.map(period => { return data[`${period}Date`] || ''; })
|
||||
const yData = periods.map(period => { return data[`${period}Csjg`] || ''; })
|
||||
const xData = periods.map(period => { return data[`${period}Date`] }).filter(Boolean) //过滤掉空值
|
||||
const yData = periods.map(period => { return data[`${period}Csjg`] }).filter(Boolean)
|
||||
const Intance = echarts.init(myEcharts.value);
|
||||
|
||||
|
||||
@ -251,7 +268,10 @@ const getEcharts = (data: any) => {
|
||||
data: xData,
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
rotate: 30 // 日期标签旋转,避免重叠
|
||||
rotate: 30, // 日期标签旋转,避免重叠
|
||||
},
|
||||
axisTick: {
|
||||
alignWithLabel: true // 让刻度线与标签对齐
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
@ -320,6 +340,16 @@ const getEcharts = (data: any) => {
|
||||
Intance.setOption(option);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getGroupInstrdList().then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
instrOptions.value = res.data.map((item: any) => ({
|
||||
yq: item.yq.trim(),
|
||||
yqmc: item.yqmc
|
||||
}))
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
<el-row :gutter="5">
|
||||
<el-col :span="8">
|
||||
<LabPat ref="labPatRef" v-model:labPat="labPat" :labPatKey="queryParams" :labSysList="labInputcolList"
|
||||
:userList="userList" @changeStatus="changeStatus" />
|
||||
:userList="userList" @changeStatus="changeStatus" @batchShow="handleBatchScan" />
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<LabResult ref="labResultRef" :labPat="labPat" :tableData="labResuts" :tableKey="queryParams"
|
||||
@ -97,6 +97,10 @@
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 批量扫码弹窗 -->
|
||||
<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" />
|
||||
@ -131,6 +135,7 @@ import { getNextNumber, getPreviousNumber } from "@/utils/getNextNumber";
|
||||
import { useCommonStore } from '@/store/modules/commonStore';
|
||||
import { classCom } from '@/utils/classCom';
|
||||
import PatientQueryForm from '@/components/selectSearch/index.vue'
|
||||
import BatchCode from './components/batchCode.vue';
|
||||
// @ts-ignore
|
||||
import { listUser } from '@/api/system/user.js'
|
||||
|
||||
@ -364,6 +369,12 @@ const fetchLabPat = () => {
|
||||
|
||||
const lastRow: any = ref({})
|
||||
|
||||
// 批量扫码ybh同步样本编号
|
||||
const ybhChangeTb = (val: string) => {
|
||||
console.log('val==>', val);
|
||||
queryParams.value.ybh = val
|
||||
handleQuery();
|
||||
}
|
||||
const handleQuery = () => {
|
||||
if (!labPatList.value.length) return
|
||||
if (!queryParams.value.ybh) {
|
||||
@ -429,8 +440,15 @@ const delSampleHd = () => {
|
||||
ElMessage.success('删除成功')
|
||||
labPatList.value = labPatList.value.filter((item: any) => item.ybh != lastRow.value.ybh)
|
||||
getTotals()
|
||||
// 删除跳下一个样本
|
||||
handleNext()
|
||||
// 删除跳当前页面下一个样本
|
||||
// handleNext()
|
||||
if (highlightRowIndex.value > labPatList.value.length - 1) {
|
||||
highlightRowIndex.value--;
|
||||
}
|
||||
|
||||
const row = labPatList.value[highlightRowIndex.value];
|
||||
labPatListRef.value.setCurrentRow(row);
|
||||
selectJob(row);
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -488,10 +506,15 @@ const handleNext = () => {
|
||||
handleCreate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 最后一个样本
|
||||
const handleLast = () => {
|
||||
}
|
||||
const batchRef = ref()
|
||||
// 批量扫码
|
||||
const handleBatchScan = () => {
|
||||
batchRef.value.open()
|
||||
}
|
||||
// 改变样本列表中样本状态
|
||||
const changeStatus = (updatedPat: any, flag: boolean) => {
|
||||
queryLabPat(queryParams.value).then((response: any) => {
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<CustomTable ref="tableDetailRef" :columns="columns" :data="tableDataDetail" :config="config"
|
||||
@row-click="handleRowClick" :enable-column-drag="true" @column-drag-end="handleColumnDragEnd">
|
||||
:enable-column-drag="true" @column-drag-end="handleColumnDragEnd">
|
||||
<template #firstCsjg="{ column }">
|
||||
<div v-html="formatHeader(column, 'first')"></div>
|
||||
</template>
|
||||
@ -147,7 +147,7 @@ const formatHeader = (column: any, prefix: string) => {
|
||||
const brxbKey = `${prefix}brxb`;
|
||||
const nlKey = `${prefix}nl`;
|
||||
const item = tableDataDetail.value[index];
|
||||
return ` ${item[dateKey]} <br /> (${item[ybhKey]}) <br /> ${item[yqdlKey]} <br />${item[brxbKey]},${item[nlKey]}`;
|
||||
return ` ${item[dateKey]} <br /> (${item[ybhKey]}) <br /> ${formatyq(item[yqKey])} <br />${item[brxbKey]},${item[nlKey]}`;
|
||||
}
|
||||
return column.label;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user