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 59a88088..46f96bf5 100644 --- a/ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java +++ b/ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java @@ -5,6 +5,7 @@ import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.ht.annotation.DoctorAudit; import com.ccsens.ht.bean.dto.PatientReportDto; import com.ccsens.ht.bean.vo.PatientReportVo; +import com.ccsens.ht.service.IExportService; import com.ccsens.ht.service.IPatientReportService; import com.ccsens.util.JsonResponse; import com.ccsens.util.bean.dto.QueryDto; @@ -17,7 +18,6 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.List; @@ -32,6 +32,8 @@ import java.util.List; public class PatientReportExportController { @Resource private IPatientReportService patientReportService; + @Resource + private IExportService exportService; @MustLogin @DoctorAudit @@ -50,6 +52,24 @@ public class PatientReportExportController { return JsonResponse.newInstance().ok(export); } + @MustLogin + @DoctorAudit + @ApiOperation(value = "根据类型导出报告单",notes = "导出报告单") + @ApiImplicitParams({ + @ApiImplicitParam(name = "json", value = "导出报告单", required = true) + }) + @RequestMapping(value="/exportReportByCode", method = RequestMethod.POST) + public JsonResponse exportReportByCode(@RequestBody @ApiParam @Valid QueryDto param){ + //查询报告单信息 + log.info("根据类型导出报告单:{}", param); + String path = exportService.exportReport(param.getParam(), param.getUserId()); + log.info("文件路径:{}", path); + PatientReportVo.Export export = new PatientReportVo.Export(); + export.setPath(path); + return JsonResponse.newInstance().ok(export); + } + + @MustLogin @DoctorAudit @ApiOperation(value = "导出指定量表",notes = "导出指定量表") 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 3a55f747..e129407c 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 @@ -39,6 +39,8 @@ public class PatientReportDto { @ApiModelProperty("初步印象") @NotNull(message="初步印象不能为空") private String initialImpression; + @ApiModelProperty("受试者合作评分") + private Integer workingScore; @ApiModelProperty("临床诊断") @NotNull(message = "临床诊断不能为空") private String clinicalDiagnosis; @@ -53,6 +55,8 @@ public class PatientReportDto { @ApiModelProperty("病人报告单ID") @NotNull(message = "报告单ID不允许为空") private Long id; + @ApiModelProperty("报告单类型") + private String report = "REPORT1.0"; public HtPatientReport copy(){ HtPatientReport report = new HtPatientReport(); diff --git a/ht/src/main/java/com/ccsens/ht/bean/po/HtReportRelevance.java b/ht/src/main/java/com/ccsens/ht/bean/po/HtReportRelevance.java new file mode 100644 index 00000000..8becc6b4 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/bean/po/HtReportRelevance.java @@ -0,0 +1,117 @@ +package com.ccsens.ht.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class HtReportRelevance implements Serializable { + private Long id; + + private String reportCode; + + private Long reportId; + + private String impression; + + private Integer socre; + + private String pdfUrl; + + private Date createTime; + + private Date updateTime; + + private Byte isDel; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getReportCode() { + return reportCode; + } + + public void setReportCode(String reportCode) { + this.reportCode = reportCode == null ? null : reportCode.trim(); + } + + public Long getReportId() { + return reportId; + } + + public void setReportId(Long reportId) { + this.reportId = reportId; + } + + public String getImpression() { + return impression; + } + + public void setImpression(String impression) { + this.impression = impression == null ? null : impression.trim(); + } + + public Integer getSocre() { + return socre; + } + + public void setSocre(Integer socre) { + this.socre = socre; + } + + public String getPdfUrl() { + return pdfUrl; + } + + public void setPdfUrl(String pdfUrl) { + this.pdfUrl = pdfUrl == null ? null : pdfUrl.trim(); + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Byte getIsDel() { + return isDel; + } + + public void setIsDel(Byte isDel) { + this.isDel = isDel; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", reportCode=").append(reportCode); + sb.append(", reportId=").append(reportId); + sb.append(", impression=").append(impression); + sb.append(", socre=").append(socre); + sb.append(", pdfUrl=").append(pdfUrl); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", isDel=").append(isDel); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/ht/src/main/java/com/ccsens/ht/bean/po/HtReportRelevanceExample.java b/ht/src/main/java/com/ccsens/ht/bean/po/HtReportRelevanceExample.java new file mode 100644 index 00000000..7eaef39f --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/bean/po/HtReportRelevanceExample.java @@ -0,0 +1,771 @@ +package com.ccsens.ht.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class HtReportRelevanceExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public HtReportRelevanceExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andReportCodeIsNull() { + addCriterion("report_code is null"); + return (Criteria) this; + } + + public Criteria andReportCodeIsNotNull() { + addCriterion("report_code is not null"); + return (Criteria) this; + } + + public Criteria andReportCodeEqualTo(String value) { + addCriterion("report_code =", value, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportCodeNotEqualTo(String value) { + addCriterion("report_code <>", value, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportCodeGreaterThan(String value) { + addCriterion("report_code >", value, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportCodeGreaterThanOrEqualTo(String value) { + addCriterion("report_code >=", value, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportCodeLessThan(String value) { + addCriterion("report_code <", value, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportCodeLessThanOrEqualTo(String value) { + addCriterion("report_code <=", value, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportCodeLike(String value) { + addCriterion("report_code like", value, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportCodeNotLike(String value) { + addCriterion("report_code not like", value, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportCodeIn(List values) { + addCriterion("report_code in", values, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportCodeNotIn(List values) { + addCriterion("report_code not in", values, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportCodeBetween(String value1, String value2) { + addCriterion("report_code between", value1, value2, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportCodeNotBetween(String value1, String value2) { + addCriterion("report_code not between", value1, value2, "reportCode"); + return (Criteria) this; + } + + public Criteria andReportIdIsNull() { + addCriterion("report_id is null"); + return (Criteria) this; + } + + public Criteria andReportIdIsNotNull() { + addCriterion("report_id is not null"); + return (Criteria) this; + } + + public Criteria andReportIdEqualTo(Long value) { + addCriterion("report_id =", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotEqualTo(Long value) { + addCriterion("report_id <>", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThan(Long value) { + addCriterion("report_id >", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThanOrEqualTo(Long value) { + addCriterion("report_id >=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThan(Long value) { + addCriterion("report_id <", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThanOrEqualTo(Long value) { + addCriterion("report_id <=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdIn(List values) { + addCriterion("report_id in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotIn(List values) { + addCriterion("report_id not in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdBetween(Long value1, Long value2) { + addCriterion("report_id between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotBetween(Long value1, Long value2) { + addCriterion("report_id not between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andImpressionIsNull() { + addCriterion("impression is null"); + return (Criteria) this; + } + + public Criteria andImpressionIsNotNull() { + addCriterion("impression is not null"); + return (Criteria) this; + } + + public Criteria andImpressionEqualTo(String value) { + addCriterion("impression =", value, "impression"); + return (Criteria) this; + } + + public Criteria andImpressionNotEqualTo(String value) { + addCriterion("impression <>", value, "impression"); + return (Criteria) this; + } + + public Criteria andImpressionGreaterThan(String value) { + addCriterion("impression >", value, "impression"); + return (Criteria) this; + } + + public Criteria andImpressionGreaterThanOrEqualTo(String value) { + addCriterion("impression >=", value, "impression"); + return (Criteria) this; + } + + public Criteria andImpressionLessThan(String value) { + addCriterion("impression <", value, "impression"); + return (Criteria) this; + } + + public Criteria andImpressionLessThanOrEqualTo(String value) { + addCriterion("impression <=", value, "impression"); + return (Criteria) this; + } + + public Criteria andImpressionLike(String value) { + addCriterion("impression like", value, "impression"); + return (Criteria) this; + } + + public Criteria andImpressionNotLike(String value) { + addCriterion("impression not like", value, "impression"); + return (Criteria) this; + } + + public Criteria andImpressionIn(List values) { + addCriterion("impression in", values, "impression"); + return (Criteria) this; + } + + public Criteria andImpressionNotIn(List values) { + addCriterion("impression not in", values, "impression"); + return (Criteria) this; + } + + public Criteria andImpressionBetween(String value1, String value2) { + addCriterion("impression between", value1, value2, "impression"); + return (Criteria) this; + } + + public Criteria andImpressionNotBetween(String value1, String value2) { + addCriterion("impression not between", value1, value2, "impression"); + return (Criteria) this; + } + + public Criteria andSocreIsNull() { + addCriterion("socre is null"); + return (Criteria) this; + } + + public Criteria andSocreIsNotNull() { + addCriterion("socre is not null"); + return (Criteria) this; + } + + public Criteria andSocreEqualTo(Integer value) { + addCriterion("socre =", value, "socre"); + return (Criteria) this; + } + + public Criteria andSocreNotEqualTo(Integer value) { + addCriterion("socre <>", value, "socre"); + return (Criteria) this; + } + + public Criteria andSocreGreaterThan(Integer value) { + addCriterion("socre >", value, "socre"); + return (Criteria) this; + } + + public Criteria andSocreGreaterThanOrEqualTo(Integer value) { + addCriterion("socre >=", value, "socre"); + return (Criteria) this; + } + + public Criteria andSocreLessThan(Integer value) { + addCriterion("socre <", value, "socre"); + return (Criteria) this; + } + + public Criteria andSocreLessThanOrEqualTo(Integer value) { + addCriterion("socre <=", value, "socre"); + return (Criteria) this; + } + + public Criteria andSocreIn(List values) { + addCriterion("socre in", values, "socre"); + return (Criteria) this; + } + + public Criteria andSocreNotIn(List values) { + addCriterion("socre not in", values, "socre"); + return (Criteria) this; + } + + public Criteria andSocreBetween(Integer value1, Integer value2) { + addCriterion("socre between", value1, value2, "socre"); + return (Criteria) this; + } + + public Criteria andSocreNotBetween(Integer value1, Integer value2) { + addCriterion("socre not between", value1, value2, "socre"); + return (Criteria) this; + } + + public Criteria andPdfUrlIsNull() { + addCriterion("pdf_url is null"); + return (Criteria) this; + } + + public Criteria andPdfUrlIsNotNull() { + addCriterion("pdf_url is not null"); + return (Criteria) this; + } + + public Criteria andPdfUrlEqualTo(String value) { + addCriterion("pdf_url =", value, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andPdfUrlNotEqualTo(String value) { + addCriterion("pdf_url <>", value, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andPdfUrlGreaterThan(String value) { + addCriterion("pdf_url >", value, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andPdfUrlGreaterThanOrEqualTo(String value) { + addCriterion("pdf_url >=", value, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andPdfUrlLessThan(String value) { + addCriterion("pdf_url <", value, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andPdfUrlLessThanOrEqualTo(String value) { + addCriterion("pdf_url <=", value, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andPdfUrlLike(String value) { + addCriterion("pdf_url like", value, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andPdfUrlNotLike(String value) { + addCriterion("pdf_url not like", value, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andPdfUrlIn(List values) { + addCriterion("pdf_url in", values, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andPdfUrlNotIn(List values) { + addCriterion("pdf_url not in", values, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andPdfUrlBetween(String value1, String value2) { + addCriterion("pdf_url between", value1, value2, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andPdfUrlNotBetween(String value1, String value2) { + addCriterion("pdf_url not between", value1, value2, "pdfUrl"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andIsDelIsNull() { + addCriterion("is_del is null"); + return (Criteria) this; + } + + public Criteria andIsDelIsNotNull() { + addCriterion("is_del is not null"); + return (Criteria) this; + } + + public Criteria andIsDelEqualTo(Byte value) { + addCriterion("is_del =", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelNotEqualTo(Byte value) { + addCriterion("is_del <>", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelGreaterThan(Byte value) { + addCriterion("is_del >", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelGreaterThanOrEqualTo(Byte value) { + addCriterion("is_del >=", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelLessThan(Byte value) { + addCriterion("is_del <", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelLessThanOrEqualTo(Byte value) { + addCriterion("is_del <=", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelIn(List values) { + addCriterion("is_del in", values, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelNotIn(List values) { + addCriterion("is_del not in", values, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelBetween(Byte value1, Byte value2) { + addCriterion("is_del between", value1, value2, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelNotBetween(Byte value1, Byte value2) { + addCriterion("is_del not between", value1, value2, "isDel"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file 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 a3443747..15633ee7 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 @@ -93,8 +93,6 @@ public class PatientReportVo { private String doctorName; @ApiModelProperty("编号") private String serialNumber; - @ApiModelProperty("初步印象") - private String initialImpression; @ApiModelProperty("临床诊断") private String clinicalDiagnosis; @ApiModelProperty("严重程度(0:未评测 1:轻度 2:中度 3:重度) ") @@ -127,12 +125,16 @@ public class PatientReportVo { private Byte career; @ApiModelProperty("医院") private String hospital; + @ApiModelProperty("受试者合作评分") + private int workingScore; + @ApiModelProperty("初步印象") + private String initialImpression; public List toPdfRow(){ List rows = getInitRows(); //第四栏 rows.add( - fillRow( + fillRowCosColSpan(3, "临床诊断:" + this.clinicalDiagnosis, "","") ); @@ -217,6 +219,24 @@ public class PatientReportVo { row.addCell(cell); } + return row; + } + private PdfUtil.Row fillRowCosColSpan(int colSpan,String... params) { + colSpan = colSpan == 0 ? 1 : colSpan; + PdfUtil.Row row = new PdfUtil.Row(); + for (String param: params) { + PdfUtil.Cell cell = new PdfUtil.Cell(); + cell.setContent(param); +// cell.setBorder(0); + cell.setCenter(false); + cell.setBorderLeft(0); + cell.setBorderRight(0); + cell.setBorderTop(0); + cell.setBorderBottom(0); + cell.setColSpan(colSpan); + row.addCell(cell); + } + return row; } } diff --git a/ht/src/main/java/com/ccsens/ht/persist/mapper/HtReportRelevanceMapper.java b/ht/src/main/java/com/ccsens/ht/persist/mapper/HtReportRelevanceMapper.java new file mode 100644 index 00000000..a352c7d0 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/persist/mapper/HtReportRelevanceMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.ht.persist.mapper; + +import com.ccsens.ht.bean.po.HtReportRelevance; +import com.ccsens.ht.bean.po.HtReportRelevanceExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface HtReportRelevanceMapper { + long countByExample(HtReportRelevanceExample example); + + int deleteByExample(HtReportRelevanceExample example); + + int deleteByPrimaryKey(Long id); + + int insert(HtReportRelevance record); + + int insertSelective(HtReportRelevance record); + + List selectByExample(HtReportRelevanceExample example); + + HtReportRelevance selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") HtReportRelevance record, @Param("example") HtReportRelevanceExample example); + + int updateByExample(@Param("record") HtReportRelevance record, @Param("example") HtReportRelevanceExample example); + + int updateByPrimaryKeySelective(HtReportRelevance record); + + int updateByPrimaryKey(HtReportRelevance record); +} \ No newline at end of file diff --git a/ht/src/main/java/com/ccsens/ht/service/ExportService.java b/ht/src/main/java/com/ccsens/ht/service/ExportService.java new file mode 100644 index 00000000..653053be --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/service/ExportService.java @@ -0,0 +1,240 @@ +package com.ccsens.ht.service; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.ccsens.ht.bean.dto.PatientReportDto; +import com.ccsens.ht.bean.po.HtPatientReport; +import com.ccsens.ht.bean.po.HtReportRelevance; +import com.ccsens.ht.bean.po.HtReportRelevanceExample; +import com.ccsens.ht.bean.vo.PatientReportVo; +import com.ccsens.ht.persist.dao.HtPatientReportDao; +import com.ccsens.ht.persist.mapper.HtReportRelevanceMapper; +import com.ccsens.ht.uitl.Constant; +import com.ccsens.util.CodeEnum; +import com.ccsens.util.PdfUtil; +import com.ccsens.util.PropUtil; +import com.ccsens.util.exception.BaseException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * @author 逗 + */ +@Slf4j +@Service +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +public class ExportService implements IExportService { + @Resource + private HtPatientReportDao htPatientReportDao; + @Resource + private HtReportRelevanceMapper reportRelevanceMapper; + @Resource + private IPatientReportService patientReportService; + @Resource + private Snowflake snowflake; + + @Override + public String exportReport(PatientReportDto.QueryDetail param, Long userId) { + log.info("根据报告单类型导出报告单:{}, 操作用户:{}", param, userId); + // TODO 暂时不导出rey试题,将传入参数改为1 + param.setRey(1); + //查看是否已生成对应文件路径 + HtPatientReport report = htPatientReportDao.selectByPrimaryKey(param.getId()); + if (report == null) { + throw new BaseException(CodeEnum.REPORT_NOT_FOUND); + } + //查询报告单类型关联的信息 + HtReportRelevance reportRelevance; + HtReportRelevanceExample relevanceExample = new HtReportRelevanceExample(); + relevanceExample.createCriteria().andReportIdEqualTo(param.getId()).andReportCodeEqualTo(param.getReport()); + List reportRelevanceList = reportRelevanceMapper.selectByExample(relevanceExample); + if(CollectionUtil.isNotEmpty(reportRelevanceList)){ + reportRelevance = reportRelevanceList.get(0); + }else { + reportRelevance = new HtReportRelevance(); + reportRelevance.setId(snowflake.nextId()); + reportRelevance.setReportCode(param.getReport()); + reportRelevance.setReportId(param.getId()); + reportRelevanceMapper.insertSelective(reportRelevance); + } + //如果以前有生成的信息,直接返回 + if (StrUtil.isNotBlank(reportRelevance.getPdfUrl())) { + return report.getUrl(); + } + //查看报告单和试题分数信息 + PatientReportVo.ReprotDetail detail = patientReportService.queryReportDetail(param, userId); + if (detail == null) { + throw new BaseException(CodeEnum.REPORT_NOT_FOUND); + } + //添加受试者合作评分和初步印象 + log.info("报告单和试题信息 {}", detail); + PatientReportVo.ReprotPatient patient = detail.getPatient(); + patient.setWorkingScore(reportRelevance.getSocre()); + patient.setInitialImpression(reportRelevance.getImpression()); + //生成写入pdf数据 + List content = new ArrayList<>(); + switch (param.getReport()){ + case Constant.Ht.Report.PARENT_CODE_2: + case Constant.Ht.Report.PARENT_CODE_3: + writeParentCode2(content,detail.getScores()); + //添加初步印象和受试者合作评分 + addScoreAndImpression(detail, content); + //添加测评员和报告日期 + initLast(content, 2); + break; + default: + detail.getScores().forEach(reportScore -> content.addAll(reportScore.toRow())); + 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); + initImplCell.setHeight(PdfUtil.Cell.defaultHeight * 2); + initImplCell.setBorderRight(1); + initImplCell.setCenter(false); + content.add(row); + //添加测评员和报告日期 + initLast(content, 4); + break; + } + + //表头 + String[] split = detail.getPatient().getHospital().split(""); + String title = String.join(" ", split); + + //生成pdf并返回路径 + String path = PropUtil.imgDomain + "/" + PdfUtil.createPdf(PropUtil.path, title, Constant.Ht.Report.PARENT_NAME, new PdfUtil.Margin(), detail.getPatient().toPdfRow(), content); + //TODO 将路径存入报告单关联信息表 +// reportRelevance.setPdfUrl(path); +// reportRelevanceMapper.updateByPrimaryKeySelective(reportRelevance); + log.info("生成文件路径:{}", path); + return path; + } + + private void addScoreAndImpression(PatientReportVo.ReprotDetail detail, List content) { + PdfUtil.Row workingScore = new PdfUtil.Row(); + workingScore.addCell(new PdfUtil.Cell("受试者合作评分",1,1)); + String a = "A 感兴趣、配合关心结果;\n"; + String b = "B 表现出感兴趣和合作,出于对医生的友好;\n"; + String c = "C 顺从、不感兴趣;\n"; + String d = "D 不满、需多次要求配合,拒绝部分检查;\n"; + String e = "E 不配合或拒绝"; + String s = ""; + switch (detail.getPatient().getWorkingScore()){ + case 0: + s = "√ " + a + " " + b + " " + c + " " + d + " " + e; + break; + case 1: + s = " " + a + "√ " + b + " " + c + " " + d + " " + e; + break; + case 2: + s = " " + a + " " + b + "√ " + c + " " + d + " " + e; + break; + case 3: + s = " " + a + " " + b + " " + c + "√ " + d + " " + e; + break; + case 4: + s = " " + a + " " + b + " " + c + " " + d + "√ " + e; + break; + default: + s = a + b + c + d + e; + break; + } +// String s = "√ A 感兴趣、配合关心结果;\n" + +// " B 表现出感兴趣和合作,出于对医生的友好;\n" + +// " C 顺从、不感兴趣;\n" + +// " D 不满、需多次要求配合,拒绝部分检查;\n" + +// " E 不配合或拒绝"; +// workingScore.addCell(new PdfUtil.Cell(String.valueOf(detail.getPatient().getWorkingScore()),2,1,1)); + PdfUtil.Cell cell = new PdfUtil.Cell(s, 3, 1, 1); + cell.setCenter(false); + workingScore.addCell(cell); + content.add(workingScore); + PdfUtil.Row impression = new PdfUtil.Row(); + + + + impression.addCell(new PdfUtil.Cell("初步印象",1,1)); + impression.addCell(new PdfUtil.Cell(String.valueOf(detail.getPatient().getInitialImpression()),3,1,1)); + content.add(impression); + } + + private void writeParentCode2(List content, List scores) { + PdfUtil.Row title = new PdfUtil.Row(); + title.addCell(new PdfUtil.Cell("项目")); + title.addCell(new PdfUtil.Cell()); + title.addCell(new PdfUtil.Cell("得分")); + PdfUtil.Cell r = new PdfUtil.Cell(); + r.setContent("异常参考值/说明"); + r.setBorderRight(1); + title.addCell(r); + content.add(title); + scores.forEach(reportScore -> { + if(CollectionUtil.isEmpty(reportScore.getSubReport())){ + PdfUtil.Row row = new PdfUtil.Row(); + + PdfUtil.Cell cellName = new PdfUtil.Cell(); + cellName.setColSpan(2); + cellName.setContent(reportScore.getName()); + row.addCell(cellName); + PdfUtil.Cell cellScore = new PdfUtil.Cell(); + cellScore.setContent(ObjectUtil.isNotNull(reportScore.getScore()) ? reportScore.getScore().toString() : ""); + row.addCell(cellScore); + PdfUtil.Cell remark = new PdfUtil.Cell(); + remark.setContent(reportScore.getRemark()); + remark.setBorderRight(1); + row.addCell(remark); + + content.add(row); + }else { + for (int i = 0; i < reportScore.getSubReport().size(); i++) { + PatientReportVo.ReportScore score = reportScore.getSubReport().get(i); + PdfUtil.Row row = new PdfUtil.Row(); + if(i == 0){ + PdfUtil.Cell cellName = new PdfUtil.Cell(); + cellName.setRowSpan(reportScore.getSubReport().size()); + cellName.setContent(reportScore.getName()); + row.addCell(cellName); + } + row.addCell(new PdfUtil.Cell(score.getName())); + row.addCell(new PdfUtil.Cell(ObjectUtil.isNotNull(score.getScore()) ? score.getScore().toString() : "")); + PdfUtil.Cell remark = new PdfUtil.Cell(); + remark.setContent(score.getRemark()); + remark.setBorderRight(1); + row.addCell(remark); + content.add(row); + } + } + }); + } + + + + private PdfUtil.Cell addCell(PdfUtil.Row row, String content, int colSpan, int rowSpan, int... border) { + PdfUtil.Cell cell1 = new PdfUtil.Cell(); + cell1.setContent(content); + cell1.setRowSpan(rowSpan); + cell1.setColSpan(colSpan); + cell1.setBorder(border == null || border.length == 0 ? 1 : border[0]); + row.addCell(cell1); + return cell1; + } + + private void initLast(List content, int totalSpan) { + PdfUtil.Row row2 = new PdfUtil.Row(); + PdfUtil.Cell doctorCell = addCell(row2, "测评员:", totalSpan, 1, 0); + doctorCell.setBorderLeft(null); + doctorCell.setBorderBottom(null); + PdfUtil.Cell dateCell = addCell(row2, "报告日期:", totalSpan, 1, 0); + dateCell.setBorderBottom(null); + dateCell.setBorderLeft(null); + content.add(row2); + } +} diff --git a/ht/src/main/java/com/ccsens/ht/service/IExportService.java b/ht/src/main/java/com/ccsens/ht/service/IExportService.java new file mode 100644 index 00000000..ff438487 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/service/IExportService.java @@ -0,0 +1,16 @@ +package com.ccsens.ht.service; + +import com.ccsens.ht.bean.dto.PatientReportDto; + +/** + * @author 逗 + */ +public interface IExportService { + /** + * 根据报告单类型导出pdf + * @param param 报告单id和类型 + * @param userId userId + * @return 返回pdf路径 + */ + String exportReport(PatientReportDto.QueryDetail param, Long userId); +} 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 0472d2b8..b2808599 100644 --- a/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java +++ b/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java @@ -628,9 +628,9 @@ public class PatientReportService implements IPatientReportService { questionTable.add(row); PdfUtil.Row tempRow = new PdfUtil.Row(); - PdfUtil.Cell cell = addCell(tempRow, "仅供临床医生参考。", scoreSpan + questionSpan + 1, 1); - tempRow.addCell(cell); - questionTable.add(tempRow); +// PdfUtil.Cell cell = addCell(tempRow, "仅供临床医生参考。", scoreSpan + questionSpan + 1, 1); +// tempRow.addCell(cell); +// questionTable.add(tempRow); initLast(questionTable, scoreSpan + questionSpan + 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 90076545..a83a2f8b 100644 --- a/ht/src/main/java/com/ccsens/ht/uitl/Constant.java +++ b/ht/src/main/java/com/ccsens/ht/uitl/Constant.java @@ -266,6 +266,8 @@ public class Constant { public static class Report{ public final static String PARENT_CODE = "REPORT1.0"; + public final static String PARENT_CODE_2 = "REPORT1.1"; + public final static String PARENT_CODE_3 = "REPORT1.2"; public final static String PARENT_NAME = "认知功能神经心理量表检查报告单"; public final static byte TYPE_EVALUATION = 2; public final static String IGNORE_SCORE = "[个]"; diff --git a/ht/src/main/resources/application.yml b/ht/src/main/resources/application.yml index b9b264a7..4ecd13fd 100644 --- a/ht/src/main/resources/application.yml +++ b/ht/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: prod - include: common, util-prod + active: dev + include: common, util-dev diff --git a/ht/src/main/resources/mapper_raw/HtReportRelevanceMapper.xml b/ht/src/main/resources/mapper_raw/HtReportRelevanceMapper.xml new file mode 100644 index 00000000..1d947ddc --- /dev/null +++ b/ht/src/main/resources/mapper_raw/HtReportRelevanceMapper.xml @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, report_code, report_id, impression, socre, pdf_url, create_time, update_time, + is_del + + + + + delete from t_ht_report_relevance + where id = #{id,jdbcType=BIGINT} + + + delete from t_ht_report_relevance + + + + + + insert into t_ht_report_relevance (id, report_code, report_id, + impression, socre, pdf_url, + create_time, update_time, is_del + ) + values (#{id,jdbcType=BIGINT}, #{reportCode,jdbcType=VARCHAR}, #{reportId,jdbcType=BIGINT}, + #{impression,jdbcType=VARCHAR}, #{socre,jdbcType=INTEGER}, #{pdfUrl,jdbcType=VARCHAR}, + #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT} + ) + + + insert into t_ht_report_relevance + + + id, + + + report_code, + + + report_id, + + + impression, + + + socre, + + + pdf_url, + + + create_time, + + + update_time, + + + is_del, + + + + + #{id,jdbcType=BIGINT}, + + + #{reportCode,jdbcType=VARCHAR}, + + + #{reportId,jdbcType=BIGINT}, + + + #{impression,jdbcType=VARCHAR}, + + + #{socre,jdbcType=INTEGER}, + + + #{pdfUrl,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{isDel,jdbcType=TINYINT}, + + + + + + update t_ht_report_relevance + + + id = #{record.id,jdbcType=BIGINT}, + + + report_code = #{record.reportCode,jdbcType=VARCHAR}, + + + report_id = #{record.reportId,jdbcType=BIGINT}, + + + impression = #{record.impression,jdbcType=VARCHAR}, + + + socre = #{record.socre,jdbcType=INTEGER}, + + + pdf_url = #{record.pdfUrl,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + is_del = #{record.isDel,jdbcType=TINYINT}, + + + + + + + + update t_ht_report_relevance + set id = #{record.id,jdbcType=BIGINT}, + report_code = #{record.reportCode,jdbcType=VARCHAR}, + report_id = #{record.reportId,jdbcType=BIGINT}, + impression = #{record.impression,jdbcType=VARCHAR}, + socre = #{record.socre,jdbcType=INTEGER}, + pdf_url = #{record.pdfUrl,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + is_del = #{record.isDel,jdbcType=TINYINT} + + + + + + update t_ht_report_relevance + + + report_code = #{reportCode,jdbcType=VARCHAR}, + + + report_id = #{reportId,jdbcType=BIGINT}, + + + impression = #{impression,jdbcType=VARCHAR}, + + + socre = #{socre,jdbcType=INTEGER}, + + + pdf_url = #{pdfUrl,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + is_del = #{isDel,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_ht_report_relevance + set report_code = #{reportCode,jdbcType=VARCHAR}, + report_id = #{reportId,jdbcType=BIGINT}, + impression = #{impression,jdbcType=VARCHAR}, + socre = #{socre,jdbcType=INTEGER}, + pdf_url = #{pdfUrl,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + is_del = #{isDel,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/util/src/main/java/com/ccsens/util/PdfUtil.java b/util/src/main/java/com/ccsens/util/PdfUtil.java index 9b0b827e..abd72ab4 100644 --- a/util/src/main/java/com/ccsens/util/PdfUtil.java +++ b/util/src/main/java/com/ccsens/util/PdfUtil.java @@ -206,6 +206,17 @@ public class PdfUtil { public Cell(String content) { this.content = content; } + public Cell(String content,int colSpan,int rowSpan) { + this.content = content; + this.colSpan = colSpan == 0 ? 1 : colSpan; + this.rowSpan = rowSpan == 0 ? 1 : rowSpan; + } + public Cell(String content,int colSpan,int rowSpan,Integer borderRight) { + this.content = content; + this.colSpan = colSpan == 0 ? 1 : colSpan; + this.rowSpan = rowSpan == 0 ? 1 : rowSpan; + this.borderRight = borderRight; + } } /**