Quellcode durchsuchen

优化导出生命体征

xiongxing vor 1 Monat
Ursprung
Commit
15e576589c
1 geänderte Dateien mit 16 neuen und 6 gelöschten Zeilen
  1. 16 6
      src/views/elderly/assess/vital-sign/index.vue

+ 16 - 6
src/views/elderly/assess/vital-sign/index.vue

@@ -182,14 +182,14 @@ const handleSingleExport = async () => {
     return
   }
   const wb = XLSX.utils.book_new()
-  const headers = ['日期', '时间', '体温', '脉搏', '呼吸', '血压', '血氧']
+  const headers = ['日期', '时间', '体温', '脉搏', '呼吸', '血压', '血氧', '测量人']
   const colCount = headers.length
 
   // 查询该长者所有数据
   const data = await getVitalSignsPage({ ...queryParams, pageNo: 1, pageSize: 99999 })
-  const records: Recordable[] = data.list || []
+  const records: Recordable[] = Array.isArray(data?.list) ? data.list : []
   if (records.length === 0) {
-    message.warning('未查询到该长者的生命体征数据')
+    message.warning(`未查询到长者「${queryParams.elderName}」的生命体征数据,无法导出`)
     return
   }
 
@@ -201,7 +201,7 @@ const handleSingleExport = async () => {
   const first = records[0]
   const infoItems = [
     { label: '姓名:', value: first.elderName || '', start: 0, span: 3 },
-    { label: '床号:', value: first.bedName || '', start: 4, span: 3 }
+    { label: '床号:', value: first.bedName || '', start: 4, span: 4 }
   ]
   const infoRow: string[] = new Array(colCount).fill('')
   infoItems.forEach((item) => {
@@ -216,7 +216,8 @@ const handleSingleExport = async () => {
     stripMetric(row.pulse),
     stripMetric(row.respiratoryRate),
     [stripMetric(row.systolicPressure), stripMetric(row.diastolicPressure)].filter(Boolean).join('/'),
-    stripMetric(row.bloodOxygenSaturation)
+    stripMetric(row.bloodOxygenSaturation),
+    row.measuringName || ''
   ])
 
   // 护士签名行
@@ -234,7 +235,16 @@ const handleSingleExport = async () => {
   ]
 
   // 列宽
-  ws['!cols'] = [{ wch: 14 }, { wch: 12 }, { wch: 10 }, { wch: 10 }, { wch: 10 }, { wch: 12 }, { wch: 10 }]
+  ws['!cols'] = [
+    { wch: 14 },
+    { wch: 12 },
+    { wch: 10 },
+    { wch: 10 },
+    { wch: 10 },
+    { wch: 12 },
+    { wch: 10 },
+    { wch: 12 }
+  ]
 
   // 行高
   ws['!rows'] = [