Browse Source

修复bug

hwy 1 day ago
parent
commit
e85cf7dced
1 changed files with 375 additions and 368 deletions
  1. 375 368
      app/statistics/js/mzfHzcx.js

+ 375 - 368
app/statistics/js/mzfHzcx.js

@ -1,377 +1,384 @@
var template = ''
$.ajax('../html/mzfHzcx.html',{
	data: {},
	dataType: 'html',
	cache: false,
	timeout: 60000, 
	async: false,
	error: function(res) {
	},
	success: function(res) {
		template = res
	}
$.ajax('../html/mzfHzcx.html', {
  data: {},
  dataType: 'html',
  cache: false,
  timeout: 60000,
  async: false,
  error: function (res) {},
  success: function (res) {
    template = res
  }
})
Vue.component('mzf-hzcx', {
	props: [],
	template: template,
	data: function() {
		return {
			tableData:[],
			testArr1: [],
			testArr2: [],
			testPosition1: 0,
			testPosition2: 0,
			list:[],
			startTime:new Date('2023','05','26'),
			endTime:new Date(),
			regionData:[
				{label:'全部',value:'8'},
				{label:'未管理',value:'0'},
				{label:'在管',value:'1'},
				{label:'失访',value:'2'},
				{label:'出组',value:'3'},
				{label:'不纳入管理 ',value:'4'},
				{label:'入组 ',value:'5'},
				{label:'死亡 ',value:'6'},
				{label:'已管理 ',value:'7'},
			],
			region: '8', //管理状态
  props: [],
  template: template,
  data: function () {
    return {
      tableData: [],
      testArr1: [],
      testArr2: [],
      testPosition1: 0,
      testPosition2: 0,
      list: [],
      startTime: new Date('2023', '05', '26'),
      endTime: new Date(),
      regionData: [
        { label: '全部', value: '8' },
        { label: '未管理', value: '0' },
        { label: '在管', value: '1' },
        { label: '失访', value: '2' },
        { label: '出组', value: '3' },
        { label: '不纳入管理 ', value: '4' },
        { label: '入组 ', value: '5' },
        { label: '死亡 ', value: '6' },
        { label: '已管理 ', value: '7' }
      ],
      region: '8', //管理状态
			tertiaryHospitalsData:[],
			tertiary: [], //地区
      tertiaryHospitalsData: [],
      tertiary: [], //地区
			communityHospitalsData:[],
			communityHospitals: [], // 三级医院
      communityHospitalsData: [],
      communityHospitals: [], // 三级医院
			groupingData:[],
			group: [], // 社区
      groupingData: [],
      group: [], // 社区
			queryLevel: 1, // :1.全部 2.区  3.等级医院 4.社区医院
			patientName: '', // 患者姓名
      queryLevel: 1, // :1.全部 2.区  3.等级医院 4.社区医院
      patientName: '', // 患者姓名
			stageType: '0,1,2,10,20',// 阶段
			// 0:慢阻肺测试患者 1:第一阶段  2:第二阶段   10:测试账号  20:其他'   全部 0,1,2,10,20
			stageData: [
				{label:'全部',value:'0,1,2,10,20'},
				{label:'慢阻肺测试患者',value:'0'},
				{label:'第一阶段 ',value:'1'},
				{label:'第二阶段 ',value:'2'},
				{label:'测试账号',value:'10'},
				{label:'其他',value:'20'},
			],
      stageType: '0,1,2,10,20', // 阶段
      // 0:慢阻肺测试患者 1:第一阶段  2:第二阶段   10:测试账号  20:其他'   全部 0,1,2,10,20
      stageData: [
        { label: '全部', value: '0,1,2,10,20' },
        { label: '慢阻肺测试患者', value: '0' },
        { label: '第一阶段 ', value: '1' },
        { label: '第二阶段 ', value: '2' },
        { label: '测试账号', value: '10' },
        { label: '其他', value: '20' }
      ],
			administration:[],
			administrationStatusData:[
				{label:'全部',value:'0'},
				{label:'康复组',value:'1'},
				{label:'对照组',value:'2'}
			],
			show:false,
			showTwo:false,
			showThree:false,
			currentPage:1,
			currentSize:10, 
			datatotal:0, //总数
			loadingTwo:false,
			setDisabled:{
				disabledDate:function(time) {
					return time.getTime() < new Date('2023','05','26') || time.getTime() > Date.now();
				}
			},
			s:'',
			e:'',
			dialogVisible: false,
			dataInfo: [],
			dialogVisible1: false,
			dataJl: []
		}
	},
	created: function(){
		this.s = this.startTime.format('yyyy-MM-dd')
		this.e = this.endTime.format('yyyy-MM-dd')
		this.list.unshift({type:'0',id:'time',label:this.s +"~"+ this.e})
		this.getCopdPatientInfoList(1, 1 , '350200')
		this.cascadingFindHosptail(1, '')
	},
	watch:{
		'startTime':{
			 handler:function(o) {
				if(!o) {
					this.list.splice(0,1)
				}
			 },
			 deep: true,
			 immediate: true
		},
		'endTime':{
			 handler:function(o) {
				if(!o) {
					this.list.splice(0,1)
				}
			 },
			 deep: true,
			 immediate: true
		},
	},
	methods: {
		// 获取地区
		cascadingFindHosptail: function(type, val, hos) {
			var vm = this
			var data = {
				findType: type ? type: 1,
				areaCode: val.length!=0 ? val.join(',') : '',
				hosptialCode: hos ? hos.join(',') : ''
			}
			statisticAPI.cascadingFindHosptail({
				jsonStr: JSON.stringify(data)
			}).then(function(res){
				if(res.status===200) {
					console.log(res, 'dq');
					if(type == 2) {
						vm.communityHospitalsData = res.data
					} else if(type == 3) {
						vm.groupingData = res.data
					}
					else {
						vm.tertiaryHospitalsData = res.data
					}
				}
			})
		},
		tertiaryChange: function(val) {
			if(val.length == 0) {
				this.communityHospitals = []
				this.communityHospitalsData = []
				this.group = []
				this.groupingData = []
			}else {
				this.queryLevel = 2
				this.cascadingFindHosptail(2, val)
			}
			
		},
		comChange: function (val) {
			var vm = this
			if(val.length == 0) {
				vm.groupingData = []
				vm.group = []
			}else {
				vm.queryLevel = 3
				vm.cascadingFindHosptail(3, vm.tertiary , val)
			}
		
		},
		admChange: function() {
		},
		groChange: function() {
			var vm = this
			vm.queryLevel = 4
		},
		// 清除
		clearGroup: function() {
			if(this.group.length == 0) {
				this.queryLevel = 3
			}
		},
		clearCommunityHospitals:function(val) {
			if(this.communityHospitals.length == 0) {
				this.queryLevel = 2
				this.groupingData = []
			}
		},
		clearTertiary: function() {
			if(this.tertiary.length == 0) {
				this.queryLevel = 1
			}
		},
		getCopdPatientInfoList:function (page, queryLevel, code) {
			var vm = this
			vm.loadingTwo = true
			var data = {
				startTime:this.startTime.format('yyyy-MM-dd'),
				endTime:this.endTime.format('yyyy-MM-dd'),
				stageType: vm.stageType,
				findType: 2,
				copdState: vm.region,
				page: page,
				size: 10,
				searchKey: vm.patientName,
				queryLevel: queryLevel,
				queryCode: code,
				hosptialCode: '', // 医院code
				pageIf: "true"
			}
			statisticAPI.getCopdPatientInfoList({
				json:JSON.stringify(data)
			}).then(function(res){
				if(res.status == 200) {
					console.log(res,'hxsj');
					vm.loadingTwo = false
					vm.tableData = res.data.list
					vm.datatotal = res.data.count
				}
			}).catch(function(err){
				vm.loadingTwo = false
			})
		},
		startTimeChange:function(o) {
			if(!this.list[0] || this.list[0].type!=0) {
			 this.list.unshift({type:'0',id:'time',label:o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
			}else{
				this.list[0].label = o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
			}
		},
		endTimeChange:function(o) {
			if(!this.list[0] || this.list[0].type!=0) {
				this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')})
			}else{
				this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')
			}
		},
		deleteClick:function(item) {
			if(item.id == "time") {
				this.startTime = ''
				this.endTime = ''
				this.list.splice(0,1)
			}
			var index = this.list.findIndex(function(v){
				return item.id == v.id
			})
			this.list.splice(index,1)
		},
		// 下一页  上一页
		handleCurrentChange:function(val) {
			var vm = this
			vm.currentPage = val
			if(this.queryLevel == 1) {
				this.getCopdPatientInfoList(val, 1 , '350200')
			} else if(this.queryLevel == 2) {
				// 地区
				var areaCode = this.tertiary.join(',')
				this.getCopdPatientInfoList(val, this.queryLevel, areaCode)
			}else if(this.queryLevel == 3) {
				// 三级医院
				var areaCode = this.communityHospitals.join(',')
				this.getCopdPatientInfoList(val, this.queryLevel, areaCode)
			}else if(this.queryLevel == 4) {
				// 社区
				var areaCode = this.group.join(',')
				this.getCopdPatientInfoList(val, this.queryLevel, areaCode)
			}
		},
		change:function(val) {
			this.list = this.list.concat(val)
		},
		// 确定
		confirm:function() {
			// 全部 , 也是默认
			if(this.queryLevel == 1) {
				this.getCopdPatientInfoList(1, 1 , '350200')
			} else if(this.queryLevel == 2) {
				// 地区
				var areaCode = this.tertiary.join(',')
				this.getCopdPatientInfoList(1, this.queryLevel, areaCode)
			}else if(this.queryLevel == 3) {
				// 三级医院
				var areaCode = this.communityHospitals.join(',')
				this.getCopdPatientInfoList(1, this.queryLevel, areaCode)
			}else if(this.queryLevel == 4) {
				// 社区
				var areaCode = this.group.join(',')
				this.getCopdPatientInfoList(1, this.queryLevel, areaCode)
			}
	
		},
		// 取消
		cancel:function() {
			this.startTime = new Date('2023','05','26')
			this.endTime = new Date()
			this.tertiary = []
			this.communityHospitals = []
			this.group = []
			this.patientName = ''
			this.region = '8'
			this.stageType = '0,1,2,10,20'
			this.queryLevel = 1
		},
		// 查看
		showInfo: function(item) {
			var vm = this
			vm.dialogVisible = true
			var data = {
				patientCode: item.patientCode
			}
			statisticAPI.findCopdPatientFollowList({
				jsonStr:JSON.stringify(data)
			}).then(function(res){
				if(res.status == 200) {
					console.log(res, '记录');
					vm.dataInfo = res.data
				}
			})
		},
		showJl: function(item) {
			console.log(item,'item');
			var vm = this
			var data = {
				followupId: item.followupId,
				visitCount: item.visit_count
			}
			var jsonStr = JSON.stringify(data)
			statisticAPI.exportConclusionList({
				// jsonStr: encodeURIComponent(jsonStr)
				followupId: item.followupId,
				visitCount: item.visit_count
			},'随访计划.pdf').then(function(res){
				vm.loadingTwo = false
			})
		},
		// 导出
		exportHandle:function() {
			// 全部 , 也是默认
			if(this.queryLevel == 1) {
				this.exportCopdPatientInfoList(1, 1 , '350200')
			} else if(this.queryLevel == 2) {
				// 地区
				var areaCode = this.tertiary.join(',')
				this.exportCopdPatientInfoList(1, this.queryLevel, areaCode)
			}else if(this.queryLevel == 3) {
				// 三级医院
				var areaCode = this.communityHospitals.join(',')
				this.exportCopdPatientInfoList(1, this.queryLevel, areaCode)
			}else if(this.queryLevel == 4) {
				// 社区
				var areaCode = this.group.join(',')
				this.exportCopdPatientInfoList(1, this.queryLevel, areaCode)
			}
		},
		exportCopdPatientInfoList: function(page, queryLevel, code) {
			var vm = this
			vm.loadingTwo = true
			var data = {
				startTime:this.startTime.format('yyyy-MM-dd'),
				endTime:this.endTime.format('yyyy-MM-dd'),
				stageType: vm.stageType,
				findType: 2,
				copdState: vm.region,
				page: page,
				size: 10,
				searchKey: vm.patientName,
				queryLevel: queryLevel,
				queryCode: code,
				hosptialCode: '', // 医院code
				pageIf: ""
			}
			var jsonStr = JSON.stringify(data)
			statisticAPI.exportCopdPatientInfoList({
				json: encodeURIComponent(jsonStr)
			},'慢阻肺患者查询.xls').then(function(res){
				vm.loadingTwo = false
			})
		}
		
	}
})
      administration: [],
      administrationStatusData: [
        { label: '全部', value: '0' },
        { label: '康复组', value: '1' },
        { label: '对照组', value: '2' }
      ],
      show: false,
      showTwo: false,
      showThree: false,
      currentPage: 1,
      currentSize: 10,
      datatotal: 0, //总数
      loadingTwo: false,
      setDisabled: {
        // disabledDate:function(time) {
        // 	return time.getTime() < new Date('2023','05','26') || time.getTime() > Date.now();
        // }
      },
      s: '',
      e: '',
      dialogVisible: false,
      dataInfo: [],
      dialogVisible1: false,
      dataJl: []
    }
  },
  created: function () {
    this.s = this.startTime.format('yyyy-MM-dd')
    this.e = this.endTime.format('yyyy-MM-dd')
    this.list.unshift({ type: '0', id: 'time', label: this.s + '~' + this.e })
    this.getCopdPatientInfoList(1, 1, '350200')
    this.cascadingFindHosptail(1, '')
  },
  watch: {
    'startTime': {
      handler: function (o) {
        if (!o) {
          this.list.splice(0, 1)
        }
      },
      deep: true,
      immediate: true
    },
    'endTime': {
      handler: function (o) {
        if (!o) {
          this.list.splice(0, 1)
        }
      },
      deep: true,
      immediate: true
    }
  },
  methods: {
    // 获取地区
    cascadingFindHosptail: function (type, val, hos) {
      var vm = this
      var data = {
        findType: type ? type : 1,
        areaCode: val.length != 0 ? val.join(',') : '',
        hosptialCode: hos ? hos.join(',') : ''
      }
      statisticAPI
        .cascadingFindHosptail({
          jsonStr: JSON.stringify(data)
        })
        .then(function (res) {
          if (res.status === 200) {
            console.log(res, 'dq')
            if (type == 2) {
              vm.communityHospitalsData = res.data
            } else if (type == 3) {
              vm.groupingData = res.data
            } else {
              vm.tertiaryHospitalsData = res.data
            }
          }
        })
    },
    tertiaryChange: function (val) {
      if (val.length == 0) {
        this.communityHospitals = []
        this.communityHospitalsData = []
        this.group = []
        this.groupingData = []
      } else {
        this.queryLevel = 2
        this.cascadingFindHosptail(2, val)
      }
    },
    comChange: function (val) {
      var vm = this
      if (val.length == 0) {
        vm.groupingData = []
        vm.group = []
      } else {
        vm.queryLevel = 3
        vm.cascadingFindHosptail(3, vm.tertiary, val)
      }
    },
    admChange: function () {},
    groChange: function () {
      var vm = this
      vm.queryLevel = 4
    },
    // 清除
    clearGroup: function () {
      if (this.group.length == 0) {
        this.queryLevel = 3
      }
    },
    clearCommunityHospitals: function (val) {
      if (this.communityHospitals.length == 0) {
        this.queryLevel = 2
        this.groupingData = []
      }
    },
    clearTertiary: function () {
      if (this.tertiary.length == 0) {
        this.queryLevel = 1
      }
    },
    getCopdPatientInfoList: function (page, queryLevel, code) {
      var vm = this
      vm.loadingTwo = true
      var data = {
        startTime: this.startTime.format('yyyy-MM-dd'),
        endTime: this.endTime.format('yyyy-MM-dd'),
        stageType: vm.stageType,
        findType: 2,
        copdState: vm.region,
        page: page,
        size: 10,
        searchKey: vm.patientName,
        queryLevel: queryLevel,
        queryCode: code,
        hosptialCode: '', // 医院code
        pageIf: 'true'
      }
      statisticAPI
        .getCopdPatientInfoList({
          json: JSON.stringify(data)
        })
        .then(function (res) {
          if (res.status == 200) {
            console.log(res, 'hxsj')
            vm.loadingTwo = false
            vm.tableData = res.data.list
            vm.datatotal = res.data.count
          }
        })
        .catch(function (err) {
          vm.loadingTwo = false
        })
    },
    startTimeChange: function (o) {
      if (!this.list[0] || this.list[0].type != 0) {
        this.list.unshift({ type: '0', id: 'time', label: o.format('yyyy-MM-dd') + '~' + this.endTime.format('yyyy-MM-dd') })
      } else {
        this.list[0].label = o.format('yyyy-MM-dd') + '~' + this.endTime.format('yyyy-MM-dd')
      }
    },
    endTimeChange: function (o) {
      if (!this.list[0] || this.list[0].type != 0) {
        this.list.unshift({ type: '0', id: 'time', label: this.startTime.format('yyyy-MM-dd') + '~' + o.format('yyyy-MM-dd') })
      } else {
        this.list[0].label = this.startTime.format('yyyy-MM-dd') + '~' + o.format('yyyy-MM-dd')
      }
    },
    deleteClick: function (item) {
      if (item.id == 'time') {
        this.startTime = ''
        this.endTime = ''
        this.list.splice(0, 1)
      }
      var index = this.list.findIndex(function (v) {
        return item.id == v.id
      })
      this.list.splice(index, 1)
    },
    // 下一页  上一页
    handleCurrentChange: function (val) {
      var vm = this
      vm.currentPage = val
      if (this.queryLevel == 1) {
        this.getCopdPatientInfoList(val, 1, '350200')
      } else if (this.queryLevel == 2) {
        // 地区
        var areaCode = this.tertiary.join(',')
        this.getCopdPatientInfoList(val, this.queryLevel, areaCode)
      } else if (this.queryLevel == 3) {
        // 三级医院
        var areaCode = this.communityHospitals.join(',')
        this.getCopdPatientInfoList(val, this.queryLevel, areaCode)
      } else if (this.queryLevel == 4) {
        // 社区
        var areaCode = this.group.join(',')
        this.getCopdPatientInfoList(val, this.queryLevel, areaCode)
      }
    },
    change: function (val) {
      this.list = this.list.concat(val)
    },
    // 确定
    confirm: function () {
      // 全部 , 也是默认
      if (this.queryLevel == 1) {
        this.getCopdPatientInfoList(1, 1, '350200')
      } else if (this.queryLevel == 2) {
        // 地区
        var areaCode = this.tertiary.join(',')
        this.getCopdPatientInfoList(1, this.queryLevel, areaCode)
      } else if (this.queryLevel == 3) {
        // 三级医院
        var areaCode = this.communityHospitals.join(',')
        this.getCopdPatientInfoList(1, this.queryLevel, areaCode)
      } else if (this.queryLevel == 4) {
        // 社区
        var areaCode = this.group.join(',')
        this.getCopdPatientInfoList(1, this.queryLevel, areaCode)
      }
    },
    // 取消
    cancel: function () {
      this.startTime = new Date('2023', '05', '26')
      this.endTime = new Date()
      this.tertiary = []
      this.communityHospitals = []
      this.group = []
      this.patientName = ''
      this.region = '8'
      this.stageType = '0,1,2,10,20'
      this.queryLevel = 1
    },
    // 查看
    showInfo: function (item) {
      var vm = this
      vm.dialogVisible = true
      var data = {
        patientCode: item.patientCode
      }
      statisticAPI
        .findCopdPatientFollowList({
          jsonStr: JSON.stringify(data)
        })
        .then(function (res) {
          if (res.status == 200) {
            console.log(res, '记录')
            vm.dataInfo = res.data
          }
        })
    },
    showJl: function (item) {
      console.log(item, 'item')
      var vm = this
      var data = {
        followupId: item.followupId,
        visitCount: item.visit_count
      }
      var jsonStr = JSON.stringify(data)
      statisticAPI
        .exportConclusionList(
          {
            // jsonStr: encodeURIComponent(jsonStr)
            followupId: item.followupId,
            visitCount: item.visit_count
          },
          '随访计划.pdf'
        )
        .then(function (res) {
          vm.loadingTwo = false
        })
    },
    // 导出
    exportHandle: function () {
      // 全部 , 也是默认
      if (this.queryLevel == 1) {
        this.exportCopdPatientInfoList(1, 1, '350200')
      } else if (this.queryLevel == 2) {
        // 地区
        var areaCode = this.tertiary.join(',')
        this.exportCopdPatientInfoList(1, this.queryLevel, areaCode)
      } else if (this.queryLevel == 3) {
        // 三级医院
        var areaCode = this.communityHospitals.join(',')
        this.exportCopdPatientInfoList(1, this.queryLevel, areaCode)
      } else if (this.queryLevel == 4) {
        // 社区
        var areaCode = this.group.join(',')
        this.exportCopdPatientInfoList(1, this.queryLevel, areaCode)
      }
    },
    exportCopdPatientInfoList: function (page, queryLevel, code) {
      var vm = this
      vm.loadingTwo = true
      var data = {
        startTime: this.startTime.format('yyyy-MM-dd'),
        endTime: this.endTime.format('yyyy-MM-dd'),
        stageType: vm.stageType,
        findType: 2,
        copdState: vm.region,
        page: page,
        size: 10,
        searchKey: vm.patientName,
        queryLevel: queryLevel,
        queryCode: code,
        hosptialCode: '', // 医院code
        pageIf: ''
      }
      var jsonStr = JSON.stringify(data)
      statisticAPI
        .exportCopdPatientInfoList(
          {
            json: encodeURIComponent(jsonStr)
          },
          '慢阻肺患者查询.xls'
        )
        .then(function (res) {
          vm.loadingTwo = false
        })
    }
  }
})