var d = dialog({ contentType: 'load', skin: 'bk-popup' }); var request = GetRequest(); var code = request.code; //从链接中获得处方code var prescriptionCode = ""; //续方的code var patient, patientName; $(function(){ getDetail(); bindEvents(); }) function getDetail(){ d.show(); var url = "/patient/prescriptionInfo/getPrescription", params = {code: code}; sendPost(url, params, 'json', 'GET', queryFailed, function(res){ if(res.status == 200){ d.close(); prescriptionCode = res.data.prescriptionCode; patient = res.data.patient; patientName = res.data.patientName; //判断是否可以续方 var reuse = getXFStatus(res.data.prescriptionDt, res.data.createTime); //可续方 //reviewedState: 0 为审核中 1.已经处理完成/未申请 if(reuse){ if(res.data.reviewedState == 1){ $("#btn-div").find("a").text("申请续方"); $("#btn-div").find("a").attr("data-status", 1); }else{ $("#btn-div").find("a").text("续方申请中"); $("#btn-div").find("a").attr("data-status", 0); } $("#btn-div").show(); $("#reuseStatus").text('可续方'); }else{ $("#btn-div").hide(); $("#reuseStatus").text('不可续方'); } //填充基本信息和临床诊断信息 $("#dateTime").text(res.data.createTime); $("#docName").text(res.data.doctorName); $("#deptName").text(res.data.hospitalName); var diseaseName = ""; for(i=0; i now){ //6个月内的时间 statusName = '续方'; canXF = true; // } } } return canXF; } function bindEvents(){ $(".c-btn").on('click', function(){ var status = $(this).attr("data-status"); //状态为可申请时,跳转去新增续方咨询页面,其他状态跳转去续方记录页面 //0 为审核中 1.已经处理完成/未申请 var userInfo = JSON.parse(window.localStorage.getItem(agentName1)); if(status == 1){ //跳转去新增续方咨询页面 window.location.href = "../../yszx/html/add-prescription-consult.html?patient="+userInfo.uid+"&name="+userInfo.name+"&jw_code="+code; }else{ //跳转去续方记录页面 window.location.href = "re-prescription_info.html?code="+prescriptionCode+"&toUser="+userInfo.uid; } }); } function queryFailed(res){ d.close(); if(res && res.msg) { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: res.msg }).show(); } else { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: '加载失败' }).show(); } }