Browse Source

Merge branch 'master-dev-1' into master-dev

master-admin
ccsens_zhengzhichuan 2 weeks ago
parent
commit
39e577abe4
  1. 5
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/EmsDto.java
  2. 3
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/AmsVo.java
  3. 2
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/RmsVo.java
  4. 3
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/persist/dao/RmsDao.java
  5. 59
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/RmsServiceImpl.java
  6. 49
      ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/RmsDao.xml
  7. 2
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/AmsController.java
  8. 6
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/EmsController.java
  9. 3
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/RmsDao.java
  10. 3
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IEmsService.java
  11. 37
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/AmsServiceImpl.java
  12. 13
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/IEmsServiceImpl.java
  13. 151
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/RmsServiceImpl.java
  14. 1
      ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/AmsDao.xml
  15. 57
      ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/RmsDao.xml

5
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/EmsDto.java

@ -101,8 +101,7 @@ public class EmsDto {
public static class BindScale {
@ApiModelProperty("测评id")
private Long evaluationId;
@ApiModelProperty("套餐ID")
private Long comboId;
@ApiModelProperty("问题id")
private List<EvaluationScale> scaleList;
}
@ -112,6 +111,8 @@ public class EmsDto {
public static class EvaluationScale{
@ApiModelProperty("量表code")
private String scaleCode;
@ApiModelProperty("套餐ID")
private Long comboId;
@ApiModelProperty("排序")
private Integer sort;
}

3
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/AmsVo.java

@ -678,6 +678,9 @@ public class AmsVo {
private String scaleName;
@ApiModelProperty("分数")
private BigDecimal score;
@ApiModelProperty("量表总分")
private BigDecimal totalScore;
@ApiModelProperty("总题数")
private Integer totalNum;
@ApiModelProperty("已完成题数")

2
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/RmsVo.java

@ -438,6 +438,8 @@ public class RmsVo {
private Integer sort;
@ApiModelProperty("认知域code")
private String parentCode;
@ApiModelProperty("认知域父级id")
private Long parentId;
@ApiModelProperty("报告单检查类型名称")
private String name;
@ApiModelProperty("量表类型名称")

3
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/persist/dao/RmsDao.java

@ -135,4 +135,7 @@ public interface RmsDao {
@Param("code") String scaleCode);
List<RmsVo.Report> queryReport(@Param("dto") RmsDto.ReportQuery dto);
List<RmsVo.ReportScore> queryEmsScaleScore(@Param("evaId") Long evaId,
@Param("scaleCodeList") List<String> scaleCodeList);
}

59
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/RmsServiceImpl.java

@ -123,7 +123,8 @@ public class RmsServiceImpl implements IRmsService {
reportExample.createCriteria().andEvaluationIdEqualTo(dto.getEvaluationId()).andDelFlagEqualTo((byte) 0);
List<RmsReport> rmsReports = rmsReportMapper.selectByExample(reportExample);
RmsReport report;
List<RmsVo.ReportScore> scores;
//查询报告单关联的量表
List<RmsVo.ReportScore> scores = rmsDao.queryEmsScaleScore(dto.getEvaluationId(), CollectionUtil.newArrayList());
Map<String, RmsReportScaleScore> reportScaleScoreMap = new HashMap<>();
if (CollUtil.isEmpty(rmsReports)) {
//生成报告单
@ -151,9 +152,9 @@ public class RmsServiceImpl implements IRmsService {
rmsReportMapper.insertSelective(report);
//查询报告单分数
List<RmsVo.ReportScore> reportScore = rmsDao.queryReportScore1(dto.getEvaluationId(), null, dto.getSex());
//重新封装报告单信息
scores = getReportScores(reportScore, dto.getEvaluationId());
// List<RmsVo.ReportScore> reportScore = rmsDao.queryReportScore1(dto.getEvaluationId(), null, dto.getSex());
// //重新封装报告单信息
// scores = getReportScores(reportScore, dto.getEvaluationId());
if (CollUtil.isNotEmpty(scores)) {
scores.forEach(score -> {
@ -165,7 +166,6 @@ public class RmsServiceImpl implements IRmsService {
reportResult.setReportId(report.getId());
});
}
//添加体质辨识养生建议
List<TzbsRmsReportYsjy> reportYsjyList = score.getReportYsjyList();
if (CollUtil.isNotEmpty(reportYsjyList)) {
@ -173,12 +173,6 @@ public class RmsServiceImpl implements IRmsService {
reportResult.setReportId(report.getId());
});
}
// 获取初步印象
ClientEvaVo.ReportView reportView = reportView(dto.getEvaluationId(), score.getCode());
if (reportView != null) {
score.setImpression(reportView.getResult());
score.setScore(reportView.getTotalScore());
}
}
//添加量表分数统计
RmsReportScaleScore reportScaleScore = new RmsReportScaleScore();
@ -203,44 +197,6 @@ public class RmsServiceImpl implements IRmsService {
}
}
}
//每次查询报告单 都重新生成分数
//查询报告单分数
List<RmsVo.ReportScore> reportScore = rmsDao.queryReportScore3(dto.getEvaluationId(), null, dto.getSex());
//重新封装报告单信息
scores = getReportScores(reportScore, dto.getEvaluationId());
if (CollUtil.isNotEmpty(scores)) {
scores = scores.stream().sorted(Comparator.comparing(RmsVo.ReportScore::getEcrSort)).collect(Collectors.toList());
scores.forEach(score -> {
//查找初步印象
RmsReportScaleScoreExample scoreExample = new RmsReportScaleScoreExample();
scoreExample.createCriteria().andReportIdEqualTo(report.getId()).andScaleCodeEqualTo(score.getCode()).andDelFlagEqualTo((byte) 0);
List<RmsReportScaleScore> rmsReportScaleScores = rmsReportScaleScoreMapper.selectByExample(scoreExample);
if (CollUtil.isNotEmpty(rmsReportScaleScores)) {
score.setImpression(rmsReportScaleScores.get(0).getImpression());
if ("TZBS_LN".equals(score.getCode()) || "TZBS_BZ".equals(score.getCode())) {
score.setScore(rmsReportScaleScores.get(0).getScore());
}
reportScaleScoreMap.put(score.getCode(), rmsReportScaleScores.get(0));
}
//查询量表试题
QmsQuestionExample qmsQuestionExample = new QmsQuestionExample();
qmsQuestionExample.createCriteria().andScaleCodeEqualTo(score.getCode()).andDelFlagEqualTo((byte) 0);
List<QmsQuestion> qmsQuestions = qmsQuestionMapper.selectByExample(qmsQuestionExample);
if (CollUtil.isNotEmpty(qmsQuestions)) {
//查询量表试题时长
EmsEvaluationQuestionDurationExample questionDurationExample = new EmsEvaluationQuestionDurationExample();
questionDurationExample.createCriteria().andEvaluationIdEqualTo(dto.getEvaluationId()).andDelFlagEqualTo((byte) 0)
.andQuestionIdIn(qmsQuestions.stream().map(QmsQuestion::getId).collect(Collectors.toList()));
List<EmsEvaluationQuestionDuration> emsEvaluationQuestionDurations = emsEvaluationQuestionDurationMapper.selectByExample(questionDurationExample);
if (CollUtil.isNotEmpty(emsEvaluationQuestionDurations)) {
score.setQuestionDuration(emsEvaluationQuestionDurations.stream().mapToLong(EmsEvaluationQuestionDuration::getDuration).sum());
}
}
});
}
RmsVo.ReportDetail detail = new RmsVo.ReportDetail();
//查询报告单信息和病人信息
RmsVo.ReportPatient reportPatient = rmsDao.queryReportResult(report.getId());
@ -648,6 +604,11 @@ public class RmsServiceImpl implements IRmsService {
if ("TZBS_LN".equals(score.getCode()) || "TZBS_BZ".equals(score.getCode())) {
score.setSubReport(new ArrayList<>());
zytzbs(evaluationId, score);
ClientEvaVo.ReportView reportView = reportView(evaluationId, score.getCode());
if (reportView != null) {
score.setImpression(reportView.getResult());
score.setScore(reportView.getTotalScore());
}
}
});
return scores;

49
ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/RmsDao.xml

@ -1492,4 +1492,53 @@ d.dept_name as hospitalName
</if>
group by r.id
</select>
<!-- <resultMap id="ResultMap" type="com.ccsens.system.domain.vo.RmsVo$ReportScore">-->
<!-- -->
<!-- </resultMap>-->
<select id="queryEmsScaleScore" resultType="com.ccsens.system.domain.vo.RmsVo$ReportScore">
WITH RECURSIVE cognitive_relevance_tree AS (
SELECT
id AS node_id,
evaluation_id,
scale_code AS scale_code,
'' AS second_level_cognitive_code,
cognitive_code AS current_cognitive_code,
score AS level_score,
total_score AS level_total_score,
parent_id,
sort,
1 AS level
FROM ems_evaluation_scale_cognitive_relevance
WHERE parent_id IS NULL
AND del_flag = 0
UNION ALL
SELECT
child.id AS node_id,
child.evaluation_id,
parent.scale_code,
child.cognitive_code AS second_level_cognitive_code,
child.cognitive_code AS current_cognitive_code,
child.score AS level_score,
child.total_score AS level_total_score,
child.parent_id,
child.sort,
2 AS level
FROM ems_evaluation_scale_cognitive_relevance child
INNER JOIN cognitive_relevance_tree parent
ON child.parent_id = parent.node_id
WHERE child.del_flag = 0
)
SELECT
rt.evaluation_id AS evaluationId,
rt.scale_code AS scaleCode,
rt.second_level_cognitive_code AS cognitiveCode,
rt.level_score AS score,
IF(rt.level_total_score = null , q.total_score, rt.level_total_score) AS totalScale,
rt.sort
FROM cognitive_relevance_tree rt
LEFT JOIN qms_scale q on rt.scale_code = q.code
ORDER BY evaluation_id, level, sort
</select>
</mapper>

2
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/AmsController.java

@ -146,7 +146,7 @@ public class AmsController extends BaseController {
//查询测评下某个量表的完成情况
@ApiOperation(value = "测评结论", notes = "测评结论 (计算分数)")
@PostMapping("/queryConclusion")
public JsonResponse< List<AmsVo.ScaleAchievement>> queryConclusion(@RequestBody @ApiParam @Valid AmsDto.ScaleAchievement queryDto) {
public JsonResponse<List<AmsVo.ScaleAchievement>> queryConclusion(@RequestBody @ApiParam @Valid AmsDto.ScaleAchievement queryDto) {
List<AmsVo.ScaleAchievement> scaleAchievement = amsService.queryConclusion(queryDto);
return JsonResponse.ok(scaleAchievement);
}

6
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/EmsController.java

@ -129,4 +129,10 @@ public class EmsController extends BaseController {
public JsonResponse<Integer> delete(@RequestBody @ApiParam @Valid EmsDto.Delete dto){
return JsonResponse.ok(emsService.delete(dto.getIdList()));
}
@ApiOperation(value = "撤回测评")
@PostMapping("/revoke")
public JsonResponse<Integer> revoke(@RequestBody @ApiParam @Valid EmsDto.Complate dto){
return JsonResponse.ok(emsService.revoke(dto.getEvaluationId()));
}
}

3
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/RmsDao.java

@ -133,4 +133,7 @@ public interface RmsDao {
List<String> queryCodeByScCode(@Param("list")List<String> list);
List<RmsVo.ReportScore> queryEmsScaleScore(@Param("evaluationId") Long evaluationId,
@Param("scaleCodeList") List<String> scaleCodeList);
}

3
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IEmsService.java

@ -38,4 +38,7 @@ public interface IEmsService {
Integer complate(Long evaluationId, Byte complateStatus);
Integer delete(List<Long> idList);
Integer revoke(Long evaluationId);
}

37
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/AmsServiceImpl.java

@ -1202,6 +1202,13 @@ public class AmsServiceImpl implements IAmsService {
List<AmsVo.ScaleAchievement> scaleAchievementList = amsDao.getScaleAchievement(queryDto.getEvaluationId(), queryDto.getScaleCode(), queryDto.getSex());
if (CollUtil.isNotEmpty(scaleAchievementList)) {
//删除已有分数
EmsEvaluationScaleCognitiveRelevanceExample emsEvaluationScaleCognitiveRelevanceExample = new EmsEvaluationScaleCognitiveRelevanceExample();
emsEvaluationScaleCognitiveRelevanceExample.createCriteria().andEvaluationIdEqualTo(queryDto.getEvaluationId());
EmsEvaluationScaleCognitiveRelevance emsEvaluationScaleCognitiveRelevance2 = new EmsEvaluationScaleCognitiveRelevance();
emsEvaluationScaleCognitiveRelevance2.setDelFlag(GenConstants.Ht.IS_DEL);
emsEvaluationScaleCognitiveRelevanceMapper.updateByExampleSelective(emsEvaluationScaleCognitiveRelevance2, emsEvaluationScaleCognitiveRelevanceExample);
scaleAchievementList.forEach(scaleAchievement -> {
//查询测评量表分数
List<RmsVo.ReportScore> reportScore = rmsDao.queryReportScore(queryDto.getEvaluationId(), scaleAchievement.getScaleCode());
@ -1209,18 +1216,20 @@ public class AmsServiceImpl implements IAmsService {
List<RmsVo.ReportScore> reportScores = rmsService.getReportScores(reportScore, queryDto.getEvaluationId());
if (CollUtil.isNotEmpty(reportScores)) {
reportScores.forEach(score -> {
//保存测评量表分数
EmsEvaluationScaleCognitiveRelevance evaluationScaleCognitiveRelevance = new EmsEvaluationScaleCognitiveRelevance();
evaluationScaleCognitiveRelevance.setEvaluationId(queryDto.getEvaluationId());
evaluationScaleCognitiveRelevance.setDelFlag(GenConstants.Ht.NO_DEL);
evaluationScaleCognitiveRelevance.setScaleCode(scaleAchievement.getScaleCode());
evaluationScaleCognitiveRelevance.setScore(score.getScore());
evaluationScaleCognitiveRelevance.setParentId(0L);
evaluationScaleCognitiveRelevance.setTotalScore(scaleAchievement.getTotalScore());
evaluationScaleCognitiveRelevance.setCreateTime(new Date());
evaluationScaleCognitiveRelevance.setId(IdUtil.getSnowflake().nextId());
evaluationScaleCognitiveRelevance.setCreateBy(SecurityUtils.getUsername());
emsEvaluationScaleCognitiveRelevanceMapper.insert(evaluationScaleCognitiveRelevance);
//保存认知域得分
if (CollectionUtil.isNotEmpty(score.getSubReport())) {
//保存测评量表分数
EmsEvaluationScaleCognitiveRelevance evaluationScaleCognitiveRelevance = new EmsEvaluationScaleCognitiveRelevance();
evaluationScaleCognitiveRelevance.setEvaluationId(queryDto.getEvaluationId());
evaluationScaleCognitiveRelevance.setScaleCode(scaleAchievement.getScaleCode());
evaluationScaleCognitiveRelevance.setScore(score.getScore());
evaluationScaleCognitiveRelevance.setParentId(0L);
evaluationScaleCognitiveRelevance.setCreateTime(new Date());
evaluationScaleCognitiveRelevance.setId(IdUtil.getSnowflake().nextId());
emsEvaluationScaleCognitiveRelevanceMapper.insert(evaluationScaleCognitiveRelevance);
//保存测评量表认知域分数
if (CollectionUtil.isNotEmpty(score.getSubReport())) {
score.getSubReport().forEach(subReport -> {
@ -1231,7 +1240,9 @@ public class AmsServiceImpl implements IAmsService {
emsEvaluationScaleCognitiveRelevance.setScore(subReport.getScore());
emsEvaluationScaleCognitiveRelevance.setParentId(evaluationScaleCognitiveRelevance.getId());
emsEvaluationScaleCognitiveRelevance.setCreateTime(new Date());
emsEvaluationScaleCognitiveRelevance.setDelFlag(GenConstants.Ht.NO_DEL);
emsEvaluationScaleCognitiveRelevance.setId(IdUtil.getSnowflake().nextId());
emsEvaluationScaleCognitiveRelevance.setCreateBy(SecurityUtils.getUsername());
emsEvaluationScaleCognitiveRelevanceMapper.insert(emsEvaluationScaleCognitiveRelevance);
if (CollectionUtil.isNotEmpty(subReport.getSubReport())) {
subReport.getSubReport().forEach(subSubReport -> {
@ -1243,6 +1254,8 @@ public class AmsServiceImpl implements IAmsService {
emsEvaluationScaleCognitiveRelevance1.setCreateTime(new Date());
emsEvaluationScaleCognitiveRelevance1.setParentId(emsEvaluationScaleCognitiveRelevance.getId());
emsEvaluationScaleCognitiveRelevance1.setId(IdUtil.getSnowflake().nextId());
emsEvaluationScaleCognitiveRelevance1.setDelFlag(GenConstants.Ht.NO_DEL);
emsEvaluationScaleCognitiveRelevance1.setCreateBy(SecurityUtils.getUsername());
emsEvaluationScaleCognitiveRelevanceMapper.insert(emsEvaluationScaleCognitiveRelevance1);
});
@ -1252,10 +1265,6 @@ public class AmsServiceImpl implements IAmsService {
}
});
}
//查找量表下每道题的完成情况
List<AmsVo.ScaleQuestionAchievement> scaleQuestionAchievementList = amsDao.getScaleQuestionAchievement(queryDto.getEvaluationId(), scaleAchievement.getScaleCode(), queryDto.getSex());
scaleAchievement.setQuestionDetail(scaleQuestionAchievementList);
//NPI特殊处理总分
if ("NPI".equals(scaleAchievement.getScaleCode())) {
scaleAchievement.setScore(amsDao.getTotalScoreByNPI(queryDto.getEvaluationId()));

13
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/IEmsServiceImpl.java

@ -232,6 +232,17 @@ public class IEmsServiceImpl implements IEmsService {
return evaluationMapper.updateByExampleSelective(emsEvaluation, emsEvaluationExample);
}
@Override
public Integer revoke(Long evaluationId) {
EmsEvaluation emsEvaluation = evaluationMapper.selectByPrimaryKey(evaluationId);
if (emsEvaluation == null) {
throw new BaseException(ErrorConstant.PATIENT_REPORT_NOT_FOUND);
}
emsEvaluation.setCompleteStatus((byte) 0);
emsEvaluation.setUpdateTime(new Date());
return evaluationMapper.updateByPrimaryKeySelective(emsEvaluation);
}
@Override
public Integer bindPatient(EmsDto.BindPatient dto) {
LoginUser loginUser = getLoginUser();
@ -323,7 +334,7 @@ public class IEmsServiceImpl implements IEmsService {
evaluationScaleRelevance.setId(IDGenerator.nextSnowflakeId());
evaluationScaleRelevance.setEvaluationId(dto.getEvaluationId());
evaluationScaleRelevance.setScaleCode(evaluationScale.getScaleCode());
evaluationScaleRelevance.setComboId(dto.getComboId());
evaluationScaleRelevance.setComboId(evaluationScale.getComboId());
evaluationScaleRelevance.setSort(sort1++);
evaluationScaleRelevance.setCreateBy(loginUser.getUsername());
evaluationScaleRelevanceMapper.insertSelective(evaluationScaleRelevance);

151
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/RmsServiceImpl.java

@ -114,6 +114,100 @@ public class RmsServiceImpl implements IRmsService {
return 0;
}
/**
* 递归组装ReportScore的父子级树形结构
* @param allReportScores 所有未组装的ReportScore列表
* @param rootParentId 根节点的parentId比如0或null根据业务定义
* @return 组装好的树形结构根节点列表
*/
public static List<RmsVo.ReportScore> buildReportScoreTree(List<RmsVo.ReportScore> allReportScores, Long rootParentId) {
// 1. 预处理:将所有节点放入Map,key=scaleId,方便快速查找
Map<String, RmsVo.ReportScore> scoreMap = new HashMap<>();
for (RmsVo.ReportScore score : allReportScores) {
scoreMap.put(score.getScaleId(), score);
// 初始化子列表(避免空指针)
if (score.getSubReport() == null) {
score.setSubReport(new ArrayList<>());
}
}
// 2. 筛选根节点(parentId等于rootParentId的节点)
List<RmsVo.ReportScore> rootNodes = new ArrayList<>();
for (RmsVo.ReportScore score : allReportScores) {
Long parentId = score.getParentId();
// 判断是否为根节点(适配parentId=null或0的情况)
boolean isRoot = (rootParentId == null && parentId == null)
|| (rootParentId != null && rootParentId.equals(parentId));
if (isRoot) {
rootNodes.add(score);
// 递归组装子节点
buildChildren(score, scoreMap);
}
}
// 3. 按sort/ecrSort排序(可选,根据业务需求)
sortReportScoreTree(rootNodes);
return rootNodes;
}
/**
* 递归为单个节点组装子节点
* @param parentNode 父节点
* @param scoreMap 所有节点的Mapkey=scaleId
*/
private static void buildChildren(RmsVo.ReportScore parentNode, Map<String, RmsVo.ReportScore> scoreMap) {
// 遍历所有节点,找到当前父节点的子节点(子节点的parentId=父节点的scaleId转Long)
for (RmsVo.ReportScore childNode : scoreMap.values()) {
Long childParentId = childNode.getParentId();
String parentScaleId = parentNode.getScaleId();
// 避免空指针,先判断parentScaleId是否能转Long(根据业务,scaleId应为数字字符串)
if (childParentId == null || parentScaleId == null) {
continue;
}
// 匹配子节点:子节点的parentId = 父节点的scaleId(转Long)
try {
Long parentIdLong = Long.parseLong(parentScaleId);
if (childParentId.equals(parentIdLong)) {
// 加入子列表
parentNode.getSubReport().add(childNode);
// 递归组装子节点的子节点
buildChildren(childNode, scoreMap);
}
} catch (NumberFormatException e) {
// 若scaleId非数字,根据业务处理(此处打印日志,跳过)
System.err.println("scaleId转换Long失败:" + parentScaleId + ",原因:" + e.getMessage());
continue;
}
}
// 子节点排序(可选)
if (CollectionUtil.isNotEmpty(parentNode.getSubReport())) {
sortReportScoreTree(parentNode.getSubReport());
}
}
/**
* 对ReportScore列表按排序字段排序优先sort其次ecrSort
* @param reportScores 待排序的列表
*/
private static void sortReportScoreTree(List<RmsVo.ReportScore> reportScores) {
reportScores.sort((o1, o2) -> {
// 先按sort排序
if (o1.getSort() != null && o2.getSort() != null) {
return o1.getSort().compareTo(o2.getSort());
}
// sort为空则按ecrSort排序
if (o1.getEcrSort() != null && o2.getEcrSort() != null) {
return o1.getEcrSort().compareTo(o2.getEcrSort());
}
// 都为空则按scaleId排序
return o1.getScaleId().compareTo(o2.getScaleId());
});
}
@Override
public RmsVo.ReportDetail queryReportDetail(RmsDto.QueryDetail dto) {
//根据测评id查找报告单
@ -121,7 +215,12 @@ public class RmsServiceImpl implements IRmsService {
reportExample.createCriteria().andEvaluationIdEqualTo(dto.getEvaluationId()).andDelFlagEqualTo((byte) 0);
List<RmsReport> rmsReports = rmsReportMapper.selectByExample(reportExample);
RmsReport report;
List<RmsVo.ReportScore> scores = new ArrayList<>();
//查询测评量表
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)) {
//生成报告单
@ -136,7 +235,6 @@ public class RmsServiceImpl implements IRmsService {
//查找病人信息
PmsPatient pmsPatient = pmsPatientMapper.selectByPrimaryKey(emsEvaluation.getPatientId());
if (ObjectUtil.isNotNull(pmsPatient)) {
// report.setPatientAge(IdcardUtil.getAgeByIdCard(pmsPatient.getIdcard()));
report.setPatientAge(getAge(pmsPatient));
}
//修改测评的状态
@ -148,11 +246,6 @@ public class RmsServiceImpl implements IRmsService {
}
rmsReportMapper.insertSelective(report);
//查询报告单分数
List<RmsVo.ReportScore> reportScore = rmsDao.queryReportScore1(dto.getEvaluationId(), null, dto.getSex());
//重新封装报告单信息
scores = getReportScores(reportScore, dto.getEvaluationId());
if (CollUtil.isNotEmpty(scores)) {
scores.forEach(score -> {
if ("TZBS_LN".equals(score.getCode()) || "TZBS_BZ".equals(score.getCode())) {
@ -197,43 +290,6 @@ public class RmsServiceImpl implements IRmsService {
}
}
}
//每次查询报告单 都重新生成分数
//查询报告单分数
// List<RmsVo.ReportScore> reportScore = rmsDao.queryReportScore3(dto.getEvaluationId(), null, dto.getSex());
// //重新封装报告单信息
// scores = getReportScores(reportScore, dto.getEvaluationId());
// if (CollUtil.isNotEmpty(scores)) {
// scores = scores.stream().sorted(Comparator.comparing(RmsVo.ReportScore::getEcrSort)).collect(Collectors.toList());
// scores.forEach(score -> {
//// //查找初步印象
//// RmsReportScaleScoreExample scoreExample = new RmsReportScaleScoreExample();
//// scoreExample.createCriteria().andReportIdEqualTo(report.getId()).andScaleCodeEqualTo(score.getCode()).andDelFlagEqualTo((byte) 0);
//// List<RmsReportScaleScore> rmsReportScaleScores = rmsReportScaleScoreMapper.selectByExample(scoreExample);
//// if (CollUtil.isNotEmpty(rmsReportScaleScores)) {
//// score.setImpression(rmsReportScaleScores.get(0).getImpression());
////// if ("TZBS_LN".equals(score.getCode()) || "TZBS_BZ".equals(score.getCode())) {
////// score.setScore(rmsReportScaleScores.get(0).getScore());
////// }
//// reportScaleScoreMap.put(score.getCode(), rmsReportScaleScores.get(0));
//// }
//
//// //查询量表试题
//// QmsQuestionExample qmsQuestionExample = new QmsQuestionExample();
//// qmsQuestionExample.createCriteria().andScaleCodeEqualTo(score.getCode()).andDelFlagEqualTo((byte) 0);
//// List<QmsQuestion> qmsQuestions = qmsQuestionMapper.selectByExample(qmsQuestionExample);
//// if (CollUtil.isNotEmpty(qmsQuestions)) {
//// //查询量表试题时长
//// EmsEvaluationQuestionDurationExample questionDurationExample = new EmsEvaluationQuestionDurationExample();
//// questionDurationExample.createCriteria().andEvaluationIdEqualTo(dto.getEvaluationId()).andDelFlagEqualTo((byte) 0)
//// .andQuestionIdIn(qmsQuestions.stream().map(QmsQuestion::getId).collect(Collectors.toList()));
//// List<EmsEvaluationQuestionDuration> emsEvaluationQuestionDurations = emsEvaluationQuestionDurationMapper.selectByExample(questionDurationExample);
//// if (CollUtil.isNotEmpty(emsEvaluationQuestionDurations)) {
//// score.setQuestionDuration(emsEvaluationQuestionDurations.stream().mapToLong(EmsEvaluationQuestionDuration::getDuration).sum());
//// }
//// }
// });
// }
RmsVo.ReportDetail detail = new RmsVo.ReportDetail();
//查询报告单信息和病人信息
@ -322,16 +378,11 @@ public class RmsServiceImpl implements IRmsService {
if (CollectionUtil.isNotEmpty(set)) {
MessageDto.QuestionInform questionInform = new MessageDto.QuestionInform();
questionInform.setQuestionId(0L);
boolean remove = set.remove(questionInform);
set.remove(questionInform);
}
// if (set.size() > 0) {
//list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(MessageDto.QuestionInform::getQuestionId))), ArrayList::new));
// redisUtil.set("message_" + score.getPatientReportId(), set, 7200);
redisUtil.deleteObject("message_" + dto.getEvaluationId());
// }
}
// scores = scores.stream().sorted(Comparator.comparing(RmsVo.ReportScore::getSort)).collect(Collectors.toList());
detail.setPatient(reportPatient);
detail.setScores(scores);
return detail;

1
ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/AmsDao.xml

@ -27,6 +27,7 @@
SELECT
qs.`code` AS scaleCode,
qs.`name` AS scaleName,
qs.total_score AS totalScore,
sum(q.score) as score,
count( DISTINCT q.questionId ) AS totalNum,
count( DISTINCT q.answerQuestionId ) AS completedNum

57
ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/RmsDao.xml

@ -1743,4 +1743,61 @@ group by ee.id
group by code
order by sort
</select>
<select id="queryEmsScaleScore" resultType="com.ccsens.system.domain.vo.RmsVo$ReportScore">
WITH RECURSIVE cognitive_relevance_tree AS (
SELECT
r.id AS scale_id,
r.evaluation_id,
r.scale_code AS scale_code,
q.name as name,
q.total_score,
q.description,
r.score AS level_score,
r.total_score AS level_total_score,
r.parent_id,
r.sort,
1 AS level
FROM ems_evaluation_scale_cognitive_relevance r
LEFT JOIN qms_scale q on r.scale_code = q.code
WHERE r.parent_id = 0 and r.del_flag = 0 and r.evaluation_id = #{evaluationId}
<if test="scaleCodeList != null and scaleCodeList.size()>0">
and scale_code in (
<foreach item="item" collection="scaleCodeList" index="index" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
UNION ALL
SELECT
child.id AS scale_id,
child.evaluation_id,
child.cognitive_code AS scale_code,
c.name,
c.total_score,
c.description,
child.score AS level_score,
child.total_score AS level_total_score,
child.parent_id,
child.sort,
2 AS level
FROM ems_evaluation_scale_cognitive_relevance child
INNER JOIN cognitive_relevance_tree parent
ON child.parent_id = parent.scale_id
left join qms_cognitive_domain c on c.code = child.cognitive_code and c.parent_code = parent.scale_code
WHERE child.del_flag = 0
)
SELECT
rt.scale_id as scaleId,
rt.parent_id as parentId,
rt.name AS name,
rt.evaluation_id AS evaluationId,
rt.scale_code AS code,
rt.level_score AS score,
rt.total_score AS totalScale,
rt.sort as ecrSort
FROM cognitive_relevance_tree rt
ORDER BY evaluation_id, level, sort
</select>
</mapper>
Loading…
Cancel
Save