Просмотр исходного кода

Merge branch 'master' of http://192.168.1.220:10080/raolu/PC-application

hwy 1 месяц назад
Родитель
Сommit
8b75f6bdbf

+ 3 - 3
app/rehabilitation/html/device.html

@ -146,7 +146,7 @@
          </div>
          绑定后,从该快捷键上传的数据将导入您的健康记录中!
        </div>
        <div v-else-if="deviceObj.categoryCode == 4">
        <div v-else-if="deviceObj.categoryCode == 4||deviceObj.categoryCode == 11">
          <div class="form-item">
            <div class="form-label">IMEI码</div>
            <el-input v-model="query.deviceSn" :disabled="dataId" placeholder="请输入设备唯一码"></el-input>
@ -317,12 +317,12 @@
              checkDoctorName: this.docInfo.doctorName
            }
            httpRequest.post('doctor/device/SavePatientDevice', { data: {data:JSON.stringify(data)} }).then(function (res) {
            httpRequest.post('doctor/device/SavePatientDevice', { data: { data: JSON.stringify(data) } }).then(function (res) {
              if (res.status == '200') {
                vm.$message.success('绑定设备成功!')
                var index = parent.layer.getFrameIndex(window.name)
                parent.layer.close(index)
              }else{
              } else {
                vm.$message.error(res.msg)
              }
            })

+ 74 - 45
app/rehabilitation/html/healthBodyRecord.html

@ -43,6 +43,7 @@
  <body>
    <div id="app" v-cloak>
      <div class="box" v-if="key==0">
        <!-- 血压 -->
        <div class="item" v-for="(item,i) in bloodPressureList" :key="i">
          <div>
            <div class="lheight2">
@ -58,6 +59,7 @@
        </div>
      </div>
      <div class="box" v-else-if="key==1">
        <!-- 血糖 -->
        <div class="item" v-for="(item,i) in bloodSugarList" :key="i">
          <div>
            <div class="lheight2">{{item.text}}</div>
@ -65,11 +67,12 @@
          </div>
          <div class="flex">
            <el-tag :type="item.tagType" effect="dark">{{item.tagName}}</el-tag>
            <span class="pl8">{{item.value}}</span>
            <div class="pl8" style="width: 50px; text-align: right">{{item.value}}</div>
          </div>
        </div>
      </div>
      <div class="box" v-else-if="key==2">
        <!-- 身高体重 -->
        <div class="item" v-for="(item,i) in heightWeightList" :key="i">
          <div>
            <div class="lheight2">
@ -84,6 +87,7 @@
        </div>
      </div>
      <div class="box" v-else-if="key == 3">
        <!-- 腰围 -->
        <div class="item" v-for="(item,i) in waistList" :key="i">
          <div>
            <div class="lheight2">{{item.value1}} cm</div>
@ -92,6 +96,7 @@
        </div>
      </div>
      <div class="box" v-else>
        <!-- 心率 -->
        <div class="item" v-for="(item,i) in heartRateList" :key="i">
          <div>
            <div class="lheight2">{{item.value1}} 次/分</div>
@ -136,8 +141,8 @@
          this.key = GetRequest().key
          this.patient = GetRequest().patient
          this.endDate = GetRequest().time
          console.log(GetRequest());
          
          console.log(GetRequest())
          switch (this.key) {
            case '0':
              this.getBloodPressureList()
@ -197,14 +202,14 @@
                  return '正常'
              }
            }
                     
            const params = { 
              type: 2, 
              page: 1, 
              pagesize: 100, 
            const params = {
              type: 2,
              page: 1,
              pagesize: 100,
              patient: this.patient,
              begin: this.getDateFromCurrentDate(this.endDate, -2000) + " 00:00:00",
              end: this.endDate + " 23:59:59"
              begin: this.getDateFromCurrentDate(this.endDate, -2000) + ' 00:00:00',
              end: this.endDate + ' 23:59:59'
            }
            httpRequest.post('doctor/health_index/list', { data: params }).then(function (res) {
              vm.bloodPressureList = res.list.data.map(function (item) {
@ -261,25 +266,49 @@
                  }
              }
            }
            const params = { 
              type: 1, 
              page: 1, 
              pagesize: 100, 
            const params = {
              type: 1,
              page: 1,
              pagesize: 100,
              patient: this.patient,
              begin: this.getDateFromCurrentDate(this.endDate, -2000) + " 00:00:00",
              end: this.endDate + " 23:59:59"
              begin: this.getDateFromCurrentDate(this.endDate, -2000) + ' 00:00:00',
              end: this.endDate + ' 23:59:59'
            }
            vm.bloodSugarList = []
            httpRequest.post('doctor/health_index/list', { data: params }).then(function (res) {
              vm.bloodSugarList = res.list.data.map(function (item) {
                return {
                  ...item,
                  text: getText(item.dataType),
                  tagType: getTagInfo('type', item['value' + item.dataType], item.dataType),
                  tagName: getTagInfo('name', item['value' + item.dataType], item.dataType),
                  recordMethod: getDevice(item['deviceSn' + item.dataType]),
                  value: item['value' + item.dataType],
                  time: item['time' + item.dataType]
                }
              // vm.bloodSugarList = res.list.data.map(function (item) {
              //   return {
              //     ...item,
              //     text: getText(item.dataType),
              //     tagType: getTagInfo('type', item['value' + item.dataType], item.dataType),
              //     tagName: getTagInfo('name', item['value' + item.dataType], item.dataType),
              //     recordMethod: getDevice(item['deviceSn' + item.dataType]),
              //     value: item['value' + item.dataType],
              //     time: item['time' + item.dataType]
              //   }
              // })
              res.list.data.forEach(function (item) {
                console.log(item)
                var arr = Object.keys(item)
                  .filter(function (item1) {
                    return item1.indexOf('deviceSn') > -1
                  })
                  .map(function (item1) {
                    return item1.substring(8)
                  })
                arr.forEach(function (item1) {
                  var newObj = {
                    text: getText(item1),
                    tagType: getTagInfo('type', item['value' + item1], item1),
                    tagName: getTagInfo('name', item['value' + item1], item1),
                    recordMethod: getDevice(item['deviceSn' + item1]),
                    value: item['value' + item1],
                    time: item['time' + item1]
                  }
                  vm.bloodSugarList.push(newObj)
                })
              })
            })
          },
@ -291,7 +320,7 @@
                  if (val > 0) {
                    return '偏瘦'
                  } else if (val < 0) {
                    return '偏重'
                    return '偏胖'
                  } else {
                    return '正常'
                  }
@ -305,13 +334,13 @@
                  }
              }
            }
            const params = { 
              type: 3, 
              page: 1, 
              pagesize: 100, 
            const params = {
              type: 3,
              page: 1,
              pagesize: 100,
              patient: this.patient,
              begin: this.getDateFromCurrentDate(this.endDate, -2000) + " 00:00:00",
              end: this.endDate + " 23:59:59"
              begin: this.getDateFromCurrentDate(this.endDate, -2000) + ' 00:00:00',
              end: this.endDate + ' 23:59:59'
            }
            httpRequest.post('doctor/health_index/list', { data: params }).then(function (res) {
              vm.heightWeightList = res.list.data.map(function (item) {
@ -327,13 +356,13 @@
          },
          getWaistList() {
            const vm = this
            const params = { 
              type: 4, 
              page: 1, 
              pagesize: 100, 
            const params = {
              type: 4,
              page: 1,
              pagesize: 100,
              patient: this.patient,
              begin: this.getDateFromCurrentDate(this.endDate, -2000) + " 00:00:00",
              end: this.endDate + " 23:59:59"
              begin: this.getDateFromCurrentDate(this.endDate, -2000) + ' 00:00:00',
              end: this.endDate + ' 23:59:59'
            }
            httpRequest.post('doctor/health_index/list', { data: params }).then(function (res) {
              vm.waistList = res.list.data.map(function (item) {
@ -367,13 +396,13 @@
                  }
              }
            }
            const params = { 
              type: 5, 
              page: 1, 
              pagesize: 100, 
            const params = {
              type: 5,
              page: 1,
              pagesize: 100,
              patient: this.patient,
              begin: this.getDateFromCurrentDate(this.endDate, -2000) + " 00:00:00",
              end: this.endDate + " 23:59:59"
              begin: this.getDateFromCurrentDate(this.endDate, -2000) + ' 00:00:00',
              end: this.endDate + ' 23:59:59'
            }
            httpRequest.post('doctor/health_index/list', { data: params }).then(function (res) {
              vm.heartRateList = res.list.data.map(function (item) {

+ 11 - 7
app/rehabilitation/html/healthMonitor.html

@ -110,7 +110,7 @@
                <div>{{bodyData.xt.recordDate}} {{bodyData.xt.during}} {{getRecordType(bodyData.xt.deviceSn)}}</div>
              </div>
              <div class="record-value flex">
                <el-tag :type="bodyData.xt.tagType" v-if="bodyData.xt.tagName">{{bodyData.xt.tagName}}</el-tag>
                <el-tag :type="bodyData.xt.tagType" v-if="bodyData.xt.tagName" style="margin-right: 10px">{{bodyData.xt.tagName}}</el-tag>
                <span>{{ bodyData.xt.value1}}</span>
                <i class="el-icon-arrow-right ml10"></i>
              </div>
@ -237,8 +237,7 @@
            const vm = this
            httpRequest.get('doctor/health_index/last', { data: { patient: this.patient } }).then(function (res) {
              vm.bodyData = res.data
              vm.getXtType(res.data.xt)
              vm.getXtType(vm.bodyData.xt)
            })
          },
          getDeviceList() {
@ -419,6 +418,7 @@
            }
          },
          getXtType(o) {
            var xuetangDuring = ['', '早餐前', '早餐后', '午餐前', '午餐后', '晚餐前', '晚餐后', '睡前']
            var duringIndex = o.value2 ? o.value2 : 0
            if (o.flag == 2) {
              if (duringIndex == 1) {
@ -431,10 +431,12 @@
            } else {
              o.during = duringIndex ? xuetangDuring[duringIndex] : ''
            }
            o.value = o.value1
            var levels = [[], [7.0, 3.9], [11.1, 4.0], [7.0, 3.9], [11.1, 4.0], [7.0, 3.9], [11.1, 4.0], [7.0, 3.9]][duringIndex]
            o.tagType = getLevelClazzType(o.value, levels[0], levels[1])
            o.tagName = getLevelClazzName(o.value, levels[0], levels[1])
            o.tagType = this.getLevelClazzType(o.value, levels[0], levels[1])
            o.tagName = this.getLevelClazzName(o.value, levels[0], levels[1])
          },
          getLevelClazzType(value, max, min) {
            if (!value || (!max && !min)) {
@ -445,12 +447,14 @@
            if (value < min) {
              return 'success'
            } else if (value > max) {
              return 'error'
              return 'danger'
            } else {
              return ''
            }
          },
          getLevelClazzName(value, max, min) {
            console.log(5)
            if (!value || (!max && !min)) {
              return ''
            }
@ -461,7 +465,7 @@
            } else if (value > max) {
              return '偏高'
            } else {
              return ''
              return '正常'
            }
          },
          getBindUser() {

+ 413 - 427
app/rehabilitation/js/health_control.js

@ -1,439 +1,425 @@
layui.use('element', function () {
    element = layui.element//Tab的切换功能,切换事件监听等,需要依赖element模块
    function Progress(dom, num) {
        window.setTimeout(function () {
            element.progress(dom, num)
        }, 360)
    }
    function showInfoMessage(msg) {
        layer.msg(msg, {
            icon: 6
        })
    }
    function showErrorMessage(msg) {
        layer.msg(msg, {
            icon: 5
  element = layui.element //Tab的切换功能,切换事件监听等,需要依赖element模块
  function Progress(dom, num) {
    window.setTimeout(function () {
      element.progress(dom, num)
    }, 360)
  }
  function showInfoMessage(msg) {
    layer.msg(msg, {
      icon: 6
    })
  }
  function showErrorMessage(msg) {
    layer.msg(msg, {
      icon: 5
    })
  }
  function conFirm(msg, num, isStop, planid, getDat) {
    if (num == 1) {
      layer.confirm(
        '<p class="c-333 mb10">请说明中止计划的原因?</p><textarea class="plr5 ptb5 w-100 h200 c-333 set-textarea" maxlength="300" placeholder="请简要描述一下原因,不多于300字"></textarea>',
        {
          btn: ['确定', '取消'],
          area: ['400px', 'auto'],
          title: '提示'
        },
        function (index) {
          var reason = $('.set-textarea').val()
          if (!reason) {
            showErrorMessage('请填写中止计划原因!')
            return false
          }
          if (num == 2) {
            showInfoMessage('计划已完成')
            $('#stopBtn_' + planid)
              .attr('disabled', true)
              .addClass('falsebutton')
            return false
          } else {
            isStop = num == 0 ? 1 : 0
          }
          if (isStop == 0) {
            $('#progress_' + planid).css({
              'background-color': 'gray'
            })
            $('#stopBtn_' + planid).html('激活计划')
            $('#stopBtn_' + planid).css({
              'background-color': '#2dbe55'
            })
          } else {
            $('#progress_' + planid).css({
              'background-color': '#ff9526'
            })
            $('#stopBtn_' + planid).html('中止计划')
            $('#stopBtn_' + planid).css({
              'background-color': '#ff3b30'
            })
          }
          var params = {
            status: isStop,
            planId: planid,
            abortReason: reason
          }
          healthAPI.updatePlanStatusById(params).then(function (res) {
            if (res.status == 200) {
              getDat()
            }
          })
          layer.close(index)
        }
      )
    } else {
      layer.confirm('您确定要执行该操作吗?', { btn: ['确定', '取消'], title: '提示' }, function (index) {
        if (num == 2) {
          showInfoMessage('计划已完成')
          $('#stopBtn_' + planid)
            .attr('disabled', true)
            .addClass('falsebutton')
          return false
        } else {
          isStop = num == 0 ? 1 : 0
        }
        if (isStop == 0) {
          $('#progress_' + planid).css({
            'background-color': 'gray'
          })
          $('#stopBtn_' + planid).html('激活计划')
          $('#stopBtn_' + planid).css({
            'background-color': '#2dbe55'
          })
        } else {
          $('#progress_' + planid).css({
            'background-color': '#ff9526'
          })
          $('#stopBtn_' + planid).html('中止计划')
          $('#stopBtn_' + planid).css({
            'background-color': '#ff3b30'
          })
        }
        var params = {
          status: isStop,
          planId: planid
        }
        healthAPI.updatePlanStatusById(params).then(function (res) {
          if (res.status == 200) {
            getDat()
          }
        })
        layer.close(index)
      })
    }
    function conFirm(msg, num, isStop, planid, getDat) {
    	if (num == 1) {
    		layer.confirm('<p class="c-333 mb10">请说明中止计划的原因?</p><textarea class="plr5 ptb5 w-100 h200 c-333 set-textarea" maxlength="300" placeholder="请简要描述一下原因,不多于300字"></textarea>', { 
	    		btn: ['确定', '取消'],
	    		area: ["400px", "auto"],
	    		title: "提示"
	    	}, function (index) {
	    		var reason = $(".set-textarea").val()
	    		if (!reason) {
	    			showErrorMessage("请填写中止计划原因!");
	    			return false;
	    		}
	            if (num == 2) {
	                showInfoMessage("计划已完成")
	                $("#stopBtn_" + planid).attr('disabled', true).addClass("falsebutton")
	                return false;
	            } else {
	                isStop = num == 0 ? 1 : 0
	            }
	            if (isStop == 0) {
	                $("#progress_" + planid).css({
	                    "background-color": "gray"
	                })
	                $("#stopBtn_" + planid).html("激活计划")
	                $("#stopBtn_" + planid).css({
	                    "background-color": "#2dbe55"
	                })
	            } else {
	                $("#progress_" + planid).css({
	                    "background-color": "#ff9526"
	                })
	                $("#stopBtn_" + planid).html("中止计划")
	                $("#stopBtn_" + planid).css({
	                    "background-color": "#ff3b30"
	                })
	            }
	            var params = {
	                status: isStop,
	                planId: planid,
	                abortReason: reason
	            }
	            healthAPI.updatePlanStatusById(params).then(function (res) {
	                if (res.status == 200) {
	                    getDat()
	                }
	            })
	            layer.close(index);
	        });
    	} else {
      		layer.confirm('您确定要执行该操作吗?', { btn: ['确定', '取消'], title: "提示" }, function (index) {
			  	if (num == 2) {
			      	showInfoMessage("计划已完成")
			      	$("#stopBtn_" + planid).attr('disabled', true).addClass("falsebutton")
			      	return false;
			  	} else {
			      	isStop = num == 0 ? 1 : 0
			  	}
			  	if (isStop == 0) {
			      	$("#progress_" + planid).css({
			          	"background-color": "gray"
			      	})
			      	$("#stopBtn_" + planid).html("激活计划")
			      	$("#stopBtn_" + planid).css({
			          	"background-color": "#2dbe55"
			      	})
			  	} else {
			      	$("#progress_" + planid).css({
			          	"background-color": "#ff9526"
			      	})
			      	$("#stopBtn_" + planid).html("中止计划")
			      	$("#stopBtn_" + planid).css({
			          	"background-color": "#ff3b30"
		          	})
		      	}
		      	var params = {
		          	status: isStop,
		          	planId: planid
		      	}
		      	healthAPI.updatePlanStatusById(params).then(function (res) {
		          	if (res.status == 200) {
		              	getDat()
		          	}
		      	})
		      	layer.close(index);
		  	});
    	}
    }
    new Vue({
        el: '#app',
        data: {
            code: "",
            modal: "",
            type: "",
            status: "",
            plan: "",
            name: "",
            isDanger: "0",
            pagesize: 10,
            total: "",
            pagetotal: '', //总页数
            currentPage: 1, //当前页数
            tablelist: [],
            diseaselist: [],
            types: [],
            Statics: {},
            wujilu: false,
            datamodelshow: true,
            plantype: 1,
            todaylog: 1,
            isTotayTodo: 1,
            progress: "",
            allFinishCount: "",
            allCount: "",
            planid: "",
            isStop: 1, //
            isActive: true,
            doctorType: "",
            docCode: "",
            docInfo: {},
            isLeader: 0,
            planCreateUser: "",
            doctorTeamList:[],
            healthyConditionType:0
        },
        watch: {
            tablelist: function (val) {
                var vm = this
                this.$nextTick(function () {
                    element.init()
                    for (var i = 0; i < val.length; i++) {
                        var allFinishCount = val[i].allFinishCount
                        var allCount = val[i].allCount
                        var isStop = val[i].status
                        var ishospitalName = val[i].hospitalName
                        vm.planCreateUser = val[i].planCreateUser
                        vm.healthyConditionType=val[i].healthyConditionType//1住院 2康复期 3日常健康 4健康筛查
                        if(vm.healthyConditionType==1){
                            $("#quote_"+val[i].id).css("backgroundColor","#FF3B30")
                        }
                        if(vm.healthyConditionType==2){
                            $("#quote_"+val[i].id).css("backgroundColor","#FF9526")
                        }
                        if(vm.healthyConditionType==3){
                            $("#quote_"+val[i].id).css("backgroundColor","#2DBE55")
                        }
                        if(vm.healthyConditionType==4){
                            $("#quote_"+val[i].id).css("backgroundColor","#02CFB9")
                        }
                        if (ishospitalName == null) {
                            $("#hospitalName_" + val[i].id).html("暂无社区信息")
                        }
                        if (allCount == 0) {
                            Progress(val[i].id, 0 + "%")
                        } else {
                            var progressNum = Math.ceil((allFinishCount / allCount) * 100)
                            Progress(val[i].id, progressNum + "%")
                        }
                        if (isStop == 0) {
                            $("#progress_" + val[i].id).css({
                                "background-color": "gray"
                            })
                            $("#stopBtn_" + val[i].id).html("激活计划")
                            $("#stopBtn_" + val[i].id).css({
                                "background-color": "#2dbe55"
                            })
                        } else {
                            $("#progress_" + val[i].id).css({
                                "background-color": "#ff9526"
                            })
                            $("#stopBtn_" + val[i].id).html("中止计划")
                            if(val[i].status == 2) {
                            	$("#stopBtn_" + val[i].id).css({
	                                "background-color": "gray"
	                            })
                            } else {
                            	$("#stopBtn_" + val[i].id).css({
	                                "background-color": "#ff3b30"
	                            })
                            }
                        }
                    }
                    var lastColor = 'red';
                    for (var i = 0; i < val.length; i++) {
                        if (i == 0) {
                            $($(".quote")[i]).css("background-color", "#12b7f5")
                            continue
                        }
                        if (val[i].patientName == val[i - 1].patientName) {
                            $($(".quote")[i]).css("background-color", "#02cfb9")
                            if (lastColor === 'red') {
                                $($(".quote")[i]).css("background-color", "#12b7f5")
                            }
                        } else {
                            if (lastColor !== 'red') {
                                $($(".quote")[i]).css("background-color", "#12b7f5")
                                lastColor = 'red'
                            } else {
                                lastColor = 'white'
                                $($(".quote")[i]).css("background-color", "#02cfb9")
                            }
                        }
                    }
                })
            },
        },
        mounted: function() {
            var vm = this
            vm.getDatas()
            vm.gettypes()
            vm.getDoctorTeam()
        },
        methods: {
            setImgSrc: function (src) {
                var str = httpRequest.getImgUrl(src)
                return str
            },
            getDoctorTeam:function(){
                var vm=this
                var wlyyAgentForDoc=JSON.parse(window.localStorage.getItem('wlyyAgentForDoc'));
                var uid=wlyyAgentForDoc && wlyyAgentForDoc.uid;
                healthAPI.getDoctorTeam(uid).then(function(res){
                    if(res.status==200){
                        vm.doctorTeamList=res.data;
                    }
                })
            },
            getDatas: function () {
                var vm = this
                var params = {
                    patientCondition: vm.name,//	居民条件,可以按身份证或者居民名称模糊匹配
                    diseaseCode: vm.type, //疾病类型
                    planType: vm.status,	//安排类型(1康复计划,2转社区医院,3转家庭病床)
                    todaybacklog: vm.isTotayTodo,	// 今日待办(1、今日待办,2、全部)
                    page: vm.currentPage,
                    pageSize: vm.pagesize,
                    isDanger: vm.isDanger,
                }
                healthAPI.getSpecialList(params).then(function (res) {
                    console.log(res)
                    if (res.status == 200) {
                        vm.wujilu = false
                        vm.total = res.data.totalCount
                        vm.pagetotal = Math.ceil(res.data.totalCount / vm.pagesize)
                        vm.tablelist = _.sortBy(res.data.detailModelList, "patientName")
                        if (vm.tablelist.length == 0) {
                            vm.wujilu = true
                        }
                        vm.docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'))
                        vm.doctorType = vm.docInfo.doctorType
                        if (vm.doctorType != 1) {
                            $(".neironglef>button:nth-child(1)").attr('disabled', "true")
                            $(".neironglef>button:nth-child(1)").addClass("falsebutton")
                            $(".neironglef>button:nth-child(1)").css("color", "white")
                        }
                        healthAPI.doctorBaseinfo().then(function (res) {
                            vm.isLeader = res.data.isLeader//0非团队长 1团队长
                            vm.level=res.data.level//1专科医生,2全科医生,3健康管理师
                            vm.planCreateUser //创建者跟登录者相等可中止操作
                            vm.docCode=res.data.code
                            for (var i = 0; i < vm.tablelist.length; i++) {
                                if(vm.docCode!=vm.planCreateUser){
                                    $("#stopBtn_" + vm.tablelist[i].id).attr('disabled', "true")
                                    $("#stopBtn_" + vm.tablelist[i].id).addClass("falsebutton")
                                }
                               
                            }
                            // if (vm.isLeader == 0||vm.level != 1) {
                            //     $(".neironglef>button:nth-child(2)").attr('disabled', "true")
                            //     $(".neironglef>button:nth-child(2)").addClass("falsebutton")
                            //     $(".neironglef>button:nth-child(2)").css("color", "white")
                            // }
                        })
                    } else {
                        showErrorMessage(res.msg);
                    }
  }
  new Vue({
    el: '#app',
    data: {
      code: '',
      modal: '',
      type: '',
      status: '',
      plan: '',
      name: '',
      isDanger: '0',
      pagesize: 10,
      total: '',
      pagetotal: '', //总页数
      currentPage: 1, //当前页数
      tablelist: [],
      diseaselist: [],
      types: [],
      Statics: {},
      wujilu: false,
      datamodelshow: true,
      plantype: 1,
      todaylog: 1,
      isTotayTodo: 1,
      progress: '',
      allFinishCount: '',
      allCount: '',
      planid: '',
      isStop: 1, //
      isActive: true,
      doctorType: '',
      docCode: '',
      docInfo: {},
      isLeader: 0,
      planCreateUser: '',
      doctorTeamList: [],
      healthyConditionType: 0
    },
    watch: {
      tablelist: function (val) {
        var vm = this
        this.$nextTick(function () {
          element.init()
          for (var i = 0; i < val.length; i++) {
            var allFinishCount = val[i].allFinishCount
            var allCount = val[i].allCount
            var isStop = val[i].status
            var ishospitalName = val[i].hospitalName
            vm.planCreateUser = val[i].planCreateUser
            vm.healthyConditionType = val[i].healthyConditionType //1住院 2康复期 3日常健康 4健康筛查
            if (vm.healthyConditionType == 1) {
              $('#quote_' + val[i].id).css('backgroundColor', '#FF3B30')
            }
            if (vm.healthyConditionType == 2) {
              $('#quote_' + val[i].id).css('backgroundColor', '#FF9526')
            }
            if (vm.healthyConditionType == 3) {
              $('#quote_' + val[i].id).css('backgroundColor', '#2DBE55')
            }
            if (vm.healthyConditionType == 4) {
              $('#quote_' + val[i].id).css('backgroundColor', '#02CFB9')
            }
            if (ishospitalName == null) {
              $('#hospitalName_' + val[i].id).html('暂无社区信息')
            }
            if (allCount == 0) {
              Progress(val[i].id, 0 + '%')
            } else {
              var progressNum = Math.ceil((allFinishCount / allCount) * 100)
              Progress(val[i].id, progressNum + '%')
            }
            if (isStop == 0) {
              $('#progress_' + val[i].id).css({
                'background-color': 'gray'
              })
              $('#stopBtn_' + val[i].id).html('激活计划')
              $('#stopBtn_' + val[i].id).css({
                'background-color': '#2dbe55'
              })
            } else {
              $('#progress_' + val[i].id).css({
                'background-color': '#ff9526'
              })
              $('#stopBtn_' + val[i].id).html('中止计划')
              if (val[i].status == 2) {
                $('#stopBtn_' + val[i].id).css({
                  'background-color': 'gray'
                })
            },
            gettypes: function () {
                var vm = this
                var search = true
                $("#Status").bsSuggest({
                    data: {
                        value: [{
                            code: "",
                            name: "全部"
                        },
                        {
                            code: "1",
                            name: "康复计划"
                        },
                        {
                            code: "2",
                            name: "(转)社区医院"
                        },
                        {
                            code: "3",
                            name: "(转)家庭病床"
                        }
                        ]
                    },
                    getDataMethod: "data",
                    effectiveFields: ["name"],
                    idField: "code",
                    keyField: "name"
                });
                healthAPI.getSpecialDisease().then(function (res) {
                    if (res.status == 200) {
                        console.log(res)
                        var data = {}
                        data.value = _.map(res.data, function (v) {
                            return {
                                code: v.code,
                                name: v.name
                            }
                        })
                        if (search) {
                            data.value = [{
                                code: "",
                                name: "全部"
                            }].concat(data.value)
                        }
                        $("#Type").bsSuggest({
                            data: data,
                            getDataMethod: "data",
                            effectiveFields: ["name"],
                            idField: "code",
                            keyField: "name"
                        });
                        vm.types = res.data;
                    } else {
                        showErrorMessage(res.msg);
                    }
              } else {
                $('#stopBtn_' + val[i].id).css({
                  'background-color': '#ff3b30'
                })
            },
            search: function (page) {
                var vm = this
                vm.type = $("#Type").attr("data-id");
                vm.status = $("#Status").attr("data-id");
                vm.currentPage = page
                vm.getDatas()
            },
            daiban: function (page) {
                var vm = this
                vm.isTotayTodo = $("#c").prop("checked") ? 1 : 2
                $(".icon-chkbox").toggleClass("icon-bgchkbox");
                vm.currentPage = page
                console.log(vm.currentPage)
                vm.getDatas()
            },
            morePlan: function (data) {
                location.href = "moreplan.html?patientCode=" + data.patientCode
            },
            stop: function (data) {
                var vm = this
                vm.planid = data.id
                conFirm("确定终止该计划吗", data.status, vm.isStop, vm.planid, vm.getDatas)
              }
            }
          }
          var lastColor = 'red'
          for (var i = 0; i < val.length; i++) {
            if (i == 0) {
              $($('.quote')[i]).css('background-color', '#12b7f5')
              continue
            }
            if (val[i].patientName == val[i - 1].patientName) {
              $($('.quote')[i]).css('background-color', '#02cfb9')
            },
            newRecover: function () {
                location.href = "../../recover/html/new_recover.html"
            },
            checkPlan: function (data) {
                var vm = this
                location.href = "../../rehabilitation/html/rehabilitation_management.html?planId=" + data.id+"&patientCode=" + data.patientCode
              if (lastColor === 'red') {
                $($('.quote')[i]).css('background-color', '#12b7f5')
              }
            } else {
              if (lastColor !== 'red') {
                $($('.quote')[i]).css('background-color', '#12b7f5')
                lastColor = 'red'
              } else {
                lastColor = 'white'
                $($('.quote')[i]).css('background-color', '#02cfb9')
              }
            }
          }
        })
      }
    },
    mounted: function () {
      var vm = this
      vm.getDatas()
      vm.gettypes()
      vm.getDoctorTeam()
    },
    methods: {
      setImgSrc: function (src) {
        var str = httpRequest.getImgUrl(src)
        return str
      },
      getDoctorTeam: function () {
        var vm = this
        var wlyyAgentForDoc = JSON.parse(window.localStorage.getItem('wlyyAgentForDoc'))
        var uid = wlyyAgentForDoc && wlyyAgentForDoc.uid
        healthAPI.getDoctorTeam(uid).then(function (res) {
          if (res.status == 200) {
            vm.doctorTeamList = res.data
          }
        })
      },
      getDatas: function () {
        var vm = this
        var params = {
          patientCondition: vm.name, //	居民条件,可以按身份证或者居民名称模糊匹配
          diseaseCode: vm.type, //疾病类型
          planType: vm.status, //安排类型(1康复计划,2转社区医院,3转家庭病床)
          todaybacklog: vm.isTotayTodo, // 今日待办(1、今日待办,2、全部)
          page: vm.currentPage,
          pageSize: vm.pagesize,
          isDanger: vm.isDanger
        }
            },
            modelControl: function () {
                location.href = "../../rehabilitation/html/management.html"
        healthAPI.getSpecialList(params).then(function (res) {
          console.log(res)
          if (res.status == 200) {
            vm.wujilu = false
            vm.total = res.data.totalCount
            vm.pagetotal = Math.ceil(res.data.totalCount / vm.pagesize)
            vm.tablelist = _.sortBy(res.data.detailModelList, 'patientName')
            if (vm.tablelist.length == 0) {
              vm.wujilu = true
            }
            vm.docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'))
            vm.doctorType = vm.docInfo.doctorType
            if (vm.doctorType != 1) {
              $('.neironglef>button:nth-child(1)').attr('disabled', 'true')
              $('.neironglef>button:nth-child(1)').addClass('falsebutton')
              $('.neironglef>button:nth-child(1)').css('color', 'white')
            }
            },
            checkPatient: function (data) {
                var vm = this
                layer.open({
                    type: 2,
                    area: ['750px', '650px'],
                    shade: 0.5,
                    title: '居民信息',
                    fixed: true, //不固定
                    maxmin: true,
                    closeBtn: 1,
                    shift: 5,
                    shadeClose: false, //点击遮罩关闭层
                    content: '../../temporary/html/userInfo.html?patient=' + data.patientCode
                })
               
                // location.href = "" + 
            healthAPI.doctorBaseinfo().then(function (res) {
              vm.isLeader = res.data.isLeader //0非团队长 1团队长
              vm.level = res.data.level //1专科医生,2全科医生,3健康管理师
              vm.planCreateUser //创建者跟登录者相等可中止操作
              vm.docCode = res.data.code
              for (var i = 0; i < vm.tablelist.length; i++) {
                if (vm.docCode != vm.planCreateUser) {
                  $('#stopBtn_' + vm.tablelist[i].id).attr('disabled', 'true')
                  $('#stopBtn_' + vm.tablelist[i].id).addClass('falsebutton')
                }
              }
              // if (vm.isLeader == 0||vm.level != 1) {
              //     $(".neironglef>button:nth-child(2)").attr('disabled', "true")
              //     $(".neironglef>button:nth-child(2)").addClass("falsebutton")
              //     $(".neironglef>button:nth-child(2)").css("color", "white")
            },
            recoveryPlan:function (data){
                location.href = "../../recover/html/personal-manage.html?patientCode="+data.patientCode+'&planId='+data.id
                    
              // }
            })
          } else {
            showErrorMessage(res.msg)
          }
        })
      },
      gettypes: function () {
        var vm = this
        var search = true
        $('#Status').bsSuggest({
          data: {
            value: [
              {
                code: '',
                name: '全部'
              },
              {
                code: '1',
                name: '康复计划'
              },
              {
                code: '2',
                name: '(转)社区医院'
              },
              {
                code: '3',
                name: '(转)家庭病床'
              }
            ]
          },
          getDataMethod: 'data',
          effectiveFields: ['name'],
          idField: 'code',
          keyField: 'name'
        })
        healthAPI.getSpecialDisease().then(function (res) {
          if (res.status == 200) {
            console.log(res)
            var data = {}
            data.value = _.map(res.data, function (v) {
              return {
                code: v.code,
                name: v.name
              }
            })
            if (search) {
              data.value = [
                {
                  code: '',
                  name: '全部'
                }
              ].concat(data.value)
            }
            $('#Type').bsSuggest({
              data: data,
              getDataMethod: 'data',
              effectiveFields: ['name'],
              idField: 'code',
              keyField: 'name'
            })
            vm.types = res.data
          } else {
            showErrorMessage(res.msg)
          }
        })
      },
      search: function (page) {
        var vm = this
        vm.type = $('#Type').attr('data-id')
        vm.status = $('#Status').attr('data-id')
        vm.currentPage = page
        vm.getDatas()
      },
      daiban: function (page) {
        var vm = this
        vm.isTotayTodo = $('#c').prop('checked') ? 1 : 2
        $('.icon-chkbox').toggleClass('icon-bgchkbox')
        vm.currentPage = page
        console.log(vm.currentPage)
        vm.getDatas()
      },
      morePlan: function (data) {
        location.href = 'moreplan.html?patientCode=' + data.patientCode
      },
        }
      stop: function (data) {
        var vm = this
        vm.planid = data.id
        conFirm('确定终止该计划吗', data.status, vm.isStop, vm.planid, vm.getDatas)
      },
      newRecover: function () {
        location.href = '../../recover/html/new_recover.html'
      },
      checkPlan: function (data) {
        var vm = this
        console.log('../../rehabilitation/html/rehabilitation_management.html?planId=' + data.id + '&patientCode=' + data.patientCode)
        // return
    })
});
        location.href = '../../rehabilitation/html/rehabilitation_management.html?planId=' + data.id + '&patientCode=' + data.patientCode
      },
      modelControl: function () {
        location.href = '../../rehabilitation/html/management.html'
      },
      checkPatient: function (data) {
        var vm = this
        layer.open({
          type: 2,
          area: ['750px', '650px'],
          shade: 0.5,
          title: '居民信息',
          fixed: true, //不固定
          maxmin: true,
          closeBtn: 1,
          shift: 5,
          shadeClose: false, //点击遮罩关闭层
          content: '../../temporary/html/userInfo.html?patient=' + data.patientCode
        })
        // location.href = "" +
      },
      recoveryPlan: function (data) {
        location.href = '../../recover/html/personal-manage.html?patientCode=' + data.patientCode + '&planId=' + data.id
      }
    }
  })
})