special-analysis.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. var reqList = [],reqLists = [[],[],[],[]]; //记录请求的参数和url,用于后退时使用
  2. var colors={"0":"#5b9db5","1":"#ed7d31","2":"#a5a5a5",
  3. "3":"#ffc000","4":"#44c274","5":"#70ad47",
  4. "6":"#255e91","7":"#9e480e","8":"#7e7e7e","9":"#997300","10":"#264478","11":"#43682b","12":"#5b9db5"}
  5. Vue.use(Vuedals.default);
  6. new Vue({
  7. el: "#main",
  8. data: {
  9. isloading:false, //加载中
  10. pageData4:{},
  11. pageData3:{},
  12. pageData2:{},
  13. pageData1:{},
  14. pageData:{},
  15. tabledata01:[],
  16. tabledata02:[],
  17. tabledata1:[],
  18. tabledata2:[],
  19. hastopbar1:true,
  20. hastopbar2:true,
  21. slaveKey1_1:"",
  22. slaveKey1_2:"",
  23. reqListLength8:1,
  24. reqListLength9:1,
  25. reqListLength10:1,
  26. reqListLength11:1,
  27. ttab:1,
  28. tbtab:1,
  29. ltabList:[{},{indexNames:{'turnUpList':"上转人次",'rehabilitationList':'康复下转人次'},xDatas:{},yDatas:{},names:[]},
  30. {indexNames:{'totalServiceList':"总服务人次"},xDatas:{},yDatas:{},names:[]},],
  31. selDateType:undefined, // 1-日,2-周, 3-月
  32. informationShow:true,
  33. information:{code:"1",title:"专病分析",name:"zbfx",tip:"专病分析为统计当前年度至今各个专病康复管理业务动态"},
  34. optionsName:[],
  35. valueName:"",
  36. ptab:1,
  37. //请求页面所需参数
  38. levelList:[{level:"4",areaLevel:"2"},{level:"3",areaLevel:"3"},{level:"2",areaLevel:"4"}], //两种搜索,地区等级对比
  39. areaLevel:"", // 2、市,3、区,4、社区,5、团队\
  40. initareaLevel:"",
  41. initlevel: '',
  42. initarea: '',
  43. level: '',
  44. area: '',
  45. areaTitle: '',
  46. lowLevel:3,
  47. initlowLevel:3,
  48. selectedDateType: 1, //折线图坐标值1-日,2-周,3-月
  49. lowCode: '',
  50. chooseYear: '',
  51. start: "",
  52. end: "",
  53. userRole: '',
  54. reqListLength:1,
  55. activeAreaIndex:0,
  56. hopitalList:[],
  57. chopitalList:[],
  58. hospitalItem:{},
  59. hospitalCode:"",
  60. tabnumber:3,
  61. activeIndex:0,
  62. isHospital:false, //判断是否切换到医院权限
  63. },
  64. components: {
  65. vuedals: Vuedals.Component
  66. },
  67. mounted: function () {
  68. var vm=this
  69. //初始化数据
  70. initData(vm);
  71. vm.bindEvent()
  72. },
  73. watch:{
  74. areaTitle:function(val){
  75. //更新区域名称
  76. EventBus.$emit('update-area-name', {
  77. 'areaName': val
  78. });
  79. },
  80. chooseYear:function(val){
  81. //更新年份
  82. EventBus.$emit('update-statistics-year', {
  83. 'selectDate': val
  84. });
  85. },
  86. },
  87. methods: {
  88. getData:function(isNext,index){ //是否下转
  89. var vm = this
  90. var params={
  91. areaLevel: vm.areaLevel,
  92. level: vm.level,
  93. area: vm.area,
  94. endDate: vm.end,
  95. startDate: vm.start,
  96. lowLevel: vm.lowLevel,
  97. index:index
  98. }
  99. if(index){
  100. loadData([index], vm);
  101. }else{
  102. loadData([0,1,2,3,4,5,6,7,8,9,10,11], vm); //刷新数据
  103. }
  104. if(isNext){
  105. //存储请求所带的参数
  106. reqList.push(params);
  107. if(index){
  108. reqLists[index-8].push(params)
  109. vm["reqListLength"+index] = reqLists[index-8].length+1
  110. }
  111. }
  112. },
  113. //表格tab切换/下转
  114. getnewdata:function(arg,index){
  115. var vm = this
  116. if(arg.level){
  117. vm.level = arg.level
  118. vm.areaLevel = _.find(vm.levelList,{level:vm.level}).areaLevel
  119. }
  120. if(arg.area){
  121. vm.area = arg.area
  122. }
  123. if(arg.areaTitle){
  124. vm.areaTitle = arg.areaTitle
  125. }
  126. if(arg.lowLevel){
  127. vm.lowLevel=arg.lowLevel
  128. }else{
  129. if(vm.areaLevel){
  130. vm.lowLevel=arg.area == '350200' ? 3 : vm.area.length == 6 ? 4 : 5;
  131. }else{
  132. vm.lowLevel = arg.lowLevel || ""
  133. }
  134. }
  135. vm.getData(arg.level,index) //有传level,说明是下转
  136. },
  137. getnewdata1:function(arg){
  138. var vm = this
  139. if(vm.hastopbar1){ //服务项时
  140. vm.hastopbar1 = false
  141. vm.slaveKey1_1 = arg.area
  142. vm.area=vm.initarea
  143. vm.areaLevel=vm.initareaLevel
  144. vm.level=vm.initlevel
  145. vm.lowLevel = vm.initlowLevel
  146. vm.getData(true,8)
  147. }else{
  148. vm.getnewdata(arg,8)
  149. }
  150. },
  151. getnewdata2:function(arg){
  152. var vm = this
  153. if(vm.hastopbar2){ //服务项时
  154. vm.hastopbar2 = false
  155. vm.slaveKey1_2 = arg.area
  156. vm.area=vm.initarea
  157. vm.areaLevel=vm.initareaLevel
  158. vm.level=vm.initlevel
  159. vm.lowLevel = vm.initlowLevel
  160. vm.getData(true,9)
  161. }else{
  162. vm.getnewdata(arg,9)
  163. }
  164. },
  165. getnewdata01:function(arg){
  166. var vm = this
  167. vm.getnewdata(arg,10)
  168. },
  169. getnewdata02:function(arg){
  170. var vm = this
  171. vm.getnewdata(arg,11)
  172. },
  173. backClickHandel:function(index,lIndex,refIndex){
  174. var vm=this
  175. var hasIndex = _.findLastIndex(reqList,{index:index})
  176. reqList.splice(hasIndex,1);
  177. var preInfo = reqLists[lIndex].pop();
  178. var info = reqLists[lIndex][reqLists[lIndex].length - 1];
  179. if(reqLists[lIndex].length==0){
  180. if(refIndex=='1'||refIndex=='2'){
  181. vm["hastopbar"+refIndex] = true
  182. vm["slaveKey1_"+refIndex] = ""
  183. info = preInfo
  184. }else{
  185. info = reqList[0]
  186. }
  187. }
  188. vm.areaLevel = info.areaLevel;
  189. vm.level = info.level;
  190. vm.area = info.area;
  191. vm.lowLevel = info.lowLevel;
  192. vm["reqListLength"+index] = reqLists[lIndex].length+1
  193. vm.getData(false,index)
  194. vm.$refs["tableRef_"+refIndex].changeTab({level:vm.level,lowlevel:vm.lowLevel}) //表格tab
  195. },
  196. backClick2:function(){
  197. var vm=this
  198. vm.backClickHandel(10,2,'01')
  199. },
  200. backClick3:function(){
  201. var vm=this
  202. vm.backClickHandel(11,3,'02')
  203. },
  204. backClick0:function(){
  205. var vm=this
  206. vm.backClickHandel(8,0,'1')
  207. },
  208. backClick1:function(){
  209. var vm=this
  210. vm.backClickHandel(9,1,'2')
  211. },
  212. //时间选择
  213. changeDate: function () {
  214. var vm=this
  215. //搜索时,取消下转记录
  216. vm.area=vm.initarea
  217. vm.areaLevel=vm.initareaLevel
  218. vm.level=vm.initlevel
  219. vm.lowLevel = vm.initlowLevel
  220. reqHistoryInit(vm)
  221. vm.getData(true)
  222. vm.initTable()
  223. },
  224. //获取疾病筛查表
  225. getOptionsName:function(){
  226. var vm=this
  227. vm.optionsName = [{code:"",name:"全部病种"}]
  228. params = {
  229. area:vm.initarea,
  230. level:vm.initareaLevel
  231. };
  232. statisticAPI.specialistAnalysisDiseaseType(params).then(function(res) {
  233. if(res.status == 200) {
  234. vm.optionsName = [{code:"",name:"全部病种("+res.data.length+"个)"}]
  235. vm.optionsName=vm.optionsName.concat(res.data)
  236. } else {
  237. vm.$message.error(res.msg)
  238. }
  239. })
  240. },
  241. //筛查表切换
  242. seleName:function(){
  243. var vm=this
  244. vm.changeDate()
  245. },
  246. //切换line
  247. showTab:function(ptab){
  248. var vm=this
  249. if(ptab){
  250. vm.ptab=ptab
  251. }
  252. setTimeout(function(){
  253. EventBus.$emit("draw-line-chart", {
  254. panelName : "分级诊疗情况",
  255. quotaNames : vm.ltabList[vm.ptab].names,
  256. xData : vm.ltabList[vm.ptab].xDatas[0],
  257. yDatas : vm.ltabList[vm.ptab].yDatas,
  258. colors : ["#17b3ec",'#FF9526'],
  259. nowlineid : 'lineChart'+vm.ptab,
  260. noDateType: true,
  261. chartheight:"260",
  262. unit:"人",
  263. noshowDate:false,
  264. startDate:vm.start,
  265. endDate:vm.end,
  266. });
  267. },300)
  268. },
  269. showtTab:function(ttab){
  270. var vm=this
  271. },
  272. showtbTab:function(tbtab){
  273. var vm=this
  274. },
  275. backClick:function(){
  276. var vm=this
  277. if(vm.isHospital){
  278. initData(vm)
  279. }else{
  280. history.go(-1);
  281. }
  282. // if (reqList.length == 1) {
  283. // history.go(-1);
  284. // } else {
  285. // var lastInfo = reqList[reqList.length-1]
  286. // if(lastInfo.index){
  287. // var idx = lastInfo.index - 8
  288. // vm["backClick"+idx]()
  289. // }
  290. // }
  291. },
  292. bindEvent:function(){
  293. var vm=this
  294. //监听后退按钮的操作
  295. EventBus.$on("back-click", function (arg) {
  296. EventBus.$emit('update-statistics-time', {}); //更新统计时间
  297. vm.backClick()
  298. });
  299. //监听页面刷新
  300. EventBus.$on("refresh-click", function (arg) {
  301. EventBus.$emit('update-statistics-time', {}); //更新统计时间
  302. initData(vm)
  303. });
  304. //弹出筛选框
  305. EventBus.$on('filter-click', function(arg) {
  306. //弹框显示筛选条件
  307. Vuedals.Bus.$emit('new', {
  308. title: '条件筛选',
  309. onClose:function(data){
  310. vm.chooseYear = data.chooseYear;
  311. if(vm.chooseYear){
  312. vm.selDateType = undefined
  313. vm.end = getEndDate(vm.chooseYear)
  314. vm.start = getDateBefore(30)
  315. }else{
  316. vm.selDateType = "按"+data.dimensionVal
  317. vm.end = getDateBefore(0)
  318. if(data.dimensionVal == '日'){
  319. vm.start = getDateBefore(1)
  320. }else if(data.dimensionVal == '周'){
  321. vm.start = getDateBefore(7)
  322. }else if(data.dimensionVal == '月'){
  323. vm.start = getDateBefore(30)
  324. }
  325. }
  326. vm.changeDate()
  327. EventBus.$emit('update-statistics-time', {});//更新统计时间
  328. //更新维度名称
  329. EventBus.$emit('update-dimension-name', {
  330. "dimensionVal" : vm.selDateType
  331. });
  332. },
  333. component: 'special-filter',
  334. props: {
  335. selectedYear: vm.chooseYear,
  336. minYear:2020,
  337. dimensionValList:['日','周','月'],
  338. }
  339. });
  340. });
  341. $("#main").removeClass("c-hide");
  342. },
  343. initTable:function(){
  344. var vm=this
  345. var tabList1 = [{name:"各区",level:"4",lowlevel:"3",isShow:true},{name:"医院",level:"3",lowlevel:"4",isShow:true},{name:"团队",level:"2",lowlevel:"5",isShow:true}]
  346. var tabList2 = [{name:"各区",level:"4",lowlevel:"3",isShow:true},{name:"社区",level:"3",lowlevel:"4",isShow:true},{name:"团队",level:"2",lowlevel:"5",isShow:true}]
  347. var tabList01 = JSON.parse(JSON.stringify(tabList1)),tabList02 = JSON.parse(JSON.stringify(tabList2))
  348. vm.$refs.tableRef_01.initTable({
  349. //表格表头
  350. tabList:tabList01,
  351. headers:[{thead:"地区",param:"name",canclick:true},{thead:"共管患者数",param:"coManagementNum"},
  352. {thead:"转诊人数",param:"referralNum"},{thead:"下转人数",param:"rehabilitationNum"},{thead:"总服务人数",param:"totalServiceNum"}],
  353. tabnumber:vm.tabnumber,
  354. })
  355. vm.$refs.tableRef_02.initTable({
  356. //表格表头
  357. tabList:tabList02,
  358. headers:[{thead:"地区",param:"name",canclick:true},{thead:"共管患者数",param:"coManagementNum"},
  359. {thead:"转诊人数",param:"referralNum"},{thead:"下转人数",param:"rehabilitationNum"},{thead:"总服务人数",param:"totalServiceNum"}],
  360. tabnumber:vm.tabnumber,
  361. })
  362. var tabItem = {name:"服务项名称"}
  363. tabList1.splice(3-vm.tabnumber,0,tabItem)
  364. tabList2.splice(3-vm.tabnumber,0,tabItem)
  365. vm.$refs.tableRef_1.initTable({
  366. //表格表头
  367. tabList:tabList1,
  368. headers:[{thead:"服务项名称",param:"name",canclick:true},{thead:"合计",param:"num"}],
  369. tabnumber:vm.tabnumber+1,
  370. })
  371. vm.$refs.tableRef_2.initTable({
  372. //表格表头
  373. tabList:tabList2,
  374. headers:[{thead:"服务项名称",param:"name",canclick:true},{thead:"合计",param:"num"}],
  375. tabnumber:vm.tabnumber+1,
  376. })
  377. },
  378. comfireHospital:function(){
  379. var vm = this
  380. if(vm.hospitalCode){
  381. vm.loadding = true
  382. vm.isHospital = true
  383. //level:2、市,3、区,4、社区,5、团队
  384. vm.initareaLevel = vm.areaLevel = vm.hospitalCode == '350200' ? 2 : vm.hospitalCode.length == 6 ? 3 : 4;
  385. vm.initlevel = vm.level = vm.hospitalCode == '350200' ? 4 : vm.hospitalCode.length == 6 ? 3 : 2;
  386. vm.initlowLevel = vm.lowLevel = vm.hospitalCode == '350200' ? 3 : vm.hospitalCode.length == 6 ? 4 : 5;
  387. vm.initarea =vm.area = vm.hospitalCode;
  388. vm.areaTitle = vm.hospitalItem.name;
  389. if(vm.activeAreaIndex=="1"){ //0:等级医院 1社区医院
  390. vm.tbtab = 2
  391. }else{
  392. vm.tbtab = 1
  393. }
  394. vm.tabnumber=vm.areaLevel==4?1:vm.areaLevel==3?2:3 //表格显示的tab数
  395. //初始化时间
  396. vm.chooseYear = getSignDate()
  397. vm.selDateType = undefined
  398. vm.end = getEndDate(vm.chooseYear)
  399. vm.start = getStartDate(vm.chooseYear)
  400. vm.changeDate()
  401. vm.getOptionsName() //获取搜索疾病列表
  402. vm.initTable()
  403. }
  404. },
  405. hopitalListShow:function(){
  406. var vm = this
  407. //弹框显示筛选条件
  408. Vuedals.Bus.$emit('new', {
  409. title: '条件筛选',
  410. onClose:function(data){
  411. if(data){
  412. vm.hospitalItem = data.hospitalItem
  413. vm.hospitalCode = data.hospitalCode
  414. vm.activeAreaIndex = data.activeName
  415. vm.comfireHospital()
  416. }
  417. },
  418. component: 'hospital-filter',
  419. // props: {
  420. // chopitalList:vm.chopitalList,
  421. // hopitalList:vm.hopitalList,
  422. // }
  423. props: {
  424. initarea:this.initarea
  425. }
  426. });
  427. }
  428. }
  429. })
  430. function initData(vm) {
  431. //获得缓存中缓存的角色权限
  432. var userRole = window.sessionStorage.getItem("selectedRole");
  433. if (!userRole) {
  434. return false;
  435. }
  436. vm.userRole = JSON.parse(userRole);
  437. //level:2、市,3、区,4、社区,5、团队
  438. vm.initareaLevel = vm.areaLevel = vm.userRole.code == '350200' ? 2 : vm.userRole.code.length == 6 ? 3 : 4;
  439. vm.initlevel = vm.level = vm.userRole.code == '350200' ? 4 : vm.userRole.code.length == 6 ? 3 : 2;
  440. vm.initlowLevel = vm.lowLevel = vm.userRole.code == '350200' ? 3 : vm.userRole.code.length == 6 ? 4 : 5;
  441. vm.initarea =vm.area = vm.userRole.code;
  442. vm.areaTitle = vm.userRole.name;
  443. if(vm.initlevel==2){
  444. if(vm.userRole.roleType == '2'){
  445. vm.tbtab = 2
  446. }else if(vm.userRole.roleType == '1'){
  447. vm.tbtab = 1
  448. }
  449. }else{
  450. if(vm.isHospital){
  451. vm.isHospital = false
  452. vm.hospitalCode = ""
  453. vm.hospitalItem = {}
  454. }else{
  455. // selectHospital(vm,1,'hopitalList')
  456. // selectHospital(vm,2,'chopitalList')
  457. }
  458. }
  459. vm.tabnumber=vm.areaLevel==4?1:vm.areaLevel==3?2:3 //表格显示的tab数
  460. var url = location.search; //获取url中"?"符后的字串
  461. if (url.indexOf("?") != -1) { //判断是否有参数
  462. var str = url.substr(1); //从第一个字符开始 因为第0个是?号 获取所有除问号的所有符串
  463. strs = str.split("="); //用等号进行分隔 (因为知道只有一个参数 所以直接用等号进分隔 如果有多个参数 要用&号分隔 再用等号进行分隔)
  464. vm.valueName = strs[1]
  465. }
  466. if(vm.valueName == '15') {
  467. $('#title').html('慢阻肺')
  468. }else if(vm.valueName == '3') {
  469. $('#title').html('冠心病')
  470. }else if(vm.valueName == '9') {
  471. $('#title').html('脑卒中')
  472. }else if(vm.valueName == '10') {
  473. $('#title').html('慢性前列腺')
  474. }else if(vm.valueName == '11') {
  475. $('#title').html('肺癌')
  476. }else if(vm.valueName == '13') {
  477. $('#title').html('慢性乳腺疾病')
  478. }else if(vm.valueName == '14') {
  479. $('#title').html('慢性胃肠病')
  480. }else if(vm.valueName == '16') {
  481. $('#title').html('慢性肝病')
  482. }else if(vm.valueName == '17') {
  483. $('#title').html('慢性妇科炎症')
  484. }else if(vm.valueName == '12') {
  485. $('#title').html('慢性肾病')
  486. }else{
  487. $('#title').html('疾病筛查分析')
  488. }
  489. //初始化时间
  490. vm.chooseYear = getSignDate()
  491. vm.selDateType = undefined
  492. vm.end = getEndDate(vm.chooseYear)
  493. vm.start = getDateBefore(30)
  494. vm.changeDate()
  495. vm.getOptionsName() //获取搜索疾病列表
  496. vm.initTable()
  497. }
  498. function reqHistoryInit(vm){
  499. reqList = []
  500. reqLists = [[],[],[],[]]
  501. _.each(reqLists,function(item,idx){
  502. var index = 8+idx
  503. vm["reqListLength"+index] = item.length+1
  504. })
  505. vm.slaveKey1_1 = ""
  506. vm.slaveKey1_2 = ""
  507. vm.hastopbar1 = true
  508. vm.hastopbar2 = true
  509. }
  510. function initReqParams(vm) {
  511. var param = {
  512. startDate: vm.start,
  513. endDate: vm.end,
  514. area: vm.area,
  515. level: vm.areaLevel,
  516. diseaseType:vm.valueName,
  517. }
  518. var reqParam = [{
  519. url: "/specialistStatistics/specialistAnalysisHead", //头部
  520. reqType: 'get',
  521. data:{
  522. diseaseType:vm.valueName,
  523. area: vm.area,
  524. level: vm.areaLevel, //2、市,3、区,4、社区,5、团队
  525. },
  526. },{
  527. url: "/specialistStatistics/specialistAnalysisHeadCount", //头部统计
  528. reqType: 'get',
  529. data:param,
  530. },{
  531. url: "/specialistStatistics/diagnosisTreatment", //分级诊疗形式(转诊趋势)
  532. reqType: 'get',
  533. data:{
  534. startDate: vm.start,
  535. endDate: vm.end,
  536. area: vm.area,
  537. level: vm.areaLevel,
  538. diseaseType:vm.valueName,
  539. interval:1,
  540. type:1, //转诊趋势
  541. },
  542. },{
  543. url: "/specialistStatistics/diagnosisTreatment", //分级诊疗形式(服务人数)
  544. reqType: 'get',
  545. data:{
  546. startDate: vm.start,
  547. endDate: vm.end,
  548. area: vm.area,
  549. level: vm.areaLevel,
  550. diseaseType:vm.valueName,
  551. interval:1,
  552. type:2, //服务人数
  553. },
  554. },{
  555. url: "/specialistStatistics/diseaseTypeAnalysis", //疾病类型分析
  556. reqType: 'get',
  557. data:param,
  558. },{
  559. url: "/specialistStatistics/dailyHealthServices", //日常健康服务
  560. reqType: 'get',
  561. data:param,
  562. },{
  563. url: "/specialistStatistics/onlineDiagnosisTreatment", //在线诊疗情况
  564. reqType: 'get',
  565. data:param,
  566. },{
  567. url: "/specialistStatistics/rehabilitationPhoneRange", //电话/短信关怀率
  568. reqType: 'get',
  569. data:param,
  570. },{
  571. url: "/specialistStatistics/coManagementRehabilitation", //康复共管情况
  572. reqType: 'get',
  573. data:{
  574. startDate: vm.start,
  575. endDate: vm.end,
  576. area: vm.area,
  577. level: vm.areaLevel,
  578. diseaseType:vm.valueName,
  579. type:1, //等级医院
  580. slaveKey1:vm.slaveKey1_1,
  581. lowLevel:vm.slaveKey1_1?vm.lowLevel:""
  582. },
  583. },{
  584. url: "/specialistStatistics/coManagementRehabilitation", //康复共管情况
  585. reqType: 'get',
  586. data:{
  587. startDate: vm.start,
  588. endDate: vm.end,
  589. area: vm.area,
  590. level: vm.areaLevel,
  591. diseaseType:vm.valueName,
  592. type:2, //社区医院
  593. slaveKey1:vm.slaveKey1_2,
  594. lowLevel:vm.slaveKey1_2?vm.lowLevel:""
  595. },
  596. },{
  597. url: "/specialistStatistics/serviceRankingAnalysis", //-专病服务排名分析/医院总体服务情况
  598. reqType: 'get',
  599. data:{
  600. startDate: vm.start,
  601. endDate: vm.end,
  602. area: vm.area,
  603. level: vm.areaLevel,
  604. diseaseType:vm.valueName,
  605. type:1,
  606. lowLevel:vm.lowLevel
  607. },
  608. },{
  609. url: "/specialistStatistics/serviceRankingAnalysis", //-专病服务排名分析/医院总体服务情况
  610. reqType: 'get',
  611. data:{
  612. startDate: vm.start,
  613. endDate: vm.end,
  614. area: vm.area,
  615. level: vm.areaLevel,
  616. diseaseType:vm.valueName,
  617. type:2,
  618. lowLevel:vm.lowLevel
  619. },
  620. }];
  621. return reqParam;
  622. }
  623. function loadData(loadArr, vm) {
  624. //获取其他请求的参数
  625. var reqParams = initReqParams(vm),
  626. reqPromise = [],
  627. newArr = []; //记录非顶部请求的请求数组
  628. for (i = 0; i < loadArr.length; i++) {
  629. var j = loadArr[i];
  630. var param = reqParams[j];
  631. reqPromise.push(httpRequest.get(param.url, {
  632. data: param.data
  633. }));
  634. newArr.push(loadArr[i]);
  635. }
  636. vm.isloading=true
  637. if (reqPromise.length > 0) {
  638. Promise.all(reqPromise).then(function (ress) {
  639. var res1, res2, res3, res4, res5, res6, res7, res8, res9, res10, res11, res12;
  640. for (var i = 0; i < loadArr.length; i++) {
  641. var j = loadArr[i] + 1;
  642. if (j == 1) { res1 = ress[i]; }
  643. if (j == 2) { res2 = ress[i]; }
  644. if (j == 3) { res3 = ress[i]; }
  645. if (j == 4) { res4 = ress[i]; }
  646. if (j == 5) { res5 = ress[i]; }
  647. if (j == 6) { res6 = ress[i]; }
  648. if (j == 7) { res7 = ress[i]; }
  649. if (j == 8) { res8 = ress[i]; }
  650. if (j == 9) { res9 = ress[i]; }
  651. if (j == 10) { res10 = ress[i]; }
  652. if (j == 11) { res11 = ress[i]; }
  653. if (j == 12) { res12 = ress[i]; }
  654. }
  655. if(res1&& res1.status == 200){
  656. vm.pageData=res1.data
  657. }
  658. if(res2&& res2.status == 200){
  659. vm.pageData1=res2.data
  660. }
  661. if(res3&& res3.status == 200){
  662. handleSecondPanelData(res3.data ,1, vm)
  663. }
  664. if(res4&& res4.status == 200){
  665. handleSecondPanelData(res4.data ,2, vm)
  666. }
  667. if(res5&& res5.status == 200){
  668. var barData = {rehabilitationNum:[],rehabilitationTimes:[]}
  669. _.each(res5.data,function(item,index){
  670. barData.rehabilitationNum.push({
  671. range:item.name,
  672. amount:item.num
  673. })
  674. barData.rehabilitationTimes.push({
  675. range:item.name,
  676. amount:item.times
  677. })
  678. })
  679. getBarData({elId:'barChart', data:barData,
  680. indexNames:{"rehabilitationNum":"下转人数","rehabilitationTimes":"下转人次"},selectedDateType:vm.selectedDateType,hasLegend:true,colors:["#17b3ec",'#20D7AD'],units:{"下转人数":"人","下转人次":"人次"}})
  681. }
  682. if(res6&& res6.status == 200){
  683. vm.pageData2=res6.data
  684. }
  685. if(res7&& res7.status == 200){
  686. vm.pageData3=res7.data
  687. }
  688. if(res8&& res8.status == 200){
  689. vm.pageData4=res8.data
  690. }
  691. if(res9&& res9.status == 200){
  692. var data9 = _.map(res9.data,function(item){
  693. item.num = item.num||item.amount||0
  694. return item
  695. })
  696. vm.tabledata1=listHandle(data9,"num");
  697. }
  698. if(res10&& res10.status == 200){
  699. var data10 = _.map(res10.data,function(item){
  700. item.num = item.num||item.amount||0
  701. return item
  702. })
  703. vm.tabledata2=listHandle(data10,"num");
  704. }
  705. if(res11&& res11.status == 200){
  706. vm.tabledata01=listHandle(res11.data,"totalServiceNum");
  707. }
  708. if(res12&& res12.status == 200){
  709. vm.tabledata02=listHandle(res12.data,"totalServiceNum");
  710. }
  711. vm.isloading=false
  712. })
  713. }
  714. }
  715. function handleSecondPanelData(data,index, vm) {
  716. var xDatas = [],
  717. yDatas = [],
  718. names = []
  719. for(var p in data){
  720. names.push(vm.ltabList[index].indexNames[p]);
  721. xData = _.map(data[p], function(o){
  722. return o.range;
  723. });
  724. yData = _.map(data[p], function(o){
  725. return o.amount;
  726. });
  727. xDatas.push(xData);
  728. yDatas.push(yData);
  729. }
  730. vm.ltabList[index].xDatas = xDatas
  731. vm.ltabList[index].yDatas = yDatas
  732. vm.ltabList[index].names = names
  733. if(vm.ptab == index){
  734. vm.showTab()
  735. }
  736. }
  737. function listHandle(list, sort){
  738. var topArr = [],newList=[];
  739. if(list.length==1&&!list[0].name){
  740. list=[]
  741. }
  742. topArr = soreRank(getKeyValueArr(list, sort||'total'));
  743. newList = _.map(list, function(o, index){
  744. o.rank=topArr[index]
  745. return o
  746. });
  747. return newList
  748. }