|
|
@ -27,6 +27,7 @@ import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|
|
|
import com.elink.esua.epdc.dto.psychology.form.*; |
|
|
|
import com.elink.esua.epdc.dto.psychology.result.*; |
|
|
|
import com.elink.esua.epdc.modules.psychology.service.PsychologistService; |
|
|
|
import com.elink.esua.epdc.modules.psychology.service.PsychologyAnswerService; |
|
|
|
import com.elink.esua.epdc.modules.psychology.service.PsychologyQuestionService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
@ -50,14 +51,21 @@ public class AppPsychologistController { |
|
|
|
@Autowired |
|
|
|
private PsychologyQuestionService psychologyQuestionService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PsychologyAnswerService psychologyAnswerService; |
|
|
|
|
|
|
|
@GetMapping("listPsychiatrist") |
|
|
|
public Result<List<PsychologistResultDTO>> listPsychiatrist(@RequestBody PsychologistFormDTO formDto) throws Exception { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class); |
|
|
|
List<PsychologistResultDTO> list = psychologistService.listPsychiatrist(formDto); |
|
|
|
return new Result<List<PsychologistResultDTO>>().ok(list); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("psychologistInfo") |
|
|
|
public Result<PsychologistInfoResultDTO> psychologistInfo(@RequestBody PsychologistInfoFormDTO formDto) throws Exception { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class); |
|
|
|
PsychologistInfoResultDTO data = psychologistService.psychologistInfo(formDto); |
|
|
|
return new Result<PsychologistInfoResultDTO>().ok(data); |
|
|
|
} |
|
|
@ -66,24 +74,30 @@ public class AppPsychologistController { |
|
|
|
public Result submitQuestion(@RequestBody PsychologyQuestionFormDTO formDto) throws Exception { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class); |
|
|
|
psychologyQuestionService.saveFromApp(formDto); |
|
|
|
psychologyQuestionService.saveQuestion(formDto); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("listUserQuestion") |
|
|
|
public Result<List<PsychologyAnswerListUserResultDTO>> listUserQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class); |
|
|
|
List<PsychologyAnswerListUserResultDTO> data = psychologistService.listUserQuestion(formDto); |
|
|
|
return new Result<List<PsychologyAnswerListUserResultDTO>>().ok(data); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("listQuestion") |
|
|
|
public Result<List<PsychologyAnswerListResultDTO>> listAllQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class); |
|
|
|
List<PsychologyAnswerListResultDTO> data = psychologistService.listAllQuestion(formDto); |
|
|
|
return new Result<List<PsychologyAnswerListResultDTO>>().ok(data); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("listUnansweredQuestion") |
|
|
|
public Result<List<PsychologyUnansweredResultDTO>> listUnansweredQuestion(@RequestBody PsychologyUnansweredFormDTO formDto) throws Exception { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class); |
|
|
|
List<PsychologyUnansweredResultDTO> data = psychologistService.listUnansweredQuestion(formDto); |
|
|
|
return new Result<List<PsychologyUnansweredResultDTO>>().ok(data); |
|
|
|
} |
|
|
@ -92,7 +106,20 @@ public class AppPsychologistController { |
|
|
|
public Result<List<PsychologyAnswerOfMineResultDTO>> listMyQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception { |
|
|
|
UserDetail user = SecurityUser.getUser(); |
|
|
|
formDto.setUserId(user.getId().toString()); |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class); |
|
|
|
List<PsychologyAnswerOfMineResultDTO> data = psychologistService.listMyQuestion(formDto); |
|
|
|
return new Result<List<PsychologyAnswerOfMineResultDTO>>().ok(data); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("submitAnswer") |
|
|
|
public Result submitAnswer(@RequestBody PsychologySubmitAnswerFormDTO formDto) throws Exception { |
|
|
|
UserDetail user = SecurityUser.getUser(); |
|
|
|
formDto.setUserId(user.getId().toString()); |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class); |
|
|
|
psychologyAnswerService.saveAnswer(formDto); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
} |