304 lines
9.4 KiB
Vue
304 lines
9.4 KiB
Vue
|
|
<template>
|
|||
|
|
<div class="labpat_box">
|
|||
|
|
<el-form :model="labPat" label-width="70px" class="compact-form" label-position="right">
|
|||
|
|
<el-form-item label="病人来源">
|
|||
|
|
<el-col :span="14">
|
|||
|
|
<SelectTable v-model:data="labPat.brly" :fields="brlyFields" dict-type="PT" placeholder="请选择" size="small"
|
|||
|
|
@getDataValue="handleFieldChange" />
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="10">
|
|||
|
|
<el-switch v-model="labPat.jzbz" active-text="急诊" active-color="#FD0101" active-value="1" inactive-value="0"
|
|||
|
|
@change="handleFieldChange"></el-switch>
|
|||
|
|
</el-col>
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="病 历 号">
|
|||
|
|
<el-input v-model="labPat.brdh" placeholder="请输入病历号" @change="handleFieldChange" size="small" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="姓 名">
|
|||
|
|
<el-input v-model="labPat.brxm" placeholder="请输入姓名" @change="handleFieldChange" size="small" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="性 别">
|
|||
|
|
<SelectTable v-model:data="labPat.brxb" dict-type="SX" placeholder="请选择" size="small"
|
|||
|
|
@getDataValue="handleFieldChange" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="年龄">
|
|||
|
|
<el-row :gutter="5">
|
|||
|
|
<el-col :span="14">
|
|||
|
|
<el-input v-model="labPat.nl" placeholder="年龄" @change="handleFieldChange" style="width:100%"
|
|||
|
|
size="small" />
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="10">
|
|||
|
|
<SelectTable v-model:data="labPat.nldw" dict-type="AU" placeholder="请选择" size="small"
|
|||
|
|
@getDataValue="handleFieldChange" />
|
|||
|
|
</el-col>
|
|||
|
|
</el-row>
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="送检科室">
|
|||
|
|
<SelectTable v-model:data="labPat.ksdh" dict-type="DP" placeholder="请选择" size="small"
|
|||
|
|
@getDataValue="handleFieldChange" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="床 号">
|
|||
|
|
<el-input v-model="labPat.ch" placeholder="请输入床号" @change="handleFieldChange" size="small" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="样本类型">
|
|||
|
|
<SelectTable v-model:data="labPat.yblx" dict-type="BT" placeholder="请选择" size="small"
|
|||
|
|
@getDataValue="handleFieldChange" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="申请医生">
|
|||
|
|
<SelectTable v-model:data="labPat.sjys" dict-type="SRD" placeholder="请选择" size="small"
|
|||
|
|
@getDataValue="handleFieldChange" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="上机时间">
|
|||
|
|
<el-date-picker v-model="labPat.sqsj" type="datetime" placeholder="上机时间" format="YYYY-MM-DD HH:mm:ss"
|
|||
|
|
value-format="YYYY-MM-DD HH:mm:ss" @change="handleFieldChange" size="small" style="width: 100%;" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="采样时间">
|
|||
|
|
<el-date-picker v-model="labPat.cyrq" type="datetime" placeholder="采样时间" format="YYYY-MM-DD HH:mm:ss"
|
|||
|
|
value-format="YYYY-MM-DD HH:mm:ss" @change="handleFieldChange" size="small" style="width: 100%;" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="报告时间">
|
|||
|
|
<el-date-picker v-model="labPat.dysj" type="datetime" placeholder="报告时间" format="YYYY-MM-DD HH:mm:ss"
|
|||
|
|
value-format="YYYY-MM-DD HH:mm:ss" @change="handleFieldChange" size="small" style="width: 100%;" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="临床诊断">
|
|||
|
|
<el-input v-model="labPat.zd" placeholder="请输入临床诊断" @change="handleFieldChange" size="small" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="备 注">
|
|||
|
|
<el-input v-model="labPat.bz" placeholder="请输入备注" @change="handleFieldChange" size="small" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="检验医生">
|
|||
|
|
<SelectTable v-model:data="labPat.yhdh" :fields="ysFields" :tableData="userList || []" label="nickName"
|
|||
|
|
value="userName" objKey="userName" :border="true" placeholder="请选择" size="small"
|
|||
|
|
@getDataValue="handleFieldChange" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="审核医生">
|
|||
|
|
<SelectTable v-model:data="labPat.hdys" :fields="ysFields" :tableData="userList || []" label="nickName"
|
|||
|
|
value="userName" objKey="userName" :border="true" placeholder="请选择" size="small"
|
|||
|
|
@getDataValue="handleFieldChange" />
|
|||
|
|
</el-form-item>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</el-form>
|
|||
|
|
</div>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script setup lang="ts">
|
|||
|
|
import { ref, reactive, watch, toRaw, computed, onMounted } from 'vue';
|
|||
|
|
import { changepatcolumn, updateLabPat } from "@/api/liswork/work/LisWork";
|
|||
|
|
import SelectTable from '@/components/SelectTable/index.vue';
|
|||
|
|
// @ts-ignore
|
|||
|
|
import { listUser } from '@/api/system/user.js'
|
|||
|
|
const props = defineProps({
|
|||
|
|
labPat: {
|
|||
|
|
type: Object,
|
|||
|
|
required: true
|
|||
|
|
},
|
|||
|
|
//结果主键
|
|||
|
|
labPatKey: {
|
|||
|
|
type: Object,
|
|||
|
|
default: () => { }
|
|||
|
|
},
|
|||
|
|
dictData: {
|
|||
|
|
type: Object,
|
|||
|
|
default: () => { }
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
const lastJgbz = ref();
|
|||
|
|
watch(() => props.labPat, (newVal) => {
|
|||
|
|
lastValue.value = JSON.stringify(newVal);
|
|||
|
|
lastJgbz.value = newVal.jgbz;
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
const emit = defineEmits(['update:labPat']);
|
|||
|
|
const lastValue = ref('');
|
|||
|
|
|
|||
|
|
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 },
|
|||
|
|
])
|
|||
|
|
const ysFields = ref([
|
|||
|
|
{ prop: 'userName', label: '用户代号', width: 80, enablePinyinSearch: true },
|
|||
|
|
{ prop: 'nickName', label: '用户姓名', width: 150, enablePinyinSearch: true },
|
|||
|
|
])
|
|||
|
|
/**
|
|||
|
|
* 通用字段变化处理(失焦、回车触发)
|
|||
|
|
*/
|
|||
|
|
const handleFieldChange = async () => {
|
|||
|
|
// 将当前labPat转为字符串用于比较
|
|||
|
|
const currentValue = JSON.stringify(props.labPat);
|
|||
|
|
// 对比与上一次保存的值是否有变化
|
|||
|
|
if (currentValue !== lastValue.value) {
|
|||
|
|
// 找出变化的字段
|
|||
|
|
const oldObj = JSON.parse(lastValue.value);
|
|||
|
|
const newObj = props.labPat;
|
|||
|
|
const changedField = getChangedField(oldObj, newObj);
|
|||
|
|
if (changedField) {
|
|||
|
|
// 这里可以添加实际的更新逻辑,比如调用接口
|
|||
|
|
try {
|
|||
|
|
// if (props.labPat.id) {
|
|||
|
|
// updateLabPat({ ...props.labPatKey, column: changedField?.field, value: changedField?.newValue }).then((res: any) => {
|
|||
|
|
// if (res.code == 0) {
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// })
|
|||
|
|
// } else {
|
|||
|
|
// changepatcolumn({ ...props.labPatKey, column: changedField?.field, value: changedField?.newValue })
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
} catch (error) {
|
|||
|
|
console.error('更新失败:', error);
|
|||
|
|
// 失败时可以恢复旧值
|
|||
|
|
emit('update:labPat', oldObj);
|
|||
|
|
lastValue.value = JSON.stringify(oldObj);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 完善字段变化检测方法
|
|||
|
|
const getChangedField = (oldObj: { [key: string]: any }, newObj: { [key: string]: any }) => {
|
|||
|
|
const oldKeys = Object.keys(oldObj);
|
|||
|
|
for (const key of oldKeys) {
|
|||
|
|
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] };
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return null;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
const userList = ref([]);
|
|||
|
|
onMounted(() => {
|
|||
|
|
const data = { status: 0, del_flag: 0, pageSize: 1000, pageNum: 1 }
|
|||
|
|
listUser(data).then((res: any) => {
|
|||
|
|
userList.value = res.rows;
|
|||
|
|
});
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
<style scoped lang="scss">
|
|||
|
|
.labpat_box {
|
|||
|
|
height: calc(90vh - 20px);
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: column;
|
|||
|
|
overflow: hidden;
|
|||
|
|
|
|||
|
|
.check_box {
|
|||
|
|
:deep(.el-checkbox__input.is-checked+.el-checkbox__label) {
|
|||
|
|
color: #f00 !important;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
:deep(.el-input__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-input__placeholder {
|
|||
|
|
// color: none !important;
|
|||
|
|
// }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
: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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
: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;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
: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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// pointer-events: none;
|
|||
|
|
|
|||
|
|
:deep(.el-radio__label) {
|
|||
|
|
color: #08355E;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
:deep(.el-switch__label) {
|
|||
|
|
color: #08355E;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</style>
|