瀏覽代碼

socket ip调整,配药添加药单和处方自动打印切换

WANGJIALIANG 3 年之前
父節點
當前提交
f550990ab1

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

@@ -5,6 +5,7 @@ import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.mz.*;
+import cn.hnthyy.thmz.entity.his.yp.YpBaseYf;
 import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
 import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode;
 import cn.hnthyy.thmz.entity.thmz.DispensingWindows;
@@ -12,6 +13,7 @@ import cn.hnthyy.thmz.entity.thmz.RadSendRecord;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.ConfirmFlagEnum;
 import cn.hnthyy.thmz.service.his.mz.*;
+import cn.hnthyy.thmz.service.his.yp.YpBaseYfService;
 import cn.hnthyy.thmz.service.his.yp.YpZdDictService;
 import cn.hnthyy.thmz.service.his.yp.YpZdManufactoryService;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
@@ -58,6 +60,8 @@ public class MzPharmacyController {
     private DispensingSocketService dispensingSocketService;
     @Autowired
     private DispensingWindowsService dispensingWindowsService;
+    @Autowired
+    private YpBaseYfService ypBaseYfService;
     /**
      * 查询处方信息
      *
@@ -622,6 +626,9 @@ public class MzPharmacyController {
                 map.put("specification", ypZdDict.getSpecification());//规格
                 map.put("drugFlag", ypZdDict.getDrugFlag());//毒麻标志
                 map.put("psFlag", ypZdDict.getPsFlag());//是否需要皮试
+                YpBaseYf ypBaseYf = ypBaseYfService.queryYpBaseYf(chargeDetail.getChargeItemCode(), chargeDetail.getSerial(), chargeDetail.getGroupNo());
+                map.put("location",ypBaseYf.getLocation());
+                map.put("stockAmount",ypBaseYf.getStockAmount());
                 String manufactoryName = ypZdManufactoryService.queryYpZdManufactoryByCode(ypZdDict.getManuCode());
                 map.put("manufactoryName", manufactoryName);//生产厂家
                 String packUnitName = mzPharmacyService.getYpUnitName(ypZdDict.getPackUnit());

+ 19 - 7
src/main/resources/static/js/common/socket-com.js

@@ -3,7 +3,7 @@ var prescriptionPrintWebsocket = null;
 var lockReconnect = false; //避免ws重复连接
 var lastPatient = '';
 var number = 0;//重连次数
-var ip = '172.16.32.161:8089';
+var ip = '172.16.32.160:81';
 function openSocket(type) {
 //判断当前浏览器是否支持WebSocket
     try {
@@ -26,8 +26,12 @@ function openSocket(type) {
     prescriptionPrintWebsocket.onopen = function (event) {
         number = 0;
         console.log(type+"连接prescriptionPrintSocket连接成功");
-        if(type == 'PY' && $("#aotuPrint").is(':checked')){//配药处方自动打印
-            printPrescriptions();
+        var chk_value ='';
+        $('input[name="aotoPrint"]:checked').each(function(){
+            chk_value = $(this).val();
+        });
+        if(type == 'PY' && chk_value!= ''){//配药处方自动打印
+            printPrescriptions(chk_value);
         }
     };
 
@@ -47,14 +51,14 @@ function openSocket(type) {
     prescriptionPrintWebsocket.onclose = function (event) {
         console.log(type+"连接prescriptionPrintSocket连接关闭 code:"+event.code+",原因:"+event.reason+",是否正常关闭:"+event.wasClean);
         if(event.code == '1001' || event.code == '1006'){//1001:终端离开, 可能因为服务端错误 1006:没有发送关闭帧
-            number += 1;
+            /*number += 1;
             if(number > 5){
                 if(ip == '172.16.32.161:8089'){
                     ip = '172.16.32.160:8089'
                 }else{
                     ip = '172.16.32.161:8089'
                 }
-            }
+            }*/
             reconnect(type);
         }
     };
