(function(){ Vue.component('right-panel', { template: '
\
\

{{diseaseTitle}}

\
\
\ 高血压\
\
\ 糖尿病\
\
\
\
\ \
\

{{data.statistics ? data.statistics.year : 0}}

\ 患病年数\
\
\
\ \
\

{{data.statistics ? data.statistics.eventSize : 0}}

\ 就诊次数\
\
\
\ \
\

{{data.statistics ? data.statistics.times : 0}}

\ 住院次数\
\
\
\

{{data.drugs || "无"}}

\

常用药物

\
\
\

就诊事件

\
\
\
\
{{event.year}}
\
\
{{item.date}}
\
\
\ {{item.eventType | getEventTypeName}}{{item.orgName}}\
\
\
\
\
\
\ \
\
暂无相关就诊数据
\
\
\
\

指标分析

\

{{content}}

\
\
', props: ['patient'], data: function() { return { data: {}, eventList: [], hasEventList: true, diseaseTitle: "", typeLength: 1, selectedType: 1, // 1-糖尿病, 2-高血压 content: "" } }, mounted: function() { var vm = this; initEventOnBus(vm); }, methods: { chooseTab: function(type){ var vm = this; this.selectedType = type; getEventList(vm); //控制左下角区域的数据显示 EventBus.$emit('show-disease-zhibiao', {type: type}); //控制图标数据显示 EventBus.$emit("get-chart-data", { type: type, // dateType: 1, //初始时值为1 gi_type: type == 2 ? 0 : 1 //血糖默认获取1周的时间 }); } }, filters:{ getEventTypeName: function(val){ switch(parseInt(val)){ case 1: return "门诊 | "; break; case 2: return "住院 | "; break; case 3: return "体检 | "; break; } } } }); function initEventOnBus(vm){ EventBus.$on('get-disease-info', function (arg) { vm.typeLength = arg.length; var type = arg.type; vm.selectedType = type; if(type == 2){ vm.diseaseTitle = "高血压"; }else if(type == 1){ vm.diseaseTitle = "糖尿病"; } getEventList(vm); }); //指标分析数据显示 EventBus.$on("get-zhibiao-analysis", function(arg){ vm.content = arg.content; }); } function getEventList(vm){ var params = { patient: vm.patient, type: vm.selectedType, page: 1, pageSize: 1000 }; patientAPI.getZYinfo(params).then(function(res){ if(res.status == 200){ vm.data = res.data; if(res.data.list.length > 0){ vm.hasEventList = true; }else{ vm.hasEventList = false; } var list = _.map(res.data.list, function(o){ var year = o.eventDate.substr(0,4); o.year = parseInt(year); var date = o.eventDate.substr(5,5); o.date = date; return o; }); var list2 = _.groupBy(list, "year"); var list3 = []; for(year in list2){ var item = list2[year]; list3.push({ year: year, list: item }); } list3.reverse(); vm.eventList = list3; }else{ vm.hasEventList = false; console.log(res.msg); } }) } })()