var template = '' $.ajax('../../../component/statistics/PersonInfo/index.html', { data: {}, dataType: 'html', cache: false, timeout: 60000, async: false, error: function (res) {}, success: function (res) { template = res } }) Vue.component('person-info', { template: template, props: [], data: function () { return { visible: false, code: null, loading: false, type: '1', patientInfo: {}, assessment: [], turnup: [], jzList: [], turnDown: [], rehabilitation: [], tabListName: ['assessment', 'turnup', 'jzList', 'turnDown', 'rehabilitation'], rehabilitationDetailVisible: false, sfList: [], currentPlan: {}, sfNumObj: {}, PlanDetailItems: [], service: {}, messageVisible: false, messInfo: '', title: '' } }, methods: { setImg(str) { return httpRequest.getImgUrl(str) }, getPatientInfo() { var vm = this httpRequest.get('statistics/collaborate/patientDetailInfo', { data: { code: vm.code } }).then(function (res) { vm.patientInfo = res.data vm.title = vm.patientInfo.name + '个案详情' }) }, goAssessment(code) { top.layer.open({ type: 2, // offset: ['100px'], //右下角弹出 area: ['568px', '80%'], shade: 0.5, title: '查看筛选结果', fixed: true, //不固定 maxmin: true, closeBtn: 1, shift: 5, shadeClose: false, //点击遮罩关闭层 content: '../../../app/jbsc/html/view_screening_results.html?resultCode=' + code + '&btnHide=1' }) }, previewMess(item) { var vm = this httpRequest.get('doctor/screen/findSurveyMessageContent', { data: { surveyResultCode: item.relation_code, type: 2 } }).then(function (res) { vm.messageVisible = true vm.messInfo = res.data }) }, closeMessageDialog() { this.messageVisible = false }, transformDataToAssessmentFormat(data, type) { // 创建一个空对象用于存储按年份分组的数据 var groupedByYear = {} // 创建一个数组用于记录年份出现的顺序 var yearOrder = [] // 遍历原始数据数组 data.forEach(function (item) { // 根据type参数选择不同的时间字段 var timeField = item.czrq || item.outpatientTime || item.createTime // 解析日期字符串并获取年份、月份和日期 var date = new Date(timeField) var year = date.getFullYear() var formattedDate = (date.getMonth() + 1).toString().padStart(2, '0') + '-' + date.getDate().toString().padStart(2, '0') var formattedTime = date.toTimeString().split(' ')[0] // 如果还没有这个年份的数据,初始化一个新的数组,并记录年份顺序 if (!groupedByYear[year]) { groupedByYear[year] = [] yearOrder.push(year) // 记录年份首次出现的位置 } // 构建新的对象并添加到对应年份的数组中 groupedByYear[year].push({ date: formattedDate, time: formattedTime, ...item }) }) // 然后构建最终的评估对象,按照原始顺序 var assessment = yearOrder.map(function (year) { return { year: year, children: groupedByYear[year] } }) return assessment }, handleClick(item) { this.getPatientDetailList(item.name) }, getPatientDetailList(type) { var vm = this vm.loading = true console.log('kkkkkkkkkkkkkkkkkkkkooooooooooo', type) httpRequest.get('statistics/collaborate/patientDetailList', { data: { code: vm.code, type: type } }).then(function (res) { var data = vm.transformDataToAssessmentFormat(res.data, type) vm[vm.tabListName[Number(type) - 1]] = data vm.loading = false }) }, openDialog(data) { this.visible = true this.type = data.type this.code = data.code this.getPatientInfo() this.getPatientDetailList(this.type) }, closeDialog() { this.visible = false this.rehabilitationDetailVisible = false }, copyToClipboard(text) { var textarea = document.createElement('textarea') textarea.style.position = 'fixed' textarea.style.opacity = 0 textarea.value = text document.body.appendChild(textarea) textarea.select() document.execCommand('copy') document.body.removeChild(textarea) this.$message.success('复制成功') }, toDetail(item) { var vm = this var params = { planDetailId: item.id } if (item.visitCount == 1 || item.visitCount == 3) { vm.previewMess(item) } else { rehaAPI.serviceItem(params).then(function (res) { if (res.status == 200) { vm.service = res.data top.layer.open({ type: 2, area: ['600px', '700px'], shade: 0.5, title: '记录随访表单', fixed: true, //不固定 maxmin: true, closeBtn: 1, // shift: 5, shadeClose: false, //点击遮罩关闭层 content: '../../rehabilitation/html/followRecord.html?serviceInfo=' + encodeURIComponent(JSON.stringify(vm.service)) + '&planDetailId=' + item.id, end: function () { // 未点击确定按钮,点击关闭按钮 } }) } }) } }, toRehabilitationDetail(item) { this.currentPlan = item this.getSfList() this.rehabilitationDetailVisible = true }, getSfList() { var vm = this var params = { searchTask: 6, planId: this.currentPlan.id, executeEndTime: '', executeStartTime: '', status: '' } var params1 = { searchTask: '', planId: this.currentPlan.id, executeEndTime: '', executeStartTime: '', status: '' } httpRequest.get('doctor/specialist/rehabilitation/calendarPlanDetailList', { data: params }).then(function (res) { vm.sfList = res.data }) httpRequest.get('doctor/specialist/rehabilitation/calendarPlanDetailItems', { data: params1 }).then(function (res) { vm.PlanDetailItems = res.data.filter(function (item) { if (item.code == 6) { vm.sfNumObj = item } if (item.code == 2 || item.code == 3) { console.log(item, 'kkkkkkkkkkkkkkkkkkkkkkkkkk') return item.compeletTotal != 0 } if (item.code != 2 && item.code != 3) { return item.code != 4 && item.code != 5 && item.code != 6 } }) }) }, back() { this.rehabilitationDetailVisible = false } } })