gx
chenyc
2024-10-17 0f841407b944d53a8bde7398004954d734b34427
src/views/home/components/patient_file.vue
@@ -8,7 +8,50 @@
                    </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>
                    基础服务:
                    <span>
                    </span>
                    膳食套餐,
                    体检套餐,
                </div>
@@ -40,7 +83,7 @@
                        <tr>
                            <td colspan="2">证件号:{{ patientsInfo.patientIdentityNo }}</td>
                            <td>透析龄:<span v-if="patientsInfo.medHistoryStatByMonth">{{
                                patientsInfo.medHistoryStatByMonth }}
            patientsInfo.medHistoryStatByMonth }}
                                    (月)</span></td>
                            <td>最近体重:<span>{{ state.patientData.上一次透前体重 }} (kg)</span></td>
                            <td>BMI:<span>{{ BMI }}</span></td>
@@ -105,12 +148,14 @@
import { usePatientsInfo } from '/@/stores/patientsInfo';
import { useUserInfo } from '/@/stores/userInfo';
import { computed, onMounted, reactive } from 'vue';
import { getPatData, getLisResults,update } from '/@/api/Patients';
import { getPatData, getLisResults, update ,updateNurtion,listNurtion,AddNurtion} from '/@/api/Patients';
import { userInfo } from 'os';
import { Search } from '@element-plus/icons-vue'
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();
@@ -118,7 +163,16 @@
const { userInfos } = storeToRefs(stores);
const props = defineProps(['tableHeight'])
const state = reactive({
    formdispl:true,// 表单是否编辑
    // 患者套餐表
    taochanId:0,
    taochan: {
        基础服务: '',
        自购几月: '',
        多少元套餐: '',
        自购多少盒: '',
        产品名称: ''
    },
    tableData: [],
    loading: false,
    patientData: {
@@ -134,20 +188,44 @@
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 updateSg = () => {
    ElMessageBox.prompt('请输入你要修改的身高单位cm', '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        inputValue:state.patientData.身高,
        inputValue: state.patientData.身高,
    })
        .then(({ value }) => {
            const params={
                id:patientsInfo.value.id,
                patientHeight:value
            const params = {
                id: patientsInfo.value.id,
                patientHeight: value
            }
            update(params).then(re=>{
                getPatData({ patCode: patientsInfo.value.code,}).then(res=>{
            update(params).then(re => {
                getPatData({ patCode: patientsInfo.value.code, }).then(res => {
                    state.patientData = res.data
                })
            })
@@ -162,7 +240,7 @@
const BMI = computed(() => {
    if (state.patientData.干体重 && state.patientData.身高) {
        return (Number(state.patientData.干体重) / (Number(state.patientData.身高)/100 * Number(state.patientData.身高)/100)).toFixed(2)
        return (Number(state.patientData.干体重) / (Number(state.patientData.身高) / 100 * Number(state.patientData.身高) / 100)).toFixed(2)
    } else {
        return ''
    }
@@ -178,14 +256,35 @@
        date1: dayjs().add(-30, 'day').format('YYYY-MM-DD'),
        date2: dayjs().format('YYYY-MM-DD'),
    }
    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
        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
    }
@@ -195,6 +294,23 @@
    }
}
// 刷新套餐
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')
})