Browse Source

解决服务断连期间产生的处方不自动打印问题
解决退药后查不到处方详细药品问题

WANGJIALIANG 4 years ago
parent
commit
d2de189606

+ 107 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/MzPharmacyController.java

@@ -366,6 +366,7 @@ public class MzPharmacyController {
                 resultMap.put("message", "次数不能为空");
                 return resultMap;
             }
+            mzChargeDetail.setReceiptNo(Math.abs(mzChargeDetail.getReceiptNo()));//防止退药处方,需将发票号转为正数
             List<MzSendMedicineVo> cfxxList = mzPharmacyService.getFyclPrescriptionDetail(mzChargeDetail);
             if (cfxxList.size() > 0) {
                 MzVisitTable visit = mzVisitTableService.queryByPatientIdAndTimes(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes());
@@ -642,6 +643,7 @@ public class MzPharmacyController {
                 printMap.put("employeeName", employee.getEmployeeName());//医师
                 printMap.put("employeeCode", employee.getEmployeeCode());//医师编码
             }
+            mzChargeDetailService.setPrintFlag(mzChargeDetail.getPatientId(),mzChargeDetail.getTimes(),mzChargeDetail.getOrderNo());
             printMap.put("totalPrice", totalPrice);
             printMap.put("list", list);
             resultMap.put("code", 0);
@@ -657,6 +659,110 @@ public class MzPharmacyController {
         }
     }
 
