| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371 | 
							- new Vue({
 
- 	el: '#main',
 
- 	data: {
 
- 		roles: [],
 
- 		selectedRole: "",
 
- 		isopen: true,
 
- 		signAnalysis: [{
 
- 			photo: '../../../images/qianyujingzhan_icon.png',
 
- 			label: '签约进展',
 
- 			url: 'sign-progress.html',
 
-             allowArea:"",
 
- 		}, {
 
- 			photo: '../../../images/xuqianjingzhan_icon.png',
 
- 			label: '续签进展',
 
- 			url: 'renew-progress.html',
 
-             allowArea:"",
 
- 		}, {
 
- 			photo: '../../../images/jumingfenxi_icon.png',
 
- 			label: '居民分析',
 
- 			url: 'resident-analysis.html',
 
-             allowArea:"",
 
- 		}, {
 
- 			photo: '../../../images/jiankangguanli_icon.png',
 
- 			label: '健康管理',
 
- 			url: 'health-management-analysis.html',
 
-             allowArea:"",
 
- 		},{
 
- 			photo: '../../../images/tuigaiqian_icon.png',
 
- 			label: '退改签',
 
- 			url: 'change-back.html',
 
-             allowArea:"",
 
- 		}, {
 
- 			photo: '../../../images/lianglvfenxi_icon.png',
 
- 			label: '两率分析',
 
- 			url: 'two-rate-analysis.html',
 
-             allowArea:"",
 
- 		}],
 
- 		serviceAnalysis: [{
 
- 			photo: '../../../images/zongtifenxi_icon.png',
 
- 			label: '总体分析',
 
- 			url: 'comprehensive-analysis.html',
 
-             allowArea:"",
 
- 		}, {
 
- 			photo: '../../../images/zixunfenxi_icon.png',
 
- 			label: '咨询分析',
 
- 			url: 'consulting-analysis.html',
 
-             allowArea:"",
 
- 		}, {
 
- 			photo: '../../../images/pijianfenxi_icon.png',
 
- 			label: '评价分析',
 
- 			url: 'estimate-analysis.html',
 
-             allowArea:"",
 
- 		}, {
 
- 			photo: '../../../images/changcufangfenxi_icon.png',
 
- 			label: '长处方分析',
 
- 			url: 'prescription-analysis.html',
 
- 			allowArea:"",
 
- 		},{
 
- 			photo: '../../../images/zhufufenxi_icon_pc.png',
 
- 			label: '祝福分析',
 
- 			url: 'blessing-analysis.html',
 
- 			allowArea:"",	
 
- 		},
 
- 		 {
 
- 			photo: '../../../images/shangmenfuwu_icon.png',
 
- 			label: '上门服务',
 
- 			url: 'smfw-analysis.html',
 
- 			allowArea:"",
 
- 		},
 
- 		 {
 
- 			photo: '../../../images/shaichafenxin_icon.png',
 
- 			label: '筛查分析',
 
- 			url: 'jbsc-analysis.html',
 
- 			allowArea:"",
 
- 		},
 
- 		 {
 
- 			photo: '../../../images/zhuanbingfenxi_icon.png',
 
- 			label: '专病分析',
 
- 			url: 'special-analysis.html',
 
- 			allowArea:"",
 
- 		},
 
- 		],
 
- 		signRateData: {
 
- 		    signTask: {
 
- 		        text: '',
 
- 		        rate: '0.00',
 
- 		        sign: 0,
 
- 		        people: 0
 
- 		    },
 
- 		    sign: {
 
- 		        text: '',
 
- 		        rate: '0.00',
 
- 		        sign: 0,
 
- 		        people: 0
 
- 		    },
 
- 		    renew: {
 
- 		        text: '',
 
- 		        rate: '0.00',
 
- 		        sign: 0,
 
- 		        people: 0
 
- 		    }
 
- 		},
 
- 		dataQuery: [{
 
- 			photo: '../../../images/shujudaochu_icon.png',
 
- 			label: '数据查询',
 
- 			url: 'comprehensive-query.html',
 
- 			allowArea:"",
 
- 		},{
 
- 			photo: '../../../images/weijishihuifu_icon.png',
 
- 			label: '咨询未及时回复',
 
- 			url: 'consult-not-reply.html',
 
- 			allowArea:"",
 
- 		},
 
- 		{
 
- 			photo: '../../../images/icon-baobiao.png',
 
- 			label: '年度考核报表',
 
- 			url: 'annual-appraisal-report.html',
 
- 			allowArea:"",
 
- 		},
 
- 		],
 
- 		paramValue:'',
 
- 		paramType:'',
 
- 		isGugan: false,
 
- 	},
 
- 	methods: {
 
- 		open: function() {
 
- 			EventBus.$emit('open-click', {});
 
- 		},
 
- 		showDetail: function(url) {
 
- 			window.location.href = url;
 
- 		},
 
- 		goToPage: function(val){
 
- 		    var url = "sign-progress.html";
 
- 		    if(val == 2){
 
- 		        url = "renew-progress.html";
 
- 		    }else if(val == 3){
 
- 		        url = "comprehensive-query.html";
 
- 		    }
 
- 		    window.location.href = url;
 
- 		},
 
- 		userRoleData:function(v) {
 
- 			var vm = this
 
- 			var roles = window.sessionStorage.getItem("userRole");
 
- 			//如果没有缓存userRole,则说明是第一次进入统计页面,需要重新请求患者信息
 
- 			// if(!roles){
 
- 			    var vm = this;
 
- 			    httpRequest.getDoctorInfo().then(function(res){
 
- 			        var docInfo = res.data,
 
- 			        userRole = docInfo.userRole;
 
- 							if(docInfo.expandLevelName){
 
- 								vm.isGugan = docInfo.expandLevelName.indexOf("慢病骨干")>-1
 
- 							}
 
- 			        _.each(userRole,function(item,index){
 
- 						if(item.areas!="350200"){
 
- 							item.roleType='2'
 
- 						}
 
- 					})
 
- 					if(docInfo.specialistRole&&docInfo.specialistRole.length){  //如果有专科权限
 
- 						_.each(docInfo.specialistRole,function(item,index){
 
- 							var hasIndex = _.findIndex(userRole,{areas:item.areas})
 
- 							if(hasIndex == -1){   //去重
 
- 								item.roleType='1'
 
- 								userRole.push(item)
 
- 							}
 
- 						})
 
- 					}
 
- 					
 
- 			        if(userRole.length>0){
 
- 			            window.sessionStorage.setItem("userRole", JSON.stringify(userRole));
 
- 			            window.sessionStorage.setItem("docInfo", JSON.stringify(docInfo));
 
- 			            vm.roles = userRole;
 
- 			            vm.selectedRole = vm.getHighestRole(userRole).code;
 
- 			            var selected = vm.getHighestRole(userRole);
 
- 			            window.sessionStorage.setItem("selectedRole", JSON.stringify(selected));
 
- 			            $("#main").removeClass("c-hide")
 
- 			        }else if(vm.isGugan){
 
- 								window.sessionStorage.setItem("docInfo", JSON.stringify(docInfo));
 
- 								var selected = {
 
- 									code: docInfo.town,
 
- 									areas: docInfo.town,
 
- 									name: docInfo.hospitalName
 
- 								}
 
- 								window.sessionStorage.setItem("selectedRole", JSON.stringify(selected));
 
- 								$("#main").removeClass("c-hide")
 
- 								
 
- 							}
 
- 					if(userRole.length==0&&docInfo.specialistRole&&docInfo.specialistRole.length==0&&!vm.isGugan){
 
- 						top.toastr.warning("您没有权限查看该页面");
 
- 					}            
 
- 			    })
 
- 			// }else{
 
- 			//     this.roles = JSON.parse(roles);
 
- 			//     if(this.roles.length>0){
 
- 			//         var selected = window.sessionStorage.getItem("selectedRole");
 
- 			//         if(selected && selected!= "undefined") {
 
- 			//             this.selectedRole = JSON.parse(selected).code;
 
- 			//         } else {
 
- 			//             this.selectedRole = this.roles[0].code;
 
- 			//             var selected = this.roles[0];
 
- 			//             window.sessionStorage.setItem("selectedRole", JSON.stringify(selected));
 
- 			//         }
 
- 			//         $("#main").removeClass("c-hide")
 
- 			//     }else{
 
- 			//         top.toastr.warning("您没有权限查看该页面");
 
- 			//     }	        
 
- 			// }
 
- 		},
 
- 		paramClick:function(v) {
 
- 			if(v == 'ztfx') {
 
- 				this.showDetail(this.serviceAnalysis[0].url)
 
- 			}else if(v == 'zxfx') {
 
- 				this.showDetail(this.serviceAnalysis[1].url)
 
- 			}else if(v == 'pjfx') {
 
- 				this.showDetail(this.serviceAnalysis[2].url)
 
- 			}else if(v == 'ccffx') {
 
- 				this.showDetail(this.serviceAnalysis[3].url)
 
- 			}else if(v == 'zffx') {
 
- 				this.showDetail(this.serviceAnalysis[4].url)
 
- 			}else if(v == 'smfw') {
 
- 				this.showDetail(this.serviceAnalysis[5].url)
 
- 			}else if(v == 'scfx') {
 
- 				this.showDetail(this.serviceAnalysis[6].url)
 
- 			}else if(v == 'zbfx') {
 
- 				if(this.paramType) {
 
- 					this.showDetail('special-analysis.html?type='+this.paramType)
 
- 				}else{
 
- 					this.showDetail(this.serviceAnalysis[7].url)
 
- 				}
 
- 			}else if(v == 'sjcx') {
 
- 				this.showDetail(this.dataQuery[0].url)
 
- 			}else if(v=='jkmzf'){
 
-             this.showDetail('comprehensive-query.html?iSearch=1')
 
- 			}
 
- 			else if(v == 'ndkhbb') {
 
- 				this.showDetail(this.dataQuery[2].url)
 
- 			}else if(v == 'jmfx') {
 
- 				this.showDetail(this.signAnalysis[2].url)
 
- 			}else if(v == 'jkgl') {
 
- 				this.showDetail(this.signAnalysis[3].url)
 
- 			}else if(v == 'tgq') {
 
- 				this.showDetail(this.signAnalysis[4].url)
 
- 			}
 
- 			
 
- 		},
 
- 		getHighestRole(userRole){
 
- 			var vm = this
 
- 			var index = userRole.findIndex(function(item){return item.code.indexOf(350200)>-1 })
 
- 			if(index>-1){
 
- 				return userRole[index]
 
- 			}
 
- 			index = userRole.findIndex(function(item){return item.code.indexOf('jk_')>-1})
 
- 			if(index>-1){
 
- 				return userRole[index]
 
- 			}
 
- 			index = userRole.findIndex(function(item){return item.code.length == 6})
 
- 			if(index>-1){
 
- 				return userRole[index]
 
- 			}
 
- 			return userRole[0]
 
- 		}
 
- 	},
 
- 	mounted: function() {
 
- 	    //获取缓存里面的userRole
 
- 		this.userRoleData()
 
- 				//TODO 发布删除这个
 
- 		// window.location.href = 'comprehensive-query.html'
 
- 		// 获取URL地址
 
- 		var url = window.location.href;
 
- 		// 获取参数部分
 
- 		var params = url.split('?')[1];
 
- 		// 将参数部分转换为对象
 
- 		var paramsObj = {};
 
- 		if (params) {
 
- 			var paramsArr = params.split('&');
 
- 			for (var i = 0; i < paramsArr.length; i++) {
 
- 				var param = paramsArr[i].split('=');
 
- 				paramsObj[param[0]] = param[1];
 
- 			}
 
- 		}
 
- 		// 获取指定参数的值
 
- 		this.paramValue = paramsObj['name'];
 
- 		this.paramType = paramsObj['type'];
 
- 		
 
- 	},
 
- 	watch: {
 
- 		selectedRole: function(val) {
 
- 			var vm = this
 
- 			var selected = _.findWhere(this.roles, {
 
- 				code: val
 
- 			});
 
- 			window.sessionStorage.setItem("selectedRole", JSON.stringify(selected));
 
- 		    getSignData(this);
 
- 		    console.log(this.selectedRole)
 
- 			if(vm.selectedRole) {
 
- 				vm.paramClick(vm.paramValue)
 
- 			}
 
- 		},
 
- 		// "paramValue":{
 
- 		// 	handler:function(v) {
 
- 		// 		this.paramClick(v)
 
- 		// 	},
 
- 		// },
 
- 		
 
- 	}
 
- })
 
