<template>
    <div class='h-full'>
        <!-- 公卫数据详情 -->
<!--        <GwDetail :info="detailInfo" v-if="showGw"/>-->
        <!-- 通用随访详情 -->
        <CurrencyFUDetail :id="detailInfo.relationId" :resident-id="residentId" v-if="showCommon"></CurrencyFUDetail>
        <!-- 专病随访详情 -->
<!--        <VisitDetail :id="detailInfo.relationId" :resident-id="residentId" :disease-type="diseaseType"  v-else-if="showFU"></VisitDetail>-->
        <!-- his -->
<!--        <HisDetail :info="detailInfo"  v-else-if="showHis"></HisDetail>-->
        <!-- 报卡随访详情 -->
        <CrsVisitDetail :relationUuid="detailInfo.relationUuid"   v-else-if="showCrs"></CrsVisitDetail>

        <!-- 专病随访详情 -->
        <SeparateFUDetail :relationId="detailInfo.relationId" v-else-if="showFU"></SeparateFUDetail>
    </div>
</template>

<script>
import { getVisitManageVByUuId } from '@/api/doctor/generalFU'
import CrsVisitDetail from '@/doctor/followUp/detail/components/CrsVisitDetail'
import CurrencyFUDetail from '@/doctor/followUp/generalFU/detail/Detail'
import IframePage from '@/components/iframePage/IframePage'
// 专病随访
import  SeparateFUDetail from '@/doctor/followUp/separateFU/detail/Index.vue'

export default {
    name: 'FollowUpDetail',
    components: { IframePage, CurrencyFUDetail, CrsVisitDetail, SeparateFUDetail },
    data() {
        return {
            detailInfo: {},
            showCommon: false,
            showFU: false,
            showHis: false,
            showCrs: false,
            showGw: false
        }
    },
    watch: {
        id: {
            handler() {
                this.load()
            },
            immediate: true
        }
    },
    computed: {
        relationUuid() {
            return this.$route.query.relationUuid
        },
        diseaseType() {
            return this.$route.query.diseaseType
        },
        residentId() {
            return this.$route.query.residentInfoId
        }
    },
    methods: {
        load() {
            let par = {
                relationUuid: this.relationUuid
            }
            getVisitManageVByUuId(par).then(res => {
                let record = res.data
                this.detailInfo = record
                // this.PhlIsShow(record)
                this.showFU = this.FUIsShow(record)
                this.showCommon = this.GAUIsShow(record)
                this.showHis = this.HisIsShow(record)
                this.showCrs = this.CrsIsShow(record)
            })
        },
        //判断是否是专病随访
        FUIsShow(record) {
            let res = false
            if ((record.serveType == 3 || (record.serveType == 4) && record.source != 4)) {
                res = true
            }
            return res
        },
        //判断是否是 通用随访
        GAUIsShow(record) {
            let res = false
            if (record.serveType == 5) {
                res = true
            }
            return res
        },
        //判断是否是his
        HisIsShow(record) {
            let res = false
            if (record.serveType == 1 || record.serveType == 2) {
                res = true
            }
            return res
        },
        //判断是否显示报卡随访
        CrsIsShow(record) {
            let res = false
            if (record.serveType == 6) {
                res = true
            }
            return res
        },
        //判断是否显示公卫随访
        PhlIsShow(record) {
            if (record.source == 4) {
                this.$router.push({
                    path: `/systemIframe/doctorGWDetail`,
                    query: {
                        src: `https://www.baidu.com/`,
                        pageTitle: `公卫详情`
                    }
                })
            }
        }
    }
}
</script>

<style scoped lang='less'>

</style>