var template = '' $.ajax('../../../component/statistics/GxbCy/index.html', { data: {}, dataType: 'html', cache: false, timeout: 60000, async: false, error: function (res) {}, success: function (res) { template = res } }) Vue.component('gxb-cy', { template: template, props: [], data: function () { return { years: [], yearType: '1', chooseYear: null, chooseTime: null, rangeOptions: [ { label: '区', value: 'town' }, { label: '社区', value: 'hospital' }, { label: '团队', value: 'team' } ], areaOptions: [ { label: '思明区', value: '350203' }, { label: '海沧区', value: '350205' }, { label: '湖里区', value: '350206' }, { label: '集美区', value: '350211' }, { label: '同安区', value: '350212' }, { label: '翔安区', value: '350213' } ], hospitalOptions: [], teamOptions: [], form: { range: 'town' }, loading: false, exportLoading: false, tableData: [], tableHeader: [], constantHeader: [ { label: '康复管理人数', prop: 'totalNum' }, { label: '康复计划次数', prop: 'totalTimes' } ], tableHeaderChildren: [ { label: '随访1', children: [ { label: '应发送消息人次', prop: 'v1Num', width: '130' }, { label: '已发送消息人次', prop: 'vd1Num', width: '130' } ] }, { label: '随访2', children: [ { label: '已登记人次', prop: 'v2Num', width: '100' }, { label: '已达标人次', prop: 'vd2Num', width: '100' }, { label: '达标率', prop: 'v2Rate', width: '100' } ] }, { label: '随访3', children: [ { label: '应发送消息人次', prop: 'v3Num', width: '130' }, { label: '已发送消息人次', prop: 'vd3Num', width: '130' } ] }, { label: '随访4', children: [ { label: '已登记人次', prop: 'v4Num', width: '100' }, { label: '已达标人次', prop: 'vd4Num', width: '100' }, { label: '达标率', prop: 'v4Rate', width: '100' } ] } ], level: 0, visible: false, title: '', query: {}, dataRangeOption: [], dialogTableData: [], dialogHeader: [], page: 1, size: 10, total: 0, messageVisible: false, messInfo: null, remind: '', dialogExportLoading: false, dialogLoading: false, service: {} } }, methods: { init() { var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole')) if (selectedRole.code.indexOf('350200') > -1) { this.level = 1 // 市卫健委 this.areaOptions = [ { label: '厦门市', value: '' }, { label: '思明区', value: '350203' }, { label: '海沧区', value: '350205' }, { label: '湖里区', value: '350206' }, { label: '集美区', value: '350211' }, { label: '同安区', value: '350212' }, { label: '翔安区', value: '350213' } ] } else if (selectedRole.code.length == 6) { this.level = 2 // 区管理 this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }] this.form = { range: 'town', area: selectedRole.code } this.getHospital(selectedRole.code) } else { this.level = 3 // 社区管理 this.rangeOptions = [ { label: '社区', value: 'hospital' }, { label: '团队', value: 'team' } ] this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code.substring(0, 6) }] this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }] this.form = { range: 'hospital', area: selectedRole.code.substring(0, 6), hospital: selectedRole.code } this.getTeam(selectedRole.code) } this.initTime() this.searchFn() }, initTime() { var vm = this var now = new Date() vm.nowyear = vm.chooseYear = now.getFullYear() vm.years = [] for (i = vm.nowyear; i >= 2013; i--) { vm.years.push(i) } }, resetArea() { if (this.level == 1) { delete this.form.area delete this.form.hospital delete this.form.team } else if (this.level == 2) { delete this.form.hospital delete this.form.team } else { delete this.form.team } }, searchFn() { var vm = this this.loading = true var params = { ...this.form, isTotal: 1 } vm.tableData = [] if (this.yearType == '1') { params.startDate = this.chooseYear + '-01-01' params.endDate = this.chooseYear + '-12-31' } else { if (this.chooseTime) { params.startDate = this.chooseTime[0] params.endDate = this.chooseTime[1] } } if (this.form.range == 'town') { this.tableHeader = getTownHeader().concat(this.constantHeader) } else if (this.form.range == 'hospital') { this.tableHeader = getHospitalHeader().concat(this.constantHeader) } else { this.tableHeader = getTeamHeader().concat(this.constantHeader) } httpRequest.get('statistics/collaborate/gxbRehabilitationInfo', { data: params }).then(function (res) { if (res.status == 200) { vm.tableData = res.detailModelList.map(function (item) { var data = JSON.parse(JSON.stringify(item)) if (vm.form.range == 'town') { data.town = item.name data.hasChildren = true } else if (vm.form.range == 'hospital') { data.hospital = item.name data.hasChildren = true } else if (vm.form.range == 'team') { data.team = item.name } return data }) } vm.loading = false }) }, exportTable() { var vm = this var params = { ...this.form } if (this.yearType == '1') { params.startDate = this.chooseYear + '-01-01' params.endDate = this.chooseYear + '-12-31' } else { if (this.chooseTime) { params.startDate = this.chooseTime[0] params.endDate = this.chooseTime[1] } } this.exportLoading = true var fileName = `冠心病康复管理情况统计表${new Date().getTime()}.xls` httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbRehabilitationInfo', fileName, params).then(function () { vm.exportLoading = false }) }, eliminateClick() { var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole')) if (this.level == 1) { this.form = { range: 'town' } } else if (this.level == 2) { this.form = { range: 'town', area: selectedRole.code } this.getHospital(selectedRole.code) } else { this.form = { range: 'hospital', area: selectedRole.code.substring(0, 6), hospital: selectedRole.code } this.getTeam(selectedRole.code) } this.yearType = '1' this.chooseYear = new Date().getFullYear() this.chooseTime = null this.$forceUpdate() }, getHospital(code, flag = true) { var vm = this if (flag) { delete this.form.hospital delete this.form.team } var params = { type: 5, code: code } httpRequest.post('common/district', { data: params }).then(function (res) { vm.hospitalOptions = [{ code: '', name: '全部' }] vm.hospitalOptions = vm.hospitalOptions.concat(res.list) }) }, getTeam(code, flag = true) { var vm = this if (flag) { delete this.form.team } var params = { hospital: code, area: this.form.area } httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) { vm.teamOptions = [{ id: '', name: '全部' }] vm.teamOptions = vm.teamOptions.concat(res.data) }) }, load(row, treeNode, resolve) { var params = {} var len = row.code.length if (len == 6) { params.range = 'hospital' params.area = row.code } else if (len == 10) { params.range = 'team' params.hospital = row.code } if (this.yearType == '1') { params.startDate = this.chooseYear + '-01-01' params.endDate = this.chooseYear + '-12-31' } else { if (this.chooseTime) { params.startDate = this.chooseTime[0] params.endDate = this.chooseTime[1] } } httpRequest.get('statistics/collaborate/gxbRehabilitationInfo', { data: params }).then(function (res) { if (res.status == 200) { var children = res.detailModelList.map(function (item) { var data = JSON.parse(JSON.stringify(item)) if (len == 6) { data.hospital = item.name data.hasChildren = true } else if (len == 10) { data.team = item.name } return data }) resolve(children) } }) }, openDialog(row, prop) { if (!row.code) return this.page = 1 this.query = {} var len = row.code.length if (len == 6) { this.query.range = 'town' this.query.area = row.code } else if (len == 10) { this.query.range = 'hospital' this.query.hospital = row.code } else { this.query.range = 'team' this.query.team = row.code } this.dataRangeOption = [{ label: row.name, value: row.code }] if (prop == 'vd1Num' || prop == 'vd3Num') { this.title = '康复随访消息推送明细' this.dialogHeader = [ { label: '姓名', prop: 'patientName' }, { label: '性别', prop: 'sex' }, { label: '年龄', prop: 'age' }, { label: '证件号码', prop: 'idcard' }, { label: '签约医院', prop: 'hospitalName' }, { label: '签约医生', prop: 'doctorName' }, { label: '提醒类型', prop: 'typeName' }, { label: '消息推送时间', prop: 'createTime' }, { label: '出院下转时间', prop: 'turnTime' }, { label: '消息推送人', prop: 'senderName' } ] if (prop == 'vd1Num') { this.query.visitCount = 1 } else { this.query.visitCount = 3 } this.visible = true this.selectSmsInfoList() } else if (prop == 'v2Num' || prop == 'v4Num') { this.title = '康复随访记录明细' this.dialogHeader = [ { label: '姓名', prop: 'name' }, { label: '性别', prop: 'sex' }, { label: '年龄', prop: 'age' }, { label: '手机号', prop: 'mobile' }, { label: '下转医院', prop: 'turnHospitalName' }, { label: '下转医生', prop: 'turnDoctorName' }, { label: '下转时间', prop: 'createTime' }, { label: '所属机构', prop: 'hospitalName' }, { label: '随访医生', prop: 'doctorName' }, { label: '计划随访时间', prop: 'followupPlanDate' }, { label: '实际随访时间', prop: 'followupDate' } ] if (prop == 'v2Num') { this.query.visitCount = 2 } else { this.query.visitCount = 4 } this.visible = true this.gxbRehabilitationFollowupRecord() } }, gxbRehabilitationFollowupRecord() { var vm = this var params = { ...this.query, page: this.page, size: this.size } if (this.yearType == '1') { params.startDate = this.chooseYear + '-01-01' params.endDate = this.chooseYear + '-12-31' } else { if (this.chooseTime) { params.startDate = this.chooseTime[0] params.endDate = this.chooseTime[1] } } this.dialogLoading = true httpRequest.get('statistics/collaborate/gxbRehabilitationFollowupRecord', { data: params }).then(function (res) { if (res.status == 200) { vm.dialogTableData = res.detailModelList vm.total = res.totalCount } vm.dialogLoading = false }) }, dialogSearchFn() { this.page = 1 this.dialogSearch() }, dialogSearch() { if (this.title == '康复随访记录明细') { this.gxbRehabilitationFollowupRecord() } else { this.selectSmsInfoList() } }, selectSmsInfoList() { var vm = this var params = { ...this.query, type: 2, page: this.page, size: this.size } if (this.yearType == '1') { params.startDate = this.chooseYear + '-01-01' params.endDate = this.chooseYear + '-12-31' } else { if (this.chooseTime) { params.startDate = this.chooseTime[0] params.endDate = this.chooseTime[1] } } this.dialogLoading = true httpRequest.get('statistics/collaborate/selectSmsInfoList', { data: params }).then(function (res) { if (res.status == 200) { vm.dialogTableData = res.detailModelList vm.total = res.totalCount } vm.dialogLoading = false }) }, dialogExportFn() { var vm = this this.exportLoading = true if (this.title == '康复随访记录明细') { var params = { ...this.query } if (this.yearType == '1') { params.startDate = this.chooseYear + '-01-01' params.endDate = this.chooseYear + '-12-31' } else { if (this.chooseTime) { params.startDate = this.chooseTime[0] params.endDate = this.chooseTime[1] } } var fileName = `康复随访记录明细${new Date().getTime()}.xls` httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbRehabilitationFollowupRecord', fileName, params).then(function () { vm.exportLoading = false }) } else { var params = { ...this.query, type: 2 } if (this.yearType == '1') { params.startDate = this.chooseYear + '-01-01' params.endDate = this.chooseYear + '-12-31' } else { if (this.chooseTime) { params.startDate = this.chooseTime[0] params.endDate = this.chooseTime[1] } } var fileName = `康复随访消息推送明细${new Date().getTime()}.xls` httpRequest.downLoadFileForAjax('statistics/collaborate/exportSelectSmsInfoList', fileName, params).then(function () { vm.exportLoading = false }) } }, dialogReset() { var params = { ...this.query } this.query = { visitCount: params.visitCount, range: typeof params.range == 'undefined' ? '' : params.range, area: typeof params.area == 'undefined' ? '' : params.area, hospital: typeof params.hospital == 'undefined' ? '' : params.hospital, team: typeof params.team == 'undefined' ? '' : params.team } }, closeDialog() { this.visible = false }, seePatientDetail(row, prop) { if (prop == 'patientName' || prop == 'name') { EventBus.$emit('preview-person-info', { type: '5', code: row.code }) } }, handleCurrentChange(val) { this.page = val this.dialogSearch() }, handleSizeChange(val) { this.size = val this.dialogSearch() }, previewForm(row) { var vm = this var params = { planDetailId: row.planDetailId } 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=' + row.planDetailId, end: function () { // 未点击确定按钮,点击关闭按钮 } }) } }) }, previewMess(row) { this.messageVisible = true this.messInfo = row.content }, closeMessageDialog() { this.messageVisible = false }, getData(data) { if (data) { this.yearType = data.yearType this.form.range = data.range this.form.area = data.area this.form.hospital = data.hospital this.form.team = data.team if (this.yearType == 1) { this.chooseYear = data.time } else { this.chooseTime = data.time } if (this.form.hospital) { // 如果有社区code传过来就调社区医院列表接口 this.getHospital(data.area, false) } if (this.form.team) { // 如果有团队code传过来就调团队列表接口 this.getTeam(data.hospital, false) } this.searchFn() } else { this.init() } }, renderHeader: function (h, item) { var label = item.column.label var column = item.column var tooltip = { '签约社区': '显示为该患者当前的签约社区医院名称', '社区医院': '显示为该患者当前的签约社区医院名称', '签约医院': '显示为该患者当前的签约社区医院名称', '签约医生': '显示为该患者当前的签约社区医生名称', '家庭医生': '显示为该患者当前的签约社区医生名称' } if (label == '签约社区' || label == '签约医生' || label == '签约医院' || label == '家庭医生' || label == '社区医院') { return [ label, h( 'el-tooltip', { props: { content: (function () { return tooltip[label] })(), placement: 'top' } }, [ h('span', { class: { 'el-icon-question': true } }) ] ) ] } else { return [column.label] } } }, mounted() { // this.init() } })