From 989c7e9b81da8aaa56c7d695dc0e24e1f49c1098 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期二, 11 三月 2025 16:01:40 +0800
Subject: [PATCH] gx

---
 src/views/home/components/pingubiao/editDietary5.vue |   94 +++++++++++++++++++++++++++++++---------------
 1 files changed, 63 insertions(+), 31 deletions(-)

diff --git a/src/views/home/components/pingubiao/editDietary5.vue b/src/views/home/components/pingubiao/editDietary5.vue
index 9a26b26..f7dd188 100644
--- a/src/views/home/components/pingubiao/editDietary5.vue
+++ b/src/views/home/components/pingubiao/editDietary5.vue
@@ -166,12 +166,13 @@
 import { NextLoading } from '/@/utils/loading';
 import { useUserInfo } from '/@/stores/userInfo';
 import { usePatientsInfo } from '/@/stores/patientsInfo';
+import dayjs from 'dayjs';
 const storesPat = usePatientsInfo();
 import { Add, update, deleteId, tiaochabiaoInfo } from '/@/api/tiaochabiao/index'
 import { storeToRefs } from 'pinia';
 import { useRoute, useRouter } from 'vue-router';
-import { ElMessage } from 'element-plus';
-import { getPatData } from '/@/api/Patients';
+import { ElLoading, ElMessage } from 'element-plus';
+import { getPatData,getLisResults } from '/@/api/Patients';
 import { number } from 'echarts';
 const stores = useUserInfo();
 const { patientsInfo } = storeToRefs(storesPat);
@@ -310,13 +311,13 @@
 
 }
 // 打开查看或者编辑明细
-const openShow = (type: string, mode: tiaochabiaoInfo) => {
+const openShow = async (type: string, mode: tiaochabiaoInfo) => {
     console.log(type)
     if (type === 'add') {
         state.tableData.初次调查日期 = formatDate(new Date(), 'YYYY-mm-dd')
         state.tableData.更新日期 = formatDate(new Date(), 'YYYY-mm-dd')
         state.tableData.记录者 = userInfos.value.userName
-        getPageInfo()
+        await  getPageInfo()
         state.dialogTableVisible = true
     }
 
@@ -332,35 +333,62 @@
 
 }
 const getPageInfo = async () => {
-    const res = await getPatData({ patCode: patientsInfo.value.code, })
-    console.log(res.data, '----')
-    state.tableData = {
-        表名: 'GNRI',
-        初次调查日期: formatDate(new Date(), 'YYYY-mm-dd'),
-        填表日期: '',
-        更新日期: formatDate(new Date(), 'YYYY-mm-dd'),
-        记录者: userInfos.value.userName,
-        身高: res.data.身高,
-        体重: res.data.身高.上一次透前体重,
-        理想体重: '',
-        血清白蛋白浓度: '',
-        无法测量身高: false,
-        膝高: '',
-        结果:''
+    const loading = ElLoading.service({
+            lock: true,
+            text: 'Loading',
+            background: 'rgba(0, 0, 0, 0.7)',
+        })
+    try{
+        const pam2 = {
+            clientCode: userInfos.value.clientCode,
+            patCode: patientsInfo.value.code,
+            date1: dayjs().add(-30, 'day').format('YYYY-MM-DD'),
+            date2: dayjs().format('YYYY-MM-DD'),
+        }
+        
+        const res = await getPatData({ patCode: patientsInfo.value.code, })
+        const res2= await  getLisResults(pam2)
+        loading.close()
+        console.log(res2.data, '-1111---')
+        let x=-1
+        // 默认白蛋白
+        if(res2.data.length>0){
+            x=res2.data.findIndex(e=>{return e.item_name==='白蛋白'})
+        }
+       
+        console.log(x)
+        state.tableData = {
+            表名: 'GNRI',
+            初次调查日期: formatDate(new Date(), 'YYYY-mm-dd'),
+            填表日期: '',
+            更新日期: formatDate(new Date(), 'YYYY-mm-dd'),
+            记录者: userInfos.value.userName,
+            身高: res.data.身高,
+            体重: res.data.上一次透前体重,
+            理想体重: '',
+            血清白蛋白浓度: x===-1?'':res2.data[x].item_result,
+            无法测量身高: false,
+            膝高: '',
+            结果:''
 
+        }
+        console.log(state.tableData )
+        state.viewInfo={
+            id: 0,
+            code: '',
+            clientCode: userInfos.value.clientCode,
+            patientCode: patientsInfo.value.code,
+            surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
+            surveryPerson: userInfos.value.code,
+            surveryJsonBody: '',
+            suveryFormName:'GNRI',
+            surveryFormType:1,
+            updateTime: ''
+        }
+    }catch(err){
+        loading.close()
     }
-    state.viewInfo={
-        id: 0,
-        code: '',
-        clientCode: userInfos.value.clientCode,
-        patientCode: patientsInfo.value.code,
-        surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
-        surveryPerson: userInfos.value.code,
-        surveryJsonBody: '',
-        suveryFormName:'GNRI',
-        surveryFormType:1,
-        updateTime: ''
-    }
+    
 }
 const generatePDF=()=> {
       const element = document.getElementById('pinggu5');
@@ -412,3 +440,7 @@
     background: yellow;
 }
 </style>
+
+function dayjs() {
+  throw new Error('Function not implemented.');
+}

--
Gitblit v1.8.0