From 998f1335a30a019724589c5551f397027ef88724 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Mon, 24 Jan 2022 09:17:54 +0800 Subject: [PATCH] =?UTF-8?q?moca=E6=8C=87=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ccsens/ht/api/DoctorController.java | 3 +- .../ht/api/PatientReportController.java | 4 +- .../ht/api/PatientReportExportController.java | 2 - .../ccsens/ht/bean/vo/PatientReportVo.java | 20 ++- .../ht/persist/dao/HtPatientReportDao.java | 2 +- .../ht/persist/dao/HtPatientScoreDao.java | 10 ++ .../com/ccsens/ht/service/ExportService.java | 4 +- .../ht/service/IPatientReportService.java | 2 +- .../ht/service/PatientReportService.java | 145 ++++++++++++++++-- .../mapper_dao/HtPatientReportDao.xml | 2 +- .../mapper_dao/HtPatientScoreDao.xml | 20 +++ 11 files changed, 188 insertions(+), 26 deletions(-) diff --git a/ht/src/main/java/com/ccsens/ht/api/DoctorController.java b/ht/src/main/java/com/ccsens/ht/api/DoctorController.java index c1715d01..ce0d2ba7 100644 --- a/ht/src/main/java/com/ccsens/ht/api/DoctorController.java +++ b/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; diff --git a/ht/src/main/java/com/ccsens/ht/api/PatientReportController.java b/ht/src/main/java/com/ccsens/ht/api/PatientReportController.java index 5e01a450..70235640 100644 --- a/ht/src/main/java/com/ccsens/ht/api/PatientReportController.java +++ b/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 queryReportDetail(@RequestBody @ApiParam @Valid QueryDto param){ + public JsonResponse queryReportDetail(@RequestBody @ApiParam @Valid QueryDto 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); } diff --git a/ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java b/ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java index bed46816..29a50b5c 100644 --- a/ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java +++ b/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) diff --git a/ht/src/main/java/com/ccsens/ht/bean/vo/PatientReportVo.java b/ht/src/main/java/com/ccsens/ht/bean/vo/PatientReportVo.java index 05abe766..33882bfc 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/vo/PatientReportVo.java +++ b/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 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("报告单检查类型") diff --git a/ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java b/ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java index f7b6bbdb..950352fe 100644 --- a/ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java +++ b/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 diff --git a/ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientScoreDao.java b/ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientScoreDao.java index 5a7672ed..57fdbe37 100644 --- a/ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientScoreDao.java +++ b/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 queryIdsByAnswer(PatientReportDto.Answer answer); + + /** + * 查询moca每道题的分数 + * @param patientReportId 报告单ID + * @param codes [] evaluationCode 数组 + * @return 题目序号和分数 + */ + List querySortScore(@Param("patientReportId") Long patientReportId, @Param("evaluationCode") String... codes); } diff --git a/ht/src/main/java/com/ccsens/ht/service/ExportService.java b/ht/src/main/java/com/ccsens/ht/service/ExportService.java index c6cc66de..de2f6b3f 100644 --- a/ht/src/main/java/com/ccsens/ht/service/ExportService.java +++ b/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); diff --git a/ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java b/ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java index 2c08f244..5ab86a98 100644 --- a/ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java +++ b/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 diff --git a/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java b/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java index a7e98dbc..78268f36 100644 --- a/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java +++ b/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 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 getReportScores(PatientReportDto.ExportCode param, List content, List reportScores, PatientReportVo.ReprotPatient reportPatient) { + private List getReportScores(PatientReportDto.ExportCode param, List content, List reportScores, PatientReportVo.ReportPatient reportPatient) { long reportId = param.getId(); //重新封装报告单信息 List 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 rows, Long patientReportId) { + // 查询moca的每一题的分数 + List scores = htPatientScoreDao.querySortScore(patientReportId, "MoCA", "YCHY"); + Map 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 getReportScores(List reportScores, long reportId) { Map map = new HashMap<>(32); diff --git a/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml b/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml index e320cdf7..5f263f02 100644 --- a/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml +++ b/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml @@ -1,7 +1,7 @@ - + diff --git a/ht/src/main/resources/mapper_dao/HtPatientScoreDao.xml b/ht/src/main/resources/mapper_dao/HtPatientScoreDao.xml index 690be9e8..0e89f02c 100644 --- a/ht/src/main/resources/mapper_dao/HtPatientScoreDao.xml +++ b/ht/src/main/resources/mapper_dao/HtPatientScoreDao.xml @@ -53,5 +53,25 @@ AND p.is_del = 0 AND q.is_del = 0 + \ No newline at end of file