comprehensive-query.js 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031
  1. Vue.use(Vuedals.default);
  2. new Vue({
  3. el: "#main",
  4. data: {
  5. height:"",
  6. isloading:false, //加载中
  7. start:"",
  8. end:"",
  9. tabledata:[], //表格数据
  10. levelList:[{level:"4",areaLevel:"2"},{level:"3",areaLevel:"3"},{level:"2",areaLevel:"4"}], //两种搜索,地区等级对比
  11. areaLevel:"", // 2、市,3、区,4、社区,5、团队
  12. initareaLevel:"",
  13. initlevel: '',
  14. initarea: '',
  15. level: '',
  16. area: '',
  17. areaTitle: '',
  18. index: '121',
  19. lowLevel: '',
  20. initlowLevel:"",
  21. years:[],
  22. chooseYear: '',
  23. userRole: '',
  24. treedata: [],
  25. tableHeader:[],
  26. defaultProps: {
  27. children: 'children',
  28. label: 'label'
  29. },
  30. pickerOptions:{
  31. disabledDate(time) {
  32. return time.getTime() > Date.now()
  33. },
  34. },
  35. radio:'1',
  36. timeLevel: 2,
  37. searchJson:{},
  38. currentPage:1,
  39. currentSize:10,
  40. datatotal:0,
  41. rangeList:[],
  42. rangeCode:"",
  43. areaList:[],
  44. areaCode:"",
  45. communityList:[{code:"",name:"全部"}],
  46. communityCode:"",
  47. teamList:[{code:"",name:"全部"}],
  48. teamCode:"",
  49. data: [{
  50. label: '明细查询',
  51. children: [
  52. {label: '咨询分析', },
  53. {label: '签约分析', },
  54. {label: '专病分析', },
  55. {label: '生日祝福分析', },
  56. {label: '上门服务分析', },
  57. {label: '长处方分析', },
  58. ]
  59. }],
  60. handleNodeShow:1,
  61. handleNodeId:0,
  62. radio1:'',
  63. radio2:'',
  64. radio3:'',
  65. radio4:'',
  66. radio5:'',
  67. radio6:'',
  68. radio7:'',
  69. radio8:'',
  70. cities:[{value:'高血压',num:'4'},
  71. {value:'糖尿病',num:'5'},
  72. {value:'65岁以上人群',num:'3'},
  73. {value:'0-6岁小孩',num:'7'},
  74. {value:'计划生育家庭',num:'9'},
  75. {value:'严重精神障碍',num:'10'},
  76. {value:'残疾人',num:'11'},
  77. {value:'普通人群',num:'1'},
  78. {value:'结核病',num:'12'},
  79. {value:'低保人群',num:'8'},
  80. {value:'孕产妇',num:'6'},
  81. ],
  82. checkedCities: [],
  83. specialCities:[],
  84. specialCheckedCities:[],
  85. serveCities:[{value:'残疾人',num:'1'},
  86. {value:'失能/半失能老人',num:'5'},
  87. {value:'80岁以上老人',num:'7'},
  88. {value:'肺结核患者',num:'2'},
  89. {value:'计生特殊家庭',num:'3'},
  90. {value:'重性精神病',num:'4'},
  91. {value:'其他',num:'6'},
  92. ],
  93. serveSpecialCities:[],
  94. options: [{
  95. value: '请选择',
  96. label: ''
  97. }, {
  98. value: '是',
  99. label: '1'
  100. }, {
  101. value: '否',
  102. label: '0'
  103. },],
  104. value: '',
  105. form:{
  106. endorseTheTicket:'',
  107. renew:'',
  108. backToSign:'',
  109. WeChat:'',
  110. },
  111. form2:{
  112. juniorCollege:'',
  113. family:'',
  114. resident:'',
  115. },
  116. form3:{
  117. family:'',
  118. resident:'',
  119. },
  120. form4:{
  121. family:'',
  122. resident:'',
  123. },
  124. form5:{
  125. family:'',
  126. resident:'',
  127. },
  128. handleData:[],
  129. diseaseData:[],
  130. serviceTypeData:[],
  131. analyseData:[], //分析数据
  132. searchJsonTime:undefined,
  133. loadingTwo:false,
  134. radio1Show:null,
  135. serverType:'',
  136. diseaseDataType:'',
  137. serviceTypeDataType:'',
  138. fullscreenLoading:false,
  139. derive:'',
  140. },
  141. components: {
  142. vuedals: Vuedals.Component
  143. },
  144. watch: {
  145. rangeCode: function (val) {
  146. var vm=this
  147. if(vm.initlevel != 2){
  148. vm.communityCode=""
  149. }
  150. vm.teamCode=""
  151. vm.getTreeList()
  152. },
  153. areaCode:function(val){
  154. var vm=this
  155. vm.selChange(3)
  156. },
  157. communityCode:function(val){
  158. var vm=this
  159. vm.selChange(5)
  160. },
  161. },
  162. mounted: function () {
  163. var vm=this
  164. //初始化数据
  165. initData(vm);
  166. vm.getDiseaseTypeList()
  167. vm.height = document.body.offsetHeight - 85
  168. window.onresize = function () {
  169. vm.height = document.body.offsetHeight - 85
  170. console.log(vm.height)
  171. }
  172. },
  173. methods: {
  174. getDiseaseTypeList:function() {
  175. var vm = this
  176. statisticAPI.getDiseaseTypeList({}).then(function(res){
  177. if(res.status == 200) {
  178. vm.specialCities = res.list
  179. }
  180. })
  181. },
  182. // 签约人群
  183. handleCheckedCitiesChange:function(value) {
  184. var vm = this
  185. vm.handleData = value
  186. },
  187. // 下转病种
  188. diseaseChange:function(value) {
  189. var vm = this
  190. vm.diseaseData = value
  191. },
  192. // 服务类型
  193. serviceTypeChange:function(value) {
  194. var vm = this
  195. vm.serviceTypeData = value
  196. },
  197. // 统计分析树形图
  198. treedataClick:function(name,data) {
  199. var vm = this
  200. vm.handleNodeShow = 1
  201. vm.handleNodeId = 0
  202. vm.currentPage = 1
  203. vm.radio = '1' //签约年度 --创建时间
  204. // initTime(vm)
  205. // initScope(vm)
  206. },
  207. // 点击明细分析树形图
  208. handleNodeClick:function(name,data) {
  209. var vm = this
  210. vm.derive = name.label
  211. if(data.id>=3) { //明细查询以下
  212. vm.handleNodeShow = 2 // 明细查询tabs为2
  213. vm.tableHeader = [] // 选择统计的数组
  214. vm.analyseData = [] // 明细查询数组
  215. }
  216. vm.handleNodeId = data.id //切换后的id
  217. vm.radio = '1' //签约年度 --创建时间
  218. vm.radio1 = '' //咨询分析咨询状态
  219. vm.radio2 = ''
  220. vm.radio3 = ''
  221. vm.radio4 = ''
  222. vm.radio5 = ''
  223. vm.radio6 = ''
  224. vm.radio7 = ''
  225. vm.radio8 = ''
  226. vm.checkedCities = [] //签约人群清空
  227. vm.specialCheckedCities = [] //下转病种清空
  228. vm.serveSpecialCities = [] //服务类型清空
  229. vm.form = {
  230. endorseTheTicket:'',
  231. renew:'',
  232. backToSign:'',
  233. WeChat:'',
  234. }
  235. vm.form2 = {
  236. juniorCollege:'',
  237. family:'',
  238. resident:'',
  239. }
  240. vm.form3 = {
  241. family:'',
  242. resident:'',
  243. },
  244. vm.form4 = {
  245. family:'',
  246. resident:'',
  247. },
  248. vm.form5 = {
  249. family:'',
  250. resident:'',
  251. },
  252. initTime(vm) //时间初始化
  253. initScope(vm) //数据范围初始化
  254. vm.currentPage = 1
  255. vm.analysFunction(vm.handleNodeId) //明细查询列表查询
  256. },
  257. // 咨询分析
  258. getConsultList:function() {
  259. var vm = this
  260. vm.loadingTwo = true
  261. statisticAPI.getConsultList({
  262. year :vm.radio=='1'?vm.chooseYear:'', //签约年度
  263. startDate :vm.radio=='2'?vm.searchJsonTime.start:'', //开始时间
  264. endDate :vm.radio=='2'?vm.searchJsonTime.end:'', //结束时间
  265. status :vm.radio1, //咨询状态,1已回复,0未回复,2未及时回复
  266. team :vm.teamCode, //团队
  267. area :vm.areaCode, //地区
  268. hospital :vm.communityCode, //社区
  269. rang :vm.rangeCode, //数据范围(town区传值area,hospital医院传值hospital,team团队传值team)
  270. pageSize:vm.currentSize,
  271. page:vm.currentPage,
  272. }).then(function(res){
  273. console.log(res,"咨询分析")
  274. if(res.status == 200) {
  275. vm.analyseData = res.data.list
  276. vm.datatotal = res.data.total
  277. vm.loadingTwo = false
  278. }
  279. })
  280. },
  281. // 签约分析
  282. getSignList:function() {
  283. var vm = this
  284. vm.loadingTwo = true
  285. var handleDataList = []
  286. vm.serverType = ''
  287. vm.handleData.forEach(function(res){
  288. handleDataList.push(res.num)
  289. })
  290. vm.serverType = handleDataList.join(',')
  291. statisticAPI.getSignList({
  292. year :vm.radio=='1'?vm.chooseYear:'', //签约年度
  293. startDate :vm.radio=='2'?vm.searchJsonTime.start:'', //开始时间
  294. endDate :vm.radio=='2'?vm.searchJsonTime.end:'', //结束时间
  295. serverType:vm.serverType, //签约人群
  296. status :vm.radio2, //签约状态,1已签约,0待审核,2代缴费
  297. isUpdate:vm.form.endorseTheTicket, //是否改签 1是0否
  298. isAdd:vm.form.renew, //是否续签 1是0否
  299. isOut:vm.form.backToSign, //是否退签 1是0否
  300. isBindWX:vm.form.WeChat, //是否绑定微信 1是0否
  301. team :vm.teamCode, //团队
  302. area :vm.areaCode=='350200'?'':vm.areaCode, //地区
  303. hospital :vm.communityCode, //社区
  304. rang :vm.rangeCode, //数据范围(town区传值area,hospital医院传值hospital,team团队传值team)
  305. pageSize:vm.currentSize,
  306. page:vm.currentPage,
  307. }).then(function(res){
  308. console.log(res,"签约分析")
  309. if(res.status == 200) {
  310. res.data.list.forEach(function(item){
  311. item.sscNum = item.sscNum.replace(/^(.{4})(?:\d+)(.{1})$/,"$1****$2")
  312. item.idcardNum = item.idcardNum.replace(/^(.{6})(?:\d+)(.{4})$/,"$1****$2")
  313. })
  314. vm.analyseData = res.data.list
  315. vm.datatotal = res.data.total
  316. vm.loadingTwo = false
  317. }
  318. })
  319. },
  320. // 专病分析
  321. getSickList:function() {
  322. var vm = this
  323. // vm.diseaseData
  324. vm.loadingTwo = true
  325. var handleDataList = []
  326. vm.diseaseDataType = ''
  327. vm.diseaseData.forEach(function(res){
  328. handleDataList.push(res.code)
  329. })
  330. vm.diseaseDataType = handleDataList.join(',')
  331. statisticAPI.getSickList({
  332. year :vm.radio=='1'?vm.chooseYear:'', //年度
  333. startDate :vm.radio=='2'?vm.searchJsonTime.start:'', //开始时间
  334. endDate :vm.radio=='2'?vm.searchJsonTime.end:'', //结束时间
  335. diseaseType:vm.diseaseDataType, //病种类型
  336. status :vm.radio3, //下转状态,1已接受,0未接受,2未管理
  337. doctorName:vm.form2.juniorCollege, //专科医生
  338. familyDoctorName:vm.form2.family, //家庭医生名字
  339. patientName:vm.form2.resident, // 居民姓名
  340. team :vm.teamCode, //团队
  341. area :vm.areaCode=='350200'?'':vm.areaCode, //地区
  342. hospital :vm.communityCode, //社区
  343. rang :vm.rangeCode, //数据范围(town区传值area,hospital医院传值hospital,team团队传值team)
  344. pageSize:vm.currentSize,
  345. page:vm.currentPage,
  346. }).then(function(res){
  347. console.log(res,"专病分析")
  348. if(res.status == 200) {
  349. res.data.list.forEach(function(item){
  350. item.sscNum = item.sscNum.replace(/^(.{4})(?:\d+)(.{1})$/,"$1****$2")
  351. item.idcardNum = item.idcardNum.replace(/^(.{6})(?:\d+)(.{4})$/,"$1****$2")
  352. })
  353. vm.analyseData = res.data.list
  354. vm.datatotal = res.data.total
  355. vm.loadingTwo = false
  356. }
  357. })
  358. },
  359. // 生日祝福分析明细
  360. getBirthdayPatientList:function() {
  361. var vm = this
  362. vm.loadingTwo = true
  363. statisticAPI.getBirthdayPatientList({
  364. patientName:vm.form3.resident, // 居民姓名
  365. doctorName:vm.form3.family, //医生姓名
  366. signYear :vm.radio=='1'?vm.chooseYear:'', //签约年度
  367. startDate :vm.radio=='2'?vm.searchJsonTime.start:'', //开始时间
  368. endDate :vm.radio=='2'?vm.searchJsonTime.end:'', //结束时间
  369. status :vm.radio4, //状态(不传为全部,1、已发送,2、未发送)
  370. team :vm.teamCode, //团队
  371. area :vm.areaCode=='350200'?'':vm.areaCode, //地区
  372. hospital :vm.communityCode, //社区
  373. range :vm.rangeCode, //数据范围(town区传值area,hospital医院传值hospital,team团队传值team)
  374. pageSize:vm.currentSize,
  375. page:vm.currentPage,
  376. }).then(function(res){
  377. if(res.status == 200) {
  378. console.log(res,"Sddddd")
  379. res.data.detailModelList.forEach(function(item){
  380. item.ssc = item.ssc.replace(/^(.{4})(?:\d+)(.{1})$/,"$1****$2")
  381. item.idcard = item.idcard.replace(/^(.{6})(?:\d+)(.{4})$/,"$1****$2")
  382. })
  383. vm.analyseData = res.data.detailModelList
  384. vm.datatotal = res.data.total
  385. vm.loadingTwo = false
  386. }
  387. })
  388. },
  389. // 长处方分析明细
  390. getPrescriptionList:function() {
  391. var vm = this
  392. vm.loadingTwo = true
  393. statisticAPI.getPrescriptionList({
  394. patientName:vm.form5.resident, // 居民姓名
  395. doctorName :vm.form5.family, //医生姓名
  396. signYear :vm.radio=='1'?vm.chooseYear:'', //签约年度
  397. startDate :vm.radio=='2'?vm.searchJsonTime.start:'', //开始时间
  398. endDate :vm.radio=='2'?vm.searchJsonTime.end:'', //结束时间
  399. status :vm.radio6, //续方状态 0待审核 20药师审核中 40待支付 100已完成 999其他
  400. diagnosis :vm.radio7, //续方疾病类型1高血压2糖尿病3其他
  401. dispensaryType :vm.radio8, // 取药方式1自取2快递3健管师配送
  402. team :vm.teamCode, //团队
  403. area :vm.areaCode=='350200'?'':vm.areaCode, //地区
  404. hospital :vm.communityCode, //社区
  405. range :vm.rangeCode, //数据范围(town区传值area,hospital医院传值hospital,team团队传值team)
  406. pageSize:vm.currentSize,
  407. page:vm.currentPage,
  408. }).then(function(res){
  409. if(res.status == 200) {
  410. res.data.detailModelList.forEach(function(item){
  411. console.log(item.finish_time,"长处方分析")
  412. item.ssc = item.ssc.replace(/^(.{4})(?:\d+)(.{1})$/,"$1****$2")
  413. item.idcard = item.idcard.replace(/^(.{6})(?:\d+)(.{4})$/,"$1****$2")
  414. })
  415. vm.analyseData = res.data.detailModelList
  416. vm.datatotal = res.data.total
  417. vm.loadingTwo = false
  418. }
  419. })
  420. },
  421. // 上门服务分析明细
  422. getDoorServiceList:function() {
  423. var vm = this
  424. vm.loadingTwo = true
  425. var handleDataList = []
  426. vm.serviceTypeDataType = ''
  427. vm.serviceTypeData.forEach(function(res){
  428. handleDataList.push(res.num)
  429. })
  430. vm.serviceTypeDataType = handleDataList.join(',')
  431. statisticAPI.getDoorServiceList({
  432. patientName:vm.form4.resident, // 居民姓名
  433. doctorName :vm.form4.family, //医生姓名
  434. signYear :vm.radio=='1'?vm.chooseYear:'', //签约年度
  435. startDate :vm.radio=='2'?vm.searchJsonTime.start:'', //开始时间
  436. endDate :vm.radio=='2'?vm.searchJsonTime.end:'', //结束时间
  437. status :vm.radio5, //工单状态 -1已取消,1待派单、2待接单、3已接单、4待服务、5待评价
  438. type :vm.serviceTypeDataType, //服务类型 1残疾人,2肺结核患者,3计生特殊家庭,4重性精神病,5失能/半失能老人,6其他,7 80岁以上老人
  439. team :vm.teamCode, //团队
  440. area :vm.areaCode=='350200'?'':vm.areaCode, //地区
  441. hospital :vm.communityCode, //社区
  442. range :vm.rangeCode, //数据范围(town区传值area,hospital医院传值hospital,team团队传值team)
  443. pageSize:vm.currentSize,
  444. page:vm.currentPage,
  445. }).then(function(res){
  446. if(res.status == 200) {
  447. console.log(res,"上门服务分析明细")
  448. res.data.detailModelList.forEach(function(item){
  449. item.ssc = item.ssc.replace(/^(.{4})(?:\d+)(.{1})$/,"$1****$2")
  450. item.idcard = item.idcard.replace(/^(.{6})(?:\d+)(.{4})$/,"$1****$2")
  451. })
  452. vm.analyseData = res.data.detailModelList
  453. vm.datatotal = res.data.total
  454. vm.loadingTwo = false
  455. }
  456. })
  457. },
  458. analysFunction:function(id) {
  459. var vm = this
  460. // idcard = idcard.replace(/^(.{6})(?:\d+)(.{4})$/,"$1****$2") 身份证 医保卡 脱敏显示
  461. if(id == 3) {
  462. // 咨询分析
  463. vm.getConsultList()
  464. }else if(id == 4) {
  465. // 签约分析
  466. vm.getSignList()
  467. }else if(id == 5) {
  468. // 专病分析
  469. vm.getSickList()
  470. }else if(id == 6) {
  471. // 生日祝福分析
  472. vm.getBirthdayPatientList()
  473. }else if(id == 7) {
  474. // 上门服务分析
  475. vm.getDoorServiceList()
  476. }else if(id == 8) {
  477. // 长处方分析
  478. vm.getPrescriptionList()
  479. }
  480. },
  481. getTreeList:function(){
  482. var vm=this
  483. statisticAPI.exportTreeList({rang:vm.rangeCode}).then(function(res){
  484. if(res.status == 200){
  485. vm.treedata = [],jindex=0
  486. _.each(res.data,function(item,index){
  487. vm.treedata.push({
  488. id:"p_"+jindex,
  489. label:index,
  490. children:[]
  491. })
  492. _.each(item,function(citem,cindex){
  493. vm.treedata[jindex].children.push({
  494. id:cindex,
  495. label:citem,
  496. })
  497. })
  498. jindex++
  499. })
  500. }
  501. })
  502. },
  503. beforeReq:function(flag){
  504. var vm=this,startDate="",endDate="",checked=[]
  505. if(vm.radio=="1"){
  506. if(vm.chooseYear == 2022) {
  507. startDate = '2022-07-01'
  508. endDate = getEndDate(vm.chooseYear)
  509. }else if(vm.chooseYear > 2022) {
  510. startDate = vm.chooseYear + '-01-01'
  511. endDate = getEndDate(vm.chooseYear)
  512. }else{
  513. startDate = getStartDate(vm.chooseYear)
  514. endDate = getEndDate(vm.chooseYear)
  515. }
  516. vm.timeLevel = 2
  517. }else{
  518. if(!vm.start&&!vm.end){
  519. this.$message({
  520. message: '请选择创建时间',
  521. type: 'warning'
  522. });
  523. return false
  524. }else{
  525. if(vm.start>vm.end){
  526. this.$message({
  527. message: '开始时间应早于结束时间',
  528. type: 'warning'
  529. });
  530. return false
  531. }else{
  532. startDate = vm.start
  533. endDate = vm.end
  534. vm.timeLevel = 1
  535. }
  536. }
  537. }
  538. if(vm.handleNodeId == 0) {
  539. var checkTree = vm.$refs.tree.getCheckedNodes(true);
  540. if(checkTree.length){
  541. if(!flag){
  542. vm.tableHeader = []
  543. }
  544. _.each(checkTree,function(item,index){
  545. if(!flag){
  546. vm.tableHeader.push({prop:item.label,label:item.label})
  547. }
  548. checked.push(item.id)
  549. })
  550. }else{
  551. this.$message({
  552. message: '请选择搜索指标!',
  553. type: 'warning'
  554. });
  555. return false
  556. }
  557. }else if(vm.handleNodeId == 2) {
  558. this.$message({
  559. message: '请选择明细查询!',
  560. type: 'warning'
  561. });
  562. return false
  563. }
  564. return {start:startDate,end:endDate,checked:checked.join(",")}
  565. },
  566. // 查询
  567. searchHandle:function(){
  568. var vm = this
  569. vm.searchJsonTime = vm.beforeReq()
  570. vm.currentPage = 1
  571. if(this.radio1 == 1) {this.radio1Show = true}else{this.radio1Show = false}
  572. if(vm.handleNodeId == 0) {
  573. if(vm.searchJsonTime){
  574. vm.searchJson = {
  575. startDate:vm.searchJsonTime.start,
  576. endDate:vm.searchJsonTime.end,
  577. quotaStr:vm.searchJsonTime.checked,
  578. range:vm.rangeCode,
  579. team:vm.teamCode,
  580. hospital:vm.communityCode,
  581. area:vm.areaCode=="350200"?"":vm.areaCode,
  582. size:vm.currentSize,
  583. page:vm.currentPage,
  584. timeLevel: vm.timeLevel
  585. }
  586. vm.getStatisticDataList()
  587. }
  588. }else if(vm.handleNodeId == 3) {
  589. // 咨询分析
  590. vm.getConsultList()
  591. }else if(vm.handleNodeId == 4) {
  592. // 签约分析
  593. vm.getSignList()
  594. }else if(vm.handleNodeId == 5) {
  595. // 专病分析
  596. vm.getSickList()
  597. }else if(vm.handleNodeId == 6) {
  598. // 生日祝福分析
  599. vm.getBirthdayPatientList()
  600. }else if(vm.handleNodeId == 7) {
  601. // 上门服务分析
  602. vm.getDoorServiceList()
  603. }else if(vm.handleNodeId == 8) {
  604. // 长处方分析
  605. vm.getPrescriptionList()
  606. }
  607. },
  608. getStatisticDataList:function(){
  609. var vm = this
  610. vm.isloading = true
  611. var params=JSON.parse(JSON.stringify(vm.searchJson))
  612. params.page = vm.currentPage
  613. statisticAPI.getStatisticDataList(params).then(function(res){
  614. if(res.status == 200) {
  615. vm.tabledata = res.data.data
  616. vm.datatotal = res.data.total
  617. if(vm.tabledata.length){
  618. vm.tableHeader=[]
  619. _.each(vm.tabledata[0],function(item,index){
  620. if(index!="town"&&index!="townName"&&index!="hospital"&&index!="hospitalName"&&index!="area"&&index!="areaName"&&index!="code"&&index!="name")
  621. vm.tableHeader.push({prop:index,label:index})
  622. })
  623. }
  624. } else {
  625. vm.$message.error(res.msg)
  626. }
  627. vm.isloading = false
  628. })
  629. },
  630. // 导出
  631. exportHandle:function(){
  632. // var uid = JSON.parse(window.localStorage.getItem('wlyyAgentForDoc')).uid
  633. // var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
  634. // saveAs(blob, "hello world.txt");
  635. // return
  636. var vm =this
  637. var vm = this,searchJson=undefined
  638. vm.fullscreenLoading = true
  639. searchJson = vm.beforeReq('export')
  640. var areaCode = vm.areaCode=="350200"?"":vm.areaCode
  641. var chooseYear = vm.radio=='1'?vm.chooseYear:'' //年份
  642. var startDate = vm.radio=='2'?vm.searchJsonTime.start:''
  643. var endDate = vm.radio=='2'?vm.searchJsonTime.end:''
  644. if(vm.handleNodeId == 0) {
  645. if(searchJson){
  646. statisticAPI.statisticsExportExport({
  647. startDate: searchJson.start,
  648. endDate: searchJson.end,
  649. quotaStr: searchJson.checked,
  650. range: vm.rangeCode,
  651. area: areaCode,
  652. hospital: vm.communityCode,
  653. team: vm.teamCode,
  654. timeLevel: vm.timeLevel,
  655. }, "综合查询.xls").then(function(res){
  656. vm.fullscreenLoading = false
  657. // toastr.info("导出成功")
  658. // var blob = new Blob(["Hello, world!"]);
  659. // FileSaver.saveAs(blob, "hello world.txt");
  660. // console.log(res)
  661. // FileSaver()
  662. })
  663. .catch(function(err){
  664. console.error(err)
  665. })
  666. // let str = httpRequest.server + 'statisticsExport/export?startDate='+searchJson.start+'&endDate='+searchJson.end+'&quotaStr='+searchJson.checked+'&range='+vm.rangeCode+'&area='+areaCode+'&hospital='+vm.communityCode+'&team='+vm.teamCode+'&timeLevel='+vm.timeLevel
  667. // window.location.href = str
  668. }
  669. }else if(vm.handleNodeId == 3) {
  670. // 咨询分析
  671. if(vm.analyseData.length!=0) {
  672. statisticAPI.statisticsExportExportConsultList({
  673. year: chooseYear,
  674. startDate: startDate,
  675. endDate: endDate,
  676. status: vm.radio1,
  677. area: areaCode,
  678. hospital: vm.communityCode,
  679. rang:vm.rangeCode,
  680. team: vm.teamCode,
  681. },vm.derive+".xls").then(function(res){
  682. vm.fullscreenLoading = false
  683. // var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
  684. // FileSaver.saveAs(blob, "hello world.txt");
  685. // FileSaver()
  686. })
  687. .catch(function(err){
  688. console.error(err)
  689. })
  690. // var str = httpRequest.server + 'statisticsExport/exportConsultList?year='+chooseYear+'&startDate='+startDate+'&endDate='+endDate+
  691. // '&status='+vm.radio1+'&area='+areaCode+'&hospital='+vm.communityCode+'&rang='+vm.rangeCode+'&team='+vm.teamCode
  692. // window.location.href = str
  693. }
  694. }else if(vm.handleNodeId == 4) {
  695. // 签约分析
  696. if(vm.analyseData.length!=0) {
  697. statisticAPI.statisticsExportExportSignList({
  698. year: chooseYear,
  699. startDate: startDate,
  700. endDate: endDate,
  701. serverType:vm.serverType,
  702. status:vm.radio2,
  703. isUpdate:vm.form.endorseTheTicket,
  704. isAdd:vm.form.renew,
  705. isOut:vm.form.backToSign,
  706. isBindWX:vm.form.WeChat,
  707. area: areaCode,
  708. hospital: vm.communityCode,
  709. rang:vm.rangeCode,
  710. team: vm.teamCode,
  711. },vm.derive+".xls").then(function(res){
  712. vm.fullscreenLoading = false
  713. // var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
  714. // FileSaver.saveAs(blob, "hello world.txt");
  715. // FileSaver()
  716. })
  717. .catch(function(err){
  718. console.error(err)
  719. })
  720. // var str = httpRequest.server + 'statisticsExport/exportSignList?year='+chooseYear+'&startDate='+startDate+'&endDate='+endDate+
  721. // '&serverType='+vm.serverType+'&status='+vm.radio2+'&isUpdate='+vm.form.endorseTheTicket+'&isAdd='+vm.form.renew+'&isOut='+vm.form.backToSign+'&isBindWX='+vm.form.WeChat+
  722. // '&area='+areaCode+'&hospital='+vm.communityCode+'&rang='+vm.rangeCode+'&team='+vm.teamCode
  723. // window.location.href = str
  724. }
  725. }else if(vm.handleNodeId == 5) {
  726. // 专病分析
  727. if(vm.analyseData.length!=0) {
  728. statisticAPI.statisticsExportExportSickList({
  729. year: chooseYear,
  730. startDate: startDate,
  731. endDate: endDate,
  732. diseaseType:vm.diseaseDataType,
  733. status:vm.radio3,
  734. doctorName:vm.form2.juniorCollege,
  735. familyDoctorName:vm.form2.family,
  736. patientName:vm.form2.resident,
  737. area: areaCode,
  738. hospital: vm.communityCode,
  739. rang:vm.rangeCode,
  740. team: vm.teamCode,
  741. },vm.derive+".xls").then(function(res){
  742. vm.fullscreenLoading = false
  743. // var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
  744. // FileSaver.saveAs(blob, "hello world.txt");
  745. // FileSaver()
  746. })
  747. .catch(function(err){
  748. console.error(err)
  749. })
  750. // var str = httpRequest.server + 'statisticsExport/exportSickList?year='+chooseYear+'&startDate='+startDate+'&endDate='+endDate+
  751. // '&diseaseType='+vm.diseaseDataType+'&status='+vm.radio3+'&doctorName='+vm.form2.juniorCollege+'&familyDoctorName='+vm.form2.family+'&patientName='+vm.form2.resident+
  752. // '&area='+areaCode+'&hospital='+vm.communityCode+'&rang='+vm.rangeCode+'&team='+vm.teamCode
  753. // window.location.href = str
  754. }
  755. }else if(vm.handleNodeId == 6) {
  756. // 生日祝福分析
  757. if(vm.analyseData.length!=0) {
  758. statisticAPI.statisticsExportGetBirthdayPatientListExport({
  759. signYear: chooseYear,
  760. startDate: startDate,
  761. endDate: endDate,
  762. patientName:vm.form3.resident,
  763. doctorName:vm.form3.family,
  764. status:vm.radio4,
  765. area: areaCode,
  766. hospital: vm.communityCode,
  767. range:vm.rangeCode,
  768. team: vm.teamCode,
  769. pageSize:'50000',
  770. page:vm.currentPage,
  771. },vm.derive+".xls").then(function(res){
  772. vm.fullscreenLoading = false
  773. // var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
  774. // FileSaver.saveAs(blob, "hello world.txt");
  775. // FileSaver()
  776. })
  777. .catch(function(err){
  778. console.error(err)
  779. })
  780. // var str = httpRequest.server + 'statisticsExport/getBirthdayPatientListExport?signYear='+chooseYear+'&startDate='+startDate+'&endDate='+endDate+
  781. // '&patientName='+vm.form5.resident+'&doctorName='+vm.form5.family+'&status='+vm.radio4+
  782. // '&area='+areaCode+'&hospital='+vm.communityCode+'&range='+vm.rangeCode+'&team='+vm.teamCode+'&pageSize=500000'+'&page='+vm.currentPage
  783. // console.log(str,"str生日祝福")
  784. // window.location.href = str
  785. }
  786. }else if(vm.handleNodeId == 7) {
  787. // 上门服务分析
  788. if(vm.analyseData.length!=0) {
  789. statisticAPI.statisticsExportExportDoorServiceList({
  790. signYear: chooseYear,
  791. startDate: startDate,
  792. endDate: endDate,
  793. patientName:vm.form4.resident,
  794. doctorName:vm.form4.family,
  795. status:vm.radio5,
  796. type:vm.serviceTypeDataType,
  797. area: areaCode,
  798. hospital: vm.communityCode,
  799. range:vm.rangeCode,
  800. team: vm.teamCode,
  801. pageSize:vm.currentSize,
  802. page:vm.currentPage,
  803. },vm.derive+".xls").then(function(res){
  804. vm.fullscreenLoading = false
  805. // var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
  806. // FileSaver.saveAs(blob, "hello world.txt");
  807. // FileSaver()
  808. })
  809. .catch(function(err){
  810. console.error(err)
  811. })
  812. // var str = httpRequest.server + 'statisticsExport/exportDoorServiceList?signYear='+chooseYear+'&startDate='+startDate+'&endDate='+endDate+
  813. // '&patientName='+vm.form5.resident+'&doctorName='+vm.form5.family+'&status='+vm.radio5+'&type='+vm.serviceTypeDataType+
  814. // '&area='+areaCode+'&hospital='+vm.communityCode+'&range='+vm.rangeCode+'&team='+vm.teamCode+'&pageSize'+vm.currentSize+'&page='+vm.currentPage
  815. // // console.log(str,"str上门服务分析")
  816. // window.location.href = str
  817. }
  818. }else if(vm.handleNodeId == 8) {
  819. // 长处方分析
  820. if(vm.analyseData.length!=0) {
  821. statisticAPI.statisticsExportExportPrescriptionList({
  822. signYear: chooseYear,
  823. startDate: startDate,
  824. endDate: endDate,
  825. patientName:vm.form5.resident,
  826. doctorName:vm.form5.family,
  827. status:vm.radio6,
  828. diagnosisName:vm.radio7,
  829. dispensaryType:vm.radio8,
  830. area: areaCode,
  831. hospital: vm.communityCode,
  832. range:vm.rangeCode,
  833. team: vm.teamCode,
  834. pageSize:vm.currentSize,
  835. page:vm.currentPage,
  836. },vm.derive+".xls").then(function(res){
  837. vm.fullscreenLoading = false
  838. // var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
  839. // FileSaver.saveAs(blob, "hello world.txt");
  840. // FileSaver()
  841. })
  842. .catch(function(err){
  843. console.error(err)
  844. })
  845. // var str = httpRequest.server + 'statisticsExport/exportPrescriptionList?signYear='+chooseYear+'&startDate='+startDate+'&endDate='+endDate+
  846. // '&patientName='+vm.form5.resident+'&doctorName='+vm.form5.family+'&status='+vm.radio6+'&diagnosisName='+vm.radio7+'&dispensaryType='+vm.radio8+
  847. // '&area='+areaCode+'&hospital='+vm.communityCode+'&range='+vm.rangeCode+'&team='+vm.teamCode+'&pageSize=500000'+'&page='+vm.currentPage
  848. // console.log(str,"str长处方分析")
  849. // window.location.href = str
  850. }
  851. }
  852. },
  853. backClick:function(){
  854. history.go(-1);
  855. },
  856. bindEvent:function(){
  857. var vm=this
  858. //监听后退按钮的操作
  859. EventBus.$on("back-click", function (arg) {
  860. EventBus.$emit('update-statistics-time', {}); //更新统计时间
  861. vm.backClick()
  862. });
  863. //监听页面刷新
  864. EventBus.$on("refresh-click", function (arg) {
  865. EventBus.$emit('update-statistics-time', {}); //更新统计时间
  866. initData(vm)
  867. });
  868. $("#main").removeClass("c-hide");
  869. },
  870. // 下一页 上一页
  871. handleCurrentChange:function(val) {
  872. var vm = this
  873. vm.currentPage = val
  874. if(vm.handleNodeId == 0) {
  875. vm.getStatisticDataList()
  876. }else if(vm.handleNodeId == 3) {
  877. // 咨询分析
  878. vm.getConsultList()
  879. }else if(vm.handleNodeId == 4) {
  880. // 签约分析
  881. vm.getSignList()
  882. }else if(vm.handleNodeId == 5) {
  883. // 专病分析
  884. vm.getSickList()
  885. }else if(vm.handleNodeId == 6) {
  886. // 生日祝福分析
  887. vm.getBirthdayPatientList()
  888. }else if(vm.handleNodeId == 7) {
  889. // 上门服务分析
  890. vm.getDoorServiceList()
  891. }else if(vm.handleNodeId == 8) {
  892. // 长处方分析
  893. vm.getPrescriptionList()
  894. }
  895. },
  896. //获取省市区 type:区3
  897. getDistrict: function(type,code,name) {
  898. var vm=this,list = [],param=""
  899. if(type == 3){
  900. list = [{code:code,name:name}]
  901. param = "area"
  902. }else if(type == 5){
  903. list = [{code:"",name:"全部"}]
  904. param = "community"
  905. }
  906. var params={
  907. type:type,code:code
  908. }
  909. homeAPI.getDistrict(params).then(function(res) {
  910. if(res.status == 200) {
  911. vm[param+"List"]=list.concat(res.list)
  912. vm[param+"Code"]=vm[param+"List"][0].code
  913. } else {
  914. vm.$message.error(res.msg)
  915. }
  916. })
  917. },
  918. selChange:function(type){
  919. var vm=this,name=""
  920. if(type == 3){
  921. vm.initSelOption("community")
  922. vm.initSelOption("team")
  923. vm.getCommunityHospital()
  924. }else if(type == 5){
  925. vm.initSelOption("team")
  926. vm.teamListByArea()
  927. }
  928. },
  929. initSelOption:function(param){
  930. var vm=this
  931. vm[param+"List"]=[{code:"",name:"全部"}]
  932. if(param == "team"){
  933. vm[param+"List"]=[{id:"",name:"全部"}]
  934. }
  935. vm[param+"Code"]=vm[param+"List"][0].code||vm[param+"List"][0].id
  936. },
  937. getCommunityHospital:function() {
  938. var vm=this,list = [{code:"",name:"全部"}],param="community"
  939. homeAPI.getCommunityHospital({area:vm.areaCode=='350200'?"":vm.areaCode}).then(function(res) {
  940. if(res.status == 200) {
  941. vm[param+"List"]=list.concat(res.data)
  942. vm[param+"Code"]=vm[param+"List"][0].code
  943. } else {
  944. vm.$message.error(res.msg)
  945. }
  946. })
  947. },
  948. teamListByArea:function() {
  949. var vm=this,list = [{id:"",name:"全部"}],param="team"
  950. homeAPI.teamListByArea({area:vm.areaCode=='350200'?"":vm.areaCode,hospital:vm.communityCode}).then(function(res) {
  951. if(res.status == 200) {
  952. vm[param+"List"]=list.concat(res.data)
  953. vm[param+"Code"]=vm[param+"List"][0].id
  954. } else {
  955. vm.$message.error(res.msg)
  956. }
  957. })
  958. }
  959. },
  960. })
  961. // 初始化时间
  962. function initTime(vm){
  963. var now = new Date();
  964. vm.end = now.format("yyyy-MM-dd")
  965. var start = now.getTime() - 30*24*60*60*1000
  966. vm.start = new Date(start).format("yyyy-MM-dd")
  967. vm.nowyear = vm.chooseYear = now.getFullYear()
  968. vm.nowmonth = now.getMonth()+1
  969. vm.years = []
  970. for(i=vm.nowyear; i>=2016; i--){
  971. vm.years.push(i)
  972. }
  973. }
  974. // 数据范围初始化
  975. function initScope(vm) {
  976. //获得缓存中缓存的角色权限
  977. var userRole = window.sessionStorage.getItem("selectedRole");
  978. if (!userRole) {
  979. return false;
  980. }
  981. vm.userRole = JSON.parse(userRole);
  982. //level:2、市,3、区,4、社区,5、团队
  983. vm.initareaLevel = vm.areaLevel = vm.userRole.code == '350200' ? 2 : vm.userRole.code.length == 6 ? 3 : 4;
  984. vm.initlevel = vm.level = vm.userRole.code == '350200' ? 4 : vm.userRole.code.length == 6 ? 3 : 2;
  985. // vm.lowLevel = vm.initlowLevel = vm.userRole.code == '350200' ? 3 : vm.userRole.code.length == 6 ? 2 : 1;
  986. vm.initarea =vm.area = vm.userRole.code;
  987. vm.areaTitle = vm.userRole.name;
  988. vm.rangeList=[{name:"按区",code:"town"},{name:"按社区",code:"hospital"},{name:"按团队",code:"team"}]
  989. if(vm.initlevel == 4){ //市获取区
  990. vm.getDistrict(3,vm.initarea,vm.areaTitle.substr(0,3))
  991. vm.rangeCode = vm.rangeList[0].code
  992. }else if(vm.initlevel == 3){ //区获取社区
  993. vm.areaList = [{code:vm.initarea,name:vm.areaTitle}]
  994. vm.areaCode = vm.initarea
  995. vm.rangeCode = vm.rangeList[0].code
  996. }else if(vm.initlevel == 2){ //社区获取团队
  997. vm.communityList = [{code:vm.initarea,name:vm.areaTitle}]
  998. vm.communityCode = vm.initarea
  999. vm.rangeList.shift()
  1000. vm.rangeCode = vm.rangeList[0].code
  1001. }
  1002. vm.searchJson.range = vm.rangeCode
  1003. }
  1004. function initData(vm) {
  1005. initScope(vm)
  1006. //初始化时间
  1007. initTime(vm)
  1008. vm.tabledata = []
  1009. vm.bindEvent()
  1010. }