dyjdRzsfjd.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. var template = ''
  2. $.ajax('../html/dyjdRzsfjd.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. Vue.component('mzf-dyjd-rzsfjd', {
  15. props: ['type'],
  16. template: template,
  17. data: function() {
  18. return {
  19. mzfSfjdData:[],
  20. list:[],
  21. startTime:new Date('2023','05','26'),
  22. endTime:new Date(),
  23. regionList:[],
  24. regionData:[
  25. {label:'全市',id:'1',type:'1'}
  26. ],
  27. regionListList:[],
  28. tertiaryHospitalsData:[
  29. {label:'全部',id:'1',type:'2'}
  30. ],
  31. communityHospitalsList:[],
  32. communityHospitalsData:[
  33. {label:'全部',id:'1',type:'3'}
  34. ],
  35. groupingList:[],
  36. groupingData:[
  37. {label:'全部',id:'1',type:'4'}
  38. ],
  39. administrationStatusList:[],
  40. administrationStatusData:[
  41. {label:'全部',id:'1',type:'5'}
  42. ],
  43. show:false,
  44. showTwo:false,
  45. showThree:false,
  46. currentPage:1,
  47. currentSize:10,
  48. datatotal:0, //总数
  49. loadingTwo:false,
  50. setDisabled:{
  51. disabledDate:function(time) {
  52. return time.getTime() < new Date('2023','05','26') || time.getTime() > Date.now();
  53. }
  54. },
  55. setDisabled1:{
  56. disabledDate:function(time) {
  57. return time.getTime() > Date.now();
  58. }
  59. },
  60. s:'',
  61. e:'',
  62. mergeObj: {},
  63. mergeArr: ['areaName', 'gradeHospitalName','communityHospitalName','targetEntryCont','v1AllCount'],
  64. }
  65. },
  66. created: function(){
  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.getCopdFollowData()
  71. },
  72. watch:{
  73. 'type':{
  74. handler:function(o){
  75. console.log('w1w1ww1w1w1w1w1w1w1w1w1w1w1w1w1w1w1w1w1w1w1w1w1w1',o)
  76. this.getCopdFollowData()
  77. },
  78. deep: true,
  79. },
  80. 'startTime':{
  81. handler:function(o) {
  82. if(!o) {
  83. this.list.splice(0,1)
  84. }
  85. },
  86. deep: true,
  87. immediate: true
  88. },
  89. 'endTime':{
  90. handler:function(o) {
  91. if(!o) {
  92. this.list.splice(0,1)
  93. }
  94. },
  95. deep: true,
  96. immediate: true
  97. },
  98. },
  99. methods: {
  100. getCopdFollowData:function() {
  101. var vm = this
  102. vm.loadingTwo = true
  103. var data = {
  104. startTime:this.startTime.format('yyyy-MM-dd'),
  105. endTime:this.endTime.format('yyyy-MM-dd')
  106. }
  107. if(vm.type==="dyjdrzsfjd"){
  108. statisticAPI.getFirstStageEntryData({
  109. jsonStr:JSON.stringify(data)
  110. }).then(function(res){
  111. if(res.status == 200) {
  112. vm.loadingTwo = false
  113. // console.log( '旧:我是第一阶段随访入组记录',res.data);
  114. vm.mzfSfjdData = vm.mergeArrays(res.data.data01,res.data.data02)
  115. console.log( '新:我是第一阶段随访入组记录',vm.mzfSfjdData);
  116. vm.getSpanArr(vm.mzfSfjdData)
  117. }
  118. }).catch(function(err){
  119. vm.loadingTwo = false
  120. })
  121. }else{
  122. statisticAPI.getCommunityHospitalFollowData({
  123. jsonStr:JSON.stringify(data)
  124. }).then(function(res){
  125. if(res.status == 200) {
  126. vm.loadingTwo = false
  127. // console.log( '旧:我是第二阶段社区医院随访记录',res.data);
  128. vm.mzfSfjdData = vm.mergeArrays(res.data.data01,res.data.data02)
  129. console.log( '新:我是第二阶社区医院随访进度',res.data);
  130. vm.getSpanArr(vm.mzfSfjdData)
  131. }
  132. }).catch(function(err){
  133. vm.loadingTwo = false
  134. })
  135. }
  136. },
  137. //合并新数据
  138. mergeArrays:function(array1, array2) {
  139. var mergedArray = [];
  140. array1.forEach(function(item1,index){
  141. array2.slice(index*3,index*3+3).forEach(function(item2){
  142. var mergedObj = Object.assign({}, item1, item2);
  143. mergedArray.push(mergedObj);
  144. })
  145. })
  146. return mergedArray;
  147. },
  148. startTimeChange:function(o) {
  149. if(!this.list[0] || this.list[0].type!=0) {
  150. this.list.unshift({type:'0',id:'time',label:o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  151. }else{
  152. this.list[0].label = o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  153. }
  154. },
  155. endTimeChange:function(o) {
  156. if(!this.list[0] || this.list[0].type!=0) {
  157. this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')})
  158. }else{
  159. this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')
  160. }
  161. },
  162. deleteClick:function(item) {
  163. if(item.id == "time") {
  164. this.startTime = ''
  165. this.endTime = ''
  166. this.list.splice(0,1)
  167. }
  168. var index = this.list.findIndex(function(v){
  169. return item.id == v.id
  170. })
  171. this.list.splice(index,1)
  172. },
  173. // 下一页 上一页
  174. handleCurrentChange:function(val) {
  175. var vm = this
  176. vm.currentPage = val
  177. },
  178. change:function(val) {
  179. this.list = this.list.concat(val)
  180. },
  181. // 确定
  182. confirm:function() {
  183. this.getCopdFollowData()
  184. },
  185. // 取消
  186. cancel:function() {
  187. this.startTime = new Date('2023','05','26')
  188. this.endTime = new Date()
  189. if(!this.list[0] || this.list[0].type!=0) {
  190. this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  191. }else{
  192. this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  193. }
  194. },
  195. // 导出 慢阻肺随访进度
  196. exportHandle:function() {
  197. var vm = this
  198. vm.loadingTwo = true
  199. var data = {
  200. startTime:this.startTime.format('yyyy-MM-dd'),
  201. endTime:this.endTime.format('yyyy-MM-dd')
  202. }
  203. var jsonStr = JSON.stringify(data)
  204. if(vm.type=="dyjdrzsfjd"){
  205. console.log('11111111111111111111111111111111111111111')
  206. statisticAPI.exportFirstStageEntryData({
  207. jsonStr: encodeURIComponent(jsonStr)
  208. },'慢阻肺第一阶段入组随访进度.xls').then(function(res){
  209. vm.loadingTwo = false
  210. })
  211. }else{
  212. statisticAPI.exportCommunityHospitalFollowData({
  213. jsonStr: encodeURIComponent(jsonStr)
  214. },'慢阻肺第二阶段社区医院随访进度.xls').then(function(res){
  215. vm.loadingTwo = false
  216. })
  217. }
  218. },
  219. // getSpanArr(data) {
  220. // this.mergeArr.forEach((key, index1) => {
  221. // var count = 0; // 用来记录需要合并行的起始位置
  222. // this.mergeObj[key] = []; // 记录每一列的合并信息
  223. // data.forEach((item, index) => {
  224. // // index == 0表示数据为第一行,直接 push 一个 1
  225. // if(index === 0) {
  226. // this.mergeObj[key].push(1);
  227. // } else {
  228. // // 判断当前行是否与上一行其值相等 如果相等 在 count 记录的位置其值 +1 表示当前行需要合并 并push 一个 0 作为占位
  229. // if(item[key] === data[index - 1][key]) {
  230. // this.mergeObj[key][count] += 1;
  231. // this.mergeObj[key].push(0);
  232. // } else {
  233. // // 如果当前行和上一行其值不相等
  234. // count = index; // 记录当前位置
  235. // this.mergeObj[key].push(1); // 重新push 一个 1
  236. // }
  237. // }
  238. // })
  239. // })
  240. // },
  241. getSpanArr(data) {
  242. this.mergeArr.forEach((key, index1) => {
  243. var count = 0; // 用来记录需要合并行的起始位置
  244. this.mergeObj[key] = []; // 记录每一列的合并信息
  245. data.forEach((item, index) => {
  246. // index == 0表示数据为第一行,直接 push 一个 1
  247. if(index === 0) {
  248. this.mergeObj[key].push(1);
  249. } else {
  250. // 判断当前行是否与上一行其值相等 如果相等 在 count 记录的位置其值 +1 表示当前行需要合并 并push 一个 0 作为占位
  251. if(key==='targetEntryCont'||key==='v1AllCount'){
  252. if(item[key] === data[index - 1][key] && this.mergeObj[key][count]%3!=0) {
  253. this.mergeObj[key][count] += 1;
  254. this.mergeObj[key].push(0);
  255. } else {
  256. // 如果当前行和上一行其值不相等
  257. count = index; // 记录当前位置
  258. this.mergeObj[key].push(1); // 重新push 一个 1
  259. }
  260. }else{
  261. if(item[key] === data[index - 1][key] ) {
  262. this.mergeObj[key][count] += 1;
  263. this.mergeObj[key].push(0);
  264. } else {
  265. // 如果当前行和上一行其值不相等
  266. count = index; // 记录当前位置
  267. this.mergeObj[key].push(1); // 重新push 一个 1
  268. }
  269. }
  270. }
  271. })
  272. })
  273. },
  274. //得到行、列的合并值
  275. objectSpanMethod: function({row, column, rowIndex, columnIndex}) {
  276. if(this.mergeArr.indexOf(column.property) !== -1) {
  277. // 判断其值是不是为0
  278. if(this.mergeObj[column.property][rowIndex]) {
  279. return [this.mergeObj[column.property][rowIndex], 1]
  280. } else {
  281. // 如果为0则为需要合并的行
  282. return [0, 0];
  283. }
  284. }
  285. },
  286. renderHeadeRexpert: function(h, item) {
  287. var index = item.$index
  288. return [
  289. index=='2'?'目标v2入组例数':index=='3'?'首例V1入筛时间(YYYY/MM/DD)':(index=='4'||index=='5')?'首例V2入组时间(YYYY/MM/DD)':item.column.index=='11'?'正常访视':item.column.index=='12'
  290. ?'超窗':item.column.index=='13'?'正常访视':item.column.index=='14'?'超窗':item.column.index=='15'?'V3':item.column.index=='16'?'V4':item.column.index=='17'?'V5':item.column.index=='18'?'V6':item.column.index=='19'?'合计':item.column.index=='20'?'SEA':item.column.index=='21'?'病情恶化':item.column.index=='22'?'并发其他疾病':item.column.index=='23'?'自愿退出':item.column.index=='24'?'研究者终止':item.column.index=='25'?'不符合纳排':item.column.index=='26'?'失访':item.column.index=='27'?'妊娠':
  291. item.column.index=='28'?'死亡':item.column.index=='29'?'其他':'',
  292. h(
  293. 'el-tooltip',
  294. {
  295. props: {
  296. content: (function() {
  297. return index=='2'?'即目标入组例数(与管理目标数一致)':index=='3'?'完成V1的提交时间,即“第一例完成V1并成功纳入筛选期的访视日期':(index=='4'||index=='5')?'查询第一个入组的时间(访视2触发入组,统计第一个做访视2的患者,且是完成访视2提交的时间。)':item.column.index=='11'?'在访视窗口内完成的访视,即访视计划时间±7天内完成的访视。':item.column.index=='12'?'超过窗口期做的访视。':item.column.index=='13'?'在访视窗口内完成的访视,即访视计划时间±14天内完成的访视。':item.column.index=='14'?'超过窗口期做的访视。':
  298. item.column.index=='15'?'V3提前终止研究的人数':item.column.index=='16'?'V4提前终止研究的人数':item.column.index=='17'?'V5提前终止研究的人数':item.column.index=='18'?'V6提前终止研究的人数':item.column.index=='19'?'提前终止研究的人数':item.column.index=='20'?'提前终止原因为受试者出现不可耐受的过敏反应或严重不良事件的人数。':item.column.index=='21'?'提前终止原因为“在研究中出现病情的急剧恶化,无法继续参与研究”的人数。':item.column.index=='22'?'提前终止原因为“并发可能会影响研究结果的疾病”的人数。':item.column.index=='23'?'提前终止原因为“受试者不愿意或不能继续研究,或要求撤回知情同意”的人数。':
  299. item.column.index=='24'?'提前终止原因为“受试者不愿意或不能继续研究,或要求撤回知情同意”的人数。':item.column.index=='25'?'提前终止原因为“发现受试者不符合任一项纳入标准,或符合任一项排除标准”的人数。':item.column.index=='26'?'提前终止原因为失访的人数。':item.column.index=='27'?'提前终止原因为妊娠的人数。':
  300. item.column.index=='28'?'提前终止原因为死亡的人数。':item.column.index=='29'?'提前终止原因为其他的人数':''
  301. })(),
  302. placement: 'top'
  303. }
  304. },
  305. [
  306. h('span', {
  307. class: {
  308. 'el-icon-question': true
  309. }
  310. })
  311. ]
  312. )
  313. ]
  314. },
  315. }
  316. })