123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605 |
- var httpData = GetRequest();
- var docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'));
- var tempwindow;
- var previewLayerIndex, followupLayerIndex, KFZDlayerIndex;
- function closeGuidancePreview(){
- layer.close(previewLayerIndex)
- }
- function closeFollowUpLayer(planDetaiId, relationCode){
- if($.isArray(relationCode)) {
- $.each(relationCode, function(index, item){
- top.rehabilitationGuideVue.saveRehabilitationOperateRecord(planDetaiId, 6, item)
- })
- } else {
- top.rehabilitationGuideVue.saveRehabilitationOperateRecord(planDetaiId, 6, relationCode)
- }
- layer.close(followupLayerIndex)
- }
- function closeKFZDlayer(planDetaiId){
- top.rehabilitationGuideVue.saveRehabilitationOperateRecord(planDetaiId, 5)
- layer.close(KFZDlayerIndex)
- }
- function showSuccessMessage(msg) {
- layer.msg(msg, {
- icon: 1
- })
- }
- function showErrorMessage(msg) {
- layer.msg(msg, {
- icon: 5
- })
- }
- top.rehabilitationGuideVue = new Vue({
- el: "#app",
- data: {
- doctorlevel:docInfo.doctorlevel,
- imgData: {
- accept: 'image/gif, image/jpeg, image/png, image/jpg',
- },
- isCollapse: false,
- selectCheckTyperadio:0,
- showAppointHelpCheckBtn:true, //点击预约协诊按钮结束变为false
- showRecordFinished:false, //点击完成记录按钮变为true
- appointTime:'',
- appointDate:"",
- appointHour:'',
- upImgs: [],
- upImgArr: [],
- planid: httpData['planid'], // 服务项id
- service: {
- relationRecordImg:{},
- messageList:{},
- },
- startTime:'',
- pickerOptions:{
- disabledDate:function(time) {
- return time.format('yyyy-MM-dd') < new Date().format('yyyy-MM-dd')
- }
- },
- pId: httpData['pId'], // 康复计划id
- patient: httpData['patient'],
- patientName: decodeURI(httpData['patientName']),
- layerIndex: undefined,
- recordId: httpData['recordId']||undefined,
- islimit: false,
- },
- watch:{
- appointDate:function(){
- if(this.appointDate==new Date().format('yyyy-MM-dd')){
- this.startTime=new Date(new Date().getTime()).format('hh:mm')
- }else{
- this.startTime=''
- }
- }
- },
- mounted: function() {
- this.getServiceItem();
- },
- methods: {
- // 提醒患者 num 1康复指导2康复下转3复诊提醒4上门服务提醒5家签提醒
- sendSpecialistWeixinMessage: function(type){
- var vm = this
- var text = ''
- if(type==4){ // 上门服务
- text = '请问您是否确认提醒'+vm.patientName+'居民预约上门护理服务?'
- } else if(type==7){ // 康复复诊
- text = '请问您是否确认提醒'+vm.patientName+'居民进行复诊?'
- }
- var current=layer.confirm(text, {
- btn: ['确定', '取消'],
- title: "提示"
- }, function (index) {
- var reservationTypeObj={0:2,1:3,2:1}
- var _type = type == 4? 4:type==7?3:''
- var loading = layer.load(0, {shade: false})
- var params = {
- patient: vm.patient,
- doctor: docInfo.uid,
- type: _type,
- relationCode: vm.planid,
- planId: vm.pId,
- reservationType:reservationTypeObj[vm.selectCheckTyperadio] //复诊类型:1线上,2线下,3远程
- }
- rehaAPI.sendSpecialistWeixinMessage(params).then(function(res){
- layer.close(loading)
- if(res.status == 200){
- showSuccessMessage('提交成功!')
- if(_type == 3 || _type == 4){ // 提醒患者后,即认为是已完成
- vm.saveRehabilitationOperateRecord(vm.planid, type)
- }
- } else {
- showErrorMessage(res.msg)
- }
- })
- layer.close(current); //再执行关闭
- })
- },
- appointHelpCheck:function(data){
- var vm=this
- vm.showAppointHelpCheckBtn=false
- vm.appointTime=vm.appointDate+' '+vm.appointHour
- var params={
- patient:vm.patient,
- doctor:data.familyDoctorCode,
- doctorName:data.familyDoctorName, //家签医生
- sendTime:vm.appointTime,
- planDetailId:vm.planid,
- appointmentDoctor:data.specialistDoctorCode,
- appointmentDoctorName:data.specialistDoctorName //专科医生
- }
- var loading = layer.load(0, {shade: false})
- rehaAPI.appointmentConsultation(params).then(function(res){
- layer.close(loading)
- if(res.status == 200){
- showSuccessMessage('操作成功')
- setTimeout(function(){
- vm.getServiceItem()
- },400)
- } else {
- showErrorMessage(res.msg)
- }
- })
- },
- encryptCode: function(docCode) {
- var publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4lT0JWcv9xx6Q1hsxMal2F1AmKti/xVbBeh8jrD5CiYsFTH0DO1Mpyvv8YtkGdnDSLRjOQOA1PiaYvZoHIhml/jTvEMsvFlAD5i1BsHa5blLlJxQNp/XI7wpMZPfczqO+I/JONrV6ib+6Ci/1FyTjPQfHaiT2ehGyM/CFzOW1PQIDAQAB"
- var encrypt =new JSEncrypt()
- encrypt.setPublicKey(publicKey)
- return encodeURIComponent(encrypt.encrypt(docCode))
- },
- openWindow(url, p1, p2){
- try{
- if(tempwindow)
- tempwindow.close()
- }catch(e){
- console.log(e)
- }
-
- if(p1){
- tempwindow = window.open('_blank', p1, p2)
- } else {
- tempwindow = window.open('_blank')
- }
- tempwindow.location = url
- },
- openHelpCheck:function(){
- var encryptCode = this.encryptCode(docInfo.uid)
- var url = httpRequest.teamworkService + '/#/teamwork/login?_code='+ encryptCode
- this.openWindow(url)
- },
- recordFinished:function(){
- this.showRecordFinished=true
- },
- //康复指导
- kfzd:function(){
- var vm=this, str = '../../rehabilitation/html/rehabilitation_guidance.html?patient='+vm.patient+'&planDetaiId='+vm.planid+'&planId='+vm.pId
- KFZDlayerIndex = layer.open({
- type: 2,
- // offset: ['100px'], //右下角弹出
- area: ['660px', '650px'],
- shade: 0.5,
- title: '康复指导',
- fixed: true, //不固定
- maxmin: true,
- closeBtn: 1,
- shift: 5,
- shadeClose: false, //点击遮罩关闭层
- content: str,
- end: function() { // 未点击确定按钮,点击关闭按钮
- this.getServiceItem();
- }
- });
- },
- // 康复随访计划
- sfjh: function(){
- var vm=this
- followupLayerIndex = layer.open({
- type: 2,
- // offset: ['100px'], //右下角弹出
- area: ['80%', '650px'],
- shade: 0.5,
- title: '随访计划',
- fixed: true, //不固定
- maxmin: true,
- closeBtn: 1,
- shift: 5,
- shadeClose: false, //点击遮罩关闭层
- content:'../../followup/html/followup_newplan.html?patient='+vm.patient+'&planDetaiId='+vm.planid+'&planId='+vm.pId,
- end: function() { // 未点击确定按钮,点击关闭按钮
- this.getServiceItem();
- }
- });
- },
- zwkf: function() {
- top.layer.msg('此功能暂未开放', {
- icon: 1
- });
- },
- //康复指导
- jkzd: function(planId,patient) {
- var vm = this
- top.layer.open({
- type: 2,
- // offset: ['100px'], //右下角弹出
- area: ['80%', '648px'],
- shade: 0.5,
- title: '健康教育',
- fixed: true, //不固定
- maxmin: true,
- closeBtn: 1,
- shift: 5,
- shadeClose: false, //点击遮罩关闭层
- content: '../../guidance/html/index.html#/person-edit-panel?patient=' + patient + '&planId=' + planId
- });
- },
- qwapp: function() {
- top.layer.msg('请前往app处理', {
- icon: 5
- });
- },
- viewGuidance: function(o){
- var vm = this
- previewLayerIndex = layer.open({
- type: 2,
- area: ['380px', '600px'],
- shade: 0.5,
- title: '预览',
- fixed: true, //不固定
- maxmin: true,
- closeBtn:1,
- shift: 5,
- shadeClose: false, //点击遮罩关闭层
- content: '../../rehabilitation/html/rehabilitation_guidance_preview.html?modelCode='+o.article
- });
- },
- getServiceItem: function() {
- var vm = this;
- var loginDoctor = JSON.parse(window.localStorage.getItem('wlyyAgent'));
- var loadding = top.layer.load(0, {
- shade: false
- }); //0代表加载的风格,支持0-2
- var params = {
- planDetailId: vm.planid,
- }
- if(vm.recordId){
- params['recordId'] = vm.recordId
- }
- rehaAPI.serviceItem(params).then(function(res) {
- top.layer.close(loadding);
- if(res.status == 200) {
- vm.service = res.data;
- var isZK=loginDoctor.doctorType==1?true:false;
- vm.service.isZK=isZK;
- if(vm.service.completeTime){
- var l = vm.service.completeTime.length
- vm.service.shortCompleteTime = vm.service.completeTime.substr(l-5, l-1)
- }
- if(vm.service.isMyTask==1){//执行者
- vm.service.isCK=true;//无法显示按钮
- if(loginDoctor.uid==vm.service.specialistDoctorCode){//说明我自己是创建者
- vm.service.isCK=false;
- vm.service.isCreate=true;
- }
- }else{
- if(loginDoctor.uid==vm.service.specialistDoctorCode){//说明我自己是创建者
- vm.service.isCreate=true;
- }
- }
- if(vm.service.type == 4 || vm.service.type == 5 || vm.service.type == 7){
- vm.getRelationRecord(vm.service.type, vm.planid).then(function(result){
- if(result.status == 200){
- vm.service.relationList = result.data&&result.data.length>0?result.data:undefined
- vm.$forceUpdate()
- }
- })
- }
- if(vm.service.frequencyCode){
- vm.islimit = true
- } else {
- vm.islimit = false
- }
- } else {
- top.layer.msg(res.msg, {
- icon: 5
- });
- }
- if(vm.service.status==1){
- var index = top.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- top.layer.title('服务记录详情', index) //再改变当前层的标题
- }
- })
- },
- getRelationRecord: function(type, planDetaiId){
- // 1.电话短信 2.康复咨询 3.远程监控检测 4.上门服务 5.康复指导 6 康复随访 7.复诊)
- var vm = this
- var url=''
- if(type==5){
- url='doctor/specialist/rehabilitation/selectByRelationCode'
- }else if(type==7){
- url='third/guahao/selectByRelationCode'
- }else if(type==4){
- url="/doctor/specialist/rehabilitation/selectRelationCode"
- }
- var vm = this
- var params = {
- relationCode: vm.recordId?vm.recordId:planDetaiId
- }
- return httpRequest.get(url, {data: params})
- },
- zdly: function(data) {
- var vm = this
- var loginDoctor = JSON.parse(window.localStorage.getItem('wlyyAgent'));
- var otherCode, otherName;
- if(loginDoctor.doctorType == 1) {
- otherCode = data.familyDoctorCode;
- otherName = data.familyDoctorName;
- } else {
- otherCode = data.specialistDoctorCode;
- otherName = data.specialistDoctorName;
- }
- top.layer.open({
- type: 2,
- // offset: ['100px'], //右下角弹出
- area: ['660px', '600px'],
- shade: 0.5,
- title: '指导留言',
- fixed: true, //不固定
- maxmin: true,
- closeBtn: 1,
- shift: 5,
- shadeClose: false, //点击遮罩关闭层
- content: '../../consulting/html/consulting.html?otherCode=' + otherCode + '&otherName=' + encodeURI(otherName) + '&planDetailId=' + vm.planid,
- end: function() { // 未点击确定按钮,点击关闭按钮
-
- vm.getServiceItem();
- }
- });
- },
- deleteImg: function(idx) {
- console.log(idx)
- this.upImgs.splice(idx, 1)
- },
- chakan: function() {
- this.isCollapse = !this.isCollapse;
- },
- upLoadImgToBase64: function() {
- var vm = this;
- var img1 = event.target.files[0];
- var reader = new FileReader();
- var type = img1.type; //文件的类型,判断是否是图片
- var size = img1.size; //文件的大小,判断图片的大小
- if(this.imgData.accept.indexOf(type) == -1) {
- alert('请选择我们支持的图片格式!');
- return false;
- }
- if(size > 3145728) {
- alert('请选择3M以内的图片!');
- return false;
- }
- reader.readAsDataURL(img1);
- reader.onload = function(e) {
- vm.upImgs.push({
- baseUrl: e.target.result
- });
- vm.upImgArr.push(img1);
- console.log('e', e, 'vm.upImgs', vm.upImgs, 'vm.upImgArr', vm.upImgArr)
- //vm.uploadImg(vm.upImgArr);
- }
- },
- qrwc: function(patient,type) {
- var vm = this;
- if(!vm.service.node){
- showErrorMessage('请填写服务记录')
- return
- }
- if(!vm.upImgs.length){
- showErrorMessage('请上传相关记录')
- return
- }
- vm.saveRehabilitationOperateRecord(vm.planid,type);
- },
- saveRehabilitationOperateRecord:function(planDetailId, type, relationCode, flag){
- var vm=this;
- var params={
- rehabilitationDetailId: planDetailId,
- node: null,
- patientCode: vm.patient,
- doctorCode: docInfo.uid,
- relationRecordType: type,
- relationRecordCode: '',
- relationRecordImg: null,
- status: 0
- }
- rehaAPI.saveRehabilitationOperateRecord({dataJson:JSON.stringify(params)}).then(function(res){
- if(res.status==200){
- if(type==1 || type==7){
- vm.uploadImg(vm.upImgArr);
- }else if(type==6){
- vm.updateRelationCodeByDetailId(planDetailId, relationCode)
- } else {
- vm.updateNoteAndImageRehabilitationOperate(planDetailId)
- }
- } else {
- layer.msg(res.msg, {
- icon: 5
- });
- }
- })
-
- },
- //上传图片
- uploadImg: function(data) {
- var vm = this;
- var len = data.length;
- if(len==0) {
- vm.updateNoteAndImageRehabilitationOperate(vm.planid)
- } else {
- var file = data[len - 1];
- var formData = new FormData();
- formData.append('file', file);
- rehaAPI.upload(formData).then(function(res) {
- if(res.status == 200) {
- vm.upImgs[len - 1].img = res.data;
- data.pop();
- vm.$forceUpdate()
- vm.uploadImg(data);
- } else {
- layer.msg(res.msg, {
- icon: 5
- });
- }
- })
- }
- },
- updateNoteAndImageRehabilitationOperate: function(planDetailId, relationCode) {
- var vm = this;
- var _image = [];
- $.each(vm.upImgs, function(index, obj){
- _image.push(obj.img);
- })
- var params = {
- planDetailId: planDetailId,
- node: vm.service&&vm.service.node?vm.service.node:null,
- image:JSON.stringify(_image)||''
- }
- if(relationCode){
- params['relationCode'] = relationCode
- }
- var loadding = top.layer.load(0, {
- shade: false
- }); //0代表加载的风格,支持0-2
- rehaAPI.updateNoteAndImageRehabilitationOperate(params).then(function(res) {
- top.layer.close(loadding);
- if(res.status == 200) {
- vm.getServiceItem();
- top.rehabilitationVue.refresh()
- }
- })
- },
- updateRelationCodeByDetailId: function(planDetailId, relationCode){
- var vm = this
- var params = {
- planDetailId: planDetailId,
- relationCode: relationCode,
- }
- rehaAPI.updateRelationCodeByDetailId(params).then(function(res) {
- if(res.status == 200) {
- vm.getServiceItem();
- top.rehabilitationVue.refresh()
- } else {
- showErrorMessage(res.msg)
- }
- })
- },
- viewDetial:function(type,code){
- var vm=this;
- if(type == 3) {
- top.layer.msg('客户端暂不支持查询健康指导记录');
- } else if(type==4){
- top.layer.msg('客户端暂不支持查询随访记录');
- }else{
- top.layer.open({
- type: 2,
- // offset: ['100px'], //右下角弹出
- area: ['80%', '600px'],
- shade: 0.5,
- title: '指导教育',
- fixed: true, //不固定
- maxmin: true,
- closeBtn: 1,
- shift: 5,
- shadeClose: false, //点击遮罩关闭层
- content: '../../article/html/article-info.html?articleId=' + code,
- end: function() { // 未点击确定按钮,点击关闭按钮
- vm.getServiceItem();
- }
- });
-
- }
- },
- getContent: function(value,type) {
- var res=value;
- if(type==2 || type==9){
- res = "<img src='"+httpRequest.getImgUrl(res)+"'>";
- }else if(type==3){
- res = '【语音】';
- }else if(type==19){
- res = '【聊天记录】';
- }else if(type==12){
- res = '【视频】';
- }
- return res;
- }
- },
- filters: {
- formatDate: function(value, format) {
- if(!value) return;
- var fmt = format || "yyyy-MM-dd hh:mm";
- var date = new Date(value);
- if(/(y+)/.test(fmt)) {
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
- }
- let o = {
- 'M+': date.getMonth() + 1,
- 'd+': date.getDate(),
- 'h+': date.getHours(),
- 'm+': date.getMinutes(),
- 's+': date.getSeconds()
- };
- for(let k in o) {
- if(new RegExp(`(${k})`).test(fmt)) {
- let str = o[k] + '';
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : ('00' + str).substr(str.length));
- }
- }
- return fmt;
- },
- getImgUrl: function(value) {
- var url = httpRequest.getImgUrl(value);
- return url;
- }
- }
- })
- $("body").on('click','img',function(){
- var _this = $(this);//将当前的img元素作为_this传入函数
- imgShow("#outerdiv", "#innerdiv", "#bigimg", _this);
- });
- function imgShow(outerdiv, innerdiv, bigimg, _this){
- var src = _this.attr("src");//获取当前点击的pimg元素中的src属性
- $(bigimg).attr("src", src);//设置#bigimg元素的src属性
- /*获取当前点击图片的真实大小,并显示弹出层及大图*/
- $("<img/>").attr("src", src).load(function(){
- var windowW = $(window).width();//获取当前窗口宽度
- var windowH = $(window).height();//获取当前窗口高度
- var realWidth = this.width;//获取图片真实宽度
- var realHeight = this.height;//获取图片真实高度
- var imgWidth, imgHeight;
- var scale = 0.8;//缩放尺寸,当图片真实宽度和高度大于窗口宽度和高度时进行缩放
-
- if(realHeight>windowH*scale) {//判断图片高度
- imgHeight = windowH*scale;//如大于窗口高度,图片高度进行缩放
- imgWidth = imgHeight/realHeight*realWidth;//等比例缩放宽度
- if(imgWidth>windowW*scale) {//如宽度扔大于窗口宽度
- imgWidth = windowW*scale;//再对宽度进行缩放
- }
- } else if(realWidth>windowW*scale) {//如图片高度合适,判断图片宽度
- imgWidth = windowW*scale;//如大于窗口宽度,图片宽度进行缩放
- imgHeight = imgWidth/realWidth*realHeight;//等比例缩放高度
- } else {//如果图片真实高度和宽度都符合要求,高宽不变
- imgWidth = realWidth;
- imgHeight = realHeight;
- }
- $(bigimg).css("width",imgWidth);//以最终的宽度对图片缩放
-
- var w = (windowW-imgWidth)/2;//计算图片与窗口左边距
- var h = (windowH-imgHeight)/2;//计算图片与窗口上边距
- $(innerdiv).css({"top":h, "left":w});//设置#innerdiv的top和left属性
- $(outerdiv).fadeIn("fast");//淡入显示#outerdiv及.pimg
- });
- $(outerdiv).click(function(){//再次点击淡出消失弹出层
- $(this).fadeOut("fast");
- });
- }
|