diff --git a/cloudutil/pom.xml b/cloudutil/pom.xml index dc13ee98..7042df2c 100644 --- a/cloudutil/pom.xml +++ b/cloudutil/pom.xml @@ -44,6 +44,11 @@ org.springframework.cloud spring-cloud-sleuth-zipkin + + com.alibaba + fastjson + 1.2.62 + \ No newline at end of file diff --git a/cloudutil/src/main/java/com/ccsens/cloudutil/annotation/Login.java b/cloudutil/src/main/java/com/ccsens/cloudutil/annotation/Login.java new file mode 100644 index 00000000..41f28133 --- /dev/null +++ b/cloudutil/src/main/java/com/ccsens/cloudutil/annotation/Login.java @@ -0,0 +1,14 @@ +package com.ccsens.cloudutil.annotation; + +import java.lang.annotation.*; + +/** + * 有token,则根据token获取userId, 无则不获取 + * @author: wuHuiJuan + * @create: 2019/12/26 16:39 + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface Login { +} diff --git a/ht/src/main/java/com/ccsens/ht/annotation/MustLogin.java b/cloudutil/src/main/java/com/ccsens/cloudutil/annotation/MustLogin.java similarity index 88% rename from ht/src/main/java/com/ccsens/ht/annotation/MustLogin.java rename to cloudutil/src/main/java/com/ccsens/cloudutil/annotation/MustLogin.java index d4d6230d..1ea0dc9a 100644 --- a/ht/src/main/java/com/ccsens/ht/annotation/MustLogin.java +++ b/cloudutil/src/main/java/com/ccsens/cloudutil/annotation/MustLogin.java @@ -1,4 +1,4 @@ -package com.ccsens.ht.annotation; +package com.ccsens.cloudutil.annotation; import java.lang.annotation.*; diff --git a/ht/src/main/java/com/ccsens/ht/aspect/MustLoginAspect.java b/cloudutil/src/main/java/com/ccsens/cloudutil/aspect/MustLoginAspect.java similarity index 63% rename from ht/src/main/java/com/ccsens/ht/aspect/MustLoginAspect.java rename to cloudutil/src/main/java/com/ccsens/cloudutil/aspect/MustLoginAspect.java index 1dac90cb..1b9049c5 100644 --- a/ht/src/main/java/com/ccsens/ht/aspect/MustLoginAspect.java +++ b/cloudutil/src/main/java/com/ccsens/cloudutil/aspect/MustLoginAspect.java @@ -1,18 +1,20 @@ -package com.ccsens.ht.aspect; +package com.ccsens.cloudutil.aspect; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.cloudutil.feign.TallFeignClient; -import com.ccsens.ht.bean.dto.QueryDto; import com.ccsens.util.CodeEnum; import com.ccsens.util.JsonResponse; import com.ccsens.util.WebConstant; -import com.ccsens.util.exception.BaseException; +import com.ccsens.util.bean.dto.QueryDto; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.Signature; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @@ -20,6 +22,7 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; /** * @description: @@ -34,7 +37,7 @@ public class MustLoginAspect { @Autowired private TallFeignClient tallFeignClient; - @Pointcut("@annotation(com.ccsens.ht.annotation.MustLogin)") + @Pointcut("@annotation(com.ccsens.cloudutil.annotation.MustLogin) || @annotation(com.ccsens.cloudutil.annotation.Login) ") public void loginAdvice(){} @Around("loginAdvice()") @@ -47,8 +50,28 @@ public class MustLoginAspect { Object[] args = pjp.getArgs(); QueryDto dto = args == null || args.length < 1 ? null : (QueryDto) args[0]; + //获取userId JsonResponse response = tallFeignClient.getUserIdByToken(authHeader); log.info("{}获取userId:{}", authHeader, response); + + Signature signature = pjp.getSignature(); + MethodSignature methodSignature = (MethodSignature) signature; + Method targetMethod = methodSignature.getMethod(); + MustLogin mustLoginAnnotation = targetMethod.getAnnotation(MustLogin.class); + + if (mustLoginAnnotation == null) { + log.info("不是必须登录,有token,则添加userId,没有则不添加"); + if (response.getCode().intValue() == CodeEnum.SUCCESS.getCode().intValue() && response.getData() != null) { + JSONObject json = JSONObject.parseObject(JSON.toJSONString(response.getData())); + Long userId = json.getLong("id"); + if (dto != null) { + dto.setUserId(userId); + } + } + Object result = pjp.proceed(); + return result; + } + //必须登录,未登录直接返回未登录相关信息 if (response.getCode().intValue() != CodeEnum.SUCCESS.getCode().intValue()) { return response; } diff --git a/game/src/main/java/com/ccsens/game/api/ScreenController.java b/game/src/main/java/com/ccsens/game/api/ScreenController.java index 0e106bfd..2cd64c1a 100644 --- a/game/src/main/java/com/ccsens/game/api/ScreenController.java +++ b/game/src/main/java/com/ccsens/game/api/ScreenController.java @@ -36,6 +36,7 @@ public class ScreenController { @ApiOperation(value = "获取游戏基本信息", notes = "") @ApiImplicitParams({ + }) @RequestMapping(value = "information", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse getGameInfo(HttpServletRequest request, diff --git a/game/src/main/java/com/ccsens/game/bean/dto/ClientDto.java b/game/src/main/java/com/ccsens/game/bean/dto/ClientDto.java new file mode 100644 index 00000000..532dc13c --- /dev/null +++ b/game/src/main/java/com/ccsens/game/bean/dto/ClientDto.java @@ -0,0 +1,18 @@ +package com.ccsens.game.bean.dto; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * @description: + * @author: wuHuiJuan + * @create: 2019/12/26 15:03 + */ +public class ClientDto { + + @Data + @ApiModel("ClientDtoJoin") + public static class Join{ + + } +} diff --git a/game/src/main/java/com/ccsens/game/bean/vo/ClientVo.java b/game/src/main/java/com/ccsens/game/bean/vo/ClientVo.java new file mode 100644 index 00000000..839d363b --- /dev/null +++ b/game/src/main/java/com/ccsens/game/bean/vo/ClientVo.java @@ -0,0 +1,18 @@ +package com.ccsens.game.bean.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @description: + * @author: wuHuiJuan + * @create: 2019/12/26 15:01 + */ +public class ClientVo { + @Data + @ApiModel("ClientVoJoin") + public static class Join{ + + } +} diff --git a/game/src/main/java/com/ccsens/game/service/ClientService.java b/game/src/main/java/com/ccsens/game/service/ClientService.java new file mode 100644 index 00000000..a13396be --- /dev/null +++ b/game/src/main/java/com/ccsens/game/service/ClientService.java @@ -0,0 +1,9 @@ +package com.ccsens.game.service; + +/** + * @description: + * @author: wuHuiJuan + * @create: 2019/12/26 15:01 + */ +public class ClientService implements IClientService { +} diff --git a/game/src/main/java/com/ccsens/game/service/IClientService.java b/game/src/main/java/com/ccsens/game/service/IClientService.java new file mode 100644 index 00000000..5d802316 --- /dev/null +++ b/game/src/main/java/com/ccsens/game/service/IClientService.java @@ -0,0 +1,11 @@ +package com.ccsens.game.service; + +/** + * @description: + * @author: wuHuiJuan + * @create: 2019/12/26 15:00 + */ +public interface IClientService { + + +} diff --git a/ht/pom.xml b/ht/pom.xml index b382c508..121898bf 100644 --- a/ht/pom.xml +++ b/ht/pom.xml @@ -24,11 +24,7 @@ 1.0-SNAPSHOT - - com.alibaba - fastjson - 1.2.62 - + diff --git a/ht/src/main/java/com/ccsens/ht/api/DoctorController.java b/ht/src/main/java/com/ccsens/ht/api/DoctorController.java index 2f33d9d4..eb4f5c4b 100644 --- a/ht/src/main/java/com/ccsens/ht/api/DoctorController.java +++ b/ht/src/main/java/com/ccsens/ht/api/DoctorController.java @@ -1,10 +1,10 @@ package com.ccsens.ht.api; -import com.ccsens.ht.annotation.MustLogin; +import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.ht.annotation.DoctorAudit; import com.ccsens.ht.bean.dto.DoctorDto; -import com.ccsens.ht.bean.dto.QueryDto; +import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.ht.bean.vo.DoctorVo; import com.ccsens.ht.service.IDoctorService; import com.ccsens.util.CodeEnum; @@ -13,7 +13,6 @@ import com.github.pagehelper.PageInfo; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; diff --git a/ht/src/main/java/com/ccsens/ht/api/FileController.java b/ht/src/main/java/com/ccsens/ht/api/FileController.java index 1ffbaa2c..82e56af6 100644 --- a/ht/src/main/java/com/ccsens/ht/api/FileController.java +++ b/ht/src/main/java/com/ccsens/ht/api/FileController.java @@ -1,12 +1,10 @@ package com.ccsens.ht.api; import cn.hutool.core.date.DateUtil; -import com.ccsens.ht.annotation.MustLogin; +import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.ht.bean.dto.FileDto; -import com.ccsens.ht.bean.dto.QueryDto; -import com.ccsens.ht.bean.dto.QuestionDto; +import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.ht.bean.vo.FileVo; -import com.ccsens.ht.bean.vo.QuestionVo; import com.ccsens.util.Base64FileUtil; import com.ccsens.util.JsonResponse; import com.ccsens.util.PropUtil; diff --git a/ht/src/main/java/com/ccsens/ht/api/PatientController.java b/ht/src/main/java/com/ccsens/ht/api/PatientController.java index d01a3544..c9f720b5 100644 --- a/ht/src/main/java/com/ccsens/ht/api/PatientController.java +++ b/ht/src/main/java/com/ccsens/ht/api/PatientController.java @@ -2,9 +2,9 @@ package com.ccsens.ht.api; import cn.hutool.core.util.IdcardUtil; import com.ccsens.ht.annotation.DoctorAudit; -import com.ccsens.ht.annotation.MustLogin; +import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.ht.bean.dto.PatientDto; -import com.ccsens.ht.bean.dto.QueryDto; +import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.ht.bean.po.HtPatient; import com.ccsens.ht.bean.vo.PatientVo; import com.ccsens.ht.service.IPatientService; diff --git a/ht/src/main/java/com/ccsens/ht/api/PatientReportController.java b/ht/src/main/java/com/ccsens/ht/api/PatientReportController.java index 792344cd..8037e3e7 100644 --- a/ht/src/main/java/com/ccsens/ht/api/PatientReportController.java +++ b/ht/src/main/java/com/ccsens/ht/api/PatientReportController.java @@ -2,15 +2,13 @@ package com.ccsens.ht.api; import com.ccsens.ht.annotation.DoctorAudit; -import com.ccsens.ht.annotation.MustLogin; +import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.ht.bean.dto.PatientReportDto; -import com.ccsens.ht.bean.dto.QueryDto; +import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.ht.bean.vo.PatientReportVo; import com.ccsens.ht.service.IPatientReportService; import com.ccsens.util.CodeEnum; import com.ccsens.util.JsonResponse; -import com.ccsens.util.PdfUtil; -import com.ccsens.util.PropUtil; import com.github.pagehelper.PageInfo; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; @@ -21,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; +import java.io.IOException; /** * @program: ptpro @@ -112,20 +111,35 @@ public class PatientReportController { return JsonResponse.newInstance().ok(authority); } -// @ApiOperation(value = "导出报告单",notes = "导出报告单") -// @ApiImplicitParams({ -// @ApiImplicitParam(name = "json", value = "导出报告单", required = true) -// }) -// @RequestMapping(value="/exportReport", method = RequestMethod.POST) -// public JsonResponse exportReport(@RequestBody @ApiParam @Valid QueryDto param){ -// //查询报告单信息 -// log.info("查询报告单详情:{}", param); -// PatientReportVo.ReprotDetail detail = patientReportService.queryReportDetail(param.getParam(), param.getUserId()); -// if (detail == null) { -// return JsonResponse.newInstance().ok(CodeEnum.); -// } -// PdfUtil.credatePdf(PropUtil.path, detail.getPatient().getName(), detail.getPatient().toPdfRow(), ) -// log.info("查询报告单详情结果:{}", detail); -// return JsonResponse.newInstance().ok(detail); -// } + @ApiOperation(value = "导出报告单",notes = "导出报告单") + @ApiImplicitParams({ + @ApiImplicitParam(name = "json", value = "导出报告单", required = true) + }) + @RequestMapping(value="/exportReport", method = RequestMethod.POST) + public JsonResponse exportReport(@RequestBody @ApiParam @Valid QueryDto param){ + //查询报告单信息 + log.info("查询报告单详情:{}", param); + String path = patientReportService.exportReport(param.getParam(), param.getUserId()); + log.info("文件路径:{}", path); + PatientReportVo.Export export = new PatientReportVo.Export(); + export.setPath(path); + + return JsonResponse.newInstance().ok(export); + } + + @ApiOperation(value = "分享报告单",notes = "分享报告单") + @ApiImplicitParams({ + @ApiImplicitParam(name = "json", value = "分享报告单", required = true) + }) + @RequestMapping(value="/shareReport", method = RequestMethod.POST) + public JsonResponse shareReport(@RequestBody @ApiParam @Valid QueryDto param) throws IOException { + //查询报告单信息 + log.info("查询报告单详情:{}", param); + String path = patientReportService.generateQRCode(param.getParam(), param.getUserId()); + log.info("文件路径:{}", path); + PatientReportVo.Export export = new PatientReportVo.Export(); + export.setPath(path); + + return JsonResponse.newInstance().ok(export); + } } diff --git a/ht/src/main/java/com/ccsens/ht/api/PositionController.java b/ht/src/main/java/com/ccsens/ht/api/PositionController.java index 32dc310d..fca81e25 100644 --- a/ht/src/main/java/com/ccsens/ht/api/PositionController.java +++ b/ht/src/main/java/com/ccsens/ht/api/PositionController.java @@ -1,8 +1,8 @@ package com.ccsens.ht.api; -import com.ccsens.ht.annotation.MustLogin; +import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.ht.bean.dto.PositionDto; -import com.ccsens.ht.bean.dto.QueryDto; +import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.ht.bean.vo.PositionVo; import com.ccsens.ht.service.IPositionService; import com.ccsens.util.JsonResponse; diff --git a/ht/src/main/java/com/ccsens/ht/api/QuestionController.java b/ht/src/main/java/com/ccsens/ht/api/QuestionController.java index 325b30ca..91177a57 100644 --- a/ht/src/main/java/com/ccsens/ht/api/QuestionController.java +++ b/ht/src/main/java/com/ccsens/ht/api/QuestionController.java @@ -2,8 +2,8 @@ package com.ccsens.ht.api; import com.ccsens.ht.annotation.DoctorAudit; -import com.ccsens.ht.annotation.MustLogin; -import com.ccsens.ht.bean.dto.QueryDto; +import com.ccsens.cloudutil.annotation.MustLogin; +import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.ht.bean.dto.QuestionDto; import com.ccsens.ht.bean.vo.QuestionVo; import com.ccsens.ht.service.IQuestionService; diff --git a/ht/src/main/java/com/ccsens/ht/aspect/DoctorAuditAspect.java b/ht/src/main/java/com/ccsens/ht/aspect/DoctorAuditAspect.java index 9be81cea..2516e003 100644 --- a/ht/src/main/java/com/ccsens/ht/aspect/DoctorAuditAspect.java +++ b/ht/src/main/java/com/ccsens/ht/aspect/DoctorAuditAspect.java @@ -1,13 +1,12 @@ package com.ccsens.ht.aspect; -import com.ccsens.ht.bean.dto.QueryDto; +import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.ht.bean.po.HtDoctor; import com.ccsens.ht.bean.po.HtDoctorExample; import com.ccsens.ht.persist.mapper.HtDoctorMapper; import com.ccsens.ht.uitl.Constant; import com.ccsens.util.CodeEnum; import com.ccsens.util.JsonResponse; -import com.ccsens.util.exception.BaseException; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; diff --git a/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReport.java b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReport.java index 1f695493..6d4f5287 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReport.java +++ b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReport.java @@ -36,6 +36,8 @@ public class HtPatientReport implements Serializable { private String url; + private String qrCodeUrl; + private String remark; private Date createTime; @@ -174,6 +176,14 @@ public class HtPatientReport implements Serializable { this.url = url == null ? null : url.trim(); } + public String getQrCodeUrl() { + return qrCodeUrl; + } + + public void setQrCodeUrl(String qrCodeUrl) { + this.qrCodeUrl = qrCodeUrl == null ? null : qrCodeUrl.trim(); + } + public String getRemark() { return remark; } @@ -228,6 +238,7 @@ public class HtPatientReport implements Serializable { sb.append(", checkTime=").append(checkTime); sb.append(", evaluationCode=").append(evaluationCode); sb.append(", url=").append(url); + sb.append(", qrCodeUrl=").append(qrCodeUrl); sb.append(", remark=").append(remark); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); diff --git a/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReportExample.java b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReportExample.java index 43d35c50..b46be1bb 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReportExample.java +++ b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReportExample.java @@ -1155,6 +1155,76 @@ public class HtPatientReportExample { return (Criteria) this; } + public Criteria andQrCodeUrlIsNull() { + addCriterion("qr_code_url is null"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlIsNotNull() { + addCriterion("qr_code_url is not null"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlEqualTo(String value) { + addCriterion("qr_code_url =", value, "qrCodeUrl"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlNotEqualTo(String value) { + addCriterion("qr_code_url <>", value, "qrCodeUrl"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlGreaterThan(String value) { + addCriterion("qr_code_url >", value, "qrCodeUrl"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlGreaterThanOrEqualTo(String value) { + addCriterion("qr_code_url >=", value, "qrCodeUrl"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlLessThan(String value) { + addCriterion("qr_code_url <", value, "qrCodeUrl"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlLessThanOrEqualTo(String value) { + addCriterion("qr_code_url <=", value, "qrCodeUrl"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlLike(String value) { + addCriterion("qr_code_url like", value, "qrCodeUrl"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlNotLike(String value) { + addCriterion("qr_code_url not like", value, "qrCodeUrl"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlIn(List values) { + addCriterion("qr_code_url in", values, "qrCodeUrl"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlNotIn(List values) { + addCriterion("qr_code_url not in", values, "qrCodeUrl"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlBetween(String value1, String value2) { + addCriterion("qr_code_url between", value1, value2, "qrCodeUrl"); + return (Criteria) this; + } + + public Criteria andQrCodeUrlNotBetween(String value1, String value2) { + addCriterion("qr_code_url not between", value1, value2, "qrCodeUrl"); + return (Criteria) this; + } + public Criteria andRemarkIsNull() { addCriterion("remark is null"); return (Criteria) this; 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 5c88d090..a451cc00 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 @@ -7,7 +7,6 @@ import com.ccsens.util.PdfUtil; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import org.springframework.beans.factory.annotation.Autowired; import java.util.*; @@ -129,12 +128,17 @@ public class PatientReportVo { "病案号:" + this.hospitalNumber) ); //第四栏 - Date date = new Date(); - date.setTime(this.reportTime); + Date date = null; + if (this.reportTime > 0) { + date = new Date(); + date.setTime(this.reportTime); + } + rows.add( fillRow( "临床诊断:" + this.clinicalDiagnosis, - "检查日期:" + DateUtil.format(date, "yyyy-MM-dd")) + "", + "检查日期:" + (date == null ? "" : DateUtil.format(date, "yyyy-MM-dd"))) ); return rows; @@ -181,31 +185,39 @@ public class PatientReportVo { } public List toRow() { + int colNum = 8; + int headNum = 2; List rows = new ArrayList<>(); if (CollectionUtil.isEmpty(subReport)) { PdfUtil.Row row = new PdfUtil.Row(); PdfUtil.Cell cell1 = new PdfUtil.Cell(); - cell1.setContent(this.name + (StrUtil.isBlank(this.remark) ? "" : "("+this.remark+")")); + cell1.setContent(this.code + (StrUtil.isBlank(this.remark) ? "" : "("+this.remark+")")); + cell1.setColSpan(headNum); PdfUtil.Cell cell2 = new PdfUtil.Cell(); cell2.setContent(this.score == null ? "" : this.score + (this.totalScore > 0 ? "/" + this.totalScore : "")); + cell2.setColSpan(colNum - headNum); row.addCell(cell1); row.addCell(cell2); + rows.add(row); - return rows; } else { String mmse = "MMSE"; String npi = "NPI"; if (mmse.equalsIgnoreCase(this.code) || npi.equalsIgnoreCase(this.code)) { PdfUtil.Row row1 = new PdfUtil.Row(); PdfUtil.Cell cell = new PdfUtil.Cell(); - cell.setContent(this.name + (StrUtil.isBlank(this.remark) ? "" : "("+this.remark+")")); + cell.setContent(this.code + (StrUtil.isBlank(this.remark) ? "" : "("+this.remark+")")); cell.setRowSpan(2); + cell.setColSpan(npi.equalsIgnoreCase(this.code) ? headNum : 1); row1.addCell(cell); + //被合并cell PdfUtil.Row row2 = new PdfUtil.Row(); +// fillBlankCell(row2); + //子测评项 this.subReport.forEach(reportScore -> { - fillRow(row1,row2, reportScore.getName(), reportScore.score == null ? "" : reportScore.score + (reportScore.totalScore > 0 ? "/" + reportScore.totalScore : "")); + fillRow(row1,row2, reportScore.getName(), reportScore.score == null ? "" : reportScore.score + (reportScore.totalScore > 0 ? "/" + reportScore.totalScore : ""), npi.equalsIgnoreCase(this.code) ? new int[]{3,3} : null); }); - + // 总分 if (mmse.equalsIgnoreCase(this.code)) { fillRow(row1,row2, "总分", this.score == null ? "" : this.score + (this.totalScore > 0 ? "/" + this.totalScore : "")); } @@ -213,75 +225,110 @@ public class PatientReportVo { rows.add(row2); } else { //moca - int firstIndex = 6; + int firstIndex = 5; PdfUtil.Row row1 = new PdfUtil.Row(); PdfUtil.Cell cell = new PdfUtil.Cell(); cell.setContent(this.name + (StrUtil.isBlank(this.remark) ? "" : "("+this.remark+")")); cell.setRowSpan(5); row1.addCell(cell); PdfUtil.Row row2 = new PdfUtil.Row(); +// fillBlankCell(row2); for (int i = 0; i < firstIndex; i++) { ReportScore reportScore = this.subReport.get(i); String jy = "JY"; if (jy.equalsIgnoreCase(reportScore.getCode())) { - fillRow(row1, row2, reportScore.getName(), ""); + fillRow(row1, row2, reportScore.getName(), "", i == 0 ? new int[]{2,2}: null); } else { - fillRow(row1, row2, reportScore.getName(), reportScore.score == null ? "" : reportScore.score + (reportScore.totalScore > 0 ? "/" + reportScore.totalScore : "")); + fillRow(row1, row2, reportScore.getName(), reportScore.score == null ? "" : reportScore.score + (reportScore.totalScore > 0 ? "/" + reportScore.totalScore : ""), i == 0 ? new int[]{2,2}: null); } } PdfUtil.Cell scoreNameCell = new PdfUtil.Cell(); scoreNameCell.setContent("总分"); row1.addCell(scoreNameCell); PdfUtil.Cell scoreCell = new PdfUtil.Cell(); - scoreNameCell.setContent("总分"); - row1.addCell(scoreNameCell); - - - for (ReportScore score: this.subReport) { - - - - if (firstIndex == 6) { - //设置总分 - PdfUtil.Cell scoreTitleCell = new PdfUtil.Cell(); - scoreTitleCell.setContent("总分"); - row1.addCell(scoreTitleCell); - PdfUtil.Cell scoreScoreCell = new PdfUtil.Cell(); - scoreScoreCell.setContent(this.score == null ? "" : this.score + (this.totalScore > 0 ? "/" + this.totalScore : "")); - scoreScoreCell.setRowSpan(4); - row2.addCell(scoreScoreCell); - rows.add(row1); - rows.add(row2); - //换行 - row1 = new PdfUtil.Row(); - row2 = new PdfUtil.Row(); - } - firstIndex++; - } + scoreCell.setContent(this.score == null ? "" : this.score + (this.totalScore > 0 ? "/" + this.totalScore : "")); + scoreCell.setRowSpan(4); + row2.addCell(scoreCell); +// fillBlankCell(row1, row2); rows.add(row1); rows.add(row2); + //下一行 + PdfUtil.Row row3 = new PdfUtil.Row(); + PdfUtil.Row row4 = new PdfUtil.Row(); + PdfUtil.Row row5 = new PdfUtil.Row(); +// fillBlankCell(row3, row4, row5); + //延迟回忆特殊处理 + String ychy = "YCHY"; + for (int i = firstIndex; i < this.subReport.size(); i++) { + ReportScore reportScore = this.subReport.get(i); + //设置名字 + PdfUtil.Cell scoreTitleCell = new PdfUtil.Cell(); + scoreTitleCell.setContent(reportScore.getName()); + scoreTitleCell.setColSpan(ychy.equalsIgnoreCase(reportScore.getCode()) ? 2 : 1); + row3.addCell(scoreTitleCell); + //设置子类 + if (ychy.equalsIgnoreCase(reportScore.getCode())) { + for (int j = 0; j < reportScore.subReport.size(); j++) { + ReportScore subScore = reportScore.getSubReport().get(j); + PdfUtil.Cell subCell = new PdfUtil.Cell(); + subCell.setContent(subScore.name + (subScore.getScore() == null ? " " : subScore.getScore()) + subScore.getRemark()); + if (j == 0 ) { + row4.addCell(subCell); + } else { + row5.addCell(subCell); + } + } + } + PdfUtil.Cell scoreScoreCell = new PdfUtil.Cell(); + scoreScoreCell.setContent(reportScore.score == null ? "" : reportScore.score + (reportScore.totalScore > 0 ? "/" + reportScore.totalScore : "")); + scoreScoreCell.setRowSpan(2); + row4.addCell(scoreScoreCell); +// fillBlankCell(row5); + + } +// fillBlankCell(row3); +// fillBlankCell(row3, row4, row5); + rows.add(row3); + rows.add(row4); + rows.add(row5); } } - PdfUtil.Row row = new PdfUtil.Row(); + PdfUtil.Row descRow = new PdfUtil.Row(); PdfUtil.Cell cell = new PdfUtil.Cell(); + cell.setColSpan(colNum); cell.setContent(this.description); - + descRow.addCell(cell); + rows.add(descRow); return rows; } - private void fillRow(PdfUtil.Row row1, PdfUtil.Row row2, String name, String score){ + /** + * 添加一个空格 + * @param rows + */ + private void fillBlankCell(PdfUtil.Row... rows) { + for (PdfUtil.Row row: rows) { + PdfUtil.Cell cell = new PdfUtil.Cell(); + row.addCell(cell); + } + } + + private void fillRow(PdfUtil.Row row1, PdfUtil.Row row2, String name, String score, int... colspan){ //名称 PdfUtil.Cell cell1 = new PdfUtil.Cell(); cell1.setContent(name); + cell1.setColSpan(colspan == null || colspan.length == 0 ? 1 : colspan[0]); row1.addCell(cell1); + //分数 PdfUtil.Cell cell2 = new PdfUtil.Cell(); cell2.setContent(score); + cell2.setColSpan(colspan == null || colspan.length <= 1 ? 1 : colspan[1]); row2.addCell(cell2); } } diff --git a/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java b/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java index 47efe904..7153547a 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java +++ b/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java @@ -85,12 +85,26 @@ public class QuestionVo { @ApiModelProperty("试题") private Question question; @ApiModelProperty("选项") - private List