Browse Source

moca指数

sd
zhizhi wu 4 years ago
parent
commit
998f1335a3
  1. 3
      ht/src/main/java/com/ccsens/ht/api/DoctorController.java
  2. 4
      ht/src/main/java/com/ccsens/ht/api/PatientReportController.java
  3. 2
      ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java
  4. 20
      ht/src/main/java/com/ccsens/ht/bean/vo/PatientReportVo.java
  5. 2
      ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java
  6. 10
      ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientScoreDao.java
  7. 4
      ht/src/main/java/com/ccsens/ht/service/ExportService.java
  8. 2
      ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java
  9. 145
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  10. 2
      ht/src/main/resources/mapper_dao/HtPatientReportDao.xml
  11. 20
      ht/src/main/resources/mapper_dao/HtPatientScoreDao.xml

3
ht/src/main/java/com/ccsens/ht/api/DoctorController.java

@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
@ -35,7 +36,7 @@ import java.util.List;
@RestController
public class DoctorController {
@Autowired
@Resource
private IDoctorService doctorService;

4
ht/src/main/java/com/ccsens/ht/api/PatientReportController.java

@ -121,10 +121,10 @@ public class PatientReportController {
@ApiImplicitParam(name = "json", value = "查询报告单详情", required = true)
})
@RequestMapping(value="/queryReportDetail", method = RequestMethod.POST)
public JsonResponse<PatientReportVo.ReprotDetail> queryReportDetail(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.QueryDetail> param){
public JsonResponse<PatientReportVo.ReportDetail> queryReportDetail(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.QueryDetail> param){
//查询报告单信息
log.info("查询报告单详情:{}", param);
PatientReportVo.ReprotDetail detail = patientReportService.queryReportDetail(param.getParam(), param.getUserId());
PatientReportVo.ReportDetail detail = patientReportService.queryReportDetail(param.getParam(), param.getUserId());
log.info("查询报告单详情结果:{}", detail);
return JsonResponse.newInstance().ok(detail);
}

2
ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java

@ -103,8 +103,6 @@ public class PatientReportExportController {
return JsonResponse.newInstance().ok(export);
}
// @MustLogin
// @DoctorAudit
@ApiOperation(value = "导出指定id的报告单分析",notes = "导出指定id的报告单分析")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "导出指定id的报告单分析", required = true)

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

