chenyc
2025-10-14 a6f64303f88508d1c4d6ce53ff46be6b745cfb93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
<template>
    <div class="personal layout-pd">
        <el-form size="small" :inline="true" :model="state.formInline"> 
            <el-form-item label="填报日期">
                <el-date-picker
                    v-model="state.formInline.date"
                    type="daterange"
                    unlink-panels
                    range-separator="To"
                    start-placeholder="开始"
                    end-placeholder="结束"
                    :shortcuts="shortcuts"
                    format="YYYY/MM/DD"
                    value-format="YYYY-MM-DD"
                />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="success" @click="daochuExcel">导出</el-button>
            </el-form-item>
        </el-form>
 
        <div class="scrollable-table" :style="{maxHeight:tableHe}">
            <table id="tabledome" class="gridtable">
                <thead>
                <tr>
                    <th colspan="22">健康管理服务明细表</th>
                </tr>
                <tr>
                    <td colspan="10">服务单位:{{clientName}}</td>
                    <td colspan="22">服务期({{state.formInline.date[0]}}到{{state.formInline.date[1]}})</td>
                </tr>
                <tr>
                    <th rowspan="2">序号</th>
                    <th rowspan="2">姓名</th>
                    <th rowspan="2">干体重</th>
                    <th rowspan="2">最新生化检验数据更新</th>
                    <th colspan="5">营养风险&营养评估</th>
                    <th rowspan="2">膳食调查</th>
                    <th colspan="8">个性化饮食指导</th>
                    <th>团体宣教</th>
                    <th rowspan="2">随访跟进</th>
                    <th rowspan="2">营养咨询回复</th>
                    <th rowspan="2">购买套餐</th>
                </tr>
                <tr>
                
                    <th>NRS-2002</th>
                    <th>SGA</th>
                    <th>MIS</th>
                    <th>GNRI</th>
                    <th>PEW</th>
                    <!-- <th>膳食调查</th> -->
                    <!-- <th colspan="8">个性化饮食指导</th> -->
                    <th>控磷</th>
                    <th>控钾</th>
                    <th>控水</th>
                    <th>贫血</th>
                    <th>蛋白质</th>
                    <th>便秘</th>
                    <th>腹泻</th>
                    <th>体重管理</th>
                    <th style="color: red;">专题勾选</th>
                    
                    
                </tr>
            </thead>
                <tbody>
 
                    <tr v-for="(row,index)  in state.tableData" :key="index">
                        <td>{{index+1}}</td>
                        <td>{{row?.patientName}}</td>
                        <td>{{row?.patientDryWeight}}</td>
                        <td>{{row?.checkIsData?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['NRS-2002']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['SGA']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['MIS']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['GNRI']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['PEW']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['膳食生活调查表']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['营养饮食指导方案']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['营养饮食指导方案']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['营养饮食指导方案']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['营养饮食指导方案']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['营养饮食指导方案']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['营养饮食指导方案']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['营养饮食指导方案']?.id?'✔':''}}</td>
                        <td>{{row?.surveryTimeMap?.['营养饮食指导方案']?.id?'✔':''}}</td>
                        <td></td>
                        <td>{{row?.surveryTimeMap?.['随访记录']?.id?'✔':''}}</td>
                        <td></td>
                        <td></td>
                    </tr>
                    
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="3">合计</td>
                        <td>{{HJcheckIsData}}</td>
                        <td>{{HJNRS}}</td>
                        <td>{{HJSGA}}</td>
                        <td>{{HJMIS}}</td>
                        <td>{{HJGNRI}}</td>
                        <td>{{HJPEW}}</td>
 
                        <td>{{HJ膳食生活调查表}}</td>
                        <td>{{HJ营养饮食指导方案}}</td>
                        <td>{{HJ营养饮食指导方案}}</td>
                        <td>{{HJ营养饮食指导方案}}</td>
                        <td>{{HJ营养饮食指导方案}}</td>
                        <td>{{HJ营养饮食指导方案}}</td>
                        <td>{{HJ营养饮食指导方案}}</td>
                        <td>{{HJ营养饮食指导方案}}</td>
                        <td>{{HJ营养饮食指导方案}}</td>
                        <td></td>
                        <td>{{HJ随访记录}}</td>
                        <td></td>
                        <td></td> 
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>
</template>
 
<script setup lang="ts" name="personal">
import { reactive, computed, onMounted, ref } from 'vue';
import { formatAxis } from '/@/utils/formatTime';
import { storeToRefs } from 'pinia';
import { useUserInfo } from '/@/stores/userInfo';
import {nutritionalSummary} from '/@/api/Patients'
import {editUserInfo} from '/@/api/login'
import { ElLoading } from 'element-plus';
import * as XLSX from 'xlsx';
import {formatDate} from '/@/utils/formatTime'
const stores = useUserInfo();
const { userInfos } = storeToRefs(stores);
const shortcuts = [
  {
    text: '上一周',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
      return [start, end]
    },
  },
  {
    text: '上一个月',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
      return [start, end]
    },
  },
  {
    text: '前三个月',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
      return [start, end]
    },
  },
]
const clientName=computed(()=>{
    return userInfos.value.clientName
})
const HJcheckIsData=computed(()=>{
    let x=0
    if(state.tableData.length>0){
        state.tableData.forEach(row => {
            if(row.checkIsData){
                x++
            }
        });
    }
    return x
})
 
