106 入科选床界面的住院医生、主治医生、主任医生字段需按照医生维护的职称进行过滤

This commit is contained in:
Ranyunqiao
2026-04-01 16:47:27 +08:00
parent 882d63249c
commit 8a863b4ecb

View File

@@ -220,7 +220,7 @@
"
>
<el-option
v-for="item in doctorInfoOptions"
v-for="item in residentDoctorOptions"
:key="item.id"
:label="item.name"
:value="item.id"
@@ -239,7 +239,7 @@
"
>
<el-option
v-for="item in doctorInfoOptions"
v-for="item in attendingDoctorOptions"
:key="item.id"
:label="item.name"
:value="item.id"
@@ -258,7 +258,7 @@
"
>
<el-option
v-for="item in doctorInfoOptions"
v-for="item in chiefDoctorOptions"
:key="item.id"
:label="item.name"
:value="item.id"
@@ -332,7 +332,7 @@
</el-dialog>
</template>
<script lang="ts" setup>
import {nextTick, onMounted, reactive, ref, watch} from 'vue';
import {computed, nextTick, onMounted, reactive, ref, watch} from 'vue';
import type {FormInstance, FormRules} from 'element-plus';
import {dayjs, ElMessage} from 'element-plus';
// import type { IInPatient } from '@/model/IInPatient'
@@ -353,8 +353,23 @@ const props = defineProps({
const currentInPatient = ref<Partial<IInPatient>>({});
const bedInfoOptions = ref<{ label: string; value: string }[]>([]);
const doctorInfoOptions = ref<{ name: string; id: string }[]>([]);
const doctorInfoOptions = ref<{ name: string; id: string; drProfttlCode?: string }[]>([]);
const nurseInfoOptions = ref<{ name: string; practitionerId: string }[]>([]);
// 住院医生只显示医师职称编码234
const residentDoctorOptions = computed(() => {
return doctorInfoOptions.value.filter(item => item.drProfttlCode === '234');
});
// 主治医生只显示主治医师职称编码233
const attendingDoctorOptions = computed(() => {
return doctorInfoOptions.value.filter(item => item.drProfttlCode === '233');
});
// 主任医生显示副主任医师232和主任医师231
const chiefDoctorOptions = computed(() => {
return doctorInfoOptions.value.filter(item => item.drProfttlCode === '231' || item.drProfttlCode === '232');
});
const InitInfoOptions = ref<any>({});
const priorityListOptions = ref<{ info: string; value: string }[]>([]);
const pendingInfo = ref<any>({});
@@ -407,13 +422,28 @@ const loadPatientInfo = () => {
console.log('chiefDoctorId:', res.data.chiefDoctorId);
console.log('primaryNurseId:', res.data.primaryNurseId);
if (res.data.admittingDoctorId) {
interventionForm.value.admittingDoctorId = String(res.data.admittingDoctorId);
const doctorId = String(res.data.admittingDoctorId);
// 检查该医生是否在住院医生列表中
const existsInResident = residentDoctorOptions.value.some(item => item.id === doctorId);
if (existsInResident) {
interventionForm.value.admittingDoctorId = doctorId;
}
}
if (res.data.attendingDoctorId) {
interventionForm.value.attendingDoctorId = String(res.data.attendingDoctorId);
const doctorId = String(res.data.attendingDoctorId);
// 检查该医生是否在主治医生列表中
const existsInAttending = attendingDoctorOptions.value.some(item => item.id === doctorId);
if (existsInAttending) {
interventionForm.value.attendingDoctorId = doctorId;
}
}
if (res.data.chiefDoctorId) {
interventionForm.value.chiefDoctorId = String(res.data.chiefDoctorId);
const doctorId = String(res.data.chiefDoctorId);
// 检查该医生是否在主任医生列表中
const existsInChief = chiefDoctorOptions.value.some(item => item.id === doctorId);
if (existsInChief) {
interventionForm.value.chiefDoctorId = doctorId;
}
}
if (res.data.primaryNurseId) {
// 护士ID也转换为字符串以匹配护士选项
@@ -489,18 +519,8 @@ const init = () => {
// 并且只在当前没有选择主任医生时才设置默认值(避免覆盖已从后端获取的数据)
if (props.pendingInfo.entranceType != 1) {
nextTick(() => {
if (doctorInfoOptions.value.length > 0 && !interventionForm.value.chiefDoctorId) {
let selectId = '';
doctorInfoOptions.value.forEach((item: any) => {
if (item.drProfttlCode == '231') {
selectId = item.id;
}
});
if (selectId.length > 0) {
interventionForm.value.chiefDoctorId = selectId;
} else {
interventionForm.value.chiefDoctorId = doctorInfoOptions.value[0].id;
}
if (chiefDoctorOptions.value.length > 0 && !interventionForm.value.chiefDoctorId) {
interventionForm.value.chiefDoctorId = chiefDoctorOptions.value[0].id;
}
});
}