diff --git a/src/views/Department-entry/Medical-examination-vehicle.vue b/src/views/Department-entry/Medical-examination-vehicle.vue index bb12c49..6d6174a 100644 --- a/src/views/Department-entry/Medical-examination-vehicle.vue +++ b/src/views/Department-entry/Medical-examination-vehicle.vue @@ -85,13 +85,25 @@ :class="{ active: selectedPatient?.id === patient.id }" >
- {{ patient.pname }} - {{ patient.medicalSn }} - - {{ getStatusText(patient) }} - +
+ {{ patient.pname }} + {{ truncateMedicalSn(patient.medicalSn) }} + + {{ getStatusText(patient) }} + + 打回 +
- @@ -2509,6 +2521,73 @@ const handleDateRangeChange = async (val) => { ElMessage.error('获取患者列表失败') } } + +// 添加重置患者状态的方法 +const resetPatientStatus = async (patient) => { + try { + // 确认是否要重置状态 + await ElMessageBox.confirm('确定要重置该患者的状态吗?重置后将无法恢复。', '重置状态确认', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }) + + const loading = ElLoading.service({ + lock: true, + text: '处理中...', + background: 'rgba(255, 255, 255, 0.7)' + }) + + try { + // 更新数据库中的status字段为0,同时更新体检日期为当前时间戳 + await PatientApi.updatePatient({ + id: patient.id, + status: 0, // 设置为待检查状态 + medicalDateTime: Date.now() // 更新体检日期为当前时间 + }) + + // 更新本地状态 + patient.status = 0 + patient.medicalDateTime = Date.now() + + // 更新列表中的患者状态 + const patientIndex = patients.value.findIndex((p) => p.id === patient.id) + if (patientIndex !== -1) { + patients.value[patientIndex].status = 0 + patients.value[patientIndex].medicalDateTime = Date.now() + } + + // 更新过滤后的列表中的患者状态 + const filteredIndex = filteredPatients.value.findIndex( + (p) => p.id === patient.id + ) + if (filteredIndex !== -1) { + filteredPatients.value[filteredIndex].status = 0 + filteredPatients.value[filteredIndex].medicalDateTime = Date.now() + } + + loading.close() + ElMessage.success('状态重置成功') + + // 刷新数据 + await refreshExamData() + } catch (error) { + loading.close() + console.error('重置状态失败:', error) + ElMessage.error('重置状态失败,请稍后重试') + } + } catch { + // 用户取消重置状态 + ElMessage.info('已取消重置状态') + } +} + +// 添加一个函数用于截断体检编号,如果空间不足 +const truncateMedicalSn = (sn) => { + if (!sn) return ''; + // 如果编号长度超过10个字符,则截断并添加省略号 + return sn.length > 10 ? sn.substring(0, 8) + '...' : sn; +} diff --git a/src/views/Department-entry/summary.vue b/src/views/Department-entry/summary.vue index 5ace970..0cce7a2 100644 --- a/src/views/Department-entry/summary.vue +++ b/src/views/Department-entry/summary.vue @@ -335,7 +335,7 @@ const saveSummary = async () => { //更新总检医生id const saveData2 = { medicalSn: props.patient.medicalSn, - chiefinspectorid: selectedDoctor.value.split('|')[0], + chiefinspectorid: parseInt(selectedDoctor.value.split('|')[0]), chiefinspector: selectedDoctor.value.split('|')[1] } diff --git a/src/views/Inspection-checklist/Inspection-checklist.vue b/src/views/Inspection-checklist/Inspection-checklist.vue index 4df6c02..a8d1822 100644 --- a/src/views/Inspection-checklist/Inspection-checklist.vue +++ b/src/views/Inspection-checklist/Inspection-checklist.vue @@ -271,13 +271,7 @@ onMounted(() => { /** 打印报告按钮操作 */ const handlePrint = async (row: PatientVO) => { try { - const data = await PatientApi.getPatientInfo(row.medicalSn) - //判断是否存在血常规、尿常规、生化检查编号 - if(!data.xcgcode && !data.ncgcode && !data.shqx){ - await PatientApi.bindPatientProject(row.medicalSn) - await PatientApi.syncinspectApplyTj(row.medicalSn) - await createPrint(row.medicalSn) - } + await PatientApi.bindPatientProject(row.medicalSn) await PatientApi.syncinspectApplyTj(row.medicalSn) await createPrint(row.medicalSn) // 打印完成后更新状态,添加当前时间戳