2025-11-24 18:03:52 +08:00

337 lines
11 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<div class="title"><span>初报人:</span>{{ labPat.confirmer }} &nbsp;&nbsp; <span>报告时间:</span>{{ labPat.confirmdt
}}&nbsp;&nbsp;</div>
<div>
<el-button class="btn_green btns_box" :size="autoSize" v-if="labPat.jgbz != 2"
@click="handleCheck(1)">初报审核</el-button>
<el-button class="btns_box" :size="autoSize" v-if="labPat.jgbz == 2" @click="handleCheck(3)">取消审核</el-button>
<el-button class="btns_box" type="primary" :size="autoSize" plain
:disabled="labPat.jgbz != null && labPat.jgbz != 0" @click="openItemDictDialog">新增</el-button>
<el-button class="btns_box" type="danger" :size="autoSize" :disabled="labPat.jgbz != null && labPat.jgbz != 0"
plain @click="handleBatchDelete">删除</el-button>
<el-button class="btn_green btns_box" :size="autoSize" @click="zhHandel">组合项目</el-button>
</div>
<CustomTable :data="tableData" :columns="columns" :config="tableConfig" :enable-column-drag="true"
@column-drag-end="handleColumnDragEnd">
<template #xmdh="{ column }">
细菌/结果({{ tableData.length }})项
</template>
<template #od="{ row }">
<el-input v-model="row.od" v-if="labPat.jgbz == 0 || labPat.jgbz == null" size="small"
class="full-width-input foucs-input" @change="handleCsjgEnter(row)" />
<span v-else>{{ row.od }}</span>
</template>
<template #csjg="{ row }">
<el-input v-model="row.csjg" v-if="labPat.jgbz == 0 || labPat.jgbz == null" size="small"
class="full-width-input" @change="handleCsjgEnter(row)" @dblclick="handleInputFocus(row)" />
<span v-else>{{ row.csjg }}</span>
</template>
<template #jgbz="{ row }">
<el-select v-model="row.jgbz" class="full-width-input" v-if="labPat.jgbz == 0 || labPat.jgbz == null"
placeholder="" @change="handleCsjgEnter(row)">
<el-option label="阳性" value="P" />
<el-option label="阴性" value="N" />
</el-select>
<span v-else> {{ formatJgbz(row.jgbz) }}</span>
</template>
<template #cutoff="{ row }">
<el-input v-model="row.cutoff" v-if="labPat.jgbz == 0 || labPat.jgbz == null" size="small"
class="full-width-input" @change="handleCsjgEnter(row)" />
<span v-else>{{ row.cutoff }}</span>
</template>
<template #alarm_flag="{ row }">
<el-select v-model="row.alarm_flag" class="full-width-input" v-if="labPat.jgbz == 0 || labPat.jgbz == null"
placeholder="" @change="handleCsjgEnter(row)">
<el-option label="危急值" value="H" />
<el-option label="无" value="" />
</el-select>
<span v-else> {{ row.alarm_flag == 'H' ? '危急值' : '' }}</span>
</template>
<template #germclass="{ row }">
{{ formatDict(row.germclass, 'germclass') }}
</template>
</CustomTable>
</div>
</template>
<script setup lang="ts">
import CustomTable from '@/components/elTable/index.vue'
import { LabResultItem, ymTableDataItem } from '@/types/index';
import { getresultmedList, savetestResult, changeresult, saveresult, newresult, getmeddictList, savemedresult, savemedresultall, deletemedresult } from '@/api/liswork/micro/index';
import {
check1, check2, uncheck2, unconfirmlog, checkuser, reglimit, deleteresult, allPatquery, emrquery, datalink, changeLinkList,
viewBackup, queryXmVal, printListwork, getresultchangelog, setinputmdl, lockSample, unLockSample, clearnotComplete, clearPrintflag,
noiteMresult, queryXmInfo, setitemInter
} from "@/api/liswork/work/LisWork";
import emitter from '@/utils/mitt';
import { ElMessage } from 'element-plus';
import { useCommonStore } from "@/store/modules/commonStore";
import { classCom } from '@/utils/classCom';
const autoSize = classCom.useAutoSize();
const props = defineProps({
labPat: {
type: Object,
required: true
},
//结果主键
labPatKey: {
type: Object,
default: () => { }
},
labResutsData: {
type: Array as PropType<LabResultItem[]>,
default: () => []
},
dictData: {
type: Object,
default: () => { }
}
})
const { labPat, labPatKey, labResutsData, dictData } = toRefs(props);
const mbStore = useCommonStore();
watch(labResutsData, (newVal: any) => {
if (newVal.length) {
tableData.value = newVal.map((item: any) => {
return {
...item,
zhxmdh: item.xmdh + ' ' + item.xmmc,
}
})
console.log('tableData==>', tableData.value);
} else {
tableData.value = []
}
if (props.labPat.jgbz != null && props.labPat.jgbz != 0 && props.labPat.jgbz != 'C') return;
// console.log('mbStore==>', mbStore.lxsrs);
if (mbStore.lxsrs.length > 0) {
mbStore.lxsrs.forEach((mbmc) => {
const data = {
...labPatKey.value,
mbmc: mbmc,
}
setinputmdl(data).then((res: any) => {
if (res.code == 0) {
const existingNames = new Set(tableData.value.map((item: any) => item.xmdh))
res.data?.forEach((item: any) => {
if (!existingNames.has(item.xmdh)) {
tableData.value.push({ ...item, jyrq: labPat.value.jyrq, zhxmdh: item.xmdh + ' ' + item.xmmc })
existingNames.add(item.xmdh)
}
})
emitter.emit('clearLxsrList')
}
});
});
}
})
// 事件定义
const emits = defineEmits([
'fetchLabResults',
'changeStatus',
'previewHandle'
]);
const tableData = ref<LabResultItem[]>([])
const columns = ref([
{ label: "细菌/结果", prop: "zhxmdh", align: 'center', visible: true, headerSlot: 'xmdh', width: 150 },
{ label: "菌落计数", prop: "od", align: 'center', visible: true, slot: 'od' },
{ label: "检验结果", prop: "csjg", align: 'center', visible: true, slot: 'csjg' },
{ label: "阴阳性", prop: "jgbz", align: 'center', visible: true, slot: 'jgbz', showOverflowTooltip: false },
{ label: "危急值", prop: "alarm_flag", align: 'center', visible: true, slot: 'alarm_flag', showOverflowTooltip: false },
{ label: "菌属", prop: "germclass", align: 'center', visible: true, slot: 'germclass' },
{ label: "鉴定率", prop: "cutoff", align: 'center', visible: true, slot: 'cutoff' },
{ label: "抗生素组", prop: "bz1", align: 'center', visible: true, width: 120 },
])
const CellStyleHd = ({ row, column, rowIndex, columnIndex }: {
row: any;
column: any;
rowIndex: number;
columnIndex: number;
}) => {
if (column.label == "细菌/结果" && (row.alarm_flag ?? "").trim().length > 0) {
return { background: '#f00 !important', color: '#FFF' };
}
if (column.label == "危急值" && (row.alarm_flag ?? "").trim().length > 0) {
return { background: '#f00 !important', color: '#FFF' };
}
if (column.label == "检验结果" && row.jgbz == "H") {
return { background: '#ffc0c0 !important', color: '#606266' };
}
if (column.label == "检验结果" && row.jgbz == "L") {
return { background: '#8080ff !important', color: '#fff' };
}
if (column.label == "检验结果" && row.jgbz == "P") {
return { background: '#ffc0c0 !important', color: '#606266' };
}
if (column.label == "检验结果" && row.jgbz == "Q") {
return { background: '#ffff80 !important', color: '#606266' };
}
if (column.label == "阴阳性" && row.jgbz == "H") {
return { background: '#ffc0c0 !important', color: '#606266' };
}
if (column.label == "阴阳性" && row.jgbz == "L") {
return { background: '#8080ff !important', color: '#fff' };
}
if (column.label == "阴阳性" && row.jgbz == "P") {
return { background: '#ffc0c0 !important', color: '#606266' };
}
if (column.label == "阴阳性" && row.jgbz == "Q") {
return { background: '#ffff80 !important', color: '#606266' };
}
};
const tableConfig = ref({
height: '28vh',
border: true,
highlightCurrentRow: true,
cellStyle: CellStyleHd
});
const handleColumnDragEnd = (data: any) => {
columns.value = data.columns;
}
const handleCheck = (checkType: number) => {
// yhdh = checkuserid.value
switch (checkType) {
case 1: // 初审
check1({ ...labPatKey.value, jyrq: labPat.value.jyrq, yhdh: props.labPat.yhdh }).then((res: any) => {
emits("changeStatus", props.labPat);
})
break;
case 2: // 审核
labPatKey.value.problemId = 0
// shHandleCheck()
break;
case 3: // 取消审核
labPatKey.value.problemId = 0
// unShHandle()
break;
default:
break;
}
};
const openItemDictDialog = () => {
};
const handleBatchDelete = () => { }
// 项目结果保存
const handleCsjgEnter = async (row: any) => {
// 判断数据中包含模板新增的数据 flag
if (tableData.value.length == 0) return
const flag = tableData.value.some((item: any) => item.changeflag == 2)
if (flag) {
saveresult(tableData.value).then((res: any) => {
if (res.code == 0) {
emitter.emit('wswSaveResult');
}
})
} else {
if (!row) return
if (row && row.id) {
emitter.emit('wswSaveResult');
newresult({ ...row, ybh: labPat.value.ybh, jyrq: labPat.value.jyrq, yq: labPat.value.yq }).then((response: any) => {
ElMessage.success("结果保存成功");
emits('fetchLabResults');
}).catch((error: any) => {
emits('fetchLabResults');
});
} else {
changeresult(row).then((response: any) => {
ElMessage.success("结果保存成功");
emits('fetchLabResults');
}).catch((error: any) => {
emits('fetchLabResults');
});
}
// nextTick(() => {
// const input = document.activeElement;
// if (input?.tagName === "INPUT") input?.blur();
// });
}
};
const csjgRef = ref()
const csjgTableData = ref([])
const handleInputFocus = (row: any) => {
// dbRow.value = row
queryXmVal({ yq: labPatKey.value.yq, xmdh: row.xmdh }).then((res: any) => {
if (res.code == 0) {
csjgTableData.value = res.data
}
nextTick(() => {
csjgRef.value.open()
})
})
};
const selectItem = (row: any) => {
// 查找修改行
const index = tableData.value.findIndex((item: any) => item.xmdh == row.xmdh)
tableData.value[index].csjg = row.qz
handleCsjgEnter(tableData.value[index])
};
// 组合项目
const combinedRef = ref()
const zhHandel = () => {
combinedRef.value.open()
};
const combinedHandel = (row: any) => {
if (props.labPat.jgbz != null && props.labPat.jgbz != 0 && props.labPat.jgbz != 'C') return ElMessage.warning('已审核结果不可添加模板项目');
const data = {
...labPatKey.value,
mbmc: row.mbmc,
}
setinputmdl(data).then((res: any) => {
if (res.code == 0) {
const existingNames = new Set(tableData.value.map((item: any) => item.xmdh))
res.data?.forEach((item: any) => {
if (!existingNames.has(item.xmdh)) {
tableData.value.push({ ...item, jyrq: labPat.value.jyrq, zhxmdh: item.xmdh + ' ' + item.xmmc })
existingNames.add(item.xmdh)
}
})
handleCsjgEnter(null)
emitter.emit('clearLxsrList')
}
});
};
const formatDict = (v: string, dictType: string) => {
return props.dictData[dictType]?.find((item: any) => item.value == v)?.label || v;
}
const formatJgbz = (v: string) => {
return v == 'H' ? '高' : v == 'L' ? '低' : v == 'N' ? '阴性' : v == 'P' ? '阳性' : v == 'Q' ? '弱阳性' : v == 'M' ? '正常' : ''
}
</script>
<style scoped lang="scss">
.title {
span {
color: #00ff64;
}
}
</style>