- function getSignData(vm){
 
-     var code = vm.selectedRole,
 
-         now = new Date(),
 
-         params = {
 
-             area: code,
 
-             level: code == '350200' ? 4 : code.length == 6 ? 3 : 2,
 
-             endDate: now.format("yyyy-MM-dd")
 
-         };
 
-     statisticAPI.getSignInfo(params).then(function(res){
 
-         if(res.status == 200){
 
-             var data = res.data;
 
-             vm.signRateData = {
 
-                 signTask: {
 
-                     text: formatRate(data.signTaskRate.rate),
 
-                     rate: '0.00',
 
-                     sign: data.signTaskRate.sign,
 
-                     people: data.signTaskRate.people
 
-                 },
 
-                 sign: {
 
-                     text: formatRate(data.signRate.rate),
 
-                     rate: '0.00',
 
-                     sign: data.signRate.sign,
 
-                     people: data.signRate.people
 
-                 },
 
-                 renew: {
 
-                     text: data.renewRange,
 
-                     rate: '0.00',
 
-                     sign: data.renew.split("/")[0],
 
-                     people: data.renew.split("/")[1]
 
-                 }
 
-             }
 
-             var val1 = data.signRate.people - data.signRate.sign,
 
-                 val2 = data.signTaskRate.people - data.signTaskRate.sign;
 
-             var signArr = [
 
-                     {name: "签约数", value: data.signRate.sign},
 
-                     {name: "未签约数", value: val1 >0 ? val1 : 0},
 
-                 ],
 
-                 signTaskArr = [
 
-                     {name: "签约数", value: data.signTaskRate.sign},
 
-                     {name: "未达标数", value: val2 >0 ? val2 : 0 }
 
-                 ],
 
-                 val = data.renew.split("/")[1] - data.renew.split("/")[0],
 
-                 renewArr = [
 
-                     {name: "续签数", value: data.renew.split("/")[0]},
 
-                     {name: "未达标数", value: val<0 ? 0 : val}
 
-                 ],
 
-                 color = ['#12b7f5', '#EBEBF5'];
 
-             var signChart = drawPieChart("signMain", signArr, color, true);
 
-             var completeChart = drawPieChart("completeMain", signTaskArr, color, true);
 
-             var renewChart = drawPieChart("renewMain", renewArr, color, true);
 
-             window.onresize = function() {
 
-                 signChart.resize();
 
-                 completeChart.resize();
 
-                 renewChart.resize();
 
-             }
 
-         }else{
 
-             console.log(res.msg);
 
-         }
 
-     })
 
- }
 
- function formatRate(str){
 
-     var val = parseFloat(str);
 
-     return val.toFixed(2)+"%";
 
- }
 
 
  |