|
@@ -10,6 +10,9 @@ import com.rf.kjb.chat.service.ChatRecordService;
|
|
|
import com.rf.kjb.chat.service.ResultQuestionService;
|
|
|
import com.rf.kjb.excel.ExcelUtil;
|
|
|
import com.rf.kjb.exception.ErrorCode;
|
|
|
+import com.rf.kjb.intelligentDialogue.dao.domain.IntelligentDialogueEntity;
|
|
|
+import com.rf.kjb.intelligentDialogue.service.IntelligentDialogueService;
|
|
|
+import com.rf.kjb.opLog.dao.model.SysLogEntity;
|
|
|
import com.rf.kjb.scale.util.DateUtil;
|
|
|
import com.rf.kjb.user.dao.model.UserEntry;
|
|
|
import com.rf.kjb.user.service.UserService;
|
|
@@ -23,8 +26,6 @@ import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.commons.lang3.time.DateUtils;
|
|
|
-import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
@@ -65,6 +66,15 @@ public class ChatController extends BaseController {
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IntelligentDialogueService intelligentDialogueService;
|
|
|
+
|
|
|
+ private String depressedOneEvaluationResult = "'5','134','298'";
|
|
|
+ private String depressedTwoEvaluationResult = "'5','134'";
|
|
|
+ private String depressedThreeEvaluationResult = "'5','134'";
|
|
|
+ private String depressedFourEvaluationResult = "'5','134'";
|
|
|
+ private String depressedFiveEvaluationResult = "'5','134'";
|
|
|
+
|
|
|
/**
|
|
|
* 查询会话问题
|
|
|
*/
|
|
@@ -77,24 +87,165 @@ public class ChatController extends BaseController {
|
|
|
id = "1";
|
|
|
}
|
|
|
ChatQuestionEntity questionEntity = this.questionService.findByIdAndLabelAndNum(id, label, num);
|
|
|
+ String token = request.getHeader("Authorization");
|
|
|
+ token = token.split(" ")[1];//以空格划分Bearer token,获取token
|
|
|
+ //从请求头中获取token
|
|
|
+ DecodedJWT verify = JWTUtil.verify(token);
|
|
|
+ String identifier = verify.getClaim("identifier").asString();
|
|
|
+ UserEntry userEntry = this.userService.findByIdentifier(identifier);
|
|
|
if (questionEntity.getLabel().equals("5") && questionEntity.getId().equals("3")){
|
|
|
- String token = request.getHeader("Authorization");
|
|
|
- token = token.split(" ")[1];//以空格划分Bearer token,获取token
|
|
|
- //从请求头中获取token
|
|
|
- DecodedJWT verify = JWTUtil.verify(token);
|
|
|
- String identifier = verify.getClaim("identifier").asString();
|
|
|
- UserEntry userEntry = this.userService.findByIdentifier(identifier);
|
|
|
questionEntity.setQuestion(userEntry.getUserName()+questionEntity.getQuestion());
|
|
|
}
|
|
|
- if (!questionEntity.getLabel().equals("5") && questionEntity.getId().equals("1")){
|
|
|
- String token = request.getHeader("Authorization");
|
|
|
- token = token.split(" ")[1];//以空格划分Bearer token,获取token
|
|
|
- //从请求头中获取token
|
|
|
- DecodedJWT verify = JWTUtil.verify(token);
|
|
|
- String identifier = verify.getClaim("identifier").asString();
|
|
|
- UserEntry userEntry = this.userService.findByIdentifier(identifier);
|
|
|
- questionEntity.setQuestion(userEntry.getUserName()+questionEntity.getQuestion());
|
|
|
+ //情绪打分跳转
|
|
|
+ if (label.equals("2")){
|
|
|
+ if (num.equals("1")){
|
|
|
+ if (id.equals("41")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"40");
|
|
|
+ }
|
|
|
+ if (id.equals("83")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"82");
|
|
|
+ }
|
|
|
+ if (id.equals("121")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"120");
|
|
|
+ }
|
|
|
+ if (id.equals("169")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"168");
|
|
|
+ }
|
|
|
+ if (id.equals("210")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"209");
|
|
|
+ }
|
|
|
+ if (id.equals("249")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"246");
|
|
|
+ }
|
|
|
+ if (id.equals("288")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"285");
|
|
|
+ }
|
|
|
+ if (id.equals("336")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"333");
|
|
|
+ }
|
|
|
+ if (id.equals("377")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"374");
|
|
|
+ }
|
|
|
+ if (id.equals("414")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"411");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (num.equals("2") || num.equals("3") || num.equals("4") || num.equals("5")){
|
|
|
+ if (id.equals("57")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"56");
|
|
|
+ }
|
|
|
+ if (id.equals("99")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"98");
|
|
|
+ }
|
|
|
+ if (id.equals("137")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"136");
|
|
|
+ }
|
|
|
+ if (id.equals("185")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"184");
|
|
|
+ }
|
|
|
+ if (id.equals("226")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"225");
|
|
|
+ }
|
|
|
+ if (id.equals("265")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"262");
|
|
|
+ }
|
|
|
+ if (id.equals("304")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"301");
|
|
|
+ }
|
|
|
+ if (id.equals("352")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"349");
|
|
|
+ }
|
|
|
+ if (id.equals("393")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"390");
|
|
|
+ }
|
|
|
+ if (id.equals("430")){
|
|
|
+ questionEntity = emotionScoreSkip(identifier,label,num,"427");
|
|
|
+ }
|
|
|
+ //情绪二次打分跳转
|
|
|
+ if (id.equals("4")){
|
|
|
+ String lastNum = String.valueOf(Integer.valueOf(num) - 1);
|
|
|
+ int lastScore = Integer.valueOf(this.intelligentDialogueService.findLastScoreByIdentifierByLabelByNumByQuestionNo(identifier,label,lastNum,"4").getContent());
|
|
|
+ IntelligentDialogueEntity intelligentDialogueEntity = this.intelligentDialogueService.findScoreByIdentifierByLabelByNumByQuestionNo(identifier,label,num);
|
|
|
+ int score = Integer.valueOf(intelligentDialogueEntity.getContent()) - lastScore;
|
|
|
+ if (score <= -80){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("13", label, num);
|
|
|
+ }else if (score <= -60 && score > -80){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("11", label, num);
|
|
|
+ }else if (score <= -40 && score > -60){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("9", label, num);
|
|
|
+ }else if (score <= -20 && score > -40){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("7", label, num);
|
|
|
+ }else if (score <= 0 && score > -20){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("5", label, num);
|
|
|
+ }else if (score <= 20 && score > 0){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("4", label, num);
|
|
|
+ }else if (score <= 40 && score > 20){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("6", label, num);
|
|
|
+ }else if (score <= 60 && score > 40){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("8", label, num);
|
|
|
+ }else if (score <= 80 && score > 60){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("10", label, num);
|
|
|
+ }else {
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("12", label, num);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //替换用户名
|
|
|
+ if (questionEntity.getQuestion().contains("userName")){
|
|
|
+ questionEntity.setQuestion(questionEntity.getQuestion().replace("userName",userEntry.getUserName()));
|
|
|
+ }
|
|
|
+ //替换使用时长
|
|
|
+ if (questionEntity.getQuestion().contains("utilityTime")){
|
|
|
+ IntelligentDialogueEntity intelligentDialogueEntity = this.intelligentDialogueService.findByIdentifierByLabelByNum(identifier,label,num);
|
|
|
+ Date beginTime = intelligentDialogueEntity.getCreateTime();
|
|
|
+ //当前时间
|
|
|
+ Date endTime = new Date();
|
|
|
+ //计算时间差
|
|
|
+ int diff = DateUtil.getDistanceByUnit(beginTime, endTime, 2);
|
|
|
+ if (diff <= 60){
|
|
|
+ questionEntity.setQuestion(questionEntity.getQuestion().replace("utilityTime",diff+"分钟"));
|
|
|
+ }else {
|
|
|
+ int MINUTE = diff%60;
|
|
|
+ int HOUR = diff/60;
|
|
|
+ if (HOUR <= 24){
|
|
|
+ questionEntity.setQuestion(questionEntity.getQuestion().replace("utilityTime",HOUR + "小时" + MINUTE + "分钟"));
|
|
|
+ }else {
|
|
|
+ int DAY = HOUR/24;
|
|
|
+ HOUR = HOUR%24;
|
|
|
+ questionEntity.setQuestion(questionEntity.getQuestion().replace("utilityTime",DAY + "天" + HOUR + "小时" + MINUTE + "分钟"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //替换天数问候
|
|
|
+ if (questionEntity.getQuestion().contains("days")){
|
|
|
+ String lastNum = String.valueOf(Integer.valueOf(num) - 1);
|
|
|
+ IntelligentDialogueEntity intelligentDialogueEntity = this.intelligentDialogueService.findDateByIdentifierByLabelByNum(identifier,label,lastNum);
|
|
|
+ Date beginTime = intelligentDialogueEntity.getCreateTime();
|
|
|
+ //当前时间
|
|
|
+ Date endTime = new Date();
|
|
|
+ //计算时间差
|
|
|
+ int diff = DateUtil.getDistanceByUnit(beginTime, endTime, 4);
|
|
|
+ questionEntity.setQuestion(questionEntity.getQuestion().replace("days",String.valueOf(diff)));
|
|
|
+ }
|
|
|
+ //替换评测结果
|
|
|
+ if (questionEntity.getQuestion().contains("SDSEvaluationResult")){
|
|
|
+ IntelligentDialogueEntity intelligentDialogueEntity = this.intelligentDialogueService.findByIdentifierByLabelByNumByQuestionNo(identifier,label,num,"1");
|
|
|
+ questionEntity.setQuestion(questionEntity.getQuestion().replace("SDSEvaluationResult",intelligentDialogueEntity.getContent()));
|
|
|
}
|
|
|
+ //替换治疗成绩
|
|
|
+ if (questionEntity.getQuestion().contains("therapeuticAchievement")){
|
|
|
+ List<IntelligentDialogueEntity> intelligentDialogueEntityList = this.intelligentDialogueService.findGradeByIdentifierByLabelByNumByQuestionNo(identifier,label,num,"2");
|
|
|
+ int therapeuticAchievement = Integer.valueOf(intelligentDialogueEntityList.get(1).getContent()) - Integer.valueOf(intelligentDialogueEntityList.get(0).getContent());
|
|
|
+ questionEntity.setQuestion(questionEntity.getQuestion().replace("therapeuticAchievement",String.valueOf(therapeuticAchievement)));
|
|
|
+ }
|
|
|
+ //替换上次训练内容
|
|
|
+ if (questionEntity.getQuestion().contains("LastTrainingContent")){
|
|
|
+ String lastNum = String.valueOf(Integer.valueOf(num) - 1);
|
|
|
+ IntelligentDialogueEntity intelligentDialogueEntity = this.intelligentDialogueService.findJobByIdentifierByLabelByNumByQuestionNo(identifier,label,lastNum,"3");
|
|
|
+ questionEntity.setQuestion(questionEntity.getQuestion().replace("LastTrainingContent",intelligentDialogueEntity.getContent()));
|
|
|
+ }
|
|
|
+
|
|
|
return success(questionEntity);
|
|
|
}
|
|
|
|
|
@@ -118,7 +269,8 @@ public class ChatController extends BaseController {
|
|
|
ChatQuestionEntity chatQuestionEntity = new ChatQuestionEntity();
|
|
|
chatQuestionEntity.setId((String) item.get(0));
|
|
|
chatQuestionEntity.setQuestion((String) item.get(1));
|
|
|
- chatQuestionEntity.setNextQuestionNo((String) item.get(2));
|
|
|
+ String nextQuestionNo = String.valueOf(item.get(2)).replace("aaa","");
|
|
|
+ chatQuestionEntity.setNextQuestionNo(nextQuestionNo);
|
|
|
String questionType = (String) item.get(3);
|
|
|
if (questionType.equals("单选")) {
|
|
|
chatQuestionEntity.setQuestionType("0");
|
|
@@ -149,11 +301,11 @@ public class ChatController extends BaseController {
|
|
|
}
|
|
|
|
|
|
if (chatQuestionEntityList.size() > 0 && chatAnswerEntityList.size() > 0) {
|
|
|
- this.questionService.deleteByLabel(label);
|
|
|
- this.answerService.deleteByLabel(label);
|
|
|
+ //this.questionService.deleteByLabel(label);
|
|
|
+ //this.answerService.deleteByLabel(label);
|
|
|
|
|
|
- this.questionService.saveBatch(chatQuestionEntityList);
|
|
|
- this.answerService.saveBatch(chatAnswerEntityList);
|
|
|
+ /*this.questionService.saveBatch(chatQuestionEntityList);
|
|
|
+ this.answerService.saveBatch(chatAnswerEntityList);*/
|
|
|
}
|
|
|
|
|
|
|
|
@@ -162,7 +314,7 @@ public class ChatController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/getAnswer/{questionNo}/{label}/{num}")
|
|
|
- @ApiOperation("查询答案列表,questionNo为问题的id字段,nextQuestionNo 为此答案被选中后的下一个应该呈现的问题")
|
|
|
+ @ApiOperation("查询答案信息列表,questionNo为问题的id字段,nextQuestionNo 为此答案被选中后的下一个应该呈现的问题")
|
|
|
public Result getAnswer(@PathVariable String questionNo, @PathVariable String label, @PathVariable String num) {
|
|
|
List<ChatAnswerEntity> answerEntities = this.answerService.findByQuestionNoAndLabelAndNum(questionNo, label, num);
|
|
|
return success(answerEntities);
|
|
@@ -170,9 +322,10 @@ public class ChatController extends BaseController {
|
|
|
|
|
|
@GetMapping("/getNextQuestionByScaleResult")
|
|
|
@ApiOperation("根据量表测试结果查询下一问题编号")
|
|
|
- public Result getNextQuestionByScaleResult(String label, String result) {
|
|
|
+ public Result getNextQuestionByScaleResult(String label, String result, String num) {
|
|
|
|
|
|
- ResultQuestionEntity resultQuestionEntity = this.resultQuestionService.findByLabelAndResult(label, result);
|
|
|
+ ResultQuestionEntity resultQuestionEntity = this.resultQuestionService.findByLabelAndResultAndNum(label, result, num);
|
|
|
+ //ResultQuestionEntity resultQuestionEntity = this.resultQuestionService.findByLabelAndNum(label, num);
|
|
|
if (resultQuestionEntity == null) {
|
|
|
return fail(ErrorCode.NEXT_QUESTION_NO_NOT_FOUND);
|
|
|
}
|
|
@@ -519,4 +672,386 @@ public class ChatController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private ChatQuestionEntity emotionScoreSkip(String identifier, String label, String num, String questionNo) {
|
|
|
+ int a = emotionScore(identifier,label,num,questionNo);
|
|
|
+ ChatQuestionEntity questionEntity = new ChatQuestionEntity();
|
|
|
+ if (label.equals("2")){
|
|
|
+ if (num.equals("1")){
|
|
|
+ if (questionNo.equals("40")){
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("41", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("43", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("45", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("47", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (questionNo.equals("82")){
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("83", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("85", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("87", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("89", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (questionNo.equals("120")){
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("121", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("123", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("125", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("157", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (questionNo.equals("168")){
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("169", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("171", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("173", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("175", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (questionNo.equals("209")){
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("210", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("212", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("214", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("216", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (questionNo.equals("246")){
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("249", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("251", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("253", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("255", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (questionNo.equals("285")){
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("288", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("290", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("292", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("294", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (questionNo.equals("333")){
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("336", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("338", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("340", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("342", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (questionNo.equals("374")){
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("377", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("379", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("381", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("383", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (questionNo.equals("411")){
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("414", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("416", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("418", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("420", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (label.equals("2")) {
|
|
|
+ if (num.equals("2") || num.equals("3") || num.equals("4") || num.equals("5")){
|
|
|
+ if (questionNo.equals("56")) {
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("57", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("59", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("61", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("63", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (questionNo.equals("98")) {
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("99", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("101", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("103", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("105", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }if (questionNo.equals("136")) {
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("137", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("139", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("141", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("143", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }if (questionNo.equals("184")) {
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("185", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("187", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("189", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("191", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }if (questionNo.equals("225")) {
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("226", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("228", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("230", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("232", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }if (questionNo.equals("262")) {
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("265", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("267", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("269", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("271", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }if (questionNo.equals("301")) {
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("304", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("306", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("308", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("310", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }if (questionNo.equals("349")) {
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("352", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("354", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("356", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("358", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }if (questionNo.equals("390")) {
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("393", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("395", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("397", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("399", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }if (questionNo.equals("427")) {
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("430", label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("432", label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("434", label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("436", label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return questionEntity;
|
|
|
+ }
|
|
|
+
|
|
|
+ private int emotionScore(String identifier, String label, String num, String questionNo) {
|
|
|
+ IntelligentDialogueEntity intelligentDialogueEntity = this.intelligentDialogueService.findEmotionScoreByIdentifierByLabelByNumByQuestionNo(identifier,label,num,questionNo);
|
|
|
+ int emotionScore = Integer.valueOf(intelligentDialogueEntity.getContent());
|
|
|
+ if (emotionScore <= 25){
|
|
|
+ emotionScore = 1;
|
|
|
+ }else if (emotionScore <= 50 && emotionScore >= 26){
|
|
|
+ emotionScore = 2;
|
|
|
+ }else if (emotionScore <= 75 && emotionScore >= 51){
|
|
|
+ emotionScore = 3;
|
|
|
+ }else {
|
|
|
+ emotionScore = 4;
|
|
|
+ }
|
|
|
+ return emotionScore;
|
|
|
+ }
|
|
|
+
|
|
|
}
|