index.js 6.6 KB

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