|
@@ -8,7 +8,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.web.client.RestTemplate;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.constants.Capacity;
|
|
|
import thyyxxk.webserver.dao.his.outpatient.triage.TriageDao;
|
|
@@ -17,6 +16,7 @@ import thyyxxk.webserver.entity.dictionary.CodeName;
|
|
|
import thyyxxk.webserver.entity.outpatient.triage.*;
|
|
|
import thyyxxk.webserver.entity.socketmessage.ApiMessageBody;
|
|
|
import thyyxxk.webserver.service.externalhttp.WebSocketService;
|
|
|
+import thyyxxk.webserver.service.outpatient.wxapi.SendWxInfoService;
|
|
|
import thyyxxk.webserver.utils.DateUtil;
|
|
|
import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
import thyyxxk.webserver.utils.StringUtil;
|
|
@@ -34,10 +34,12 @@ public class TriageService {
|
|
|
@Value("${triage-notify-url}")
|
|
|
private String triageNotifyUrl;
|
|
|
private final WebSocketService socketService;
|
|
|
+ private final SendWxInfoService sendWxInfoService;
|
|
|
|
|
|
- public TriageService(TriageDao dao, WebSocketService socketService) {
|
|
|
+ public TriageService(TriageDao dao, WebSocketService socketService, SendWxInfoService sendWxInfoService) {
|
|
|
this.dao = dao;
|
|
|
this.socketService = socketService;
|
|
|
+ this.sendWxInfoService = sendWxInfoService;
|
|
|
}
|
|
|
|
|
|
public ResultVo<Map<String, Object>> getUnTriagedPatients(Integer currentPage, Integer pageSize) {
|
|
@@ -242,8 +244,7 @@ public class TriageService {
|
|
|
|
|
|
private ResultVo<String> notifyVipReq(int serialNo) {
|
|
|
MessageForPush vipRegMessage = dao.selectVipRegMessage(serialNo);
|
|
|
- String message = String.format("患者<span style=\"color:red;font-weight:bold\">%s</span>" +
|
|
|
- "预约了国际医疗部,预约就诊时间为<span style=\"font-weight:bold;color: red\">%s</span>",
|
|
|
+ String message = String.format("患者【%s】预约了国际医疗部,预约就诊时间为【%s】",
|
|
|
vipRegMessage.getName(), DateUtil.formatDatetime(vipRegMessage.getVisitDate()));
|
|
|
JSONObject messageWrapper = new JSONObject();
|
|
|
messageWrapper.put("name", "systemNotification");
|
|
@@ -251,16 +252,22 @@ public class TriageService {
|
|
|
messageBody.put("title", "提醒");
|
|
|
messageBody.put("message", message);
|
|
|
messageWrapper.put("message", messageBody);
|
|
|
-
|
|
|
List<String> vipTriageUsers = dao.selectVipTriageUser();
|
|
|
- if (vipTriageUsers.isEmpty()) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "没有国际医疗部的分诊人员。");
|
|
|
+ if (!vipTriageUsers.isEmpty()) {
|
|
|
+ ApiMessageBody body = new ApiMessageBody(messageWrapper.toJSONString());
|
|
|
+ for (String userCode : vipTriageUsers) {
|
|
|
+ body.setUserCode(userCode);
|
|
|
+ socketService.sendMessageByUserCode(body);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- ApiMessageBody body = new ApiMessageBody(messageWrapper.toJSONString());
|
|
|
- for (String userCode : vipTriageUsers) {
|
|
|
- body.setUserCode(userCode);
|
|
|
- socketService.sendMessageByUserCode(body);
|
|
|
+ List<String> codeRsList = dao.selectCodeRsList();
|
|
|
+ if (!codeRsList.isEmpty()) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ for (String codeRs : codeRsList) {
|
|
|
+ sb.append("|").append(codeRs);
|
|
|
+ }
|
|
|
+ String touser = sb.substring(1);
|
|
|
+ sendWxInfoService.sendCorpWxMsg(touser, message);
|
|
|
}
|
|
|
return ResultVoUtil.success();
|
|
|
}
|