index.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. var template = ''
  2. $.ajax('../../../component/statistics/JzSituation/index.html', {
  3. data: {},
  4. dataType: 'html',
  5. cache: false,
  6. timeout: 60000,
  7. async: false,
  8. error: function (res) {},
  9. success: function (res) {
  10. template = res
  11. }
  12. })
  13. Vue.component('jz-situation', {
  14. template: template,
  15. props: [],
  16. data: function () {
  17. return {
  18. years: [],
  19. yearType: '1',
  20. chooseYear: null,
  21. chooseTime: null,
  22. rangeOptions: [
  23. { label: '区', value: 'town' },
  24. { label: '医院', value: 'hospital' },
  25. { label: '团队', value: 'team' }
  26. ],
  27. areaOptions: [
  28. { label: '思明区', value: '350203' },
  29. { label: '海沧区', value: '350205' },
  30. { label: '湖里区', value: '350206' },
  31. { label: '集美区', value: '350211' },
  32. { label: '同安区', value: '350212' },
  33. { label: '翔安区', value: '350213' }
  34. ],
  35. hospitalOptions: [],
  36. teamOptions: [],
  37. form: {
  38. range: 'town'
  39. },
  40. loading: false,
  41. exportLoading: false,
  42. tableData: [],
  43. tableHeader: [
  44. { label: '居民', prop: 'name', width: '110' },
  45. { label: '就诊卡', prop: 'totalTimes', width: '90' },
  46. { label: '身份证', prop: '1', width: '90' },
  47. { label: '手机号', prop: '2 ', width: '110' },
  48. { label: '地址', prop: '3', width: '110' },
  49. { label: '是否签约', prop: '4', width: '110' },
  50. { label: '社区名称', prop: '5', width: '110' },
  51. { label: '就诊医院', prop: '6', width: '110' },
  52. { label: '就诊时间', prop: '6', width: '110' },
  53. { label: '就诊科室', prop: '6', width: '110' },
  54. { label: '诊断结果', prop: '6', width: '110' },
  55. { label: '就诊类型', prop: '6', width: '110' },
  56. { label: '费用总和', prop: '6', width: '110' },
  57. ],
  58. page: 1,
  59. size: 10,
  60. total: 0,
  61. level: 0
  62. }
  63. },
  64. methods: {
  65. init() {
  66. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  67. if (selectedRole.code.indexOf('350200') > -1) {
  68. this.level = 1 // 市卫健委
  69. this.areaOptions = [
  70. { label: '思明区', value: '350203' },
  71. { label: '海沧区', value: '350205' },
  72. { label: '湖里区', value: '350206' },
  73. { label: '集美区', value: '350211' },
  74. { label: '同安区', value: '350212' },
  75. { label: '翔安区', value: '350213' }
  76. ]
  77. } else if (selectedRole.code.length == 6) {
  78. this.level = 2 // 区管理
  79. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  80. this.form = {
  81. range: 'town',
  82. area: selectedRole.code
  83. }
  84. this.getHospital(selectedRole.code)
  85. } else {
  86. this.level = 3 // 社区管理
  87. this.rangeOptions = [
  88. { label: '医院', value: 'hospital' },
  89. { label: '团队', value: 'team' }
  90. ]
  91. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  92. this.hospital = [{ label: selectedRole.name, value: selectedRole.code }]
  93. this.form = {
  94. range: 'hospital',
  95. area: selectedRole.code.substring(0, 6),
  96. hospital: selectedRole.code
  97. }
  98. this.getTeam(selectedRole.code)
  99. }
  100. this.initTime()
  101. this.getList()
  102. },
  103. initTime() {
  104. var vm = this
  105. var now = new Date()
  106. vm.nowyear = vm.chooseYear = now.getFullYear()
  107. vm.years = []
  108. for (i = vm.nowyear; i >= 2013; i--) {
  109. vm.years.push(i)
  110. }
  111. },
  112. resetArea() {
  113. if (this.level == 1) {
  114. delete this.form.area
  115. delete this.form.hospital
  116. delete this.form.team
  117. } else if (this.level == 2) {
  118. delete this.form.hospital
  119. delete this.form.team
  120. } else {
  121. delete this.form.team
  122. }
  123. },
  124. getList() {
  125. return
  126. var vm = this
  127. this.loading = true
  128. var params = {
  129. ...this.form,
  130. page: this.page,
  131. pageSize: this.size
  132. }
  133. if (this.yearType == '1') {
  134. params.startDate = this.chooseYear + '-01-01'
  135. params.endDate = this.chooseYear + '-12-31'
  136. } else {
  137. if (this.chooseTime) {
  138. params.startDate = this.chooseTime[0]
  139. params.endDate = this.chooseTime[1]
  140. }
  141. }
  142. httpRequest.get('statistics/collaborate/signInfoStatistics', { data: params }).then(function (res) {
  143. if (res.status == 200) {
  144. vm.tableData = res.detailModelList
  145. vm.total = res.totalCount
  146. }
  147. vm.loading = false
  148. })
  149. },
  150. queryDate() {
  151. this.page = 1
  152. this.getList()
  153. },
  154. exportTable() {
  155. var vm = this
  156. var params = {
  157. ...this.form,
  158. page: this.page,
  159. pageSize: this.size
  160. }
  161. if (this.yearType == '1') {
  162. params.startDate = this.chooseYear + '-01-01 00:00'
  163. params.endDate = this.chooseYear + '-12-31 23:59'
  164. } else {
  165. if (this.chooseTime) {
  166. params.startDate = this.chooseTime[0] + ' 00:00'
  167. params.endDate = this.chooseTime[1] + ' 23:59'
  168. }
  169. }
  170. this.exportLoading = true
  171. var fileName = `冠心病门诊下转统计表${new Date().getTime()}.xls`
  172. httpRequest.downLoadFileForAjax('statistics/collaborate/exportSignInfoStatistics', fileName, params).then(function () {
  173. vm.exportLoading = false
  174. })
  175. },
  176. eliminateClick() {
  177. this.resetArea()
  178. this.yearType = '1'
  179. this.chooseYear = new Date().getFullYear()
  180. this.chooseTime = null
  181. this.$forceUpdate()
  182. },
  183. getHospital(code) {
  184. var vm = this
  185. delete this.form.hospital
  186. delete this.form.team
  187. var params = {
  188. type: 5,
  189. code: code
  190. }
  191. httpRequest.post('common/district', { data: params }).then(function (res) {
  192. vm.hospitalOptions = res.list
  193. })
  194. },
  195. getTeam(code) {
  196. var vm = this
  197. delete this.form.team
  198. var params = {
  199. hospital: code
  200. }
  201. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  202. vm.teamOptions = res.data
  203. })
  204. },
  205. handleCurrentChange(val) {
  206. this.page = val
  207. this.getList()
  208. },
  209. handleSizeChange(val) {
  210. this.size = val
  211. this.getList()
  212. }
  213. },
  214. mounted() {
  215. this.init()
  216. }
  217. })