var httpData=GetRequest(); var docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent')); var loginDoctor = docInfo var clientHeight = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight); new Vue({ el:"#app", data:{ clientHeight: clientHeight, planId: httpData['planId'], planDetaiId: httpData['planDetaiId'], patient: httpData['patient'], itemType:"1", //随访计划 followUpItem:{ patientName: '', planList:[{date:new Date().format("yyyy-MM-dd HH:mm")+":00",type:"2",doctor:loginDoctor.uid,followupClass:'',type1:'1'}], //计划列表 }, rules: { followupPlanDate: [ { required: true, message: '请选择随访时间', trigger: 'change' }, ], }, item_1:{patientName: '',planList:[{date:"",type:"2",doctor:loginDoctor.uid,type1:'1'}]}, //随访计划列表 planItem:{date:"",type:"2",doctor:loginDoctor.uid,type1:'1'}, //随访计划列表项 item_2:{ "patientName": '', "date":"", "followupType":"2", "followupClass":"", "followupManagerStatus":"", "plandate":"", "prescriptioncode":"" }, item_3:{ "patientName": '', "followupDate":"", "followupPlanDate":"", "followupType":"2", "followupClass":"", }, patientName: '', patientInfo:{}, loginDoctor: loginDoctor, doctorList:[], sfPatientList:{}, followupManagerStatusList:[], //临时随访状态 toSelectsfpatient:false, followTypeList: [{code:'1',name:'高血压'},{code:'2',name:'糖尿病'},{code:'1,2',name:'高血压,糖尿病'}, {code:'11',name:'冠心病'},{code:'16',name:'慢性阻塞性肺病'},{code:'17',name:'脑卒中'},{code:'13',name:'慢性前列腺'},{code:'19',name:'肺癌'},{code:'15',name:'慢性肾病'}, {code:'14',name:'慢性乳腺'},{code:'20',name:'慢性胃肠病'},{code:'18',name:'脂肪肝'},{code:'12',name:'慢性妇科炎症'} ] }, mounted: function() { this.doctorList.push(loginDoctor) this.getDictByDictName("FOLLOWUP_MANAGER_STATUS","followupManagerStatusList") if(this.patient){ this.getPatientInfo() this.getDoctorList() } $("body").click(function () { $("#div_items").css('display', 'none'); }); $(".div_item").hover(function () { $(this).css('background-color', '#f8f8f8') }, function () { $(this).css('background-color', 'white') }); }, methods: { //计划类型改变 changePlanType: function(){ this.doctorList=[] if(this.itemType=="1"){ this.doctorList.push(loginDoctor) } this.followUpItem=JSON.parse(JSON.stringify(this["item_"+this.itemType])) if(this.itemType=="1"){ this.followUpItem.planList[0].date=new Date().format("yyyy-MM-dd HH:mm")+":00" }else if(this.itemType=="2"){ this.followUpItem.date=new Date().format("yyyy-MM-dd HH:mm")+":00" this.followUpItem.type='2' }else if(this.itemType=="3"){ this.followUpItem.followupDate=new Date().format("yyyy-MM-dd HH:mm")+":00" } // this.patientInfo = {} setTimeout(()=>{ this.$refs.form.clearValidate() },100) }, fsClassChange: function(){ // this.patientInfo = {} this.followUpItem.patientName="" setTimeout(()=>{ this.$refs.form.clearValidate() },100) }, // 选择随访居民 selectsfPatient: function(){ var vm=this if(this.followUpItem.patientName.length>=15){ $("#div_items").css('display', 'block'); vm.getsfPatient() }else{ $("#div_items").css('display', 'none'); } }, // 获取访视居民列表 getsfPatient: function(){ var vm=this var params={idcard:this.followUpItem.patientName} serviceVisitApi.getPatientJWInfo(params).then(res=>{ if(res.status==200){ if(!res.data.data){ vm.sfPatientList={} }else{ vm.sfPatientList=res.data.data } }else{ this.$message.error(res.data.msg) } }) }, // 选择访视居民选中单个下拉框 clicksingleItem: function(sitem){ var vm=this if(!sitem.ssc&&!sitem.patient){ const h = this.$createElement; this.$msgbox({ title: '系统提示', message: h('p', { style: 'text-align: center;padding-top:20px;padding-bottom:40px;color:#333;' }, '此居民暂无社保卡号,不支持为其创建入户访视计划。请居民注册厦门i健康账号后,医生方可创建入户访视计划'), showCancelButton: false, confirmButtonText: '确定', confirmButtonClass:"c-btn-plain c-btn-12b7f5-plain c-btn-w68", cancelButtonClass:"c-btn-plain c-btn-d7dce6-plain c-btn-w68" }).then(action => { }) return } if(!sitem.patient){ const h = this.$createElement; this.$msgbox({ title: '系统提示', message: h('p', { style: 'text-align: center;padding-top:20px;padding-bottom:40px;color:#333;' }, '此居民暂无厦门i健康,若要继续为此居民进行入户访视,系统将为此居民自动创建一个厦门i健康账号,请问您是否确认继续此操作?'), showCancelButton: true, confirmButtonText: '确定', cancelButtonText: '取消', confirmButtonClass:"c-btn-plain c-btn-12b7f5-plain c-btn-w68", cancelButtonClass:"c-btn-plain c-btn-d7dce6-plain c-btn-w68" }).then(action => { var obj={} obj.status=1 obj.isCertified=0 obj.address=sitem.homeAddress obj.name=sitem.sickName obj.sex=sitem.sickSex obj.idcard=sitem.idCard obj.birthday=sitem.birthday obj.ssc=sitem.ssc obj.age=sitem.age var data={ jsonData:JSON.stringify(obj) } serviceVisitApi.create(data).then(res=>{ if(res.status==200){ $("#div_items").css('display', 'block'); vm.getsfPatient() vm.toSelectsfpatient=false }else{ this.$message.error(res.data.msg) } }) }).catch(() => { }); }else{ vm.patientInfo={} vm.followUpItem.patientName=sitem.sickName vm.toSelectsfpatient=true vm.patientInfo.code=sitem.patient vm.patientInfo.name=sitem.sickName vm.patientInfo.idcard=sitem.idCard vm.patientInfo.age=sitem.age+"岁" vm.patientInfo.idcardEncrypt=sitem.idcardEncrypt vm.patientInfo.mobile=sitem.mobile vm.patientInfo.sex=sitem.sickSex } }, // 获取居民对应医生列表--随访 getDoctorList: function() { var params = { code: this.patient } followUpAPI.sign_doctors(params).then(function(msg){ if (msg.status === 200) { var hasThisDoctor=_.find(msg.list,{code:loginDoctor.uid}) if(hasThisDoctor>-1){ //列表里有当前医生 this.doctorList=msg.list }else{ this.doctorList.push(loginDoctor) } } }) }, addListItem: function(){ var listItem=JSON.parse(JSON.stringify(this.planItem)) listItem.date=new Date().format("yyyy-MM-dd HH:mm")+":00" this.followUpItem.planList.push(listItem) }, removeListItem: function(index){ const h = this.$createElement; this.$msgbox({ title: '删除提示', message: h('p', { style: 'text-align: center;padding-top:20px;padding-bottom:40px;color:#333;' }, '请问您是否确认删除本次计划?'), showCancelButton: true, confirmButtonText: '确定', cancelButtonText: '取消', confirmButtonClass:"c-btn-plain c-btn-12b7f5-plain c-btn-w68", cancelButtonClass:"c-btn-plain c-btn-d7dce6-plain c-btn-w68" }).then(action => { this.followUpItem.planList.splice(index,1) }).catch(() => { }); }, //创建随访计划 addFollowupPlan: function(){ var vm = this this.$refs["form"].validate((valid) => { if (valid) { var ispass=_.every(this.followUpItem.planList,(item,index)=>{ var datepass=true var typepass=item.type!="3"||this.patientInfo.mobile if(typepass){ datepass=index==0||(index>0 && this.followUpItem.planList[index-1].date{ // this.$loading.close() layer.close(loading) if(res.status == 200){ layer.msg(res.msg, { icon: 1 }) if(res.data&&res.data.length>0){ var relationCode = res.data[0].id var flag = 1 ;//标记(1随访2临时随访) window.parent.closeFollowUpLayer(vm.planDetaiId, relationCode, flag) } }else{ layer.msg(res.msg, { icon: 5 }) } }) } else { console.log('error submit!!'); return false; } }); }, //创建临时随访 addFollowup: function(){ var vm = this this.$refs["form"].validate((valid) => { if (valid) { if(this.followUpItem.plandate){ if(this.followUpItem.plandate<=this.followUpItem.date){ this.$message.warning("下次随访时间不可早于随访时间") return false } } if(this.followUpItem.followupType=="3"&&!this.patientInfo.mobile){ this.$message.warning("该居民无联系方式,不可进行电话随访") return false } var params=JSON.parse(JSON.stringify(this.followUpItem)) params.patient=this.patientInfo.code // this.$loading('创建临时随访...') var loading = layer.load(0, {shade: false}) followUpAPI.addFollowup(params).then(res=>{ // this.$loading.close() layer.close(loading) if(res.status == 200){ layer.msg(res.msg, { icon: 1 }) if(res.data&&res.data.length>0){ var relationCode = res.data var flag = 2 ;//标记(1随访2临时随访) window.parent.closeFollowUpLayer(vm.planDetaiId, relationCode, flag) } }else{ layer.msg(res.msg, { icon: 5 }) } }) } else { console.log('error submit!!'); return false; } }); }, //创建入户访视 saveFollowup: function(){ var vm = this if(!this.patientInfo.code){ //未选中居民 this.followUpItem.patientName="" } if(this.followUpItem.followupType=="3"&&!this.patientInfo.mobile){ this.$message.warning("该居民无联系方式,不可进行电话访视") return false } this.$refs["form"].validate((valid) => { if (valid) { var params={ followupDate: this.followUpItem.followupDate, followupPlanDate: this.followUpItem.followupDate, followupType: this.followUpItem.followupType, followupClass: this.followUpItem.followupClass, doctorCode: loginDoctor.uid, doctorName: loginDoctor.name, orgCode: loginDoctor.hospital, orgName: loginDoctor.hospitalName, patientCode: this.patientInfo.code, patientName: this.patientInfo.name, idcard: this.patientInfo.idcard, age:this.patientInfo.age, idcardEncrypt:this.patientInfo.idcardEncrypt, mobile:this.patientInfo.mobile, sex:this.patientInfo.sex, dataFrom: "2", status: "2", createTime: new Date().format("yyyy-MM-dd HH:mm:ss"), creater: loginDoctor.uid, type:'3' //区分随访计划1、新增随访2、临时随访3、入户随访 } // this.$loading('创建入户访视...') var loading = layer.load(0, {shade: false}) followUpAPI.saveFollowup({jsonFollowup:JSON.stringify(params)}).then(res=>{ // this.$loading.close() layer.close(loading) if(res.status == 200){ layer.msg(res.msg, { icon: 1 }) if(res.data&&res.data.length>0){ var relationCode = res.data[0].id window.parent.closeFollowUpLayer(vm.planDetaiId, relationCode) } }else{ layer.msg(res.msg, { icon: 5 }) } }) } else { console.log('error submit!!'); return false; } }); }, getDictByDictName: function(name,itemName) { var vm = this var params = { name: name } signAPI.getDictByDictName(params).then(function(res){ var result = res.list if (res.status === 200) { vm[itemName] = result } }) }, // 选择居民信息或者获取居民信息 // getPatientInfo(obj) { // this.patientInfo = obj // this.$set(this.followUpItem,"patientName",obj.name) // if(this.itemType=="1"){ // this.getDoctorList() // } // }, // 选择居民信息或者获取居民信息 getPatientInfo: function() { var vm = this var params = { patient: vm.patient } followUpAPI.getPatientInfo(params).then(function(res){ if(res.status == 200){ vm.patientInfo = res.data?res.data:{} vm.followUpItem['patientName'] = vm.patientInfo.name vm.item_1['patientName'] = vm.patientInfo.name vm.item_2['patientName'] = vm.patientInfo.name vm.item_3['patientName'] = vm.patientInfo.name vm.patientName = vm.patientInfo.name } }) }, //打开居民列表弹框 showPatientList: function(){ if(this.itemType=="3"){ var ispass=true this.$refs["form"].validateField(["followupClass","followupDate"],(valid)=>{ if(valid){ //有值说明验证未通过 ispass=false } }) if(!ispass){ return false } } this.$root.bus.$emit('selectPatientAddFUPlan',{type:this.itemType,patientInfo:this.patientInfo,followUpItem:this.followUpItem}) }, //关闭弹框 closeMask: function(){ this.$root.bus.$emit('closeMask') }, back: function(){ this.$emit("removeTab","newPlan") }, } })