|
|
|
@ -53,7 +53,9 @@ import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.text.DecimalFormat; |
|
|
|
import java.time.Duration; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalTime; |
|
|
|
import java.time.Period; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
|
@ -106,18 +108,24 @@ public class RmsServiceImpl implements IRmsService { |
|
|
|
private TzbsRmsReportYsjyMapper rmsReportYsjyMapper; |
|
|
|
|
|
|
|
|
|
|
|
public int getAge(PmsPatient pmsPatient) { |
|
|
|
if (pmsPatient.getBirthYear() != null) { |
|
|
|
Calendar instance = Calendar.getInstance(); |
|
|
|
return instance.get(Calendar.YEAR) - pmsPatient.getBirthYear(); |
|
|
|
public int getAge(String birthday) { |
|
|
|
if (birthday == null || birthday.trim().isEmpty()) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
try { |
|
|
|
LocalDate birthDate = LocalDate.parse(birthday); |
|
|
|
return Period.between(birthDate, LocalDate.now()).getYears(); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("计算年龄失败", e); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 递归组装ReportScore的父子级树形结构 |
|
|
|
* |
|
|
|
* @param allReportScores 所有未组装的ReportScore列表 |
|
|
|
* @param rootParentId 根节点的parentId(比如0或null,根据业务定义) |
|
|
|
* @param rootParentId 根节点的parentId(比如0或null,根据业务定义) |
|
|
|
* @return 组装好的树形结构根节点列表 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@ -154,8 +162,9 @@ public class RmsServiceImpl implements IRmsService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 递归为单个节点组装子节点 |
|
|
|
* |
|
|
|
* @param parentNode 父节点 |
|
|
|
* @param scoreMap 所有节点的Map(key=scaleId) |
|
|
|
* @param scoreMap 所有节点的Map(key=scaleId) |
|
|
|
*/ |
|
|
|
private static void buildChildren(RmsVo.ReportScore parentNode, Map<String, RmsVo.ReportScore> scoreMap) { |
|
|
|
// 遍历所有节点,找到当前父节点的子节点(子节点的parentId=父节点的scaleId转Long)
|
|
|
|
@ -192,6 +201,7 @@ public class RmsServiceImpl implements IRmsService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 对ReportScore列表按排序字段排序(优先sort,其次ecrSort) |
|
|
|
* |
|
|
|
* @param reportScores 待排序的列表 |
|
|
|
*/ |
|
|
|
private static void sortReportScoreTree(List<RmsVo.ReportScore> reportScores) { |
|
|
|
@ -211,104 +221,119 @@ public class RmsServiceImpl implements IRmsService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public RmsVo.ReportDetail queryReportDetail(RmsDto.QueryDetail dto) { |
|
|
|
//查找测评信息
|
|
|
|
EmsEvaluation emsEvaluation = emsEvaluationMapper.selectByPrimaryKey(dto.getEvaluationId()); |
|
|
|
if(ObjectUtil.isNull(emsEvaluation)){ |
|
|
|
throw new RuntimeException("未找到测评信息"); |
|
|
|
} |
|
|
|
//查找患者信息
|
|
|
|
PmsPatient pmsPatient = pmsPatientMapper.selectByPrimaryKey(emsEvaluation.getPatientId()); |
|
|
|
if(ObjectUtil.isNull(pmsPatient)){ |
|
|
|
throw new RuntimeException("未找到患者信息"); |
|
|
|
} |
|
|
|
|
|
|
|
//根据测评id查找报告单
|
|
|
|
RmsReportExample reportExample = new RmsReportExample(); |
|
|
|
reportExample.createCriteria().andEvaluationIdEqualTo(dto.getEvaluationId()).andDelFlagEqualTo((byte) 0); |
|
|
|
List<RmsReport> rmsReports = rmsReportMapper.selectByExample(reportExample); |
|
|
|
RmsReport report; |
|
|
|
//查询测评量表
|
|
|
|
if (CollUtil.isNotEmpty(rmsReports)) { |
|
|
|
RmsReport rmsReport = new RmsReport(); |
|
|
|
rmsReport.setDelFlag((byte) 1); |
|
|
|
rmsReportMapper.updateByExampleSelective(rmsReport, reportExample); |
|
|
|
//删除报告单分数
|
|
|
|
RmsReportScaleScore reportScaleScore = new RmsReportScaleScore(); |
|
|
|
reportScaleScore.setDelFlag((byte) 1); |
|
|
|
RmsReportScaleScoreExample reportScaleScoreExample = new RmsReportScaleScoreExample(); |
|
|
|
reportScaleScoreExample.createCriteria().andReportIdEqualTo(dto.getEvaluationId()); |
|
|
|
rmsReportScaleScoreMapper.updateByExampleSelective(reportScaleScore, reportScaleScoreExample); |
|
|
|
} |
|
|
|
//查询测评量表及分数
|
|
|
|
List<RmsVo.ReportScore> scores = rmsDao.queryEmsScaleScore(dto.getEvaluationId(), CollectionUtil.newArrayList()); |
|
|
|
if (CollUtil.isNotEmpty(scores)) { |
|
|
|
//组装成父子级关系
|
|
|
|
scores = buildReportScoreTree(scores, 0L); |
|
|
|
} |
|
|
|
Map<String, RmsReportScaleScore> reportScaleScoreMap = new HashMap<>(); |
|
|
|
if (CollUtil.isEmpty(rmsReports)) { |
|
|
|
//生成报告单
|
|
|
|
report = new RmsReport(); |
|
|
|
report.setId(IDGenerator.nextSnowflakeId()); |
|
|
|
report.setName(GenConstants.Ht.Report.PARENT_NAME + DateUtil.today()); |
|
|
|
report.setEvaluationId(dto.getEvaluationId()); |
|
|
|
report.setReportTime(System.currentTimeMillis()); |
|
|
|
//查找测评信息
|
|
|
|
EmsEvaluation emsEvaluation = emsEvaluationMapper.selectByPrimaryKey(dto.getEvaluationId()); |
|
|
|
if (ObjectUtil.isNotNull(emsEvaluation)) { |
|
|
|
//查找病人信息
|
|
|
|
PmsPatient pmsPatient = pmsPatientMapper.selectByPrimaryKey(emsEvaluation.getPatientId()); |
|
|
|
if (ObjectUtil.isNotNull(pmsPatient)) { |
|
|
|
report.setPatientAge(getAge(pmsPatient)); |
|
|
|
} |
|
|
|
//修改测评的状态
|
|
|
|
if (dto.getComplateStatus() != null) { |
|
|
|
emsEvaluation.setCompleteStatus(dto.getComplateStatus()); |
|
|
|
} |
|
|
|
emsEvaluationMapper.updateByPrimaryKeySelective(emsEvaluation); |
|
|
|
report.setVisitNo(emsEvaluation.getVisitNo()); |
|
|
|
} |
|
|
|
rmsReportMapper.insertSelective(report); |
|
|
|
// RmsReportScaleScoreExample rmsReportScaleScoreExample = new RmsReportScaleScoreExample();
|
|
|
|
// rmsReportScaleScoreExample.createCriteria().andReportIdEqualTo(dto.getEvaluationId());
|
|
|
|
|
|
|
|
//生成报告单
|
|
|
|
RmsReport report = new RmsReport(); |
|
|
|
report.setId(IDGenerator.nextSnowflakeId()); |
|
|
|
report.setName(GenConstants.Ht.Report.PARENT_NAME + DateUtil.today()); |
|
|
|
report.setEvaluationId(dto.getEvaluationId()); |
|
|
|
report.setReportTime(System.currentTimeMillis()); |
|
|
|
report.setPatientAge(getAge(pmsPatient.getBirthday())); |
|
|
|
//修改测评的状态
|
|
|
|
if (dto.getComplateStatus() != null) { |
|
|
|
emsEvaluation.setCompleteStatus(dto.getComplateStatus()); |
|
|
|
} |
|
|
|
emsEvaluationMapper.updateByPrimaryKeySelective(emsEvaluation); |
|
|
|
report.setVisitNo(emsEvaluation.getVisitNo()); |
|
|
|
rmsReportMapper.insertSelective(report); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(scores)) { |
|
|
|
scores.forEach(score -> { |
|
|
|
if ("TZBS_LN".equals(score.getCode()) || "TZBS_BZ".equals(score.getCode())) { |
|
|
|
if (CollUtil.isNotEmpty(scores)) { |
|
|
|
scores.forEach(score -> { |
|
|
|
if ("TZBS_LN".equals(score.getCode()) || "TZBS_BZ".equals(score.getCode())) { |
|
|
|
// 添加体质辨识结论
|
|
|
|
List<TzbsRmsReportResult> reportResultList = score.getReportResultList(); |
|
|
|
if (CollUtil.isNotEmpty(reportResultList)) { |
|
|
|
reportResultList.forEach(reportResult -> { |
|
|
|
reportResult.setReportId(report.getId()); |
|
|
|
}); |
|
|
|
clientEvaDao.batchInsertReportResult(reportResultList); |
|
|
|
} |
|
|
|
List<TzbsRmsReportResult> reportResultList = score.getReportResultList(); |
|
|
|
if (CollUtil.isNotEmpty(reportResultList)) { |
|
|
|
reportResultList.forEach(reportResult -> { |
|
|
|
reportResult.setReportId(report.getId()); |
|
|
|
}); |
|
|
|
clientEvaDao.batchInsertReportResult(reportResultList); |
|
|
|
} |
|
|
|
|
|
|
|
//添加体质辨识养生建议
|
|
|
|
List<TzbsRmsReportYsjy> reportYsjyList = score.getReportYsjyList(); |
|
|
|
if (CollUtil.isNotEmpty(reportYsjyList)) { |
|
|
|
reportYsjyList.forEach(reportResult -> { |
|
|
|
reportResult.setReportId(report.getId()); |
|
|
|
rmsReportYsjyMapper.insertSelective(reportResult); |
|
|
|
}); |
|
|
|
} |
|
|
|
//添加体质辨识养生建议
|
|
|
|
List<TzbsRmsReportYsjy> reportYsjyList = score.getReportYsjyList(); |
|
|
|
if (CollUtil.isNotEmpty(reportYsjyList)) { |
|
|
|
reportYsjyList.forEach(reportResult -> { |
|
|
|
reportResult.setReportId(report.getId()); |
|
|
|
rmsReportYsjyMapper.insertSelective(reportResult); |
|
|
|
}); |
|
|
|
} |
|
|
|
//添加量表分数统计
|
|
|
|
RmsReportScaleScore reportScaleScore = new RmsReportScaleScore(); |
|
|
|
reportScaleScore.setId(IDGenerator.nextSnowflakeId()); |
|
|
|
reportScaleScore.setReportId(report.getId()); |
|
|
|
reportScaleScore.setScaleCode(score.getCode()); |
|
|
|
reportScaleScore.setImpression(score.getImpression()); |
|
|
|
reportScaleScore.setScore(score.getScore()); |
|
|
|
rmsReportScaleScoreMapper.insertSelective(reportScaleScore); |
|
|
|
reportScaleScoreMap.put(score.getCode(), reportScaleScore); |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
report = rmsReports.get(0); |
|
|
|
//查找测评信息
|
|
|
|
EmsEvaluation emsEvaluation = emsEvaluationMapper.selectByPrimaryKey(dto.getEvaluationId()); |
|
|
|
if (ObjectUtil.isNotNull(emsEvaluation)) { |
|
|
|
//修改测评的状态
|
|
|
|
if (dto.getComplateStatus() != null) { |
|
|
|
emsEvaluation.setCompleteStatus(dto.getComplateStatus()); |
|
|
|
emsEvaluationMapper.updateByPrimaryKeySelective(emsEvaluation); |
|
|
|
} |
|
|
|
} |
|
|
|
//添加量表分数统计
|
|
|
|
RmsReportScaleScore reportScaleScore = new RmsReportScaleScore(); |
|
|
|
reportScaleScore.setId(IDGenerator.nextSnowflakeId()); |
|
|
|
reportScaleScore.setReportId(report.getId()); |
|
|
|
reportScaleScore.setScaleCode(score.getCode()); |
|
|
|
reportScaleScore.setResult(score.getImpression()); |
|
|
|
reportScaleScore.setScore(score.getScore()); |
|
|
|
reportScaleScore.setIsShow((byte) 1); |
|
|
|
reportScaleScore.setComboId(score.getComboId()); |
|
|
|
reportScaleScore.setSort(score.getSort()); |
|
|
|
rmsReportScaleScoreMapper.insertSelective(reportScaleScore); |
|
|
|
reportScaleScoreMap.put(score.getCode(), reportScaleScore); |
|
|
|
}); |
|
|
|
} |
|
|
|
//肌少结论生成
|
|
|
|
//处理肌少
|
|
|
|
String jishaoResult = addJs(scores); |
|
|
|
if (StrUtil.isNotEmpty(jishaoResult)) { |
|
|
|
RmsReportScaleScore reportScaleScore = new RmsReportScaleScore(); |
|
|
|
reportScaleScore.setId(IDGenerator.nextSnowflakeId()); |
|
|
|
reportScaleScore.setReportId(report.getId()); |
|
|
|
reportScaleScore.setScaleCode("JI_SHAO"); |
|
|
|
reportScaleScore.setImpression(jishaoResult); |
|
|
|
reportScaleScore.setSort(scores.size() + 1); |
|
|
|
reportScaleScore.setIsShow((byte) 0); |
|
|
|
rmsReportScaleScoreMapper.insertSelective(reportScaleScore); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
RmsVo.ReportDetail detail = new RmsVo.ReportDetail(); |
|
|
|
//查询报告单信息和病人信息
|
|
|
|
RmsVo.ReportPatient reportPatient = rmsDao.queryReportResult(report.getId()); |
|
|
|
|
|
|
|
//查找患者做过的测评的最早和最晚的时间
|
|
|
|
RmsVo.PatientEvaluationTime time = new RmsVo.PatientEvaluationTime(); |
|
|
|
if (ObjectUtil.isNotNull(reportPatient)) { |
|
|
|
time = rmsDao.getTimeByPatientId(reportPatient.getPatientId()); |
|
|
|
if (ObjectUtil.isNull(time)) { |
|
|
|
time = new RmsVo.PatientEvaluationTime(); |
|
|
|
time.setMinTime(new Date()); |
|
|
|
time.setMaxTime(new Date()); |
|
|
|
} |
|
|
|
time = rmsDao.getTimeByPatientId(pmsPatient.getId()); |
|
|
|
if (ObjectUtil.isNull(time)) { |
|
|
|
time = new RmsVo.PatientEvaluationTime(); |
|
|
|
time.setMinTime(new Date()); |
|
|
|
time.setMaxTime(new Date()); |
|
|
|
} |
|
|
|
|
|
|
|
EmsEvaluation emsEvaluation = emsEvaluationMapper.selectByPrimaryKey(dto.getEvaluationId()); |
|
|
|
PmsPatient pmsPatient = pmsPatientMapper.selectByPrimaryKey(emsEvaluation.getPatientId()); |
|
|
|
// PmsPatient pmsPatient = pmsPatientMapper.selectByPrimaryKey(emsEvaluation.getPatientId());
|
|
|
|
if (ObjectUtil.isNotNull(emsEvaluation) && CollUtil.isNotEmpty(scores)) { |
|
|
|
for (RmsVo.ReportScore score : scores) { |
|
|
|
//查询量表试题
|
|
|
|
@ -372,23 +397,117 @@ public class RmsServiceImpl implements IRmsService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//删除延迟回忆
|
|
|
|
Object objects = redisUtil.get("message_" + dto.getEvaluationId()); |
|
|
|
if (objects != null) { |
|
|
|
Set<MessageDto.QuestionInform> set = (Set<MessageDto.QuestionInform>) objects; |
|
|
|
if (CollectionUtil.isNotEmpty(set)) { |
|
|
|
MessageDto.QuestionInform questionInform = new MessageDto.QuestionInform(); |
|
|
|
questionInform.setQuestionId(0L); |
|
|
|
set.remove(questionInform); |
|
|
|
} |
|
|
|
redisUtil.deleteObject("message_" + dto.getEvaluationId()); |
|
|
|
//查询报告单信息和病人信息
|
|
|
|
RmsVo.ReportPatient reportPatient = rmsDao.queryReportResult(report.getId()); |
|
|
|
detail.setPatient(reportPatient); |
|
|
|
detail.setScores(scores); |
|
|
|
return detail; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public RmsVo.ReportDetail queryReport(RmsDto.QueryDetail dto) { |
|
|
|
//根据测评id查找报告单
|
|
|
|
RmsReportExample reportExample = new RmsReportExample(); |
|
|
|
reportExample.createCriteria().andEvaluationIdEqualTo(dto.getEvaluationId()).andDelFlagEqualTo((byte) 0); |
|
|
|
List<RmsReport> rmsReports = rmsReportMapper.selectByExample(reportExample); |
|
|
|
if (CollUtil.isEmpty(rmsReports)) { |
|
|
|
return queryReportDetail(dto); |
|
|
|
} |
|
|
|
RmsReport report = rmsReports.get(0); |
|
|
|
RmsVo.ReportDetail detail = new RmsVo.ReportDetail(); |
|
|
|
//查询报告单信息和病人信息
|
|
|
|
RmsVo.ReportPatient reportPatient = rmsDao.queryReportResult(report.getId()); |
|
|
|
|
|
|
|
//查找患者做过的测评的最早和最晚的时间
|
|
|
|
RmsVo.PatientEvaluationTime time = new RmsVo.PatientEvaluationTime(); |
|
|
|
if (ObjectUtil.isNotNull(reportPatient)) { |
|
|
|
time = rmsDao.getTimeByPatientId(reportPatient.getPatientId()); |
|
|
|
if (ObjectUtil.isNull(time)) { |
|
|
|
time = new RmsVo.PatientEvaluationTime(); |
|
|
|
time.setMinTime(new Date()); |
|
|
|
time.setMaxTime(new Date()); |
|
|
|
} |
|
|
|
} |
|
|
|
//查询测评量表
|
|
|
|
List<RmsVo.ReportScore> scores = rmsDao.queryEmsScaleScore(dto.getEvaluationId(), CollectionUtil.newArrayList()); |
|
|
|
if (CollUtil.isNotEmpty(scores)) { |
|
|
|
//组装成父子级关系
|
|
|
|
scores = buildReportScoreTree(scores, 0L); |
|
|
|
} |
|
|
|
detail.setPatient(reportPatient); |
|
|
|
detail.setScores(scores); |
|
|
|
return detail; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 添加肌少套餐结论 |
|
|
|
* 判断是否添加肌少总结论 |
|
|
|
* 如果四项测试有一项没做,则跳过 |
|
|
|
* |
|
|
|
* @param scores |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
//
|
|
|
|
//
|
|
|
|
private String addJs(List<RmsVo.ReportScore> scores) { |
|
|
|
//指定套餐才会触发,暂定写死套餐id
|
|
|
|
scores = scores.stream().filter(score -> score.getComboId() != null && score.getComboId() == 1982986055883821056L).collect(Collectors.toList()); |
|
|
|
if (CollUtil.isEmpty(scores)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
String str = ""; |
|
|
|
List<RmsVo.ReportScore> sarcCalf = scores.stream().filter( |
|
|
|
score -> score.getCode().equals("SARC-Calf") |
|
|
|
).collect(Collectors.toList()); |
|
|
|
List<RmsVo.ReportScore> wczl = scores.stream().filter( |
|
|
|
score -> score.getCode().equals("5CZLSY") |
|
|
|
).collect(Collectors.toList()); |
|
|
|
List<RmsVo.ReportScore> szggj = scores.stream().filter( |
|
|
|
score -> score.getCode().equals("SZGGJ") |
|
|
|
).collect(Collectors.toList()); |
|
|
|
List<RmsVo.ReportScore> wlcd = scores.stream().filter( |
|
|
|
score -> score.getCode().equals("WLCD") |
|
|
|
).collect(Collectors.toList()); |
|
|
|
List<RmsVo.ReportScore> lmbs = scores.stream().filter( |
|
|
|
score -> score.getCode().equals("LMBS") |
|
|
|
).collect(Collectors.toList()); |
|
|
|
if (CollUtil.isNotEmpty(sarcCalf)) { |
|
|
|
QmsScaleAssConf sarcCalfConf = amsDao.queryScaleAssConf1(sarcCalf.get(0).getCode(), sarcCalf.get(0).getScore(), null); |
|
|
|
if (sarcCalfConf != null) { |
|
|
|
str = sarcCalfConf.getResult(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (CollUtil.isEmpty(wczl) || CollUtil.isEmpty(szggj) || CollUtil.isEmpty(wlcd) || CollUtil.isEmpty(lmbs)) { |
|
|
|
return str; |
|
|
|
} |
|
|
|
|
|
|
|
QmsScaleAssConf wczlConf = amsDao.queryScaleAssConf1(wczl.get(0).getCode(), wczl.get(0).getScore(), null); |
|
|
|
QmsScaleAssConf szggjConf = amsDao.queryScaleAssConf1(szggj.get(0).getCode(), szggj.get(0).getScore(), null); |
|
|
|
QmsScaleAssConf wlcdConf = amsDao.queryScaleAssConf1(wlcd.get(0).getCode(), wlcd.get(0).getScore(), null); |
|
|
|
QmsScaleAssConf lmbsConf = amsDao.queryScaleAssConf1(lmbs.get(0).getCode(), lmbs.get(0).getScore(), null); |
|
|
|
if (wczlConf != null && szggjConf != null && wlcdConf != null && lmbsConf != null) { |
|
|
|
// *四项测试结果都正常,说明没有肌少症风险
|
|
|
|
// *如果四肢骨骼肌身高质量指数(ASMI)正常,肌肉力量或(及)躯体功能下降,则有肌少症风险;
|
|
|
|
// *如果四项测试值全部低于标准值,则诊断为严重肌少症。
|
|
|
|
// *如果四肢骨骼肌身高质量指数(ASMI)低于标准值,肌肉力量或躯体功能其中有一项低于标准值,则诊断为肌少症;
|
|
|
|
// *否则有肌少症风险
|
|
|
|
if (!"1".equals(wczlConf.getNeedPlan()) && !"1".equals(szggjConf.getNeedPlan()) && !"1".equals(wlcdConf.getNeedPlan()) && !"1".equals(lmbsConf.getNeedPlan())) { |
|
|
|
//没有肌少症风险
|
|
|
|
return StrUtil.isEmpty(str) ? "没有肌少症风险" : str + "\n" + "没有肌少症风险"; |
|
|
|
} else if (!"1".equals(szggjConf.getNeedPlan()) && "1".equals(wlcdConf.getNeedPlan()) && "1".equals(lmbsConf.getNeedPlan()) && "1".equals(wczlConf.getNeedPlan())) { |
|
|
|
return StrUtil.isEmpty(str) ? "有肌少症风险" : str + "\n" + "有肌少症风险"; |
|
|
|
} else if ("1".equals(wczlConf.getNeedPlan()) && "1".equals(wlcdConf.getNeedPlan()) && "1".equals(lmbsConf.getNeedPlan()) && "1".equals(szggjConf.getNeedPlan())) { |
|
|
|
return StrUtil.isEmpty(str) ? "严重肌少症" : str + "\n" + "严重肌少症"; |
|
|
|
} else if ("1".equals(szggjConf.getNeedPlan()) && ("1".equals(wlcdConf.getNeedPlan()) || "1".equals(lmbsConf.getNeedPlan()) || "1".equals(wczlConf.getNeedPlan()))) { |
|
|
|
return StrUtil.isEmpty(str) ? "肌少症" : str + "\n" + "肌少症"; |
|
|
|
} else { |
|
|
|
return StrUtil.isEmpty(str) ? "有肌少症风险" : str + "\n" + "有肌少症风险"; |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ClientEvaVo.ReportView reportView(Long evaluationId, String code) { |
|
|
|
ClientEvaVo.ReportView vo = clientEvaDao.getTzbsResult(evaluationId, code); |
|
|
|
@ -837,9 +956,9 @@ public class RmsServiceImpl implements IRmsService { |
|
|
|
|
|
|
|
// 记忆指数:自由回忆*3+分类提示*2+多选提示*1 范围0-15分
|
|
|
|
if (sortScoreMap.containsKey(huiyi) || sortScoreMap.containsKey(fenlei) || sortScoreMap.containsKey(duoxuan)) { |
|
|
|
jiYi = sortScoreMap.getOrDefault(huiyi, zero).multiply(new BigDecimal(3)) |
|
|
|
.add(sortScoreMap.getOrDefault(fenlei, zero).multiply(new BigDecimal(2))) |
|
|
|
.add(sortScoreMap.getOrDefault(duoxuan, zero)); |
|
|
|
jiYi = getOrDefaultSafe(sortScoreMap,huiyi, zero).multiply(new BigDecimal(3)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,fenlei, zero).multiply(new BigDecimal(2))) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,duoxuan, zero)); |
|
|
|
} |
|
|
|
RmsVo.ScoreDistribution jiYiScore = new RmsVo.ScoreDistribution("jiYi", "记忆指数", ObjectUtil.isNull(jiYi) ? BigDecimal.ZERO : jiYi); |
|
|
|
cognitiveDomainList.add(jiYiScore); |
|
|
|
@ -849,26 +968,26 @@ public class RmsServiceImpl implements IRmsService { |
|
|
|
|| sortScoreMap.containsKey(daobei) || sortScoreMap.containsKey(jingjuexing) || sortScoreMap.containsKey(jianfa) |
|
|
|
|| sortScoreMap.containsKey(dongwu) || sortScoreMap.containsKey(xiangsixing) |
|
|
|
) { |
|
|
|
zhiXing = sortScoreMap.getOrDefault(lianxian, zero).add(sortScoreMap.getOrDefault(huazhong, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(shunbei, zero)).add(sortScoreMap.getOrDefault(daobei, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(jingjuexing, zero)).add(sortScoreMap.getOrDefault(jianfa, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(dongwu, zero)).add(sortScoreMap.getOrDefault(xiangsixing, zero)); |
|
|
|
zhiXing = getOrDefaultSafe(sortScoreMap,lianxian, zero).add(getOrDefaultSafe(sortScoreMap,huazhong, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,shunbei, zero)).add(getOrDefaultSafe(sortScoreMap,daobei, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,jingjuexing, zero)).add(getOrDefaultSafe(sortScoreMap,jianfa, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,dongwu, zero)).add(getOrDefaultSafe(sortScoreMap,xiangsixing, zero)); |
|
|
|
} |
|
|
|
RmsVo.ScoreDistribution zhiXingScore = new RmsVo.ScoreDistribution("zhiXing", "执行指数", ObjectUtil.isNull(zhiXing) ? BigDecimal.ZERO : zhiXing); |
|
|
|
cognitiveDomainList.add(zhiXingScore); |
|
|
|
// 视空间指数:立方体+画钟+命名 0-7分
|
|
|
|
if (sortScoreMap.containsKey(lifangti) || sortScoreMap.containsKey(huazhong) |
|
|
|
|| sortScoreMap.containsKey(mingming1) || sortScoreMap.containsKey(mingming2) || sortScoreMap.containsKey(mingming3)) { |
|
|
|
kongJian = sortScoreMap.getOrDefault(lifangti, zero).add(sortScoreMap.getOrDefault(huazhong, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(mingming1, zero)).add(sortScoreMap.getOrDefault(mingming2, zero)).add(sortScoreMap.getOrDefault(mingming3, zero)); |
|
|
|
kongJian = getOrDefaultSafe(sortScoreMap,lifangti, zero).add(getOrDefaultSafe(sortScoreMap,huazhong, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,mingming1, zero)).add(getOrDefaultSafe(sortScoreMap,mingming2, zero)).add(getOrDefaultSafe(sortScoreMap,mingming3, zero)); |
|
|
|
} |
|
|
|
RmsVo.ScoreDistribution kongJianScore = new RmsVo.ScoreDistribution("kongJian", "视空间指数", ObjectUtil.isNull(kongJian) ? BigDecimal.ZERO : kongJian); |
|
|
|
cognitiveDomainList.add(kongJianScore); |
|
|
|
// 语言指数:命名+句子复述+词语流畅性 0-6分
|
|
|
|
if (sortScoreMap.containsKey(mingming1) || sortScoreMap.containsKey(mingming2) || sortScoreMap.containsKey(mingming3) |
|
|
|
|| sortScoreMap.containsKey(fushu1) || sortScoreMap.containsKey(fushu2) || sortScoreMap.containsKey(dongwu)) { |
|
|
|
yuYan = sortScoreMap.getOrDefault(mingming1, zero).add(sortScoreMap.getOrDefault(mingming2, zero)).add(sortScoreMap.getOrDefault(mingming3, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(chongfu1, zero)).add(sortScoreMap.getOrDefault(chongfu2, zero)).add(sortScoreMap.getOrDefault(dongwu, zero)); |
|
|
|
yuYan = getOrDefaultSafe(sortScoreMap,mingming1, zero).add(getOrDefaultSafe(sortScoreMap,mingming2, zero)).add(getOrDefaultSafe(sortScoreMap,mingming3, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,chongfu1, zero)).add(getOrDefaultSafe(sortScoreMap,chongfu2, zero)).add(getOrDefaultSafe(sortScoreMap,dongwu, zero)); |
|
|
|
} |
|
|
|
RmsVo.ScoreDistribution yuYanScore = new RmsVo.ScoreDistribution("yuYan", "语言指数", ObjectUtil.isNull(yuYan) ? BigDecimal.ZERO : yuYan); |
|
|
|
cognitiveDomainList.add(yuYanScore); |
|
|
|
@ -876,15 +995,15 @@ public class RmsServiceImpl implements IRmsService { |
|
|
|
if (sortScoreMap.containsKey(shunbei) || sortScoreMap.containsKey(daobei) || sortScoreMap.containsKey(jingjuexing) |
|
|
|
|| sortScoreMap.containsKey(jianfa) || sortScoreMap.containsKey(chongfu1) || sortScoreMap.containsKey(chongfu2) |
|
|
|
|| sortScoreMap.containsKey(fushu1) || sortScoreMap.containsKey(fushu2)) { |
|
|
|
zhuYi = sortScoreMap.getOrDefault(shunbei, zero).add(sortScoreMap.getOrDefault(daobei, zero)).add(sortScoreMap.getOrDefault(jingjuexing, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(jianfa, zero)).add(sortScoreMap.getOrDefault(chongfu1, zero)).add(sortScoreMap.getOrDefault(chongfu2, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(fushu1, zero)).add(sortScoreMap.getOrDefault(fushu2, zero)); |
|
|
|
zhuYi = getOrDefaultSafe(sortScoreMap,shunbei, zero).add(getOrDefaultSafe(sortScoreMap,daobei, zero)).add(getOrDefaultSafe(sortScoreMap,jingjuexing, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,jianfa, zero)).add(getOrDefaultSafe(sortScoreMap,chongfu1, zero)).add(getOrDefaultSafe(sortScoreMap,chongfu2, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,fushu1, zero)).add(getOrDefaultSafe(sortScoreMap,fushu2, zero)); |
|
|
|
} |
|
|
|
RmsVo.ScoreDistribution zhuYiScore = new RmsVo.ScoreDistribution("zhuYi", "注意指数", ObjectUtil.isNull(zhuYi) ? BigDecimal.ZERO : zhuYi); |
|
|
|
cognitiveDomainList.add(zhuYiScore); |
|
|
|
// 定向指数:定向 0-6分
|
|
|
|
if (sortScoreMap.containsKey(shijian) || sortScoreMap.containsKey(didian)) { |
|
|
|
dingXiang = sortScoreMap.getOrDefault(shijian, zero).add(sortScoreMap.getOrDefault(didian, zero)); |
|
|
|
dingXiang = getOrDefaultSafe(sortScoreMap,shijian, zero).add(getOrDefaultSafe(sortScoreMap,didian, zero)); |
|
|
|
} |
|
|
|
RmsVo.ScoreDistribution dingXiangScore = new RmsVo.ScoreDistribution("dingXiang", "定向指数", ObjectUtil.isNull(dingXiang) ? BigDecimal.ZERO : dingXiang); |
|
|
|
cognitiveDomainList.add(dingXiangScore); |
|
|
|
@ -894,6 +1013,10 @@ public class RmsServiceImpl implements IRmsService { |
|
|
|
return scoreDistributions; |
|
|
|
} |
|
|
|
|
|
|
|
public static <K, V> V getOrDefaultSafe(Map<K, V> map, K key, V defaultValue) { |
|
|
|
return map.containsKey(key) && map.get(key) != null ? map.get(key) : defaultValue; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param score |
|
|
|
* @param educationalStatus 教育程度(1:文盲 2:小学 3:初中 4:高中 5:大学 6:大学以上 7:其他) |
|
|
|
@ -2499,43 +2622,43 @@ public class RmsServiceImpl implements IRmsService { |
|
|
|
BigDecimal zero = new BigDecimal(0); |
|
|
|
// 记忆指数:自由回忆*3+分类提示*2+多选提示*1 范围0-15分
|
|
|
|
if (sortScoreMap.containsKey(huiyi) || sortScoreMap.containsKey(fenlei) || sortScoreMap.containsKey(duoxuan)) { |
|
|
|
jiYi = sortScoreMap.getOrDefault(huiyi, zero).multiply(new BigDecimal(3)) |
|
|
|
.add(sortScoreMap.getOrDefault(fenlei, zero).multiply(new BigDecimal(2))) |
|
|
|
.add(sortScoreMap.getOrDefault(duoxuan, zero)); |
|
|
|
jiYi = getOrDefaultSafe(sortScoreMap,huiyi, zero).multiply(new BigDecimal(3)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,fenlei, zero).multiply(new BigDecimal(2))) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,duoxuan, zero)); |
|
|
|
} |
|
|
|
// 执行指数:连线测验+画钟+数字广度顺+数字广度逆+警觉性(听1敲桌子)+连续减7+词语流畅性(1分钟说动物)+抽象(词语相似性) 0-13分 1+3+1+1+1+3+1+2=13
|
|
|
|
if (sortScoreMap.containsKey(lianxian) || sortScoreMap.containsKey(huazhong) || sortScoreMap.containsKey(shunbei) |
|
|
|
|| sortScoreMap.containsKey(daobei) || sortScoreMap.containsKey(jingjuexing) || sortScoreMap.containsKey(jianfa) |
|
|
|
|| sortScoreMap.containsKey(dongwu) || sortScoreMap.containsKey(xiangsixing) |
|
|
|
) { |
|
|
|
zhiXing = sortScoreMap.getOrDefault(lianxian, zero).add(sortScoreMap.getOrDefault(huazhong, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(shunbei, zero)).add(sortScoreMap.getOrDefault(daobei, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(jingjuexing, zero)).add(sortScoreMap.getOrDefault(jianfa, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(dongwu, zero)).add(sortScoreMap.getOrDefault(xiangsixing, zero)); |
|
|
|
zhiXing = getOrDefaultSafe(sortScoreMap,lianxian, zero).add(getOrDefaultSafe(sortScoreMap,huazhong, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,shunbei, zero)).add(getOrDefaultSafe(sortScoreMap,daobei, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,jingjuexing, zero)).add(getOrDefaultSafe(sortScoreMap,jianfa, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,dongwu, zero)).add(getOrDefaultSafe(sortScoreMap,xiangsixing, zero)); |
|
|
|
} |
|
|
|
// 视空间指数:立方体+画钟+命名 0-7分
|
|
|
|
if (sortScoreMap.containsKey(lifangti) || sortScoreMap.containsKey(huazhong) |
|
|
|
|| sortScoreMap.containsKey(mingming1) || sortScoreMap.containsKey(mingming2) || sortScoreMap.containsKey(mingming3)) { |
|
|
|
kongJian = sortScoreMap.getOrDefault(lifangti, zero).add(sortScoreMap.getOrDefault(huazhong, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(mingming1, zero)).add(sortScoreMap.getOrDefault(mingming2, zero)).add(sortScoreMap.getOrDefault(mingming3, zero)); |
|
|
|
kongJian = getOrDefaultSafe(sortScoreMap,lifangti, zero).add(getOrDefaultSafe(sortScoreMap,huazhong, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,mingming1, zero)).add(getOrDefaultSafe(sortScoreMap,mingming2, zero)).add(getOrDefaultSafe(sortScoreMap,mingming3, zero)); |
|
|
|
} |
|
|
|
// 语言指数:命名+句子复述+词语流畅性 0-6分
|
|
|
|
if (sortScoreMap.containsKey(mingming1) || sortScoreMap.containsKey(mingming2) || sortScoreMap.containsKey(mingming3) |
|
|
|
|| sortScoreMap.containsKey(fushu1) || sortScoreMap.containsKey(fushu2) || sortScoreMap.containsKey(dongwu)) { |
|
|
|
yuYan = sortScoreMap.getOrDefault(mingming1, zero).add(sortScoreMap.getOrDefault(mingming2, zero)).add(sortScoreMap.getOrDefault(mingming3, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(chongfu1, zero)).add(sortScoreMap.getOrDefault(chongfu2, zero)).add(sortScoreMap.getOrDefault(dongwu, zero)); |
|
|
|
yuYan = getOrDefaultSafe(sortScoreMap,mingming1, zero).add(getOrDefaultSafe(sortScoreMap,mingming2, zero)).add(getOrDefaultSafe(sortScoreMap,mingming3, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,chongfu1, zero)).add(getOrDefaultSafe(sortScoreMap,chongfu2, zero)).add(getOrDefaultSafe(sortScoreMap,dongwu, zero)); |
|
|
|
} |
|
|
|
// 注意指数:数字广度顺+数字广度逆+警觉性+连续减7+句子重复+即刻记忆2次 0-18分
|
|
|
|
if (sortScoreMap.containsKey(shunbei) || sortScoreMap.containsKey(daobei) || sortScoreMap.containsKey(jingjuexing) |
|
|
|
|| sortScoreMap.containsKey(jianfa) || sortScoreMap.containsKey(chongfu1) || sortScoreMap.containsKey(chongfu2) |
|
|
|
|| sortScoreMap.containsKey(fushu1) || sortScoreMap.containsKey(fushu2)) { |
|
|
|
zhuYi = sortScoreMap.getOrDefault(shunbei, zero).add(sortScoreMap.getOrDefault(daobei, zero)).add(sortScoreMap.getOrDefault(jingjuexing, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(jianfa, zero)).add(sortScoreMap.getOrDefault(chongfu1, zero)).add(sortScoreMap.getOrDefault(chongfu2, zero)) |
|
|
|
.add(sortScoreMap.getOrDefault(fushu1, zero)).add(sortScoreMap.getOrDefault(fushu2, zero)); |
|
|
|
zhuYi = getOrDefaultSafe(sortScoreMap,shunbei, zero).add(getOrDefaultSafe(sortScoreMap,daobei, zero)).add(getOrDefaultSafe(sortScoreMap,jingjuexing, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,jianfa, zero)).add(getOrDefaultSafe(sortScoreMap,chongfu1, zero)).add(getOrDefaultSafe(sortScoreMap,chongfu2, zero)) |
|
|
|
.add(getOrDefaultSafe(sortScoreMap,fushu1, zero)).add(getOrDefaultSafe(sortScoreMap,fushu2, zero)); |
|
|
|
} |
|
|
|
// 定向指数:定向 0-6分
|
|
|
|
if (sortScoreMap.containsKey(shijian) || sortScoreMap.containsKey(didian)) { |
|
|
|
dingXiang = sortScoreMap.getOrDefault(shijian, zero).add(sortScoreMap.getOrDefault(didian, zero)); |
|
|
|
dingXiang = getOrDefaultSafe(sortScoreMap,shijian, zero).add(getOrDefaultSafe(sortScoreMap,didian, zero)); |
|
|
|
} |
|
|
|
|
|
|
|
PdfUtil.Row titleRow = new PdfUtil.Row(); |
|
|
|
|