const HJNRS=computed(()=>{
    let x=0
    if(state.tableData.length>0){
        state.tableData.forEach(row => {
            if(row?.surveryTimeMap?.['NRS-2002']?.id){
                x++
            }
        });
    }
    return x
})
const HJSGA=computed(()=>{
    let x=0
    if(state.tableData.length>0){
        state.tableData.forEach(row => {
            if(row?.surveryTimeMap?.['SGA']?.id){
                x++
            }
        });
    }
    return x
})
const HJMIS=computed(()=>{
    let x=0
    if(state.tableData.length>0){
        state.tableData.forEach(row => {
            if(row?.surveryTimeMap?.['MIS']?.id){
                x++
            }
        });
    }
    return x
})
const HJGNRI=computed(()=>{
    let x=0
    if(state.tableData.length>0){
        state.tableData.forEach(row => {
            if(row?.surveryTimeMap?.['GNRI']?.id){
                x++
            }
        });
    }
    return x
})
const HJPEW=computed(()=>{
    let x=0
    if(state.tableData.length>0){
        state.tableData.forEach(row => {
            if(row?.surveryTimeMap?.['PEW']?.id){
                x++
            }
        });
    }
    return x
})
const HJ膳食生活调查表=computed(()=>{
    let x=0
    if(state.tableData.length>0){
        state.tableData.forEach(row => {
            if(row?.surveryTimeMap?.['膳食生活调查表']?.id){
                x++
            }
        });
    }
    return x
})
const HJ营养饮食指导方案=computed(()=>{
    let x=0
    if(state.tableData.length>0){
        state.tableData.forEach(row => {
            if(row?.surveryTimeMap?.['营养饮食指导方案']?.id){
                x++
            }
        });
    }
    return x
})
const HJ随访记录=computed(()=>{
    let x=0
    if(state.tableData.length>0){
        state.tableData.forEach(row => {
            if(row?.surveryTimeMap?.['随访记录']?.id){
                x++
            }
        });
    }
    return x
})
const tableHe = computed(() => {
    let height = document.documentElement.clientHeight;
    console.log('窗口高度')
    const navDom = document.querySelector('.layout-navbars-breadcrumb-index');
    if (navDom) {
        height -= navDom.scrollHeight;
    }
    return height-60+'px'
})
// 当前时间提示语
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
const state = reactive({
    tableData: <any>[],
    page:1,
    size:10,
    total:0,
    loading: false,
    formInline:{
        date: [formatDate(start,'YYYY-mm-dd'), formatDate(end,'YYYY-mm-dd')],
    },
    dialogTableVisible:false
})
const daochuExcel=()=>{
    let table = document.getElementById('tabledome');
      if (table) {
        const wb = XLSX.utils.table_to_book(table, { sheet: "Sheet1" });
          XLSX.writeFile(wb, "患者健康服务统计.xlsx"); // 文件名和扩展名可以根据需要更改
      } else {
        console.error("找不到指定的表格");
      }
}
const onSubmit=()=>{
    const pasm={
        startTime:state.formInline.date[0]+ ' 00:00:00',
        endTime:state.formInline.date[1]+ ' 23:59:59',
        clientCode:userInfos.value.clientCode,
        queryValue:''
    }
    console.log(pasm)
    const loading = ElLoading.service({
        lock: true,
        text: 'Loading',
        background: 'rgba(0, 0, 0, 0.7)',
    })
    nutritionalSummary(pasm).then(re=>{
        console.log(re.data)
        state.tableData=re.data
    }).finally(()=>{
        loading.close()
    })
 
}
onMounted(()=>{
    onSubmit()
})
</script>
 
<style scoped lang="scss">
.scrollable-table {
    width: 100%;
    overflow-y: auto;
    display: block;
  }
  table {
    width: 100%;
    border-collapse: collapse;
  }
  thead, tfoot {
    background-color: #f5f5f5;
    position: sticky;
    left: 0;
    right: 0;
    z-index: 2;
  }
  thead {
    top: 0;
  }
  tfoot {
    bottom: 0;
  }
  th, td {
    padding: 8px 12px;
    text-align: left;
    border: 1px solid #ddd;
  }
 
.gridtable {
    width: 100%;
    font-family: verdana, arial, sans-serif;
    font-size: 11px;
    color: #333333;
    border-width: 1px;
    border-color: #666666;
    border-collapse: collapse;
   
}
 
.gridtable th {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    border-color: #666666;
    background-color: #a4b0e2;
}
 
.gridtable td {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    border-color: #666666;
    background-color: #ffffff;
    text-align: center;
}
</style>