chenyc
2025-02-13 c7d64da312576120b6252f91fea4e0052fd5f8dc
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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
<template>
    <div class="dietarySurvey-item">
        <el-dialog v-model="state.dialogTableVisible" title="SGA" :fullscreen="true" width="100%">
            <div class="container" style="width: 100%; height: 100%;overflow: auto;">
                <div id="pinggu2">
                    <div>
                        <el-form size="small">
                            <div style="width: 100%">
                                <table id="tabledome" class="gridtable">
 
                                    <tr>
                                        <th colspan="2">
                                            <el-form-item label="初次调查日期">
                                                <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>
 
                                        </th>
                                        <th colspan="2">
                                            <el-form-item label="更新日期">
                                                <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>
 
 
                                        </th>
                                        <th colspan="2">
                                            <el-form-item label="记录者">
                                                <el-input v-model="state.tableData.记录者" style="width: 100px;" readonly  placeholder="" />
                                            </el-form-item>
                                        </th>
 
                                    </tr>
                                    <tr>
                                        <th colspan="2">
                                            患者姓名:{{ patientsInfo.patientName }}
 
                                        </th>
                                        <th colspan="2">
                                            年龄:{{ patientsInfo.age }}
                                        </th>
                                        <th colspan="2">性别:{{ patientsInfo.patientGenderText }}</th>
 
                                    </tr>
 
 
                                    <tr>
                                        <td colspan="3">
                                            评价内容
 
                                        </td>
                                        <td colspan="3" style="color: red;">
                                            评级结果:{{sum.value}},{{sum.label}}
                                        </td>
 
 
                                    </tr>
                                    <tr>
                                        <td colspan="1" rowspan="3">
                                            体重改变
 
                                        </td>
                                        <td colspan="2">您目前体重?</td>
                                        <td colspan="3">
                                            <el-input v-model="state.tableData.您目前体重" style="max-width: 150px"
                                                placeholder="">
                                                <template #append>kg</template>
                                            </el-input>
                                        </td>
                                    </tr>
                                    <tr>
 
                                        <td colspan="2">与您六月份前的体重相比有变化吗?</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.体重改变1.type">
                                                <el-radio value="A">A:体重变化&lt;5%或5%-10%但正在改善 </el-radio>
                                                <el-radio value="B">B:持续减少5%-10%或由10%升至5%-10%</el-radio>
                                                <el-radio value="C">C:持续减少>10%</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
 
                                        <td colspan="2">近2周体重变化了吗?</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.体重改变2.type">
                                                <el-radio value="A">A:无变化,正常体重或恢复到5%内</el-radio>
                                                <el-radio value="B">B:稳定,但低于理想或通常体重;部分恢复但不完全</el-radio>
                                                <el-radio value="C">C:减少/降低</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <!-- 饮食 -->
                                    <tr>
                                        <td rowspan="6">
                                            进食
 
                                        </td>
                                        <td colspan="2">您的食欲??</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.进食1.type">
                                                <el-radio value="A">A:好</el-radio>
                                                <el-radio value="D">C:正常</el-radio>
                                                <el-radio value="C">C:差</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
 
                                        <td colspan="2">您的进食量有变化吗?</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.进食2.type">
                                                <el-radio value="A">A:不变</el-radio>
                                                <el-radio value="B">B:增加</el-radio>
                                                <el-radio value="C">C:减少</el-radio>
                                                <!-- <el-radio value="D">D:非常好</el-radio> -->
                                            </el-radio-group>
                                        </td>
 
                                    </tr>
                                    <tr>
 
                                        <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-group>
                                        </td>
 
                                    </tr>
                                    <tr>
 
                                        <td colspan="2">您的食物类型有变化吗?</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.进食4.type">
                                                <el-radio value="A">A:没有变化</el-radio>
                                                <el-radio value="B">B:半流食</el-radio>
                                                <el-radio value="C">C:全流食</el-radio>
                                                <el-radio value="D">D:无法进食</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
 
                                        <td colspan="2">摄食变化?</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.进食5.type">
                                                <el-radio value="A">A:好;无变化,轻度;短期变化</el-radio>
                                                <el-radio value="B">B:正常下限,但在减少;差,但在增加;差,没变化(取决于初始状态)</el-radio>
                                                <el-radio value="C">C:差,并在减少;差,无变化</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
 
                                        <td colspan="2">摄食变化的时间?</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.进食6.type">
                                                <el-radio value="A">A:≤2周,变化少或无变化</el-radio>
                                                <el-radio value="B">B:>2周,轻-中度低于理想摄食量</el-radio>
                                                <el-radio value="C">C:>2周,不能进食,饥饿</el-radio>
                                            </el-radio-group>
                                        </td>
                                        </tr>
                                    <tr>
                                        <td rowspan="6">
                                            胃肠道症状
                                        </td>
                                        <td colspan="5">近2周以来您经常出现下列问题吗?</td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">1:没有食欲:</td>
                                        <td colspan="3">
                                            从不-很少-每天-一周1-2次-每周2-3次
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">2:腹泻:</td>
                                        <td colspan="3">
                                            从不-很少-每天-一周1-2次-每周2-3次
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">3:恶心:</td>
                                        <td colspan="3">
                                            从不-很少-每天-一周1-2次-每周2-3次
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">4:呕吐:</td>
                                        <td colspan="3">
                                            从不-很少-每天-一周1-2次-每周2-3次
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="6">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.胃肠道症状.type">
                                                <el-radio value="A">A:少有,间断</el-radio>
                                                <el-radio value="B">B:部分症状,>2周;严重、持续的症状,但在改善</el-radio>
                                                <el-radio value="C">C:部分或所有症状,频繁或每天,>2周</el-radio>
                                            </el-radio-group>
                                        </td>
 
                                    </tr>
                                    <!-- 功能特异                                      -->
                                    <tr>
                                        <td rowspan="6">
                                            功能异常
                                        </td>
                                        <td colspan="5">您现在还能像往常那样做以下的事吗?</td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">1:散步:</td>
                                        <td colspan="3">
                                            没有-稍微减少-明显减少-增多
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">2:工作:</td>
                                        <td colspan="3">
                                            没有-稍微减少-明显减少-增多
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">3:室内活动:</td>
                                        <td colspan="3">
                                            没有-稍微减少-明显减少-增多
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">4:再过去的两周内有何变化:</td>
                                        <td colspan="3">
                                            有所改善-无变化-恶化
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="6">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.功能异常.type">
                                                <el-radio value="A">A:无受损,力气/精力无改变或轻中度下降但在改善</el-radio>
                                                <el-radio value="B">B:力气/精力中度下降但在改善;通常的活动部分减少;严重下降但在改善</el-radio>
                                                <el-radio value="C">C:力气/精力严重下降,卧床</el-radio>
                                            </el-radio-group>
                                        </td>
 
                                    </tr>
                                    <tr>
                                        <td>
                                            疾病和相关营养需求
                                        </td>
                                        <td colspan="2">疾病诊断&代谢应激</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.疾病和相关营养需求.type">
                                                <el-radio value="A">A:无应激</el-radio>
                                                <el-radio value="B">B:低水平应激</el-radio>
                                                <el-radio value="C">C:中高度应激</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr >
                                        <td rowspan="14">
                                            体检
                                        </td>
                                        <td colspan="2" >皮下脂肪</td>
                                        <td colspan="3" >
                                                <span value="A">A:良好</span>  &nbsp;&nbsp;
                                                <span value="B">B:轻度-中度</span>  &nbsp;&nbsp;
                                                <span value="C">C:重度</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        
                                        <td colspan="2">下眼皮</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.下眼皮.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        
                                        <td colspan="2">二/三头肌</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.二三头肌.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        
                                        <td colspan="2">肌肉消耗</td>
                                        <td colspan="3">
                                                <span value="A">A:良好</span>  &nbsp;&nbsp;
                                                <span value="B">B:轻度-中度</span>  &nbsp;&nbsp;
                                                <span value="C">C:重度</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">颞部</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.颞部.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">锁骨</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.锁骨.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">肩</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.肩.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">肩胛骨</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.肩胛骨.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">骨间肌</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.骨间肌.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">膝盖</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.膝盖.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">股四头肌</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.股四头肌.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">腓肠肌</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.腓肠肌.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">水肿</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.水肿.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">腹水</td>
                                        <td colspan="3">
                                            <el-radio-group class="elradiozdi" v-model="state.tableData.腹水.type">
                                                <el-radio value="A">A</el-radio>
                                                <el-radio value="B">B</el-radio>
                                                <el-radio value="C">C</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    
                                    <tr>
                                        <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定为营养良好,或有明显的改善病例结果
                                        </td>
                                    </tr>
 
                                </table>
                            </div>
                        </el-form>
                    </div>
 
                </div>
            </div>
            <template #footer>
                <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="'#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>
 
 
    </div>
 
