if(!Promise){
  var Promise = require("bluebird");
// Configure
  Promise.config({
    longStackTraces: true,
    warnings: true // note, run node with --trace-warnings to see full stack traces for warnings
  })
}
require('./../css/reset.css');
require('./../css/cdssPlan.less');
require('./../css/popup.css');
require('./../css/followUpV.less');
require('../css/staticSearch.less')
require('./../js/staticSearch.js')      //静态知识搜索
require('./../images/empty.png').replace(/^undefined/g, '')
require('./../images/empty2.png').replace(/^undefined/g, '')
require('./../images/empty3.png').replace(/^undefined/g, '')
require('./../images/loading.gif').replace(/^undefined/g, '')
require('./../images/right.png').replace(/^undefined/g, '')
require('./../images/new.png').replace(/^undefined/g, '')

const $ = require("jquery");
const { post,config,getUrlArgObject,openNewWin,titleConfig } = require('./promise.js');
const { renderFollowUp } = require('./followUp.js');


//静态知识类型： 1：诊断 2.药品 3.化验套餐 4.化验明细 5.辅检 6.手术和操作

let mrId = getUrlArgObject('mrId') 
let msg;

function getMRInfo() {
   return post(config.getMr2,{mrId:mrId})
}
// $('.loading').css("display","block")
$('.empty').css("display","none")
if(mrId){
  getMRInfo().then(res =>{
    if(res.data.code == '0'){
        msg = res.data.data ||{}
        window.msg = msg
        renderFollowUp(msg)
    }
  }).catch(function (err) {
      console.log(err);
  })
} else{

}


let disName=""
function handleShow(){
  const newinConf = {
    width: '600',   //窗口的文档显示区的宽度。以像素计。
    height: '826',  //窗口文档显示区的高度。以像素计。
    left: '0',  //窗口的 x 坐标。以像素计。
    top: '0',    //窗口的 y 坐标。以像素计。
    openMode: "_blank"  //每次都是新窗口打开为_blank,打开同一窗口填写任意字符串
  }
  const newWindowLocation = `width=${newinConf.width}, height=${newinConf.height}, left=${newinConf.left}, top=${newinConf.top} scrollbars=yes`
  window.open('./emergency.html?disName='+disName, newinConf.openMode, newWindowLocation)
}
$(document).on('click',".allDis .allName",function(){
  handleShow()
})
$(document).on('click',".singleDis",function(){
  $(this).next().css("display","block")
  $(this).css("display","none")
})
$(document).on('click',".allDis .right,.allDis .secDis",function(){
  $(".allDis").css("display","none")
  $(".singleDis").css("display","block")
})



function adjustHei(){
  const iframeHei = $(".bodyWrap").height()
  const tabHei = $(".tabList").height()
  $(".contentWrapper").css("height",iframeHei-tabHei-20-30+3+19+'px')
}



$(function(){
  $.fn.extend({  
    "preventScroll":function(){  
        $(this).each(function(){  
            var _this = this;  
            if(navigator.userAgent.indexOf('Firefox') >= 0){   //firefox  
                _this.addEventListener('DOMMouseScroll',function(e){  
                    _this.scrollTop += e.detail > 0 ? 60 : -60;     
                    e.preventDefault();  
                },false);   
            }else{  
                _this.onmousewheel = function(e){   
                    e = e || window.event;    
                    _this.scrollTop += e.wheelDelta > 0 ? -60 : 60;     
                    return false;  
                };  
            }  
        })    
    }  
  });  
  // $(".iframeWrap").preventScroll();  
  /*$(".iframeWrap").preventScroll();
  $(".recommendWrap").preventScroll();  
  $(".infoWrap").preventScroll();  
  $(".medicalKonwledgeWrap .staticSearchB ul").preventScroll(); */
    /*$(window).on("resize", function(){
    /*$(".iframeWrap").preventScroll();
      $(".recommendWrap").preventScroll();

      $(".medicalKonwledgeWrap .staticSearchB ul").preventScroll();
      adjustHei()
    })*/
});
