chenyc
2024-08-21 59ba223820054f296191f581bd413f5b9cff9e7f
src/views/home/index.vue
@@ -1,7 +1,7 @@
<template>
   <div class="home-container layout-pd ">
        <el-row :gutter="15" >
            <el-col :span="4"  class="patTabel">
            <el-col :xs="8" :sm="6" :md="4" :lg="3" class="patTabel">
                <el-table :data="state.filterTableData" 
                stripe 
                :height="state.tableHeight.left"
@@ -13,7 +13,6 @@
                        <template #header>
                            <div class="home-title">
                                    <el-avatar shape="square" style="width: 16px; height: 16px;background-color: #ffffff;margin-right: 10px;margin-left: 10px;" fit="contain" :src="huanzheliebiao" />
                                    <div class="titleHome">患者列表</div>
                            </div>
                            <el-input size="default"  @change="getPatients"  v-model="state.search" placeholder="支持模糊查询"  :prefix-icon="Search"/>
@@ -28,7 +27,7 @@
                    </el-table-column>
                </el-table>
            </el-col>
            <el-col :span="20" class="detailRight">
            <el-col :xs="14" :sm="18" :md="20" :lg="21" class="detailRight">
                <el-tabs v-model="state.activeName" class="demo-tabs" @tab-click="handleClick">
                    <el-tab-pane label="患者档案" name="患者档案">
                        <template #label>
@@ -37,7 +36,7 @@
                                <span style="margin-left: 5px">患者档案</span>
                            </span>
                        </template>
                        患者档案
                        <patientFile :tableHeight="state.tableHeight.detailRight"  ref="patientFileRef"></patientFile>
                    </el-tab-pane>
                    <el-tab-pane label="生化数据" name="生化数据">
                        <template #label>
@@ -46,7 +45,7 @@
                                <span style="margin-left: 5px">生化数据</span>
                            </span>
                        </template>
                        Config
                        <lisUi ref="lisUiRef"></lisUi>
                    </el-tab-pane>
                    <el-tab-pane label="用药记录" name="用药记录">
                        <template #label>
@@ -55,7 +54,7 @@
                                <span style="margin-left: 5px">用药记录</span>
                            </span>
                        </template>
                        Role
                        <MedicationRecords :tableHeight="state.tableHeight.detailRight" ref="MedicationRecordsRef"></MedicationRecords>
                    </el-tab-pane>
                    <el-tab-pane label="历史服务" name="历史服务">
                        <template #label>
@@ -73,7 +72,7 @@
                                <span style="margin-left: 5px">膳食调查</span>
                            </span>
                        </template>
                        Task
                        <dietarySurvey></dietarySurvey>
                    </el-tab-pane>
                    <el-tab-pane label="营养筛查评估" name="营养筛查评估">
                        <template #label>
@@ -105,6 +104,11 @@
                </el-tabs>
            </el-col>
        </el-row>
        <div class="fixed-div" v-show="patientsInfo.patientName">
            <el-avatar :size="80" :src="patientsInfo.patientAvatarIcon" />
            <div>{{patientsInfo.patientName}}</div>
        </div>
   </div>
</template>
@@ -114,17 +118,31 @@
import {QueryList} from '/@/api/Patients'
import { storeToRefs } from 'pinia';
import { useUserInfo } from '/@/stores/userInfo';
import { usePatientsInfo } from '/@/stores/patientsInfo';
const stores = useUserInfo();
const storesPat = usePatientsInfo();
const { userInfos } = storeToRefs(stores);
const { patientsInfo } = storeToRefs(storesPat);
import { ElLoading, TabsPaneContext } from 'element-plus'
import { Search } from '@element-plus/icons-vue'
// 用药记录
import MedicationRecords from './components/Medication_records.vue'
// 膳食调查
import dietarySurvey from './components/dietary_survey.vue'
// 患者档案
import patientFile from './components/patient_file.vue'
// 化验结果
import lisUi from './components/lis_.ui.vue'
interface User {
    code:string,
    patientName: string
    patientGenderText: string
    age: string
}
const MedicationRecordsRef=ref()
const patientFileRef=ref()
const currentRow=ref()
const lisUiRef=ref()
const state = reactive({
   global: {
      homeChartOne: null,
@@ -132,23 +150,7 @@
      homeCharThree: null,
      dispose: [null, '', undefined],
   } as any,
    filterTableData:[
        {
            name: '张山',
            sex: '男',
            age: '12',
        },
        {
            name: '张山二',
            sex: '男',
            age: '12',
        },
        {
            name: '王二小',
            sex: '男',
            age: '12',
        },
    ],
    filterTableData:[],
    activeName:'患者档案',
    tableHeight:{
        left:0,
@@ -160,9 +162,17 @@
    setTableHeight()
    getPatients()
})
const handleCurrentChange = (val: User | undefined) => {
  currentRow.value = val
const handleCurrentChange = (val: any | undefined) => {
    console.log('-----------------333')
    console.log(val)
    if(val){
        currentRow.value = val
        //缓存到vuex 中
        storesPat.setPatientsInfo(val)
        getTabsData()
    }
}
/**获取患者列表 */
const getPatients=()=>{
    const loading = ElLoading.service({
        lock: true,
@@ -175,11 +185,19 @@
        wherecondition:`client_code="${userInfos.value.clientCode}" and (patient_name like "%${state.search.toLowerCase()}%"
        OR patient_name_py like "%${state.search.toLowerCase()}%")`
    }
    storesPat.setPatientsInfo({
      id: '',
      code: '',
      age: 0,
      patientName: '',
      patientGenderText: '',
      patientAvatarIcon: ''
    })
    QueryList(ps).then(res=>{
        console.log('----------------患者--------')
        console.log(res.data)
        state.filterTableData=res.data.list
    }).finally(e=>{
    }).finally(()=>{
        loading.close()
    })
}
@@ -198,7 +216,21 @@
};
/** 切换明细tabs*/
const handleClick=(tab: TabsPaneContext, event: Event)=>{
    console.log(tab, event)
    alert('1')
    state.activeName=tab.paneName as string
    getTabsData()
}
/** 获取明细项数据 */
const getTabsData=()=>{
    if(MedicationRecordsRef.value&&patientsInfo.value.id){
        if(state.activeName==='用药记录'){
            MedicationRecordsRef.value.getData()
        }else if(state.activeName==='患者档案'){
            console.log(patientFileRef.value)
            patientFileRef.value.getData()
        }
    }
}
</script>
@@ -242,6 +274,26 @@
.detailRight{
    background-color: #ffffff;
}
.fixed-div {
    position: fixed;
    flex: 1;
    display: flex;
    align-items: center;
    bottom: 10px;
    right: 30px;
    width: 200px;
    height: 100px;
    background-color:#ffffff;
    color: rgb(16, 3, 3);
    padding: 10px;
    z-index: 999;
    div{
        font-weight: 800;
        margin-left: 10px;
        font-size: 20px;
    }
  }
</style>