var template = '' $.ajax('../../../component/statistics/GxbMz/index.html', { data: {}, dataType: 'html', cache: false, timeout: 60000, async: false, error: function (res) {}, success: function (res) { template = res } }) Vue.component('gxb-mz', { 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: 'totalTimes', width: '90' }, { label: '门诊下转次数', prop: 'mzTimes', width: '110' }, { label: '出院下转次数', prop: 'zyTimes', width: '110' }, { label: '下转人数', prop: 'totalNum', width: '110' }, { label: '门诊下转人数', prop: 'mzNum', width: '110' }, { label: '出院下转人数', prop: 'zyNum', width: '110' }, { label: '门诊下转已评估', prop: 'mzScreenNum', width: '120' }, { label: '门诊下转未评估', prop: 'unMzScreenNum', width: '120' }, { label: '出院下转已评估', prop: 'zyScreenNum', width: '120' }, { label: '出院下转未评估', prop: 'unZyScreenNum', width: '120' } ], level: 0, visible: false, query: {}, dataRangeOption: [], dialogTableData: [], dialogHeader: [], page: 1, size: 10, total: 0, messageVisible: false, messInfo: null, remind: '', dialogLoading: false, dialogExportLoading: false, statusOptions: [], rehabilitationHospital: [], archiveList: [], inviteStatus: [ { value: '', label: '全部' }, { value: '1', label: '门诊患者' }, { value: '2', label: '出院患者' } ], communityHospitals: [], title: '', dialogVisible: false, signatoryList: [] } }, 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 }] 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() this.getDictData() this.hospitalsByType() }, 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 } }, getDictData() { var vm = this statisticAPI.getDictByDictName({ name: 'rehabilitation_status' }).then(function (res) { vm.statusOptions = [{ value: '全部', code: '' }] vm.statusOptions = vm.statusOptions.concat(res.list) }) statisticAPI.getDictByDictName({ name: 'rehabilitation_hospital' }).then(function (res) { vm.rehabilitationHospital = [{ value: '全部', code: '' }] vm.rehabilitationHospital = vm.rehabilitationHospital.concat(res.list) }) statisticAPI.getDictByDictName({ name: 'archive_status' }).then(function (res) { vm.archiveList = [{ value: '全部', code: '' }] vm.archiveList = vm.archiveList.concat(res.list) }) }, 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/gxbTurnDownInfo', { 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 = data.code && true } else if (vm.form.range == 'hospital') { data.hospital = item.name data.hasChildren = data.code && 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/exportGxbTurnDownInfo', 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 } if (!code) { vm.hospitalOptions = [{ name: '全部', value: '' }] vm.teamOptions = [{ name: '全部', value: '' }] return false } httpRequest.post('common/district', { data: params }).then(function (res) { vm.hospitalOptions = res.list }) }, getTeam(code, flag = true) { var vm = this if (flag) { delete this.form.team } var params = { hospital: code } httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) { vm.teamOptions = 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/gxbTurnDownInfo', { 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) } }) }, dialogSearchFn() { this.page = 1 if (this.title == '康复下转明细列表') { this.rehabilitationPatientInfo() } else if (this.title == '下转情况数据列表') { this.turnDownDataPage() } }, dialogExportFn() { var vm = this var params = { ...this.query } if (this.title == '康复下转明细列表') { if (this.yearType == '1') { params.startTime = this.chooseYear + '-01-01' params.endTime = this.chooseYear + '-12-31' } else { if (this.chooseTime) { params.startTime = this.chooseTime[0] params.endTime = this.chooseTime[1] } } this.dialogExportLoading = true var fileName = `康复下转明细列表${new Date().getTime()}.xls` httpRequest.downLoadFileForAjax('doctor/specialist/rehabilitation/exportRehabilitationPatientInfo', fileName, params).then(function () { vm.dialogExportLoading = false }) } else { 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.dialogExportLoading = true var fileName = `冠心病下转情况统计表${new Date().getTime()}.xls` httpRequest.downLoadFileForAjax('statistics/collaborate/exportTurnDownDataPage', fileName, params).then(function () { vm.dialogExportLoading = false }) } }, dialogReset() { var params = { ...this.query } if (this.title == '康复下转明细列表') { this.query = { status: '', hospitalCode: '', orgCode: '', archiveStatus: '', patientType: '', 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 } } else if (this.title == '下转情况数据列表') { this.query = { sex: '', isSign: '', eventType: '', range: params.range, area: params.area, hospital: params.hospital, team: params.team } } }, handleCurrentChange(val) { this.page = val if (this.title == '康复下转明细列表') { this.rehabilitationPatientInfo() } else if (this.title == '下转情况数据列表') { this.turnDownDataPage() } }, handleSizeChange(val) { this.size = val if (this.title == '康复下转明细列表') { this.rehabilitationPatientInfo() } else if (this.title == '下转情况数据列表') { this.turnDownDataPage() } }, // 获取社区医院 hospitalsByType() { var vm = this // var code var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole')) if (selectedRole.code.indexOf('350200') > -1) { code = '350200' // 市卫健委 } else if (selectedRole.code.length == 6) { code = selectedRole.code } else { this.level = 3 // 社区管理 } if (selectedRole.code.length > 6) { this.communityHospitals = [{ label: selectedRole.name, value: selectedRole.code }] } else { var type = 1 if (selectedRole.code.indexOf('350200') > -1) { type = 1 // 市卫健委 } else if (selectedRole.code.length == 6) { type = 2 } statisticAPI .hospitalsByType({ type: type, code: selectedRole.code }) .then(function (res) { if (res.status == 200) { vm.communityHospitals = [{ label: '全部', value: '' }] res.list.forEach(function (v) { vm.communityHospitals.push({ value: v.code, label: v.name }) }) } }) .catch(function (err) { console.log(err, 'Errr') }) } }, openDialog(row, prop) { if (!row.code) return this.page = 1 if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) { this.query = { status: '', hospitalCode: '', orgCode: '', archiveStatus: '', patientType: '' } this.visible = true this.title = '康复下转明细列表' this.dialogHeader = [ { label: '姓名', prop: 'name' }, { label: '性别', prop: 'sex' }, { label: '年龄', prop: 'age' }, { label: '手机号', prop: 'mobile' }, { label: '下转医院', prop: 'hospitalName' }, { label: '下转医生', prop: 'hospitalDoctor' }, { label: '下转时间', prop: 'createTime' }, { label: '患者类型', prop: 'patientType' }, { label: '下转状态', prop: 'statusName' }, { label: '接收社区医院', prop: 'orgName' }, { label: '接收签约医生', prop: 'doctorName' }, { label: '接收时间', prop: 'receiveTime' }, { label: '档案状态', prop: 'archiveStatusName' } ] switch (prop) { case 'mzTimes': this.query.patientType = '1' break case 'zyTimes': this.query.patientType = '2' break } } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) { this.visible = true this.title = '下转情况数据列表' this.query = { sex: '', isSign: '', eventType: '' } this.dialogHeader = [ { label: '姓名', prop: 'name' }, { label: '性别', prop: 'sex' }, { label: '年龄', prop: 'age' }, { label: '手机号', prop: 'mobile' }, { label: '是否签约', prop: 'isSign' }, { label: '社区医院', prop: 'hospitalName' }, { label: '下转次数', prop: 'num' }, { label: '最近一次下转诊断', prop: 'diagnosisName' }, { label: '最近一次下转时间', prop: 'turnDownTime' }, { label: '最近一次下转类型', prop: 'eventType' } ] switch (prop) { case 'mzNum': this.query.eventType = '1' break case 'zyNum': this.query.eventType = '2' break } } 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 (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) { this.rehabilitationPatientInfo() } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) { this.turnDownDataPage() } }, // 康复下转操作 operation(num, item) { var vm = this if (num != 2) { statisticAPI .synchronizePationSingle({ id: item.id }) .then(function (res) { if (res.status == 200) { vm.$message.success('操作成功') } else { vm.$message.error(res.msg) } }) .catch(function (err) { console.log(err, 'Errr') }) } else { vm.signatoryList = [] statisticAPI .kangfuGetSignInfo({ idcard: item.idcard }) .then(function (res) { if (res.status == 200) { if (res.data != null) { vm.signatoryList.push(res.data) } } }) .catch(function (err) { console.log(err, 'Errr') }) vm.dialogVisible = true } }, rehabilitationPatientInfo() { var vm = this var params = { ...this.query, page: this.page, size: this.size, disease: 3 } if (this.yearType == '1') { params.startTime = this.chooseYear + '-01-01' params.endTime = this.chooseYear + '-12-31' } else { if (this.chooseTime) { params.startTime = this.chooseTime[0] params.endTime = this.chooseTime[1] } } this.dialogLoading = true statisticAPI.rehabilitationPatientInfo(params).then(function (res) { if (res.status == 200) { res.detailModelList.forEach(function (v) { v.sex = v.sex == 1 ? '男' : '女' }) vm.dialogTableData = res.detailModelList vm.total = res.totalCount } else { vm.$message.error(res.msg) } vm.dialogLoading = false }) }, turnDownDataPage() { var vm = this var params = { ...this.query, page: this.page, pageSize: 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/turnDownDataPage', { data: params }).then(function (res) { if (res.status == 200) { vm.dialogTableData = res.detailModelList vm.total = res.totalCount } vm.dialogLoading = false }) }, closeDialog() { this.visible = false }, closeDialog1() { this.dialogVisible = 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() } }, seePatientDetail(row, prop) { console.log('uuuuuuuuuuuuuuuuu', row, prop) if (prop == 'name') { if (row.patient && this.title == '康复下转明细列表') { EventBus.$emit('preview-person-info', { type: '4', code: row.patient }) } else if (row.code && this.title == '下转情况数据列表') { EventBus.$emit('preview-person-info', { type: '4', code: row.code }) } else { this.$message.warning('未查询到该患者信息') } } }, 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() {} })