123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483 |
- // 慢阻肺患者档案-服务档案
- var template = ''
- $.ajax('../../../component/statistics/CopdRecordSearch/index.html', {
- data: {},
- dataType: 'html',
- cache: false,
- timeout: 60000,
- async: false,
- error: function (res) {},
- success: function (res) {
- template = res
- }
- })
- Vue.component('copd-record-search', {
- 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,
- sex: '',
- firstVisitType: '',
- hasLung: '',
- hasCt: '',
- hasx: '',
- hasBloodGas: '',
- hasSmoke: '',
- hasDrink: '',
- diseaseConversion: '',
- age: '',
- dataList: [],
- daLoading: false,
- datatotal: 0,
- chooseYear: '',
- firstVisitArea: '',
- firstVisitOrgLevel: '',
- end: '',
- start: '',
- nowyear: '',
- nowmonth: '',
- years: [],
- radio: '1',
- dicName: ['jkcopd_disease_conversion', 'jkcopd_age', 'jkcopd_smoke', 'jkcopd_drink', 'jkcopd_firstVisitType', 'jkcopd_first_area', 'jkcopd_first_org_level'],
- conversionArr: [],
- ageArr: [],
- firstVisitType: [],
- areaArr: [],
- smokeArr: [],
- drinkArr: [],
- orGlevelArr: [],
- 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: []
- }
- },
- watch: {
- value1(va) {
- if (this.radio == '2') {
- this.startTime = va[0]
- this.endTime = va[1]
- }
- },
- rangeCode: function (val) {
- var vm = this
- // if (vm.initlevel != 2) {
- // vm.communityCode = ''
- // }
- // vm.teamCode = ''
- },
- // areaCode: function (val) {
- // var vm = this
- // vm.selChange(3)
- // },
- // communityCode: function (val) {
- // var vm = this
- // vm.selChange(5)
- // }
- },
- methods: {
- hospitalList() {
- var vm = this
- statisticAPI.hospitalList({ queryArea: vm.userRoleCode }).then(function (res) {
- if (res.status == 200) {
- vm.communityArr = res.detailModelList
- }
- })
- },
- //字典
- getDictByDictName(value) {
- var vm = this
- statisticAPI.getDictByDictName({ name: value }).then(function (res) {
- if (value == 'jkcopd_age') {
- vm.ageArr = res.list
- } else if (value == 'jkcopd_smoke') {
- vm.smokeArr = res.list
- } else if (value == 'jkcopd_drink') {
- vm.drinkArr = res.list
- } else if (value == 'jkcopd_first_area') {
- vm.areaArr = res.list
- } else if (value == 'jkcopd_disease_conversion') {
- vm.conversionArr = res.list
- } else if (value == 'jkcopd_firstVisitType') {
- vm.firstVisitTypeArr = res.list
- } else if (value == 'jkcopd_first_org_level') {
- vm.orGlevelArr = res.list
- }
- })
- },
- //获取省市区 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
- },
- manageInfo() {
- var vm = this
- this.daLoading = true
- var params = {
- startTime: this.radio == 1 ? this.chooseYear + '-01-01' : this.startTime,
- endTime: this.radio == 1 ? this.chooseYear + '-12-31' : this.endTime,
- quotaStr: this.quotaStrArr.join(','),
- range: this.rangeCode,
- area: this.areaCode == '350200' ? '' : this.areaCode,
- page: 1,
- size: 50,
- sex: this.sex,
- firstVisitType: this.firstVisitType,
- hasLung: this.hasLung,
- hasCt: this.hasCt,
- hasx: this.hasx,
- hasBloodGas: this.hasBloodGas,
- hasSmoke: this.hasSmoke,
- hasDrink: this.hasDrink,
- diseaseConversion: this.diseaseConversion,
- age: this.age
- }
- if(this.rangeCode == "hospital"){
- params.hospital = this.communityCode
- }
- console.log("tableheader");
-
- statisticAPI
- .manageInfo(params)
- .then(function (res) {
- if (res.status == 200) {
- vm.tabledata = res.data.data
- vm.datatotal = res.data.total
- if (vm.tabledata.length) {
- vm.tableHeader = []
- if(vm.rangeCode =='town'){
- vm.tableHeader.push({prop:'townName',label: '地区',width: '100',align:'center'})
- }else{
- vm.tableHeader.push({prop:'hospitalName',label: '社区',width: '180',align:'center'})
- }
- _.each(vm.tabledata[0], function (item, index) {
- if (
- index != 'town' &&
- index != 'townName' &&
- index != 'hospital' &&
- index != 'hospitalName' &&
- index != 'area' &&
- index != 'areaName' &&
- index != 'code' &&
- index != 'name'
- )
- vm.tableHeader.push({ prop: index, label: index,align:'right',headerAlign:'center' })
- })
- }
- } else {
- vm.$message.error(res.msg)
- }
- vm.daLoading = false
- })
- .catch(function (err) {
- vm.daLoading = false
- })
- },
- bubbleSort(array) {
- for (var i = 0; i < array.length - 1; i++) {
- for (var j = 0; j < array.length - i - 1; j++) {
- // 1.对每一个值和它的下一个值进行比较
- if (array[j] > array[j + 1]) {
- // 如果第一个值更多,则将其赋予自定义计数值 count
- var count = array[j]
- // 反复交换
- array[j] = array[j + 1]
- array[j + 1] = count
- }
- }
- }
- return array
- },
- search() {
- if(this.rangeCode == 'town' && this.areaCode == null){
- this.$message.warning("请选择地区")
- return
- }
- if(this.rangeCode == 'hospital' && this.communityCode == null){
- this.$message.warning("请选择社区")
- return
- }
- if (this.quotaStrArr.length) {
- this.manageInfo()
- } else {
- this.$message({
- message: '请选择查询指标!',
- type: 'warning'
- })
- return false
- }
- },
- 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 quotaStrs= this.bubbleSort(this.quotaStrArr)
- this.quotaStrArr.sort(function (a, b) {
- return a - b
- })
- var params = {
- startTime: this.radio == 1 ? this.chooseYear + '-01-01' : this.startTime,
- endTime: this.radio == 1 ? this.chooseYear + '-12-31' : this.endTime,
- quotaStr: this.quotaStrArr.join(','),
- range: this.rangeCode,
- area: this.areaCode == '350200' ? '' : this.areaCode,
- hospital: this.communityCode,
- page: 1,
- size: 50,
- sex: this.sex,
- firstVisitType: this.firstVisitType,
- hasLung: this.hasLung,
- hasCt: this.hasCt,
- hasx: this.hasx,
- hasBloodGas: this.hasBloodGas,
- hasSmoke: this.hasSmoke,
- hasDrink: this.hasDrink,
- diseaseConversion: this.diseaseConversion,
- age: this.age
- }
- statisticAPI.exportManageInfo(params, '管理情况.xls').then(function (res) {
- vm.daLoading = false
- vm.$message({
- message: '导出成功!',
- type: 'success'
- })
- })
- },
- resetDate() {
- ;(this.startTime = ''),
- (this.endTime = ''),
- (this.rangeCode = 'town'),
- (this.quotaStr = ''),
- (this.range = ''),
- (this.area = ''),
- (this.hospital = ''),
- (this.sex = ''),
- (this.firstVisitType = ''),
- (this.firstVisitArea = ''),
- (this.firstVisitOrgLevel = ''),
- (this.areaCode = ''),
- (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()
- }
- },
- 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
-
- }
-
- EventBus.$on('copd-record-filter-change', function (event) {
- vm.quotaStrArr = event
- console.log(vm.quotaStrArr, '999sd8s9a8d9s8ad9sa89')
- })
- this.dicName.forEach(function (item) {
- vm.getDictByDictName(item)
- })
- // this.manageInfo()
- },
- destroyed() {
- EventBus.$off('copd-record-filter-change')
- }
- })
|