mzfV1rzReport.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. var template = ''
  2. $.ajax('../html/mzfv1rzReport.html',{
  3. data: {},
  4. dataType: 'html',
  5. cache: false,
  6. timeout: 60000,
  7. async: false,
  8. error: function(res) {
  9. },
  10. success: function(res) {
  11. template = res
  12. }
  13. })
  14. let date = new Date();
  15. let today = date.toISOString().split('T')[0];
  16. let oneWeekBeforeDate = new Date(date.getTime() - (7 * 24 * 60 * 60 * 1000));
  17. Vue.component('mzf-v1rzreport', {
  18. props: [],
  19. template: template,
  20. data: function() {
  21. return {
  22. mzfWorksheetData:[],
  23. list:[], // 已选列表
  24. startTime: oneWeekBeforeDate, //new Date('2023','05','26'),
  25. endTime: new Date(),
  26. regionList:[], // 地区
  27. regionData:[],
  28. threeHospitalList:[], // 三级医院
  29. tertiaryHospitalsData:[],
  30. communityHospitalsList:[], //社区医院
  31. communityHospitalsData:[],
  32. groupingList:[], // 分组
  33. groupingData:[],
  34. administrationStatusList:[], // 管理状态
  35. administrationStatusData:[
  36. {label:'全部',id:'8',type:'5', disabled: true, checked: false},
  37. {label:'已管理',id:'7',type:'5', disabled: true, checked: false},
  38. {label:'在管',id:'1',type:'5', disabled: true, checked: false},
  39. {label:'未管理',id:'0',type:'5', disabled: true, checked: false},
  40. {label:'不纳入管理',id:'4',type:'5', disabled: true, checked: false},
  41. {label:'入组',id:'5',type:'5', disabled: false , checked: false},
  42. {label:'出组',id:'3',type:'5', disabled: true, checked: false},
  43. {label:'失访',id:'2',type:'5', disabled: true, checked: false},
  44. {label:'死亡',id:'6',type:'5', disabled: true, checked: false},
  45. ],
  46. show:false,
  47. showTwo:false,
  48. showThree:false,
  49. currentPage:1,
  50. currentSize:10,
  51. datatotal:10, //总数
  52. loadingTwo:false,
  53. setDisabled:{
  54. disabledDate(time) {
  55. return time.getTime() < new Date('2023','05','26') || time.getTime() > Date.now();
  56. }
  57. },
  58. s:'',
  59. e:'',
  60. findType: 1,
  61. groupState: '',
  62. copdState: false
  63. }
  64. },
  65. created: function(){
  66. // 初始化时间条件
  67. this.s = this.startTime.format('yyyy-MM-dd')
  68. this.e = this.endTime.format('yyyy-MM-dd')
  69. this.list.unshift({type:'0',id:'time',label:this.s +"~"+ this.e})
  70. // this.cascadingFindHosptail() // 地区
  71. // this.threeHospital() // 三级医院
  72. // this.communityHospital() // 社区医院
  73. // this.group() // 分组
  74. this.findHospitalEntryCount() // 表单
  75. },
  76. watch:{
  77. 'startTime':{
  78. handler:function(o) {
  79. if(!o) {
  80. this.list.splice(0,1)
  81. }
  82. },
  83. deep: true,
  84. immediate: true
  85. },
  86. 'endTime':{
  87. handler:function(o) {
  88. if(!o) {
  89. this.list.splice(0,1)
  90. }
  91. },
  92. deep: true,
  93. immediate: true
  94. },
  95. },
  96. methods: {
  97. // 级联查询医院
  98. // cascadingFindHosptail: function(type, areaCode, hospitalCode) {
  99. // var vm = this
  100. // var data = {
  101. // findType: type ? type : 1, // findType 1查地区 2查三级医院 3社区医院 4 分组【对照组、康复组】
  102. // areaCode: areaCode || '',
  103. // hosptialCode: hospitalCode || '',
  104. // }
  105. // var jsonStr = JSON.stringify(data)
  106. // statisticAPI.cascadingFindHosptail({
  107. // jsonStr
  108. // }).then(res => {
  109. // if(res.status == 200) {
  110. // console.log(res);
  111. // if(vm.findType == 1) {
  112. // res.data.forEach(v => {
  113. // v.checked = false
  114. // })
  115. // this.regionData = [{areaCode:'', areaName:'全市', checked: true}].concat(res.data)
  116. // }else if(vm.findType == 2) {
  117. // this.tertiaryHospitalsData = [{areaCode:'', areaName:'', hospitalCode: '', hospitalName: '全部'}].concat(res.data)
  118. // }else if(vm.findType == 3) {
  119. // this.communityHospitalsData = [{areaCode:'', areaName:'', hospitalCode: '', hospitalName: '全部'}].concat(res.data)
  120. // }
  121. // else if (vm.findType == 4) {
  122. // var data = _.map(res.data, function(v) {
  123. // var temp = {}
  124. // for(var k in v) {
  125. // temp.code = k
  126. // temp.label = v[k]
  127. // }
  128. // return temp
  129. // })
  130. // console.log(data, 'fenzu');
  131. // this.groupingData = [{label:'全部',id:'1',type:'4'}].concat(data)
  132. // }
  133. // }
  134. // }).catch(function(err){
  135. // console.log(err);
  136. // })
  137. // },
  138. // // 获取全部三级医院
  139. // threeHospital: function() {
  140. // var vm = this
  141. // var data = {
  142. // findType: 2, // findType 1查地区 2查三级医院 3社区医院 4 分组【对照组、康复组】
  143. // areaCode: '',
  144. // hosptialCode: '',
  145. // }
  146. // var jsonStr = JSON.stringify(data)
  147. // statisticAPI.cascadingFindHosptail({
  148. // jsonStr
  149. // }).then(res => {
  150. // if(res.status == 200) {
  151. // // this.tertiaryHospitalsData = [{areaCode:'', areaName:'', hospitalCode: '', hospitalName: '全部'}].concat(res.data)
  152. // this.tertiaryHospitalsData = res.data
  153. // }
  154. // })
  155. // },
  156. // // 获取全部社区医院
  157. // communityHospital: function() {
  158. // var vm = this
  159. // var data = {
  160. // findType: 3, // findType 1查地区 2查三级医院 3社区医院 4 分组【对照组、康复组】
  161. // areaCode: '',
  162. // hosptialCode: '',
  163. // }
  164. // var jsonStr = JSON.stringify(data)
  165. // statisticAPI.cascadingFindHosptail({
  166. // jsonStr
  167. // }).then(res => {
  168. // if(res.status == 200) {
  169. // // this.communityHospitalsData = [{areaCode:'', areaName:'', hospitalCode: '', hospitalName: '全部'}].concat(res.data)
  170. // this.communityHospitalsData = res.data
  171. // }
  172. // })
  173. // },
  174. // // 获取分组
  175. // group: function() {
  176. // var vm = this
  177. // var data = {
  178. // findType: 4, // findType 1查地区 2查三级医院 3社区医院 4 分组【对照组、康复组】
  179. // areaCode: '',
  180. // hosptialCode: '',
  181. // }
  182. // var jsonStr = JSON.stringify(data)
  183. // statisticAPI.cascadingFindHosptail({
  184. // jsonStr
  185. // }).then(res => {
  186. // if(res.status == 200) {
  187. // var data = _.map(res.data, function(v) {
  188. // var temp = {}
  189. // for(var k in v) {
  190. // temp.code = k
  191. // temp.label = v[k]
  192. // }
  193. // return temp
  194. // })
  195. // console.log(data, 'fenzu');
  196. // // this.groupingData = [{label:'全部',id:'1',type:'4'}].concat(data)
  197. // this.groupingData = data
  198. // }
  199. // })
  200. // },
  201. // 查询数据接口 1默认时间,和 三级医院
  202. findHospitalEntryCount: function(code, hospitalCode, communityHospitalCode,groupingCode) {
  203. var vm = this
  204. vm.loadingTwo = true
  205. var data = {
  206. startTime:this.startTime.format('yyyy-MM-dd'),
  207. endTime:this.endTime.format('yyyy-MM-dd'),
  208. areaCode: code || '', // 地区code
  209. hosptialCode: hospitalCode || '', // 医院code
  210. communityHospitalCode: communityHospitalCode || '', // 社区医院code
  211. groupState: groupingCode || '', // 3 康复组 4 对照组
  212. copdState: 5
  213. }
  214. var jsonStr = JSON.stringify(data)
  215. statisticAPI.findHospitalEntryCount({
  216. jsonStr
  217. }).then(res => {
  218. if(res.status == 200) {
  219. console.log(res);
  220. vm.loadingTwo = false
  221. vm.mzfWorksheetData = res.data
  222. vm.datatotal = res.total
  223. }
  224. }).catch(function(err){
  225. console.log(err);
  226. })
  227. },
  228. // 开始时间
  229. startTimeChange:function(o) {
  230. if(!this.list[0] || this.list[0].type!=0) {
  231. this.list.unshift({type:'0',id:'time',label:o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  232. }else{
  233. this.list[0].label = o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  234. }
  235. },
  236. // 结束时间
  237. endTimeChange:function(o) {
  238. if(!this.list[0] || this.list[0].type!=0) {
  239. this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')})
  240. }else{
  241. this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')
  242. }
  243. },
  244. // 删除所选的条件
  245. deleteClick:function(item) {
  246. // 如果id==time 删除时间选择
  247. if(item.id == "time") {
  248. this.startTime = ''
  249. this.endTime = ''
  250. this.list.splice(0,1)
  251. }
  252. // 找对应当前点击的index 进行移除
  253. var index = this.list.findIndex(function(v){
  254. return item.id == v.id
  255. })
  256. this.list.splice(index,1)
  257. },
  258. // 下一页 上一页
  259. handleCurrentChange:function(val) {
  260. var vm = this
  261. vm.currentPage = val
  262. },
  263. // // 选择地区
  264. // change:function(val) {
  265. // console.log(val, '选择的数据');
  266. // var code = [] // 地区code
  267. // val.forEach(v => {
  268. // v.type = 1
  269. // v.label = v.areaName
  270. // code.push(v.areaCode)
  271. // })
  272. // this.findType = 2
  273. // this.cascadingFindHosptail(this.findType, code.join(',') , '',)
  274. // this.list = Array.from(new Set(this.list.concat(val)))
  275. // },
  276. // // 选择三级医院
  277. // changeHospital(val) {
  278. // var hospitalCode = [] // 三级医院code
  279. // val.forEach(v => {
  280. // v.type = 2
  281. // v.label = v.hospitalName
  282. // hospitalCode.push(v.hospitalCode)
  283. // })
  284. // this.findType = 3
  285. // this.cascadingFindHosptail(this.findType, '', hospitalCode.join(','))
  286. // this.list = Array.from(new Set(this.list.concat(val)))
  287. // },
  288. // // 选择社区
  289. // changeCommunityHospitals(val) {
  290. // console.log(val)
  291. // var communityHospitalCode = []
  292. // val.forEach(v => {
  293. // v.type = 3
  294. // v.label = v.hospitalName
  295. // communityHospitalCode.push(v.hospitalCode)
  296. // })
  297. // this.findType = 4
  298. // this.cascadingFindHosptail(this.findType, '', '')
  299. // this.list = Array.from(new Set(this.list.concat(val)))
  300. // },
  301. // // 分组
  302. // changeGroup(val) {
  303. // val.forEach(v => {
  304. // v.type = 4
  305. // })
  306. // this.list = Array.from(new Set(this.list.concat(val)))
  307. // },
  308. // // 管理状态
  309. // changeStatus(val) {
  310. // console.log(val);
  311. // this.list = Array.from(new Set(this.list.concat(val)))
  312. // },
  313. // 确定
  314. confirm:function() {
  315. // // 地区
  316. // var regionCode = []
  317. // this.regionList.forEach(v => {
  318. // regionCode.push(v.areaCode)
  319. // })
  320. // // 三级医院
  321. // var threeHospitaCode = []
  322. // this.threeHospitalList.forEach(v => {
  323. // threeHospitaCode.push(v.hospitalCode)
  324. // })
  325. // // 社区医院
  326. // var communityHospitalCode = []
  327. // this.communityHospitalsList.forEach(v => {
  328. // communityHospitalCode.push(v.hospitalCode)
  329. // })
  330. // var groupingCode = []
  331. // this.groupingList.forEach(v => {
  332. // groupingCode.push(v.code)
  333. // })
  334. // this.findHospitalEntryCount(regionCode.join(','), threeHospitaCode.join(','), communityHospitalCode.join(','), groupingCode.join(','))
  335. this.findHospitalEntryCount()
  336. },
  337. // 取消
  338. cancel:function() {
  339. this.startTime = oneWeekBeforeDate
  340. this.endTime = new Date()
  341. if(!this.list[0] || this.list[0].type!=0) {
  342. this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  343. }else{
  344. this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  345. }
  346. // this.list = []
  347. // this.regionList = []
  348. // this.threeHospitalList = []
  349. // this.communityHospitalsList = []
  350. // this.groupingList = []
  351. // this.administrationStatusList = []
  352. // this.list.unshift({type:'0',id:'time',label:this.s +"~"+ this.e},{type:'2', id:'1', label:'全部'})
  353. // this.findHospitalEntryCount()
  354. },
  355. // 导出
  356. exportHandle:function() {
  357. // // 地区
  358. // var regionCode = []
  359. // // 三级医院
  360. // var threeHospitaCode = []
  361. // // 社区医院
  362. // var communityHospitalCode = []
  363. // // 分组
  364. // var groupingCode = []
  365. // this.list.forEach(v => {
  366. // regionCode.push(v.areaCode)
  367. // threeHospitaCode.push(v.hospitalCode)
  368. // communityHospitalCode.push(v.hospitalCode)
  369. // groupingCode.push(v.code)
  370. // })
  371. var vm = this
  372. vm.loadingTwo = true
  373. var data = {
  374. startTime: vm.startTime.format('yyyy-MM-dd'),
  375. endTime: vm.endTime.format('yyyy-MM-dd'),
  376. areaCode: '', // 地区code
  377. hosptialCode: '', // 医院code
  378. communityHospitalCode: '', // 社区医院code
  379. groupState: '', // 3 康复组 4 对照组
  380. }
  381. var jsonStr = JSON.stringify(data)
  382. statisticAPI.exportHospitalEntryCount({
  383. jsonStr: encodeURIComponent(jsonStr)
  384. },'v1\入组情况报表.xls').then(function(res){
  385. vm.loadingTwo = false
  386. })
  387. },
  388. }
  389. })