123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- 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:"",
- },
- ]
- },
- 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;
- }
- },
- mounted: function() {
- //获取缓存里面的userRole
- var roles = window.sessionStorage.getItem("userRole");
- //如果没有缓存userRole,则说明是第一次进入统计页面,需要重新请求患者信息
- if(!roles){
- var vm = this;
- httpRequest.getDoctorInfo().then(function(res){
- var docInfo = res.data,
- userRole = docInfo.userRole;
- _.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 = userRole[0].code;
- var selected = userRole[0];
- window.sessionStorage.setItem("selectedRole", JSON.stringify(selected));
- $("#main").removeClass("c-hide")
- }else{
- 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("您没有权限查看该页面");
- }
- }
- console.log(this.selectedRole)
-
- },
- watch: {
- selectedRole: function(val) {
- var selected = _.findWhere(this.roles, {
- code: val
- });
- window.sessionStorage.setItem("selectedRole", JSON.stringify(selected));
- getSignData(this);
- console.log(this.selectedRole)
- }
- }
- })
- 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)+"%";
- }
|