|
|
@ -50,6 +50,8 @@ public class PatientService implements IPatientService{ |
|
|
|
@Resource |
|
|
|
private RecipeRecordMapper recipeRecordMapper; |
|
|
|
@Resource |
|
|
|
private RecipeProjectMapper recipeProjectMapper; |
|
|
|
@Resource |
|
|
|
private RecDrillDao recDrillDao; |
|
|
|
@Resource |
|
|
|
private RecoveryDoctorMapper recoveryDoctorMapper; |
|
|
@ -118,6 +120,15 @@ public class PatientService implements IPatientService{ |
|
|
|
|
|
|
|
@Override |
|
|
|
public PatientVo.RecipeRecordId startDrill(PatientDto.StartDrill param, Long userId) throws Exception { |
|
|
|
//查找患者
|
|
|
|
Patient patient = patientDao.selectByPrimaryKey(param.getPatientId()); |
|
|
|
if(ObjectUtil.isNull(patient)){ |
|
|
|
return null; |
|
|
|
} |
|
|
|
RecipeProject recipeProject = recipeProjectMapper.selectByPrimaryKey(param.getRecipeProjectId()); |
|
|
|
if(ObjectUtil.isNull(recipeProject)){ |
|
|
|
return null; |
|
|
|
} |
|
|
|
//存储一条训练记录
|
|
|
|
RecipeRecord recRecord = new RecipeRecord(); |
|
|
|
recRecord.setId(snowflake.nextId()); |
|
|
@ -137,11 +148,14 @@ public class PatientService implements IPatientService{ |
|
|
|
data.setGameId(param.getGameId()); |
|
|
|
recoveryWithStartDrill.setData(data); |
|
|
|
//查询患者当前关联的机器人
|
|
|
|
RecoveryRobot recoveryRobot = patientDao.getRobotByPatientId(param.getPatientId()); |
|
|
|
|
|
|
|
//查询接收者
|
|
|
|
Set<String> userIdSet = new HashSet<>(); |
|
|
|
userIdSet.add(recoveryRobot.getUserid().toString()); |
|
|
|
userIdSet.add(param.getPatientId().toString()); |
|
|
|
RecoveryRobot recoveryRobot = patientDao.getRobotByPatientId(param.getPatientId()); |
|
|
|
if(ObjectUtil.isNotNull(recoveryRobot)){ |
|
|
|
userIdSet.add(recoveryRobot.getUserid().toString()); |
|
|
|
} |
|
|
|
//封装成inMessage
|
|
|
|
MessageRule messageRule = MessageRule.defaultRule(MessageConstant.DomainType.User); |
|
|
|
messageRule.setAckRule(MessageRule.AckRule.NONE); |
|
|
@ -215,17 +229,20 @@ public class PatientService implements IPatientService{ |
|
|
|
@Override |
|
|
|
public PatientVo.PatientFullScreen fullScreen(PatientDto.TaskDetailId param, Long userId) { |
|
|
|
PatientVo.PatientFullScreen patientFullScreen = patientDao.getPatientFllScreen(param.getDetailId()); |
|
|
|
List<RecipeVo.Game> gameList = recDrillDao.getGameByDrillId(patientFullScreen.getDrillId()); |
|
|
|
if (CollectionUtil.isNotEmpty(gameList)) { |
|
|
|
patientFullScreen.setGameId(gameList.get(0).getId()); |
|
|
|
patientFullScreen.setGameName(gameList.get(0).getName()); |
|
|
|
patientFullScreen.setGameUrl(gameList.get(0).getGameUrl()); |
|
|
|
if(ObjectUtil.isNotNull(patientFullScreen)) { |
|
|
|
List<RecipeVo.Game> gameList = recDrillDao.getGameByDrillId(patientFullScreen.getDrillId()); |
|
|
|
if (CollectionUtil.isNotEmpty(gameList)) { |
|
|
|
patientFullScreen.setGameId(gameList.get(0).getId()); |
|
|
|
patientFullScreen.setGameName(gameList.get(0).getName()); |
|
|
|
patientFullScreen.setGameUrl(gameList.get(0).getGameUrl()); |
|
|
|
} |
|
|
|
} |
|
|
|
return patientFullScreen; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void completeRecovery(PatientDto.EndRecovery param, Long userId) throws Exception { |
|
|
|
//TODO 给患者和机器人关联的记录添加结束时间
|
|
|
|
//TODO 将处方项目关联的任务设为完成
|
|
|
|
//发送消息,让机器人切回康复中心的项目
|
|
|
|
Set<String> userIdSet = new HashSet<>(); |
|
|
|