Browse Source

有出院申请时向医保科发送消息。

lighter 1 year ago
parent
commit
27182cb544

+ 1 - 0
src/main/java/thyyxxk/webserver/entity/socketmessage/ApiMessageBody.java

@@ -11,6 +11,7 @@ public class ApiMessageBody {
     private String roomCode;
     private String documentId;
     private Session session;
+    private String groupId;
     private String messageContent;
 
     public ApiMessageBody() {

+ 5 - 3
src/main/java/thyyxxk/webserver/service/externalhttp/WebSocketService.java

@@ -12,10 +12,13 @@ public interface WebSocketService {
     @Post("/sendMessageBySid")
     ResultVo<String> sendMessageBySid(@JSONBody ApiMessageBody body);
 
-    @Post(value = "/sendMessageByUserCode" , async = true)
+    @Post(value = "/sendMessageByUserCode", async = true)
     ResultVo<String> sendMessageByUserCode(@JSONBody ApiMessageBody body);
 
-    @Post("/sendMessageToAll")
+    @Post(value = "/sendMessageByGroupId", async = true)
+    void sendMessageByGroupId(@JSONBody ApiMessageBody body);
+
+    @Post(value = "/sendMessageToAll", async = true)
     void sendMessageToAll(@JSONBody ApiMessageBody body);
 
     @Get("/getOnlineCount")
@@ -39,7 +42,6 @@ public interface WebSocketService {
     @Get(value = "/textToSpeech?text={text}&id={id}", timeout = 5000)
     ResultVo<String> textToSpeech(@Var("text") String text, @Var("id") String id);
 
-
     @Get(value = "/getWeComAddressBookToken", timeout = 1000)
     String getWeComAddressBookToken();
 

+ 18 - 1
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiSettleApplyService.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.service.medicalinsurance;
 
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
@@ -13,6 +14,8 @@ import thyyxxk.webserver.entity.inpatient.dismiss.ZyDisYbDiag;
 import thyyxxk.webserver.entity.inpatient.dismiss.ZyDisYbSrgry;
 import thyyxxk.webserver.entity.inpatient.patient.Patient;
 import thyyxxk.webserver.entity.inpatient.patient.ZyInYbDiag;
+import thyyxxk.webserver.entity.socketmessage.ApiMessageBody;
+import thyyxxk.webserver.service.externalhttp.WebSocketService;
 import thyyxxk.webserver.service.inpatient.casefrontsheet.CaseFrontSheetMainService;
 import thyyxxk.webserver.service.redislike.RedisLikeService;
 import thyyxxk.webserver.service.inpatient.PatientService;
@@ -37,15 +40,17 @@ public class SiSettleApplyService {
     private final RedisLikeService redis;
     private final PatientService ptntSrvc;
     private final CaseFrontSheetMainService csfrntSrvc;
+    private final WebSocketService socketService;
     private static final Integer APPROVED = 1;
     private static final Integer REAL_SETTLE = 1;
     private static final Integer MIDDLE_SETTLE = 2;
 
-    public SiSettleApplyService(SiSettleApplyDao dao, RedisLikeService redis, PatientService ptntSrvc, CaseFrontSheetMainService csfrntSrvc) {
+    public SiSettleApplyService(SiSettleApplyDao dao, RedisLikeService redis, PatientService ptntSrvc, CaseFrontSheetMainService csfrntSrvc, WebSocketService socketService) {
         this.dao = dao;
         this.redis = redis;
         this.ptntSrvc = ptntSrvc;
         this.csfrntSrvc = csfrntSrvc;
+        this.socketService = socketService;
     }
 
     public ResultVo<SiSettleApply> selectSettleApply(Patient p) {
@@ -88,6 +93,18 @@ public class SiSettleApplyService {
         apply.setSortNo(apply.getSortNo() + 1);
         apply.setInputStaff(TokenUtil.getInstance().getTokenUserId());
         dao.insertSettleApply(apply);
+
+        JSONObject messageWrapper = new JSONObject();
+        messageWrapper.put("name", "systemNotification");
+        JSONObject messageBody = new JSONObject();
+        messageBody.put("title", "提示");
+        messageBody.put("message", "【住院号:" + apply.getPatNo() + "】有新的出院申请。");
+        messageWrapper.put("message", messageBody);
+        ApiMessageBody body = new ApiMessageBody();
+        body.setGroupId("3020100");
+        body.setMessageContent(messageWrapper.toJSONString());
+        socketService.sendMessageByGroupId(body);
+
         return ResultVoUtil.success("提交成功。");
     }