<template>
    <div>
        <van-nav-bar title='新增通用随访' left-text='' left-arrow>
        </van-nav-bar>
        <div class='p-4 h-overflow'>
            <base-info :info="resident"></base-info>
        </div>
    </div>
</template>

<script>
import BaseInfo from '@/doctor/followUp/generalFU/form/BaseInfo'
import { fetchCurrencyById, getChronicResidentsId } from '@/api/doctor/generalFU'

export default {
    name: 'Index',
    components: { BaseInfo },
    data() {
        return {
            info: {},
            resident: {}
        }
    },
    created() {
        // this.init()
    },
    computed: {
        routerDetail() {
            return this.$route.query
        }
    },
    methods: {
        async init() {
            const res = await getChronicResidentsId(this.routerDetail.residentId)
            this.resident = {
                ...res.data,
                residentInfoId: this.routerDetail.residentId
            }
            this.info = {}
            this.info.residentInfoId = this.routerDetail.residentId
            this.info.gender = this.resident.gender;
            this.info.currentAge = this.resident.currentAge;
            this.info.genderName = this.resident.genderName;
            this.info.diseaseType = this.routerDetail.diseaseType
            if (this.routerDetail.id) {
                const res = await fetchCurrencyById({ id: this.routerDetail.id })
                let result = res.data || {}
                this.info = {
                    ...result
                }
            }
        }
    }
}
</script>

<style scoped lang='less'>
:deep(.van-nav-bar .van-icon) {
    color: #000000;
}
.h-overflow {
    height: calc(100vh - 60px);
    overflow-y: auto;
}
</style>