diff --git a/src/api/inspect/inspectpatient/index.ts b/src/api/inspect/inspectpatient/index.ts index 4c98ed4..201aa3a 100644 --- a/src/api/inspect/inspectpatient/index.ts +++ b/src/api/inspect/inspectpatient/index.ts @@ -31,6 +31,7 @@ export interface PatientVO { shqx: string // 生化编号 isprint: number // 是否打印 printtime: Date // 打印时间 + barcodetime: Date // 条形码时间 chiefinspectorid: string // 总检医生ID chiefinspector: string // 总检医生 } @@ -165,5 +166,11 @@ export const PatientApi = { //更新患者补充信息 updatePatientSupplement: async (medicalSn: string,idCard: string) => { return await request.get({ url: `/inspect/patient/updatePatientSupplement?medicalSn=` + medicalSn + `&idCard=` + idCard}) + }, + //更新条形码打印时间 + updateBarcodeTime: async (medicalSn: string, barcodetime: Date) => { + return await request.put({ + url: `/inspect/patient/updateBarcodeTime?medicalSn=${medicalSn}&barcodetime=${barcodetime.toISOString()}` + }) } } diff --git a/src/views/Inspection-checklist/Inspection-checklist.vue b/src/views/Inspection-checklist/Inspection-checklist.vue index 7f6ad60..b94b72a 100644 --- a/src/views/Inspection-checklist/Inspection-checklist.vue +++ b/src/views/Inspection-checklist/Inspection-checklist.vue @@ -347,8 +347,56 @@ const createPrint = async (medicalSn) => { /** 打印条形码 */ const handlePrintBarcode = async (row: PatientVO) => { try { + // 获取最新的患者信息 + const patientInfo = await PatientApi.getPatientInfo(row.medicalSn) + console.log('患者信息:', patientInfo) + + // 检查是否存在条形码打印时间 + if(patientInfo.barcodetime){ + // 格式化上次打印时间,显示中文年月日格式 + const date = new Date(patientInfo.barcodetime) + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + const lastPrintTime = `${year}年${month}月${day}日` + + // 格式化报告打印时间 + let reportPrintTime = '' + if (patientInfo.medicalDateTime && patientInfo.status == 1) { + const reportDate = new Date(patientInfo.medicalDateTime) + const reportYear = reportDate.getFullYear() + const reportMonth = String(reportDate.getMonth() + 1).padStart(2, '0') + const reportDay = String(reportDate.getDate()).padStart(2, '0') + reportPrintTime = `${reportYear}年${reportMonth}月${reportDay}日` + } + + try { + // 显示只有确定按钮的提示框 + await ElMessageBox.alert( + `
该条形码已于 ${lastPrintTime} 打印。
` + + (reportPrintTime ? `
该患者报告于 ${reportPrintTime} 打印。
` : ''), + '提示', + { + confirmButtonText: '确定', + type: 'warning', + dangerouslyUseHTMLString: true + } + ) + } catch (error) { + // 用户点击确定后继续执行 + console.log('用户确认重新打印') + } + } + // 获取条形码数据 const databarcodePrint = await PatientApi.GetbarcodeInfo(row.medicalSn) + + // 检查是否存在条形码数据 + if (!databarcodePrint || !databarcodePrint.barcodes || databarcodePrint.barcodes.length === 0) { + message.warning('条形码不存在,无法打印') + return + } + // 基础打印数据 - 患者基本信息 const baseData = { patientName: databarcodePrint.name || row.pname, @@ -449,6 +497,13 @@ const handlePrintBarcode = async (row: PatientVO) => { // 执行批量打印 - 直接传入数组数据 hiprintTemplate.print(batchPrintData, options, ext); + + // 打印成功后更新条形码打印时间 + await PatientApi.updateBarcodeTime(row.medicalSn, new Date()) + + // 刷新列表 + await getList() + message.success('打印成功') } catch (error: any) { console.error('打印条形码失败,详细错误:', error); message.error(`打印条形码失败: ${error.message || '未知错误'}`); diff --git a/src/views/sta/index.vue b/src/views/sta/index.vue index 2b65c36..ea82adb 100644 --- a/src/views/sta/index.vue +++ b/src/views/sta/index.vue @@ -1,80 +1,150 @@ - +