默认医生
This commit is contained in:
parent
4a56c696b1
commit
2d9f0972ff
@ -421,7 +421,7 @@
|
|||||||
v-for="item in doctorList"
|
v-for="item in doctorList"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="`${item.label}|${item.value}`"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
@ -767,8 +767,10 @@ const loadPatientData = async (patient) => {
|
|||||||
const patientData = await PatientApi.getPatient(patient.id)
|
const patientData = await PatientApi.getPatient(patient.id)
|
||||||
reportData.value = patientData
|
reportData.value = patientData
|
||||||
|
|
||||||
// 重置检查医生和日期
|
// 保存当前选择的医生,只在需要时重置
|
||||||
inspectDoctor.value = ''
|
const currentDoctor = inspectDoctor.value
|
||||||
|
|
||||||
|
// 重置检查日期
|
||||||
inspectTime.value = ''
|
inspectTime.value = ''
|
||||||
|
|
||||||
// 检查患者状态,如果已检查则设置检查完成状态为true
|
// 检查患者状态,如果已检查则设置检查完成状态为true
|
||||||
@ -799,6 +801,7 @@ const loadPatientData = async (patient) => {
|
|||||||
// 查找已检查的项目,获取检查医生和日期
|
// 查找已检查的项目,获取检查医生和日期
|
||||||
const checkedItems = itemsRes.list.filter((item) => item.itemStatus === '1')
|
const checkedItems = itemsRes.list.filter((item) => item.itemStatus === '1')
|
||||||
|
|
||||||
|
let foundDoctorInfo = false
|
||||||
if (checkedItems.length > 0) {
|
if (checkedItems.length > 0) {
|
||||||
// 使用第一个已检查项目的检查医生和日期
|
// 使用第一个已检查项目的检查医生和日期
|
||||||
const firstCheckedItem = checkedItems[0]
|
const firstCheckedItem = checkedItems[0]
|
||||||
@ -806,6 +809,7 @@ const loadPatientData = async (patient) => {
|
|||||||
// 设置检查医生
|
// 设置检查医生
|
||||||
if (firstCheckedItem.inspectdoctor) {
|
if (firstCheckedItem.inspectdoctor) {
|
||||||
inspectDoctor.value = firstCheckedItem.inspectdoctor
|
inspectDoctor.value = firstCheckedItem.inspectdoctor
|
||||||
|
foundDoctorInfo = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化检查时间
|
// 格式化检查时间
|
||||||
@ -815,6 +819,11 @@ const loadPatientData = async (patient) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果未找到已检查项目的医生信息且不是已检查状态,则保留当前选择的医生
|
||||||
|
if (!foundDoctorInfo && !isExamCompleted.value && currentDoctor) {
|
||||||
|
inspectDoctor.value = currentDoctor
|
||||||
|
}
|
||||||
|
|
||||||
// 用于存储异常信息
|
// 用于存储异常信息
|
||||||
let abnormalSummary = []
|
let abnormalSummary = []
|
||||||
|
|
||||||
@ -957,14 +966,12 @@ const handlePatientSelect = async (patient) => {
|
|||||||
// 设置选中患者
|
// 设置选中患者
|
||||||
selectedPatient.value = patient
|
selectedPatient.value = patient
|
||||||
|
|
||||||
// 重置检查医生和日期
|
|
||||||
inspectDoctor.value = ''
|
|
||||||
inspectTime.value = ''
|
|
||||||
|
|
||||||
// 根据患者状态设置检查完成状态
|
// 根据患者状态设置检查完成状态
|
||||||
isExamCompleted.value = patient.status === '1' || patient.status === 1
|
isExamCompleted.value = patient.status === '1' || patient.status === 1
|
||||||
|
|
||||||
|
// 加载患者数据,包括设置检查医生等
|
||||||
await loadPatientData(patient)
|
await loadPatientData(patient)
|
||||||
|
|
||||||
currentTab.value = 'general'
|
currentTab.value = 'general'
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[handlePatientSelect] 切换患者失败:', error)
|
console.error('[handlePatientSelect] 切换患者失败:', error)
|
||||||
@ -1250,19 +1257,34 @@ const getTabColor = (index) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
// 清理页面状态
|
try {
|
||||||
patients.value = []
|
loading.value = true
|
||||||
selectedPatient.value = null
|
// 首先获取用户信息
|
||||||
|
const userProfile = await getUserProfile()
|
||||||
|
user.value = userProfile
|
||||||
|
|
||||||
// 已经在定义时设置为20,这里不需要再设置
|
// 然后获取医生列表(会自动匹配当前用户)
|
||||||
// pageSize.value = 20
|
await getDoctorList()
|
||||||
pageNo.value = 1
|
|
||||||
|
|
||||||
// 获取医生列表
|
// 初始化患者列表
|
||||||
await getDoctorList()
|
await getPatientList()
|
||||||
|
|
||||||
// 直接调用获取列表方法,不附加任何过滤条件
|
// 如果检查医生没有设置,但用户有昵称,再次尝试匹配医生
|
||||||
await getPatientList()
|
if (!inspectDoctor.value && user.value?.nickname && doctorList.value.length > 0) {
|
||||||
|
const matchedOption = doctorList.value.find(item =>
|
||||||
|
item.label === user.value.nickname
|
||||||
|
)
|
||||||
|
if (matchedOption) {
|
||||||
|
inspectDoctor.value = matchedOption.value
|
||||||
|
console.log('在onMounted中设置默认检查医生:', inspectDoctor.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('初始化组件失败:', error)
|
||||||
|
ElMessage.error('初始化组件失败,请刷新页面重试')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 修改处理时间周期切换的函数
|
// 修改处理时间周期切换的函数
|
||||||
@ -1539,15 +1561,14 @@ const handleSync = async () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 如果需要,添加超声报告请求
|
// 直接添加超声报告请求,无需检查是否存在数据
|
||||||
if (needsSyncUS) {
|
syncPromises.push(
|
||||||
syncPromises.push(
|
PatientApi.getUSTj(medicalSn).catch((error) => {
|
||||||
PatientApi.getUSTj(medicalSn).catch((error) => {
|
console.warn('获取超声报告失败:', error)
|
||||||
console.warn('获取超声报告失败:', error)
|
return null
|
||||||
return null
|
})
|
||||||
})
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
// 如果需要,添加心电图报告请求
|
// 如果需要,添加心电图报告请求
|
||||||
if (needsSyncECG) {
|
if (needsSyncECG) {
|
||||||
syncPromises.push(
|
syncPromises.push(
|
||||||
@ -2051,7 +2072,7 @@ const handleSaveAllResults = async () => {
|
|||||||
// 获取选择的医生信息
|
// 获取选择的医生信息
|
||||||
let doctorName = inspectDoctor.value
|
let doctorName = inspectDoctor.value
|
||||||
if (doctorName && doctorName.includes('|')) {
|
if (doctorName && doctorName.includes('|')) {
|
||||||
doctorName = doctorName.split('|')[0] // 只取医生姓名部分
|
doctorName = doctorName.split('|')[1] // 修改为取医生姓名部分,而不是ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收集所有标签页的所有检查项目
|
// 收集所有标签页的所有检查项目
|
||||||
@ -2717,10 +2738,29 @@ const getDoctorList = async () => {
|
|||||||
pageSize: 100 // 设置较大的数值以获取所有医生
|
pageSize: 100 // 设置较大的数值以获取所有医生
|
||||||
})
|
})
|
||||||
if (res && res.list && res.list.length > 0) {
|
if (res && res.list && res.list.length > 0) {
|
||||||
|
// 保存原始医生列表数据
|
||||||
doctorList.value = res.list.map(doctor => ({
|
doctorList.value = res.list.map(doctor => ({
|
||||||
label: doctor.doctorname,
|
label: doctor.doctorname,
|
||||||
value: doctor.doctorid
|
value: `${doctor.doctorid}|${doctor.doctorname}`
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// 如果已经获取到了用户信息,尝试匹配医生
|
||||||
|
if (user.value?.nickname) {
|
||||||
|
// 使用精确匹配
|
||||||
|
const matchedDoctor = res.list.find(doctor =>
|
||||||
|
doctor.doctorname === user.value.nickname
|
||||||
|
)
|
||||||
|
|
||||||
|
if (matchedDoctor) {
|
||||||
|
// 设置检查医生
|
||||||
|
inspectDoctor.value = `${matchedDoctor.doctorid}|${matchedDoctor.doctorname}`
|
||||||
|
console.log('已为检查医生设置默认值:', inspectDoctor.value)
|
||||||
|
} else {
|
||||||
|
console.log('未找到与用户昵称匹配的医生:', user.value.nickname)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('未获取到用户昵称')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取医生列表失败:', error)
|
console.error('获取医生列表失败:', error)
|
||||||
|
@ -51,6 +51,7 @@ import { ElLoading, ElMessage } from 'element-plus'
|
|||||||
import { Refresh } from '@element-plus/icons-vue'
|
import { Refresh } from '@element-plus/icons-vue'
|
||||||
import TemplateDrawer from '@/views/Department-entry/Drawer-Template.vue'
|
import TemplateDrawer from '@/views/Department-entry/Drawer-Template.vue'
|
||||||
import { DoctorApi } from '@/api/inspect/inspectdoctor'
|
import { DoctorApi } from '@/api/inspect/inspectdoctor'
|
||||||
|
import { getUserProfile } from '@/api/system/user/profile'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
patient: {
|
patient: {
|
||||||
@ -86,6 +87,9 @@ const editableSummary = ref('')
|
|||||||
// 添加患者状态检查
|
// 添加患者状态检查
|
||||||
const isReadOnly = ref(false)
|
const isReadOnly = ref(false)
|
||||||
|
|
||||||
|
// 添加用户信息响应式引用
|
||||||
|
const user = ref(null)
|
||||||
|
|
||||||
// 检查患者状态
|
// 检查患者状态
|
||||||
const checkPatientStatus = () => {
|
const checkPatientStatus = () => {
|
||||||
if (props.patient?.status) {
|
if (props.patient?.status) {
|
||||||
@ -420,6 +424,14 @@ const loadDoctorList = async () => {
|
|||||||
const response = await DoctorApi.getDoctorPage(queryParams)
|
const response = await DoctorApi.getDoctorPage(queryParams)
|
||||||
if (response && response.list && response.list.length > 0) {
|
if (response && response.list && response.list.length > 0) {
|
||||||
doctorList.value = response.list
|
doctorList.value = response.list
|
||||||
|
|
||||||
|
// 如果已经获取到了用户信息,尝试匹配医生
|
||||||
|
if (user.value?.nickname) {
|
||||||
|
const matchedDoctor = response.list.find(doctor => doctor.doctorname === user.value.nickname)
|
||||||
|
if (matchedDoctor) {
|
||||||
|
selectedDoctor.value = `${matchedDoctor.doctorid}|${matchedDoctor.doctorname}`
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载医生列表失败:', error)
|
console.error('加载医生列表失败:', error)
|
||||||
@ -428,11 +440,18 @@ const loadDoctorList = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
const initData = () => {
|
const initData = async () => {
|
||||||
|
// 获取当前登录用户信息
|
||||||
|
try {
|
||||||
|
const userProfile = await getUserProfile()
|
||||||
|
user.value = userProfile
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取用户信息失败:', error)
|
||||||
|
}
|
||||||
|
|
||||||
loadPatientItems()
|
loadPatientItems()
|
||||||
checkPatientStatus()
|
checkPatientStatus()
|
||||||
loadDoctorList()
|
await loadDoctorList()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组件挂载时加载数据
|
// 组件挂载时加载数据
|
||||||
|
Loading…
Reference in New Issue
Block a user