|
@@ -4,6 +4,7 @@ package com.bofeng.service;
|
|
import com.baomidou.mybatisplus.toolkit.IdWorker;
|
|
import com.baomidou.mybatisplus.toolkit.IdWorker;
|
|
import com.bofeng.dao.*;
|
|
import com.bofeng.dao.*;
|
|
import com.bofeng.entity.*;
|
|
import com.bofeng.entity.*;
|
|
|
|
+import com.yvan.platform.Conv;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.joda.time.DateTime;
|
|
import org.joda.time.DateTime;
|
|
@@ -47,6 +48,95 @@ public class RiBaoService {
|
|
@Autowired
|
|
@Autowired
|
|
private UptownMapper uptownMapper;
|
|
private UptownMapper uptownMapper;
|
|
|
|
|
|
|
|
+ //健康评估
|
|
|
|
+ @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
|
+ public MsSuspected getScore(Long susprectedId, String userName, Integer medical, BigDecimal temperature, Integer cough, Integer muscle, Integer dyspnea, Integer fatigue, Integer diarrhea, Long userCreate) {
|
|
|
|
+ MsSuspected msSuspected = new MsSuspected();
|
|
|
|
+ msSuspected.setTemperatureScore(getTemperatureScore(temperature));
|
|
|
|
+ msSuspected.setScore(addScore(medical, temperature, cough, muscle, dyspnea, fatigue, diarrhea));
|
|
|
|
+ Integer scoreHistroy = msSuspectedMapper.selectUserNameScore(userCreate, userName, susprectedId);
|
|
|
|
+ msSuspected.setScoreHistroy(scoreHistroy);
|
|
|
|
+ msSuspected.setScoreRezult(scoreRezulte(medical, msSuspected.getScoreHistroy(), msSuspected.getScore()));
|
|
|
|
+ return msSuspected;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取温度评分
|
|
|
|
+ @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
|
+ public Integer getTemperatureScore(BigDecimal temperature) {
|
|
|
|
+ Integer score = 0;
|
|
|
|
+ //温度
|
|
|
|
+ if (Conv.NFloat(temperature) < Conv.NFloat(37.3))//37.3以下0分
|
|
|
|
+ score += 0;
|
|
|
|
+ if (Conv.NFloat(temperature) >= Conv.NFloat(37.4) && Conv.NFloat(temperature) <= Conv.NFloat(38))// 37.3~38℃为 1分
|
|
|
|
+ score += 1;
|
|
|
|
+ if (Conv.NFloat(temperature) >= Conv.NFloat(38.1) && Conv.NFloat(temperature) <= Conv.NFloat(39))// 38.1~39℃为中度发热 2分
|
|
|
|
+ score += 2;
|
|
|
|
+ if (Conv.NFloat(temperature) >= Conv.NFloat(39.1) && Conv.NFloat(temperature) <= Conv.NFloat(40))//39.1~40℃为高热 3分
|
|
|
|
+ score += 3;
|
|
|
|
+ if (Conv.NFloat(temperature) > Conv.NFloat(40))//340℃以上为超高热 4分
|
|
|
|
+ score += 4;
|
|
|
|
+ return score;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取总评分
|
|
|
|
+ @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
|
+ public Integer addScore(Integer medical, BigDecimal temperature, Integer cough, Integer muscle, Integer dyspnea, Integer fatigue, Integer diarrhea) {
|
|
|
|
+ Integer score = 0;
|
|
|
|
+
|
|
|
|
+ if (medical == 0) {
|
|
|
|
+ //温度
|
|
|
|
+ score += getTemperatureScore(temperature);
|
|
|
|
+ //咳嗽
|
|
|
|
+ score += cough;
|
|
|
|
+ //肌肉
|
|
|
|
+ score += muscle;
|
|
|
|
+ //肌肉
|
|
|
|
+ score += dyspnea;
|
|
|
|
+ //肌肉
|
|
|
|
+ score += fatigue;
|
|
|
|
+ //肌肉
|
|
|
|
+ score += diarrhea;
|
|
|
|
+ } else
|
|
|
|
+ score = 5;
|
|
|
|
+ return score;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //评估结果
|
|
|
|
+ @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
|
+ public Integer scoreRezulte(Integer medical, Integer scoreHistory, Integer score) {
|
|
|
|
+ Integer scoreRezult = 0;
|
|
|
|
+ if (medical == 0) {
|
|
|
|
+ //判断用户是否含有历史评分
|
|
|
|
+ if (scoreHistory == null) {
|
|
|
|
+ //判断结果
|
|
|
|
+ if (score < 1)
|
|
|
|
+ scoreRezult = 1;
|
|
|
|
+ if (score >= 1 && score <= 3)
|
|
|
|
+ scoreRezult = 2;
|
|
|
|
+ if (score == 4)
|
|
|
|
+ scoreRezult = 3;
|
|
|
|
+ if (score > 4)
|
|
|
|
+ scoreRezult = 4;
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ if (score - scoreHistory >= 3)
|
|
|
|
+ return 4;
|
|
|
|
+ else {
|
|
|
|
+ if (score < 1)
|
|
|
|
+ scoreRezult = 1;
|
|
|
|
+ if (score >= 1 && score <= 3)
|
|
|
|
+ scoreRezult = 2;
|
|
|
|
+ if (score == 4)
|
|
|
|
+ scoreRezult = 3;
|
|
|
|
+ if (score > 4)
|
|
|
|
+ scoreRezult = 4;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else
|
|
|
|
+ scoreRezult = 4;
|
|
|
|
+ return scoreRezult;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
public MsReport editRibao(Long reportId) {
|
|
public MsReport editRibao(Long reportId) {
|
|
DateTime dateTime = new DateTime();
|
|
DateTime dateTime = new DateTime();
|
|
@@ -93,11 +183,55 @@ public class RiBaoService {
|
|
ribaoDetail.setSuspectedStatus(suspectedStatus);
|
|
ribaoDetail.setSuspectedStatus(suspectedStatus);
|
|
if (ribaoDetail.getSuspectedId() != null && ribaoDetail.getSuspectedId().longValue() > 0L) {
|
|
if (ribaoDetail.getSuspectedId() != null && ribaoDetail.getSuspectedId().longValue() > 0L) {
|
|
ribaoDetail.setTimeUpdate(dateTime);
|
|
ribaoDetail.setTimeUpdate(dateTime);
|
|
|
|
+
|
|
|
|
+ //判断是否评估
|
|
|
|
+ if (ribaoDetail.getScoreRezult() == 0) {
|
|
|
|
+ MsSuspected score = getScore(
|
|
|
|
+ ribaoDetail.getSuspectedId(),
|
|
|
|
+ ribaoDetail.getUserName(),
|
|
|
|
+ ribaoDetail.getMedical(),
|
|
|
|
+ ribaoDetail.getTemperature(),
|
|
|
|
+ ribaoDetail.getCough(),
|
|
|
|
+ ribaoDetail.getMuscle(),
|
|
|
|
+ ribaoDetail.getDyspnea(),
|
|
|
|
+ ribaoDetail.getFatigue(),
|
|
|
|
+ ribaoDetail.getDiarrhea(),
|
|
|
|
+ ribaoDetail.getUserCreate());
|
|
|
|
+ if (score != null) {
|
|
|
|
+ ribaoDetail.setScoreRezult(score.getScoreRezult());
|
|
|
|
+ ribaoDetail.setScore(score.getScore());
|
|
|
|
+ ribaoDetail.setTemperatureScore(score.getTemperatureScore());
|
|
|
|
+ ribaoDetail.setScoreHistroy(score.getScoreHistroy());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
msSuspectedMapper.updateById(ribaoDetail);
|
|
msSuspectedMapper.updateById(ribaoDetail);
|
|
} else {
|
|
} else {
|
|
ribaoDetail.setSuspectedId(IdWorker.getId());
|
|
ribaoDetail.setSuspectedId(IdWorker.getId());
|
|
ribaoDetail.setTimeCreate(dateTime);
|
|
ribaoDetail.setTimeCreate(dateTime);
|
|
ribaoDetail.setTimeUpdate(dateTime);
|
|
ribaoDetail.setTimeUpdate(dateTime);
|
|
|
|
+
|
|
|
|
+ //判断是否评估
|
|
|
|
+ if (ribaoDetail.getScoreRezult() == 0) {
|
|
|
|
+ MsSuspected score = getScore(
|
|
|
|
+ 0L,
|
|
|
|
+ ribaoDetail.getUserName(),
|
|
|
|
+ ribaoDetail.getMedical(),
|
|
|
|
+ ribaoDetail.getTemperature(),
|
|
|
|
+ ribaoDetail.getCough(),
|
|
|
|
+ ribaoDetail.getMuscle(),
|
|
|
|
+ ribaoDetail.getDyspnea(),
|
|
|
|
+ ribaoDetail.getFatigue(),
|
|
|
|
+ ribaoDetail.getDiarrhea(),
|
|
|
|
+ ribaoDetail.getUserCreate());
|
|
|
|
+ if (score != null) {
|
|
|
|
+ ribaoDetail.setScoreRezult(score.getScoreRezult());
|
|
|
|
+ ribaoDetail.setScore(score.getScore());
|
|
|
|
+ ribaoDetail.setTemperatureScore(score.getTemperatureScore());
|
|
|
|
+ ribaoDetail.setScoreHistroy(score.getScoreHistroy());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
msSuspectedMapper.insert(ribaoDetail);
|
|
msSuspectedMapper.insert(ribaoDetail);
|
|
}
|
|
}
|
|
|
|
|