Browse Source

分诊部分

lighter 3 years ago
parent
commit
918a4a2956

+ 7 - 2
src/main/java/thyyxxk/webserver/controller/triage/TriageController.java

@@ -37,6 +37,11 @@ public class TriageController {
         return service.getTriagedPatients();
     }
 
+    @GetMapping("/getTreatedPatients")
+    public ResultVo<List<MzfzPatientOrder>> getTreatedPatients() {
+        return service.getTreatedPatients();
+    }
+
     @GetMapping("/getChosenDept")
     public ResultVo<List<CodeName>> getChosenDept() {
         return service.getChosenDept();
@@ -64,8 +69,8 @@ public class TriageController {
 
     @PassToken
     @GetMapping("/notifyComplete")
-    public ResultVo<Boolean> notifyComplete(@RequestParam("serialNo") Integer serialNo) {
-        return service.notifyComplete(serialNo);
+    public void notifyComplete(@RequestParam("serialNo") Integer serialNo) {
+        service.notifyComplete(serialNo);
     }
 
     @GetMapping("/cancelTriage")

+ 36 - 13
src/main/java/thyyxxk/webserver/dao/his/triage/TriageDao.java

@@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.*;
 import thyyxxk.webserver.entity.dictionary.CodeName;
 import thyyxxk.webserver.entity.dictionary.PureCodeName;
-import thyyxxk.webserver.entity.triage.MessageForPush;
-import thyyxxk.webserver.entity.triage.MzYshTzxx;
-import thyyxxk.webserver.entity.triage.MzfzPatientOrder;
-import thyyxxk.webserver.entity.triage.MzfzZdDeptRoom;
+import thyyxxk.webserver.entity.triage.*;
 
 import java.util.List;
 import java.util.concurrent.ConcurrentMap;
@@ -67,6 +64,23 @@ public interface TriageDao {
             "</script>")
     List<MzfzPatientOrder> getTriagedPatients(@Param("deptCodes") String[] deptCodes);
 
+    @Select("<script>" +
+            "select visit_date=convert(varchar(19), visit_date, 21),patient_id, times, name, " +
+            "dept_code, dept_name=(select name from zd_unit_code where code=(select dept_code " +
+            "from mzfz_zd_dept_room where room_code=a.room_code)), " +
+            "room_code,room_name=(select room_name from mzfz_zd_dept_room where room_code=a.room_code), " +
+            "room_status=(select status_flag from mzfz_zd_dept_room where room_code=a.room_code), " +
+            "doctor_code,doctor_name=(select name from a_employee_mi where code=doctor_code), " +
+            "serial_no, gh_no, req_type,req_name=(select name from mzy_zd_charge_type where code=a.req_type), " +
+            "fz_no, slow_flag, status_flag, status_time,call_time, req_order, ampm " +
+            "from mzfz_patient_order a where datediff(day, visit_date, getdate())=0 and status_flag='9' " +
+            "and dept_code in " +
+            "<foreach collection='deptCodes' item='deptCode' open='(' separator=',' close=')'>" +
+            "#{deptCode}" +
+            "</foreach> order by fz_no" +
+            "</script>")
+    List<MzfzPatientOrder> getTreatedPatients(@Param("deptCodes") String[] deptCodes);
+
     // 获取大屏幕显示数据
     @Select("<script>" +
             "select visit_date,patient_id, times, name, " +
@@ -153,15 +167,6 @@ public interface TriageDao {
     IPage<MzfzPatientOrder> getAllPatients(IPage<MzfzPatientOrder> iPage, @Param("deptCodes") String[] deptCodes,
                                            @Param("content") String content);
 
-    @Select("<script>" +
-            "select rtrim(serial_no) code, rtrim(room_code) name from mzfz_patient_order " +
-            "where status_flag!='d' and isnull(status_flag, 0)>1 and serial_no in " +
-            "<foreach collection='ids.keys' item='serialNo' open='(' separator=',' close=')'> " +
-            "#{serialNo}" +
-            "</foreach>" +
-            "</script>")
-    List<PureCodeName> getNotifiedSerialNos(@Param("ids") ConcurrentMap<Integer, String> ids);
-
     // 获取病人分诊信息(用于通知)
     @Select("select " +
             "rtrim(a.gh_no) gh_no, " +
@@ -198,4 +203,22 @@ public interface TriageDao {
             "mzfz_patient_order.room_code=mzfz_zd_dept_room.room_code) " +
             "from mzfz_patient_order where serial_no=#{serialNo}")
     MessageForPush selectMessageForPush(@Param("serialNo") int serialNo);
+
+    @Select("select a.serial_no as serialNo, socket_sid as socketSid, a.room_code as roomCode from " +
+            "t_triage_notify_relation a, mzfz_patient_order b " +
+            "where datediff(day,a.create_datetime,getdate())=0 and a.notify_datetime is null " +
+            "and isnull(b.status_flag,0)>1 and a.serial_no=b.serial_no")
+    List<TriageNotifyRelation> selectUnNotifiedList();
+
+    @Update("update t_triage_notify_relation set notify_datetime=getdate() where serial_no=#{serialNo}")
+    void updateNotifyDatetime(@Param("serialNo") int serialNo);
+
+    @Delete("delete from t_triage_notify_relation where serial_no=#{serialNo}")
+    void deleteNotifyRelation(@Param("serialNo") int serialNo);
+
+    @Insert("insert into t_triage_notify_relation(serial_no, socket_sid, room_code) values (#{serialNo}, #{sid}, #{roomCode})")
+    void insertNotifyRelation(@Param("serialNo") int serialNo, @Param("sid") String sid, @Param("roomCode") String roomCode);
+
+    @Select("select * from t_triage_notify_relation where serial_no=#{serialNo}")
+    TriageNotifyRelation selectTriageNotifyRelation(@Param("serialNo") int serialNo);
 }

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/triage/MzfzZdDeptRoom.java

@@ -89,4 +89,6 @@ public class MzfzZdDeptRoom  implements Serializable {
 
 	private Integer serialNo;
 
+	private Integer fuzhenFlag;
+
 }

+ 10 - 0
src/main/java/thyyxxk/webserver/entity/triage/TriageNotifyRelation.java

@@ -0,0 +1,10 @@
+package thyyxxk.webserver.entity.triage;
+
+import lombok.Data;
+
+@Data
+public class TriageNotifyRelation {
+    private Integer serialNo;
+    private String socketSid;
+    private String roomCode;
+}

+ 57 - 63
src/main/java/thyyxxk/webserver/scheduled/QueryNotifiedPatients.java

@@ -1,63 +1,57 @@
-package thyyxxk.webserver.scheduled;
-
-import com.alibaba.fastjson.JSON;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import thyyxxk.webserver.dao.his.triage.TriageDao;
-import thyyxxk.webserver.entity.dictionary.PureCodeName;
-import thyyxxk.webserver.entity.triage.MessageForPush;
-import thyyxxk.webserver.entity.triage.MzfzPatientOrder;
-import thyyxxk.webserver.service.triage.PatientSidContainer;
-import thyyxxk.webserver.utils.VoiceUtil;
-import thyyxxk.webserver.websocket.WebSocketServer;
-
-import java.util.List;
-import java.util.concurrent.ConcurrentMap;
-
-@Slf4j
-@Component
-public class QueryNotifiedPatients {
-    private final TriageDao dao;
-    @Value("${execute-scheduled}")
-    private Boolean executeScheduled;
-
-    @Autowired
-    public QueryNotifiedPatients(TriageDao dao) {
-        this.dao = dao;
-    }
-
-    @Scheduled(fixedRate = 6000)
-    public void query() {
-        if (executeScheduled) {
-            ConcurrentMap<Integer, String> map = PatientSidContainer.getInstance().getSidPatientsMap();
-            if (map.isEmpty()) return;
-            List<PureCodeName> list = dao.getNotifiedSerialNos(map);
-            if (list == null || list.isEmpty()) return;
-            for (PureCodeName item : list) {
-                MzfzPatientOrder patient = dao.getPatientTriageInfo(Integer.parseInt(item.getCode()));
-                MessageForPush param = new MessageForPush();
-                param.setAction(1);
-                param.setSerialNo(patient.getSerialNo());
-                param.setFzNo(patient.getFzNo());
-                param.setName(patient.getName());
-                param.setDeptName(patient.getDeptName());
-                param.setRoomNo(patient.getRoomNo());
-                param.setRoomCode(patient.getRoomCode());
-                final String msg = JSON.toJSONString(param);
-                String text = String.format("请%s号%s,到%s%s号诊室就诊。", param.getFzNo(), param.getName(),
-                        param.getDeptName(), param.getRoomNo());
-                VoiceUtil.textToSpeech(text, String.valueOf(param.getSerialNo()));
-                String userCode = map.get(Integer.parseInt(item.getCode()));
-                int code1 = WebSocketServer.sendFloorTriageMessage(userCode, msg);
-                int code2 = WebSocketServer.sendRoomTriageMessage(item.getName(), msg);
-
-                if (code1 != 200 || code2 != 200) {
-                    PatientSidContainer.getInstance().delete(param.getSerialNo());
-                }
-            }
-        }
-    }
-}
+//package thyyxxk.webserver.scheduled;
+//
+//import com.alibaba.fastjson.JSON;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.scheduling.annotation.Scheduled;
+//import org.springframework.stereotype.Component;
+//import thyyxxk.webserver.dao.his.triage.TriageDao;
+//import thyyxxk.webserver.entity.triage.MessageForPush;
+//import thyyxxk.webserver.entity.triage.MzfzPatientOrder;
+//import thyyxxk.webserver.entity.triage.TriageNotifyRelation;
+//import thyyxxk.webserver.utils.VoiceUtil;
+//import thyyxxk.webserver.websocket.WebSocketServer;
+//
+//import java.util.List;
+//
+//@Slf4j
+//@Component
+//public class QueryNotifiedPatients {
+//    private final TriageDao dao;
+//    @Value("${execute-scheduled}")
+//    private Boolean executeScheduled;
+//
+//    @Autowired
+//    public QueryNotifiedPatients(TriageDao dao) {
+//        this.dao = dao;
+//    }
+//
+//    @Scheduled(fixedRate = 6000)
+//    public void query() {
+//        if (executeScheduled) {
+//            List<TriageNotifyRelation> unNotifiedList = dao.selectUnNotifiedList();
+//            if (null == unNotifiedList || unNotifiedList.isEmpty()) {
+//                return;
+//            }
+//            for (TriageNotifyRelation item : unNotifiedList) {
+//                MzfzPatientOrder patient = dao.getPatientTriageInfo(item.getSerialNo());
+//                MessageForPush param = new MessageForPush();
+//                param.setAction(1);
+//                param.setSerialNo(patient.getSerialNo());
+//                param.setFzNo(patient.getFzNo());
+//                param.setName(patient.getName());
+//                param.setDeptName(patient.getDeptName());
+//                param.setRoomNo(patient.getRoomNo());
+//                param.setRoomCode(patient.getRoomCode());
+//                final String msg = JSON.toJSONString(param);
+//                String text = String.format("请%s号%s,到%s%s号诊室就诊。", param.getFzNo(), param.getName(),
+//                        param.getDeptName(), param.getRoomNo());
+//                VoiceUtil.textToSpeech(text, String.valueOf(param.getSerialNo()));
+//                WebSocketServer.sendFloorTriageMessage(item.getSocketSid(), msg);
+//                WebSocketServer.sendRoomTriageMessage(item.getRoomCode(), msg);
+//                dao.updateNotifyDatetime(param.getSerialNo());
+//            }
+//        }
+//    }
+//}

+ 7 - 7
src/main/java/thyyxxk/webserver/service/LoginService.java

@@ -10,10 +10,7 @@ import thyyxxk.webserver.entity.dictionary.CodeName;
 import thyyxxk.webserver.entity.login.UserInfo;
 import thyyxxk.webserver.entity.login.VueMenu;
 import thyyxxk.webserver.entity.settings.permissions.MenuItem;
-import thyyxxk.webserver.utils.ResultVoUtil;
-import thyyxxk.webserver.utils.SnowFlakeId;
-import thyyxxk.webserver.utils.TokenUtil;
-import thyyxxk.webserver.utils.TreeUtil;
+import thyyxxk.webserver.utils.*;
 
 import java.util.HashMap;
 import java.util.List;
@@ -44,12 +41,12 @@ public class LoginService {
             }
             dao.insertNewUserToDjUserBase(tempUserInfo);
         }
-        if (!userInfo.getPassword().equals(tempUserInfo.getPassword())) {
+        if (!userInfo.getSid().equals("fromTriageScreen") && !userInfo.getPassword().equals(tempUserInfo.getPassword())) {
             return ResultVoUtil.fail(ExceptionEnum.INVALID_PASSWORD);
         }
         String token = tokenService.getToken(tempUserInfo);
         tempUserInfo.setToken(token);
-        tempUserInfo.setSid(makeSid(tempUserInfo.getCode(), token));
+        tempUserInfo.setSid(makeSid(tempUserInfo.getCode(), token, userInfo.getSid()));
         tempUserInfo.setRoles(dao.getUserRoles(tempUserInfo.getCode()));
         tempUserInfo.setDeptName(dao.getDeptName(tempUserInfo.getDeptCode()));
         return ResultVoUtil.success(tempUserInfo);
@@ -90,13 +87,16 @@ public class LoginService {
         return dao.findUserByCode(code);
     }
 
-    private String makeSid(String code, String token) {
+    private String makeSid(String code, String token, String sid) {
         String tempToken = token.replaceAll("\\.", "")
                 .replaceAll("_", "")
                 .replaceAll("-", "");
         String flakeIdSub = "-" + SnowFlakeId.instance().nextId() + "-";
         int random = new Random().nextInt(80);
         String tokenSub = tempToken.substring(random, random + 18);
+        if (StringUtil.notBlank(sid) && sid.equals("fromTriageScreen")) {
+            tokenSub += "-triageFloorScreen";
+        }
         return code + flakeIdSub + tokenSub;
     }
 }

+ 16 - 0
src/main/java/thyyxxk/webserver/service/examinations/InspectionsService.java

@@ -10,6 +10,7 @@ import org.dom4j.Document;
 import org.dom4j.DocumentException;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
@@ -17,6 +18,7 @@ import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.examinations.inspections.InspectionsIndex;
 import thyyxxk.webserver.entity.examinations.inspections.QueryInspectionParam;
 import thyyxxk.webserver.entity.examinations.inspections.detail.*;
+import thyyxxk.webserver.service.externalhttp.ThmzSystem;
 import thyyxxk.webserver.utils.DateUtil;
 import thyyxxk.webserver.utils.FilterUtil;
 import thyyxxk.webserver.utils.ResultVoUtil;
@@ -28,6 +30,7 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
 /**
@@ -36,13 +39,26 @@ import java.util.concurrent.CompletableFuture;
 @Service
 @Slf4j
 public class InspectionsService {
+    private final ThmzSystem thmz;
     private static final String SOAP_URL = "http://172.16.32.178:622/pushservice.asmx?wsdl";
     private static final String UNDEFINED = "undefined";
     private static final String SUCCESS = "1";
     private static final String ERROR = "0";
 
+    @Autowired
+    public InspectionsService(ThmzSystem thmz) {
+        this.thmz = thmz;
+    }
+
     @Async
     public CompletableFuture<ResultVo<List<InspectionsIndex>>> queryInspectionsIndex(QueryInspectionParam param) {
+        if (param.getType() == 0) {
+            Map<String, Object> parent = thmz.getParentIdByPatientId(param.getContent());
+            if ((int) parent.get("code") == 0) {
+                List<Map<String, String>> list = FilterUtil.cast(parent.get("data"));
+                param.setContent(list.get(0).get("parentPatientId"));
+            }
+        }
         String send = "<message>" +
                 "<PATIENT_TYPE>" + param.getType() + "</PATIENT_TYPE>" +
                 "<PTNT_NO>" + param.getContent() + "</PTNT_NO>" +

+ 3 - 0
src/main/java/thyyxxk/webserver/service/externalhttp/ThmzSystem.java

@@ -28,4 +28,7 @@ public interface ThmzSystem {
 
     @Get("/getPatientIdByParentId?patientId={patientId}")
     Map<String, Object> getPatientIdByParentId(@Var("patientId") String patientId);
+
+    @Get("/getParentIdByPatientId?patientId={patientId}")
+    Map<String, Object> getParentIdByPatientId(@Var("patientId") String patientId);
 }

+ 0 - 42
src/main/java/thyyxxk/webserver/service/triage/PatientSidContainer.java

@@ -1,42 +0,0 @@
-package thyyxxk.webserver.service.triage;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * @author dj
- */
-public class PatientSidContainer {
-    private static PatientSidContainer instance;
-
-    /**
-     * <Integer, String> >>> <serialNo, userCode>
-     * */
-    private final ConcurrentMap<Integer, String> patientSidMap;
-
-    private PatientSidContainer() {
-        patientSidMap = new ConcurrentHashMap<>();
-    }
-
-    public synchronized static PatientSidContainer getInstance() {
-        if (null == instance) {
-            synchronized (PatientSidContainer.class) {
-                instance = new PatientSidContainer();
-            }
-        }
-        return instance;
-    }
-
-    public ConcurrentMap<Integer, String> getSidPatientsMap() {
-        return patientSidMap;
-    }
-
-    public void put(Integer serialNo, String userCode) {
-        getSidPatientsMap().put(serialNo, userCode);
-    }
-
-    public boolean delete(Integer serialNo) {
-        String userCode = getSidPatientsMap().get(serialNo);
-        return getSidPatientsMap().remove(serialNo, userCode);
-    }
-}

+ 46 - 26
src/main/java/thyyxxk/webserver/service/triage/TriageService.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.service.triage;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
@@ -16,6 +17,8 @@ import thyyxxk.webserver.entity.triage.*;
 import thyyxxk.webserver.utils.ResultVoUtil;
 import thyyxxk.webserver.utils.StringUtil;
 import thyyxxk.webserver.utils.TokenUtil;
+import thyyxxk.webserver.utils.VoiceUtil;
+import thyyxxk.webserver.websocket.WebSocketServer;
 
 import java.util.*;
 
@@ -53,6 +56,11 @@ public class TriageService {
         return ResultVoUtil.success(dao.getTriagedPatients(depts));
     }
 
+    public ResultVo<List<MzfzPatientOrder>> getTreatedPatients() {
+        String[] depts = StringUtil.triageDeptString2Array(dao.selectChosenDepts(TokenUtil.getTokenUserId()));
+        return ResultVoUtil.success(dao.getTreatedPatients(depts));
+    }
+
     public ResultVo<List<FloorScreen>> getBigScreenData(Boolean fullName) {
         String[] depts = StringUtil.triageDeptString2Array(dao.selectChosenDepts(TokenUtil.getTokenUserId()));
         List<MzfzPatientOrder> list = dao.getBigScreenData(depts);
@@ -123,17 +131,18 @@ public class TriageService {
         }
         dao.updatePatientNum(room.getDeptCode(), room.getRoomCode(), patientNum);
         dao.fenZhen(room);
-        log.info("分诊:update mzfz_patient_order set status_flag=1, slow_flag=0, " +
-                        "dept_code={}, room_code={}, doctor_code={}, fz_no={} where serial_no={}",
+        log.info("分诊:update mzfz_patient_order set status_flag=1, slow_flag=0, dept_code={}, room_code={}, " +
+                        "doctor_code={}, fz_no={}, fz_flag={} where serial_no={}",
                 room.getDeptCode(), room.getRoomCode(), room.getDoctorCode(),
-                room.getPatientNum(), room.getSerialNo());
-        PatientSidContainer.getInstance().put(room.getSerialNo(), TokenUtil.getTokenUserId());
+                room.getPatientNum(), room.getFuzhenFlag(), room.getSerialNo());
+        dao.deleteNotifyRelation(room.getSerialNo());
+        dao.insertNotifyRelation(room.getSerialNo(), TokenUtil.getTokenUserId(), room.getRoomCode());
         return ResultVoUtil.success("分诊成功。");
     }
 
-    public ResultVo<Boolean> notifyComplete(Integer serialNo) {
+    public void notifyComplete(Integer serialNo) {
         log.info("通知完毕>>> {}", serialNo);
-        return ResultVoUtil.success(PatientSidContainer.getInstance().delete(serialNo));
+        dao.updateNotifyDatetime(serialNo);
     }
 
     public ResultVo<Integer> fuZhen(Integer serialNo) {
@@ -142,7 +151,7 @@ public class TriageService {
 
     public ResultVo<Integer> cancelTriage(Integer serialNo) {
         Integer ret = dao.cancelTriage(serialNo);
-        PatientSidContainer.getInstance().delete(serialNo);
+        dao.deleteNotifyRelation(serialNo);
         return ResultVoUtil.success(ret);
     }
 
@@ -179,26 +188,37 @@ public class TriageService {
     }
 
     public ResultVo<String> notifyMessage(MessageForPush param) {
-        MessageForPush prm = dao.selectMessageForPush(param.getSerialNo());
-        if (null == prm) {
+        MessageForPush messageForPush = dao.selectMessageForPush(param.getSerialNo());
+        if (null == messageForPush) {
             return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "没有找到此患者的分诊信息!");
         }
-        prm.setAction(param.getAction());
-        log.info("消息推送>>> {}", prm);
-        RestTemplate template = new RestTemplate();
-        String result;
-        try {
-            result = template.postForObject(triageNotifyUrl, prm, String.class);
-        } catch (Exception e) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
-        if (param.getAction() == 1) {
-            if (null != result && result.equals("0")) {
-                dao.updateStatus(param.getSerialNo());
-            } else {
-                log.error("消息推送失败,没有找到在线的分诊台连接。{}", prm);
-            }
-        }
-        return ResultVoUtil.success(result);
+        messageForPush.setAction(param.getAction());
+        String text = String.format("请%s号%s,到%s%s号诊室就诊。", messageForPush.getFzNo(), messageForPush.getName(),
+                messageForPush.getDeptName(), messageForPush.getRoomNo());
+        log.info("消息推送>>> {}\n{}", messageForPush, text);
+        // todo 下面这部分在完成迁移后启用
+        VoiceUtil.textToSpeech(text, String.valueOf(param.getSerialNo()));
+        final String msg = JSON.toJSONString(messageForPush);
+        TriageNotifyRelation notifyRelation = dao.selectTriageNotifyRelation(messageForPush.getSerialNo());
+        WebSocketServer.sendFloorTriageMessage(notifyRelation.getSocketSid(), msg);
+        WebSocketServer.sendRoomTriageMessage(notifyRelation.getRoomCode(), msg);
+        dao.updateNotifyDatetime(param.getSerialNo());
+        return ResultVoUtil.success();
+        // todo 下面这一部分在完成迁移后删除
+//        RestTemplate template = new RestTemplate();
+//        String result;
+//        try {
+//            result = template.postForObject(triageNotifyUrl, messageForPush, String.class);
+//        } catch (Exception e) {
+//            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+//        }
+//        if (param.getAction() == 1) {
+//            if (null != result && result.equals("0")) {
+//                dao.updateStatus(param.getSerialNo());
+//            } else {
+//                log.error("消息推送失败,没有找到在线的分诊台连接。{}", messageForPush);
+//            }
+//        }
+//        return ResultVoUtil.success(result);
     }
 }

+ 12 - 15
src/main/java/thyyxxk/webserver/websocket/WebSocketServer.java

@@ -1,6 +1,5 @@
 package thyyxxk.webserver.websocket;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
@@ -12,7 +11,6 @@ import javax.websocket.server.ServerEndpoint;
 import java.io.IOException;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
 /**
@@ -27,11 +25,13 @@ public class WebSocketServer {
 
     @OnOpen
     public void onOpen(Session session, @PathParam("sid") String sid) {
-        SESSION_MAP.forEach((item, index) -> {
-            if (sid.split("-")[0].equals(item.split("-")[0])) {
-                sendMessageByWebSocketSidSingle(item);
-            }
-        });
+        if (!sid.endsWith("Screen")) {
+            SESSION_MAP.forEach((item, index) -> {
+                if (sid.split("-")[0].equals(item.split("-")[0])) {
+                    sendMessageByWebSocketSidSingle(item);
+                }
+            });
+        }
         SESSION_MAP.put(sid, session);
         ONLINE_COUNT.incrementAndGet();
         log.info("有新连接加入:{},当前在线人数为:{}", sid, ONLINE_COUNT.get());
@@ -68,32 +68,29 @@ public class WebSocketServer {
         }
     }
 
-    public static int sendFloorTriageMessage(String userCode, String message) {
+    public static void sendFloorTriageMessage(String userCode, String message) {
         for (Map.Entry<String, Session> entry : SESSION_MAP.entrySet()) {
             if (entry.getKey().startsWith(userCode) && entry.getKey().endsWith("triageFloorScreen")) {
                 try {
                     entry.getValue().getBasicRemote().sendText(message);
-                    return 200;
+                    return;
                 } catch (Exception e) {
                     log.error("【sid: " + userCode + "】Socket发送导诊台通知出错", e);
-                    return ExceptionEnum.INTERNAL_SERVER_ERROR.getCode();
+                    return;
                 }
             }
         }
-        return ExceptionEnum.NULL_POINTER.getCode();
     }
 
-    public static int sendRoomTriageMessage(String roomCode, String message) {
+    public static void sendRoomTriageMessage(String roomCode, String message) {
         Session session = SESSION_MAP.get(roomCode + "-triageRoomScreen");
         if (null == session) {
-            return ExceptionEnum.NULL_POINTER.getCode();
+            return;
         }
         try {
             session.getBasicRemote().sendText(message);
-            return 200;
         } catch (Exception e) {
             log.error("【sid: " + roomCode + "】Socket发送诊室屏显通知出错", e);
-            return ExceptionEnum.INTERNAL_SERVER_ERROR.getCode();
         }
     }