123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- // 慢阻肺患者档案-服务档案
- var template = ''
- $.ajax('../../../component/statistics/CopdServeNum/index.html', {
- data: {},
- dataType: 'html',
- cache: false,
- timeout: 60000,
- async: false,
- error: function (res) {},
- success: function (res) {
- template = res
- }
- })
- Vue.component('copd-serve-num', {
- template: template,
- props: [],
- data() {
- return {
- // 当前显示的字段
- communityArr: [],
- tableFieldList: [],
- quotaStrArr: [],
- value1: [],
- rangeList: [
- { name: '按区', code: 'town' },
- { name: '按社区', code: 'hospital' }
- ],
- startTime: '',
- endTime: '',
- rangeCode: 'town',
- quotaStr: '',
- range: '',
- area: '',
- hospital: '',
- page: 1,
- size: 20,
- chooseYear: '',
- years: '',
- userRole: '',
- levelList: [
- { level: '4', areaLevel: '2' },
- { level: '3', areaLevel: '3' },
- { level: '2', areaLevel: '4' }
- ], //两种搜索,地区等级对比
- areaLevel: '', // 2、市,3、区,4、社区,5、团队
- initareaLevel: '',
- initlevel: '',
- initarea: '',
- level: '',
- areaTitle: '',
- areaCode: null,
- communityList: [{ code: '', name: '全部' }],
- communityCode: null,
- teamList: [{ code: '', name: '全部' }],
- teamCode: '',
- userRoleCode: '',
- docInfo: JSON.parse(window.localStorage.getItem('docInfo')),
- isGuGan: false,
- areaList: [],
- tabledata: [],
- tableHeader: [
- { label: '地区', prop: 'name', width: '90' },
- { label: '总患者人数', prop: 'patientNum', width: '90' },
- { label: '计划服务人数', prop: 'planNum', width: '90' },
- { label: '已服务人数', prop: 'serviceNum', width: '90' },
- { label: '服务完成度', prop: 'serviceProgress', width: '90' }
- ],
- radio: '1',
- fileList: [],
- file: undefined,
- isProgressShow: false,
- percentage: 0,
- success: false,
- loading: false,
- isOver: false,
- status: '',
- errList: [],
- daLoading: false,
- isShow: false,
- datatotal: 0
- }
- },
- methods: {
- gotoDownLoad() {
- const a = document.createElement('a')
- a.style.display = 'none'
- a.download = '模板.xlsx'
- a.href = './template.xls'
- a.target = '_blank'
- a.click()
- },
- hospitalList() {
- var vm = this
- statisticAPI.hospitalList({ queryArea: vm.userRoleCode }).then(function (res) {
- if (res.status == 200) {
- vm.communityArr = res.detailModelList
- }
- })
- },
- //获取省市区 type:区3
- getDistrict: function (type, code, name) {
- var vm = this,
- list = [],
- param = ''
- if (type == 3) {
- list = [{ code: code, name: name }]
- param = 'area'
- } else if (type == 5) {
- list = [{ code: '', name: '全部' }]
- param = 'community'
- }
- var params = {
- type: type,
- code: code
- }
- homeAPI.getDistrict(params).then(function (res) {
- if (res.status == 200) {
- vm[param + 'List'] = list.concat(res.list)
- // vm[param + 'Code'] = vm[param + 'List'][0].code
- } else {
- vm.$message.error(res.msg)
- }
- })
- },
- // 初始化时间
- initTime(vm) {
- var now = new Date()
- vm.endTime = now.format('yyyy-MM-dd')
- var start = now.getFullYear() + '-' + '01-01'
- vm.startTime = new Date(start).format('yyyy-MM-dd')
- vm.nowyear = vm.chooseYear = now.getFullYear()
- // vm.chooseYear = '2022'
- vm.nowmonth = now.getMonth() + 1
- vm.years = []
- for (i = vm.nowyear; i >= 2013; i--) {
- vm.years.push(i)
- }
- },
- // 数据范围初始化
- initScope(type) {
- var vm = this
- //获得缓存中缓存的角色权限
- var userRole = window.sessionStorage.getItem('selectedRole')
- if (!userRole) {
- return false
- }
- vm.userRole = JSON.parse(userRole)
- vm.areaTitle = vm.userRole.name
- if (vm.isGuGan) {
- return
- }
- if (type == 3) {
- this.areaCode = null
- this.communityCode = null
- if (vm.userRole.code == '350200' || vm.userRole.code == 'jk_350200') {
- vm.getDistrict(type, 350200, '厦门市')
- } else if (vm.userRole.code.indexOf('jk_') > -1) {
- vm.getDistrict(type, vm.userRole.code.substring(3), vm.areaTitle.substring(0, 3))
- } else if (vm.userRole.code.length == 6) {
- vm.getDistrict(type, vm.userRole.code, vm.areaTitle.substring(0, 3))
- }
- } else {
- this.communityCode = null
- if (this.rangeCode == 'hospital') vm.getDistrict(type, vm.areaCode)
- }
- return
- //获得缓存中缓存的角色权限
- var userRole = window.sessionStorage.getItem('selectedRole')
- if (!userRole) {
- return false
- }
- vm.userRole = JSON.parse(userRole)
- //level:2、市,3、区,4、社区,5、团队
- vm.initareaLevel = vm.areaLevel = vm.userRole.code == 'jk_350200' ? 2 : vm.userRole.code.length == 9 ? 3 : 4
- vm.initlevel = vm.level = vm.userRole.code == 'jk_350200' ? 4 : vm.userRole.code.length == 9 ? 3 : 2
- // vm.lowLevel = vm.initlowLevel = vm.userRole.code == '350200' ? 3 : vm.userRole.code.length == 6 ? 2 : 1;
- vm.initarea = vm.area = vm.userRole.code
- vm.areaTitle = vm.userRole.name
- if (vm.initlevel == 4) {
- //市获取区
- vm.getDistrict(3, vm.initarea.substring(3), vm.areaTitle.substr(0, 3))
- vm.rangeCode = vm.rangeList[0].code
- } else if (vm.initlevel == 3) {
- //区获取社区
- vm.areaList = [{ code: vm.initarea, name: vm.areaTitle }]
- vm.areaCode = vm.initarea
- vm.rangeCode = vm.rangeList[0].code
- } else if (vm.initlevel == 2) {
- //社区获取团队
- vm.communityList = [{ code: vm.initarea, name: vm.areaTitle }]
- vm.communityCode = vm.initarea
- vm.rangeList.shift()
- vm.rangeCode = vm.rangeList[0].code
- }
- vm.range = vm.rangeCode
- },
- toggleField(fieldName) {
- return this.tableFieldList.indexOf(fieldName) !== -1
- },
- selChange: function (type) {
- var vm = this,
- name = ''
- if (type == 3) {
- vm.initSelOption('community')
- vm.initSelOption('team')
- vm.getCommunityHospital()
- } else if (type == 5) {
- vm.initSelOption('team')
- // vm.teamListByArea();
- }
- },
- initSelOption: function (param) {
- var vm = this
- vm[param + 'List'] = [{ code: '', name: '全部' }]
- if (param == 'team') {
- vm[param + 'List'] = [{ id: '', name: '全部' }]
- }
- vm[param + 'Code'] = vm[param + 'List'][0].code || vm[param + 'List'][0].id
- },
- getCommunityHospital: function () {
- var vm = this,
- list = [{ code: '', name: '全部' }],
- param = 'community'
- homeAPI.getCommunityHospital({ area: vm.areaCode == '350200' ? '' : vm.areaCode }).then(function (res) {
- if (res.status == 200) {
- vm[param + 'List'] = list.concat(res.data)
- vm[param + 'Code'] = vm[param + 'List'][0].code
- } else {
- vm.$message.error(res.msg)
- }
- })
- },
- exportTable() {
- var vm = this
- vm.daLoading = true
- var params = {
- year: this.chooseYear,
- range: this.rangeCode,
- area: this.areaCode == '350200' ? '' : this.areaCode
- }
- statisticAPI.exportServiceProgress(params, '服务人数配置及进度查询.xls').then(function (res) {
- vm.daLoading = false
- vm.$message({
- message: '导出成功!',
- type: 'success'
- })
- })
- },
- resetDate() {
- if (this.isGuGan) {
- this.rangeCode = 'hospital'
- this.areaCode = this.docInfo.town
- this.communityCode = this.docInfo.hospital
- } else {
- this.rangeCode = 'town'
- this.areaCode = ''
- this.communityCode = ''
- }
- this.startTime = ''
- this.endTime = ''
- this.quotaStr = ''
- this.range = ''
- this.area = ''
- this.hospital = ''
- this.sex = ''
- this.firstVisitType = ''
- this.firstVisitArea = ''
- this.firstVisitOrgLevel = ''
- this.hasLung = ''
- this.hasCt = ''
- this.hasx = ''
- this.hasBloodGas = ''
- this.hasSmoke = ''
- this.hasDrink = ''
- this.diseaseConversion = ''
- this.age = ''
- },
- handleCurrentChange(val) {
- this.page = val
- this.search()
- },
- handleSizeChange(val) {
- this.size = val
- this.search()
- },
- //上传
- toggle(isShow) {
- this.isShow = isShow
- if (!isShow) {
- this.reset()
- }
- },
- reset(type) {
- this.percentage = 0
- this.success = false
- this.isOver = false
- this.errList = []
- if (type != 1) {
- this.loading = false
- this.file = undefined
- this.month = ''
- }
- },
- search() {
- var vm = this
- vm.daLoading = true
- var params = {
- year: this.chooseYear,
- range: this.rangeCode,
- area: this.areaCode == '350200' ? '' : this.areaCode
- }
- statisticAPI.getServiceProgress(params).then(function (res) {
- vm.daLoading = false
- if (res.status == 200) {
- vm.tabledata = res.detailModelList
- vm.totalCount = res.totalCount
- vm.totalPage = res.totalPage
- } else {
- vm.$message.error(res.msg)
- }
- console.log(res, 'llllllllllllllllllllllllllllllll')
- })
- },
- close(type) {
- this.reset(type)
- this.isProgressShow = false
- if (type != 1) {
- this.isShow = false
- }
- },
- beforeUploadPic(file) {
- this.file = file
- },
- check() {
- var vm = this
- vm.loading = true
- if (!vm.file) {
- vm.loading = false
- vm.$message('请选择文件')
- return
- }
- vm.save()
- },
- save() {
- var vm = this
- vm.daLoading = true
- var formData = new FormData()
- formData.append('file', vm.file)
- // vm.initProgress()
- httpRequest
- .post('doctor/jkCopd/importPlanExcel', {
- data: formData,
- cache: false, //上传文件无需缓存
- processData: false, //用于对data参数进行序列化处理 这里必须false
- contentType: false //必须
- })
- .then(function (res) {
- if (res.status == 200) {
- vm.search()
- vm.daLoading = false
- vm.isShow = false
- vm.$message({
- message: '导入成功!',
- type: 'success'
- })
- } else {
- vm.$message.error('导入失败!')
- vm.daLoading = false
- }
- })
- .catch(function (e) {
- console.error(e)
- vm.daLoading = false
- })
- },
- initProgress() {
- var vm = this
- this.isProgressShow = true
- setTimeout(() => {
- if (!vm.isOver && vm.percentage != 90) {
- vm.percentage += 10
- vm.initProgress()
- }
- }, 1000)
- }
- },
- mounted() {
- var vm = this
- var userRole = JSON.parse(window.sessionStorage.getItem('selectedRole'))
- vm.userRoleCode = userRole.code
- this.initTime(this)
- if (this.docInfo.expandLevelName) {
- this.isGuGan = this.docInfo.expandLevelName.indexOf('慢病骨干') > -1
- }
- this.initScope(3)
- if (this.isGuGan) {
- // 如何是慢病骨干 则只能选社区,并且限定死社区
- this.rangeList = [{ name: '按社区', code: 'hospital' }]
- this.rangeCode = 'hospital'
- this.areaList = [{ name: this.docInfo.hospitalName.substring(0, 3), code: this.docInfo.town }]
- this.areaCode = this.docInfo.town
- this.communityList = [{ name: this.docInfo.hospitalName, code: this.docInfo.hospital }]
- this.communityCode = this.docInfo.hospital
- // vm.receivingHospitalList = [{code:this.docInfo.hospital,name:this.docInfo.hospitalName}]
- // this.hospital = this.docInfo.hospital
- }
- this.search()
- EventBus.$on('copd-record-filter-change', function (event) {
- vm.quotaStrArr = event
- console.log(vm.quotaStrArr, '999sd8s9a8d9s8ad9sa89')
- })
- },
- destroyed() {
- EventBus.$off('copd-record-filter-change')
- }
- })
|