From 9a40afe785178480c91938bc3332b5ed62992af3 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Thu, 29 Apr 2021 13:36:04 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E7=97=85=E4=BE=8B?= =?UTF-8?q?=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ht/api/PatientReportExportController.java | 19 +- .../ccsens/ht/bean/dto/PatientReportDto.java | 10 + .../ccsens/ht/bean/vo/PatientReportVo.java | 66 ++- .../ht/persist/dao/HtPatientReportDao.java | 54 +- .../ht/service/IPatientReportService.java | 5 +- .../ht/service/PatientReportService.java | 190 ++++++- .../java/com/ccsens/ht/uitl/Constant.java | 42 ++ .../mapper_dao/HtPatientReportDao.xml | 73 ++- .../resources/mapper_dao/HtQuestionDao.xml | 10 +- tall/src/main/resources/application.yml | 4 +- .../main/java/com/ccsens/util/PoiUtil.java | 516 ++++++++++++++++-- .../java/com/ccsens/util/WebConstant.java | 3 +- 12 files changed, 893 insertions(+), 99 deletions(-) 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 0e19d4c9..59a88088 100644 --- a/ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java +++ b/ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java @@ -11,10 +11,7 @@ import com.ccsens.util.bean.dto.QueryDto; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; @@ -70,19 +67,19 @@ public class PatientReportExportController { return JsonResponse.newInstance().ok(export); } - @MustLogin - @DoctorAudit +// @MustLogin +// @DoctorAudit @ApiOperation(value = "导出指定id的报告单分析",notes = "导出指定id的报告单分析") @ApiImplicitParams({ @ApiImplicitParam(name = "json", value = "导出指定id的报告单分析", required = true) }) - @RequestMapping(value="/exportAnalyse", method = RequestMethod.POST) - public void exportAnalyse(@RequestBody @ApiParam @Valid QueryDto> param, HttpServletResponse response) throws IOException { + @RequestMapping(value="/exportAnalyse", method = RequestMethod.GET) + public void exportAnalyse(@RequestParam(value = "ids")@ApiParam @Valid List ids, HttpServletResponse response) throws IOException { //查询报告单信息 - log.info("导出指定报告单分析:{}", param); - Workbook workbook = patientReportService.exportAnalyse(param.getParam(), param.getUserId()); + log.info("导出指定报告单分析:{}", ids); + Workbook workbook = patientReportService.exportAnalyse(ids); log.info("导出报告单分析结束"); - String fileName = "报告单信息"; + String fileName = "报告单信息.xlsx"; response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, CharsetUtil.UTF_8)); workbook.write(response.getOutputStream()); } diff --git a/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java b/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java index 0111fdb0..dd2fa278 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java +++ b/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java @@ -99,8 +99,18 @@ public class PatientReportDto { } + @ApiModel("导出报告单分析-请求") + @Data public static class ExportSpecial{ + @ApiModelProperty("报告单ID") private Long id; + +// public ExportSpecial() { +// } +// +// public ExportSpecial(Long id) { +// this.id = id; +// } } /**医生对报告单权限*/ 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 b777a8c7..bbf1809a 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 @@ -14,9 +14,9 @@ import java.math.BigDecimal; import java.util.*; /** - * @program: ptpro + * @program: ht * @description: - * @author: wu huijuan + * @author: whj * @create: 2019/10/31 10:28 */ public class PatientReportVo { @@ -604,8 +604,7 @@ public class PatientReportVo { } } - /**医生对报告单权限*/ - @ApiModel("PatientReportVoAuthority") + @ApiModel("医生对报告单权限") @Data public static class Authority{ @ApiModelProperty("对报告单的操作权限 0:仅查看 1: 可修改 2:可审查") @@ -735,4 +734,63 @@ public class PatientReportVo { @ApiModelProperty("答案") private String answer; } + + @ApiModel("报告单分析导出-vo") + @Data + public static class Analyse{ + @ApiModelProperty("报告单ID") + private Long id; + @ApiModelProperty("测评日期") + private Long reportTime; + @ApiModelProperty("患者名字") + private String patientName; + @ApiModelProperty("性别") + private Byte sex; + @ApiModelProperty("年龄") + private Byte patientAge; + @ApiModelProperty("文化程度") + private Byte educationalStatus; + @ApiModelProperty("职业") + private Byte career; + @ApiModelProperty("临床诊断") + private String clinicalDiagnosis; + @ApiModelProperty("严重程度") + private Byte pasi; + @ApiModelProperty("mmse分数") + private List mmseScores; + @ApiModelProperty("moca分数") + private List mocaScores; + @ApiModelProperty("总分") + private List totalScores; + + } + + + @ApiModel("mmse分数-导出分析") + @Data + public static class MMSEScore{ + @ApiModelProperty("code") + private String code; + @ApiModelProperty("分数") + private BigDecimal score; + } + + @ApiModel("moca分数-导出分析") + @Data + public static class MoCAScore{ + @ApiModelProperty("题目排序") + private int sort; + @ApiModelProperty("分数") + private BigDecimal score; + } + + @ApiModel("量表总分数-导出分析") + @Data + public static class TotalScore{ + @ApiModelProperty("量表类型") + private String evaluationCode; + @ApiModelProperty("总评分") + private BigDecimal totalScore; + } + } 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 c6a987bd..336bd517 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 @@ -18,40 +18,41 @@ public interface HtPatientReportDao extends HtPatientReportMapper { /** *根据病人报告单ID查询报告单结果 - * @param id - *@return: com.ccsens.ht.bean.vo.PatientReportVo.ReprotPatient - *@Author: wuHuiJuan + * @param id 报告单ID + *@return com.ccsens.ht.bean.vo.PatientReportVo.ReprotPatient + *@author wuHuiJuan *@date: 2019/11/19 11:08 */ PatientReportVo.ReprotPatient queryReportResult(@Param("id") Long id); /** * 根据病人报告单ID查询报告单各项相关分数 * @param id 报告单ID + * @param rey 是否查询rey * @param report 报告单类型 - *@return: com.ccsens.ht.bean.vo.PatientReportVo.ReportScore - *@Author: wuHuiJuan + *@return com.ccsens.ht.bean.vo.PatientReportVo.ReportScore + *@author wuHuiJuan *@date: 2019/11/19 11:46 */ List queryReportScore(@Param("id") Long id,@Param("rey") int rey, @Param("report") String report); /** * 查询NPI的分数 - * @param id - * @return + * @param id 报告单ID + * @return npi分数 */ - List> queryNPIScore(@Param("id") Long id); + List> queryNpiScore(@Param("id") Long id); /** * 检查未完成的报告单 - * @param userId - * @return + * @param userId 医生ID + * @return 报告单 */ PatientReportVo.Complete checkComplete(@Param("userId") Long userId); /** * 忽略报告单 - * @param id - * @param userId + * @param id 报告单ID + * @param userId 用户ID */ void ignoreComplete(@Param("id") Long id, @Param("userId") Long userId); @@ -59,35 +60,35 @@ public interface HtPatientReportDao extends HtPatientReportMapper { * 查询报告单名字(ID,名字,导出路径) * @param doctorId 医生ID * @param patientId 病人ID - * @return + * @return 报告单id,名字和pdf路径 */ List queryReportName(@Param("doctorId")Long doctorId, @Param("patientId") Long patientId); /** * 管理员查询报告单 - * @param adminQueryReport - * @return + * @param adminQueryReport 搜索条件 + * @return 报告单 */ List queryAllReports(PatientReportDto.AdminQueryReport adminQueryReport); /** * 根据临床诊断统计 - * @param param - * @return + * @param param 统计条件 + * @return 临床诊断统计 */ List countByClinicalDiagnosis(PatientReportDto.ClinicalDiagnosis param); /** * 根据年龄性别统计 - * @param param - * @return + * @param param 年龄性别 + * @return 年龄性别统计 */ List countBySexAndAge(PatientReportDto.AgeAndSex param); /** * 根据日期统计 - * @param param - * @return + * @param param 日期 + * @return 统计 */ List countByDay(PatientReportDto.Day param); @@ -95,7 +96,7 @@ public interface HtPatientReportDao extends HtPatientReportMapper { * 查询报告单的详细答题洗洗 * @param id 报告单id * @param evaluationCode 测试类型 - * @return + * @return 报告单的详细答题明细 */ List queryReportAnswer(@Param("id")Long id, @Param("evaluationCode")String evaluationCode); @@ -110,7 +111,7 @@ public interface HtPatientReportDao extends HtPatientReportMapper { * 根据病人报告单ID查询报告单各项相关分数 * @param id 报告单ID * @param code 量表类型 - * @return + * @return 报告单分数 */ List queryReportScore2(@Param("id") Long id, @Param("code") String code); @@ -121,4 +122,11 @@ public interface HtPatientReportDao extends HtPatientReportMapper { * @return 题目 */ List queryQuestionAndScore(@Param("id") Long id, @Param("code") String code); + + /** + * + * @param ids 指定报告单ID + * @return 报告单分数 mmse 分类 moca 试题和分数 其他:总分 + */ + List queryReportAnalyseScore(@Param("ids") List ids); } 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 5ce6331b..4c8b1112 100644 --- a/ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java +++ b/ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java @@ -168,9 +168,8 @@ public interface IPatientReportService { /** * 导出指定报告单分析 - * @param param 报告单ID列表 - * @param userId 用户ID + * @param ids 报告单ID列表 * @return workbook */ - Workbook exportAnalyse(List param, Long userId); + Workbook exportAnalyse(List ids); } 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 88314b52..3371e9ca 100644 --- a/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java +++ b/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java @@ -26,6 +26,7 @@ import com.github.pagehelper.PageInfo; import com.github.pagehelper.StringUtil; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -235,7 +236,7 @@ public class PatientReportService implements IPatientReportService { } private void initNPI(long id, PatientReportVo.ReportScore score) { - List> list = htPatientReportDao.queryNPIScore(id); + List> list = htPatientReportDao.queryNpiScore(id); Map npiScore = new HashMap<>(); list.forEach(map -> npiScore.put((String)map.get("optionName"), map.get("score"))); PatientReportVo.ReportScore carer = new PatientReportVo.ReportScore(); @@ -628,7 +629,7 @@ public class PatientReportService implements IPatientReportService { List reportScores = htPatientReportDao.queryReportScore2(param.getId(),param.getCode()); if (!Constant.Ht.Report.ADL.equals(param.getCode())) { - getReportScores(param, content, reportScores); + getReportScores(param, content, reportScores, reportPatient); } @@ -643,14 +644,189 @@ public class PatientReportService implements IPatientReportService { } @Override - public Workbook exportAnalyse(List param, Long userId) { + public Workbook exportAnalyse(List ids) { + List analyses = htPatientReportDao.queryReportAnalyseScore(ids); -// PoiUtil. - return null; + + int total = 38; + List> rows = new ArrayList<>(); + // 标题 表头 + initAnalyseTitle(rows, total); + + if (CollectionUtil.isEmpty(analyses)) { + Workbook workbook = new XSSFWorkbook();; + PoiUtil.exportWB("报告单详情", rows, workbook); + return workbook; + } + // 填充数据 + for (int i = 0; i < analyses.size(); i++) { + + List row = new ArrayList<>(); + row.add(new PoiUtil.PoiUtilCell(String.valueOf(i+1),1,1)); + for (int j = 1; j < total; j++) { + row.add(new PoiUtil.PoiUtilCell("",1,1)); + } + fillAnalyse(row, analyses.get(i)); + rows.add(row); + } + + + + Workbook workbook = new XSSFWorkbook();; + PoiUtil.exportWB("报告单详情", rows, workbook); + return workbook; + } + + /** + * 填充导出分析 + * @param row 表格 + * @param analyse 分析 + */ + private void fillAnalyse(List row, PatientReportVo.Analyse analyse) { + row.get(1).setValue(DateUtil.format(new Date(analyse.getReportTime()), "yyyy.MM.dd")); + row.get(2).setValue(analyse.getPatientName()); + row.get(3).setValue(analyse.getSex() == 0 ? "男" : "女"); + row.get(4).setValue(String.valueOf(analyse.getPatientAge())); + row.get(5).setValue(Constant.Ht.getEducational(analyse.getEducationalStatus())); + row.get(6).setValue(Constant.Ht.getCareer(analyse.getCareer())); + row.get(7).setValue(analyse.getClinicalDiagnosis()); + row.get(8).setValue(Constant.Ht.getPasi(analyse.getPasi())); + if (CollectionUtil.isNotEmpty(analyse.getMmseScores())) { + analyse.getMmseScores().forEach(score->{ + switch (score.getCode()) { + case "DXL" : row.get(9).setValue(score.getScore().intValue() + "");break; + case "JYL" : row.get(10).setValue(score.getScore().intValue() + "");break; + case "ZYLHJSL" : row.get(11).setValue(score.getScore().intValue() + "");break; + case "HYNL" : row.get(12).setValue(score.getScore().intValue() + "");break; + case "YYNL" : row.get(13).setValue(score.getScore().intValue() + "");break; + case "JGNL" : row.get(14).setValue(score.getScore().intValue() + "");break; + } + }); + } + // MOCA匹配 + if (CollectionUtil.isNotEmpty(analyse.getMocaScores())) { + for (int i = 0; i < analyse.getMocaScores().size(); i++) { + PatientReportVo.MoCAScore score = analyse.getMocaScores().get(i); + if (score.getSort() <= 3) { + row.get(15+score.getSort()).setValue(score.getScore().intValue() + ""); + } else if (score.getSort() == 4 || score.getSort() == 5 || score.getSort() == 6) { + String value = row.get(19).getValue(); + int s = StrUtil.isEmpty(value) ? 0 : Integer.parseInt(value); + row.get(19).setValue(String.valueOf(s + score.getScore().intValue())); + } else if (score.getSort() >= 7 && score.getSort() <= 12) { + row.get(13+score.getSort()).setValue(score.getScore().intValue() + ""); + } else if (score.getSort() == 13 || score.getSort() == 14) { + String value = row.get(26).getValue(); + int s = StrUtil.isEmpty(value) ? 0 : Integer.parseInt(value); + 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) { + row.get(10+score.getSort()).setValue(score.getScore().intValue() + ""); + } else if (score.getSort() == 18) { + row.get(32).setValue(score.getScore().intValue() + ""); + } + } + } + + if (CollectionUtil.isNotEmpty(analyse.getTotalScores())) { + analyse.getTotalScores().forEach(totalScore -> { + switch (totalScore.getEvaluationCode()) { + case "MMSE": row.get(15).setValue(totalScore.getTotalScore().intValue() + "");break; + case "MoCA": row.get(33).setValue(totalScore.getTotalScore().intValue() + "");break; + case "ADL": row.get(34).setValue(totalScore.getTotalScore().intValue() + "");break; + case "HAMA": row.get(35).setValue(totalScore.getTotalScore().intValue() + "");break; + case "HAMD": row.get(36).setValue(totalScore.getTotalScore().intValue() + "");break; + case "NPI": row.get(37).setValue(totalScore.getTotalScore().intValue() + "");break; + } + }); + } + } + + private void initAnalyseTitle(List> rows, int total) { + List headRow = new ArrayList<>(); + PoiUtil.PoiUtilCell headCell = new PoiUtil.PoiUtilCell(); + headCell.setColspan(total); + headCell.setValue("认知功能神经心理量表检查报告单"); + headRow.add(headCell); + rows.add(headRow); + log.info("标题:{}", headCell); + List oneTitleRow = new ArrayList<>(); + oneTitleRow.add(new PoiUtil.PoiUtilCell("序号",1,2)); + oneTitleRow.add(new PoiUtil.PoiUtilCell("基本信息",8,1)); + for (int i = 0; i < 7; i++) { + oneTitleRow.add(new PoiUtil.PoiUtilCell("",1,1)); + } + + + oneTitleRow.add(new PoiUtil.PoiUtilCell("MMSE",7,1)); + for (int i = 0; i < 6; i++) { + oneTitleRow.add(new PoiUtil.PoiUtilCell("",1,1)); + } + oneTitleRow.add(new PoiUtil.PoiUtilCell("MoCA",18,1)); + for (int i = 0; i < 17; i++) { + oneTitleRow.add(new PoiUtil.PoiUtilCell("",1,1)); + } + oneTitleRow.add(new PoiUtil.PoiUtilCell("其他量表",4,1)); + for (int i = 0; i < 4; i++) { + oneTitleRow.add(new PoiUtil.PoiUtilCell("",1,1)); + } + rows.add(oneTitleRow); + + List titleRow = new ArrayList<>(); + // 基本信息 + titleRow.add(new PoiUtil.PoiUtilCell("")); + titleRow.add(new PoiUtil.PoiUtilCell("测评日期")); + titleRow.add(new PoiUtil.PoiUtilCell("姓名")); + titleRow.add(new PoiUtil.PoiUtilCell("性别")); + titleRow.add(new PoiUtil.PoiUtilCell("年龄")); + titleRow.add(new PoiUtil.PoiUtilCell("文化程度")); + titleRow.add(new PoiUtil.PoiUtilCell("职业")); + titleRow.add(new PoiUtil.PoiUtilCell("临床诊断")); + titleRow.add(new PoiUtil.PoiUtilCell("严重程度")); + // MMSE + titleRow.add(new PoiUtil.PoiUtilCell("定向力")); + titleRow.add(new PoiUtil.PoiUtilCell("记忆力")); + titleRow.add(new PoiUtil.PoiUtilCell("注意力和计算力")); + titleRow.add(new PoiUtil.PoiUtilCell("回忆能力")); + titleRow.add(new PoiUtil.PoiUtilCell("语言能力")); + titleRow.add(new PoiUtil.PoiUtilCell("结构能力")); + titleRow.add(new PoiUtil.PoiUtilCell("总分")); + + // MoCA + titleRow.add(new PoiUtil.PoiUtilCell("连线测验")); + titleRow.add(new PoiUtil.PoiUtilCell("立方体")); + titleRow.add(new PoiUtil.PoiUtilCell("画钟")); + // 命名 4-6 + titleRow.add(new PoiUtil.PoiUtilCell("命名")); + titleRow.add(new PoiUtil.PoiUtilCell("记忆1")); + titleRow.add(new PoiUtil.PoiUtilCell("记忆2")); + titleRow.add(new PoiUtil.PoiUtilCell("注意顺背")); + titleRow.add(new PoiUtil.PoiUtilCell("注意倒背")); + titleRow.add(new PoiUtil.PoiUtilCell("注意敲1")); + titleRow.add(new PoiUtil.PoiUtilCell("注意100-7")); + // 语言重复 13-14 + titleRow.add(new PoiUtil.PoiUtilCell("语言重复")); + 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("多选提示")); + titleRow.add(new PoiUtil.PoiUtilCell("定向")); + titleRow.add(new PoiUtil.PoiUtilCell("总分")); + + // 其他量表总分 + titleRow.add(new PoiUtil.PoiUtilCell("ADL总分")); + titleRow.add(new PoiUtil.PoiUtilCell("HAMA总分")); + titleRow.add(new PoiUtil.PoiUtilCell("HAMD总分")); + titleRow.add(new PoiUtil.PoiUtilCell("NPI总分")); + rows.add(titleRow); } - private List getReportScores(PatientReportDto.ExportCode param, List content, List reportScores) { + private List getReportScores(PatientReportDto.ExportCode param, List content, List reportScores, PatientReportVo.ReprotPatient reportPatient) { long reportId = param.getId(); //重新封装报告单信息 List scores = getReportScores(reportScores, reportId); @@ -663,7 +839,7 @@ public class PatientReportService implements IPatientReportService { int titleSpan = 2; PdfUtil.Cell initWordCell = addCell(row, "初步印象", titleSpan, 2); initWordCell.setHeight(PdfUtil.Cell.defaultHeight * 2); - String initialImpression = ""; + String initialImpression = reportPatient.getInitialImpression(); PdfUtil.Cell initImplCell = addCell(row, initialImpression, colNum - titleSpan, 2); initImplCell.setHeight(PdfUtil.Cell.defaultHeight * 2); initImplCell.setBorderRight(1); diff --git a/ht/src/main/java/com/ccsens/ht/uitl/Constant.java b/ht/src/main/java/com/ccsens/ht/uitl/Constant.java index 44a3f31f..a1aefe86 100644 --- a/ht/src/main/java/com/ccsens/ht/uitl/Constant.java +++ b/ht/src/main/java/com/ccsens/ht/uitl/Constant.java @@ -129,10 +129,52 @@ public class Constant { public final static byte SEX_MAN = 0; public final static byte SEX_WOMAN = 1; + //1:文盲 2:小学 3:初中 4:高中 5:大学 6:大学以上 7:其他 + public static String getEducational(int status) { + switch (status) { + case 1: return "文盲"; + case 2: return "小学"; + case 3: return "初中"; + case 4: return "高中"; + case 5: return "大学"; + case 6: return "大学以上"; + default: return "其他"; + } + } + + public static String getCareer(int status) { + switch (status) { + case 1: return "农林牧渔水利生产人员"; + case 2: return "教师"; + case 3: return "医务工作者"; + case 4: return "专业技术人员"; + case 5: return "生产、运输设备操作人员及有关人员"; + case 6: return "商业、服务业人员"; + case 7: return "国家机关、事业单位、企业负责人"; + case 8: return "商业、服务业人员"; + case 9: return "军人"; + case 10: return "媒体、文体类工作人员"; + case 11: return "在校学生"; + case 12: return "未就业"; + case 13: return "家务"; + default: return "其他"; + } + } + /**删除*/ public final static byte IS_DEL = 1; + public static String getPasi(Byte pasi) { + switch (pasi) { + case 0: return "正常"; + case 1: return "轻度"; + case 2: return "中度"; + case 3: return "重度"; + default: return ""; + } + } + public final static class QuestionRecord{ public static final byte RECORD_TYPE_CODE = 0; diff --git a/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml b/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml index 2d573a52..ed13cc55 100644 --- a/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml +++ b/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml @@ -48,6 +48,29 @@ + + + + + + + + + + + + + + + + + + + + + + + - select option_name as optionName, sum(score) as score from t_ht_patient_score where patient_report_id = #{id, jdbcType=BIGINT} and question_parent_code = 'NPI' @@ -357,6 +380,54 @@ q.sort, o.sort + \ No newline at end of file diff --git a/ht/src/main/resources/mapper_dao/HtQuestionDao.xml b/ht/src/main/resources/mapper_dao/HtQuestionDao.xml index 5ea00dc2..cbfcf214 100644 --- a/ht/src/main/resources/mapper_dao/HtQuestionDao.xml +++ b/ht/src/main/resources/mapper_dao/HtQuestionDao.xml @@ -38,7 +38,7 @@ replace into t_ht_question (id, evaluation_code, parent_code, sort, question, type, - record_type, record_content, relation_code, + record_type, record_content, relation_code, relation_id, operate_type, recode_starttime, time_wabei, allow_clear, clear_times, timing_length, remark, create_time, update_time, @@ -48,6 +48,14 @@ (#{question.id,jdbcType=BIGINT}, #{question.evaluationCode,jdbcType=VARCHAR}, #{question.parentCode,jdbcType=VARCHAR}, #{question.sort,jdbcType=INTEGER}, #{question.question,jdbcType=VARCHAR}, #{question.type,jdbcType=TINYINT}, #{question.recordType,jdbcType=VARCHAR}, #{question.recordContent,jdbcType=VARCHAR}, #{question.relationCode,jdbcType=VARCHAR}, + + + 0, + + + #{question.relationId}, + + #{question.operateType,jdbcType=TINYINT}, #{question.recodeStarttime,jdbcType=TINYINT}, #{question.timeWabei,jdbcType=TINYINT}, #{question.allowClear,jdbcType=TINYINT}, #{question.clearTimes,jdbcType=INTEGER}, #{question.timingLength,jdbcType=INTEGER}, #{question.remark,jdbcType=VARCHAR}, #{question.createTime,jdbcType=TIMESTAMP}, now(), 0 ) diff --git a/tall/src/main/resources/application.yml b/tall/src/main/resources/application.yml index eca66951..1d881c2f 100644 --- a/tall/src/main/resources/application.yml +++ b/tall/src/main/resources/application.yml @@ -1,4 +1,4 @@ spring: profiles: - active: test - include: util-test,common \ No newline at end of file + active: dev + include: util-dev,common \ No newline at end of file diff --git a/util/src/main/java/com/ccsens/util/PoiUtil.java b/util/src/main/java/com/ccsens/util/PoiUtil.java index efbd2ded..346dcdc5 100644 --- a/util/src/main/java/com/ccsens/util/PoiUtil.java +++ b/util/src/main/java/com/ccsens/util/PoiUtil.java @@ -1,11 +1,17 @@ package com.ccsens.util; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.ccsens.util.exception.BaseException; +import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.poi.POIXMLDocumentPart; +import org.apache.poi.common.usermodel.HyperlinkType; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.*; import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker; import org.springframework.stereotype.Component; @@ -20,17 +26,283 @@ import java.util.Map; /** * 导入导出excel + * @author wu */ @Slf4j @Component public class PoiUtil { + + @Data + public static class PoiUtilCell { + /** + * 单元格内容 + */ + private String value = ""; + /** + * 跨列 + */ + private int colspan = 1; + /** + * 跨行 + */ + private int rowspan = 1; + /** + * 水平居中 + */ + private HorizontalAlignment style = HorizontalAlignment.CENTER; + /** + * 垂直居中 + */ + private VerticalAlignment verticalAlignment = VerticalAlignment.CENTER; + /** + * 行高 + */ + private Integer height; + /** + * 列宽 + */ + private Integer wight; + + /** + * 跳转的路径 + */ + private String path; + /** + * 函数 + */ + private String function; + + /** + * 是否是数字格式 0否 1是 + */ + private byte num = 0; + + public PoiUtilCell() { + + } + + public PoiUtilCell(String value) { + this.value = value; + } + + public PoiUtilCell(String value,String function) { + this.value = value; + this.function = function; + } + + + public PoiUtilCell(String value, int colspan, int rowspan) { + this.value = value; + this.colspan = colspan; + this.rowspan = rowspan; + } + + public PoiUtilCell(String value, Integer height, Integer wight) { + this.value = value; + this.height = height; + this.wight = wight; + } + + public PoiUtilCell(String value, int colspan, int rowspan, Integer height, Integer wight) { + this.value = value; + this.colspan = colspan; + this.rowspan = rowspan; + this.height = height; + this.wight = wight; + } + + } + + + /** + * 导出Excel + * + * @param sheetName sheet名称 + * @param rows 行 + * @param wb XSSFWorkbook对象 无则创建 + * @return 返回生成的excel数据 + */ + public static Workbook exportWB(String sheetName, List> rows, Workbook wb) { + + // 第一步,创建一个XSSFWorkbook,对应一个Excel文件 + if (wb == null) { + wb = new XSSFWorkbook(); + } + if (rows == null) { + return wb; + } + // 第二步,在workbook中添加一个sheet,对应Excel文件中的sheet + Sheet sheet = wb.getSheet(sheetName); + if (ObjectUtil.isNull(sheet)) { + sheet = wb.createSheet(sheetName); + } + +// // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制 +// HSSFRow row = sheet.createRow(0); + + // 第四步,创建单元格,并设置值表头 设置表头居中 + for (int i = 0; i < rows.size(); i++) { + List cells = rows.get(i); + for (int j = 0; j < cells.size(); j++) { + PoiUtilCell cell = cells.get(j); + //设置列宽 + if (ObjectUtil.isNotNull(cell.wight)) { + sheet.setColumnWidth(j, cell.wight * 256); + } + mergedRegion(sheet, i, j, cells.get(j)); + } + } + + //创建内容 + for (int i = 0; i < rows.size(); i++) { + Row row = sheet.getRow(i); + if (ObjectUtil.isNull(row)) { + row = sheet.createRow(i); + } + List cells = rows.get(i); + for (int j = 0; j < cells.size(); j++) { + PoiUtilCell cell = cells.get(j); + if(ObjectUtil.isNull(cell)){ + continue; + } + //查找当前单元格 + Cell newCell = row.getCell(j); + if(ObjectUtil.isNull(newCell)){ + newCell = row.createCell(j); + } + //查找当前单元格的样式 + CellStyle style = newCell.getCellStyle(); + if(ObjectUtil.isNull(style)){ + style = wb.createCellStyle(); + } +// CellStyle style = wb.createCellStyle(); + //设置内容 + if (!WebConstant.CELL_NULL.equals(cell.value)){ +// if(cell.num == 1){ +// newCell.setCellValue(Integer.parseInt(cell.value)); +// }else { +// newCell.setCellValue(cell.value); +// } + if(ObjectUtil.isNull(cell.value)) { +// log.info("单元格内容为空:{}", cell.value); + }else { + if (cell.value.length() <= 14 && cell.value.matches("\\d+")) { + newCell.setCellValue(Long.parseLong(cell.value)); + } else { + newCell.setCellValue(cell.value); + } + } + } + //设置行高 + if (ObjectUtil.isNotNull(cell.height)) { + if (j == 0) { + row.setHeight(cell.height.shortValue()); + } + } + //设置水平居中和垂直居中 + style.setAlignment(cell.style); + style.setVerticalAlignment(cell.verticalAlignment); + //设置跳转路径 + if (StrUtil.isNotEmpty(cell.path)) { + XSSFCreationHelper createHelper = (XSSFCreationHelper) wb.getCreationHelper(); + XSSFHyperlink link = createHelper.createHyperlink(HyperlinkType.URL); + link.setAddress(cell.path); + newCell.setHyperlink(link); + //设置字体颜色 + Font font = wb.createFont(); + font.setColor(Font.COLOR_RED); + style.setFont(font); + } + //添加函数 + if(StrUtil.isNotEmpty(cell.getFunction())) { + newCell.setCellFormula(cell.getFunction()); + } + //设置自动换行 + style.setWrapText(true); + //将样式添加至单元格 + newCell.setCellStyle(style); + +// CellStyle style = wb.createCellStyle(); +// 将内容按顺序赋给对应的列对象 +// 如果value是cell_null代表次单元格不需要赋值 +// if (cell.value.equals(WebConstant.CELL_NULL)){ +// continue; +// } +// Cell newCell = row.createCell(j); +// //设置行高 +// if (ObjectUtil.isNotNull(cell.height)) { +// if (j == 0) { +// row.setHeight(cell.height.shortValue()); +// } +// } +// +// if(cell.num == 1){ +// newCell.setCellValue(Integer.parseInt(cell.value)); +// }else { +// newCell.setCellValue(cell.value); +// } +// style.setAlignment(cell.style); +// style.setVerticalAlignment(cell.verticalAlignment); + +// //设置跳转路径 +// if (StrUtil.isNotEmpty(cell.path)) { +// XSSFCreationHelper createHelper = (XSSFCreationHelper) wb.getCreationHelper(); +// XSSFHyperlink link = createHelper.createHyperlink(HyperlinkType.URL); +// link.setAddress(cell.path); +// newCell.setHyperlink(link); +// //设置字体颜色 +// Font font = wb.createFont(); +// font.setColor(Font.COLOR_RED); +// style.setFont(font); +// } +// //添加函数 +// if(StrUtil.isNotEmpty(cell.getFunction())) { +// newCell.setCellFormula(cell.getFunction()); +// } +// //设置自动换行 +// style.setWrapText(true); +// newCell.setCellStyle(style); + } + } + return wb; + } + + /** + * 合并单元格 + * + * @param sheet 当前sheet + * @param rows 行数 + * @param cols 列数 + * @param cell 单元格信息 + */ + private static void mergedRegion(Sheet sheet, int rows, int cols, PoiUtilCell cell) { +// +// int rowspan = cell.rowspan; +// if (rowspan > 1) { +// sheet.addMergedRegion(new CellRangeAddress(rows, rows + rowspan - 1, cols, cols)); +// } +// int colspan = cell.colspan; +// +// if (colspan > 1) { +// sheet.addMergedRegion(new CellRangeAddress(rows, rows, cols, cols + colspan - 1)); +// } + + int rowspan = cell.rowspan; + int colspan = cell.colspan; + if(rowspan > 1 || colspan > 1){ + sheet.addMergedRegion(new CellRangeAddress(rows, rows + rowspan - 1, cols, cols + colspan - 1)); + } + + } + + /** * @param file * @param sheetIndex * @param dataIndex 数据从第几行开始(0) * @return */ - public static List readExce(File file, int sheetIndex, String sheetName, int dataIndex, boolean hasImg) throws Exception{ + public static List readExce(File file, int sheetIndex, String sheetName, int dataIndex, boolean hasImg) throws Exception { if (!file.getPath().endsWith(".xls") && !file.getPath().endsWith(".xlsx")) { log.info("文件不是excel类型:{}", file.getName()); throw new BaseException(CodeEnum.FILE_FORMAT_ERROR); @@ -38,47 +310,52 @@ public class PoiUtil { log.info("导入解析开始,fileName:{}", file.getPath()); - List list = new ArrayList<>(); + List list = new ArrayList<>(); - Sheet sheet = createSheet(file, sheetIndex, sheetName); - //读取放在首列的图片 - Map imgMap = null; - if (hasImg) { - imgMap = getImg(file, sheet); - } - //获取sheet的行数 - int rows = sheet.getPhysicalNumberOfRows(); + Sheet sheet = createSheet(file, sheetIndex, sheetName); + if(ObjectUtil.isNull(sheet)){ + return list; + } + //读取放在首列的图片 + Map imgMap = null; + if (hasImg) { + imgMap = getImg(file, sheet); + } + //获取sheet的行数 + int rows = sheet.getPhysicalNumberOfRows(); - //读取数据 - for (int i = 0; i < rows; i++) { + //读取数据 + for (int i = 0; i < rows; i++) { - Row row = getRow(sheet, i, dataIndex); - if (row == null) { + Row row = getRow(sheet, i, dataIndex); + if (row == null || row.getLastCellNum() <= 0) { + continue; + } + System.out.println(row); + System.out.println(row.getLastCellNum()); + Object[] objects = new Object[row.getLastCellNum()]; + if (hasImg && imgMap != null) { + for (String key : imgMap.keySet()) { + if (key.startsWith(i + "-")) { + int index = Integer.parseInt(key.split("-")[1]); + objects[index] = imgMap.get(key); + } + } + } + for (int j = 0; j < row.getLastCellNum(); j++) { + Cell cell = row.getCell(j); + if (cell == null) { continue; } - Object[] objects = new Object[row.getLastCellNum()]; - if (hasImg && imgMap != null) { - for (String key: imgMap.keySet()) { - if (key.startsWith(i+"-")) { - int index = Integer.parseInt(key.split("-")[1]); - objects[index] = imgMap.get(key); - } - } + if (objects[j] == null) { + objects[j] = getCallValue(cell); } - for (int j = 0; j < row.getLastCellNum(); j++) { - Cell cell = row.getCell(j); - if (cell == null) { - continue; - } - if (objects[j] == null) { - objects[j] = getCallValue(cell); - } - } - list.add(objects); } - log.info("导入文件解析成功!"); - return list; + list.add(objects); + } + log.info("导入文件解析成功!"); + return list; } @@ -121,7 +398,6 @@ public class PoiUtil { } - private PoiUtil() { super(); } @@ -163,7 +439,7 @@ public class PoiUtil { String suffix = pictureData.suggestFileExtension(); //图片 byte[] data = pictureData.getData(); - String fileName = "/poi/img/" + cn.hutool.core.date.DateUtil.today() + "/"+ System.currentTimeMillis() + "." + suffix; + String fileName = "/poi/img/" + cn.hutool.core.date.DateUtil.today() + "/" + System.currentTimeMillis() + "." + suffix; String path = PropUtil.path + fileName; FileOutputStream out = null; @@ -215,6 +491,7 @@ public class PoiUtil { return map; } + /** * 获取当前行 */ @@ -241,7 +518,6 @@ public class PoiUtil { /** * 生成sheet - * * @param file * @param index * @return @@ -251,7 +527,7 @@ public class PoiUtil { InputStream inputStream = new FileInputStream(file); Workbook workbook; if (file.getPath().endsWith(".xls")) { - workbook = new HSSFWorkbook(inputStream); + workbook = new XSSFWorkbook(inputStream); } else { workbook = new XSSFWorkbook(inputStream); } @@ -261,17 +537,165 @@ public class PoiUtil { return workbook.getSheetAt(index); } - public static void main(String[] args) throws Exception { - File file = new File("D:\\1.xlsx"); - List list = readExce(file, 0, null, 3, true); - for (Object[] arr : list) { - for (Object t : arr) { - System.out.print(t + "---"); + /** + * 插入图片 + * @param row1:起始行 + * @param row2:终止行 + * @param col1:起始列 + * @param col2:终止列 + * @throws IOException + */ + public static Workbook setImg(Workbook wb,String sheetName,String imgPath,int row1,int row2,int col1,int col2) throws IOException { + // 第一步,创建一个XSSFWorkbook,对应一个Excel文件 + if (wb == null) { + wb = new XSSFWorkbook(); + } + // 第二步,在workbook中添加一个sheet,对应Excel文件中的sheet + Sheet sheet = wb.getSheet(sheetName); + if (ObjectUtil.isNull(sheet)) { + sheet = wb.createSheet(sheetName); + } + // 插入 PNG 图片至 Excel + InputStream is = new FileInputStream(imgPath); + if(ObjectUtil.isNull(is)){ + return wb; + } + byte[] bytes = IOUtils.toByteArray(is); + int pictureIdx = wb.addPicture(bytes, Workbook.PICTURE_TYPE_PNG); + + CreationHelper helper = wb.getCreationHelper(); + Drawing drawing = sheet.createDrawingPatriarch(); + ClientAnchor anchor = helper.createClientAnchor(); + + // 图片插入坐标 + anchor.setDx1(0); + anchor.setDy1(0); + anchor.setDx2(0); + anchor.setDy2(0); + anchor.setRow1(row1); + anchor.setRow2(row2); + anchor.setCol1(col1); + anchor.setCol2(col2); + // 插入图片 + Picture pict = drawing.createPicture(anchor, pictureIdx); + return wb; + } + + + + /** + * 获取excel的列号 + * @param num 第几列(从1开始) + * @return 返回列号 + */ + public static String toRadix(Integer num) throws Exception{ + String[] array = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}; + int count = 26; + String out = ""; + if(num > count){ + if(num % count == 0){ + out = array[(num / count) - 1 - 1] + array[count - 1]; + }else { + out = array[(num / count) - 1] + array[(num % count) - 1]; } - System.out.println("============"); + }else{ + out = array[num - 1]; } + return out; } + public static void main(String[] args) throws Exception { + String s = toRadix(3); + System.out.println(s); + + +// File file = new File("F:\\wenjian\\3.xlsx"); +// file.createNewFile(); +// InputStream inputStream = new FileInputStream(file); + Workbook workbook = new XSSFWorkbook(); +// XSSFSheet sheet = (XSSFSheet) workbook.getSheetAt(0); +// XSSFRow row = sheet.getRow(6); +// XSSFCell newCell = row.createCell(2); +// XSSFCell newCell1 = row.createCell(3); +// //添加公式 +// newCell.setCellFormula("A7+B7"); +// newCell1.setCellFormula("A8/B8"); +// //设置打印区域 +// workbook.setPrintArea( +// 0, //工作薄 下标0开始 +// 0, //起始列 下标0开始 +// 20, //终止列 下标0开始 +// 0, //起始行 下标0开始 +// 20 //终止行 下标0开始 +// ); +//// CellStyle style = workbook.createCellStyle(); +//// style.setFillBackgroundColor(); +// +// OutputStream stream = new FileOutputStream(new File("D:\\1.xlsx")); +// workbook.write(stream); +// stream.close(); + + + + PoiUtilCell poiUtilCell = new PoiUtilCell(); + poiUtilCell.setValue("111222333"); + poiUtilCell.setColspan(2); + poiUtilCell.setRowspan(1); + PoiUtilCell poiUtilCell1 = new PoiUtilCell(); + poiUtilCell1.setValue("1112222"); + PoiUtilCell poiUtilCell3 = new PoiUtilCell(); + poiUtilCell3.setValue("123"); + + PoiUtilCell poiUtilCell2 = new PoiUtilCell(); + poiUtilCell2.setValue(""); + poiUtilCell2.setFunction("SUM(A1:C1)"); + + + List cells = new ArrayList<>(); + cells.add(poiUtilCell); + cells.add(poiUtilCell1); + cells.add(poiUtilCell3); + + cells.add(poiUtilCell2); + + List> list = new ArrayList<>(); + list.add(cells); + + + +// list.add(cells); +// +// List cells1 = new ArrayList<>(); +// cells1.add(new PoiUtilCell("两列一行", 2, 1)); +// list.add(cells1); +// +// List cells2 = new ArrayList<>(); +// cells2.add(new PoiUtilCell("一列两行", 1, 2)); +// list.add(cells2); +// List cells3 = new ArrayList<>(); +// cells3.add(new PoiUtilCell("5")); +// cells3.add(new PoiUtilCell("6")); +// list.add(cells3); +// List cells4 = new ArrayList<>(); +// list.add(cells4); +// List cells5 = new ArrayList<>(); +// cells5.add(new PoiUtilCell("9", 2, 2)); +// cells5.add(new PoiUtilCell("9")); +// list.add(cells5); + String fileName = "zzz/" + cn.hutool.core.date.DateUtil.today() + "/" + System.currentTimeMillis() + ".xlsx"; + String path = WebConstant.UPLOAD_PATH_BASE + fileName; + File tmpFile = new File(path); + if (!tmpFile.getParentFile().exists()) { + tmpFile.getParentFile().mkdirs(); + } + + Workbook wbs = exportWB("Sheet1", list, workbook); + OutputStream stream = new FileOutputStream(tmpFile); + wbs.write(stream); + stream.close(); + + + } -} +} \ No newline at end of file diff --git a/util/src/main/java/com/ccsens/util/WebConstant.java b/util/src/main/java/com/ccsens/util/WebConstant.java index f4893d02..219c128c 100644 --- a/util/src/main/java/com/ccsens/util/WebConstant.java +++ b/util/src/main/java/com/ccsens/util/WebConstant.java @@ -6,7 +6,8 @@ import java.io.File; public class WebConstant { - + /**cell内容不赋值*/ + public static final String CELL_NULL = "cell_null"; /**数据存在*/ public static final byte STATUS_EXIT = 0; /**数据已删除*/ From 7ade4958f5ab9ed68dd3d242314ff2fe5af3c0e2 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Thu, 6 May 2021 10:03:30 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E6=8A=A5=E5=91=8A=E5=8D=95=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccsens/ht/bean/vo/PatientReportVo.java | 43 ++++++++++++++++--- .../ht/service/PatientReportService.java | 35 +++++++++++++-- .../ccsens/ht/service/QuestionService.java | 2 +- .../java/com/ccsens/ht/uitl/Constant.java | 5 ++- pom.xml | 2 +- .../main/java/com/ccsens/util/PdfUtil.java | 10 ++--- 6 files changed, 78 insertions(+), 19 deletions(-) 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 bbf1809a..a3443747 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 @@ -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 rows) { List 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 rows) { + fillMocaScore(rows); + } + + + + private void fillSingleMoca(List 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 rows) { int firstIndex = 5; PdfUtil.Row row1 = new PdfUtil.Row(); PdfUtil.Cell cell = new PdfUtil.Cell(); 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 3371e9ca..077f7b88 100644 --- a/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java +++ b/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 queryAllReports(PatientReportDto.AdminQueryReport adminQueryReport, Long userId) { PageHelper.startPage(adminQueryReport.getPageNum(), adminQueryReport.getPageSize()); + + + List scores = adminQueryReport.getScores(); + if (CollectionUtil.isNotEmpty(scores)) { + Iterator iterator = scores.iterator(); + while (iterator.hasNext()) { + PatientReportDto.Score next = iterator.next(); + if (next.getStart() == null && next.getEnd() == null) { + iterator.remove(); + } + } + } + List 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 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); diff --git a/ht/src/main/java/com/ccsens/ht/service/QuestionService.java b/ht/src/main/java/com/ccsens/ht/service/QuestionService.java index 74634834..0cd99494 100644 --- a/ht/src/main/java/com/ccsens/ht/service/QuestionService.java +++ b/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))); } } diff --git a/ht/src/main/java/com/ccsens/ht/uitl/Constant.java b/ht/src/main/java/com/ccsens/ht/uitl/Constant.java index a1aefe86..ad9ef63a 100644 --- a/ht/src/main/java/com/ccsens/ht/uitl/Constant.java +++ b/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 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{ diff --git a/pom.xml b/pom.xml index ca3bc12a..dc69693d 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ util - health + question diff --git a/util/src/main/java/com/ccsens/util/PdfUtil.java b/util/src/main/java/com/ccsens/util/PdfUtil.java index 2eac4228..9b0b827e 100644 --- a/util/src/main/java/com/ccsens/util/PdfUtil.java +++ b/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; } From 223b39cef7f574a2f82a7bf63db1e9a72cc52f5b Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Fri, 7 May 2021 09:56:21 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E6=8A=A5=E5=91=8A=E5=8D=95=E5=88=86?= =?UTF-8?q?=E6=9E=90=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccsens/ht/bean/dto/PatientReportDto.java | 4 +- .../ht/service/PatientReportService.java | 182 +++++++++++++++++- ht/src/main/resources/application.yml | 4 +- .../mapper_dao/HtPatientReportDao.xml | 74 ++++--- 4 files changed, 221 insertions(+), 43 deletions(-) diff --git a/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java b/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java index dd2fa278..2afe78cd 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java +++ b/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java @@ -178,9 +178,9 @@ public class PatientReportDto { @ApiModelProperty("量表类型") private String code; @ApiModelProperty("开始") - private Integer start; + private Double start; @ApiModelProperty("结束") - private Integer end; + private Double end; } @ApiModel("临床诊断统计请求") 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 077f7b88..23bdf02e 100644 --- a/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java +++ b/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java @@ -8,13 +8,12 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.ccsens.ht.bean.dto.PatientReportDto; import com.ccsens.ht.bean.dto.PatientReportSearchDto; +import com.ccsens.ht.bean.dto.QuestionDto; import com.ccsens.ht.bean.po.*; import com.ccsens.ht.bean.vo.PatientReportSearchVo; import com.ccsens.ht.bean.vo.PatientReportVo; -import com.ccsens.ht.persist.dao.HtDoctorDao; -import com.ccsens.ht.persist.dao.HtPatientReportDao; -import com.ccsens.ht.persist.dao.HtPositionDao; -import com.ccsens.ht.persist.dao.HtReportDao; +import com.ccsens.ht.bean.vo.QuestionVo; +import com.ccsens.ht.persist.dao.*; import com.ccsens.ht.persist.mapper.HtPatientFollowUpMapper; import com.ccsens.ht.persist.mapper.HtPatientMapper; import com.ccsens.ht.persist.mapper.HtPatientReportRecordMapper; @@ -66,6 +65,12 @@ public class PatientReportService implements IPatientReportService { private HtPatientFollowUpMapper htPatientFollowUpMapper; @Resource private HtReportDao htReportDao; + @Resource + private RedisUtil redisUtil; + @Resource + private HtQuestionDao htQuestionDao; + @Resource + private IQuestionService questionService; @Override public JsonResponse generatePatientReport(PatientReportDto.Generate generate, Long userId) { @@ -670,7 +675,7 @@ public class PatientReportService implements IPatientReportService { List analyses = htPatientReportDao.queryReportAnalyseScore(ids); - int total = 38; + int total = 124; List> rows = new ArrayList<>(); // 标题 表头 initAnalyseTitle(rows, total); @@ -680,6 +685,7 @@ public class PatientReportService implements IPatientReportService { PoiUtil.exportWB("报告单详情", rows, workbook); return workbook; } + // 填充数据 for (int i = 0; i < analyses.size(); i++) { @@ -699,6 +705,26 @@ public class PatientReportService implements IPatientReportService { return workbook; } + + private Long getQuestionId(String code, int sort) { + String key = "ht_question_" + code + "_" + sort; + Object value = redisUtil.get(key); + + if (value != null) { + return (Long) value; + } + HtQuestionExample questionExample = new HtQuestionExample(); + questionExample.createCriteria().andParentCodeEqualTo(code).andSortEqualTo(sort); + List htQuestions = htQuestionDao.selectByExample(questionExample); + if (CollectionUtil.isEmpty(htQuestions)) { + return null; + } + Long id = htQuestions.get(0).getId(); + redisUtil.set(key, id); + return id; + } + + /** * 填充导出分析 * @param row 表格 @@ -713,6 +739,7 @@ public class PatientReportService implements IPatientReportService { row.get(6).setValue(Constant.Ht.getCareer(analyse.getCareer())); row.get(7).setValue(analyse.getClinicalDiagnosis()); row.get(8).setValue(Constant.Ht.getPasi(analyse.getPasi())); + // MMSE分数 if (CollectionUtil.isNotEmpty(analyse.getMmseScores())) { analyse.getMmseScores().forEach(score->{ switch (score.getCode()) { @@ -750,7 +777,7 @@ public class PatientReportService implements IPatientReportService { } } } - + // 报告单一总成绩 if (CollectionUtil.isNotEmpty(analyse.getTotalScores())) { analyse.getTotalScores().forEach(totalScore -> { switch (totalScore.getEvaluationCode()) { @@ -763,6 +790,73 @@ public class PatientReportService implements IPatientReportService { } }); } + // 画钟 + // 画钟题目ID + Long hzId = getQuestionId("HZ", 3); + QuestionDto.QueryPatientCanvas hzQuery = new QuestionDto.QueryPatientCanvas(); + hzQuery.setPatientReportId(analyse.getId()); + hzQuery.setQuestionId(hzId); + List patientCanvas = questionService.getCanvas(hzQuery, null); + if (CollectionUtil.isNotEmpty(patientCanvas)) { + QuestionVo.Parameter parameters = patientCanvas.get(0).getParameters(); + // 完成总时间 + row.get(38).setValue(parameters.getTotalDuration() + "ms"); + row.get(39).setValue(parameters.getPaintTime() + "ms"); + row.get(40).setValue(parameters.getReflectOnTime() + "ms"); + row.get(44).setValue(String.valueOf(parameters.getLineParameterList().size())); + row.get(45).setValue(String.valueOf(parameters.getAveTimes())); + row.get(46).setValue(pxToMm(parameters.getAveLength()) + "mm"); + row.get(47).setValue(pxToMm(parameters.getLongLine()) + "mm"); + row.get(51).setValue(pxToMm(parameters.getLongSpeed()) + "mm/s"); + row.get(52).setValue(pxToSquare(parameters.getMinCircleAcreage().doubleValue()) + "mm²"); + row.get(53).setValue(pxToMm(parameters.getShowCentreCoordinate().getX()) + "mm"); + row.get(54).setValue(pxToMm(parameters.getShowCentreCoordinate().getY()) + "mm"); + } + + Long simpleId = getQuestionId("EasyOne", 4); + initSimple(row, analyse, simpleId, 55); + + Long simpleThreeId = getQuestionId("EasyTwo", 5); + initSimple(row, analyse, simpleThreeId, 78); + Long simpleTwentyId = getQuestionId("EasyThree", 6); + initSimple(row, analyse, simpleTwentyId, 101); + } + + public String pxToMm(double length) { + return new BigDecimal(144).multiply(new BigDecimal(length)).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).toString(); + } + public String pxToSquare(double length) { + return new BigDecimal(144 * 144).multiply(new BigDecimal(length)).divide(new BigDecimal(100 * 100)).setScale(2, BigDecimal.ROUND_HALF_UP).toString(); + } + + private void initSimple(List row, PatientReportVo.Analyse analyse, Long simpleId, int startIndex) { + QuestionDto.QueryPatientCanvas simpleQuery = new QuestionDto.QueryPatientCanvas(); + simpleQuery.setPatientReportId(analyse.getId()); + simpleQuery.setQuestionId(simpleId); + List simpleCanvas = questionService.getCanvas(simpleQuery, null); + if (CollectionUtil.isNotEmpty(simpleCanvas)) { + QuestionVo.Parameter parameters = simpleCanvas.get(0).getParameters(); + // 完成总时间 + row.get(startIndex).setValue(parameters.getTotalDuration() + "ms"); + row.get(startIndex + 1).setValue(parameters.getPaintTime() + "ms"); + row.get(startIndex + 2).setValue(parameters.getReflectOnTime() + "ms"); + row.get(startIndex + 3).setValue(String.valueOf(parameters.getLineParameterList().size())); + row.get(startIndex + 4).setValue(parameters.getAveTimes() + "ms"); + row.get(startIndex + 5).setValue(pxToMm(parameters.getAveLength()) + "mm"); + row.get(startIndex + 6).setValue(pxToMm(parameters.getLongLine()) + "mm"); + row.get(startIndex + 8).setValue(pxToMm(parameters.getLongSpeed()) + "mm/s"); + row.get(startIndex + 9).setValue(pxToSquare(parameters.getMinRectangleAcreage()) + "mm²"); + row.get(startIndex + 10).setValue(pxToMm(parameters.getShowCentreCoordinate().getX()) + "mm"); + row.get(startIndex + 11).setValue(pxToMm(parameters.getShowCentreCoordinate().getY()) + "mm"); + row.get(startIndex + 12).setValue(pxToMm(parameters.getRight().getX()) + "mm"); + row.get(startIndex + 13).setValue(pxToMm(parameters.getRight().getY()) + "mm"); + row.get(startIndex + 15).setValue(String.valueOf(parameters.getLongNums())); + row.get(startIndex + 16).setValue(String.valueOf(parameters.getShortNums())); + row.get(startIndex + 17).setValue(parameters.getTransitionTime() + "ms"); + row.get(startIndex + 18).setValue(parameters.getFiveLongLinesTime() + "ms"); + row.get(startIndex + 19).setValue(parameters.getLongLineRate() + "%"); + + } } private void initAnalyseTitle(List> rows, int total) { @@ -790,9 +884,27 @@ public class PatientReportService implements IPatientReportService { oneTitleRow.add(new PoiUtil.PoiUtilCell("",1,1)); } oneTitleRow.add(new PoiUtil.PoiUtilCell("其他量表",4,1)); - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 3; i++) { oneTitleRow.add(new PoiUtil.PoiUtilCell("",1,1)); } + oneTitleRow.add(new PoiUtil.PoiUtilCell("画钟",17,1)); + for (int i = 0; i < 16; i++) { + oneTitleRow.add(new PoiUtil.PoiUtilCell("",1,1)); + } + oneTitleRow.add(new PoiUtil.PoiUtilCell("简单图形测验",23,1)); + for (int i = 0; i < 22; i++) { + oneTitleRow.add(new PoiUtil.PoiUtilCell("",1,1)); + } + oneTitleRow.add(new PoiUtil.PoiUtilCell("3min回忆",23,1)); + for (int i = 0; i < 22; i++) { + oneTitleRow.add(new PoiUtil.PoiUtilCell("",1,1)); + } + oneTitleRow.add(new PoiUtil.PoiUtilCell("20min延迟回忆",23,1)); + for (int i = 0; i < 22; i++) { + oneTitleRow.add(new PoiUtil.PoiUtilCell("",1,1)); + } + + rows.add(oneTitleRow); List titleRow = new ArrayList<>(); @@ -844,9 +956,65 @@ public class PatientReportService implements IPatientReportService { titleRow.add(new PoiUtil.PoiUtilCell("HAMA总分")); titleRow.add(new PoiUtil.PoiUtilCell("HAMD总分")); titleRow.add(new PoiUtil.PoiUtilCell("NPI总分")); + + // 画钟 + //38 + titleRow.add(new PoiUtil.PoiUtilCell("完成总时间")); + titleRow.add(new PoiUtil.PoiUtilCell("落笔时间")); + titleRow.add(new PoiUtil.PoiUtilCell("思考时间")); + // 41-42 空字符 + titleRow.add(new PoiUtil.PoiUtilCell("钟面后延迟时间")); + titleRow.add(new PoiUtil.PoiUtilCell("第一指针延迟时间")); + titleRow.add(new PoiUtil.PoiUtilCell("第二指针延迟时间")); + + titleRow.add(new PoiUtil.PoiUtilCell("总笔画数")); + titleRow.add(new PoiUtil.PoiUtilCell("每分钟笔画数")); + titleRow.add(new PoiUtil.PoiUtilCell("平均长度")); + titleRow.add(new PoiUtil.PoiUtilCell("最长笔画长度")); + // 48 49 空字符串 + titleRow.add(new PoiUtil.PoiUtilCell("时针长度")); + titleRow.add(new PoiUtil.PoiUtilCell("分针长度")); + + titleRow.add(new PoiUtil.PoiUtilCell("平均速度")); + titleRow.add(new PoiUtil.PoiUtilCell("最长笔画速度")); + titleRow.add(new PoiUtil.PoiUtilCell("最小外接圆面积")); + titleRow.add(new PoiUtil.PoiUtilCell("图形中心水平位置")); + titleRow.add(new PoiUtil.PoiUtilCell("图形中心垂直位置")); + + // 简单图形测验 + // 55 + fillSimplePicture(titleRow); + fillSimplePicture(titleRow); + fillSimplePicture(titleRow); rows.add(titleRow); } + private void fillSimplePicture(List titleRow) { + titleRow.add(new PoiUtil.PoiUtilCell("完成总时间")); + titleRow.add(new PoiUtil.PoiUtilCell("落笔时间")); + titleRow.add(new PoiUtil.PoiUtilCell("思考时间")); + titleRow.add(new PoiUtil.PoiUtilCell("总笔画数")); + titleRow.add(new PoiUtil.PoiUtilCell("每分钟笔画数")); + titleRow.add(new PoiUtil.PoiUtilCell("平均长度")); + titleRow.add(new PoiUtil.PoiUtilCell("最长笔画长度")); + titleRow.add(new PoiUtil.PoiUtilCell("平均速度")); + titleRow.add(new PoiUtil.PoiUtilCell("最长笔画速度")); + titleRow.add(new PoiUtil.PoiUtilCell("最小外接长方形面积")); + titleRow.add(new PoiUtil.PoiUtilCell("图形中心水平位置")); + titleRow.add(new PoiUtil.PoiUtilCell("图形中心垂直位置")); + titleRow.add(new PoiUtil.PoiUtilCell("图形顶边距离绘图区域中心的距离")); + titleRow.add(new PoiUtil.PoiUtilCell("图形底边距离绘图区域中心的距离")); + titleRow.add(new PoiUtil.PoiUtilCell("每条笔画的长度")); + titleRow.add(new PoiUtil.PoiUtilCell("长笔画数量")); + titleRow.add(new PoiUtil.PoiUtilCell("短笔画数量")); + titleRow.add(new PoiUtil.PoiUtilCell("所有短长笔画序列的过渡时间")); + titleRow.add(new PoiUtil.PoiUtilCell("5个早期长笔画的经过时间")); + titleRow.add(new PoiUtil.PoiUtilCell("前5笔长笔画率")); + titleRow.add(new PoiUtil.PoiUtilCell("相似系数")); + titleRow.add(new PoiUtil.PoiUtilCell("图形重心水平位置")); + titleRow.add(new PoiUtil.PoiUtilCell("图形重心垂直位置")); + } + private List getReportScores(PatientReportDto.ExportCode param, List content, List reportScores, PatientReportVo.ReprotPatient reportPatient) { long reportId = param.getId(); //重新封装报告单信息 diff --git a/ht/src/main/resources/application.yml b/ht/src/main/resources/application.yml index 5889ff7f..d082c0ea 100644 --- a/ht/src/main/resources/application.yml +++ b/ht/src/main/resources/application.yml @@ -1,4 +1,4 @@ spring: profiles: - active: test - include: common, util-test \ No newline at end of file + active: prod + include: common, util-prod \ No newline at end of file diff --git a/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml b/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml index ed13cc55..a07db687 100644 --- a/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml +++ b/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml @@ -143,9 +143,33 @@ order by create_time desc + \ No newline at end of file From 396094f4bf99d3d685a1e544688b17a8b319cc50 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Tue, 11 May 2021 18:41:12 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=A1=B6=E9=83=A8+?= =?UTF-8?q?=E6=82=A3=E8=80=85=E5=90=8D=E5=AD=97=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java | 2 ++ .../main/java/com/ccsens/ht/service/PatientReportService.java | 4 ++-- ht/src/main/resources/application.yml | 4 ++-- ht/src/main/resources/mapper_dao/HtPatientReportDao.xml | 3 +++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java b/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java index 2afe78cd..3a55f747 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java +++ b/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java @@ -141,6 +141,8 @@ public class PatientReportDto { @ApiModel("查询报告单") @Data public static class AdminQueryReport { + @ApiModelProperty("病人名字") + private String patientName; @ApiModelProperty("病人年龄-开始") private Byte startAge; @ApiModelProperty("病人年龄-结束") 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 025114b6..a90a442c 100644 --- a/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java +++ b/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java @@ -658,8 +658,8 @@ public class PatientReportService implements IPatientReportService { String subHead = CollectionUtil.isEmpty(reportScores) ? "" : reportScores.get(0).getName() + "(" + reportScores.get(0).getCode() + ")报告单"; PdfUtil.Margin margin = new PdfUtil.Margin(); - margin.setTop(12); - margin.setBottom(12); + margin.setTop(24); + margin.setBottom(24); margin.setLeft(64); margin.setRight(64); String[] split = reportPatient.getHospital().split(""); diff --git a/ht/src/main/resources/application.yml b/ht/src/main/resources/application.yml index 5889ff7f..d082c0ea 100644 --- a/ht/src/main/resources/application.yml +++ b/ht/src/main/resources/application.yml @@ -1,4 +1,4 @@ spring: profiles: - active: test - include: common, util-test \ No newline at end of file + active: prod + include: common, util-prod \ No newline at end of file diff --git a/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml b/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml index 375f239f..7512ff02 100644 --- a/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml +++ b/ht/src/main/resources/mapper_dao/HtPatientReportDao.xml @@ -170,6 +170,9 @@ AND report.type = 2 AND s.type IN ( 0, 2 ) + + and p.name = #{patientName} + and p.sex = #{patientSex}