551 lines
15 KiB
Vue
Raw Normal View History

2025-05-20 16:34:38 +08:00
<template>
2025-09-26 17:26:06 +08:00
<div class="labpat_box">
<div class="flex-between mb5">
2025-10-29 18:02:33 +08:00
<el-input v-model="sqhValue" placeholder="条码号" ref="sqhRef" :size="aotuSize" class="mr10" style="width:100%"
2025-10-21 09:55:56 +08:00
@keyup.enter="handleInputFocus" />
2025-10-29 18:02:33 +08:00
<el-button type="primary" :size="aotuSize">打印条码</el-button>
2025-09-26 17:26:06 +08:00
</div>
2025-10-21 09:55:56 +08:00
<el-form :model="labPat" label-width="70px" class="compact-form" label-position="right">
<div :class="['sh_box', getColor(lastJgbz)]" v-if="lastJgbz != null && lastJgbz != 0 && lastJgbz != 'C'">
<div class="text">{{ getLableType(lastJgbz) }}</div>
2025-09-26 17:26:06 +08:00
</div>
2025-10-16 11:20:50 +08:00
<template v-for="v in labSysList" :key="v.xh">
<el-row :gutter="10" v-if="v.mrts == '病人来源'">
<el-col :span="18">
<el-form-item :label="v.zdts" v-if="v.kj == '1'">
<SelectTable v-model:data="labPat[v.zdmc]" :fields="brlyFields" :dictType="v.dict" placeholder=""
2025-10-28 17:22:53 +08:00
label="label" value="value" objKey="value" :border="true" size="small"
@getDataValue="handleFieldChange" />
2025-10-16 11:20:50 +08:00
</el-form-item>
2025-09-26 17:26:06 +08:00
</el-col>
2025-10-16 11:20:50 +08:00
<el-col :span="6">
2025-10-28 17:22:53 +08:00
<el-checkbox v-model="labPat.jzbz" true-value="1" class="check_box"> 急诊 </el-checkbox>
<!-- :disabled="v.kybj == '0'" -->
2025-09-26 17:26:06 +08:00
</el-col>
</el-row>
2025-05-20 16:34:38 +08:00
2025-10-16 11:20:50 +08:00
<el-form-item :label="v.zdts" v-if="v.kj == '1' && !v.dict && v.mrts != '年龄'">
2025-10-28 17:22:53 +08:00
<el-input v-if="v.zdlb == '1'" v-model="labPat[v.zdmc]" @change="handleFieldChange" size="small" />
2025-10-16 11:20:50 +08:00
2025-10-28 17:22:53 +08:00
<el-date-picker v-if="v.zdlb == '3'" v-model="labPat[v.zdmc]" type="datetime" format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss" @change="handleFieldChange" size="small" style="width: 100%;" />
2025-10-16 11:20:50 +08:00
</el-form-item>
2025-09-26 17:26:06 +08:00
2025-10-16 11:20:50 +08:00
<el-form-item :label="v.zdts" v-if="v.kj == '1' && v.mrts == '年龄'">
<el-col :span="14" v-if="v.mrts == '年龄'">
<el-input v-model="labPat[v.zdmc]" @change="handleFieldChange" style="width:100%" size="small" />
</el-col>
<el-col :span="10">
<SelectTable v-model:data="labPat.nldw" :fields="ksdhFields" dictType="AU" label="label" value="value"
objKey="value" :border="true" size="small" @getDataValue="handleFieldChange" placeholder="" />
</el-col>
</el-form-item>
<el-form-item :label="v.zdts"
v-if="v.dict && v.kj == '1' && v.mrts != '病人来源' && v.mrts != '年龄单位' && v.mrts != '检验医师' && v.mrts != '核对医师'">
<SelectTable v-model:data="labPat[v.zdmc]" :fields="ksdhFields" :dictType="v.dict" label="label" value="value"
objKey="value" :border="true" size="small" @getDataValue="handleFieldChange" placeholder="" />
</el-form-item>
<el-form-item :label="v.zdts" v-if="v.mrts == '检验医师' && v.kj == '1'">
<SelectTable v-model:data="labPat[v.zdmc]" :fields="ysFields" :tableData="userList || []" label="nickName"
2025-10-28 17:22:53 +08:00
value="userName" objKey="userName" :border="true" size="small" @getDataValue="getJyysData" placeholder="" />
2025-10-16 11:20:50 +08:00
</el-form-item>
<el-form-item :label="v.zdts" v-if="v.mrts == '核对医师' && v.kj == '1'">
<SelectTable v-model:data="labPat[v.zdmc]" :fields="ysFields" :tableData="userList || []" label="nickName"
2025-10-28 17:22:53 +08:00
value="userName" objKey="userName" :border="true" size="small" @getDataValue="getHdysData" placeholder="" />
2025-10-16 11:20:50 +08:00
</el-form-item>
</template>
</el-form>
2025-10-21 09:55:56 +08:00
<!-- 医生校验 -->
<el-dialog v-model="visible" title="请输入审核人员密码..." :width="500" :close-on-click-modal="false" :draggable="true">
<el-form ref="formRef" :model="form" label-width="100px">
<!-- 用户代号 -->
<el-form-item label="用户代号:">
<el-input v-model="form.yhdh" disabled placeholder="用户代号" />
</el-form-item>
<!-- 用户姓名 -->
<el-form-item label="用户姓名:">
<el-input v-model="form.userName" disabled placeholder="用户姓名" />
</el-form-item>
<!-- 密码输入 -->
<el-form-item label="密码:" prop="mm" :rules="[{ required: true, message: '请输入密码', trigger: 'blur' }]">
<el-input v-model="form.mm" type="password" placeholder="请输入密码" />
</el-form-item>
<!-- 操作选项 -->
<el-form-item label="">
<el-radio-group v-model="form.type" @change="handleRadioChange">
<el-radio :label="1">仅修改当前标本</el-radio>
<el-radio :label="2">修改当天所有未审核并且无核对医生的标本</el-radio>
<el-radio :label="3"><span style="color: #f00;">修改当天所有未审核标本(将覆盖原有的核对医生)</span></el-radio>
<el-radio :label="4">
<el-row :gutter="5">
<el-col :span="8">指定样本号区间</el-col>
<template v-if="form.type == 4">
<el-col :span="8"> <el-input v-model="form.ybh1" size="small" /></el-col>
<el-col :span="8"><el-input v-model="form.ybh2" size="small" /></el-col>
</template>
</el-row>
</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer ">
<el-button type="primary" @click="handleConfirm"> 确定 </el-button>
<el-button @click="handleCancel"> 取消 </el-button>
</div>
</template>
</el-dialog>
2025-05-20 16:34:38 +08:00
</div>
</template>
2025-09-26 17:26:06 +08:00
<script setup lang="ts">
2025-10-21 09:55:56 +08:00
import { ref, reactive, watch, toRaw, computed, onMounted, nextTick } from 'vue';
import { changepatcolumn, updateLabPat, checkYsUser } from "@/api/liswork/work/LisWork";
2025-10-13 17:28:33 +08:00
import SelectTable from '@/components/SelectTable/index.vue';
2025-10-16 11:20:50 +08:00
// @ts-ignore
import { listUser } from '@/api/system/user.js'
import { PropType } from 'vue';
2025-10-28 17:22:53 +08:00
import emitter from '@/utils/mitt';
2025-10-29 18:02:33 +08:00
import { classCom } from '@/utils/classCom';
const aotuSize = classCom.useAutoSize();
2025-10-16 11:20:50 +08:00
interface LabSysItem {
kj: string;
dict: string;
kybj: string;
zdlb: string;
zdmc: string;
zdts: string;
xh: number;
mrts: string;
}
2025-05-20 16:34:38 +08:00
const props = defineProps({
2025-10-16 11:20:50 +08:00
labSysList: {
type: Array as PropType<LabSysItem[]>,
required: true
},
2025-05-20 16:34:38 +08:00
labPat: {
type: Object,
required: true
},
//结果主键
2025-09-26 17:26:06 +08:00
labPatKey: {
type: Object,
default: () => { }
2025-09-17 10:19:20 +08:00
},
2025-10-21 09:55:56 +08:00
2025-09-17 10:19:20 +08:00
});
2025-09-29 17:30:02 +08:00
const lastJgbz = ref();
2025-10-21 09:55:56 +08:00
const sqhValue = ref(''); // 条码号
const sqhRef = ref();
2025-09-26 17:26:06 +08:00
watch(() => props.labPat, (newVal) => {
lastValue.value = JSON.stringify(newVal);
2025-09-29 17:30:02 +08:00
lastJgbz.value = newVal.jgbz;
2025-10-28 17:22:53 +08:00
sqhValue.value = '';
2025-09-26 17:26:06 +08:00
})
2025-10-10 17:35:28 +08:00
2025-10-28 17:22:53 +08:00
const emit = defineEmits(['update:labPat', 'changeStatus']);
2025-09-26 17:26:06 +08:00
const lastValue = ref('');
2025-10-13 17:28:33 +08:00
const brlyFields = ref([
{ prop: 'value', label: '代号', width: 80, enablePinyinSearch: true },
{ prop: 'label', label: '名称', width: 120, enablePinyinSearch: true },
])
const ksdhFields = ref([
{ prop: 'value', label: '代号', width: 80, enablePinyinSearch: true },
{ prop: 'label', label: '名称', width: 150, enablePinyinSearch: true },
])
2025-10-16 11:20:50 +08:00
const ysFields = ref([
{ prop: 'userName', label: '用户代号', width: 80, enablePinyinSearch: true },
{ prop: 'nickName', label: '用户姓名', width: 150, enablePinyinSearch: true },
])
2025-10-21 09:55:56 +08:00
const visible = ref(false);
// 表单数据
const form = ref({
yhdh: '',
userName: '',
mm: '',
type: 1,
zdmc: '',
ybh1: '',
ybh2: '',
});
const sqhFlag = ref(false);
const handleInputFocus = () => {
sqhFlag.value = true;
props.labPat.sqh = sqhValue.value;
handleFieldChange();
};
// 表单引用
const formRef = ref();
// 处理确定按钮点击
const handleConfirm = async () => {
if (!formRef.value) return;
// 表单验证
const valid = await formRef.value.validate();
if (valid) {
checkYsUser({ ...form.value, ...props.labPatKey }).then((res: any) => {
if (res.code == 0) {
visible.value = false
form.value.mm = ''
handleFieldChange()
}
})
}
};
// 处理取消按钮点击
const handleCancel = () => {
formRef.value?.resetFields();
visible.value = false
if (form.value.zdmc = 'yhdh') {
props.labPat.yhdh = JSON.parse(lastValue.value).yhdh
}
if (form.value.zdmc = 'hdys') {
props.labPat.hdys = JSON.parse(lastValue.value).hdys
}
};
const handleRadioChange = () => {
if (form.value.type == 4) {
form.value.ybh1 = ''
form.value.ybh2 = ''
}
}
// 医生校验
const getJyysData = (data: any) => {
if (data.userName == JSON.parse(lastValue.value).yhdh) return
form.value.yhdh = data.userName;
form.value.userName = data.nickName;
form.value.zdmc = 'yhdh';
nextTick(() => {
visible.value = true
})
}
const getHdysData = (data: any) => {
if (data.userName == JSON.parse(lastValue.value).hdys) return
form.value.yhdh = data.userName;
form.value.userName = data.nickName;
form.value.zdmc = 'hdys';
nextTick(() => {
visible.value = true
})
}
2025-10-28 17:22:53 +08:00
2025-09-17 10:19:20 +08:00
/**
2025-09-26 17:26:06 +08:00
* 通用字段变化处理(失焦、回车触发)
*/
2025-09-17 10:19:20 +08:00
const handleFieldChange = async () => {
2025-09-26 17:26:06 +08:00
// 将当前labPat转为字符串用于比较
const currentValue = JSON.stringify(props.labPat);
// 对比与上一次保存的值是否有变化
if (currentValue !== lastValue.value) {
2025-10-28 17:22:53 +08:00
emitter.emit('saveLab');
2025-09-26 17:26:06 +08:00
// 找出变化的字段
const oldObj = JSON.parse(lastValue.value);
const newObj = props.labPat;
const changedField = getChangedField(oldObj, newObj);
if (changedField) {
// 这里可以添加实际的更新逻辑,比如调用接口
try {
2025-10-28 17:22:53 +08:00
saveLabPat(changedField)
2025-09-26 17:26:06 +08:00
} catch (error) {
console.error('更新失败:', error);
// 失败时可以恢复旧值
emit('update:labPat', oldObj);
lastValue.value = JSON.stringify(oldObj);
}
}
}
2025-09-17 10:19:20 +08:00
};
2025-10-28 17:22:53 +08:00
// 保存病人信息
const saveLabPat = async (changedField: any) => {
if (props.labPat.id) {
updateLabPat({ ...props.labPatKey, ...props.labPat }).then((res: any) => {
if (res.code == 0) {
if (sqhFlag.value) {
sqhValue.value = ''
sqhRef.value.focus()
}
if (res.data) {
emit('update:labPat', res.data)
emit("changeStatus", res.data, sqhFlag.value);
} else {
emit("changeStatus", props.labPat, sqhFlag.value);
}
sqhFlag.value = false
}
})
} else {
if (!changedField) return
changepatcolumn({ ...props.labPatKey, column: changedField?.field, value: changedField?.newValue }).then((res: any) => {
if (res.code == 0) {
if (sqhFlag.value) {
sqhValue.value = ''
sqhRef.value.focus()
}
if (res.data) {
emit('update:labPat', res.data)
emit("changeStatus", props.labPat, sqhFlag.value);
} else {
emit("changeStatus", props.labPat, sqhFlag.value);
}
sqhFlag.value = false
}
})
}
};
2025-09-17 10:19:20 +08:00
2025-09-26 17:26:06 +08:00
// 完善字段变化检测方法
const getChangedField = (oldObj: { [key: string]: any }, newObj: { [key: string]: any }) => {
2025-09-17 10:19:20 +08:00
const oldKeys = Object.keys(oldObj);
for (const key of oldKeys) {
2025-09-26 17:26:06 +08:00
const oldVal = oldObj[key];
const newVal = newObj[key];
if (oldVal instanceof Date && newVal instanceof Date) {
if (oldVal.getTime() !== newVal.getTime()) {
return { field: key, oldValue: oldVal, newValue: newVal };
}
} else if (oldVal !== newVal) {
return { field: key, oldValue: oldVal, newValue: newVal };
}
}
const newKeys = Object.keys(newObj);
for (const key of newKeys) {
if (!(key in oldObj)) {
return { field: key, oldValue: undefined, newValue: newObj[key] };
2025-09-17 10:19:20 +08:00
}
}
2025-09-26 17:26:06 +08:00
2025-09-17 10:19:20 +08:00
return null;
};
2025-09-26 17:26:06 +08:00
const getLableType = (type: string) => {
switch (type) {
case '1':
return '初审';
case '2':
return '已审核';
case '3':
return '初报';
case '4':
return '二报';
case '5':
return '锁定';
default:
return '';
}
}
const getColor = (type: string) => {
switch (type) {
case '1':
return 'cs_color';
case '2':
return 'sh_color';
case '3':
return 'cb_color';
case '4':
return 'eb_color';
case '5':
return 'sd_color';
default:
return 'default';
}
}
2025-10-16 11:20:50 +08:00
const userList = ref([]);
onMounted(() => {
const data = { status: 0, del_flag: 0, pageSize: 1000, pageNum: 1 }
listUser(data).then((res: any) => {
userList.value = res.rows;
});
2025-10-28 17:22:53 +08:00
// 监听保存病人结果
emitter.on('saveResult', () => {
saveLabPat(null)
})
2025-10-16 11:20:50 +08:00
})
2025-09-26 17:26:06 +08:00
2025-09-17 10:19:20 +08:00
2025-05-20 16:34:38 +08:00
</script>
<style scoped lang="scss">
2025-09-26 17:26:06 +08:00
.labpat_box {
2025-10-21 09:55:56 +08:00
height: calc(90vh - 73px);
2025-09-26 17:26:06 +08:00
display: flex;
flex-direction: column;
overflow: hidden;
2025-10-16 11:20:50 +08:00
.check_box {
:deep(.el-checkbox__input.is-checked+.el-checkbox__label) {
color: #f00 !important;
}
}
2025-09-26 17:26:06 +08:00
2025-09-29 17:30:02 +08:00
:deep(.el-input__wrapper) {
box-shadow: 0 0 0 1px #96B8D9 inset;
background-color: rgba(236, 244, 251, 0.5);
color: #08355E;
2025-09-26 17:26:06 +08:00
2025-09-29 17:30:02 +08:00
.is-focus {
box-shadow: 0 0 0 1px #1f6dd3 inset !important;
}
&:hover {
box-shadow: 0 0 0 1px #1f6dd3 inset !important;
}
// .el-input__placeholder {
// color: none !important;
// }
2025-09-26 17:26:06 +08:00
}
2025-09-29 17:30:02 +08:00
:deep(.el-select__wrapper) {
box-shadow: 0 0 0 1px #96B8D9 inset;
background-color: rgba(236, 244, 251, 0.5);
color: #08355E;
.is-focus {
box-shadow: 0 0 0 1px #1f6dd3 inset !important;
}
&:hover {
box-shadow: 0 0 0 1px #1f6dd3 inset !important;
}
.el-select__placeholder {
color: #08355E !important;
}
2025-09-26 17:26:06 +08:00
}
2025-09-29 17:30:02 +08:00
:deep(.el-input__inner) {
color: #08355E !important;
-webkit-text-fill-color: #08355E;
}
:deep(.el-select__input) {
color: #08355E !important;
}
.compact-form {
flex: 1;
position: relative;
height: 100%;
overflow-y: auto;
overflow-x: hidden;
.el-form-item {
margin-bottom: 0px;
}
.el-form-item__label {
padding-bottom: 0px;
color: #08355E;
font-size: 12px;
2025-10-21 09:55:56 +08:00
}
:deep(.el-form-item--default .el-form-item__label) {
height: 27px !important;
line-height: 27px !important;
}
:deep(.el-form-item--default .el-form-item__content) {
line-height: 27px !important;
2025-09-29 17:30:02 +08:00
}
// pointer-events: none;
:deep(.el-radio__label) {
color: #08355E;
}
}
:deep(.el-switch__label) {
color: #08355E;
}
2025-09-26 17:26:06 +08:00
}
2025-09-29 17:30:02 +08:00
2025-09-26 17:26:06 +08:00
.sh_box {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0);
z-index: 9;
display: flex;
justify-content: center;
align-items: center;
writing-mode: vertical-rl;
font-weight: 500;
2025-10-21 09:55:56 +08:00
font-size: 100px;
.text {
font-style: italic;
}
2025-09-26 17:26:06 +08:00
// pointer-events: none;
}
.cs_color {
2025-10-21 09:55:56 +08:00
color: rgba(40, 189, 187, 0.25);
2025-09-26 17:26:06 +08:00
}
.sh_color {
2025-10-21 09:55:56 +08:00
color: rgba(238, 8, 8, 0.25);
2025-09-26 17:26:06 +08:00
}
.cb_color {
2025-10-21 09:55:56 +08:00
color: rgba(255, 165, 0, 0.25);
2025-09-26 17:26:06 +08:00
}
.eb_color {
2025-10-21 09:55:56 +08:00
color: rgba(0, 128, 0, 0.25);
2025-09-26 17:26:06 +08:00
}
.sd_color {
2025-10-21 09:55:56 +08:00
color: rgba(128, 128, 128, 0.25);
2025-05-20 16:34:38 +08:00
}
2025-09-26 17:26:06 +08:00
.default {
2025-10-21 09:55:56 +08:00
color: rgba(40, 189, 187, 0.25);
2025-05-20 16:34:38 +08:00
}
</style>