@ -67,18 +67,18 @@ public class PatientReportVo {
private Long doctorId;
}
@ApiModel("PatientReportVoReprotDetail")
@ApiModel("PatientReportVoReportDetail")
@Data
public static class ReprotDetail{
public static class ReportDetail {
@ApiModelProperty("报告单上病人信息")
private ReprotPatient patient;
private ReportPatient patient;
@ApiModelProperty("报告单上分数信息")
private List<ReportScore> scores;
}
@ApiModel("PatientReportVoReprotPatient")
@ApiModel("PatientReportVoReportPatient")
@Data
public static class ReprotPatient{
public static class ReportPatient {
@ApiModelProperty("病人报告单ID")
private Long id;
@ApiModelProperty("报告单名字")
@ -241,8 +241,14 @@ public class PatientReportVo {
}
}
/**分数类型*/
@ApiModel("PatientReportVoReportScore")
@ApiModel("题目序号和分数-响应")
@Data
public static class SortScore{
private int sort;
private BigDecimal score;
}
@ApiModel("报告单分数-响应")
@Data
public static class ReportScore{
@ApiModelProperty("报告单检查类型")

2
ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java

@ -23,7 +23,7 @@ public interface HtPatientReportDao extends HtPatientReportMapper {
*@author wuHuiJuan
*@date: 2019/11/19 11:08
*/
PatientReportVo.ReprotPatient queryReportResult(@Param("id") Long id);
PatientReportVo.ReportPatient queryReportResult(@Param("id") Long id);
/**
* 根据病人报告单ID查询报告单各项相关分数
* @param id 报告单ID

10
ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientScoreDao.java

@ -2,7 +2,9 @@ package com.ccsens.ht.persist.dao;
import com.ccsens.ht.bean.dto.PatientReportDto;
import com.ccsens.ht.bean.po.HtPatientScore;
import com.ccsens.ht.bean.vo.PatientReportVo;
import com.ccsens.ht.persist.mapper.HtPatientScoreMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -26,4 +28,12 @@ public interface HtPatientScoreDao extends HtPatientScoreMapper {
* @return
*/
List<Long> queryIdsByAnswer(PatientReportDto.Answer answer);
/**
* 查询moca每道题的分数
* @param patientReportId 报告单ID
* @param codes [] evaluationCode 数组
* @return 题目序号和分数
*/
List<PatientReportVo.SortScore> querySortScore(@Param("patientReportId") Long patientReportId, @Param("evaluationCode") String... codes);
}

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

@ -75,7 +75,7 @@ public class ExportService implements IExportService {
return report.getUrl();
}
//查看报告单和试题分数信息
PatientReportVo.ReprotDetail detail = patientReportService.queryReportDetail(param, userId);
PatientReportVo.ReportDetail detail = patientReportService.queryReportDetail(param, userId);
if (detail == null) {
throw new BaseException(CodeEnum.REPORT_NOT_FOUND);
}
@ -158,7 +158,7 @@ public class ExportService implements IExportService {
// throw new BaseException(CodeEnum.REPORT_NOT_FOUND);
// }
//查询报告单信息和病人信息
PatientReportVo.ReprotPatient reportPatient = htPatientReportDao.queryReportResult(param.getId());
PatientReportVo.ReportPatient reportPatient = htPatientReportDao.queryReportResult(param.getId());
//查询报告单的关联信息
HtReportRelevanceExample relevanceExample = new HtReportRelevanceExample();
relevanceExample.createCriteria().andReportIdEqualTo(param.getId()).andReportCodeEqualTo(report);

2
ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java

@ -53,7 +53,7 @@ public interface IPatientReportService {
*@author wuHuiJuan
*@date: 2019/11/19 10:18
*/
PatientReportVo.ReprotDetail queryReportDetail(PatientReportDto.QueryDetail queryDetail, Long userId);
PatientReportVo.ReportDetail queryReportDetail(PatientReportDto.QueryDetail queryDetail, Long userId);
/**
* 查询医生对该报告单的权限
* @param authority authority

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

@ -257,10 +257,10 @@ public class PatientReportService implements IPatientReportService {
}
@Override
public PatientReportVo.ReprotDetail queryReportDetail(PatientReportDto.QueryDetail queryDetail, Long userId) {
PatientReportVo.ReprotDetail detail = new PatientReportVo.ReprotDetail();
public PatientReportVo.ReportDetail queryReportDetail(PatientReportDto.QueryDetail queryDetail, Long userId) {
PatientReportVo.ReportDetail detail = new PatientReportVo.ReportDetail();
//查询报告单信息和病人信息
PatientReportVo.ReprotPatient reportPatient = htPatientReportDao.queryReportResult(queryDetail.getId());
PatientReportVo.ReportPatient reportPatient = htPatientReportDao.queryReportResult(queryDetail.getId());
//查询报告单的关联信息
HtReportRelevanceExample relevanceExample = new HtReportRelevanceExample();
relevanceExample.createCriteria().andReportIdEqualTo(queryDetail.getId()).andReportCodeEqualTo(queryDetail.getReport());
@ -397,7 +397,7 @@ public class PatientReportService implements IPatientReportService {
if (StrUtil.isNotBlank(report.getUrl())) {
return report.getUrl();
}
PatientReportVo.ReprotDetail detail = queryReportDetail(queryDetail, userId);
PatientReportVo.ReportDetail detail = queryReportDetail(queryDetail, userId);
if (detail == null) {
throw new BaseException(CodeEnum.REPORT_NOT_FOUND);
}
@ -683,7 +683,7 @@ public class PatientReportService implements IPatientReportService {
List<PdfUtil.Row> content = new ArrayList<>();
//查询报告单信息和病人信息
PatientReportVo.ReprotPatient reportPatient = htPatientReportDao.queryReportResult(param.getId());
PatientReportVo.ReportPatient reportPatient = htPatientReportDao.queryReportResult(param.getId());
if (reportPatient == null) {
throw new BaseException(CodeEnum.PARAM_ERROR);
}
@ -831,7 +831,7 @@ public class PatientReportService implements IPatientReportService {
} else if (score.getSort() >= 15 && score.getSort() <= 17) {
row.get(12+score.getSort()).setValue(score.getScore().intValue() + "");
} else if (score.getSort()== 21 || score.getSort() == 22) {
row.get(10+score.getSort()).setValue(score.getScore().intValue() + "");
row.get(9+score.getSort()).setValue(score.getScore().intValue() + "");
} else if (score.getSort() == 18 || score.getSort() == 19) {
if (score.getScore() != null) {
String value = row.get(32).getValue();
@ -1014,9 +1014,9 @@ public class PatientReportService implements IPatientReportService {
titleRow.add(new PoiUtil.PoiUtilCell("流畅性1min"));
titleRow.add(new PoiUtil.PoiUtilCell("抽象"));
titleRow.add(new PoiUtil.PoiUtilCell("延迟回忆"));
// 20
titleRow.add(new PoiUtil.PoiUtilCell("分类提示"));
// 21
titleRow.add(new PoiUtil.PoiUtilCell("分类提示"));
// 22
titleRow.add(new PoiUtil.PoiUtilCell("多选提示"));
titleRow.add(new PoiUtil.PoiUtilCell("定向"));
titleRow.add(new PoiUtil.PoiUtilCell("总分"));
@ -1085,7 +1085,7 @@ public class PatientReportService implements IPatientReportService {
titleRow.add(new PoiUtil.PoiUtilCell("图形重心垂直位置"));
}
private List<PatientReportVo.ReportScore> getReportScores(PatientReportDto.ExportCode param, List<PdfUtil.Row> content, List<PatientReportVo.ReportScore> reportScores, PatientReportVo.ReprotPatient reportPatient) {
private List<PatientReportVo.ReportScore> getReportScores(PatientReportDto.ExportCode param, List<PdfUtil.Row> content, List<PatientReportVo.ReportScore> reportScores, PatientReportVo.ReportPatient reportPatient) {
long reportId = param.getId();
//重新封装报告单信息
List<PatientReportVo.ReportScore> scores = getReportScores(reportScores, reportId);
@ -1095,6 +1095,12 @@ public class PatientReportService implements IPatientReportService {
|| Constant.Ht.Report.MOCA.equals(param.getCode()) ? 9 : 8;
scores.forEach(reportScore -> content.addAll(reportScore.toSingleRow()));
if (Constant.Ht.Report.MOCA.equalsIgnoreCase(param.getCode())){
// moca 计算moca认知域指数CDIS
fillMocaCDIS(content, param.getId());
}
PdfUtil.Row row = new PdfUtil.Row();
int titleSpan = 2;
PdfUtil.Cell initWordCell = addCell(row, "初步印象", titleSpan, 2);
@ -1114,6 +1120,127 @@ public class PatientReportService implements IPatientReportService {
return scores;
}
/**
* 添加moca认知域指数CDIS
* @param rows 表格行
* @param patientReportId 报告单ID
*/
private void fillMocaCDIS(List<PdfUtil.Row> rows, Long patientReportId) {
// 查询moca的每一题的分数
List<PatientReportVo.SortScore> scores = htPatientScoreDao.querySortScore(patientReportId, "MoCA", "YCHY");
Map<Integer, BigDecimal> sortScoreMap = new HashMap<>();
if (CollectionUtil.isNotEmpty(scores)) {
scores.forEach(score -> sortScoreMap.put(score.getSort(), score.getScore()));
}
int lianxian = 1;
int lifangti = 2;
int huazhong = 3;
int mingming1 = 4;
int mingming2 = 5;
int mingming3 = 6;
int fushu1 = 7;
int fushu2 = 8;
int shunbei = 9;
int daobei = 10;
int jingjuexing = 11;
int jianfa = 12;
int chongfu1 = 13;
int chongfu2 = 14;
int dongwu = 15;
int xiangsixing = 16;
int huiyi = 17;
int shijian = 18;
int didian = 19;
int shizhijue = 20;
int fenlei = 21;
int duoxuan = 22;
BigDecimal jiYi = null;
BigDecimal zhiXing = null;
BigDecimal kongJian = null;
BigDecimal yuYan = null;
BigDecimal zhuYi = null;
BigDecimal dingXiang = null;
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));
}
// 执行指数:连线测验+画钟+数字广度顺+数字广度逆+警觉性(听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));
}
// 视空间指数:立方体+画钟+命名 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));
}
// 语言指数:命名+句子复述+词语流畅性 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(fushu1, zero)).add(sortScoreMap.getOrDefault(fushu2, zero)).add(sortScoreMap.getOrDefault(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));
}
// 定向指数:定向 0-6分
if (sortScoreMap.containsKey(shijian) || sortScoreMap.containsKey(didian)) {
dingXiang = sortScoreMap.getOrDefault(shijian, zero).add(sortScoreMap.getOrDefault(didian, zero));
}
PdfUtil.Row titleRow = new PdfUtil.Row();
PdfUtil.Cell titleCell = new PdfUtil.Cell("MoCA认知域指数(CDIS)");
titleCell.setRowSpan(3);
titleRow.addCell(titleCell);
PdfUtil.Cell jiYiCell = new PdfUtil.Cell("记忆指数");
jiYiCell.setColSpan(2);
titleRow.addCell(jiYiCell);
titleRow.addCell(new PdfUtil.Cell("执行指数"));
titleRow.addCell(new PdfUtil.Cell("空间指数"));
titleRow.addCell(new PdfUtil.Cell("注意力指数"));
titleRow.addCell(new PdfUtil.Cell("语言指数"));
titleRow.addCell(new PdfUtil.Cell("定向指数"));
rows.add(titleRow);
PdfUtil.Row oneRow = new PdfUtil.Row();
PdfUtil.Cell jiYiValueCell = new PdfUtil.Cell(jiYi == null ? " / 15" : jiYi.toString() + " / 15");
jiYiValueCell.setColSpan(2);
jiYiValueCell.setRowSpan(2);
oneRow.addCell(jiYiValueCell);
PdfUtil.Cell zhiXingValueCell = new PdfUtil.Cell(zhiXing == null ? " / 13" : zhiXing.toString() + " / 13");
zhiXingValueCell.setRowSpan(2);
oneRow.addCell(zhiXingValueCell);
PdfUtil.Cell kongJianValueCell = new PdfUtil.Cell(kongJian == null ? " / 7" : kongJian.toString() + " / 7");
kongJianValueCell.setRowSpan(2);
oneRow.addCell(kongJianValueCell);
PdfUtil.Cell zhuYiValueCell = new PdfUtil.Cell(zhuYi == null ? " / 18" : zhuYi.toString() + " / 18");
zhuYiValueCell.setRowSpan(2);
oneRow.addCell(zhuYiValueCell);
PdfUtil.Cell yuYanValueCell = new PdfUtil.Cell(yuYan == null ? " / 6" : yuYan.toString() + " / 6");
yuYanValueCell.setRowSpan(2);
oneRow.addCell(yuYanValueCell);
PdfUtil.Cell dingXiangValueCell = new PdfUtil.Cell(dingXiang == null ? " / 6" : dingXiang.toString() + " / 6");
zhuYiValueCell.setRowSpan(2);
oneRow.addCell(zhuYiValueCell);
rows.add(oneRow);
rows.add(new PdfUtil.Row());
}
@Override
public List<PatientReportVo.ReportScore> getReportScores(List<PatientReportVo.ReportScore> reportScores, long reportId) {
Map<String, PatientReportVo.ReportScore> map = new HashMap<>(32);

2
ht/src/main/resources/mapper_dao/HtPatientReportDao.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ht.persist.dao.HtPatientReportDao">
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.vo.PatientReportVo$ReprotPatient">
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.vo.PatientReportVo.ReportPatient">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="patient_id" jdbcType="BIGINT" property="patientId"/>

20
ht/src/main/resources/mapper_dao/HtPatientScoreDao.xml

@ -53,5 +53,25 @@
AND p.is_del = 0
AND q.is_del = 0
</select>
<select id="querySortScore" resultType="com.ccsens.ht.bean.vo.PatientReportVo$SortScore">
select q.sort, sum(s.score) as score
from t_ht_question q,
t_ht_patient_score s
where q.id = s.question_id
and s.patient_report_id = #{patientReportId}
<choose>
<when test="evaluationCode.length &lt; 1"></when>
<when test="evaluationCode.length = 1">and q.evaluation_code = #{evaluationCode[0]}</when>
<otherwise>
<foreach collection="evaluationCode" item="item" open="and q.evaluation_code in(" separator="," close=")">
#{item}
</foreach>
</otherwise>
</choose>
and s.type in (0,2)
and q.is_del = 0
and s.is_del = 0
group by q.sort
</select>
</mapper>
Loading…
Cancel
Save