chenyc
2025-07-11 e469082aa6225d3c422288544986c86875585e76
src/views/home/components/pingubiao/editDietary5.vue
@@ -119,10 +119,10 @@
                                    <tr>
                                        <td colspan="6" style="color: #E6A23C;">
                                            GNRI为4个等级:<br>
                                            高营养风险(GNIR&lt;82<br>
                                            中营养风险(82≤GNIR<92)<br>
                                            低营养风险(92≤GNIR≤98)<br>
                                            无营养风险(GNIR>98)
                                            高营养风险(GNRI&lt;82<br>
                                            中营养风险(82≤GNRI<92)<br>
                                            低营养风险(92≤GNRI≤98)<br>
                                            无营养风险(GNRI>98)
                                        </td>
@@ -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);
@@ -259,7 +260,7 @@
        }else if(data>=98){
            res.value=data
            res.label='低营养风险'
            res.label='无营养风险'
            res.color='#303133'
        }
        return res
@@ -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.');
}