+    /**
+     * 查询未打印的处方数据
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getPrintPrescriptionDatas", method = {RequestMethod.POST})
+    public Map<String, Object> getPrintPrescriptionDatas(HttpServletRequest httpServletRequest) throws MzException {
+        Map<String, Object> resultMap = new HashMap<>();
+        User tokenUser = TokenUtil.getUser(httpServletRequest);
+        try {
+            DispensingWindows windows = dispensingWindowsService.queryLastDispensingWindowsByUserIdCode(tokenUser.getUserIdCode(),null);
+            if (windows == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "当前操作人未设置发药基础参数,请先设置!");
+                return resultMap;
+            }
+            List<MzChargeDetail> prescriptions = mzChargeDetailService.queryMzPrescriptionByPrintFlag(0);
+            List<Map> maps = new ArrayList<>();
+            for (int j = 0; j < prescriptions.size(); j++) {
+                MzChargeDetail prescription = prescriptions.get(j);
+                Map<String, Object> printMap = new HashMap<>();
+                MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(prescription.getPatientId());
+                MzVisitTable visit = mzVisitTableService.queryByPatientIdAndTimes(prescription.getPatientId(), prescription.getTimes());
+                printMap.put("patientId", prescription.getPatientId());
+                printMap.put("ybCardNo", mzPatientMi.getYbCardNo());
+                printMap.put("icCardNo", mzPatientMi.getIcCardNo());
+                printMap.put("name", mzPatientMi.getName());
+                printMap.put("sex", mzPatientMi.getSex());
+                printMap.put("age", mzPatientMi.getAge());
+                printMap.put("birthDay", mzPatientMi.getBirthDay());
+                printMap.put("socialNo", mzPatientMi.getSocialNo());
+                printMap.put("phoneNo", mzPatientMi.getPhoneNo());
+                printMap.put("address", mzPatientMi.getAddress());
+                printMap.put("icdText", visit.getIcdText());//诊断
+                prescription.setBillItemCode("TC");
+                List<MzChargeDetail> mzChargeDetails = mzChargeDetailService.getMzChargeDetailList(prescription);
+                if (mzChargeDetails.size() > 0) {
+                    printMap.put("realNo", mzChargeDetails.get(0).getRealNo());//交费流水号
+                }
+                Employee employee = new Employee();
+                BigDecimal totalPrice = new BigDecimal("0");//总价
+                List<Map<String, Object>> list = new ArrayList<>();
+                for (int i = 0; i < mzChargeDetails.size(); i++) {
+                    MzChargeDetail chargeDetail =  mzChargeDetails.get(i);
+                    if(i == 0){
+                        String warnDeptName = zdUnitCodeService.queryDeptNameByIdInCache(chargeDetail.getWarnDept());
+                        printMap.put("warnDeptName", warnDeptName);//科室
+                    }
+                    Map<String, Object> map = new HashMap<>();
+                    totalPrice = totalPrice.add(chargeDetail.getUnitPrice().multiply(BigDecimal.valueOf(chargeDetail.getQuantity())));
+                    map.put("quantity", chargeDetail.getQuantity());//数量
+                    map.put("drugQuan", chargeDetail.getDrugQuan());//一次剂量
+                    map.put("priceTime", chargeDetail.getPriceTime());//划价日期 开处方日期
+                    map.put("frequency", chargeDetail.getFrequency());//频率
+                    map.put("jzFlag", chargeDetail.getJzFlag());//急诊标记
+                    map.put("instructionText", chargeDetail.getInstructionText());//嘱托说明
+                    map.put("tryResult", chargeDetail.getTryResult());//皮试结果
+                    map.put("tryFlag", chargeDetail.getTryFlag());//是否需要皮试
+                    YpZdDict ypZdDict = ypZdDictService.queryYpZdDictByCodeAndSerial(chargeDetail.getChargeItemCode(), chargeDetail.getSerial());
+                    map.put("ybZfFlag",chargeDetail.getYbZfFlag());//皮试自备
+                    map.put("drugName", ypZdDict.getName());//药品名称
+                    map.put("specification", ypZdDict.getSpecification());//规格
+                    map.put("drugFlag", ypZdDict.getDrugFlag());//毒麻标志
+                    map.put("psFlag", ypZdDict.getPsFlag());//是否需要皮试
+                    String manufactoryName = ypZdManufactoryService.queryYpZdManufactoryByCode(ypZdDict.getManuCode());
+                    map.put("manufactoryName", manufactoryName);//生产厂家
+                    String packUnitName = mzPharmacyService.getYpUnitName(ypZdDict.getPackUnit());
+                    if (chargeDetail.getGroupNo().equals("81")) {
+                        map.put("ypUnitName", packUnitName);//单位
+                        map.put("drugUnitName", packUnitName);//一次剂量单位
+                    } else if (chargeDetail.getGroupNo().equals("71")) {
+                        String drugUnitName = mzPharmacyService.getYpUnitName(chargeDetail.getDrugUnit());
+                        map.put("ypUnitName", packUnitName);//单位
+                        map.put("drugUnitName", drugUnitName);//一次剂量单位
+                    }
+                    if(chargeDetail.getSupplyCode() != null){
+                        MzZdSupplyType mzZdSupplyType = mzZdSupplyTypeService.selectMzZdSupplyTypeByCode(chargeDetail.getSupplyCode());
+                        map.put("printName", mzZdSupplyType.getPrintName());//给药方式
+                    }
+                    employee = employeeService.queryByUserCode(chargeDetail.getDoctorCode());
+                    list.add(map);
+                }
+                if (employee.getEmployeeName() != null) {
+                    printMap.put("employeeName", employee.getEmployeeName());//医师
+                    printMap.put("employeeCode", employee.getEmployeeCode());//医师编码
+                }
+                mzChargeDetailService.setPrintFlag(prescription.getPatientId(),prescription.getTimes(),prescription.getOrderNo());
+                printMap.put("totalPrice", totalPrice);
+                printMap.put("list", list);
+                maps.add(printMap);
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "批量打印成功");
+            resultMap.put("data", maps);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("批量打印失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "批量打印失败");
+            return resultMap;
+        }
+    }
+
     /**
      * 获取注射单药品标签打印数据
      *
@@ -710,6 +816,7 @@ public class MzPharmacyController {
                 resultMap.put("message", "当前操作人未设置发药基础参数,请先设置!");
                 return resultMap;
             }
+            mzChargeDetail.setReceiptNo(Math.abs(mzChargeDetail.getReceiptNo()));//防止退药处方,需将发票号转为正数
             List<MzSendMedicineVo> cfxxList = mzPharmacyService.getFyclPrescriptionDetail(mzChargeDetail);
             if (cfxxList.size() > 0) {
                 MzVisitTable visit = mzVisitTableService.queryByPatientIdAndTimes(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes());

+ 19 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzChargeDetailMapper.java

@@ -1064,4 +1064,23 @@ public interface MzChargeDetailMapper {
             "</when>"+
             "</script>"})
     List<MzChargeDetail> selectMzChargeDetailList(MzChargeDetail mzChargeDetail);
+
+    /**
+     * 修改门诊发药打印标记
+     *
+     * @param patientId
+     * @param times
+     * @return
+     */
+    @Update("update mz_charge_detail set print_flag =1 where patient_id = #{patientId} and times = #{times} and order_no = #{orderNo}")
+    int setPrintFlag(@Param("patientId") String patientId, @Param("times") Integer times, @Param("orderNo") Integer orderNo);
+
+    /**
+     * 根据打印标记查询当天处方信息
+     *
+     * @param printFlag
+     * @return
+     */
+    @Select("select patient_id,times,order_no,group_no from mz_charge_detail where print_flag=#{printFlag} and group_no = '71' and datediff(day, charge_date,getdate())=0 group by patient_id, times, order_no,group_no ")
+    List<MzChargeDetail> selectMzPrescriptionByPrintFlag(@Param("printFlag") Integer printFlag);
 }

