From 81cb502e107b2feac5c329d534477063cf24d9cb Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期一, 24 二月 2025 16:36:23 +0800
Subject: [PATCH] 34

---
 src/views/home/components/patient_file.vue |  431 ++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 327 insertions(+), 104 deletions(-)

diff --git a/src/views/home/components/patient_file.vue b/src/views/home/components/patient_file.vue
index d6f68af..f230d60 100644
--- a/src/views/home/components/patient_file.vue
+++ b/src/views/home/components/patient_file.vue
@@ -1,81 +1,148 @@
 <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> 
+            <el-card class="box-card">
+                <div class="clearfix">
+                    <el-icon size="16" color="#409efc">
+                        <Briefcase />
+                    </el-icon> <span> &nbsp; 服务套餐</span>
                 </div>
                 <div>
-                   基础服务100套餐
-                   膳食套餐,
-                   体检套餐,
+                    <el-form  :inline="true" class="demo-form-inline">
+                        <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 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>身高:{{patientsInfo.patientHeight}}</td>
-                            <td>干体重:<span v-if="state.patientData.干体重">{{state.patientData.干体重}} (kg)</span></td>
-                            
+                            <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></td>
+
+
                         </tr>
                         <tr>
-                            <td>透析龄:<span v-if="patientsInfo.medHistoryStatByMonth">{{patientsInfo.medHistoryStatByMonth}} (月)</span></td>
-                          
-                            <td colspan="4">证件号:{{patientsInfo.patientIdentityNo}}</td>
-                            
+                            <td colspan="2">证件号:{{ patientsInfo.patientIdentityNo }}</td>
+                            <td>透析龄:<span v-if="patientsInfo.medHistoryStatByMonth">{{
+                                patientsInfo.medHistoryStatByMonth }}
+                                    (月)</span></td>
+                            <td>最近体重:<span>{{ state.patientData.上一次透前体重 }} (kg)</span></td>
+                            <td>BMI:<span>{{ BMI }}</span></td>
+
                         </tr>
                         <tr>
-                            <td >电话号码:{{patientsInfo.patientTelNo}}</td>
-                            <td >家属电话:{{patientsInfo.patientTelNoRelative}}</td>
-                            <td colspan="3">家庭地址:{{patientsInfo.patientAddress}}</td>
-                            
+                            <td>电话号码:{{ patientsInfo.patientTelNo }}</td>
+                            <td>家属电话:{{ patientsInfo.patientTelNoRelative }}</td>
+                            <td colspan="3">家庭地址:{{ patientsInfo.patientAddress }}</td>
+
                         </tr>
                         <tr>
-                            <td colspan="5">患者诊断:{{state.patientData.诊断}}</td>
+                            <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> 
+                <div class="clearfix">
+                    <el-icon size="16" color="#409efc">
+                        <CreditCard />
+                    </el-icon> <span> &nbsp; 最新生化数据</span>
                 </div>
-                <div >
-                    <el-row :gutter="10" v-if="state.listData.lis">
-
-                        <div v-for="(item, key) in state.listData.lis" :key="key">
-                            <div class="itemLis" v-if="item?.结果列表.length>0" >
-                                <div class="title">
-                                    {{key}}
-                                </div>
-                                <div  class="itemRes" v-for="(itemRes, resIndex) in item?.结果列表" :key="resIndex">
-                                    <div  class="itemResDtile" v-for="(tdKey, ttIndex) in formatResKeys(itemRes)" :key="ttIndex" >
-                                       <div>
-                                        {{ itemRes[tdKey].name }}
-                                       </div>
-                                       <div>
-                                        {{ itemRes[tdKey].result }}<span class="tdate">{{itemRes[tdKey].unit}}</span>
-                                       </div>
+                <el-scrollbar :height="(tableHeight-520)+'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>
+                                                {{ item?.item_result }}<span class="tdate">{{ item?.item_result_unit
+                                                    }}</span>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="tdate">
+                                        {{ item?.sample_date_str }}
+                                    </div>
+
                                 </div>
-                                <div  class="tdate" >
-                                    {{item?.结果列表[0]?.标本日期}}
-                                </div>
-                               
-                            </div>
-                          
-                        </div>
-                    </el-row>
-                </div>
+
+                            </el-col>
+                        </el-row>
+                    </div>
+                </el-scrollbar>
             </el-card>
-            
+
         </div>
         <el-empty v-else description="无数据,请先选择患者"></el-empty>
     </div>
