|
|
@ -158,6 +158,8 @@ public class PatientService implements IPatientService{ |
|
|
|
Object o = redisUtil.get(Constant.Redis.RECORD_SCORE + recRecord.getId()); |
|
|
|
data.setScore(o == null ? 0 : (Integer) o); |
|
|
|
data.setSubTaskId(projectDecompose.getTaskId()); |
|
|
|
data.setStatus(1); |
|
|
|
|
|
|
|
recoveryWithStartDrill.setData(data); |
|
|
|
//用pt的WS发送消息
|
|
|
|
//查询接收者
|
|
|
@ -176,6 +178,8 @@ public class PatientService implements IPatientService{ |
|
|
|
log.info("开始训练消息:{}",inMessage); |
|
|
|
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME, |
|
|
|
JacksonUtil.beanToJson(inMessage)); |
|
|
|
//用新ws给患者再发一条消息
|
|
|
|
ChannelManager.sendTo(patient.getUserId().toString(), OutMessageSet.newInstance().ackId(null).add(new OutMessage(JacksonUtil.beanToJson(recoveryWithStartDrill)))); |
|
|
|
//给机器人发送消息,用新的WS
|
|
|
|
RecoveryRobot recoveryRobot = patientDao.getRobotByPatientId(param.getPatientId()); |
|
|
|
if(ObjectUtil.isNotNull(recoveryRobot)){ |
|
|
@ -203,17 +207,21 @@ public class PatientService implements IPatientService{ |
|
|
|
RecoveryWithEndDrill.Data data = new RecoveryWithEndDrill.Data(); |
|
|
|
data.setRecordId(param.getId()); |
|
|
|
data.setScore(score); |
|
|
|
data.setStatus(2); |
|
|
|
RecoveryWithEndDrill recoveryWithEndDrill = new RecoveryWithEndDrill(data); |
|
|
|
//查找患者信息
|
|
|
|
Patient patient = patientDao.selectByPrimaryKey(param.getId()); |
|
|
|
Patient patient = patientDao.selectByPrimaryKey(param.getPatientId()); |
|
|
|
if(ObjectUtil.isNotNull(patient)) { |
|
|
|
ChannelManager.sendTo(patient.getUserId().toString(), OutMessageSet.newInstance().ackId(null).add(new OutMessage(JacksonUtil.beanToJson(recoveryWithEndDrill)))); |
|
|
|
//查找患者关联的机器人信息
|
|
|
|
RecoveryRobot recoveryRobot = patientDao.getRobotByPatientId(patient.getId()); |
|
|
|
if(ObjectUtil.isNotNull(recipeRecord)){ |
|
|
|
ChannelManager.sendTo(recoveryRobot.getUserid().toString(), OutMessageSet.newInstance().ackId(null).add(new OutMessage(JacksonUtil.beanToJson(recoveryWithEndDrill)))); |
|
|
|
} |
|
|
|
} |
|
|
|
//查找患者关联的机器人信息
|
|
|
|
RecoveryRobot recoveryRobot = patientDao.getRobotByPatientId(patient.getId()); |
|
|
|
if(ObjectUtil.isNotNull(recipeRecord)){ |
|
|
|
ChannelManager.sendTo(recoveryRobot.getUserid().toString(), OutMessageSet.newInstance().ackId(null).add(new OutMessage(JacksonUtil.beanToJson(recoveryWithEndDrill)))); |
|
|
|
} |
|
|
|
//删除redis内的分数
|
|
|
|
redisUtil.del(Constant.Redis.RECORD_SCORE + recipeRecord.getId()); |
|
|
|
redisUtil.del(Constant.Redis.RECORD_TIMES + recipeRecord.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -285,7 +293,9 @@ public class PatientService implements IPatientService{ |
|
|
|
if(ObjectUtil.isNotNull(patient)){ |
|
|
|
//查询患者当前关联的机器人
|
|
|
|
RecoveryRobot recoveryRobot = patientDao.getRobotByPatientId(patient.getId()); |
|
|
|
userIdSet.add(recoveryRobot.getUserid().toString()); |
|
|
|
if(ObjectUtil.isNotNull(recoveryRobot)){ |
|
|
|
userIdSet.add(recoveryRobot.getUserid().toString()); |
|
|
|
} |
|
|
|
//查询患者所属的康复中心关联的项目
|
|
|
|
RecoveryCentre recoveryCentre = recoveryCentreMapper.selectByPrimaryKey(patient.getCentreId()); |
|
|
|
if(ObjectUtil.isNotNull(recoveryCentre)){ |
|
|
@ -305,27 +315,46 @@ public class PatientService implements IPatientService{ |
|
|
|
@Override |
|
|
|
public PatientVo.RecordStatus getDrillStatus(PatientDto.SubTimeTaskId param, Long userId) { |
|
|
|
PatientVo.RecordStatus recordStatus = new PatientVo.RecordStatus(); |
|
|
|
|
|
|
|
RecipeRecordExample recipeRecordExample = new RecipeRecordExample(); |
|
|
|
recipeRecordExample.createCriteria().andSubTaskIdEqualTo(param.getSubTaskId()); |
|
|
|
List<RecipeRecord> recipeRecordList = recipeRecordMapper.selectByExample(recipeRecordExample); |
|
|
|
if(CollectionUtil.isNotEmpty(recipeRecordList)){ |
|
|
|
RecipeRecord recipeRecord = recipeRecordList.get(0); |
|
|
|
recordStatus.setId(recipeRecord.getId()); |
|
|
|
if(ObjectUtil.isNotNull(recipeRecord.getStartTime()) && ObjectUtil.isNotNull(recipeRecord.getEndTime())){ |
|
|
|
if(recipeRecord.getStartTime() != 0 && recipeRecord.getEndTime() == 0){ |
|
|
|
recordStatus.setStatus(1); |
|
|
|
recordStatus.setStartTime(recipeRecord.getStartTime()); |
|
|
|
return recordStatus; |
|
|
|
} |
|
|
|
if(recipeRecord.getEndTime() != 0){ |
|
|
|
recordStatus.setStatus(2); |
|
|
|
recordStatus.setStartTime(recipeRecord.getStartTime()); |
|
|
|
return recordStatus; |
|
|
|
//查询分解的处方项信息
|
|
|
|
Long decomposeId = null; |
|
|
|
RecipeProjectDecomposeExample decomposeExample = new RecipeProjectDecomposeExample(); |
|
|
|
decomposeExample.createCriteria().andTaskIdEqualTo(param.getSubTaskId()); |
|
|
|
List<RecipeProjectDecompose> decomposeList = projectDecomposeMapper.selectByExample(decomposeExample); |
|
|
|
if(CollectionUtil.isEmpty(decomposeList)){ |
|
|
|
RecipeProjectDecomposeExample decomposeExample1 = new RecipeProjectDecomposeExample(); |
|
|
|
decomposeExample1.createCriteria().andRobotTaskIdEqualTo(param.getSubTaskId()); |
|
|
|
List<RecipeProjectDecompose> decomposeList1 = projectDecomposeMapper.selectByExample(decomposeExample); |
|
|
|
if(CollectionUtil.isNotEmpty(decomposeList1)){ |
|
|
|
decomposeId = decomposeList1.get(0).getId(); |
|
|
|
} |
|
|
|
}else { |
|
|
|
decomposeId = decomposeList.get(0).getId(); |
|
|
|
} |
|
|
|
if(ObjectUtil.isNotNull(decomposeId)){ |
|
|
|
RecipeRecordExample recipeRecordExample = new RecipeRecordExample(); |
|
|
|
recipeRecordExample.createCriteria().andDecomposeIdEqualTo(decomposeId); |
|
|
|
List<RecipeRecord> recipeRecordList = recipeRecordMapper.selectByExample(recipeRecordExample); |
|
|
|
if(CollectionUtil.isNotEmpty(recipeRecordList)){ |
|
|
|
RecipeRecord recipeRecord = recipeRecordList.get(0); |
|
|
|
recordStatus.setId(recipeRecord.getId()); |
|
|
|
if(ObjectUtil.isNotNull(recipeRecord.getStartTime()) && ObjectUtil.isNotNull(recipeRecord.getEndTime())){ |
|
|
|
if(recipeRecord.getStartTime() != 0 && recipeRecord.getEndTime() == 0){ |
|
|
|
recordStatus.setStatus(1); |
|
|
|
recordStatus.setStartTime(recipeRecord.getStartTime()); |
|
|
|
Object o = redisUtil.get(Constant.Redis.RECORD_SCORE + recipeRecord.getId()); |
|
|
|
recordStatus.setScore(o == null ? 0 : (int)o); |
|
|
|
return recordStatus; |
|
|
|
} |
|
|
|
if(recipeRecord.getEndTime() != 0){ |
|
|
|
recordStatus.setStatus(2); |
|
|
|
recordStatus.setStartTime(recipeRecord.getStartTime()); |
|
|
|
recordStatus.setScore(recipeRecord.getScore()); |
|
|
|
return recordStatus; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
recordStatus.setStatus(0); |
|
|
|
} |
|
|
|
recordStatus.setStatus(0); |
|
|
|
return recordStatus; |
|
|
|
} |
|
|
|
|
|
|
@ -341,7 +370,13 @@ public class PatientService implements IPatientService{ |
|
|
|
//生成消息
|
|
|
|
RecoveryWithCountdown recoveryWithCountdown = new RecoveryWithCountdown(); |
|
|
|
log.info("倒计时结束消息:{}",recoveryWithCountdown); |
|
|
|
//给患者发送消息
|
|
|
|
ChannelManager.sendTo(patientUserId, OutMessageSet.newInstance().ackId(null).add(new OutMessage(JacksonUtil.beanToJson(recoveryWithCountdown)))); |
|
|
|
//给机器人发送新消息
|
|
|
|
RecoveryRobot recoveryRobot = patientDao.getRobotByPatientId(patient.getId()); |
|
|
|
if(ObjectUtil.isNotNull(recoveryRobot)){ |
|
|
|
ChannelManager.sendTo(recoveryRobot.getUserid().toString(), OutMessageSet.newInstance().ackId(null).add(new OutMessage(JacksonUtil.beanToJson(recoveryWithCountdown)))); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Set<String> userIdSet = new HashSet<>();
|
|
|
|