chenyc
2025-06-13 52c88b72d655c40f5c883e496c777906211caa2f
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
<template>
    <div class="dietarySurvey-home">
        <div v-if="patientsInfo.id" v-loading="state.loading">
            <el-card class="box-card">
                <div class="clearfix">
                    <el-icon size="16" color="#409efc">
                        <Briefcase />
                    </el-icon> <span> &nbsp; 服务套餐</span>
                </div>
                <div>
                    <el-form  :inline="true" class="demo-form-inline" size="small">
                        <el-form-item label="基础服务:">
                            <el-radio-group class="elradiozdi" :disabled="state.formdispl" v-model="state.taochan.基础服务">
                                <el-radio value="是">是</el-radio>
                                <el-radio value="否">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="自购套餐:" >
                            <el-row>
                                <el-col :span='12'>
                                    <el-input v-model="state.taochan.自购几月" :disabled="state.formdispl" placeholder="购买多少个月">
                                        <template #append>月</template>
                                    </el-input>
                                </el-col>
                                <el-col :span='12'>
                                    <el-input v-model="state.taochan.多少元套餐" :disabled="state.formdispl" placeholder="套餐金额">
                                        <template #append>元</template>
                                    </el-input>
                                </el-col>
                            </el-row>
                        </el-form-item>
                        <el-form-item label="自购产品名称">
                            <el-row>
                                <el-col :span='12'>
                                    <el-input v-model="state.taochan.产品名称" :disabled="state.formdispl" placeholder="产品名称"></el-input>
                                </el-col>
                                <el-col :span='12'>
                                    <el-input v-model="state.taochan.自购多少盒" :disabled="state.formdispl" placeholder="数量">
                                        <template #append>盒</template>
                                    </el-input>
                                </el-col>
                            </el-row>
 
                        </el-form-item>
                        <el-form-item>
                            <el-button v-if="state.formdispl" type="primary" :icon="Edit" @click="state.formdispl=false">编辑</el-button>
                            <el-button v-else type="success" :icon="Check" @click="onSubmitTC" >保存</el-button>
                        </el-form-item>
 
                    </el-form>
                   
                </div>
            </el-card>
            <el-card class="box-card" style="margin-top:10px;">
                <div class="clearfix">
                    <el-icon size="16" color="#409efc">
                        <CreditCard />
                    </el-icon> <span> &nbsp; 患者基本信息</span>
                </div>
                <div>
                    <table class="gridtable">
                        <tr>
                            <td>姓名:{{ patientsInfo.patientName }}</td>
                            <td>年龄:<span v-if="patientsInfo.age">{{ patientsInfo.age }} 岁</span></td>
                            <td>性别:{{ patientsInfo.patientGenderText }}</td>
                            <td>身高:{{ state.patientData.身高 }} <span v-if="state.patientData.身高">(cm)</span>
 
                                <span>
                                    <el-icon :size="14" color="#409EFF" @click="updateSg">
                                        <Edit />
                                    </el-icon>
                                </span>
                            </td>
                            <td>干体重:<span>{{ state.patientData.干体重 }} (kg)</span>
                                <el-icon :size="14" color="#409EFF" @click="state.gtzshow=true">
                                    <Calendar />
                                </el-icon>
                            </td>
 
 
                        </tr>
                        <tr>
                            <td colspan="2">证件号:{{ state.patientData.证件号 }}</td>
                            <td>透析龄:<span>{{透析年龄}}</span></td>
                            <td>最近体重:<span>{{ state.patientData.上一次透前体重 }} (kg)</span></td>
                            <td>BMI:<span>{{ BMI }}</span></td>
 
                        </tr>
                        <tr>
                            <td>电话号码:{{ state.patientData.电话号码 }}</td>
                            <td>家属电话:{{ state.patientData.亲属手机号 }}</td>
                            <td colspan="3">家庭地址:{{ state.patientData.家庭住址 }}</td>
 
                        </tr>
                        <tr>
                            <td colspan="5">患者诊断:{{ state.patientData.诊断 }}</td>
                        </tr>
                        <tr>
                            <td colspan="5">外院出院诊断:{{ state.patientData.出院诊断 }} 
                                <span>
                                    <el-icon :size="14" color="#409EFF" @click="updateZD">
                                        <Edit />
                                    </el-icon>
                                </span>
                                </td>
                        </tr>
                    </table>
                </div>
            </el-card>
            <el-card class="box-card" style="margin-top:10px;">
                <div class="clearfix">
                    <el-icon size="16" color="#409efc">
                        <CreditCard />
                    </el-icon> <span> &nbsp; 最新生化数据 <span style="color: #606266; font-size: 80%;font-weight: 200;">(90天以内的)</span></span>
                </div>
                <el-scrollbar :height="(tableHeight-820)+'px'">
                    <div>
                        <el-row :gutter="10" v-if="state.listData.length">
                            <el-col :xs="8" :sm="8" :md="6" :lg="6" :xl="4" v-for="(item, key) in state.listData"
                                :key="key">
                                <div class="itemLis" v-if="item?.item_result">
                                    <!-- <div class="title">
                                        {{ key }}
                                    </div> -->
                                    <div class="itemRes">
                                        <div class="itemResDtile">
                                            <div style="text-align: center;width: 100%;">
                                                {{ item?.item_name }}
                                            </div>
                                            <div>
                                              <span style="font-weight: 600;" :style="{ color:item.item_result_flag==='d'?'#409EFF':'#F56C6C'}">{{ item?.item_result }}</span> 
                                             <span class="tdate">{{ item?.item_result_unit
                                                    }}</span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="tdate">
                                        {{ item?.sample_date_str }}
                                    </div>
 
                                </div>
 
                            </el-col>
                        </el-row>
                    </div>
                </el-scrollbar>
            </el-card>
            <el-card class="box-card" style="margin-top:10px;">
                <div class="clearfix">
                    <el-icon size="16" color="#409efc">
                        <CreditCard />
                    </el-icon> <span> &nbsp; 最近营养筛查评估 <span style="color: #606266; font-size: 80%;font-weight: 200;">(90天以内的)</span></span>
                </div>
                <el-scrollbar :height="(tableHeight-820)+'px'">
                    <div>
                        <el-row :gutter="10" v-if="state.营养筛查历史表.length">
                            <el-col :xs="8" :sm="8" :md="6" :lg="6" :xl="4" v-for="(item, key) in state.营养筛查历史表"
                                :key="key">
                                <div class="itemLis">
                                    <div class="title">
                                        {{ item?.结果.表名 }}
                                    </div>
                                    <div class="itemRes">
                                        <div class="itemResDtile">
                                           
                                            <div>
                                              <span style="font-weight: 600;" :style="{ color:item?.结果.结果.color}">{{ item?.结果.结果.label }}</span> 
                                                <span class="tdate"> 得分:{{ item?.结果.结果.value}}</span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="tdate">
                                        {{ item?.surveryTime }}
                                    </div>
 
                                </div>
 
                            </el-col>
                        </el-row>
                    </div>
                </el-scrollbar>
            </el-card>
 
        </div>
        <el-empty v-else description="无数据,请先选择患者"></el-empty>
        <el-dialog v-model="state.gtzshow" title="干体重历史调整记录" width="800px">
            <el-table  :data="state.gtztableData" height="300" >
                    <el-table-column align="center" prop="createTime"  label="时间"  width="180" />  
                    <el-table-column align="center" prop="pureWeight" label="干体重"  />
                    <el-table-column align="center" label="启用时间">
                        <template #default="scope">
                            <span v-if="scope.row.enableRecordTime">{{scope.row.enableRecordTime.substring(0,11)}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" prop="remark"  label="备注" />
                  
                </el-table>
        </el-dialog>
    </div>
 
</template>
 
<script setup lang="ts">
import { storeToRefs } from 'pinia';
import { usePatientsInfo } from '/@/stores/patientsInfo';
import { useUserInfo } from '/@/stores/userInfo';
import { computed, onMounted, reactive } from 'vue';
import { getPatData, getLisResults, update ,updateNurtion,listNurtion,AddNurtion,getDryWeightList} from '/@/api/Patients';
import {list} from '/@/api/tiaochabiao/index'
import { userInfo } from 'os';
import { Search ,Edit,Check} from '@element-plus/icons-vue'
import dayjs from 'dayjs';
import { ElMessage, ElMessageBox } from 'element-plus';
 
import { number } from 'echarts';
import { rowKey } from 'element-plus/es/components/table-v2/src/common';
const storesPat = usePatientsInfo();
const stores = useUserInfo();
 
const { patientsInfo } = storeToRefs(storesPat);
const { userInfos } = storeToRefs(stores);
const props = defineProps(['tableHeight'])
const state = reactive({
    gtztableData:[],
    gtzshow:false,
    formdispl:true,// 表单是否编辑
    // 患者套餐表
    taochanId:0,
    taochan: {
        基础服务: '',
        自购几月: '',
        多少元套餐: '',
        自购多少盒: '',
        产品名称: ''
    },
    tableData: [],
    loading: false,
    patientData: {
        姓名: '',
        干体重: '',
        证件号: "",
        诊断: '',
        身高: '',
        上一次透前体重: '',
        出院诊断:'',
        '透析龄(月)':''
    },
    // 最近检验数据
    listData: <any>{},
    营养筛查历史表:<any>[]
})
const tableHe = computed(() => {
    return props.tableHeight - 130
})
const onSubmitTC=()=>{
    const data={
        id:state.taochanId,
        patient_code:patientsInfo.value.code,
        plan_json_body:JSON.stringify(state.taochan)
    }
    if(state.taochanId){
        state.loading = true
        updateNurtion(data).then(re=>{
            getlistNurtion()
        }).finally(()=>{
            state.formdispl=true
            state.loading = false
        })
    }else{
        state.loading = true
        AddNurtion(data).then(re=>{
            getlistNurtion()
        }).finally(()=>{
            state.formdispl=true
            state.loading = false
        })
    }
}
const updateZD=()=>{
    ElMessageBox.prompt('请输入你要编辑的外院出院诊断', '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        inputValue: state.patientData.出院诊断,
    })
        .then(({ value }) => {
            const params = {
                id: patientsInfo.value.id,
                outDiagnoseFromPrevHospital: value
            }
            update(params).then(re => {
                getPatData({ patCode: patientsInfo.value.code, }).then(res => {
                    state.patientData = res.data
                })
            })
        })
        .catch(() => {
            ElMessage({
                type: 'info',
                message: '取消修改',
            })
        })
}
/**打开修改身高 */
const updateSg = () => {
    ElMessageBox.prompt('请输入你要修改的身高单位cm', '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        inputValue: state.patientData.身高,
    })
        .then(({ value }) => {
            const params = {
                id: patientsInfo.value.id,
                patientHeight: value
            }
            update(params).then(re => {
                getPatData({ patCode: patientsInfo.value.code, }).then(res => {
                    state.patientData = res.data
                })
            })
        })
        .catch(() => {
            ElMessage({
                type: 'info',
                message: '取消修改',
            })
        })
}
 
