Browse Source

20210604简单测试

pt
zy_Java 4 years ago
parent
commit
ff908844a1
  1. 2
      recovery/src/main/java/com/ccsens/recovery/api/PatientController.java
  2. 2
      recovery/src/main/java/com/ccsens/recovery/bean/dto/PatientDto.java
  3. 31
      recovery/src/main/java/com/ccsens/recovery/service/PatientService.java
  4. 2
      recovery/src/main/resources/application-dev.yml
  5. 8
      recovery/src/main/resources/mapper_dao/PatientDao.xml
  6. 10
      recovery/src/main/resources/mapper_dao/RecDrillDao.xml
  7. 8
      tall/src/main/resources/application-dev.yml

2
recovery/src/main/java/com/ccsens/recovery/api/PatientController.java

@ -102,7 +102,7 @@ public class PatientController {
} }
@MustLogin @MustLogin
@ApiOperation(value = "开训练", notes = "zy:") @ApiOperation(value = "开始一个训练", notes = "zy:")
@RequestMapping(value = "/start", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) @RequestMapping(value = "/start", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<PatientVo.RecipeRecordId> startDrill(@ApiParam @Validated @RequestBody QueryDto<PatientDto.StartDrill> params) throws Exception { public JsonResponse<PatientVo.RecipeRecordId> startDrill(@ApiParam @Validated @RequestBody QueryDto<PatientDto.StartDrill> params) throws Exception {
log.info("开启训练:{}",params); log.info("开启训练:{}",params);

2
recovery/src/main/java/com/ccsens/recovery/bean/dto/PatientDto.java

@ -32,7 +32,7 @@ public class PatientDto {
@Data @Data
@ApiModel("任务详情id") @ApiModel("任务详情id")
public static class TaskDetailId{ public static class TaskDetailId{
@NotNull(message = "任务详情id") @NotNull(message = "任务详情id不能为空")
@ApiModelProperty("任务详情id") @ApiModelProperty("任务详情id")
private Long detailId; private Long detailId;
} }

31
recovery/src/main/java/com/ccsens/recovery/service/PatientService.java

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

2
recovery/src/main/resources/application-dev.yml

@ -11,7 +11,7 @@ spring:
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
rabbitmq: rabbitmq:
host: test.tall.wiki host: 192.168.4.113
# host: 127.0.0.1 # host: 127.0.0.1
password: 111111 password: 111111
port: 5672 port: 5672

8
recovery/src/main/resources/mapper_dao/PatientDao.xml

@ -137,15 +137,19 @@
FROM FROM
t_patient p, t_patient p,
t_doctor d, t_doctor d,
t_recipe re,
t_recipe_project rp, t_recipe_project rp,
t_recipe_project_decompose rpd, t_recipe_project_decompose rpd,
t_rec_drill rd t_rec_drill rd
WHERE WHERE
p.doctor_id = d.id p.doctor_id = d.id
and re.patient_id = p.id
and re.id = rp.recipe_id
and rp.id = rpd.recipe_project_id and rp.id = rpd.recipe_project_id
and rp.drill_id = rd.id and rp.drill_id = rd.id
and p.rec_status = 0 and p.rec_status = 0
and d.rec_status = 0 and d.rec_status = 0
and re.rec_status = 0
and rp.rec_status = 0 and rp.rec_status = 0
and rpd.rec_status = 0 and rpd.rec_status = 0
and rd.rec_status = 0 and rd.rec_status = 0
@ -172,7 +176,7 @@
p.`name` as `name`, p.`name` as `name`,
p.sex as sex, p.sex as sex,
p.age as age, p.age as age,
p.id_card as idCord, p.id_card as idCard,
p.phone as phone, p.phone as phone,
p.address as address, p.address as address,
c.id as recoveryCentreId, c.id as recoveryCentreId,
@ -189,7 +193,7 @@
and p.rec_status = 0 and p.rec_status = 0
and d.rec_status = 0 and d.rec_status = 0
and c.rec_status = 0 and c.rec_status = 0
and c.id = #{recoveryCentreId} and c.id = #{centreId}
and p.id_card like concat('%',#{idCard},'%') and p.id_card like concat('%',#{idCard},'%')
</select> </select>
</mapper> </mapper>

10
recovery/src/main/resources/mapper_dao/RecDrillDao.xml

@ -5,11 +5,13 @@
<select id="getGameByDrillId" resultType="com.ccsens.recovery.bean.vo.RecipeVo$Game"> <select id="getGameByDrillId" resultType="com.ccsens.recovery.bean.vo.RecipeVo$Game">
SELECT SELECT
* g.id,
g.`name`,
g.game_url as gameUrl
FROM FROM
t_rec_drill d t_rec_game g
LEFT JOIN t_rec_drill_game dg on d.id = dg.drill_id and dg.rec_status = 0 LEFT JOIN t_rec_drill_game dg on g.id = dg.game_id and dg.rec_status = 0
LEFT JOIN t_rec_game g on g.id = dg.game_id = and g.rec_status = 0 LEFT JOIN t_rec_drill d on d.id = dg.drill_id and d.rec_status = 0
WHERE WHERE
d.rec_status = 0 d.rec_status = 0
and d.id = #{drillId} and d.id = #{drillId}

8
tall/src/main/resources/application-dev.yml

@ -11,11 +11,11 @@ spring:
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
rabbitmq: rabbitmq:
host: 192.168.4.113 # host: 192.168.4.113
# host: 127.0.0.1 host: 127.0.0.1
password: 111111 password: guest
port: 5672 port: 5672
username: admin username: guest
redis: redis:
database: 0 database: 0
host: 127.0.0.1 host: 127.0.0.1

Loading…
Cancel
Save