|
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.ccsens.recovery.bean.dto.HospitalDto; |
|
|
|
import com.ccsens.recovery.bean.dto.PatientDto; |
|
|
|
import com.ccsens.recovery.bean.message.RecoveryWithActionFeedBack; |
|
|
|
import com.ccsens.recovery.bean.message.RecoveryWithCountdown; |
|
|
|
import com.ccsens.recovery.bean.message.RecoveryWithStartDrill; |
|
|
|
import com.ccsens.recovery.bean.po.*; |
|
|
|
import com.ccsens.recovery.bean.vo.PatientVo; |
|
|
@ -19,6 +20,7 @@ import com.ccsens.util.bean.message.common.MessageConstant; |
|
|
|
import com.ccsens.util.bean.message.common.MessageRule; |
|
|
|
import com.ccsens.util.config.RabbitMQConfig; |
|
|
|
import com.ccsens.util.message.SwitchoverProjectUtil; |
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.amqp.core.AmqpTemplate; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -302,12 +304,28 @@ public class PatientService implements IPatientService{ |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void countdown(PatientDto.PatientId param, Long userId) { |
|
|
|
public void countdown(PatientDto.PatientId param, Long userId) throws Exception { |
|
|
|
Set<String> userIdSet = new HashSet<>(); |
|
|
|
//查询患者信息
|
|
|
|
Patient patient = patientDao.selectByPrimaryKey(param.getId()); |
|
|
|
if(ObjectUtil.isNotNull(patient)){ |
|
|
|
userIdSet.add(patient.getUserId().toString()); |
|
|
|
|
|
|
|
} |
|
|
|
//消息规则
|
|
|
|
MessageRule messageRule = MessageRule.defaultRule(MessageConstant.DomainType.User); |
|
|
|
messageRule.setAckRule(MessageRule.AckRule.NONE); |
|
|
|
messageRule.setOfflineDiscard((byte) 1); |
|
|
|
//生成消息
|
|
|
|
RecoveryWithCountdown recoveryWithCountdown = new RecoveryWithCountdown(); |
|
|
|
|
|
|
|
InMessage inMessage = new InMessage(); |
|
|
|
inMessage.setToDomain(MessageConstant.DomainType.User); |
|
|
|
inMessage.setTos(userIdSet); |
|
|
|
inMessage.setData(JacksonUtil.beanToJson(recoveryWithCountdown)); |
|
|
|
inMessage.setRule(messageRule); |
|
|
|
log.info("倒计时结束:{}",inMessage); |
|
|
|
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME, |
|
|
|
JacksonUtil.beanToJson(inMessage)); |
|
|
|
} |
|
|
|
} |
|
|
|