index.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. var template = ''
  2. $.ajax('../../../component/statistics/PersonInfo/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('person-info', {
  14. template: template,
  15. props: [],
  16. data: function () {
  17. return {
  18. visible: false,
  19. code: null,
  20. loading: false,
  21. type: '1',
  22. patientInfo: {},
  23. assessment: [],
  24. turnup: [],
  25. jzList: [],
  26. turnDown: [],
  27. rehabilitation: [],
  28. tabListName: ['assessment', 'turnup', 'jzList', 'turnDown', 'rehabilitation'],
  29. rehabilitationDetailVisible: false,
  30. sfList: [],
  31. currentPlan: {},
  32. sfNumObj: {},
  33. PlanDetailItems: [],
  34. service: {},
  35. messageVisible: false,
  36. messInfo: '',
  37. title: ''
  38. }
  39. },
  40. methods: {
  41. setImg(str) {
  42. return httpRequest.getImgUrl(str)
  43. },
  44. getPatientInfo() {
  45. var vm = this
  46. httpRequest.get('statistics/collaborate/patientDetailInfo', { data: { code: vm.code } }).then(function (res) {
  47. vm.patientInfo = res.data
  48. vm.title = vm.patientInfo.name + '个案详情'
  49. })
  50. },
  51. goAssessment(code) {
  52. top.layer.open({
  53. type: 2,
  54. // offset: ['100px'], //右下角弹出
  55. area: ['568px', '80%'],
  56. shade: 0.5,
  57. title: '查看筛选结果',
  58. fixed: true, //不固定
  59. maxmin: true,
  60. closeBtn: 1,
  61. shift: 5,
  62. shadeClose: false, //点击遮罩关闭层
  63. content: '../../../app/jbsc/html/view_screening_results.html?resultCode=' + code + '&btnHide=1'
  64. })
  65. },
  66. previewMess(item) {
  67. var vm = this
  68. httpRequest.get('doctor/screen/findSurveyMessageContent', { data: { surveyResultCode: item.relation_code, type: 2 } }).then(function (res) {
  69. vm.messageVisible = true
  70. vm.messInfo = res.data
  71. })
  72. },
  73. closeMessageDialog() {
  74. this.messageVisible = false
  75. },
  76. transformDataToAssessmentFormat(data, type) {
  77. // 创建一个空对象用于存储按年份分组的数据
  78. var groupedByYear = {}
  79. // 创建一个数组用于记录年份出现的顺序
  80. var yearOrder = []
  81. // 遍历原始数据数组
  82. data.forEach(function (item) {
  83. // 根据type参数选择不同的时间字段
  84. var timeField = item.czrq || item.outpatientTime || item.createTime
  85. // 解析日期字符串并获取年份、月份和日期
  86. var date = new Date(timeField)
  87. var year = date.getFullYear()
  88. var formattedDate = (date.getMonth() + 1).toString().padStart(2, '0') + '-' + date.getDate().toString().padStart(2, '0')
  89. var formattedTime = date.toTimeString().split(' ')[0]
  90. // 如果还没有这个年份的数据,初始化一个新的数组,并记录年份顺序
  91. if (!groupedByYear[year]) {
  92. groupedByYear[year] = []
  93. yearOrder.push(year) // 记录年份首次出现的位置
  94. }
  95. // 构建新的对象并添加到对应年份的数组中
  96. groupedByYear[year].push({
  97. date: formattedDate,
  98. time: formattedTime,
  99. ...item
  100. })
  101. })
  102. // 然后构建最终的评估对象,按照原始顺序
  103. var assessment = yearOrder.map(function (year) {
  104. return {
  105. year: year,
  106. children: groupedByYear[year]
  107. }
  108. })
  109. return assessment
  110. },
  111. handleClick(item) {
  112. this.getPatientDetailList(item.name)
  113. },
  114. getPatientDetailList(type) {
  115. var vm = this
  116. vm.loading = true
  117. console.log('kkkkkkkkkkkkkkkkkkkkooooooooooo', type)
  118. httpRequest.get('statistics/collaborate/patientDetailList', { data: { code: vm.code, type: type } }).then(function (res) {
  119. var data = vm.transformDataToAssessmentFormat(res.data, type)
  120. vm[vm.tabListName[Number(type) - 1]] = data
  121. vm.loading = false
  122. })
  123. },
  124. openDialog(data) {
  125. this.visible = true
  126. this.type = data.type
  127. this.code = data.code
  128. this.getPatientInfo()
  129. this.getPatientDetailList(this.type)
  130. },
  131. closeDialog() {
  132. this.visible = false
  133. this.rehabilitationDetailVisible = false
  134. },
  135. copyToClipboard(text) {
  136. var textarea = document.createElement('textarea')
  137. textarea.style.position = 'fixed'
  138. textarea.style.opacity = 0
  139. textarea.value = text
  140. document.body.appendChild(textarea)
  141. textarea.select()
  142. document.execCommand('copy')
  143. document.body.removeChild(textarea)
  144. this.$message.success('复制成功')
  145. },
  146. toDetail(item) {
  147. var vm = this
  148. var params = {
  149. planDetailId: item.id
  150. }
  151. if (item.visitCount == 1 || item.visitCount == 3) {
  152. vm.previewMess(item)
  153. } else {
  154. rehaAPI.serviceItem(params).then(function (res) {
  155. if (res.status == 200) {
  156. vm.service = res.data
  157. top.layer.open({
  158. type: 2,
  159. area: ['600px', '700px'],
  160. shade: 0.5,
  161. title: '记录随访表单',
  162. fixed: true, //不固定
  163. maxmin: true,
  164. closeBtn: 1,
  165. // shift: 5,
  166. shadeClose: false, //点击遮罩关闭层
  167. content: '../../rehabilitation/html/followRecord.html?serviceInfo=' + encodeURIComponent(JSON.stringify(vm.service)) + '&planDetailId=' + item.id,
  168. end: function () {
  169. // 未点击确定按钮,点击关闭按钮
  170. }
  171. })
  172. }
  173. })
  174. }
  175. },
  176. toRehabilitationDetail(item) {
  177. this.currentPlan = item
  178. this.getSfList()
  179. this.rehabilitationDetailVisible = true
  180. },
  181. getSfList() {
  182. var vm = this
  183. var params = {
  184. searchTask: 6,
  185. planId: this.currentPlan.id,
  186. executeEndTime: '',
  187. executeStartTime: '',
  188. status: ''
  189. }
  190. var params1 = {
  191. searchTask: '',
  192. planId: this.currentPlan.id,
  193. executeEndTime: '',
  194. executeStartTime: '',
  195. status: ''
  196. }
  197. httpRequest.get('doctor/specialist/rehabilitation/calendarPlanDetailList', { data: params }).then(function (res) {
  198. vm.sfList = res.data
  199. })
  200. httpRequest.get('doctor/specialist/rehabilitation/calendarPlanDetailItems', { data: params1 }).then(function (res) {
  201. vm.PlanDetailItems = res.data.filter(function (item) {
  202. if (item.code == 6) {
  203. vm.sfNumObj = item
  204. }
  205. if (item.code == 2 || item.code == 3) {
  206. console.log(item, 'kkkkkkkkkkkkkkkkkkkkkkkkkk')
  207. return item.compeletTotal != 0
  208. }
  209. if (item.code != 2 && item.code != 3) {
  210. return item.code != 4 && item.code != 5 && item.code != 6
  211. }
  212. })
  213. })
  214. },
  215. back() {
  216. this.rehabilitationDetailVisible = false
  217. }
  218. }
  219. })