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

Merge branch 'dev-1.1.0' of https://172.16.32.165/hurugang/thmz_system into dev-1.1.0

hurugang 4 лет назад
Родитель
Сommit
eb41067701

+ 4 - 15
src/main/java/cn/hnthyy/thmz/controller/mz/MzPharmacyController.java

@@ -444,7 +444,7 @@ public class MzPharmacyController {
                 return resultMap;
             }
             resultMap = mzPharmacyService.sendMedicineProcessing(mzChargeDetail, tokenUser);
-            dispensingSocketService.sendToMedicine(mzChargeDetail.getPatientId(),SocketSenderTypeEnum.SEND_MEDICINE.code);
+            dispensingSocketService.sendToMedicine(mzChargeDetail.getPatientId());
             return resultMap;
         } catch (Exception e) {
             e.printStackTrace();
@@ -495,8 +495,7 @@ public class MzPharmacyController {
             if (num > 0) {
                 resultMap.put("code", 0);
                 resultMap.put("message", "配药处理成功");
-                dispensingSocketService.sendDispensing(SocketSenderTypeEnum.DISPENSING_MEDICINE.code);
-                dispensingSocketService.sendToMedicine(mzChargeDetail.getPatientId(),SocketSenderTypeEnum.DISPENSING_MEDICINE.code);
+                dispensingSocketService.sendToMedicineAndSendMedicine(mzChargeDetail.getPatientId());
                 return resultMap;
             }
             resultMap.put("code", -1);
@@ -532,19 +531,9 @@ public class MzPharmacyController {
                 resultMap.put("message", "打印失败,病人ID为空");
                 return resultMap;
             }
-            if (mzChargeDetail.getOrderNo() == null) {
-                resultMap.put("code", -1);
-                resultMap.put("message", "打印失败,处方号为空");
-                return resultMap;
-            }
-            if (mzChargeDetail.getRealNo() == null) {
-                resultMap.put("code", -1);
-                resultMap.put("message", "打印失败,发票流水号为空");
-                return resultMap;
-            }
-            if (mzChargeDetail.getChargeDate() == null) {
+            if (mzChargeDetail.getTimes() == null) {
                 resultMap.put("code", -1);
-                resultMap.put("message", "打印失败,缴费时间为空");
+                resultMap.put("message", "打印失败,次数为空");
                 return resultMap;
             }
             Map<String, Object> printMap = new HashMap<>();

+ 5 - 4
src/main/java/cn/hnthyy/thmz/controller/mz/YpfydlController.java

@@ -98,10 +98,11 @@ public class YpfydlController {
                 resultMap.put("message", "查询未发药药品失败,未选择药房");
                 return resultMap;
             }
-            DateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
-            Date myDate1 = dateFormat1.parse("2021-01-22");
-            Date begin = DateUtil.getFirstSecond(myDate1);
-            Date end = DateUtil.getLastSecond(myDate1);
+           /* DateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
+            Date myDate1 = dateFormat1.parse("2021-01-22");*/
+            Date now = new Date();
+            Date begin = DateUtil.getFirstSecond(now);
+            Date end = DateUtil.getLastSecond(now);
             List<Map<String, Object>> currentList = mzYpFydlService.queryToMedicine(groupNo, begin, end);
             resultMap.put("code", 0);
             resultMap.put("message", "查询未发药药品成功");

+ 38 - 31
src/main/java/cn/hnthyy/thmz/service/impl/thmz/DispensingSocketServiceImpl.java

@@ -7,12 +7,12 @@ import cn.hnthyy.thmz.service.his.mz.MzChargeDetailService;
 import cn.hnthyy.thmz.service.his.mz.MzPatientMiService;
 import cn.hnthyy.thmz.service.thmz.DispensingSocketService;
 import cn.hnthyy.thmz.socket.PrescriptionPrintSocket;
-import cn.hnthyy.thmz.socket.ToMedicineSocket;
-import org.json.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @Service
@@ -20,54 +20,61 @@ public class DispensingSocketServiceImpl implements DispensingSocketService {
     @Autowired
     PrescriptionPrintSocket prescriptionPrintSocket;
     @Autowired
-    ToMedicineSocket toMedicineSocket;
-    @Autowired
     MzPatientMiService mzPatientMiService;
     @Autowired
     MzChargeDetailService mzChargeDetailService;
 
-    @Override
-    public int sendPrescription(String patientId,int times,String type) {
-        Map<String,Object> msgMap = new HashMap();
-        msgMap.put("patientId",patientId);
-        msgMap.put("times",times);
-        msgMap.put("type",type);
-        JSONObject jsonObject = new JSONObject(msgMap);
-        return prescriptionPrintSocket.sendMessage(jsonObject.toString());
-    }
 
     @Override
-    public int sendToMedicine(String patientId,String type) {
+    public int sendToMedicine(String patientId) {
         Map<String,Object> msgMap = new HashMap();
-        msgMap.put("patientId",patientId);
+        msgMap.put("patient_id",patientId);
         MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
         msgMap.put("name",mzPatientMi.getName());
-        msgMap.put("type",type);
-        JSONObject jsonObject = new JSONObject(msgMap);
-        return toMedicineSocket.sendMessage(jsonObject.toString());
+        msgMap.put("type",SocketSenderTypeEnum.SEND_MEDICINE.code);
+        List<String> objTypes = new ArrayList<>();
+        objTypes.add(SocketSenderTypeEnum.CALL_NUMBER.code);
+        return prescriptionPrintSocket.sendMessage(msgMap,objTypes);
     }
 
     @Override
-    public int sendToMedicine(String patientId, int times) {
+    public int sendToMedicineAndDispensing(String patientId, int times) {
         //查询缴费药品的发药药房
         MzChargeDetail mzChargeDetail = new MzChargeDetail();
         mzChargeDetail.setPatientId(patientId);
         mzChargeDetail.setTimes(times);
-        mzChargeDetailService.queryChargeDetail(mzChargeDetail);
-        Map<String,Object> msgMap = new HashMap();
-        msgMap.put("patientId",patientId);
-        MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
-        msgMap.put("name",mzPatientMi.getName());
-        msgMap.put("type",SocketSenderTypeEnum.PAY.code);
-        JSONObject jsonObject = new JSONObject(msgMap);
-        return toMedicineSocket.sendMessage(jsonObject.toString());
+        List<MzChargeDetail> chargeDetail = mzChargeDetailService.getMzChargeDetailList(mzChargeDetail);
+        boolean flag = false;
+        for (MzChargeDetail detail : chargeDetail) {
+            if(detail.getGroupNo().equals("71")){
+                flag = true;
+                break;
+            }
+        }
+        if(flag){
+            Map<String,Object> msgMap = new HashMap();
+            msgMap.put("patient_id",patientId);
+            MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
+            msgMap.put("name",mzPatientMi.getName());
+            msgMap.put("type",SocketSenderTypeEnum.PAY.code);
+            List<String> objTypes = new ArrayList<>();
+            objTypes.add(SocketSenderTypeEnum.CALL_NUMBER.code);
+            objTypes.add(SocketSenderTypeEnum.DISPENSING_MEDICINE.code);
+            return prescriptionPrintSocket.sendMessage(msgMap,objTypes);
+        }
+        return 0;
     }
 
     @Override
-    public int sendDispensing(String type) {
+    public int sendToMedicineAndSendMedicine(String patientId) {
         Map<String,Object> msgMap = new HashMap();
-        msgMap.put("type",type);
-        JSONObject jsonObject = new JSONObject(msgMap);
-        return prescriptionPrintSocket.sendMessage(jsonObject.toString());
+        MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
+        msgMap.put("name",mzPatientMi.getName());
+        msgMap.put("patient_id",patientId);
+        msgMap.put("type",SocketSenderTypeEnum.DISPENSING_MEDICINE.code);
+        List<String> objTypes = new ArrayList<>();
+        objTypes.add(SocketSenderTypeEnum.CALL_NUMBER.code);
+        objTypes.add(SocketSenderTypeEnum.SEND_MEDICINE.code);
+        return prescriptionPrintSocket.sendMessage(msgMap,objTypes);
     }
 }

+ 1 - 1
src/main/java/cn/hnthyy/thmz/service/impl/thmz/OrderStatusChangeServiceImpl.java

@@ -68,7 +68,7 @@ public class OrderStatusChangeServiceImpl implements OrderStatusChangeService {
                 String status = arr[1];
                 if (OrderStatusEnum.SUCCESSFUL_PRESCRIPTION_PAYMENT.code.equals(status)) {
                     try {
-                        dispensingSocketService.sendToMedicine(patientInfo[0], Integer.valueOf(patientInfo[1]));
+                        dispensingSocketService.sendToMedicineAndDispensing(patientInfo[0], Integer.valueOf(patientInfo[1]));
                     } catch (Exception e) {
                         log.error("通知药房出错,错误信息{}", e.getMessage());
                     }

+ 7 - 15
src/main/java/cn/hnthyy/thmz/service/thmz/DispensingSocketService.java

@@ -7,35 +7,27 @@ package cn.hnthyy.thmz.service.thmz;
  */
 public interface DispensingSocketService {
 
-    /**
-     * 缴费通知配药处理
-     * @param patientId
-     * @param times
-     * @param type socket发送方类型SocketSenderTypeEnum
-     * @return
-     */
-    int sendPrescription(String patientId,int times,String type);
 
     /**
      * 通知发药提醒
      * @param patientId
-     * @param type socket发送方类型SocketSenderTypeEnum
      * @return
      */
-    int sendToMedicine(String patientId,String type);
+    int sendToMedicine(String patientId);
 
     /**
-     * 通知发药提醒
+     * 通知发药提醒和配药处理
      * @param patientId
+     * @param times
      * @return
      */
-    int sendToMedicine(String patientId,int times);
+    int sendToMedicineAndDispensing(String patientId,int times);
 
     /**
-     * 通知发药处理
-     * @param type socket发送方类型SocketSenderTypeEnum
+     * 通知发药通知和发药处理
+     * @param patientId
      * @return
      */
-    int sendDispensing(String type);
+    int sendToMedicineAndSendMedicine(String patientId);
 
 }

+ 30 - 11
src/main/java/cn/hnthyy/thmz/socket/PrescriptionPrintSocket.java

@@ -1,12 +1,16 @@
 package cn.hnthyy.thmz.socket;
 
 import lombok.extern.slf4j.Slf4j;
+import org.json.JSONArray;
+import org.json.JSONObject;
 import org.springframework.stereotype.Component;
 
 import javax.websocket.*;
 import javax.websocket.server.PathParam;
 import javax.websocket.server.ServerEndpoint;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -43,8 +47,8 @@ public class PrescriptionPrintSocket {
     public void onOpen(@PathParam(value = "type") String type, Session session) {
         onlineCount.incrementAndGet(); // 在线数加1
         clients.put(session.getId(), session);
-        clientTypes.put(session.getId(),type);
-        log.info("有新连接加入:{},类型:{},当前在线人数为:{}", session.getId(),type, onlineCount.get());
+        clientTypes.put(session.getId(), type);
+        log.info("有新连接加入:{},类型:{},当前在线人数为:{}", session.getId(), type, onlineCount.get());
     }
 
     /**
@@ -55,7 +59,7 @@ public class PrescriptionPrintSocket {
         onlineCount.decrementAndGet(); // 在线数减1
         clients.remove(session.getId());
         clientTypes.remove(session.getId());
-        log.info("有一连接关闭:{},类型:{},当前在线人数为:{}", session.getId(),clientTypes.get(session.getId()),onlineCount.get());
+        log.info("有一连接关闭:{},类型:{},当前在线人数为:{}", session.getId(), clientTypes.get(session.getId()), onlineCount.get());
     }
 
     /**
@@ -66,7 +70,17 @@ public class PrescriptionPrintSocket {
     @OnMessage
     public void onMessage(String message, Session session) {
         log.info("服务端收到客户端[{}]的消息:{}", session.getId(), message);
-        this.sendMessage(message);
+        JSONObject jsonObject = new JSONObject(message);
+        JSONArray objJsonTypes = jsonObject.getJSONArray("objTypes");
+        List<String> objTypes = new ArrayList();
+        for (int i = 0; i < objJsonTypes.length(); i++) {
+            objTypes.add((String) objJsonTypes.get(i));
+        }
+        Map<String,Object> msgMap = new HashMap();
+        msgMap.put("patient_id",jsonObject.getString("patient_id"));
+        msgMap.put("name",jsonObject.getString("name"));
+        msgMap.put("type",jsonObject.getString("type"));
+        this.sendMessage(msgMap, objTypes);
     }
 
     @OnError
@@ -77,18 +91,23 @@ public class PrescriptionPrintSocket {
 
     /**
      * 群发消息
-     * @param message 消息内容
-     * @return
+     *
+     * @param msgObj   消息内容
+     * @param objTypes 接收消息的客户端类型SocketSenderTypeEnum
+     * @return 接收消息的客户端数量
      */
-    public int sendMessage(String message) {
+    public int sendMessage(Object msgObj, List<String> objTypes) {
         int i = 0;
         for (Map.Entry<String, Session> sessionEntry : clients.entrySet()) {
             Session toSession = sessionEntry.getValue();
+            String jsonObject = JSONObject.valueToString(msgObj);
             // 发送消息给接收方
-            if (clientTypes.get(toSession.getId()).equals("acceptor")) {
-                log.info("服务端给客户端[{}]发送消息{}", toSession.getId(), message);
-                toSession.getAsyncRemote().sendText(message);
-                i++;
+            for (String type : objTypes) {
+                if (clientTypes.get(toSession.getId()).equals(type)) {
+                    log.info("服务端给客户端[{}]发送消息{}", toSession.getId(), jsonObject);
+                    toSession.getAsyncRemote().sendText(jsonObject);
+                    i++;
+                }
             }
         }
         return i;

+ 0 - 96
src/main/java/cn/hnthyy/thmz/socket/ToMedicineSocket.java

@@ -1,96 +0,0 @@
-package cn.hnthyy.thmz.socket;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-
-import javax.websocket.*;
-import javax.websocket.server.PathParam;
-import javax.websocket.server.ServerEndpoint;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * 前后端交互的类实现消息的接收推送(自己发送给所有人(不包括自己))
- *
- * @ServerEndpoint(value = "/ToMedicineSocket") 前端通过此URI 和后端交互,建立连接
- */
-@Slf4j
-@ServerEndpoint(value = "/toMedicineSocket/{type}")
-@Component
-public class ToMedicineSocket {
-
-    /**
-     * 记录当前在线连接数
-     */
-    private static AtomicInteger onlineCount = new AtomicInteger(0);
-
-    /**
-     * 存放所有在线的客户端
-     */
-    private static Map<String, Session> clients = new ConcurrentHashMap<>();
-
-    /**
-     * 存放所有在线客户端所属的类型
-     */
-    private static Map<String, String> clientTypes = new HashMap<>();
-
-    /**
-     * 连接建立成功调用的方法
-     */
-    @OnOpen
-    public void onOpen(@PathParam(value = "type") String type, Session session) {
-        onlineCount.incrementAndGet(); // 在线数加1
-        clients.put(session.getId(), session);
-        clientTypes.put(session.getId(),type);
-        log.info("有新连接加入:{},类型:{},当前在线人数为:{}", session.getId(),type, onlineCount.get());
-    }
-
-    /**
-     * 连接关闭调用的方法
-     */
-    @OnClose
-    public void onClose(Session session) {
-        onlineCount.decrementAndGet(); // 在线数减1
-        clients.remove(session.getId());
-        clientTypes.remove(session.getId());
-        log.info("有一连接关闭:{},类型:{},当前在线人数为:{}", session.getId(),clientTypes.get(session.getId()),onlineCount.get());
-    }
-
-    /**
-     * 收到客户端消息后调用的方法
-     *
-     * @param message 客户端发送过来的消息
-     */
-    @OnMessage
-    public void onMessage(String message, Session session) {
-        log.info("服务端收到客户端[{}]的消息:{}", session.getId(), message);
-        this.sendMessage(message);
-    }
-
-    @OnError
-    public void onError(Session session, Throwable error) {
-        log.error("发生错误");
-        error.printStackTrace();
-    }
-
-    /**
-     * 群发消息
-     *
-     * @param message 消息内容
-     */
-    public int sendMessage(String message) {
-        int i = 0;
-        for (Map.Entry<String, Session> sessionEntry : clients.entrySet()) {
-            Session toSession = sessionEntry.getValue();
-            // 发送消息给接收方
-            if (clientTypes.get(toSession.getId()).equals("acceptor")) {
-                log.info("服务端给客户端[{}]发送消息{}", toSession.getId(), message);
-                toSession.getAsyncRemote().sendText(message);
-                i++;
-            }
-        }
-        return i;
-    }
-}

+ 6 - 10
src/main/resources/static/js/mz/to-medicine-test.js

@@ -26,7 +26,6 @@ $(function () {
     $(".selectpicker").selectpicker({
         dropuAuto: false
     });
-
     var yesNo = '<option value="71">门诊西药房</option><option value="81">门诊中药房</option><option value="82">颗粒剂药房</option>';
     $('#fyClass').html(yesNo);
     $('#fyClass').selectpicker('refresh');
@@ -218,13 +217,12 @@ function getTableDate() {
  * 刷新列表
  */
 function refeshTable() {
-    console.log(new Date().getSeconds());
+    console.log("方法一轮时间:"+new Date().getSeconds());
     for (var i = 1; i < 7; i++) {
         if (tempPastList == null || tempPastList.length == 0) {
             $("#past" + i).text("");
             if (i == 6) {
-                currentListHadDone = true;
-                //如果过号列表也遍历完成,将待取药列表置空,否责重新遍历待取药列表
+                pastListHadDone = true;
                 //深度拷贝数组
                 tempPastList = $.extend(true, [], pastList);
             }
@@ -239,7 +237,6 @@ function refeshTable() {
             $("#current" + i).text("");
             if (i == 12) {
                 currentListHadDone = true;
-                //如果过号列表也遍历完成,将待取药列表置空,否责重新遍历待取药列表
                 //深度拷贝数组
                 tempCurrentList = $.extend(true, [], currentList);
             }
@@ -254,7 +251,6 @@ function refeshTable() {
             $("#dispense" + i).text("");
             if (i == 12) {
                 dispenseListHadDone = true;
-                //如果过号列表也遍历完成,将待取药列表置空,否责重新遍历待取药列表
                 //深度拷贝数组
                 tempDispenseList = $.extend(true, [], dispenseList);
             }
@@ -298,19 +294,19 @@ var websocket = null;
 
 //判断当前浏览器是否支持WebSocket, 主要此处要更换为自己的地址
 if ('WebSocket' in window) {
-    websocket = new WebSocket("ws://" + window.location.host + "/thmz/toMedicineSocket/acceptor");
+    websocket = new WebSocket("ws://" + window.location.host + "/thmz/prescriptionPrintSocket/JH");
 } else {
     alert('Not support websocket')
 }
 
 //连接发生错误的回调方法
 websocket.onerror = function () {
-    console.log("发药提醒toMedicineSocket发生错误")
+    console.log("发药提醒prescriptionPrintSocket发生错误")
 };
 
 //连接成功建立的回调方法
 websocket.onopen = function (event) {
-    console.log("发药提醒toMedicineSocket连接成功");
+    console.log("发药提醒prescriptionPrintSocket连接成功");
 }
 
 //接收到消息的回调方法
@@ -383,7 +379,7 @@ websocket.onmessage = function (event) {
 
 //连接关闭的回调方法
 websocket.onclose = function () {
-    console.log("发药提醒toMedicineSocket连接关闭");
+    console.log("发药提醒prescriptionPrintSocket连接关闭");
 }
 
 //监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。

+ 10 - 39
src/main/resources/static/js/mz/west_pharmacy_dispensing.js

@@ -129,8 +129,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.orderNo + '\',\'' + row.realNo + '\',\'' + row.chargeDate + '\',\'' + row.times + '\',\'' + row.receiptNo + '\',\'' + row.warnDept + '\')"  style="color: #35D082;"><i class="fa fa-print"></i></button>';
-                    str += '<button type="button" class="registration-no-color-foot-button" title="配药完成" onclick="dispensingDispose(\'' + row.patientId + '\',\'' + row.orderNo + '\',\'' + row.name + '\',\'' + row.realNo + '\',\'' + row.chargeDate + '\')"><i class="glyphicon glyphicon-send"></i></button>';
+                    var str = '<button type="button" class="registration-no-color-foot-button" title="打印" onclick="printPrescription(\'' + row.patientId + '\',\'' + row.times + '\')"  style="color: #35D082;"><i class="fa fa-print"></i></button>';
+                    str += '<button type="button" class="registration-no-color-foot-button" title="配药完成" onclick="dispensingDispose(\'' + row.patientId + '\',\'' + row.orderNo + '\',\'' + row.name + '\',\'' + row.realNo + '\',\'' + row.chargeDate + '\')"><i class="fa fa-check-square-o"></i></button>';
                     return str;
                 }
             }
@@ -229,13 +229,10 @@ function dispensingDispose(patientId, orderNo, name, realNo, chargeDate) {
 /**
  * 打印处方
  */
-function printPrescription(patientId, orderNo, realNo, times, receiptNo) {
+function printPrescription(patientId, times) {
     var tem = {
         patientId: patientId,
-        orderNo: orderNo,
-        realNo: realNo,
         times: times,
-        receiptNo: receiptNo,
         groupNo: 71
     };
     $.ajax({
@@ -390,12 +387,10 @@ function setPrint() {
 
 
 var prescriptionPrintWebsocket = null;
-var toMedicineWebsocket = null;
 
 //判断当前浏览器是否支持WebSocket, 主要此处要更换为自己的地址
 if ('WebSocket' in window) {
-    prescriptionPrintWebsocket = new WebSocket("ws://" + window.location.host + "/thmz/prescriptionPrintSocket/sender");
-    toMedicineWebsocket = new WebSocket("ws://" + window.location.host + "/thmz/toMedicineSocket/sender");
+    prescriptionPrintWebsocket = new WebSocket("ws://" + window.location.host + "/thmz/prescriptionPrintSocket/PY");
 } else {
     alert('Not support websocket')
 }
@@ -416,12 +411,12 @@ prescriptionPrintWebsocket.onmessage = function (event) {
     var printStatus = $("#printStatusSearch").val();
     var dispensingStatus = $("#dispensingStatusSearch").val();
     var data = JSON.parse(event.data);
-    if (data.type == 'jf' && data.content == 1 && printStatus == 0 && dispensingStatus == 0) {//来自缴费成功后的消息
-        console.log("刷新配药表格");
-        initTable();
-        if($("#aotuPrint1").is(':checked')){//自动打印
-            console.log("自动打印");
-            printPrescription(data.patientId, data.orderNo, data.realNo, data.times, data.receiptNo);
+    if (data.type == 'JF') {//来自缴费成功后的消息
+        if(printStatus == 0 && dispensingStatus == 0){
+            initTable();
+        }
+        if($("#aotuPrint").is(':checked')){//自动打印
+            printPrescription(data.patient_id, data.times);
         }
     }
 }
@@ -433,37 +428,13 @@ prescriptionPrintWebsocket.onclose = function () {
 //-----------prescriptionPrintSocket -end
 
 
-//-----------toMedicineWebsocket -start
-//连接发生错误的回调方法
-toMedicineWebsocket.onerror = function () {
-    console.log("配药连接toMedicineWebsocket发生错误")
-};
-
-//连接成功建立的回调方法
-toMedicineWebsocket.onopen = function (event) {
-    console.log("配药连接toMedicineWebsocket连接成功");
-}
-
-//接收到消息的回调方法
-toMedicineWebsocket.onmessage = function (event) {
-
-}
-
-//连接关闭的回调方法
-toMedicineWebsocket.onclose = function () {
-    console.log("配药连接toMedicineWebsocket连接关闭");
-}
-//------------toMedicineWebsocket end
-
 //监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
 window.onbeforeunload = function () {
     prescriptionPrintWebsocket.close();
-    toMedicineWebsocket.close();
 }
 
 //关闭连接
 function closeWebSocket() {
     prescriptionPrintWebsocket.close();
-    toMedicineWebsocket.close();
 }
 

+ 2 - 30
src/main/resources/static/js/mz/west_pharmacy_send.js

@@ -132,7 +132,6 @@ function sendMedicineProcessing(realNo, groupNo, orderNo, receiptNo, times, pati
             if (res.code == 0) {
                 successMesage(res);
                 initTbTable();
-                //toMedicineWebSocket.send(JSON.stringify({patient_id:patientId,name:name,type:'fy'}));
             } else {
                 errorMesage(res);
             }
@@ -912,7 +911,7 @@ function saveRefundMedicine() {
  * @param name
  */
 function callNumber(patientId, name) {
-    toMedicineWebSocket.send(JSON.stringify({patient_id: patientId, name: name, type: 'JH'}));
+    prescriptionPrintWebSocket.send(JSON.stringify({patient_id: patientId, name: name,type:'JH', objTypes: ['JH']}));
 }
 
 /**
@@ -947,12 +946,10 @@ function setPrint() {
 
 
 var prescriptionPrintWebSocket = null;
-var toMedicineWebSocket = null;
 
 //判断当前浏览器是否支持WebSocket, 主要此处要更换为自己的地址
 if ('WebSocket' in window) {
-    prescriptionPrintWebSocket = new WebSocket("ws://" + window.location.host + "/thmz/prescriptionPrintSocket/acceptor");
-    toMedicineWebSocket = new WebSocket("ws://" + window.location.host + "/thmz/toMedicineSocket/sender");
+    prescriptionPrintWebSocket = new WebSocket("ws://" + window.location.host + "/thmz/prescriptionPrintSocket/FY");
 } else {
     alert('Not support websocket')
 }
@@ -984,40 +981,15 @@ prescriptionPrintWebSocket.onclose = function () {
 }
 //-----------prescriptionPrintWebSocket end
 
-//---------toMedicineWebSocket start
-//连接发生错误的回调方法
-toMedicineWebSocket.onerror = function () {
-    console.log("发药连接toMedicineWebSocket发生错误")
-};
-
-//连接成功建立的回调方法
-toMedicineWebSocket.onopen = function (event) {
-    console.log("发药连接toMedicineWebSocket连接成功");
-}
-
-//接收到消息的回调方法
-toMedicineWebSocket.onmessage = function (event) {
-
-}
-
-//连接关闭的回调方法
-toMedicineWebSocket.onclose = function () {
-    console.log("发药连接toMedicineWebSocket连接关闭");
-}
-//-----------toMedicineWebSocket end
-
-
 //监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
 window.onbeforeunload = function () {
     prescriptionPrintWebSocket.close();
-    toMedicineWebSocket.close();
 }
 
 
 //关闭连接
 function closeWebSocket() {
     prescriptionPrintWebSocket.close();
-    toMedicineWebSocket.close();
 }
 
 

+ 4 - 4
src/main/resources/templates/mz/to-medicine-test.html

@@ -74,7 +74,7 @@
                             <td class="text-center current" style="vertical-align: middle !important;width: 15%;" id="current4"></td>
                             <td class="text-center dispense" style="vertical-align: middle !important;width: 15%;" id="dispense3"></td>
                             <td class="text-center dispense" style="vertical-align: middle !important;width: 15%;" id="dispense4"></td>
-                            <td class="text-center past" style="vertical-align: middle !important;width: 15%;color: red;" id="past2"></td>
+                            <td class="text-center past" style="vertical-align: middle !important;" id="past2"></td>
                         </tr>
                         <tr style="background: #BBFDBC;">
                             <td rowspan="4" class="text-center" style="background: aliceblue;vertical-align: middle !important;color: rgb(69,124,189);font-weight: bold;font-size: 120px;" id="rightPerson"></td>
@@ -82,21 +82,21 @@
                             <td class="text-center current" style="vertical-align: middle !important;" id="current6"></td>
                             <td class="text-center dispense" style="vertical-align: middle !important;" id="dispense5"></td>
                             <td class="text-center dispense" style="vertical-align: middle !important;" id="dispense6"></td>
-                            <td class="text-center past" style="vertical-align: middle !important;color: red;" id="past3"></td>
+                            <td class="text-center past" style="vertical-align: middle !important;" id="past3"></td>
                         </tr>
                         <tr style="background: #9CD4D4;">
                             <td class="text-center current" style="vertical-align: middle !important;" id="current7"></td>
                             <td class="text-center current" style="vertical-align: middle !important;" id="current8"></td>
                             <td class="text-center dispense" style="vertical-align: middle !important;" id="dispense7"></td>
                             <td class="text-center dispense" style="vertical-align: middle !important;" id="dispense8"></td>
-                            <td class="text-center past" style="vertical-align: middle !important;color: red;" id="past4"></td>
+                            <td class="text-center past" style="vertical-align: middle !important;" id="past4"></td>
                         </tr>
                         <tr style="background: #BBFDBC;">
                             <td class="text-center current" style="vertical-align: middle !important;" id="current9"></td>
                             <td class="text-center current" style="vertical-align: middle !important;" id="current10"></td>
                             <td class="text-center dispense" style="vertical-align: middle !important;" id="dispense9"></td>
                             <td class="text-center dispense" style="vertical-align: middle !important;" id="dispense10"></td>
-                            <td class="text-center past" style="vertical-align: middle !important;color: red;" id="past5"></td>
+                            <td class="text-center past" style="vertical-align: middle !important;" id="past5"></td>
                         </tr>
                         <tr style="background: #9CD4D4;">
                             <td class="text-center current" style="vertical-align: middle !important;" id="current11"></td>

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

@@ -45,7 +45,7 @@
                     <div class="form-group ">
                         <div class="col-md-3 col-sm-3 col-xs-12 item">
                             <label>
-                                自动打印 <input id="aotuPrint1" type="checkbox"/>
+                                自动打印 <input id="aotuPrint" type="checkbox"/>
                             </label>
                         </div>
                         <label class="control-label col-md-1 col-sm-1 col-xs-12" for="nameSearch">姓名