import {
    Message
} from 'element-ui'


function enterEvent(to, from, next) {

    if (sessionStorage.getItem("patiensInfo")) {
        next() //调用next才会往下走
    } else {
        Message({
            message: "请先选择病人就诊",
            type: 'error',
            showClose: true
        })

        next({
            path: '/index/gangplank?path=' + '/index/todaypatients'
        })
    }
}


export default [{
    path: 'prescribing',
    name: 'prescribing',
    component: () => import('@/views/diagnosis/Prescribing.vue'),
    meta: {
        title: '智能开方',
        pftitle: '诊疗'
    },
    beforeEnter: enterEvent

}, {
    path: 'trunPage',
    name: 'trunPage',
    component: () => import('@/views/diagnosis/turnPage.vue'),
    meta: {
        title: '中转页面',
        pftitle: '诊疗'
    },


}, {
    path: 'emr',
    name: 'emr',
    component: () => import('@/views/diagnosis/Emr.vue'),
    meta: {
        title: '中医电子病历',
        pftitle: '诊疗'
    },
    beforeEnter: enterEvent
}, {
    path: 'diagnosis',
    name: 'diagnosis',
    component: () => import('@/views/diagnosis/Diagnosis.vue'),
    meta: {
        title: '诊断页',
        pftitle: '诊疗'
    },
    beforeEnter: enterEvent
}, {
    path: 'dialectical',
    name: 'dialectical',
    component: () => import('@/views/diagnosis/Dialectical.vue'),
    meta: {
        title: '智能辨证 ',
        pftitle: '诊疗',
        keeplive: true
    },
    beforeEnter: enterEvent
}, {
    path: 'dialecticalq',
    name: 'dialecticalq',
    component: () => import('@/views/diagnosis/DialecticalQ.vue'),
    meta: {
        title: '智能辨证问卷 ',
        pftitle: '诊疗'
    },
    beforeEnter: enterEvent
}, {
    path: 'physical',
    name: 'physical',
    component: () => import('@/views/diagnosis/Physical.vue'),
    meta: {
        title: '体质辨识管理',
        pftitle: '中医治未病'
    },
    // beforeEnter: enterEvent
}, {
    path: 'physicald',
    name: 'physicald',
    component: () => import('@/views/diagnosis/PhysicalD.vue'),
    meta: {
        title: '体质辨识明细',
        pftitle: '中医治未病'
    },
    // beforeEnter: enterEvent
}, {
    path: 'healthTrack',
    name: 'healthTrack',
    component: () => import('@/views/diagnosis/HealthTracking.vue'),
    meta: {
        title: '健康跟踪',
        pftitle: '中医治未病'
    },
    // beforeEnter: enterEvent
}, {
    path: 'questions',
    name: 'questions',
    component: () => import('@/views/diagnosis/Questions.vue'),
    meta: {
        title: '智能辨证问卷',
        pftitle: '中医治未病'
    },
    beforeEnter: enterEvent
}, {
    path: 'questionsr',
    name: 'questionsr',
    component: () => import('@/views/diagnosis/QuestionResult.vue'),
    meta: {
        title: '智能辨证问卷',
        pftitle: '中医治未病'
    },
    // beforeEnter: enterEvent
}, {
    path: 'physicalTotal',
    name: 'physicalTotal',
    component: () => import('@/views/diagnosis/PhysicalTotal.vue'),
    meta: {
        title: '中医体质统计与分析',
        pftitle: '中医治未病'
    },
    // beforeEnter: enterEvent
}]