Browse Source

Merge branch 'master' of gitee.com:ccsens_s/ccsenscloud

master
zhangye 6 years ago
parent
commit
b5c3ec61c6
  1. 18
      game/src/main/java/com/ccsens/game/service/ClientService.java
  2. 7
      game/src/main/java/com/ccsens/game/service/ScreenService.java
  3. 2
      game/src/main/java/com/ccsens/game/util/SendMsg.java
  4. 11
      ht/src/main/java/com/ccsens/ht/bean/vo/PatientReportVo.java
  5. 4
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  6. 19
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java

18
game/src/main/java/com/ccsens/game/service/ClientService.java

@ -12,18 +12,12 @@ import com.ccsens.game.bean.po.GameRecord;
import com.ccsens.game.bean.po.GameUserJoin;
import com.ccsens.game.bean.po.GameUserJoinExample;
import com.ccsens.game.bean.vo.ClientVo;
import com.ccsens.game.persist.dao.GameRecordDao;
import com.ccsens.game.persist.dao.GameUserJoinDao;
import com.ccsens.game.util.GameConstant;
import com.ccsens.game.util.SendMsg;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.RedisUtil;
import com.ccsens.util.exception.BaseException;
import com.ccsens.util.mq.DelayProducer;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ZSetOperations;
@ -33,10 +27,6 @@ import org.springframework.transaction.annotation.Transactional;
import com.ccsens.util.bean.dto.QueryDto;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* @description:
@ -51,16 +41,12 @@ public class ClientService implements IClientService {
@Autowired
private GameUserJoinDao gameUserJoinDao;
@Autowired
private GameRecordDao gameRecordDao;
@Autowired
private Snowflake snowflake;
@Autowired
private RedisUtil redisUtil;
@Autowired
private TallFeignClient tallFeignClient;
@Autowired
private SendMsg sendMsg;
@Autowired
private IScreenService screenService;
@ -157,7 +143,7 @@ public class ClientService implements IClientService {
ClientVo.CompletedData completedData = new ClientVo.CompletedData();
completedData.setTimes(join.getTimes());
completedData.setScore(join.getScore());
Integer sort = gameUserJoinDao.getRanking(join.getUserId(), join.getUserId());
Integer sort = gameUserJoinDao.getRanking(join.getUserId(), gameRecord.getId());
if(ObjectUtil.isNotNull(sort)){
completedData.setSort(sort);
}else {
@ -167,7 +153,7 @@ public class ClientService implements IClientService {
GameUserJoinExample joinExample = new GameUserJoinExample();
joinExample.createCriteria().andRecordIdEqualTo(gameRecord.getId());
long count = gameUserJoinDao.countByExample(joinExample);
completedData.setOver((int) (low/count * 100));
completedData.setOver((int) (low * 100/count));
joinVo.setCompletedData(completedData);
break;
default: break;

7
game/src/main/java/com/ccsens/game/service/ScreenService.java

@ -11,7 +11,6 @@ import com.ccsens.game.bean.dto.ScreenDto;
import com.ccsens.game.bean.dto.message.BaseMessageDto;
import com.ccsens.game.bean.dto.message.ChromeMessageDto;
import com.ccsens.game.bean.po.*;
import com.ccsens.game.bean.vo.ClientVo;
import com.ccsens.game.bean.vo.ScreenVo;
import com.ccsens.game.persist.dao.*;
import com.ccsens.game.util.GameConstant;
@ -25,7 +24,6 @@ import com.ccsens.util.exception.BaseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.stereotype.Service;
@ -36,6 +34,9 @@ import java.io.File;
import java.util.*;
import java.util.concurrent.*;
/**
* @author zy
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
@ -62,8 +63,6 @@ public class ScreenService implements IScreenService{
@Autowired
private Snowflake snowflake;
@Autowired
private RabbitTemplate rabbitTemplate;
@Autowired
private SendMsg sendMsg;
@Autowired
private RedisUtil redisUtil;

2
game/src/main/java/com/ccsens/game/util/SendMsg.java

@ -116,7 +116,7 @@ public class SendMsg {
user.setScore(type.getScore().intValue());
log.info("{} score: {}", type.getValue(), type.getScore());
Long sort = redisUtil.zsReverseRank(userKey, type.getValue());
user.setSort(sort == null ? 1 : sort.intValue());
user.setSort(sort == null ? 1 : sort.intValue() + 1);
//超过
Set<Object> overs = redisUtil.zsGetByScore(userKey, 0, user.getScore() - 1);
Long total = redisUtil.zsGetSize(userKey);

11
ht/src/main/java/com/ccsens/ht/bean/vo/PatientReportVo.java

@ -215,7 +215,8 @@ public class PatientReportVo {
// fillBlankCell(row2);
//子测评项
this.subReport.forEach(reportScore -> {
fillRow(row1,row2, reportScore.getName(), reportScore.score == null ? "" : reportScore.score + (reportScore.totalScore > 0 ? "/" + reportScore.totalScore : ""), npi.equalsIgnoreCase(this.code) ? new int[]{3,3} : null);
String score = (reportScore.score == null ? "" : reportScore.score) + (reportScore.getTotalScore() > 0 ? "/" + reportScore.getTotalScore() : "");
fillRow(row1,row2, reportScore.getName(), score, npi.equalsIgnoreCase(this.code) ? new int[]{3,3} : null);
});
// 总分
if (mmse.equalsIgnoreCase(this.code)) {
@ -237,9 +238,10 @@ public class PatientReportVo {
ReportScore reportScore = this.subReport.get(i);
String jy = "JY";
if (jy.equalsIgnoreCase(reportScore.getCode())) {
fillRow(row1, row2, reportScore.getName(), "", i == 0 ? new int[]{2,2}: null);
fillRow(row1, row2, reportScore.getName(), " ", i == 0 ? new int[]{2,2}: null);
} else {
fillRow(row1, row2, reportScore.getName(), reportScore.score == null ? "" : reportScore.score + (reportScore.totalScore > 0 ? "/" + reportScore.totalScore : ""), i == 0 ? new int[]{2,2}: null);
String score = (reportScore.score == null ? "" : reportScore.score) + (reportScore.getTotalScore() > 0 ? "/" + reportScore.getTotalScore() : "");
fillRow(row1, row2, reportScore.getName(), score, i == 0 ? new int[]{2,2}: null);
}
}
PdfUtil.Cell scoreNameCell = new PdfUtil.Cell();
@ -280,7 +282,8 @@ public class PatientReportVo {
}
}
PdfUtil.Cell scoreScoreCell = new PdfUtil.Cell();
scoreScoreCell.setContent(reportScore.score == null ? "" : reportScore.score + (reportScore.totalScore > 0 ? "/" + reportScore.totalScore : ""));
String score = (reportScore.score == null ? "" : reportScore.score) + (reportScore.getTotalScore() > 0 ? "/" + reportScore.getTotalScore() : "");
scoreScoreCell.setContent(score);
scoreScoreCell.setRowSpan(2);
row4.addCell(scoreScoreCell);
// fillBlankCell(row5);

4
ht/src/main/java/com/ccsens/ht/service/PatientReportService.java

@ -162,9 +162,9 @@ public class PatientReportService implements IPatientReportService {
List<HtDoctor> doctors = htDoctorMapper.selectByExample(doctorExample);
log.info("当前用户是否为医生:{}", CollectionUtil.isNotEmpty(doctors));
if (query.getPatientId() != null) {
reportExample.createCriteria().andPatientIdEqualTo(query.getPatientId());
reportExample.createCriteria().andPatientIdEqualTo(query.getPatientId()).andInitialImpressionIsNotNull().andInitialImpressionNotEqualTo("");
} else if (CollectionUtil.isNotEmpty(doctors)) {
reportExample.createCriteria().andDoctorIdEqualTo(doctors.get(0).getId());
reportExample.createCriteria().andDoctorIdEqualTo(doctors.get(0).getId()).andInitialImpressionIsNotNull().andInitialImpressionNotEqualTo("");
} else {
log.info("既无病人信息,有无医生信息,不允许查询");
throw new BaseException(CodeEnum.PARAM_ERROR);

19
ht/src/main/java/com/ccsens/ht/service/QuestionService.java

@ -198,18 +198,20 @@ public class QuestionService implements IQuestionService {
List<HtPatientScore> scores = getHtPatientScores(score, question, report, ruleList, nameOption, idOption);
if (!CollectionUtils.isEmpty(ruleList)) {
HtQuestionScoringRule rule = ruleList.get(0);
if (rule.getType() == null || rule.getType().byteValue() == Constant.Ht.Rule.SMALL) {
int currentNum = getCurrentNum(scores);
JSONArray ruleDetails = JSON.parseArray(rule.getDetail());
AtomicInteger patientScore = new AtomicInteger();
for (int i = 0; i < ruleDetails.size() - 1; i++) {
JSONObject small = (JSONObject)ruleDetails.get(i);
JSONObject next = (JSONObject)ruleDetails.get(i+1);
if (i == 0 && scores.size() <= small.getIntValue(Constant.Ht.Rule.SMALL_NUM)) {
if (i == 0 && currentNum <= small.getIntValue(Constant.Ht.Rule.SMALL_NUM)) {
patientScore.set(small.getIntValue(Constant.Ht.Rule.SMALL_SCORE));
break;
}
if (scores.size() > small.getIntValue(Constant.Ht.Rule.SMALL_NUM) && scores.size() <= next.getIntValue(Constant.Ht.Rule.SMALL_NUM)) {
if (currentNum > small.getIntValue(Constant.Ht.Rule.SMALL_NUM) && currentNum <= next.getIntValue(Constant.Ht.Rule.SMALL_NUM)) {
patientScore.set(next.getIntValue(Constant.Ht.Rule.SMALL_SCORE));
}
}
@ -244,6 +246,19 @@ public class QuestionService implements IQuestionService {
return CodeEnum.SUCCESS;
}
/**
* 查询试题正确个数
* @param scores
* @return
*/
private int getCurrentNum(List<HtPatientScore> scores) {
if (CollectionUtil.isEmpty(scores)) {
return 0;
}
// 分数>0, 算1道题
return scores.stream().mapToInt(score -> score.getScore() > 0 ? 1 : 0).sum();
}
private void optionUniq(QuestionDto.Score score) {
List<Long> ids = new ArrayList<>();
Iterator<QuestionDto.Option> iterator = score.getOptions().iterator();

Loading…
Cancel
Save