index.js 8.5 KB

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