+ 2 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzPharmacyMapper.java

@@ -494,7 +494,7 @@ public interface MzPharmacyMapper {
             "a.win_no,",
             "confirm_flag",
             " FROM yp_mz_fytj a",
-            " WHERE   1=1     ",
+            " WHERE   1=1  and real_no > 0  ",
             "<when test='name!=null'>",
             " and a.name like '%${name}%'",
             "</when>",
@@ -550,7 +550,7 @@ public interface MzPharmacyMapper {
             "a.win_no,",
             "confirm_flag",
             " FROM yp_mz_fytj a",
-            " WHERE   1=1     ",
+            " WHERE   1=1   and real_no > 0   ",
             "<when test='name!=null'>",
             " and a.name like '%${name}%'",
             "</when>",

+ 17 - 0
src/main/java/cn/hnthyy/thmz/service/his/mz/MzChargeDetailService.java

@@ -344,4 +344,21 @@ public interface MzChargeDetailService {
      * @return
      */
     MzPrescriptionVo getMzPrescriptionVo(String patientId,Integer times,Boolean MzBlRecordFlag,String payMark) throws MzException;
+
+    /**
+     * 修改门诊发药打印标记
+     *
+     * @param patientId
+     * @param times
+     * @return
+     */
+    int setPrintFlag(String patientId, Integer times, Integer orderNo);
+
+    /**
+     * 根据打印标记查询当天处方信息
+     *
+     * @param printFlag
+     * @return
+     */
+    List<MzChargeDetail> queryMzPrescriptionByPrintFlag(Integer printFlag);
 }

+ 10 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -1448,6 +1448,16 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         return mzPrescriptionVo;
     }
 
+    @Override
+    public int setPrintFlag(String patientId, Integer times, Integer orderNo) {
+        return mzChargeDetailMapper.setPrintFlag(patientId, times, orderNo);
+    }
+
+    @Override
+    public List<MzChargeDetail> queryMzPrescriptionByPrintFlag(Integer printFlag) {
+        return mzChargeDetailMapper.selectMzPrescriptionByPrintFlag(printFlag);
+    }
+
 //    @Override
 //    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
 //    public int reSaveDetailFromBak(MzChargeDetail mzChargeDetail) {

+ 3 - 0
src/main/resources/static/js/common/socket-com.js

@@ -22,6 +22,9 @@ function openSocket(type) {
 //连接成功建立的回调方法
     prescriptionPrintWebsocket.onopen = function (event) {
         console.log(type+"连接prescriptionPrintSocket连接成功");
+        if(type == 'PY' && $("#aotuPrint").is(':checked')){//配药处方自动打印
+            printPrescriptions();
+        }
     };
 
 //接收到消息的回调方法

+ 151 - 105
src/main/resources/static/js/mz/west_pharmacy_dispensing.js

@@ -26,6 +26,13 @@ $(function () {
     $('#btn_clean').click(function () {
         cleanParams();
     });
+    //自动打印点击事件
+    $('#aotuPrint').click(function () {
+        //选中
+        if($("#aotuPrint").is(':checked')){
+            printPrescriptions();
+        }
+    });
 });
 
 
@@ -422,111 +429,39 @@ function printPrescription(patientId, times, orderNo) {
             }
             if (res.code == 0) {
                 setPrint();//初始化默认打印机
-                $('#print_view input').attr("value", "");
-                var age=0;
-                if (null != res.data) {
-                    for (var key in res.data) {
-                        $("#" + key + "").attr("value", res.data[key]);
-                    }
-                    age = getBirthSlot(res.data['birthDay'],res.data.list[0].priceTime);
-                    if(age.substring(0,age.indexOf('岁')) < 7){
-                        $("#age").attr("value", age);
-                    }else{
-                        $("#age").attr("value", age.substring(0,age.indexOf('岁')+1));
-                    }
-                }
-                var list = res.data.list;
-                if (age.substring(0,age.indexOf('岁')) < 18) {
-                    $('#drugFlag').attr("value", "儿科");
-                    printIndex = ekCfPrintIndex;
-                } else if (res.data.warnDeptName.indexOf("急诊") != -1) {
-                    $('#drugFlag').attr("value", "急诊");
-                    printIndex = jzCfPrintIndex;
-                } else{
-                    $('#drugFlag').attr("value", "普通");
-                    printIndex = mzCfPrintIndex;
-                }
-                if (list[0].drugFlag == 2 || list[0].drugFlag == 3) {
-                    $('#drugFlag').attr("value", "麻、精一");
-                } else if (list[0].drugFlag == 4) {
-                    $('#drugFlag').attr("value", "精二");
-                }
-                $('#priceTime').attr("value", format(list[0].priceTime, "yyyy-MM-dd HH:mm"));
-                $('#employeeName').attr("value", res.data.employeeName + "/" + res.data.employeeCode);
-                if (res.data.sex == 1) {
-                    $('#sex').attr("value", '男');
-                } else if (res.data.sex == 2) {
-                    $('#sex').attr("value", '女');
-                } else {
-                    $('#sex').attr("value", '未知');
-                }
-                if(res.data.ybCardNo == null || res.data.ybCardNo == ''){
-                    $('#ybCardNo').attr("value", res.data.icCardNo);
-                }
-                var tr = '';
-                for (let i = 0; i < list.length; i++) {
-                    let printName = list[i].printName==null?"":list[i].printName;
-                    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>';
+                printView(res.data);
+                successMesage(res);
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+}
+
+/**
+ * 批量打印处方
+ */
+function printPrescriptions() {
+    $.ajax({
+        type: "POST",
+        url: '/thmz/getPrintPrescriptionDatas',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                setPrint();//初始化默认打印机
+                for (let i = 0; i < res.data.length; i++) {
+                    let data = res.data[i];
+                    printView(data);
+                    if((i+1) == res.data.length){
+                        successMesage(res);
                     }
-                    var number = i + 1;
-                    let manufactoryName = list[i].manufactoryName == null || list[i].manufactoryName == '' ? '' : '(' + list[i].manufactoryName + ')';
-                    tr += '<tr>\n' +
-                        '                                <td style="margin-bottom: 5px;width: 10px;font-size: 14px;" align="left" valign="top">' + number + "." +
-                        '</td>\n' +
-                        '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 260px;font-size: 14px;">\n' + tryResult + list[i].drugName +
-                        '                                </td>\n' +
-                        '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 120px;text-align: right;font-size: 14px;">' + list[i].specification +
-                        '</td>\n' +
-                        '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 15px;text-align: left;font-size: 14px;">×</td>\n' +
-                        '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 15px;text-align: left;font-size: 14px;">' + list[i].quantity +
-                        '</td>\n' +
-                        '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 25px;text-align: left;font-size: 14px;">' + list[i].ypUnitName +
-                        '</td>\n' +
-                        '                            </tr>\n' +
-                        '                            <tr>\n' +
-                        '                                <td style="margin-bottom: 5px;width: 10px;font-size: 14px;" align="left" valign="top">' +
-                        '</td>\n' +
-                        '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 260px;font-size: 14px;">\n' + manufactoryName + tryFlag +
-                        '                                </td>\n' +
-                        '                                <td colspan="4" style="padding-left:0px;margin-bottom: 5px;vertical-align: middle !important;text-align: left;font-size: 14px;">用法:' + list[i].drugQuan+"&nbsp;" + list[i].drugUnitName + '/次&nbsp;&nbsp;' + list[i].frequency + '&nbsp;&nbsp;' + printName +
-                        '</td>\n' +
-                        '                            </tr>'+
-                        '                            <tr>\n' +
-                        '                                <td style="margin-bottom: 5px;width: 10px;font-size: 14px;" align="left" valign="top">' +
-                        '</td>\n' +
-                        '                                <td colspan="5" style="margin-bottom: 5px;vertical-align: middle !important;width: 260px;font-size: 14px;">\n' + (list[i].instructionText==null?'':list[i].instructionText) +
-                        '                                </td>\n' +
-                        '                            </tr><tr><td>&nbsp;</td></tr>';
-                }
-                $('#tbody_yp').html(tr);
-                $('#yxwk').remove();
-                if (list.length < 5) {
-                    $('#div_yp').append('<span id="yxwk" style="margin-bottom: 5px;font-size: 14px;">以下为空</span>');
                 }
-                LODOP = getLodop();
-                LODOP.PRINT_INITA(6, 0, "140mm", "202mm", "泰和医院处方笺");
-                LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
-                //设置默认打印机
-                LODOP.SET_PRINTER_INDEX(printIndex);
-                LODOP.SET_PRINT_PAGESIZE(1, '140mm', '202mm', "CreateCustomPage");
-                LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "140mm");
-                LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "202mm");
-                LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
-                LODOP.ADD_PRINT_HTM("5mm", "7mm", "140mm", "202mm",  $("div[id='print_view']").html());
-                LODOP.PRINT();
-                LODOP.NewPage();//下一页
-                //LODOP.PREVIEW();
-                successMesage(res);
             } else {
                 errorMesage(res);
             }
@@ -534,6 +469,117 @@ function printPrescription(patientId, times, orderNo) {
     });
 }
 
+/**
+ * 打印界面生成
+ * @param data
+ */
+function printView(data) {
+    $('#print_view input').attr("value", "");
+    var age=0;
+    if (null != data) {
+        for (var key in data) {
+            $("#" + key + "").attr("value", data[key]);
+        }
+        age = getBirthSlot(data['birthDay'],data.list[0].priceTime);
+        if(age.substring(0,age.indexOf('岁')) < 7){
+            $("#age").attr("value", age);
+        }else{
+            $("#age").attr("value", age.substring(0,age.indexOf('岁')+1));
+        }
+    }
+    var list = data.list;
+    if (age.substring(0,age.indexOf('岁')) < 18) {
+        $('#drugFlag').attr("value", "儿科");
+        printIndex = ekCfPrintIndex;
+    } else if (data.warnDeptName.indexOf("急诊") != -1) {
+        $('#drugFlag').attr("value", "急诊");
+        printIndex = jzCfPrintIndex;
+    } else{
+        $('#drugFlag').attr("value", "普通");
+        printIndex = mzCfPrintIndex;
+    }
+    if (list[0].drugFlag == 2 || list[0].drugFlag == 3) {
+        $('#drugFlag').attr("value", "麻、精一");
+    } else if (list[0].drugFlag == 4) {
+        $('#drugFlag').attr("value", "精二");
+    }
+    $('#priceTime').attr("value", format(list[0].priceTime, "yyyy-MM-dd HH:mm"));
+    $('#employeeName').attr("value", data.employeeName + "/" + data.employeeCode);
+    if (data.sex == 1) {
+        $('#sex').attr("value", '男');
+    } else if (data.sex == 2) {
+        $('#sex').attr("value", '女');
+    } else {
+        $('#sex').attr("value", '未知');
+    }
+    if(data.ybCardNo == null || data.ybCardNo == ''){
+        $('#ybCardNo').attr("value", data.icCardNo);
+    }
+    var tr = '';
+    for (let i = 0; i < list.length; i++) {
+        let printName = list[i].printName==null?"":list[i].printName;
+        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>';
+        }
+        var number = i + 1;
+        let manufactoryName = list[i].manufactoryName == null || list[i].manufactoryName == '' ? '' : '(' + list[i].manufactoryName + ')';
+        tr += '<tr>\n' +
+            '                                <td style="margin-bottom: 5px;width: 10px;font-size: 14px;" align="left" valign="top">' + number + "." +
+            '</td>\n' +
+            '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 260px;font-size: 14px;">\n' + tryResult + list[i].drugName +
+            '                                </td>\n' +
+            '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 120px;text-align: right;font-size: 14px;">' + list[i].specification +
+            '</td>\n' +
+            '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 15px;text-align: left;font-size: 14px;">×</td>\n' +
+            '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 15px;text-align: left;font-size: 14px;">' + list[i].quantity +
+            '</td>\n' +
+            '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 25px;text-align: left;font-size: 14px;">' + list[i].ypUnitName +
+            '</td>\n' +
+            '                            </tr>\n' +
+            '                            <tr>\n' +
+            '                                <td style="margin-bottom: 5px;width: 10px;font-size: 14px;" align="left" valign="top">' +
+            '</td>\n' +
+            '                                <td style="margin-bottom: 5px;vertical-align: middle !important;width: 260px;font-size: 14px;">\n' + manufactoryName + tryFlag +
+            '                                </td>\n' +
+            '                                <td colspan="4" style="padding-left:0px;margin-bottom: 5px;vertical-align: middle !important;text-align: left;font-size: 14px;">用法:' + list[i].drugQuan+"&nbsp;" + list[i].drugUnitName + '/次&nbsp;&nbsp;' + list[i].frequency + '&nbsp;&nbsp;' + printName +
+            '</td>\n' +
+            '                            </tr>'+
+            '                            <tr>\n' +
+            '                                <td style="margin-bottom: 5px;width: 10px;font-size: 14px;" align="left" valign="top">' +
+            '</td>\n' +
+            '                                <td colspan="5" style="margin-bottom: 5px;vertical-align: middle !important;width: 260px;font-size: 14px;">\n' + (list[i].instructionText==null?'':list[i].instructionText) +
+            '                                </td>\n' +
+            '                            </tr><tr><td>&nbsp;</td></tr>';
+    }
+    $('#tbody_yp').html(tr);
+    $('#yxwk').remove();
+    if (list.length < 5) {
+        $('#div_yp').append('<span id="yxwk" style="margin-bottom: 5px;font-size: 14px;">以下为空</span>');
+    }
+    LODOP = getLodop();
+    LODOP.PRINT_INITA(6, 0, "140mm", "202mm", "泰和医院处方笺");
+    LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
+    //设置默认打印机
+    LODOP.SET_PRINTER_INDEX(printIndex);
+    LODOP.SET_PRINT_PAGESIZE(1, '140mm', '202mm', "CreateCustomPage");
+    LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "140mm");
+    LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "202mm");
+    LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
+    LODOP.ADD_PRINT_HTM("5mm", "7mm", "140mm", "202mm",  $("div[id='print_view']").html());
+    LODOP.PRINT();
+    LODOP.NewPage();//下一页
+    //LODOP.PREVIEW();
+}
+
 /**
  * 获取时间选择器的时间数组
  * @returns {string[]}
@@ -541,8 +587,8 @@ function printPrescription(patientId, times, orderNo) {
 function getRePortRangeArr() {
     var rePortRange = $('#reportrange span').html();
     var rePortRangeArr = rePortRange.split(" - ");
-    rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
-    rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
+    rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00";
+    rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59";
     return rePortRangeArr;
 }