@@ -86,9 +90,17 @@ function dispensingMessage(data) {
         if (dispensingStatus == 0) {
             initTable();
         }
-        if ($("#aotuPrint").is(':checked')) {//自动打印
+        var chk_value ='';
+        $('input[name="aotoPrint"]:checked').each(function(){
+            chk_value = $(this).val();
+        });
+        if (chk_value != '') {//自动打印
             for (var i = 0; i < data.orderNos.length; i++) {
-                printPrescription(data.patient_id, data.times,data.orderNos[i]);
+                if(chk_value == 1){
+                    printPrescription(data.patient_id, data.times,data.orderNos[i]);
+                }else if(chk_value == 2){
+                    printDrugList(data.patient_id, data.times,data.orderNos[i]);
+                }
             }
         }
     }

+ 7 - 0
src/main/resources/static/js/fy_config.js

@@ -33,6 +33,9 @@ $(function (){
         if($("#printSelect_mzcf").val() != null){
             window.localStorage["mzCfPrintIndex"] = $("#printSelect_mzcf").val();
         }
+        if($("#printSelect_mzyd").val() != null){
+            window.localStorage["mzydPrintIndex"] = $("#printSelect_mzyd").val();
+        }
         if($("#printSelect_ekcf").val() != null){
             window.localStorage["ekCfPrintIndex"] = $("#printSelect_ekcf").val();
         }
@@ -88,6 +91,8 @@ $(function (){
 function getLastDispensingWindowsByCurrentUser() {
     $('#printSelect_mzcf').selectpicker('val', window.localStorage["mzCfPrintIndex"]==null?-1:window.localStorage["mzCfPrintIndex"]);
     $('#printSelect_mzcf').selectpicker('refresh');
+    $('#printSelect_mzyd').selectpicker('val', window.localStorage["mzydPrintIndex"]==null?-1:window.localStorage["mzydPrintIndex"]);
+    $('#printSelect_mzyd').selectpicker('refresh');
     $('#printSelect_ekcf').selectpicker('val', window.localStorage["ekCfPrintIndex"]==null?-1:window.localStorage["ekCfPrintIndex"]);
     $('#printSelect_ekcf').selectpicker('refresh');
     $('#printSelect_jzcf').selectpicker('val', window.localStorage["jzCfPrintIndex"]==null?-1:window.localStorage["jzCfPrintIndex"]);
@@ -183,6 +188,8 @@ function createPrinterList() {
     }
     $('#printSelect_mzcf').html(html);
     $('#printSelect_mzcf').selectpicker('refresh');
+    $('#printSelect_mzyd').html(html);
+    $('#printSelect_mzyd').selectpicker('refresh');
     $('#printSelect_ekcf').html(html);
     $('#printSelect_ekcf').selectpicker('refresh');
     $('#printSelect_jzcf').html(html);

+ 130 - 12
src/main/resources/static/js/mz/west_pharmacy_dispensing.js

@@ -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[]}

+ 8 - 0
src/main/resources/templates/fy_config.html

@@ -54,6 +54,14 @@
                             </select>
                         </div>
                     </div>
+                    <div class="item form-group">
+                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="printSelect_mzyd">门诊药房药单打印机
+                        </label>
+                        <div class="col-md-4 col-sm-4 col-xs-12">
+                            <select class="form-control selectpicker show-tick"  id="printSelect_mzyd">
+                            </select>
+                        </div>
+                    </div>
                     <div class="item form-group">
                         <label class="control-label col-md-3 col-sm-3 col-xs-12" for="printSelect_mzcf">门诊处方打印机
                         </label>

+ 43 - 14
src/main/resources/templates/mz/west_pharmacy_dispensing.html

@@ -46,7 +46,10 @@
                     <div class="form-group ">
                         <div class="col-md-3 col-sm-3 col-xs-12 item">
                             <label>
-                                自动打印 <input id="aotuPrint" type="checkbox"/>
+                                处方自动打印 <input id="aotoPrint" name="aotoPrint" type="checkbox" value="1"/>
+                            </label>
+                            <label>
+                                药单自动打印 <input id="aotoPrintYd" name="aotoPrint" type="checkbox" value="2"/>
                             </label>
                         </div>
                         <label class="control-label col-md-1 col-sm-1 col-xs-12" for="nameSearch">姓名
@@ -79,7 +82,7 @@
                 <table id="prescription_table"></table>
             </div>
         </div>
-
+        <!--打印处方html-->
         <div id="report_table" class="in"
              style="display: none;width:550px;height: 700px;margin:0 auto;border: 1px solid #337ab7;font-size: 16px;padding: 40px 20px 40px 20px;overflow-y: auto; overflow-x:hidden;">
             <div id="print_view" style="position: relative;">
@@ -136,18 +139,6 @@
                     <div id="div_yp">
                         <table class="table table-striped table-bordered" >
                             <tbody id="tbody_yp">
-                            <!--<tr>
-                                <td style="width: 10px;" align="left" valign="top">1.</td>
-                                <td style="vertical-align: middle !important;width: 260px;">复方石淋通胶囊(湖南德康天机草堂中国股份有限公司)
-                                </td>
-                                <td style="vertical-align: middle !important;width: 120px;text-align: right;">0.25g x36粒/盒</td>
-                                <td style="vertical-align: middle !important;width: 20px;text-align: right;">×</td>
-                                <td style="vertical-align: middle !important;width: 20px;text-align: right;">6.0</td>
-                                <td style="vertical-align: middle !important;width: 30px;text-align: right;">盒</td>
-                            </tr>
-                            <tr>
-                                <td colspan="5" style="vertical-align: middle !important;text-align: right;">用法:0.2mg/次 TID 口服</td>
-                            </tr>-->
                             </tbody>
                         </table>
                     </div>
@@ -173,9 +164,47 @@
                 </div>
             </div>
         </div>
+        <!--打印处方html end-->
+
+        <!--打印药单html-->
+        <div id="report_table_list" class="in"
+             style="display: none;width:1300px;margin:0 auto;border: 1px solid #337ab7;font-size: 16px;padding: 40px 20px 40px 20px;overflow-y: auto; overflow-x:hidden;">
+            <div id="print_view_list" style="position: relative;">
+                <table id="yddy_table" class="table table-striped table-bordered" style="margin-top: 0px;border: none;">
+                    <tr style="font-weight: 700;background-color: #EBEBE4">
+                        <td colspan="9" style="font-size: 18px;text-align: center;border: transparent !important;"><span class="title">泰和医院门诊患者西药药单</span></td>
+                    </tr>
+                    <tr>
+                        <td colspan="9" style="border: transparent !important;">&nbsp;</td>
+                    </tr>
+                    <tr style="font-weight: 700;background-color: #EBEBE4">
+                        <td colspan="2" style="text-align: left;border: transparent !important;">姓名:<span class="name"></span></td>
+                        <td colspan="2" style="text-align: left;border: transparent !important;">性别:<span class="sex"></span></td>
+                        <td colspan="1" style="text-align: left;border: transparent !important;">年龄:<span class="age"></span></td>
+                        <td colspan="3" style="text-align: left;border: transparent !important;">打印时间:<span class="printDate"></span></td>
+                    </tr>
+                    <tr style="font-weight: 700;background-color: #EBEBE4">
+                        <td colspan="2" style="text-align: left;border: transparent !important;">科室:<span class="warnDeptName"></span></td>
+                        <td colspan="2" style="text-align: left;border: transparent !important;">医生:<span class="employeeName"></span></td>
+                        <td colspan="3" style="text-align: left;border: transparent !important;">诊断:<span class="icdText"></span></td>
+                    </tr>
+                    <tr>
+                        <td class="xtd" style="text-align: center;width: 100px;">货位号</td>
+                        <td class="xtd" style="text-align: center;width: 150px;">品名</td>
+                        <td class="xtd" style="text-align: center;width: 120px;">规格</td>
+                        <td class="xtd" style="text-align: center;width: 60px;">数量</td>
+                        <td class="xtd" style="text-align: center;width: 150px;">生产厂家</td>
+                        <td class="xtd" style="text-align: center;width: 120px;">给药方式</td>
+                        <td class="xtd" style="text-align: center;width: 120px;">当前库存</td>
+                    </tr>
+                </table>
+            </div>
+        </div>
+        <!--打印药单html end-->
     </div>
 </div>
 
+
 <!--处方详细弹窗开始-->
 <div class="modal fade bs-example-modal-sm in" tabindex="-1" role="dialog" aria-hidden="true" id="cfxxModal">
     <div class="modal-dialog modal-sm">