From 8f1eb56a472b3f7621944cdab679c092a4484698 Mon Sep 17 00:00:00 2001 From: limengnan <420004014@qq.com> Date: Fri, 28 Nov 2025 14:51:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/renderer/src/views/Dashboard.vue | 4 ++ frontend/src/renderer/src/views/Detection.vue | 2 +- .../src/renderer/src/views/PatientCreate.vue | 49 ++++++++++++++++--- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/frontend/src/renderer/src/views/Dashboard.vue b/frontend/src/renderer/src/views/Dashboard.vue index 69d389c0..17cbb317 100644 --- a/frontend/src/renderer/src/views/Dashboard.vue +++ b/frontend/src/renderer/src/views/Dashboard.vue @@ -606,6 +606,10 @@ const isCloseCreat = ref(false) function closecreatbox(e){ if(e == true){ loadPatients() + }else if(e != null && e.id != null) { + selectedPatient.value = e + loadPatients() + isDetection.value = true } isCloseCreat.value = false } diff --git a/frontend/src/renderer/src/views/Detection.vue b/frontend/src/renderer/src/views/Detection.vue index 50067d47..cd380d0c 100644 --- a/frontend/src/renderer/src/views/Detection.vue +++ b/frontend/src/renderer/src/views/Detection.vue @@ -2125,7 +2125,7 @@ function closeDiagnosticMessage(e){ function closecreatbox(e){ - if(e == true){ + if(e === true){ loadPatientInfo() } isCloseCreat.value = false diff --git a/frontend/src/renderer/src/views/PatientCreate.vue b/frontend/src/renderer/src/views/PatientCreate.vue index 74d118ef..697ec8a9 100644 --- a/frontend/src/renderer/src/views/PatientCreate.vue +++ b/frontend/src/renderer/src/views/PatientCreate.vue @@ -102,12 +102,16 @@ class="formsaveCancel"> 保存 + + 保存并开始检测 + @@ -242,7 +246,6 @@ const savePatient = async () => { const genderValue = genderMap[patientForm.gender] || patientForm.gender const patientData = { - id: patientForm.id, name: patientForm.name, gender: genderValue, birth_date: patientForm.birth_date, @@ -273,15 +276,46 @@ const savePatient = async () => { throw error } } - +const updatePatient = async () => { + const patientData = { + id: patientForm.value.id, + name: patientForm.value.name, + gender: patientForm.value.gender, + age: calculatedAge.value, + birth_date: patientForm.value.birth_date, + height: patientForm.value.height, + weight: patientForm.value.weight, + shoe_size: patientForm.value.shoe_size, + phone: patientForm.value.phone, + occupation: patientForm.value.occupation, + email: patientForm.value.email, + nationality: patientForm.value.nationality, + residence: patientForm.value.residence, + workplace: patientForm.value.workplace + } + try { + const response = await patientAPI.updatePatient(patientForm.value.id, patientData) + if (response.success) { + return response.data + } else { + throw new Error(response.message || '修改失败') + } + } catch (error) { + throw error + } +} const handleSave = async () => { if (!(await validateForm())) return - saveLoading.value = true + saveLoading.value = true try { - await savePatient() + if(patientForm.value.id == null){ + await savePatient() + }else[ + await updatePatient () + ] + ElMessage.success('患者档案保存成功') - router.push('/') } catch (error) { ElMessage.error('保存失败:' + error.message) } finally { @@ -296,7 +330,8 @@ const handleSaveAndDetect = async () => { try { const patient = await savePatient() ElMessage.success('患者档案保存成功,即将开始检测') - router.push(`/detection/${patient.id}`) + emit('closecreatbox',patient) + // router.push(`/detection/${patient.id}`) } catch (error) { ElMessage.error('保存失败:' + error.message) } finally {