const BMI = computed(() => {
    if (state.patientData.干体重 && state.patientData.身高) {
        return (Number(state.patientData.干体重) / (Number(state.patientData.身高) / 100 * Number(state.patientData.身高) / 100)).toFixed(2)
    } else {
        return ''
    }
})
const 透析年龄=computed(() => {
    if (state.patientData['透析龄(月)']) {
        const nian=Math.floor(Number(state.patientData['透析龄(月)']) / 12)===0?'':Math.floor(Number(state.patientData['透析龄(月)']) / 12)+'年'
        const yue=(Number(state.patientData['透析龄(月)']) % 12)===0?'':Number(state.patientData['透析龄(月)']) % 12+'月'
        return  nian +yue
    } else {
        return ''
    }
})
// 第一步:定义子组件里面的方法
const getData = async (str: string) => {
    var pam = {
        patCode: patientsInfo.value.code,
    }
    const pam2 = {
        clientCode: userInfos.value.clientCode,
        patCode: patientsInfo.value.code,
        date1: dayjs().add(-90, 'day').format('YYYY-MM-DD'),
        date2: dayjs().format('YYYY-MM-DD'),
    }
    const pas3={
        page: 0,
        size: 0,
        wherecondition:`patient_code='${patientsInfo.value.code}'`,
    }
    const pasm={
        page: 0,
        size: 0,
        wherecondition:`survery_form_type=1 and patient_code='${patientsInfo.value.code}'`,
        ordercondition: 'survery_time desc'
    }
    pasm.wherecondition+=` and survery_time BETWEEN '${dayjs().add(-90, 'day').format('YYYY-MM-DD')} 00:00:00' AND '${dayjs().format('YYYY-MM-DD')} 23:59:59'`
    
    try {
        state.loading = true
        getGtzList()
        const [res1, res2,res3,res4] = await Promise.all([
            getPatData(pam),
            getLisResults(pam2),
            listNurtion(pas3),
            list(pasm) //查询评估表
        ])
        state.patientData = res1.data
        state.listData=[]
        console.log('赋值患者信息',state.patientData)
        // 赛选异常的值
        res2.data.forEach(e=>{
            if(e.item_result_flag!=='z'){
                state.listData.push(e)
            }
        })
        state.营养筛查历史表=[]
        state.营养筛查历史表=res4.data.list.map(e=>{
            e.结果=JSON.parse(e.surveryJsonBody)
            return e
        })
        console.log(state.营养筛查历史表)
        console.log('--------------------')
        // state.listData = res2.data
        if(res3.data?.list.length>=1){
            const row=res3.data.list[0]
            console.log('taochanshuju----',row)
            state.taochanId=row.id
            state.taochan=JSON.parse(row.planJsonBody)
        }else{
            state.taochanId=0
            state.taochan={
                基础服务: '',
                自购几月: '',
                多少元套餐: '',
                自购多少盒: '',
                产品名称: ''
            }
        }
        console.log('lis数据', state.listData)
        state.loading = false
    }
    catch (error) {
        state.loading = false
        ElMessage.error('结果请求错误,请联系管理员!')
    }
 
}
const getGtzList=()=>{
    var data = {
    wherecondition: `patient_code = '${patientsInfo.value.code}'`,
    ordercondition: 'create_time desc'
    }
    getDryWeightList(data).then((res:any) => {
        state.gtztableData = res.data.list
    }).finally(()=>{
        
    })
}
// 刷新套餐
const getlistNurtion=()=>{
    const pas3={
        page: 0,
        size: 0,
        wherecondition:`patient_code='${patientsInfo.value.code}'`,
    }
    listNurtion(pas3).then(res3=>{
        if(res3.data.list&&res3.data.list>=1){
            const row=res3.data.list[0]
            state.taochanId=row.id
            state.taochan=JSON.parse(row.planJsonBody)
        }else{
            state.taochanId=0
        }
    })
}
 