</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';
import { useUserInfo } from '/@/stores/userInfo';
import { usePatientsInfo } from '/@/stores/patientsInfo';
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';
const stores = useUserInfo();
const { patientsInfo } = storeToRefs(storesPat);
const { userInfos } = storeToRefs(stores);
const router = useRouter()
const emit = defineEmits(["shuaxin"]);
const state = reactive({
    dialogTableVisible: false,
    tableData: {
        表名: 'SGA',
        初次调查日期: "",
        填表日期: '',
        更新日期: '',
        记录者: '陈银成',
        您目前体重: '',
        体重改变1: {
            type: '',
            input1: '',
        },
        体重改变2: {
            type: '',
            input1: '',
        },
        进食1: { type: '' },
        进食2: { type: '' },
        进食3: { type: '' },
        进食4: { type: '' },
        进食5: { type: '' },
        进食6: { type: '' },
        胃肠道症状: { type: '' },
        功能异常: {
            type: '',
            input1: '',
        },
        疾病和相关营养需求: {
            type: '',
            input1: '',
        },
        下眼皮: {
            type: '',
            input1: '',
        },
        二三头肌: {
            type: '',
            input1: '',
        },
        颞部: {
            type: '',
            input1: '',
        },
        锁骨: {
            type: '',
            input1: '',
        },
        肩: {
            type: '',
            input1: '',
        },
        肩胛骨: {
            type: '',
            input1: '',
        },
        骨间肌: {
            type: '',
            input1: '',
        },
        膝盖: {
            type: '',
            input1: '',
        },
        股四头肌: {
            type: '',
            input1: '',
        },
        腓肠肌: {
            type: '',
            input1: '',
        },
        水肿: {
            type: '',
            input1: '',
        },
        腹水: {
            type: '',
            input1: '',
        },
        结果:''
    },
    loading: false,
    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: 'SGA',
        surveryFormType: 1,
        updateTime: ''
    }
 
})
const sum = computed(() => {
    let a = 0
    let b=0
    let c=0
    const res={
        value:'',
        label:'',
        color:''
    }
    for (let key in state.tableData) {
        if (state.tableData[key]?.type==='A') {
            a++
        }else if(state.tableData[key]?.type==='B') {
            b++
        }else if(state.tableData[key]?.type==='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
}
const onSubmit = () => {
    console.log('submit!')
    console.log(state.tableData)
    state.tableData.结果=sum.value
    const info: tiaochabiaoInfo = {
        id: state.viewInfo.id,
        surveryFormType: 1,
        code: state.viewInfo.code,
        clientCode: userInfos.value.clientCode,
        patientCode: patientsInfo.value.code,
        surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
        surveryPerson: userInfos.value.code,
        surveryJsonBody: JSON.stringify(state.tableData),
        suveryFormName: 'SGA',
        updateTime: ''
    }
    console.log(info)
    if (info.id === 0) {
        Add(info).then(re => {
            console.log(re.data)
            state.dialogTableVisible = false
            emit('shuaxin')
        })
    } else if (info.id > 0) {
        info.surveryTime = state.viewInfo.surveryTime
        update(info).then(re => {
            console.log(re.data)
            state.dialogTableVisible = false
            emit('shuaxin')
        })
    }
 
}
// 第一步:定义子组件里面的方法
const getData = (str: string) => {
    console.log("子组件获取显示数据!" + str);
    state.loading = true
 
}
// 打开查看或者编辑明细
const openShow = (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()
        state.dialogTableVisible = true
    }
    else if (type === 'update') {
        console.log('------------------------3333333333333333')
        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 = {
        表名: 'SGA',
        初次调查日期: formatDate(new Date(), 'YYYY-mm-dd'),
        填表日期: '',
        更新日期: formatDate(new Date(), 'YYYY-mm-dd'),
        记录者: userInfos.value.userName,
        您目前体重: '',
        体重改变1: {
            type: '',
            input1: '',
        },
        体重改变2: {
            type: '',
            input1: '',
        },
        进食1: { type: '' },
        进食2: { type: '' },
        进食3: { type: '' },
        进食4: { type: '' },
        进食5: { type: '' },
        进食6: { type: '' },
        胃肠道症状: { type: '' },
        功能异常: {
            type: '',
            input1: '',
        },
        疾病和相关营养需求: {
            type: '',
            input1: '',
        },
        下眼皮: {
            type: '',
            input1: '',
        },
        二三头肌: {
            type: '',
            input1: '',
        },
        颞部: {
            type: '',
            input1: '',
        },
        锁骨: {
            type: '',
            input1: '',
        },
        肩: {
            type: '',
            input1: '',
        },
        肩胛骨: {
            type: '',
            input1: '',
        },
        骨间肌: {
            type: '',
            input1: '',
        },
        膝盖: {
            type: '',
            input1: '',
        },
        股四头肌: {
            type: '',
            input1: '',
        },
        腓肠肌: {
            type: '',
            input1: '',
        },
        水肿: {
            type: '',
            input1: '',
        },
        腹水: {
            type: '',
            input1: '',
        },
        结果:''
    }
    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: '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>
 
 
<style scoped lang="scss">
.gridtable {
    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;
    text-align: left;
    border-color: #666666;
    background-color: #a4b0e2;
}
 
.gridtable td {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    border-color: #666666;
    background-color: #ffffff;
}
</style>