From 81cb502e107b2feac5c329d534477063cf24d9cb Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期一, 24 二月 2025 16:36:23 +0800
Subject: [PATCH] 34

---
 src/views/home/components/pingubiao/editDietary2.vue |   83 ++++++++++++++++++++++++++++++++---------
 1 files changed, 64 insertions(+), 19 deletions(-)

diff --git a/src/views/home/components/pingubiao/editDietary2.vue b/src/views/home/components/pingubiao/editDietary2.vue
index b98b42b..44e59f8 100644
--- a/src/views/home/components/pingubiao/editDietary2.vue
+++ b/src/views/home/components/pingubiao/editDietary2.vue
@@ -1,8 +1,8 @@
 <template>
     <div class="dietarySurvey-item">
-        <el-dialog v-model="state.dialogTableVisible" title="主观全面评定(SGA)评价" :fullscreen="true" width="100%">
+        <el-dialog v-model="state.dialogTableVisible" title="SGA" :fullscreen="true" width="100%">
             <div class="container" style="width: 100%; height: 100%;overflow: auto;">
-                <div>
+                <div id="pinggu2">
                     <div>
                         <el-form size="small">
                             <div style="width: 100%">
@@ -11,7 +11,7 @@
                                     <tr>
                                         <th colspan="2">
                                             <el-form-item label="初次调查日期">
-                                                <el-date-picker v-model="state.tableData.初次调查日期" type="date"
+                                                <el-date-picker v-model="state.tableData.初次调查日期" type="date" readonly
                                                     style="width: 100px;" placeholder="" format="YYYY/MM/DD"
                                                     value-format="YYYY-MM-DD" />
                                             </el-form-item>
@@ -19,7 +19,7 @@
                                         </th>
                                         <th colspan="2">
                                             <el-form-item label="更新日期">
-                                                <el-date-picker v-model="state.tableData.更新日期" type="date"
+                                                <el-date-picker v-model="state.tableData.更新日期" type="date" readonly
                                                     style="width: 100px;" placeholder="" format="YYYY/MM/DD"
                                                     value-format="YYYY-MM-DD" />
                                             </el-form-item>
@@ -28,7 +28,7 @@
                                         </th>
                                         <th colspan="2">
                                             <el-form-item label="记录者">
-                                                <el-input v-model="state.tableData.记录者" style="width: 100px;"   placeholder="" />
+                                                <el-input v-model="state.tableData.记录者" style="width: 100px;" readonly  placeholder="" />
                                             </el-form-item>
                                         </th>
 
@@ -52,7 +52,7 @@
 
                                         </td>
                                         <td colspan="3" style="color: red;">
-                                            评级结果:{{sum}}
+                                            评级结果:{{sum.value}},{{sum.label}}
                                         </td>
 
 
@@ -125,8 +125,8 @@
                                         <td colspan="2">这种情况持续多长时间?</td>
                                         <td colspan="3">
                                             <el-radio-group class="elradiozdi" v-model="state.tableData.进食3.type">
-                                                <el-radio value="A">A:小于等于2周</el-radio>
-                                                <el-radio value="B">B:大于2周</el-radio>
+                                                <el-radio value="A">A:≤2周</el-radio>
+                                                <el-radio value="B">B:>2周</el-radio>
                                                
                                             </el-radio-group>
                                         </td>
@@ -404,13 +404,13 @@
                                     </tr>
                                     
                                     <tr>
-                                        <td colspan="6" style="font-weight: 600;">
+                                        <td colspan="6" style="font-weight: 600; color: #000;">
                                             注意:
                                             <br />
                                             1.体重变化,考虑过去6个月或近2周的,过去5个月变化显著,但近一个月无丢失无增加,或近2周经治疗后体重稳定,则体重丢失一项不予考虑。
                                             <br />2.胃肠道症状至少持续2周,偶尔一两次不予考虑。
                                             <br />3.应激参照:大面积烧伤、高烧、或大量出血属高应激,长期发烧、慢性腹泻属中应激,长期低烧或恶性肿瘤属低应
-                                            <br />4.评价结果中,8项中至少5项属于C级或者B级,分别定位重度或中度具体参考:C>5项定为重度营养不良,有明显的躯体症状C小于5但B+C大于等于5项定为中度营养不良,B+C小于5项为轻度营养不良A≥5定为营养良好,或有明显的改善病例结果
+                                            <br />4.评价结果中,8项中至少5项属于C级或者B级,分别定位重度或中度具体参考:C>5项定为重度营养不良,有明显的躯体症状C小于5但B+C>等于5项定为中度营养不良,B+C小于5项为轻度营养不良A≥5定为营养良好,或有明显的改善病例结果
                                         </td>
                                     </tr>
 
@@ -427,6 +427,14 @@
                     <el-button type="primary" @click="onSubmit">
                         保存
                     </el-button>
