Просмотр исходного кода

Merge branch 'dev-1.1.4' into 'dev-1.1.4'

门诊自动打印优化

See merge request lihong/thmz_system!36
huangshuhua 1 год назад
Родитель
Сommit
9a22a2ccc4

+ 12 - 11
src/main/resources/static/js/common/socket-com.js

@@ -29,22 +29,23 @@ function openSocket(type) {
                         //连接成功建立的回调方法
                         prescriptionPrintWebsocket.onopen = function (event) {
                             console.log(type + "连接prescriptionPrintSocket连接成功");
-                            var chk_value = '';
-                            $('input[name="autoPrint"]:checked').each(function () {
-                                chk_value = $(this).val();
-                            });
-                            $('input[name="printType"]:checked').each(function () {
-                                printType = $(this).val();
-                            });
-                            if (type == 'PY' && chk_value != '') {//配药处方自动打印
-                                printPrescriptions(chk_value);
-                            }
+                            // 取消socket方式自动打印
+                            // var chk_value = '';
+                            // $('input[name="autoPrint"]:checked').each(function () {
+                            //     chk_value = $(this).val();
+                            // });
+                            // $('input[name="printType"]:checked').each(function () {
+                            //     printType = $(this).val();
+                            // });
+                            // if (type == 'PY' && chk_value != '') {//配药处方自动打印
+                            //     printPrescriptions(chk_value);
+                            // }
                         };
                         //页面接收到消息的回调方法
                         prescriptionPrintWebsocket.onmessage = function (event) {
                             var data = JSON.parse(event.data);
                             if (type == 'PY' && data.groupNo == groupNo) {
-                                dispensingMessage(data);
+                                // dispensingMessage(data);
                             } else if (type == 'FY') {
                                 sendMedicineMessage(data);
                             } else if (type == 'JH') {

+ 22 - 22
src/main/resources/static/js/mz/west_pharmacy_dispensing.js

@@ -10,6 +10,7 @@ var windowsNoYf = window.localStorage["winNo"];
 var printType = '';
 var temporaryKeyList="";
 var timer="";
+var printTimer = "";
 $(function () {
     init_daterangepicker();
     if (groupNo == null || windowsNoYf == null) {
@@ -26,32 +27,30 @@ $(function () {
         cleanParams();
     });
 
-    $('input:radio').each(function () {
+    $('input:checkbox').each(function () {
         $(this).click(function () {
             if ($(this).prop('checked')) {
-                $(':radio[name=autoPrint]').removeAttr('checked');
+                $(':checkbox[name=autoPrint]').removeAttr('checked');
+                $(':checkbox[name=printType]').removeAttr('checked');
                 $(this).prop('checked', true);
                 var chk_value = '';
                 $('input[name="autoPrint"]:checked').each(function () {
                     chk_value = $(this).val();
                 });
-                printPrescriptions(chk_value);
-            }
-        })
-    });
-    $('input:checkbox').each(function () {
-        $(this).click(function () {
-            if ($(this).prop('checked')) {
-                $(':checkbox[name=printType]').removeAttr('checked');
-                $(this).prop('checked', true);
                 $('input[name="printType"]:checked').each(function () {
                     printType = $(this).val();
                 });
+                if (!printTimer) {
+                    printTimer = setInterval("autoPrintMzCf()",2000);
+                }
             } else {
-                printType = ''
+                $(':checkbox[name=autoPrint]').removeAttr('checked');
+                $(':checkbox[name=printType]').removeAttr('checked');
+                printType = "";
+                clearTimeout(printTimer);
+                printTimer=null;
+
             }
-            var chk_value = $('input[name="autoPrint"]:checked').val();
-            printPrescriptions(chk_value);
         })
     });
     $("#cfxxModal").on('shown.bs.modal', function (t) {
@@ -639,14 +638,8 @@ function printPrescription(patientId, times, orderNo) {
             }
             if (res.code == 0) {
                 //setPrint();//初始化默认打印机
-                // 3:打印血液中心的处方
-                if(printType == '3' && res.data.warnDeptCode == '1020510'){
-                    printView(res.data);
-                    successMesage(res);
-                } else if(printType != '3' && res.data.warnDeptCode != '1020510'){
-                    printView(res.data);
-                    successMesage(res);
-                }
+                printView(res.data);
+                successMesage(res);
             } else {
                 errorMesage(res);
             }
@@ -689,6 +682,7 @@ function printDrugList(patientId, times, orderNo) {
     });
 }
 
+let count = 0;
 /**
  * 批量打印处方
  * @param chkValue 1:处方打印 2:药单打印
@@ -1041,4 +1035,10 @@ function checkInput() {
     //清除定时器
     clearTimeout(timer);
     timer=null;
+}
+
+// 定时器调用处方打印
+function autoPrintMzCf(){
+    let v = $("#autoPrint").val();
+    printPrescriptions(v);
 }

+ 1 - 1
src/main/resources/templates/mz/west_pharmacy_dispensing.html

@@ -56,7 +56,7 @@
                     <div class="form-group ">
                         <div class="col-md-3 col-sm-3 col-xs-12 item">
                             <label>
-                                配药单自动打印 <label><input id="autoPrint" name="autoPrint" type="radio" value="1"/>处方形式</label>&nbsp;&nbsp;
+                                配药单自动打印 <label><input id="autoPrint" name="autoPrint" type="checkbox" value="1"/>处方形式</label>&nbsp;&nbsp;
 <!--                                <label><input name="autoPrint" type="radio" value="2" onclick="javascript:return false;"/>药单形式</label>&nbsp;&nbsp;-->
                                 <label><input id="printType" name="printType" type="checkbox" value="3"/>血透室打印</label>
                             </label>