获取公卫患者信息

This commit is contained in:
Euni4U 2025-03-26 13:00:35 +08:00
parent 68e72a07a8
commit c83d9b4976
2 changed files with 36 additions and 1 deletions

View File

@ -119,5 +119,9 @@ export const PatientApi = {
//根据体检编号&姓名&身份证号获取患者信息
getPatientInfoByMedicalSn: async (searchKey: string) => {
return await request.get({ url: `/inspect/patient/PatientBySearchKey?searchKey=` + searchKey })
},
//获取公卫患者信息
getGwPatientInfo: async (idCard: string) => {
return await request.get({ url: `/inspect/patient/GetApiPatientInfo?idCard=` + idCard })
}
}

View File

@ -120,7 +120,10 @@ v-loading.fullscreen.lock="fullscreenLoading"
<el-input v-model="addForm.name" placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="身份证号" prop="cardId">
<el-input v-model="addForm.cardId" placeholder="请输入身份证号" @blur="handleCardIdBlur" />
<div style="display: flex; align-items: center;">
<el-input v-model="addForm.cardId" placeholder="请输入身份证号" @blur="handleCardIdBlur" style="width: 75%;" />
<el-button type="primary" @click="handleGwPatientInfo" style="margin-left: 10px;">获取公卫患者信息</el-button>
</div>
</el-form-item>
<el-form-item label="出生日期" prop="birthDate">
<el-date-picker
@ -472,4 +475,32 @@ const formatDate = (date: Date): string => {
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
//
const handleGwPatientInfo = async () => {
if (!addForm.cardId) {
message.warning('请先输入身份证号')
return
}
try {
loading.value = true
// API
const result = await PatientApi.getGwPatientInfo(addForm.cardId)
console.log('获取到的公卫患者信息:', result);
if (result) {
//
addForm.name = result.name || ''
addForm.phone = result.telephone || ''
addForm.address = result.addree || ''
message.success('成功获取公卫患者信息')
} else {
message.warning('未找到该患者的公卫信息')
}
} catch (error) {
message.error('获取公卫患者信息失败: ' + (error.message || '未知错误'))
} finally {
loading.value = false
}
}
</script>