index.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. var template = ''
  2. $.ajax('../../../component/statistics/TurndownAnalysis/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('turndown-analysis', {
  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: '100' },
  45. { label: '年龄', prop: 'age', width: '90' },
  46. { label: '性别', prop: 'sex', width: '90' },
  47. { label: '手机号', prop: 'mobile', width: '110' },
  48. { label: '是否签约', prop: 'isSign', width: '110' },
  49. { label: '社区名称', prop: 'hospitalName', width: '130' },
  50. { label: '下转次数', prop: 'num', width: '100' },
  51. { label: '最近一次下转诊断', prop: 'diagnosisName', width: '130' },
  52. { label: '最近一次下转时间', prop: 'turnDownTime', width: '150' },
  53. { label: '最近一次下转类型', prop: 'eventType', width: '130' },
  54. { label: '风险评估次数', prop: 'screenNum', width: '110' },
  55. { label: '最近一次评估结果', prop: 'screenResult', width: '130' }
  56. ],
  57. page: 1,
  58. size: 10,
  59. total: 0,
  60. level: 0,
  61. }
  62. },
  63. methods: {
  64. init() {
  65. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  66. if (selectedRole.code.indexOf('350200') > -1) {
  67. this.level = 1 // 市卫健委
  68. this.areaOptions = [
  69. { label: '思明区', value: '350203' },
  70. { label: '海沧区', value: '350205' },
  71. { label: '湖里区', value: '350206' },
  72. { label: '集美区', value: '350211' },
  73. { label: '同安区', value: '350212' },
  74. { label: '翔安区', value: '350213' }
  75. ]
  76. } else if (selectedRole.code.length == 6) {
  77. this.level = 2 // 区管理
  78. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  79. this.form = {
  80. range: 'town',
  81. area: selectedRole.code
  82. }
  83. this.getHospital(selectedRole.code)
  84. } else {
  85. this.level = 3 // 社区管理
  86. this.rangeOptions = [
  87. { label: '社区', value: 'hospital' },
  88. { label: '团队', value: 'team' }
  89. ]
  90. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code.substring(0, 6) }]
  91. this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
  92. this.form = {
  93. range: 'hospital',
  94. area: selectedRole.code.substring(0, 6),
  95. hospital: selectedRole.code
  96. }
  97. this.getTeam(selectedRole.code)
  98. }
  99. this.initTime()
  100. this.getList()
  101. },
  102. initTime() {
  103. var vm = this
  104. var now = new Date()
  105. vm.nowyear = vm.chooseYear = now.getFullYear()
  106. vm.years = []
  107. for (i = vm.nowyear; i >= 2013; i--) {
  108. vm.years.push(i)
  109. }
  110. },
  111. resetArea() {
  112. if (this.level == 1) {
  113. delete this.form.area
  114. delete this.form.hospital
  115. delete this.form.team
  116. } else if (this.level == 2) {
  117. delete this.form.hospital
  118. delete this.form.team
  119. } else {
  120. delete this.form.team
  121. }
  122. },
  123. getList() {
  124. var vm = this
  125. this.loading = true
  126. var params = {
  127. ...this.form,
  128. page: this.page,
  129. pageSize: this.size
  130. }
  131. if (this.yearType == '1') {
  132. params.startDate = this.chooseYear + '-01-01'
  133. params.endDate = this.chooseYear + '-12-31'
  134. } else {
  135. if (this.chooseTime) {
  136. params.startDate = this.chooseTime[0]
  137. params.endDate = this.chooseTime[1]
  138. }
  139. }
  140. httpRequest.get('statistics/collaborate/turnDownAnalysis', { data: params }).then(function (res) {
  141. if (res.status == 200) {
  142. vm.tableData = res.detailModelList
  143. vm.total = res.totalCount
  144. }
  145. vm.loading = false
  146. })
  147. },
  148. queryDate() {
  149. this.page = 1
  150. this.getList()
  151. },
  152. exportTable() {
  153. var vm = this
  154. var params = {
  155. ...this.form,
  156. page: this.page,
  157. pageSize: this.size
  158. }
  159. if (this.yearType == '1') {
  160. params.startDate = this.chooseYear + '-01-01'
  161. params.endDate = this.chooseYear + '-12-31'
  162. } else {
  163. if (this.chooseTime) {
  164. params.startDate = this.chooseTime[0]
  165. params.endDate = this.chooseTime[1]
  166. }
  167. }
  168. this.exportLoading = true
  169. var fileName = `下转动态分析${new Date().getTime()}.xls`
  170. httpRequest.downLoadFileForAjax('statistics/collaborate/exportTurnDownAnalysis', fileName, params).then(function () {
  171. vm.exportLoading = false
  172. })
  173. },
  174. eliminateClick() {
  175. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  176. if (this.level == 1) {
  177. this.form = {
  178. range: 'town'
  179. }
  180. } else if (this.level == 2) {
  181. this.form = {
  182. range: 'town',
  183. area: selectedRole.code
  184. }
  185. this.getHospital(selectedRole.code)
  186. } else {
  187. this.form = {
  188. range: 'hospital',
  189. area: selectedRole.code.substring(0, 6),
  190. hospital: selectedRole.code
  191. }
  192. this.getTeam(selectedRole.code)
  193. }
  194. this.yearType = '1'
  195. this.chooseYear = new Date().getFullYear()
  196. this.chooseTime = null
  197. this.$forceUpdate()
  198. },
  199. getHospital(code) {
  200. var vm = this
  201. delete this.form.hospital
  202. delete this.form.team
  203. var params = {
  204. type: 5,
  205. code: code
  206. }
  207. httpRequest.post('common/district', { data: params }).then(function (res) {
  208. vm.hospitalOptions = [{ code: '', name: '全部' }]
  209. vm.hospitalOptions = vm.hospitalOptions.concat(res.list)
  210. })
  211. },
  212. getTeam(code) {
  213. var vm = this
  214. delete this.form.team
  215. var params = {
  216. hospital: code,
  217. area: this.form.area
  218. }
  219. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  220. vm.teamOptions = [{ id: '', name: '全部' }]
  221. vm.teamOptions = vm.teamOptions.concat(res.data)
  222. })
  223. },
  224. handleCurrentChange(val) {
  225. this.page = val
  226. this.getList()
  227. },
  228. handleSizeChange(val) {
  229. this.size = val
  230. this.getList()
  231. },
  232. openDialog(scope) {
  233. layer.open({
  234. type: 2,
  235. // offset: ['100px'], //右下角弹出
  236. area: ['568px', '100%'],
  237. shade: 0.5,
  238. title: '查看筛选结果',
  239. fixed: true, //不固定
  240. maxmin: true,
  241. closeBtn: 1,
  242. shift: 5,
  243. shadeClose: false, //点击遮罩关闭层
  244. content: `../../jbsc/html/view_screening_results.html?resultCode=${scope.row.code}&opt=1`
  245. })
  246. }
  247. },
  248. mounted() {
  249. this.init()
  250. }
  251. })