123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- 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<res.data.prescriptionDt.length; i++){
- var ds = res.data.prescriptionDt[i];
- diseaseName += ds.healthProblemName+ ' ';
- }
- $("#deseaseDetail").text(diseaseName);
-
- //药品列表
- var rpList = res.data.prescriptionInfo;
- var html = template('rp_tmp', {list: rpList});
- $("#rpList").empty().append(html);
- }else{
- queryFailed(res);
- }
- });
- }
- //判断是否可以续方
- function getXFStatus(arr, date){
- var isXFDesease = true,
- statusName = '',
- canXF = false;
- if(arr){
- for(i=0; i<arr.length; i++){
- var item = arr[i];
- //HP0093 - 高血压 , HP0047 - 糖尿病
- if((item.healthProblem != 'HP0093') && (item.healthProblem != 'HP0047')){
- isXFDesease = false;
- break;
- }
- }
- if(isXFDesease){
- //判断时间是否是在6个月内的
- // var d = new Date(date),
- // now = new Date();
- // now.setMonth(now.getMonth() - 2);
-
- // if(d > 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();
- }
- }
|