@@ -87,9 +154,14 @@
 import { usePatientsInfo } from '/@/stores/patientsInfo';
 import { useUserInfo } from '/@/stores/userInfo';
 import { computed, onMounted, reactive } from 'vue';
-import { getPatData,getLisResults } from '/@/api/Patients';
+import { getPatData, getLisResults, update ,updateNurtion,listNurtion,AddNurtion} from '/@/api/Patients';
 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();
 
@@ -97,91 +169,233 @@
 const { userInfos } = storeToRefs(stores);
 const props = defineProps(['tableHeight'])
 const state = reactive({
+    formdispl:true,// 表单是否编辑
+    // 患者套餐表
+    taochanId:0,
+    taochan: {
+        基础服务: '',
+        自购几月: '',
+        多少元套餐: '',
+        自购多少盒: '',
+        产品名称: ''
+    },
     tableData: [],
     loading: false,
-    patientData:{
-        姓名:'',
-        干体重:'',
-        证件号:"",
-        诊断:'',
-        身高:''
+    patientData: {
+        姓名: '',
+        干体重: '',
+        证件号: "",
+        诊断: '',
+        身高: '',
+        上一次透前体重: '',
+        出院诊断:'',
     },
-    listData:<any>{}
+    listData: <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 getData = async (str: string) => {
     var pam = {
         patCode: patientsInfo.value.code,
     }
-    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 pam2 = {
+        clientCode: userInfos.value.clientCode,
+        patCode: patientsInfo.value.code,
+        date1: dayjs().add(-30, 'day').format('YYYY-MM-DD'),
+        date2: dayjs().format('YYYY-MM-DD'),
     }
-    try{
+    const pas3={
+        page: 0,
+        size: 0,
+        wherecondition:`patient_code='${patientsInfo.value.code}'`,
+    }
+    try {
         state.loading = true
-        const [res1,res2]=await Promise.all([
+        const [res1, res2,res3] = await Promise.all([
             getPatData(pam),
-            getLisResults(pam2)
+            getLisResults(pam2),
+            listNurtion(pas3)
         ])
-        state.patientData=res1.data
-        state.listData=res2.data
-        console.log('lis数据',state.listData)
+        state.patientData = res1.data
+        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){
+    catch (error) {
         state.loading = false
+        ElMessage.error('结果请求错误,请联系管理员!')
     }
-    // console.log("患者档案子组件获取显示数据!" + str);
-    // console.log(props.tableHeight)
-    // var pam = {
-    //     patCode: patientsInfo.value.code,
-    // }
-    // state.loading = true
-    // getPatData(pam).then(re=>{
-    //     console.log(re.data)
-    //     state.patientData=re.data
-    // })
-    
+
 }
-onMounted(()=>{
-    // console.log(dayjs().add(-7, 'day').format('YYYY-MM-DD'),'---shan')
-    if(state.listData.lis){
-        console.log('有意义------------------')
+// 刷新套餐
+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')
 })
 const formatResKeys = (obj: Object) => {
-	return Object.keys(obj).filter((k) => k !== '标本日期');
+    return Object.keys(obj).filter((k) => k !== '标本日期');
 };
 const formatResKeysDate = (obj: Object) => {
-	return Object.keys(obj).filter((k) => k === '标本日期');
+    return Object.keys(obj).filter((k) => k === '标本日期');
 };
 
 // 第二步:暴露方法
 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%;}
+<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 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{
+.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;
+    margin-top: -10px;
+    margin-bottom: 10px;
 }
 
-.itemLis{
-    min-width: 120px;
+.itemLis {
+    margin-bottom: 10px;
+    width: 100%;
     padding-left: 10px;
     padding-right: 10px;
     height: 100px;
@@ -192,35 +406,44 @@
     border-radius: 5px;
     text-align: center;
     margin-left: 10px;
-    .title{
+
+    .title {
         text-align: left;
         color: #909399;
         font-size: 13px;
         height: 20px;
         line-height: 20px;
     }
-    .itemRes{
+
+    .itemRes {
         height: 60px;
         flex: 1;
         display: flex;
         align-items: center;
         color: #303133;
         font-size: 16px;
-        div{
-            line-height: 30px;text-align: center; padding-left: 10px; padding-right: 10px;
+
+        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添加红色边框 */
+            border-left: 1px solid #909399;
+            /* 示例样式:为除第一个div外的所有div添加红色边框 */
         }
     }
-    .tdate{
+
+    .tdate {
         color: #909399;
         font-size: 13px;
         height: 20px;
         line-height: 20px;
     }
 }
-
-
 </style>

--
Gitblit v1.8.0