| | |
| | | <template> |
| | | <div class="dietarySurvey-item"> |
| | | <el-dialog v-model="state.dialogTableVisible" title="营养风险筛查表(NRS2002)" :fullscreen="true" width="100%"> |
| | | <div class="container" style="width: 100%; height: 100%; overflow: auto"> |
| | | <div> |
| | | <el-dialog v-model="state.dialogTableVisible" title="NRS-2002" :fullscreen="true" width="100%"> |
| | | <div style="width: 100%; height: 100%; overflow: auto"> |
| | | <div id="pinggu1"> |
| | | <div> |
| | | <el-form size="small"> |
| | | <div style="width: 100%"> |
| | |
| | | <th colspan="2"> |
| | | <el-form-item label="初次调查日期"> |
| | | <el-date-picker |
| | | readonly |
| | | v-model="state.tableData.初次调查日期" |
| | | type="date" |
| | | style="width: 100px" |
| | |
| | | <th colspan="2"> |
| | | <el-form-item label="更新日期"> |
| | | <el-date-picker |
| | | readonly |
| | | v-model="state.tableData.更新日期" |
| | | type="date" |
| | | style="width: 100px" |
| | |
| | | </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> |
| | | </tr> |
| | |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td colspan="4">小于70 岁</td> |
| | | <td colspan="4">< 70 岁</td> |
| | | <td colspan="1">0分</td> |
| | | <td colspan="1"> |
| | | <el-radio-group class="elradiozdi" v-model="state.tableData.年龄评分.type"> |
| | |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td colspan="4">大于、等于70 岁</td> |
| | | <td colspan="4">>=70 岁</td> |
| | | <td colspan="1">1分</td> |
| | | <td colspan="1"> |
| | | <el-radio-group class="elradiozdi" v-model="state.tableData.年龄评分.type"> |
| | |
| | | <br /> |
| | | <br /> |
| | | <br /> |
| | | <div style="color: blue"> |
| | | 最后得分:{{ sum }}, {{ sum >= 3 ? '患者存在营养风险,应进行营养评定,并制定和实施营养支持治疗计划。' : '无营养风险' }} |
| | | <div style="color: blue" v-if="sum.value" :style="{color:sum.color}"> |
| | | 最后得分:{{ sum.value }}, {{ sum.label }} |
| | | </div> |
| | | |
| | | <br /> |
| | |
| | | <div class="dialog-footer" style="text-align: center"> |
| | | <el-button @click="funhui">取消</el-button> |
| | | <el-button type="primary" @click="onSubmit"> 保存 </el-button> |
| | | <el-button v-if="state.viewInfo.id" type="primary" v-print="'#pinggu1'"> |
| | | <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> |
| | |
| | | </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'; |
| | |
| | | const state = reactive({ |
| | | dialogTableVisible: false, |
| | | tableData: { |
| | | 表名: '营养风险筛查表(NRS2002)', |
| | | 表名: 'NRS-2002', |
| | | 初次调查日期: '', |
| | | 填表日期: '', |
| | | 更新日期: '', |
| | |
| | | surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'), |
| | | surveryPerson: userInfos.value.code, |
| | | surveryJsonBody: '', |
| | | suveryFormName: '营养风险筛查表(NRS2002)', |
| | | suveryFormName: 'NRS-2002', |
| | | surveryFormType: 1, |
| | | updateTime: '', |
| | | }, |
| | | }); |
| | | const sum = computed(() => { |
| | | const res={ |
| | | value:'', |
| | | label:'', |
| | | color:'' |
| | | } |
| | | let x = 0; |
| | | for (let key in state.tableData) { |
| | | console.log(key + 'key==' + state.tableData[key]?.type); |
| | |
| | | x += Number(state.tableData[key]?.type); |
| | | } |
| | | } |
| | | return x; |
| | | res.value=x |
| | | if(x>=3){ |
| | | res.label='存在营养风险' |
| | | res.color='#F56C6C' |
| | | }else{ |
| | | res.label='无营养风险' |
| | | res.color='#303133' |
| | | } |
| | | return res; |
| | | }); |
| | | const funhui = () => { |
| | | state.dialogTableVisible = false; |
| | |
| | | const onSubmit = () => { |
| | | console.log('submit!'); |
| | | console.log(state.tableData); |
| | | let x = 0; |
| | | for (let key in state.tableData) { |
| | | console.log(key + 'key==' + state.tableData[key]?.type); |
| | | if (Number(state.tableData[key]?.type)) { |
| | | x += Number(state.tableData[key]?.type); |
| | | } |
| | | } |
| | | if(x>=3){ |
| | | state.tableData.结果= '患者存在营养风险,应进行营养评定,并制定和实施营养支持治疗计划。' |
| | | }else{ |
| | | state.tableData.结果='无营养风险' |
| | | } |
| | | |
| | | state.tableData.结果=sum.value |
| | | const info: tiaochabiaoInfo = { |
| | | id: state.viewInfo.id, |
| | | surveryFormType: 1, |
| | |
| | | surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'), |
| | | surveryPerson: userInfos.value.code, |
| | | surveryJsonBody: JSON.stringify(state.tableData), |
| | | suveryFormName: '营养风险筛查表(NRS2002)', |
| | | suveryFormName: 'NRS-2002', |
| | | updateTime: '', |
| | | }; |
| | | console.log(info); |
| | |
| | | console.log(mode); |
| | | state.viewInfo = mode; |
| | | state.tableData = JSON.parse(mode.surveryJsonBody); |
| | | state.tableData.初次调查日期=mode.surveryTime |
| | | state.tableData.更新日期=mode.updateTime |
| | | state.dialogTableVisible = true; |
| | | } |
| | | }; |
| | | const getPageInfo = () => { |
| | | state.tableData = { |
| | | 表名: '营养风险筛查表(NRS2002)', |
| | | 表名: 'NRS-2002', |
| | | 初次调查日期: formatDate(new Date(), 'YYYY-mm-dd'), |
| | | 填表日期: '', |
| | | 更新日期: formatDate(new Date(), 'YYYY-mm-dd'), |
| | |
| | | surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'), |
| | | surveryPerson: userInfos.value.code, |
| | | surveryJsonBody: '', |
| | | suveryFormName: '营养风险筛查表(NRS2002)', |
| | | suveryFormName: 'NRS-2002', |
| | | surveryFormType: 1, |
| | | updateTime: '', |
| | | }; |
| | | }; |
| | | const generatePDF=()=> { |
| | | const element = document.getElementById('pinggu1'); |
| | | 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 }); |
| | |
| | | border-color: #666666; |
| | | background-color: #ffffff; |
| | | } |
| | | </style> |
| | | </style> |