Browse Source

报告单导出

sd
zhizhi wu 4 years ago
parent
commit
7ade4958f5
  1. 43
      ht/src/main/java/com/ccsens/ht/bean/vo/PatientReportVo.java
  2. 35
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  3. 2
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java
  4. 5
      ht/src/main/java/com/ccsens/ht/uitl/Constant.java
  5. 2
      pom.xml
  6. 10
      util/src/main/java/com/ccsens/util/PdfUtil.java

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

@ -150,7 +150,7 @@ public class PatientReportVo {
}
PdfUtil.Row fourRow = new PdfUtil.Row();
PdfUtil.Cell cell = new PdfUtil.Cell();
cell.setContent("临床诊断:" );
cell.setContent("临床诊断:" + (StrUtil.isEmpty(this.clinicalDiagnosis) ? "" : this.clinicalDiagnosis) );
cell.setCenter(false);
cell.setColSpan(2);
cell.setBorderLeft(0);
@ -190,15 +190,15 @@ public class PatientReportVo {
rows.add(
fillRow(
"文化程度:" + this.educationalStatusUnit + "年",
"编号:" + this.serialNumber,
"编号:" + (StrUtil.isEmpty(this.serialNumber) ? "" : this.serialNumber),
"职业:" + careerMap.get(this.career))
);
//第三栏
rows.add(
fillRow(
"科别:" + this.department,
"床号:" + this.bedNumber,
"病案号:" + this.hospitalNumber)
"科别:" + (StrUtil.isEmpty(this.department) ? "" : this.department),
"床号:" + (StrUtil.isEmpty(this.bedNumber) ? "" : this.bedNumber),
"病案号:" + (StrUtil.isEmpty(this.hospitalNumber) ? "" : this.hospitalNumber))
);
return rows;
}
@ -345,7 +345,7 @@ public class PatientReportVo {
fillMmseOrNpi(headNum, rows, mmse, npi);
break;
case Constant.Ht.Report.MOCA:
fillMoca(rows);
fillSingleMoca(rows);
break;
default:
fillCommon(rows);
@ -363,6 +363,16 @@ public class PatientReportVo {
private void fillMMSE(List<PdfUtil.Row> rows) {
List<ReportScore> mmseList = new ArrayList<>();
dealMMSE(this, mmseList);
PdfUtil.Row row = new PdfUtil.Row();
PdfUtil.Cell purposeCell = new PdfUtil.Cell(Constant.Export.MMSE_PURPOSE);
purposeCell.setColSpan(8);
purposeCell.setBorderRight(1);
purposeCell.setCenter(false);
purposeCell.setHeight(36);
row.addCell(purposeCell);
rows.add(row);
PdfUtil.Row titleRow = new PdfUtil.Row();
PdfUtil.Row scoreRow = new PdfUtil.Row();
for (int i = 0; i < mmseList.size() ; i++) {
@ -486,8 +496,29 @@ public class PatientReportVo {
rows.add(row2);
}
private void fillMoca(List<PdfUtil.Row> rows) {
fillMocaScore(rows);
}
private void fillSingleMoca(List<PdfUtil.Row> rows) {
//moca
PdfUtil.Row row = new PdfUtil.Row();
PdfUtil.Cell purposeCell = new PdfUtil.Cell(Constant.Export.MOCA_PURPOSE);
purposeCell.setColSpan(8);
purposeCell.setCenter(false);
purposeCell.setBorderRight(1);
purposeCell.setHeight(36);
row.addCell(purposeCell);
rows.add(row);
fillMocaScore(rows);
}
private void fillMocaScore(List<PdfUtil.Row> rows) {
int firstIndex = 5;
PdfUtil.Row row1 = new PdfUtil.Row();
PdfUtil.Cell cell = new PdfUtil.Cell();

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

@ -368,7 +368,9 @@ public class PatientReportService implements IPatientReportService {
content.add(row);
initLast(content, 8);
String path = PropUtil.imgDomain + "/" + PdfUtil.createPdf(PropUtil.path, detail.getPatient().getHospital(), Constant.Ht.Report.PARENT_NAME, new PdfUtil.Margin(), detail.getPatient().toPdfRow(), content);
String[] split = detail.getPatient().getHospital().split("");
String title = String.join(" ", split);
String path = PropUtil.imgDomain + "/" + PdfUtil.createPdf(PropUtil.path, title, Constant.Ht.Report.PARENT_NAME, new PdfUtil.Margin(), detail.getPatient().toPdfRow(), content);
report.setUrl(path);
htPatientReportDao.updateByPrimaryKeySelective(report);
log.info("生成文件路径:{}", path);
@ -458,6 +460,19 @@ public class PatientReportService implements IPatientReportService {
@Override
public PageInfo<PatientReportVo.ReportName> queryAllReports(PatientReportDto.AdminQueryReport adminQueryReport, Long userId) {
PageHelper.startPage(adminQueryReport.getPageNum(), adminQueryReport.getPageSize());
List<PatientReportDto.Score> scores = adminQueryReport.getScores();
if (CollectionUtil.isNotEmpty(scores)) {
Iterator<PatientReportDto.Score> iterator = scores.iterator();
while (iterator.hasNext()) {
PatientReportDto.Score next = iterator.next();
if (next.getStart() == null && next.getEnd() == null) {
iterator.remove();
}
}
}
List<PatientReportVo.ReportName> reportNames = htPatientReportDao.queryAllReports(adminQueryReport);
return new PageInfo<>(reportNames);
}
@ -625,6 +640,9 @@ public class PatientReportService implements IPatientReportService {
//查询报告单信息和病人信息
PatientReportVo.ReprotPatient reportPatient = htPatientReportDao.queryReportResult(param.getId());
if (reportPatient == null) {
throw new BaseException(CodeEnum.PARAM_ERROR);
}
//查询报告单分数
List<PatientReportVo.ReportScore> reportScores = htPatientReportDao.queryReportScore2(param.getId(),param.getCode());
@ -637,8 +655,11 @@ public class PatientReportService implements IPatientReportService {
PdfUtil.Margin margin = new PdfUtil.Margin();
margin.setTop(12);
margin.setBottom(12);
margin.setLeft(36);
String path = PropUtil.imgDomain + "/" + PdfUtil.createPdf(PropUtil.path, reportPatient.getHospital(), subHead, margin , reportPatient.toPdfSimpleCodeRow(),questionTable, content);
margin.setLeft(64);
margin.setRight(64);
String[] split = reportPatient.getHospital().split("");
String title = String.join(" ", split);
String path = PropUtil.imgDomain + "/" + PdfUtil.createPdf(PropUtil.path, title, subHead, margin , reportPatient.toPdfSimpleCodeRow(),questionTable, content);
log.info("{}报告单导出路径:{}", param, path);
return path;
}
@ -840,7 +861,7 @@ public class PatientReportService implements IPatientReportService {
PdfUtil.Cell initWordCell = addCell(row, "初步印象", titleSpan, 2);
initWordCell.setHeight(PdfUtil.Cell.defaultHeight * 2);
String initialImpression = reportPatient.getInitialImpression();
PdfUtil.Cell initImplCell = addCell(row, initialImpression, colNum - titleSpan, 2);
PdfUtil.Cell initImplCell = addCell(row, "", colNum - titleSpan, 2);
initImplCell.setHeight(PdfUtil.Cell.defaultHeight * 2);
initImplCell.setBorderRight(1);
initImplCell.setCenter(false);
@ -921,14 +942,20 @@ public class PatientReportService implements IPatientReportService {
// 检查目的
if (StrUtil.isNotBlank(title.checkPurpose)) {
PdfUtil.Row row = new PdfUtil.Row();
row.setHeight(100);
PdfUtil.Cell cell = addCell(row, title.checkPurpose, (title.optionList.size() + questionSpan + 1 ) * cols, 1);
cell.setCenter(false);
cell.setBorderRight(1);
cell.setHeight(36);
questionTable.add(row);
}
// 设置表头
PdfUtil.Row row1 = new PdfUtil.Row();
PdfUtil.Row row2 = new PdfUtil.Row();
if (!Constant.Ht.Report.HAMA.equals(code)) {
row2.setFontSize(10);
}
for (int i = 0; i < cols ; i++) {
addCell(row1, "序号", 1, 2);
// addCell(row2, "", 1, 1);

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

@ -994,7 +994,7 @@ public class QuestionService implements IQuestionService {
lineIndex++;
// 第5条线时,计算长线段的比例
if (lineIndex == lineCount) {
parameter.setLongLineRate(new BigDecimal(longLineIndex).divide(new BigDecimal(lineCount)));
parameter.setLongLineRate(new BigDecimal(longLineIndex * 100).divide(new BigDecimal(lineCount)));
}
}

5
ht/src/main/java/com/ccsens/ht/uitl/Constant.java

@ -41,7 +41,6 @@ public class Constant {
public static final class Export{
public final static Map<String, ReportExportTitle> TITLE_MAP = new HashMap<>();
static {
TITLE_MAP.put("HAMA", new ReportExportTitle("检查目的:用于焦虑症的诊断及程度划分的依据。",
"近一周内", "圈出最符合病人情况的分数",
@ -49,10 +48,12 @@ public class Constant {
TITLE_MAP.put("HAMD", new ReportExportTitle("检查目的:临床评定抑郁状态。",
"", "圈出最符合病人情况的分数",
"无(0)","轻度(1)","中度(2)","重度(3)","极重度(4)"));
TITLE_MAP.put("ADL", new ReportExportTitle("检查目的:ADL量表用于评定被测试人日常生活能力(包括躯体功能和使用工具能力)。",
TITLE_MAP.put("ADL", new ReportExportTitle("检查目的:ADL量表用于评定被测试人日常生活能力(包括躯体功能和使用工具能力)。",
"", "圈出最符合的情况",
"自己可以做(1)","有些困难(2)","需要帮助(3)","根本无法做(4)"));
}
public static final String MMSE_PURPOSE = "检查目的:MMSE用于筛查痴呆患者、判断认知损害的严重程度并跟踪记录病情变化情况。涵盖了定向力、记忆力、计算及注意力、语言和视空间能力等认知域。";
public static final String MOCA_PURPOSE = "检查目的:MoCA作为总体认知功能评估的筛查量表,覆盖注意力、执行功能、记忆、语言、视空间结构、抽象思维、计算和定向力等认知域。";
}
public static final class ReportExportTitle{

2
pom.xml

@ -12,7 +12,7 @@
<module>util</module>
<!-- <module>game</module>-->
<!-- <module>mt</module>-->
<module>health</module>
<!--<module>health</module>-->
<!-- <module>ct</module>-->
<module>question</module>
</modules>

10
util/src/main/java/com/ccsens/util/PdfUtil.java

@ -51,7 +51,7 @@ public class PdfUtil {
// 中文字体
BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
// 标题字体
Font titleChinese = new Font(bfChinese, 24, Font.BOLD);
Font titleChinese = new Font(bfChinese, 14, Font.NORMAL);
//设置标题
Paragraph par = new Paragraph(title, titleChinese);
par.setAlignment(Element.ALIGN_CENTER);
@ -59,14 +59,14 @@ public class PdfUtil {
if (StrUtil.isNotBlank(subhead)) {
// 标题字体
Font subheadChinese = new Font(bfChinese, 22, Font.NORMAL);
Font subheadChinese = new Font(bfChinese, 15, Font.NORMAL);
//设置标题
Paragraph subheadPar = new Paragraph(subhead, subheadChinese);
subheadPar.setAlignment(Element.ALIGN_CENTER);
document.add(subheadPar);
}
// 每行加空白
fillBlankRow(document, new Font(bfChinese, 12, Font.NORMAL));
fillBlankRow(document, new Font(bfChinese, 8, Font.NORMAL));
//设置介绍内容
if (CollectionUtil.isNotEmpty(intros)) {
fillRow(intros, document);
@ -126,7 +126,7 @@ public class PdfUtil {
PdfPTable table = new PdfPTable(size);
table.setSpacingBefore(0);
table.setWidthPercentage(90);
table.setWidthPercentage(100);
for (int j = 0; j < rows.size(); j++) {
Row row = rows.get(j);
table.setHorizontalAlignment(row.align);
@ -214,7 +214,7 @@ public class PdfUtil {
@Data
public static class Margin{
private float left = 72;
private float right = 0;
private float right = 72;
private float top = 32;
private float bottom = 32;
}

Loading…
Cancel
Save