|
@@ -1,10 +1,12 @@
|
|
|
package com.nb.app.assistant.service;
|
|
package com.nb.app.assistant.service;
|
|
|
|
|
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
-import com.nb.app.assistant.entity.AssistantUserBindEntity;
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.nb.app.assistant.api.entity.AssistantUserBindEntity;
|
|
|
|
|
+import com.nb.app.assistant.api.feign.IAssistantUserBindClient;
|
|
|
import com.nb.app.assistant.entity.AssistantUserEntity;
|
|
import com.nb.app.assistant.entity.AssistantUserEntity;
|
|
|
-import com.nb.app.assistant.enums.ApplyEnum;
|
|
|
|
|
-import com.nb.app.assistant.enums.BindEnum;
|
|
|
|
|
|
|
+import com.nb.app.assistant.api.enums.ApplyEnum;
|
|
|
|
|
+import com.nb.app.assistant.api.enums.BindEnum;
|
|
|
import com.nb.app.assistant.mapper.AssistantUserBindMapper;
|
|
import com.nb.app.assistant.mapper.AssistantUserBindMapper;
|
|
|
import com.nb.app.msg.bean.MsgBean;
|
|
import com.nb.app.msg.bean.MsgBean;
|
|
|
import com.nb.app.msg.enums.MsgEnum;
|
|
import com.nb.app.msg.enums.MsgEnum;
|
|
@@ -16,6 +18,8 @@ import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @author lifang
|
|
* @author lifang
|
|
|
* @version 1.0.0
|
|
* @version 1.0.0
|
|
@@ -24,7 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
* @createTime 2022年08月10日 10:27:00
|
|
* @createTime 2022年08月10日 10:27:00
|
|
|
*/
|
|
*/
|
|
|
@Component
|
|
@Component
|
|
|
-public class LocalAssistantUserBindService extends BaseService<AssistantUserBindMapper, AssistantUserBindEntity,String> {
|
|
|
|
|
|
|
+public class LocalAssistantUserBindService extends BaseService<AssistantUserBindMapper, AssistantUserBindEntity,String> implements IAssistantUserBindClient {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
@Lazy
|
|
@Lazy
|
|
@@ -49,7 +53,8 @@ public class LocalAssistantUserBindService extends BaseService<AssistantUserBind
|
|
|
String id = String.valueOf(SecurityUtil.getId());
|
|
String id = String.valueOf(SecurityUtil.getId());
|
|
|
AssistantUserEntity currentUser = userService.getById(id);
|
|
AssistantUserEntity currentUser = userService.getById(id);
|
|
|
entity.setStatus(BindEnum.WAITING);
|
|
entity.setStatus(BindEnum.WAITING);
|
|
|
- entity.setUserId(currentUser.getId());
|
|
|
|
|
|
|
+ entity.setAssistId(currentUser.getId());
|
|
|
|
|
+ entity.setAssistNickname(currentUser.getNickname());
|
|
|
boolean result = this.baseMapper.insert(entity) == 1;
|
|
boolean result = this.baseMapper.insert(entity) == 1;
|
|
|
|
|
|
|
|
if(result){
|
|
if(result){
|
|
@@ -59,8 +64,8 @@ public class LocalAssistantUserBindService extends BaseService<AssistantUserBind
|
|
|
.msgType(ApplyEnum.INVITE_CODE.equals(entity.getApplyType())?
|
|
.msgType(ApplyEnum.INVITE_CODE.equals(entity.getApplyType())?
|
|
|
MsgEnum.CODE_BIND_NOTIFY:MsgEnum.MANUAL_BIND_NOTIFY)
|
|
MsgEnum.CODE_BIND_NOTIFY:MsgEnum.MANUAL_BIND_NOTIFY)
|
|
|
.payload(entity.getId())
|
|
.payload(entity.getId())
|
|
|
- .sender(entity.getUserId())
|
|
|
|
|
- .senderName(currentUser.getNickName())
|
|
|
|
|
|
|
+ .sender(entity.getAssistId())
|
|
|
|
|
+ .senderName(currentUser.getNickname())
|
|
|
.patientId(entity.getPatientId())
|
|
.patientId(entity.getPatientId())
|
|
|
.patientCode(entity.getPatientCode())
|
|
.patientCode(entity.getPatientCode())
|
|
|
.patientName(entity.getPatientName())
|
|
.patientName(entity.getPatientName())
|
|
@@ -80,8 +85,34 @@ public class LocalAssistantUserBindService extends BaseService<AssistantUserBind
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- @Transactional(readOnly = true)
|
|
|
|
|
|
|
+ @Transactional
|
|
|
public void painCall(String bindId) {
|
|
public void painCall(String bindId) {
|
|
|
- AssistantUserBindEntity byId = this.getById(bindId);
|
|
|
|
|
|
|
+ //todo
|
|
|
|
|
+ AssistantUserBindEntity userBind = this.getById(bindId);
|
|
|
|
|
+ AssistantUserEntity user = userService.getById(userBind.getAssistId());
|
|
|
|
|
+ SpringUtil.publishEvent(new SaveMsgEvent(
|
|
|
|
|
+ this,
|
|
|
|
|
+ MsgBean.builder()
|
|
|
|
|
+ .msgType(ApplyEnum.INVITE_CODE.equals(userBind.getApplyType())?
|
|
|
|
|
+ MsgEnum.CODE_BIND_NOTIFY:MsgEnum.MANUAL_BIND_NOTIFY)
|
|
|
|
|
+ .payload(userBind.getPatientId())
|
|
|
|
|
+ .sender(userBind.getAssistId())
|
|
|
|
|
+ .senderName(user.getNickname())
|
|
|
|
|
+ .patientId(userBind.getPatientId())
|
|
|
|
|
+ .patientCode(userBind.getPatientCode())
|
|
|
|
|
+ .patientName(userBind.getPatientName())
|
|
|
|
|
+ .receiver(userBind.getDoctorId())
|
|
|
|
|
+ .receiverName(userBind.getDoctorName())
|
|
|
|
|
+ .sys(false)
|
|
|
|
|
+ .build()
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<AssistantUserBindEntity> list(String doctorId) {
|
|
|
|
|
+ return this.list(new QueryWrapper<AssistantUserBindEntity>()
|
|
|
|
|
+ .lambda()
|
|
|
|
|
+ .eq(AssistantUserBindEntity::getDoctorId,doctorId)
|
|
|
|
|
+ .eq(AssistantUserBindEntity::getStatus,BindEnum.SUCCESS));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|