+                    <el-button v-if="state.viewInfo.id" type="primary" v-print="'#pinggu2'">
+                        <el-icon><Printer /></el-icon>
+                        打印
+                    </el-button>
+                    <el-button type="primary" v-if="state.viewInfo.id" @click="generatePDF">
+                        <el-icon><Position /></el-icon>
+                        导出
+                    </el-button>
                 </div>
             </template>
         </el-dialog>
@@ -437,6 +445,7 @@
 </template>
 
 <script setup lang="ts" name="visualizingLinkDemo2">
+import html2pdf from 'html2pdf.js';
 import { reactive, onMounted, onUnmounted, ref, computed } from 'vue';
 import { formatDate } from '/@/utils/formatTime';
 import { NextLoading } from '/@/utils/loading';
@@ -455,7 +464,7 @@
 const state = reactive({
     dialogTableVisible: false,
     tableData: {
-        表名: '主观全面评定(SGA)评价',
+        表名: 'SGA',
         初次调查日期: "",
         填表日期: '',
         更新日期: '',
@@ -531,7 +540,8 @@
         腹水: {
             type: '',
             input1: '',
-        }
+        },
+        结果:''
     },
     loading: false,
     viewInfo: {
@@ -542,7 +552,7 @@
         surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
         surveryPerson: userInfos.value.code,
         surveryJsonBody: '',
-        suveryFormName: '主观全面评定(SGA)评价',
+        suveryFormName: 'SGA',
         surveryFormType: 1,
         updateTime: ''
     }
@@ -552,8 +562,12 @@
     let a = 0
     let b=0
     let c=0
+    const res={
+        value:'',
+        label:'',
+        color:''
+    }
     for (let key in state.tableData) {
-        console.log(key + 'key==' + state.tableData[key]?.type)
         if (state.tableData[key]?.type==='A') {
             a++
         }else if(state.tableData[key]?.type==='B') {
@@ -562,7 +576,23 @@
             c++
         }
     }
-    return `A:${a},B:${b},C:${c}`
+    if(c>5){
+        res.label='重度营养不良'
+        res.color='#F56C6C'
+    }else if(c<5&&b+c>=5){
+        res.label='中度营养不良'
+        res.color='#E6A23C'
+    }else if(b+c<5){
+        res.label='轻度营养不良'
+        res.color='#E6A23C'
+    }else if(a>=5) {
+        res.label='营养良好'
+        res.color='#303133'
+    }else{
+        res.label=''
+    }
+    res.value=`A:${a},B:${b},C:${c}`
+    return res
 })
 const funhui = () => {
     state.dialogTableVisible = false
@@ -570,6 +600,7 @@
 const onSubmit = () => {
     console.log('submit!')
     console.log(state.tableData)
+    state.tableData.结果=sum.value
     const info: tiaochabiaoInfo = {
         id: state.viewInfo.id,
         surveryFormType: 1,
@@ -579,7 +610,7 @@
         surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
         surveryPerson: userInfos.value.code,
         surveryJsonBody: JSON.stringify(state.tableData),
-        suveryFormName: '主观全面评定(SGA)评价',
+        suveryFormName: 'SGA',
         updateTime: ''
     }
     console.log(info)
@@ -621,6 +652,8 @@
         console.log(mode)
         state.viewInfo = mode
         state.tableData = JSON.parse(mode.surveryJsonBody)
+        state.tableData.初次调查日期=mode.surveryTime
+        state.tableData.更新日期=mode.updateTime
         state.dialogTableVisible = true
 
 
@@ -629,7 +662,7 @@
 }
 const getPageInfo = () => {
     state.tableData = {
-        表名: '主观全面评定(SGA)评价',
+        表名: 'SGA',
         初次调查日期: formatDate(new Date(), 'YYYY-mm-dd'),
         填表日期: '',
         更新日期: formatDate(new Date(), 'YYYY-mm-dd'),
@@ -705,7 +738,8 @@
         腹水: {
             type: '',
             input1: '',
-        }
+        },
+        结果:''
     }
     state.viewInfo={
         id: 0,
@@ -715,12 +749,23 @@
         surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
         surveryPerson: userInfos.value.code,
         surveryJsonBody: '',
-        suveryFormName: '主观全面评定(SGA)评价',
+        suveryFormName: 'SGA',
         surveryFormType: 1,
         updateTime: ''
     }
 }
+const generatePDF=()=> {
+      const element = document.getElementById('pinggu2');
+      const opt = {
+        margin: 10,
+        filename: `${state.tableData.表名}.pdf`,
+        image: { type: 'jpeg', quality: 0.98 },
+        html2canvas: { scale: 2 },
+        jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
+      };
+      html2pdf().set(opt).from(element).save();
 
+}
 // 第二步:暴露方法
 defineExpose({ getData, openShow })
 </script>

--
Gitblit v1.8.0