index.js 6.7 KB

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