lifang 3 месяцев назад
Родитель
Сommit
10407b19b1

+ 2 - 0
tr-modules-api/tr-module-system-api/src/main/java/cn/tr/module/api/sys/tenant/SysTenantApi.java

@@ -11,5 +11,7 @@ import java.util.*;
 public interface SysTenantApi {
     List<SysTenantPojo> selectAll();
 
+    SysTenantPojo selectById(String id);
+
     SysTenantPojo selectByHospitalCode(String hospitalCode);
 }

+ 9 - 0
tr-modules/tr-module-mobile/src/main/java/cn/tr/module/mobile/dto/MsgDTO.java

@@ -39,4 +39,13 @@ public class MsgDTO {
         msgDTO.setMsgId(IdWorker.getIdStr());
         return msgDTO;
     }
+
+    public static MsgDTO noneMsg(String clinicId,String fromUserId){
+        MsgDTO msgDTO = new MsgDTO();
+        msgDTO.setClinicId(clinicId);
+        msgDTO.setType(MsgContentType.DOCTOR_NONE);
+        msgDTO.setFromUserId(fromUserId);
+        msgDTO.setMsgId(IdWorker.getIdStr());
+        return msgDTO;
+    }
 }

+ 5 - 0
tr-modules/tr-module-mobile/src/main/java/cn/tr/module/mobile/enums/MsgContentType.java

@@ -35,4 +35,9 @@ public interface MsgContentType {
      * 医生退出
      */
     String DOCTOR_OUT="dOut";
+
+    /**
+     * 初始化时医生未进入
+     */
+    String DOCTOR_NONE="dNone";
 }

+ 8 - 6
tr-modules/tr-module-mobile/src/main/java/cn/tr/module/mobile/service/impl/ImMsgReceivedServiceImpl.java

@@ -92,13 +92,15 @@ public class ImMsgReceivedServiceImpl implements IImMsgReceivedService {
             TenantContextHolder.setIgnore(Boolean.TRUE);
             groupUserRepository.readAllMsg(loginInfo.getClinicId(), loginInfo.getUserId());
             TenantContextHolder.setIgnore(Boolean.FALSE);
-            //判断医生是否在线
-            if (self.doctorIsOnline(loginInfo.getClinicId())) {
-                try{
+            try{
+                //判断医生是否在线
+                if (self.doctorIsOnline(loginInfo.getClinicId())) {
                     sendMsg(MsgDTO.onlineMsg(loginInfo.getClinicId(),loginInfo.getUserId()),Boolean.FALSE);
-                }catch (Exception e){
-                    log.warn("发送消息失败:{%s}",e.getMessage());
+                }else {
+                    sendMsg(MsgDTO.noneMsg(loginInfo.getClinicId(),loginInfo.getUserId()),Boolean.FALSE);
                 }
+            }catch (Exception e){
+                log.warn("发送消息失败:{%s}",e.getMessage());
             }
         };
 
@@ -114,7 +116,7 @@ public class ImMsgReceivedServiceImpl implements IImMsgReceivedService {
             final Protocal p = ProtocalFactory.createCommonData(JSONUtil.toJsonStr(msg), "0", toUser, true, msg.getMsgId(), -1);
             MBObserver resultObserver = new MBObserver() {
                 public void update(boolean b, Object o) {
-                    if (b) {
+                    if (b&&Boolean.TRUE.equals(offlineSave)) {
                         //更新已读消息
                         ServerEventCallbackHandler.onTransfer4S2CMessageSuccess.accept(msg);
                     }

+ 7 - 6
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/service/impl/BizWxUserServiceImpl.java

@@ -6,13 +6,13 @@ import cn.hutool.core.util.StrUtil;
 import cn.tr.core.annotation.TenantIgnore;
 import cn.tr.core.exception.TRExcCode;
 import cn.tr.core.strategy.LoginUserStrategy;
+import cn.tr.module.api.sys.tenant.SysTenantApi;
+import cn.tr.module.api.sys.tenant.SysTenantPojo;
 import cn.tr.module.smart.common.po.BizHospitalPO;
 import cn.tr.module.smart.common.po.BizWxUserHospitalPO;
-import cn.tr.module.smart.common.repository.BizHospitalRepository;
 import cn.tr.module.smart.common.repository.BizWxUserHospitalRepository;
 import cn.tr.module.smart.wx.controller.vo.BizWxUserBindHospitalVO;
 import cn.tr.module.smart.wx.dto.BizWxUserShiftHospitalDTO;
-import cn.tr.module.sys.user.service.ISysUserService;
 import cn.tr.plugin.security.bo.UserLoginInfoBO;
 import cn.tr.plugin.security.constant.SecurityConstant;
 import cn.tr.plugin.security.context.LoginUserContextHolder;
@@ -53,10 +53,11 @@ public class BizWxUserServiceImpl implements IBizWxUserService {
     @Autowired
     private BizWxUserHospitalRepository wxUserHospitalRepository;
 
-    @Autowired
-    private BizHospitalRepository hospitalRepository;
+
     @Autowired
     private WxMpService wxMpService;
+    @Autowired
+    private SysTenantApi sysTenantApi;
 
     @Autowired
     @Lazy
@@ -190,8 +191,8 @@ public class BizWxUserServiceImpl implements IBizWxUserService {
     @Override
     public void bindHospital(String currentUserId, String hospitalId) {
         //判断医院是否存在
-        BizHospitalPO hospital = hospitalRepository.selectById(hospitalId);
-        if(ObjectUtil.isEmpty(hospital)){
+        SysTenantPojo tenant = sysTenantApi.selectById(hospitalId);
+        if(ObjectUtil.isEmpty(tenant)){
             throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"医院不存在");
         }
         BizWxUserHospitalPO bizWxUserHospital = wxUserHospitalRepository.selectOne(new LambdaQueryWrapper<BizWxUserHospitalPO>()

+ 5 - 0
tr-modules/tr-module-system/src/main/java/cn/tr/module/sys/user/provider/SysTenantApiProvider.java

@@ -26,6 +26,11 @@ public class SysTenantApiProvider implements SysTenantApi {
         return SysTenantMapper.INSTANCE.toPojoList(repository.selectList(new LambdaQueryWrapper<>()));
     }
 
+    @Override
+    public SysTenantPojo selectById(String id) {
+        return SysTenantMapper.INSTANCE.toPojo(repository.selectById(id));
+    }
+
     @Override
     public SysTenantPojo selectByHospitalCode(String hospitalCode) {
         return SysTenantMapper.INSTANCE.toPojo(