|
|
@ -76,6 +76,8 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
private HtReportRelevanceMapper reportRelevanceMapper; |
|
|
|
@Resource |
|
|
|
private IExportService exportService; |
|
|
|
@Resource |
|
|
|
private HtPatientScoreDao htPatientScoreDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public JsonResponse<PatientReportVo.Generate> generatePatientReport(PatientReportDto.Generate generate, Long userId) { |
|
|
@ -404,12 +406,12 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
PdfUtil.Row row = new PdfUtil.Row(); |
|
|
|
PdfUtil.Cell initWordCell = addCell(row, "初步印象", 2, 2); |
|
|
|
initWordCell.setHeight(PdfUtil.Cell.defaultHeight * 2); |
|
|
|
PdfUtil.Cell initImplCell = addCell(row, detail.getPatient().getInitialImpression(), 6, 2); |
|
|
|
PdfUtil.Cell initImplCell = addCell(row, detail.getPatient().getInitialImpression(), 9, 2); |
|
|
|
initImplCell.setHeight(PdfUtil.Cell.defaultHeight * 2); |
|
|
|
initImplCell.setBorderRight(1); |
|
|
|
initImplCell.setCenter(false); |
|
|
|
content.add(row); |
|
|
|
initLast(content, 8); |
|
|
|
initLast(content, 9); |
|
|
|
|
|
|
|
String[] split = detail.getPatient().getHospital().split(""); |
|
|
|
String title = String.join(" ", split); |
|
|
@ -710,7 +712,8 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
public Workbook exportAnalyse(List<Long> ids) { |
|
|
|
|
|
|
|
List<PatientReportVo.Analyse> analyses = htPatientReportDao.queryReportAnalyseScore(ids); |
|
|
|
|
|
|
|
// 处理MMSE的时间定向力和地点定向力
|
|
|
|
dealMMSEScored(analyses); |
|
|
|
|
|
|
|
int total = 124; |
|
|
|
List<List< PoiUtil.PoiUtilCell >> rows = new ArrayList<>(); |
|
|
@ -742,6 +745,26 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
return workbook; |
|
|
|
} |
|
|
|
|
|
|
|
private void dealMMSEScored(List<PatientReportVo.Analyse> analyses) { |
|
|
|
analyses.forEach(analyse -> { |
|
|
|
List<PatientReportVo.MMSEScore> mmseScores = analyse.getMmseScores(); |
|
|
|
if (CollectionUtil.isNotEmpty(mmseScores)) { |
|
|
|
BigDecimal mmseDxl = null; |
|
|
|
for (PatientReportVo.MMSEScore score: mmseScores) { |
|
|
|
if (Constant.Ht.Report.MMSE_SJDXL.equals(score.getCode()) |
|
|
|
&& score.getScore() != null) { |
|
|
|
mmseDxl = score.getScore().add(new BigDecimal((mmseDxl == null ? 0 : mmseDxl.intValue()))); |
|
|
|
} |
|
|
|
if (Constant.Ht.Report.MMSE_DDDXL.equals(score.getCode()) |
|
|
|
&& score.getScore() != null) { |
|
|
|
mmseDxl = score.getScore().add(new BigDecimal((mmseDxl == null ? 0 : mmseDxl.intValue()))); |
|
|
|
} |
|
|
|
} |
|
|
|
mmseScores.add(new PatientReportVo.MMSEScore(Constant.Ht.Report.MMSE_DXL, mmseDxl)); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Long getQuestionId(String code, int sort) { |
|
|
|
String key = "ht_question_" + code + "_" + sort; |
|
|
@ -807,10 +830,16 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
row.get(26).setValue(String.valueOf(s + score.getScore().intValue())); |
|
|
|
} else if (score.getSort() >= 15 && score.getSort() <= 17) { |
|
|
|
row.get(12+score.getSort()).setValue(score.getScore().intValue() + ""); |
|
|
|
} else if (score.getSort()== 20 || score.getSort() == 21) { |
|
|
|
} else if (score.getSort()== 21 || score.getSort() == 22) { |
|
|
|
row.get(10+score.getSort()).setValue(score.getScore().intValue() + ""); |
|
|
|
} else if (score.getSort() == 18) { |
|
|
|
row.get(32).setValue(score.getScore().intValue() + ""); |
|
|
|
} else if (score.getSort() == 18 || score.getSort() == 19) { |
|
|
|
if (score.getScore() != null) { |
|
|
|
String value = row.get(32).getValue(); |
|
|
|
int dxlScore = StrUtil.isEmpty(value) ? 0 : Integer.parseInt(value); |
|
|
|
row.get(32).setValue(dxlScore + score.getScore().intValue() + ""); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1062,7 +1091,8 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
List<PatientReportVo.ReportScore> scores = getReportScores(reportScores, reportId); |
|
|
|
// 分数汇总
|
|
|
|
|
|
|
|
int colNum = Constant.Ht.Report.HAMD.equalsIgnoreCase(param.getCode()) ? 9 : 8; |
|
|
|
int colNum = Constant.Ht.Report.HAMD.equalsIgnoreCase(param.getCode()) |
|
|
|
|| Constant.Ht.Report.MOCA.equals(param.getCode()) ? 9 : 8; |
|
|
|
|
|
|
|
scores.forEach(reportScore -> content.addAll(reportScore.toSingleRow())); |
|
|
|
PdfUtil.Row row = new PdfUtil.Row(); |
|
|
@ -1161,6 +1191,14 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
return workbook; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Workbook exportAnalyseAll(PatientReportDto.Answer answer) { |
|
|
|
log.info("导出全部分析:{}", answer); |
|
|
|
List<Long> reportIds = htPatientScoreDao.queryIdsByAnswer(answer); |
|
|
|
log.info("报告单数量:{}", reportIds.size()); |
|
|
|
return exportAnalyse(reportIds); |
|
|
|
} |
|
|
|
|
|
|
|
private void initQuestionBody(int questionSpan, PatientReportVo.QuestionAndAnswer question, PdfUtil.Row row, boolean isLast, int optionSize) { |
|
|
|
addCell(row, question == null ? Constant.Ht.STRING_DEFAULT : String.valueOf(question.getSort()), 1, 1); |
|
|
|
addCell(row, question == null ? Constant.Ht.STRING_DEFAULT : question.getQuestion(), questionSpan, 1); |
|
|
|