|  | @@ -4,6 +4,7 @@ var printIndex;
 | 
	
		
			
				|  |  |  var mzCfPrintIndex = window.localStorage["mzCfPrintIndex"];
 | 
	
		
			
				|  |  |  var ekCfPrintIndex = window.localStorage["ekCfPrintIndex"];
 | 
	
		
			
				|  |  |  var jzCfPrintIndex = window.localStorage["jzCfPrintIndex"];
 | 
	
		
			
				|  |  | +var mzydPrintIndex = window.localStorage["mzydPrintIndex"];
 | 
	
		
			
				|  |  |  var groupNo = window.localStorage["groupNo"];
 | 
	
		
			
				|  |  |  var windowsNoYf = window.localStorage["winNo"];
 | 
	
		
			
				|  |  |  $(function () {
 | 
	
	
		
			
				|  | @@ -31,13 +32,27 @@ $(function () {
 | 
	
		
			
				|  |  |      $('#btn_clean').click(function () {
 | 
	
		
			
				|  |  |          cleanParams();
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | -    //自动打印点击事件
 | 
	
		
			
				|  |  | -    $('#aotuPrint').click(function () {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    $('input:checkbox').each(function () {
 | 
	
		
			
				|  |  | +       $(this).click(function () {
 | 
	
		
			
				|  |  | +           if($(this).prop('checked')){
 | 
	
		
			
				|  |  | +                $(':checkbox[name=aotoPrint]').removeAttr('checked');
 | 
	
		
			
				|  |  | +                $(this).prop('checked',true);
 | 
	
		
			
				|  |  | +               var chk_value ='';
 | 
	
		
			
				|  |  | +               $('input[name="aotoPrint"]:checked').each(function(){
 | 
	
		
			
				|  |  | +                   chk_value = $(this).val();
 | 
	
		
			
				|  |  | +               });
 | 
	
		
			
				|  |  | +               printPrescriptions(chk_value);
 | 
	
		
			
				|  |  | +           }
 | 
	
		
			
				|  |  | +       })
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    /*//自动打印点击事件
 | 
	
		
			
				|  |  | +    $('#aotoPrint').click(function () {
 | 
	
		
			
				|  |  |          //选中
 | 
	
		
			
				|  |  | -        if($("#aotuPrint").is(':checked')){
 | 
	
		
			
				|  |  | +        if($("#aotoPrint").is(':checked')){
 | 
	
		
			
				|  |  |              printPrescriptions();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -    });
 | 
	
		
			
				|  |  | +    });*/
 | 
	
		
			
				|  |  |  });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -101,10 +116,8 @@ function initTable() {
 | 
	
		
			
				|  |  |                  align: "center",
 | 
	
		
			
				|  |  |                  valign: 'middle',
 | 
	
		
			
				|  |  |                  formatter: function (value, row, index) {
 | 
	
		
			
				|  |  | -                    var str = '<button type="button" class="registration-no-color-foot-button" title="打印" onclick="printPrescription(\'' + row.patientId + '\',\'' + row.times+ '\',\'' + row.orderNo + '\')"  style="color: #35D082;"><i class="fa fa-print"></i></button>';
 | 
	
		
			
				|  |  | -                    /*if(row.isRadSend == 0 && row.confirmFlag !=5 && row.confirmFlag !=1){
 | 
	
		
			
				|  |  | -                        str += '<button type="button" class="registration-no-color-foot-button" title="配药完成" onclick="dispensingDispose(\'' + row.patientId + '\',\'' + row.orderNo + '\',\'' + row.times + '\')"><i class="fa fa-check-square-o"></i></button>';
 | 
	
		
			
				|  |  | -                    }*/
 | 
	
		
			
				|  |  | +                    var str = '<button type="button" class="registration-no-color-foot-button" title="打印处方" onclick="printPrescription(\'' + row.patientId + '\',\'' + row.times+ '\',\'' + row.orderNo + '\')"  style="color: #35D082;"><i class="fa fa-print"></i></button>';
 | 
	
		
			
				|  |  | +                    str += '<button type="button" class="registration-no-color-foot-button" title="打印药单" onclick="printDrugList(\'' + row.patientId + '\',\'' + row.times+ '\',\'' + row.orderNo + '\')"  style="color: black;"><i class="fa fa-print"></i></button>';
 | 
	
		
			
				|  |  |                      str += '<button type="button" class="registration-no-color-foot-button" title="详细" onclick="prescriptionDetail(\'' + row.realNo + '\',\'' + row.orderNo + '\',\'' + row.receiptNo + '\',\'' + row.times + '\',\'' + row.patientId + '\')"><i class="fa fa-plus"></i></button>';
 | 
	
		
			
				|  |  |                      return str;
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -447,10 +460,46 @@ function printPrescription(patientId, times, orderNo) {
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * 打印药单
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +function printDrugList(patientId, times, orderNo) {
 | 
	
		
			
				|  |  | +    if(mzydPrintIndex == null){
 | 
	
		
			
				|  |  | +        return errorMesageSimaple('打印机参数未设置,请在发药参数设置中设置');
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    var tem = {
 | 
	
		
			
				|  |  | +        patientId: patientId,
 | 
	
		
			
				|  |  | +        times: times,
 | 
	
		
			
				|  |  | +        orderNo: orderNo,
 | 
	
		
			
				|  |  | +        groupNo: groupNo
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +    $.ajax({
 | 
	
		
			
				|  |  | +        type: "POST",
 | 
	
		
			
				|  |  | +        url: '/thmz/getPrintPrescriptionData',
 | 
	
		
			
				|  |  | +        contentType: "application/json;charset=UTF-8",
 | 
	
		
			
				|  |  | +        dataType: "json",
 | 
	
		
			
				|  |  | +        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
 | 
	
		
			
				|  |  | +        data: JSON.stringify(tem),
 | 
	
		
			
				|  |  | +        success: function (res) {
 | 
	
		
			
				|  |  | +            if (res == '401' || res == 401) {
 | 
	
		
			
				|  |  | +                window.location.href = '/thmz/login/view'
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (res.code == 0) {
 | 
	
		
			
				|  |  | +                console.log(res.data);
 | 
	
		
			
				|  |  | +                printDrugListView(res.data);
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                errorMesage(res);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 批量打印处方
 | 
	
		
			
				|  |  | + * @param chkValue 1:处方打印 2:药单打印
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  | -function printPrescriptions() {
 | 
	
		
			
				|  |  | +function printPrescriptions(chkValue) {
 | 
	
		
			
				|  |  |      if(mzCfPrintIndex == null || ekCfPrintIndex == null || jzCfPrintIndex == null){
 | 
	
		
			
				|  |  |          return errorMesageSimaple('打印机参数未设置,请在发药参数设置中设置');
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -466,10 +515,13 @@ function printPrescriptions() {
 | 
	
		
			
				|  |  |                  return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              if (res.code == 0) {
 | 
	
		
			
				|  |  | -                //setPrint();//初始化默认打印机
 | 
	
		
			
				|  |  |                  for (let i = 0; i < res.data.length; i++) {
 | 
	
		
			
				|  |  |                      let data = res.data[i];
 | 
	
		
			
				|  |  | -                    printView(data);
 | 
	
		
			
				|  |  | +                    if(chkValue == 1){
 | 
	
		
			
				|  |  | +                        printView(data);
 | 
	
		
			
				|  |  | +                    }else if(chkValue == 2){
 | 
	
		
			
				|  |  | +                        printDrugListView(data);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                      if((i+1) == res.data.length){
 | 
	
		
			
				|  |  |                          successMesage(res);
 | 
	
		
			
				|  |  |                      }
 | 
	
	
		
			
				|  | @@ -482,7 +534,7 @@ function printPrescriptions() {
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  | - * 打印界面生成
 | 
	
		
			
				|  |  | + * 处方打印界面生成
 | 
	
		
			
				|  |  |   * @param data
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  function printView(data) {
 | 
	
	
		
			
				|  | @@ -588,6 +640,72 @@ function printView(data) {
 | 
	
		
			
				|  |  |      //LODOP.PREVIEW();
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * 药单打印界面生成
 | 
	
		
			
				|  |  | + * @param data
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +function printDrugListView(data) {
 | 
	
		
			
				|  |  | +    var age=0;
 | 
	
		
			
				|  |  | +    if (null != data) {
 | 
	
		
			
				|  |  | +        $(".name").html(data["name"]);
 | 
	
		
			
				|  |  | +        if (data.sex == 1) {
 | 
	
		
			
				|  |  | +            $('.sex').html('男');
 | 
	
		
			
				|  |  | +        } else if (data.sex == 2) {
 | 
	
		
			
				|  |  | +            $('.sex').html('女');
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            $('.sex').html('未知');
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        age = getBirthSlot(data['birthDay'],data.list[0].priceTime);
 | 
	
		
			
				|  |  | +        $(".age").html(age);
 | 
	
		
			
				|  |  | +        $(".printDate").html(format(new Date(), "yyyy-MM-dd HH:mm"));
 | 
	
		
			
				|  |  | +        $(".warnDeptName").html(data["warnDeptName"]);
 | 
	
		
			
				|  |  | +        $(".icdText").html(data["icdText"]);
 | 
	
		
			
				|  |  | +        $(".employeeName").html(data["employeeName"]);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    $('.sjh').remove();
 | 
	
		
			
				|  |  | +    var html = '';
 | 
	
		
			
				|  |  | +    var list = data.list;
 | 
	
		
			
				|  |  | +    for (let i = 0; i < list.length; i++) {
 | 
	
		
			
				|  |  | +        let tryResult = '';
 | 
	
		
			
				|  |  | +        let tryFlag = '';
 | 
	
		
			
				|  |  | +        if(list[i].tryResult == 0){
 | 
	
		
			
				|  |  | +            tryResult = '(—)';
 | 
	
		
			
				|  |  | +        }else if(list[i].psFlag == 1 && list[i].tryFlag == 0){//药品需要皮试,处方未点需要皮试
 | 
	
		
			
				|  |  | +            tryResult = '<span style="color: red">(免试)</span>';
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(list[i].ybZfFlag == 1){
 | 
	
		
			
				|  |  | +            tryFlag = '<span style="color: red">(皮试自备一支)</span>';
 | 
	
		
			
				|  |  | +        }else if(list[i].tryFlag == 1){
 | 
	
		
			
				|  |  | +            tryFlag = '<span style="color: red">(需皮试)</span>';
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        let manufactoryName = list[i].manufactoryName == null || list[i].manufactoryName == '' ? '' : '(' + list[i].manufactoryName + ')';
 | 
	
		
			
				|  |  | +        html += '<tr class="sjh">';
 | 
	
		
			
				|  |  | +        html += '<td class="xtd" style="text-align: center;">' + list[i].location + '</td>';
 | 
	
		
			
				|  |  | +        html += '<td class="xtd" style="text-align: left;">' + tryFlag+list[i].drugName + '</td>';
 | 
	
		
			
				|  |  | +        html += '<td class="xtd" style="text-align: left;">' + list[i].specification + '</td>';
 | 
	
		
			
				|  |  | +        html += '<td class="xtd" style="text-align: center;">' + list[i].quantity + '</td>';
 | 
	
		
			
				|  |  | +        html += '<td class="xtd" style="text-align: left;">' + manufactoryName + '</td>';
 | 
	
		
			
				|  |  | +        html += '<td class="xtd" style="text-align: center;">' + list[i].printName + '</td>';
 | 
	
		
			
				|  |  | +        html += '<td class="xtd" style="text-align: center;">' + parseFloat(list[i].stockAmount) + '</td>';
 | 
	
		
			
				|  |  | +        html += '</tr>';
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    $('#yddy_table').append(html);
 | 
	
		
			
				|  |  | +    LODOP = getLodop();
 | 
	
		
			
				|  |  | +    LODOP.PRINT_INITA(6, 0, "241mm", "93mm", "门诊患者西药药单");
 | 
	
		
			
				|  |  | +    LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
 | 
	
		
			
				|  |  | +    //设置默认打印机
 | 
	
		
			
				|  |  | +    LODOP.SET_PRINTER_INDEX(mzydPrintIndex);
 | 
	
		
			
				|  |  | +    LODOP.SET_PRINT_PAGESIZE(1, '241mm', '93mm', "CreateCustomPage");
 | 
	
		
			
				|  |  | +    LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "241mm");
 | 
	
		
			
				|  |  | +    LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "93mm");
 | 
	
		
			
				|  |  | +    LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊患者西药药单");//对新建的纸张重命名
 | 
	
		
			
				|  |  | +    var strStyle="<style>table,td,th {border-width: 1px;" +
 | 
	
		
			
				|  |  | +        "border-style: solid;border-collapse: collapse;table-layout:fixed;word-wrap:break-word;font-size: 11}.xtd{border: 1px solid black;}</style>";
 | 
	
		
			
				|  |  | +    LODOP.ADD_PRINT_HTM("5mm", "7mm", "241mm", "93mm", strStyle + $("div[id='print_view_list']").html());
 | 
	
		
			
				|  |  | +    LODOP.PRINT();
 | 
	
		
			
				|  |  | +    //LODOP.PRINT_DESIGN();
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 获取时间选择器的时间数组
 | 
	
		
			
				|  |  |   * @returns {string[]}
 |