onMounted(() => {
    // console.log(dayjs().add(-7, 'day').format('YYYY-MM-DD'),'---shan')
})
 
 
// 第二步:暴露方法
defineExpose({ getData })
</script>
 
<style lang="scss">
.gridtable {
    font-family: verdana, arial, sans-serif;
    font-size: 14px;
    color: #333333;
    border-width: 1px;
    border-color: #666666;
    border-collapse: collapse;
    width: 100%;
}
 
.gridtable th {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    border-color: #666666;
    background-color: #dedede;
}
 
.gridtable td {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    border-color: #666666;
    background-color: #ffffff;
}
 
.clearfix {
    font-weight: 800;
    flex: 1;
    height: inherit;
    display: flex;
    align-items: center;
    margin-top: -10px;
    margin-bottom: 10px;
}
 
.itemLis {
    margin-bottom: 10px;
    width: 100%;
    padding-left: 10px;
    padding-right: 10px;
    height: 100px;
    // margin-top: 10px;
    // line-height: 33px;
    border: 1px solid #c7c9cd;
    border-left: 3px solid #409EFF;
    border-radius: 5px;
    text-align: center;
    margin-left: 10px;
 
    .title {
        text-align: left;
        color: #909399;
        font-size: 13px;
        height: 20px;
        line-height: 20px;
    }
 
    .itemRes {
        height: 60px;
        flex: 1;
        display: flex;
        align-items: center;
        color: #303133;
        font-size: 16px;
 
        div {
            width: 100%;
            line-height: 30px;
            text-align: center;
            padding-left: 10px;
            padding-right: 10px;
        }
 
        .itemResDtile:not(:first-child) {
            width: 100%;
            /* 在这里添加你想要的样式 */
            border-left: 1px solid #909399;
            /* 示例样式:为除第一个div外的所有div添加红色边框 */
        }
    }
 
    .tdate {
        color: #909399;
        font-size: 13px;
        height: 20px;
        line-height: 20px;
    }
}
</style>