Browse Source

20210517v1.0

sd
zy_Java 4 years ago
parent
commit
8e03a7114a
  1. 2
      cloudutil/src/main/resources/application-util-prod.yml
  2. 2
      cloudutil/src/main/resources/application-util-test.yml
  3. 93
      ht/src/main/java/com/ccsens/ht/api/ImportController.java
  4. 21
      ht/src/main/java/com/ccsens/ht/api/PatientReportController.java
  5. 87
      ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java
  6. 15
      ht/src/main/java/com/ccsens/ht/api/QuestionController.java
  7. 50
      ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java
  8. 30
      ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java
  9. 117
      ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReportRecordDesc.java
  10. 761
      ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReportRecordDescExample.java
  11. 11
      ht/src/main/java/com/ccsens/ht/bean/po/HtQuestion.java
  12. 60
      ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionExample.java
  13. 117
      ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionOptionDesc.java
  14. 761
      ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionOptionDescExample.java
  15. 161
      ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionRecord.java
  16. 1021
      ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionRecordExample.java
  17. 117
      ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionRecordOption.java
  18. 771
      ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionRecordOptionExample.java
  19. 393
      ht/src/main/java/com/ccsens/ht/bean/vo/PatientReportVo.java
  20. 146
      ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java
  21. 73
      ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java
  22. 18
      ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportRecordDescDao.java
  23. 9
      ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionDao.java
  24. 26
      ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionOptionDescDao.java
  25. 16
      ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionRecordDao.java
  26. 15
      ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionRecordOptionDao.java
  27. 16
      ht/src/main/java/com/ccsens/ht/persist/dao/HtReportDao.java
  28. 30
      ht/src/main/java/com/ccsens/ht/persist/mapper/HtPatientReportRecordDescMapper.java
  29. 30
      ht/src/main/java/com/ccsens/ht/persist/mapper/HtQuestionOptionDescMapper.java
  30. 30
      ht/src/main/java/com/ccsens/ht/persist/mapper/HtQuestionRecordMapper.java
  31. 30
      ht/src/main/java/com/ccsens/ht/persist/mapper/HtQuestionRecordOptionMapper.java
  32. 15
      ht/src/main/java/com/ccsens/ht/service/IImportService.java
  33. 113
      ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java
  34. 33
      ht/src/main/java/com/ccsens/ht/service/IQuestionService.java
  35. 280
      ht/src/main/java/com/ccsens/ht/service/ImportService.java
  36. 704
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  37. 471
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java
  38. 153
      ht/src/main/java/com/ccsens/ht/uitl/Constant.java
  39. 3
      ht/src/main/resources/application-dev.yml
  40. 2
      ht/src/main/resources/application-prod.yml
  41. 34
      ht/src/main/resources/application-test.yml
  42. 3
      ht/src/main/resources/application.yml
  43. 4
      ht/src/main/resources/druid-prod.yml
  44. 207
      ht/src/main/resources/mapper_dao/HtPatientReportDao.xml
  45. 12
      ht/src/main/resources/mapper_dao/HtPatientReportRecordDescDao.xml
  46. 120
      ht/src/main/resources/mapper_dao/HtQuestionDao.xml
  47. 15
      ht/src/main/resources/mapper_dao/HtQuestionOptionDao.xml
  48. 21
      ht/src/main/resources/mapper_dao/HtQuestionOptionDescDao.xml
  49. 16
      ht/src/main/resources/mapper_dao/HtQuestionRecordDao.xml
  50. 14
      ht/src/main/resources/mapper_dao/HtQuestionRecordOptionDao.xml
  51. 64
      ht/src/main/resources/mapper_dao/HtReportDao.xml
  52. 276
      ht/src/main/resources/mapper_raw/HtPatientReportRecordDescMapper.xml
  53. 35
      ht/src/main/resources/mapper_raw/HtQuestionMapper.xml
  54. 275
      ht/src/main/resources/mapper_raw/HtQuestionOptionDescMapper.xml
  55. 338
      ht/src/main/resources/mapper_raw/HtQuestionRecordMapper.xml
  56. 276
      ht/src/main/resources/mapper_raw/HtQuestionRecordOptionMapper.xml
  57. 2
      pom.xml
  58. 14
      question/src/main/java/com/ccsens/question/api/PatientReportController.java
  59. 12
      question/src/main/java/com/ccsens/question/bean/dto/PatientReportDto.java
  60. 80
      question/src/main/java/com/ccsens/question/bean/vo/PatientReportVo.java
  61. 8
      question/src/main/java/com/ccsens/question/persist/dao/HtPatientReportDao.java
  62. 8
      question/src/main/java/com/ccsens/question/service/IPatientReportService.java
  63. 191
      question/src/main/java/com/ccsens/question/service/PatientReportService.java
  64. 2
      question/src/main/java/com/ccsens/question/uitl/Constant.java
  65. 6
      question/src/main/resources/application-green.yml
  66. 7
      question/src/main/resources/application-prod.yml
  67. 4
      question/src/main/resources/application.yml
  68. 4
      question/src/main/resources/druid-prod.yml
  69. 6
      question/src/main/resources/mapper_dao/HtPatientReportDao.xml
  70. 1
      tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java
  71. 8
      tall/src/main/resources/application-dev.yml
  72. 5
      tall/src/main/resources/application-test.yml
  73. 4
      tall/src/main/resources/application.yml
  74. 1
      tall/src/main/resources/mapper_dao/TaskDetailDao.xml
  75. 35
      util/src/main/java/com/ccsens/util/PdfUtil.java
  76. 516
      util/src/main/java/com/ccsens/util/PoiUtil.java
  77. 3
      util/src/main/java/com/ccsens/util/WebConstant.java
  78. 2
      util/src/test/java/com/ccsens/util/PdfUtilTest.java

2
cloudutil/src/main/resources/application-util-prod.yml

@ -21,7 +21,7 @@ eureka:
# 指定eureka server通信地址,注意/eureka/小尾巴不能少
#defaultZone: http://admin:admin@peer1:8761/eureka/,http://admin:admin@peer2:8762/eureka/
# defaultZone: http://admin:admin@192.144.182.42:7010/eureka/
defaultZone: http://admin:admin@81.70.54.64:7010/eureka/
defaultZone: http://admin:admin@121.36.3.207:7010/eureka/
instance:
# 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server
prefer-ip-address: true

2
cloudutil/src/main/resources/application-util-test.yml

@ -20,7 +20,7 @@ eureka:
service-url:
# 指定eureka server通信地址,注意/eureka/小尾巴不能少
#defaultZone: http://admin:admin@peer1:8761/eureka/,http://admin:admin@peer2:8762/eureka/
defaultZone: http://admin:admin@192.168.31.13:7010/eureka/
defaultZone: http://admin:admin@192.168.4.113:7010/eureka/
instance:
# 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server
prefer-ip-address: true

93
ht/src/main/java/com/ccsens/ht/api/ImportController.java

@ -1,5 +1,6 @@
package com.ccsens.ht.api;
import cn.hutool.core.collection.CollectionUtil;
import com.ccsens.ht.service.IImportService;
import com.ccsens.ht.uitl.Constant;
import com.ccsens.util.JsonResponse;
@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.Part;
import java.io.File;
import java.util.List;
/**
@ -54,19 +56,27 @@ public class ImportController {
String allowedExts = "xls,xlsx";
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator;
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir);
File execlFile = new File(dir+path);
File excelFile = new File(dir+path);
long time2 = System.currentTimeMillis();
log.info("解析文件耗时:{}", (time2 - time1));
importService.importPosition(execlFile, 0);
importService.importPosition(excelFile, 0);
long time3 = System.currentTimeMillis();
log.info("导入职务耗时:{}", (time3 - time2));
importService.importTitle(execlFile, 1);
importService.importTitle(excelFile, 1);
long time4 = System.currentTimeMillis();
log.info("导入职称耗时:{}", (time4 - time3));
importService.importReport(execlFile, 2);
List<String> codes = importService.importReport(excelFile, 2);
long time5 = System.currentTimeMillis();
log.info("导入报告单耗时:{}", (time5 - time4));
importService.importQuestion(execlFile, Constant.Ht.Question.ALL);
importService.importReportRecord(excelFile, 3);
log.info("导入报告单其他记录耗时:{}", System.currentTimeMillis() - time5);
if (CollectionUtil.isNotEmpty(codes)) {
for (String code: codes) {
importService.importQuestion(excelFile, code);
log.info("{}导入完成",code);
}
}
return JsonResponse.newInstance().ok();
}
@ -84,24 +94,45 @@ public class ImportController {
@RequestMapping(value = "/importReportType", method = RequestMethod.POST)
public JsonResponse importReportType(@RequestParam(required = true) Part file) throws Exception{
long time1 = System.currentTimeMillis();
//1.上传文件
String allowedExts = "xls,xlsx";
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator;
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir);
File execlFile = new File(dir+path);
long time2 = System.currentTimeMillis();
log.info("解析文件耗时:{}", (time2 - time1));
// importService.importPosition(execlFile, 0);
// long time3 = System.currentTimeMillis();
// log.info("导入职务耗时:{}", (time3 - time2));
// importService.importTitle(execlFile, 1);
long time4 = System.currentTimeMillis();
// log.info("导入职称耗时:{}", (time4 - time3));
importService.importReport(execlFile, 2);
long time5 = System.currentTimeMillis();
log.info("导入报告单耗时:{}", (time5 - time4));
// importService.importQuestion(execlFile, Constant.Ht.Question.ALL);
File excelFile = new File(dir+path);
importService.importReport(excelFile, 2);
return JsonResponse.newInstance().ok();
}
@ApiOperation(value = "单独导入报告单类型",notes = "文件大小不能超过20M,支持后缀:.xls|.xlsx")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "医疗项目表", required = true, paramType = "form",dataType = "__file")
})
@RequestMapping(value = "/importReportTypeRecord", method = RequestMethod.POST)
public JsonResponse importReportTypeRecord(@RequestParam(required = true) Part file) throws Exception{
//1.上传文件
String allowedExts = "xls,xlsx";
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator;
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir);
File excelFile = new File(dir+path);
importService.importReportRecord(excelFile, 3);
return JsonResponse.newInstance().ok();
}
@ApiOperation(value = "导入指定测评类型",notes = "文件大小不能超过20M,支持后缀:.xls|.xlsx")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "医疗项目表", required = true, paramType = "form",dataType = "__file"),
@ApiImplicitParam(name = "code", value = "测评类型", required = true, paramType = "form",dataType = "__file")
})
@RequestMapping(value = "/importEvaluation", method = RequestMethod.POST)
public JsonResponse importEvaluation(@RequestParam(required = true) Part file, @RequestParam(required = true) String code) throws Exception{
//1.上传文件
String allowedExts = "xls,xlsx";
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator;
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir);
File excelFile = new File(dir+path);
importService.importQuestion(excelFile, code);
log.info("导入{}",code);
return JsonResponse.newInstance().ok();
}
@ -120,14 +151,12 @@ public class ImportController {
@RequestMapping(value = "/importMoca", method = RequestMethod.POST)
public JsonResponse importMoca(@RequestParam(required = true) Part file) throws Exception{
long time1 = System.currentTimeMillis();
//1.上传文件
String allowedExts = "xls,xlsx";
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator;
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir);
File execlFile = new File(dir+path);
long time2 = System.currentTimeMillis();
importService.importQuestion(execlFile, Constant.Ht.Report.MOCA);
File excelFile = new File(dir+path);
importService.importQuestion(excelFile, Constant.Ht.Report.MOCA);
log.info("导入moca");
return JsonResponse.newInstance().ok();
}
@ -146,14 +175,12 @@ public class ImportController {
@RequestMapping(value = "/importMMSE", method = RequestMethod.POST)
public JsonResponse importMMSE(@RequestParam(required = true) Part file) throws Exception{
long time1 = System.currentTimeMillis();
//1.上传文件
String allowedExts = "xls,xlsx";
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator;
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir);
File execlFile = new File(dir+path);
long time2 = System.currentTimeMillis();
importService.importQuestion(execlFile, Constant.Ht.Report.MMSE);
File excelFile = new File(dir+path);
importService.importQuestion(excelFile, Constant.Ht.Report.MMSE);
log.info("导入mmse");
return JsonResponse.newInstance().ok();
}
@ -172,14 +199,12 @@ public class ImportController {
@RequestMapping(value = "/importRey", method = RequestMethod.POST)
public JsonResponse importRey(@RequestParam(required = true) Part file) throws Exception{
long time1 = System.currentTimeMillis();
//1.上传文件
String allowedExts = "xls,xlsx";
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator;
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir);
File execlFile = new File(dir+path);
long time2 = System.currentTimeMillis();
importService.importQuestion(execlFile, Constant.Ht.Report.REY);
File excelFile = new File(dir+path);
importService.importQuestion(excelFile, Constant.Ht.Report.REY);
log.info("导入Rey");
return JsonResponse.newInstance().ok();
}
@ -199,14 +224,12 @@ public class ImportController {
@RequestMapping(value = "/importXFXPD", method = RequestMethod.POST)
public JsonResponse importXFXPD(@RequestParam(required = true) Part file) throws Exception{
long time1 = System.currentTimeMillis();
//1.上传文件
String allowedExts = "xls,xlsx";
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator;
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir);
File execlFile = new File(dir+path);
long time2 = System.currentTimeMillis();
importService.importQuestion(execlFile, Constant.Ht.Report.XFXPD);
File excelFile = new File(dir+path);
importService.importQuestion(excelFile, Constant.Ht.Report.XFXPD);
log.info("导入XFXPD");
return JsonResponse.newInstance().ok();
}

21
ht/src/main/java/com/ccsens/ht/api/PatientReportController.java

@ -14,7 +14,6 @@ import com.ccsens.util.JsonResponse;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -143,20 +142,10 @@ 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<PatientReportVo.Export> exportReport(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.QueryDetail> 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({
@ -166,7 +155,7 @@ public class PatientReportController {
public JsonResponse<PatientReportVo.Export> shareReport(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.QueryDetail> param) throws IOException {
//查询报告单信息
log.info("查询报告单详情:{}", param);
String path = patientReportService.generateQRCode(param.getParam(), param.getUserId());
String path = patientReportService.generateQrCode(param.getParam(), param.getUserId());
log.info("文件路径:{}", path);
PatientReportVo.Export export = new PatientReportVo.Export();
export.setPath(path);

87
ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java

@ -0,0 +1,87 @@
package com.ccsens.ht.api;
import cn.hutool.core.util.CharsetUtil;
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.IPatientReportService;
import com.ccsens.util.JsonResponse;
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.*;
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;
/**
* @description:
* @author: whj
* @time: 2021/4/21 19:01
*/
@Slf4j
@Api(tags = "报告单导出",value = "报告单导出")
@RestController
public class PatientReportExportController {
@Resource
private IPatientReportService patientReportService;
@MustLogin
@DoctorAudit
@ApiOperation(value = "导出报告单",notes = "导出报告单")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "导出报告单", required = true)
})
@RequestMapping(value="/exportReport", method = RequestMethod.POST)
public JsonResponse<PatientReportVo.Export> exportReport(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.QueryDetail> 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);
}
@MustLogin
@DoctorAudit
@ApiOperation(value = "导出指定量表",notes = "导出指定量表")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "导出指定量表", required = true)
})
@RequestMapping(value="/export", method = RequestMethod.POST)
public JsonResponse<PatientReportVo.Export> export(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.ExportCode> param) {
//查询报告单信息
log.info("导出指定报告单:{}", param);
String path = patientReportService.export(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 = "导出指定id的报告单分析",notes = "导出指定id的报告单分析")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "导出指定id的报告单分析", required = true)
})
@RequestMapping(value="/exportAnalyse", method = RequestMethod.GET)
public void exportAnalyse(@RequestParam(value = "ids")@ApiParam @Valid List<Long> ids, HttpServletResponse response) throws IOException {
//查询报告单信息
log.info("导出指定报告单分析:{}", ids);
Workbook workbook = patientReportService.exportAnalyse(ids);
log.info("导出报告单分析结束");
String fileName = "报告单信息.xlsx";
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, CharsetUtil.UTF_8));
workbook.write(response.getOutputStream());
}
}

15
ht/src/main/java/com/ccsens/ht/api/QuestionController.java

@ -44,7 +44,6 @@ public class QuestionController {
@RequestMapping(value="/queryQuestion", method = RequestMethod.POST)
public JsonResponse<QuestionVo.Query> query(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.Query> queryDto){
log.info("查询试题:{}", queryDto);
QuestionVo.Query query = questionService.queryQuestion(queryDto.getParam(), queryDto.getUserId());
log.info("查询试题结果:{}", query);
return JsonResponse.newInstance().ok(query);
@ -92,6 +91,19 @@ public class QuestionController {
return JsonResponse.newInstance().ok(patientCanvas);
}
@MustLogin
@DoctorAudit
@ApiOperation(value = "保存题目的其他记录",notes = "whj:保存题目的其他记录")
@ApiImplicitParams({
})
@RequestMapping(value="/saveRecord", method = RequestMethod.POST)
public JsonResponse saveRecord(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.Record> queryDto) {
log.info("保存题目的其他记录:{}", queryDto);
questionService.saveRecord(queryDto.getParam(), queryDto.getUserId());
log.info("保存题目的其他记录成功");
return JsonResponse.newInstance().ok();
}
@MustLogin
@DoctorAudit
@ApiOperation(value = "查看用户画图信息",notes = "zy:查看画板信息画图轨迹等")
@ -117,4 +129,5 @@ public class QuestionController {
log.info("删除画图轨迹成功");
return JsonResponse.newInstance().ok();
}
}

50
ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java

@ -7,6 +7,7 @@ import lombok.Data;
import org.springframework.beans.BeanUtils;
import javax.validation.constraints.*;
import java.util.List;
/**
* @program: ptpro
@ -83,8 +84,34 @@ public class PatientReportDto {
private Long id;
@ApiModelProperty("是否需要rey 默认为0 0全部查询导出 1不导出rey 2只导出rey")
private int rey = 0;
@ApiModelProperty("报告单类型")
private String report = "REPORT1.0";
}
@ApiModel("导出指定某一种报告单")
@Data
public static class ExportCode{
@ApiModelProperty("病人报告单ID")
@NotNull(message = "病人报告单ID不能为空")
private Long id;
@ApiModelProperty("报告单类型")
private String code;
}
@ApiModel("导出报告单分析-请求")
@Data
public static class ExportSpecial{
@ApiModelProperty("报告单ID")
private Long id;
// public ExportSpecial() {
// }
//
// public ExportSpecial(Long id) {
// this.id = id;
// }
}
/**医生对报告单权限*/
@ApiModel("PatientReportDtoAuthority")
@ -114,12 +141,20 @@ public class PatientReportDto {
@ApiModel("查询报告单")
@Data
public static class AdminQueryReport {
@ApiModelProperty("病人名字")
private String patientName;
@ApiModelProperty("病人年龄-开始")
private Byte startAge;
@ApiModelProperty("病人年龄-结束")
private Byte endAge;
@ApiModelProperty("性别")
private Byte patientSex;
@ApiModelProperty("教育程度(1:文盲 2:小学 3:初中 4:高中 5:大学 6:大学以上 7:其他)")
private Byte educationalStatus;
@ApiModelProperty("受教时间-开始")
private Integer startEducationalStatusUnit;
@ApiModelProperty("受教时间-结束")
private Integer endEducationalStatusUnit;
@ApiModelProperty("临床诊断")
private String clinicalDiagnosis;
@ApiModelProperty("严重程度")
@ -128,6 +163,8 @@ public class PatientReportDto {
private Long startTime;
@ApiModelProperty("结束时间")
private Long endTime;
@ApiModelProperty("分数")
private List<Score> scores;
@ApiModelProperty("第几页")
@Min(value = 1)
private int pageNum = 1;
@ -137,6 +174,17 @@ public class PatientReportDto {
private int pageSize = 10;
}
@ApiModel("分数")
@Data
public static class Score{
@ApiModelProperty("量表类型")
private String code;
@ApiModelProperty("开始")
private Double start;
@ApiModelProperty("结束")
private Double end;
}
@ApiModel("临床诊断统计请求")
@Data
public static class ClinicalDiagnosis{

30
ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java

@ -5,8 +5,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.servlet.http.Part;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.File;
import java.math.BigDecimal;
import java.util.List;
/**
@ -75,6 +77,30 @@ public class QuestionDto {
@ApiModelProperty("超出占比")
private String beyondProportion;
}
@Data
@ApiModel("其他记录-request")
public static class Record{
@NotNull
@ApiModelProperty("病人报告单ID")
private Long patientReportId;
@NotNull
@ApiModelProperty("其他记录答案")
private List<RecordDetail> details;
}
@Data
@ApiModel("其他记录答案-request")
public static class RecordDetail{
@ApiModelProperty("试题ID")
@NotNull(message = "试题ID不能为空")
private Long recordId;
@NotEmpty
@ApiModelProperty("答案")
private List<String> answers;
}
@Data
@ApiModel("画板信息")
public static class Canvas{
@ -101,6 +127,10 @@ public class QuestionDto {
@NotNull(message = "测评试题id不能为空")
@ApiModelProperty("测评试题id")
private Long questionId;
@ApiModelProperty("参考长度")
private BigDecimal referenceLength;
@ApiModelProperty("参考思考时间")
private BigDecimal referenceReflectOnTime;
}
@Data

117
ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReportRecordDesc.java

@ -0,0 +1,117 @@
package com.ccsens.ht.bean.po;
import java.io.Serializable;
import java.util.Date;
public class HtPatientReportRecordDesc implements Serializable {
private Long id;
private Long patientReportId;
private Long recordId;
private String answer;
private String remark;
private Date createTime;
private Date updateTime;
private Byte isDel;
private Long answerTime;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getPatientReportId() {
return patientReportId;
}
public void setPatientReportId(Long patientReportId) {
this.patientReportId = patientReportId;
}
public Long getRecordId() {
return recordId;
}
public void setRecordId(Long recordId) {
this.recordId = recordId;
}
public String getAnswer() {
return answer;
}
public void setAnswer(String answer) {
this.answer = answer == null ? null : answer.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.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;
}
public Long getAnswerTime() {
return answerTime;
}
public void setAnswerTime(Long answerTime) {
this.answerTime = answerTime;
}
@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(", patientReportId=").append(patientReportId);
sb.append(", recordId=").append(recordId);
sb.append(", answer=").append(answer);
sb.append(", remark=").append(remark);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isDel=").append(isDel);
sb.append(", answerTime=").append(answerTime);
sb.append("]");
return sb.toString();
}
}

761
ht/src/main/java/com/ccsens/ht/bean/po/HtPatientReportRecordDescExample.java

@ -0,0 +1,761 @@
package com.ccsens.ht.bean.po;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class HtPatientReportRecordDescExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public HtPatientReportRecordDescExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> 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 andPatientReportIdIsNull() {
addCriterion("patient_report_id is null");
return (Criteria) this;
}
public Criteria andPatientReportIdIsNotNull() {
addCriterion("patient_report_id is not null");
return (Criteria) this;
}
public Criteria andPatientReportIdEqualTo(Long value) {
addCriterion("patient_report_id =", value, "patientReportId");
return (Criteria) this;
}
public Criteria andPatientReportIdNotEqualTo(Long value) {
addCriterion("patient_report_id <>", value, "patientReportId");
return (Criteria) this;
}
public Criteria andPatientReportIdGreaterThan(Long value) {
addCriterion("patient_report_id >", value, "patientReportId");
return (Criteria) this;
}
public Criteria andPatientReportIdGreaterThanOrEqualTo(Long value) {
addCriterion("patient_report_id >=", value, "patientReportId");
return (Criteria) this;
}
public Criteria andPatientReportIdLessThan(Long value) {
addCriterion("patient_report_id <", value, "patientReportId");
return (Criteria) this;
}
public Criteria andPatientReportIdLessThanOrEqualTo(Long value) {
addCriterion("patient_report_id <=", value, "patientReportId");
return (Criteria) this;
}
public Criteria andPatientReportIdIn(List<Long> values) {
addCriterion("patient_report_id in", values, "patientReportId");
return (Criteria) this;
}
public Criteria andPatientReportIdNotIn(List<Long> values) {
addCriterion("patient_report_id not in", values, "patientReportId");
return (Criteria) this;
}
public Criteria andPatientReportIdBetween(Long value1, Long value2) {
addCriterion("patient_report_id between", value1, value2, "patientReportId");
return (Criteria) this;
}
public Criteria andPatientReportIdNotBetween(Long value1, Long value2) {
addCriterion("patient_report_id not between", value1, value2, "patientReportId");
return (Criteria) this;
}
public Criteria andRecordIdIsNull() {
addCriterion("record_id is null");
return (Criteria) this;
}
public Criteria andRecordIdIsNotNull() {
addCriterion("record_id is not null");
return (Criteria) this;
}
public Criteria andRecordIdEqualTo(Long value) {
addCriterion("record_id =", value, "recordId");
return (Criteria) this;
}
public Criteria andRecordIdNotEqualTo(Long value) {
addCriterion("record_id <>", value, "recordId");
return (Criteria) this;
}
public Criteria andRecordIdGreaterThan(Long value) {
addCriterion("record_id >", value, "recordId");
return (Criteria) this;
}
public Criteria andRecordIdGreaterThanOrEqualTo(Long value) {
addCriterion("record_id >=", value, "recordId");
return (Criteria) this;
}
public Criteria andRecordIdLessThan(Long value) {
addCriterion("record_id <", value, "recordId");
return (Criteria) this;
}
public Criteria andRecordIdLessThanOrEqualTo(Long value) {
addCriterion("record_id <=", value, "recordId");
return (Criteria) this;
}
public Criteria andRecordIdIn(List<Long> values) {
addCriterion("record_id in", values, "recordId");
return (Criteria) this;
}
public Criteria andRecordIdNotIn(List<Long> values) {
addCriterion("record_id not in", values, "recordId");
return (Criteria) this;
}
public Criteria andRecordIdBetween(Long value1, Long value2) {
addCriterion("record_id between", value1, value2, "recordId");
return (Criteria) this;
}
public Criteria andRecordIdNotBetween(Long value1, Long value2) {
addCriterion("record_id not between", value1, value2, "recordId");
return (Criteria) this;
}
public Criteria andAnswerIsNull() {
addCriterion("answer is null");
return (Criteria) this;
}
public Criteria andAnswerIsNotNull() {
addCriterion("answer is not null");
return (Criteria) this;
}
public Criteria andAnswerEqualTo(String value) {
addCriterion("answer =", value, "answer");
return (Criteria) this;
}
public Criteria andAnswerNotEqualTo(String value) {
addCriterion("answer <>", value, "answer");
return (Criteria) this;
}
public Criteria andAnswerGreaterThan(String value) {
addCriterion("answer >", value, "answer");
return (Criteria) this;
}
public Criteria andAnswerGreaterThanOrEqualTo(String value) {
addCriterion("answer >=", value, "answer");
return (Criteria) this;
}
public Criteria andAnswerLessThan(String value) {
addCriterion("answer <", value, "answer");
return (Criteria) this;
}
public Criteria andAnswerLessThanOrEqualTo(String value) {
addCriterion("answer <=", value, "answer");
return (Criteria) this;
}
public Criteria andAnswerLike(String value) {
addCriterion("answer like", value, "answer");
return (Criteria) this;
}
public Criteria andAnswerNotLike(String value) {
addCriterion("answer not like", value, "answer");
return (Criteria) this;
}
public Criteria andAnswerIn(List<String> values) {
addCriterion("answer in", values, "answer");
return (Criteria) this;
}
public Criteria andAnswerNotIn(List<String> values) {
addCriterion("answer not in", values, "answer");
return (Criteria) this;
}
public Criteria andAnswerBetween(String value1, String value2) {
addCriterion("answer between", value1, value2, "answer");
return (Criteria) this;
}
public Criteria andAnswerNotBetween(String value1, String value2) {
addCriterion("answer not between", value1, value2, "answer");
return (Criteria) this;
}
public Criteria andRemarkIsNull() {
addCriterion("remark is null");
return (Criteria) this;
}
public Criteria andRemarkIsNotNull() {
addCriterion("remark is not null");
return (Criteria) this;
}
public Criteria andRemarkEqualTo(String value) {
addCriterion("remark =", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotEqualTo(String value) {
addCriterion("remark <>", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThan(String value) {
addCriterion("remark >", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThanOrEqualTo(String value) {
addCriterion("remark >=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThan(String value) {
addCriterion("remark <", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThanOrEqualTo(String value) {
addCriterion("remark <=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLike(String value) {
addCriterion("remark like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotLike(String value) {
addCriterion("remark not like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkIn(List<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotIn(List<String> values) {
addCriterion("remark not in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkBetween(String value1, String value2) {
addCriterion("remark between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotBetween(String value1, String value2) {
addCriterion("remark not between", value1, value2, "remark");
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<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> 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<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> 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<Byte> values) {
addCriterion("is_del in", values, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotIn(List<Byte> 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 Criteria andAnswerTimeIsNull() {
addCriterion("answer_time is null");
return (Criteria) this;
}
public Criteria andAnswerTimeIsNotNull() {
addCriterion("answer_time is not null");
return (Criteria) this;
}
public Criteria andAnswerTimeEqualTo(Long value) {
addCriterion("answer_time =", value, "answerTime");
return (Criteria) this;
}
public Criteria andAnswerTimeNotEqualTo(Long value) {
addCriterion("answer_time <>", value, "answerTime");
return (Criteria) this;
}
public Criteria andAnswerTimeGreaterThan(Long value) {
addCriterion("answer_time >", value, "answerTime");
return (Criteria) this;
}
public Criteria andAnswerTimeGreaterThanOrEqualTo(Long value) {
addCriterion("answer_time >=", value, "answerTime");
return (Criteria) this;
}
public Criteria andAnswerTimeLessThan(Long value) {
addCriterion("answer_time <", value, "answerTime");
return (Criteria) this;
}
public Criteria andAnswerTimeLessThanOrEqualTo(Long value) {
addCriterion("answer_time <=", value, "answerTime");
return (Criteria) this;
}
public Criteria andAnswerTimeIn(List<Long> values) {
addCriterion("answer_time in", values, "answerTime");
return (Criteria) this;
}
public Criteria andAnswerTimeNotIn(List<Long> values) {
addCriterion("answer_time not in", values, "answerTime");
return (Criteria) this;
}
public Criteria andAnswerTimeBetween(Long value1, Long value2) {
addCriterion("answer_time between", value1, value2, "answerTime");
return (Criteria) this;
}
public Criteria andAnswerTimeNotBetween(Long value1, Long value2) {
addCriterion("answer_time not between", value1, value2, "answerTime");
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);
}
}
}

11
ht/src/main/java/com/ccsens/ht/bean/po/HtQuestion.java

@ -22,6 +22,8 @@ public class HtQuestion implements Serializable {
private String relationCode;
private Long relationId;
private Byte operateType;
private Byte recodeStarttime;
@ -116,6 +118,14 @@ public class HtQuestion implements Serializable {
this.relationCode = relationCode == null ? null : relationCode.trim();
}
public Long getRelationId() {
return relationId;
}
public void setRelationId(Long relationId) {
this.relationId = relationId;
}
public Byte getOperateType() {
return operateType;
}
@ -211,6 +221,7 @@ public class HtQuestion implements Serializable {
sb.append(", recordType=").append(recordType);
sb.append(", recordContent=").append(recordContent);
sb.append(", relationCode=").append(relationCode);
sb.append(", relationId=").append(relationId);
sb.append(", operateType=").append(operateType);
sb.append(", recodeStarttime=").append(recodeStarttime);
sb.append(", timeWabei=").append(timeWabei);

60
ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionExample.java

@ -705,6 +705,66 @@ public class HtQuestionExample {
return (Criteria) this;
}
public Criteria andRelationIdIsNull() {
addCriterion("relation_id is null");
return (Criteria) this;
}
public Criteria andRelationIdIsNotNull() {
addCriterion("relation_id is not null");
return (Criteria) this;
}
public Criteria andRelationIdEqualTo(Long value) {
addCriterion("relation_id =", value, "relationId");
return (Criteria) this;
}
public Criteria andRelationIdNotEqualTo(Long value) {
addCriterion("relation_id <>", value, "relationId");
return (Criteria) this;
}
public Criteria andRelationIdGreaterThan(Long value) {
addCriterion("relation_id >", value, "relationId");
return (Criteria) this;
}
public Criteria andRelationIdGreaterThanOrEqualTo(Long value) {
addCriterion("relation_id >=", value, "relationId");
return (Criteria) this;
}
public Criteria andRelationIdLessThan(Long value) {
addCriterion("relation_id <", value, "relationId");
return (Criteria) this;
}
public Criteria andRelationIdLessThanOrEqualTo(Long value) {
addCriterion("relation_id <=", value, "relationId");
return (Criteria) this;
}
public Criteria andRelationIdIn(List<Long> values) {
addCriterion("relation_id in", values, "relationId");
return (Criteria) this;
}
public Criteria andRelationIdNotIn(List<Long> values) {
addCriterion("relation_id not in", values, "relationId");
return (Criteria) this;
}
public Criteria andRelationIdBetween(Long value1, Long value2) {
addCriterion("relation_id between", value1, value2, "relationId");
return (Criteria) this;
}
public Criteria andRelationIdNotBetween(Long value1, Long value2) {
addCriterion("relation_id not between", value1, value2, "relationId");
return (Criteria) this;
}
public Criteria andOperateTypeIsNull() {
addCriterion("operate_type is null");
return (Criteria) this;

117
ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionOptionDesc.java

@ -0,0 +1,117 @@
package com.ccsens.ht.bean.po;
import java.io.Serializable;
import java.util.Date;
public class HtQuestionOptionDesc implements Serializable {
private Long id;
private Long optionId;
private Integer sort;
private Byte type;
private String content;
private String remark;
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 Long getOptionId() {
return optionId;
}
public void setOptionId(Long optionId) {
this.optionId = optionId;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Byte getType() {
return type;
}
public void setType(Byte type) {
this.type = type;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.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(", optionId=").append(optionId);
sb.append(", sort=").append(sort);
sb.append(", type=").append(type);
sb.append(", content=").append(content);
sb.append(", remark=").append(remark);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isDel=").append(isDel);
sb.append("]");
return sb.toString();
}
}

761
ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionOptionDescExample.java

@ -0,0 +1,761 @@
package com.ccsens.ht.bean.po;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class HtQuestionOptionDescExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public HtQuestionOptionDescExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> 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 andOptionIdIsNull() {
addCriterion("option_id is null");
return (Criteria) this;
}
public Criteria andOptionIdIsNotNull() {
addCriterion("option_id is not null");
return (Criteria) this;
}
public Criteria andOptionIdEqualTo(Long value) {
addCriterion("option_id =", value, "optionId");
return (Criteria) this;
}
public Criteria andOptionIdNotEqualTo(Long value) {
addCriterion("option_id <>", value, "optionId");
return (Criteria) this;
}
public Criteria andOptionIdGreaterThan(Long value) {
addCriterion("option_id >", value, "optionId");
return (Criteria) this;
}
public Criteria andOptionIdGreaterThanOrEqualTo(Long value) {
addCriterion("option_id >=", value, "optionId");
return (Criteria) this;
}
public Criteria andOptionIdLessThan(Long value) {
addCriterion("option_id <", value, "optionId");
return (Criteria) this;
}
public Criteria andOptionIdLessThanOrEqualTo(Long value) {
addCriterion("option_id <=", value, "optionId");
return (Criteria) this;
}
public Criteria andOptionIdIn(List<Long> values) {
addCriterion("option_id in", values, "optionId");
return (Criteria) this;
}
public Criteria andOptionIdNotIn(List<Long> values) {
addCriterion("option_id not in", values, "optionId");
return (Criteria) this;
}
public Criteria andOptionIdBetween(Long value1, Long value2) {
addCriterion("option_id between", value1, value2, "optionId");
return (Criteria) this;
}
public Criteria andOptionIdNotBetween(Long value1, Long value2) {
addCriterion("option_id not between", value1, value2, "optionId");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(Integer value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(Integer value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(Integer value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(Integer value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(Integer value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(Integer value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<Integer> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<Integer> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(Integer value1, Integer value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(Integer value1, Integer value2) {
addCriterion("sort not between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("type is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("type is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Byte value) {
addCriterion("type =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Byte value) {
addCriterion("type <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Byte value) {
addCriterion("type >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Byte value) {
addCriterion("type >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Byte value) {
addCriterion("type <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Byte value) {
addCriterion("type <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Byte> values) {
addCriterion("type in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Byte> values) {
addCriterion("type not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Byte value1, Byte value2) {
addCriterion("type between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Byte value1, Byte value2) {
addCriterion("type not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andContentIsNull() {
addCriterion("content is null");
return (Criteria) this;
}
public Criteria andContentIsNotNull() {
addCriterion("content is not null");
return (Criteria) this;
}
public Criteria andContentEqualTo(String value) {
addCriterion("content =", value, "content");
return (Criteria) this;
}
public Criteria andContentNotEqualTo(String value) {
addCriterion("content <>", value, "content");
return (Criteria) this;
}
public Criteria andContentGreaterThan(String value) {
addCriterion("content >", value, "content");
return (Criteria) this;
}
public Criteria andContentGreaterThanOrEqualTo(String value) {
addCriterion("content >=", value, "content");
return (Criteria) this;
}
public Criteria andContentLessThan(String value) {
addCriterion("content <", value, "content");
return (Criteria) this;
}
public Criteria andContentLessThanOrEqualTo(String value) {
addCriterion("content <=", value, "content");
return (Criteria) this;
}
public Criteria andContentLike(String value) {
addCriterion("content like", value, "content");
return (Criteria) this;
}
public Criteria andContentNotLike(String value) {
addCriterion("content not like", value, "content");
return (Criteria) this;
}
public Criteria andContentIn(List<String> values) {
addCriterion("content in", values, "content");
return (Criteria) this;
}
public Criteria andContentNotIn(List<String> values) {
addCriterion("content not in", values, "content");
return (Criteria) this;
}
public Criteria andContentBetween(String value1, String value2) {
addCriterion("content between", value1, value2, "content");
return (Criteria) this;
}
public Criteria andContentNotBetween(String value1, String value2) {
addCriterion("content not between", value1, value2, "content");
return (Criteria) this;
}
public Criteria andRemarkIsNull() {
addCriterion("remark is null");
return (Criteria) this;
}
public Criteria andRemarkIsNotNull() {
addCriterion("remark is not null");
return (Criteria) this;
}
public Criteria andRemarkEqualTo(String value) {
addCriterion("remark =", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotEqualTo(String value) {
addCriterion("remark <>", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThan(String value) {
addCriterion("remark >", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThanOrEqualTo(String value) {
addCriterion("remark >=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThan(String value) {
addCriterion("remark <", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThanOrEqualTo(String value) {
addCriterion("remark <=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLike(String value) {
addCriterion("remark like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotLike(String value) {
addCriterion("remark not like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkIn(List<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotIn(List<String> values) {
addCriterion("remark not in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkBetween(String value1, String value2) {
addCriterion("remark between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotBetween(String value1, String value2) {
addCriterion("remark not between", value1, value2, "remark");
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<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> 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<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> 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<Byte> values) {
addCriterion("is_del in", values, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotIn(List<Byte> 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);
}
}
}

161
ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionRecord.java

@ -0,0 +1,161 @@
package com.ccsens.ht.bean.po;
import java.io.Serializable;
import java.util.Date;
public class HtQuestionRecord implements Serializable {
private Long id;
private Byte recordType;
private Long questionId;
private Integer sort;
private Byte calcType;
private String showTitle;
private String showForm;
private String defaultValue;
private Byte type;
private String remark;
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 Byte getRecordType() {
return recordType;
}
public void setRecordType(Byte recordType) {
this.recordType = recordType;
}
public Long getQuestionId() {
return questionId;
}
public void setQuestionId(Long questionId) {
this.questionId = questionId;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Byte getCalcType() {
return calcType;
}
public void setCalcType(Byte calcType) {
this.calcType = calcType;
}
public String getShowTitle() {
return showTitle;
}
public void setShowTitle(String showTitle) {
this.showTitle = showTitle == null ? null : showTitle.trim();
}
public String getShowForm() {
return showForm;
}
public void setShowForm(String showForm) {
this.showForm = showForm == null ? null : showForm.trim();
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue == null ? null : defaultValue.trim();
}
public Byte getType() {
return type;
}
public void setType(Byte type) {
this.type = type;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.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(", recordType=").append(recordType);
sb.append(", questionId=").append(questionId);
sb.append(", sort=").append(sort);
sb.append(", calcType=").append(calcType);
sb.append(", showTitle=").append(showTitle);
sb.append(", showForm=").append(showForm);
sb.append(", defaultValue=").append(defaultValue);
sb.append(", type=").append(type);
sb.append(", remark=").append(remark);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isDel=").append(isDel);
sb.append("]");
return sb.toString();
}
}

1021
ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionRecordExample.java

File diff suppressed because it is too large

117
ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionRecordOption.java

@ -0,0 +1,117 @@
package com.ccsens.ht.bean.po;
import java.io.Serializable;
import java.util.Date;
public class HtQuestionRecordOption implements Serializable {
private Long id;
private Long questionRecordId;
private Integer sort;
private String dataKey;
private String dataValue;
private String remark;
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 Long getQuestionRecordId() {
return questionRecordId;
}
public void setQuestionRecordId(Long questionRecordId) {
this.questionRecordId = questionRecordId;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public String getDataKey() {
return dataKey;
}
public void setDataKey(String dataKey) {
this.dataKey = dataKey == null ? null : dataKey.trim();
}
public String getDataValue() {
return dataValue;
}
public void setDataValue(String dataValue) {
this.dataValue = dataValue == null ? null : dataValue.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.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(", questionRecordId=").append(questionRecordId);
sb.append(", sort=").append(sort);
sb.append(", dataKey=").append(dataKey);
sb.append(", dataValue=").append(dataValue);
sb.append(", remark=").append(remark);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isDel=").append(isDel);
sb.append("]");
return sb.toString();
}
}

771
ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionRecordOptionExample.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 HtQuestionRecordOptionExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public HtQuestionRecordOptionExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> 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 andQuestionRecordIdIsNull() {
addCriterion("question_record_id is null");
return (Criteria) this;
}
public Criteria andQuestionRecordIdIsNotNull() {
addCriterion("question_record_id is not null");
return (Criteria) this;
}
public Criteria andQuestionRecordIdEqualTo(Long value) {
addCriterion("question_record_id =", value, "questionRecordId");
return (Criteria) this;
}
public Criteria andQuestionRecordIdNotEqualTo(Long value) {
addCriterion("question_record_id <>", value, "questionRecordId");
return (Criteria) this;
}
public Criteria andQuestionRecordIdGreaterThan(Long value) {
addCriterion("question_record_id >", value, "questionRecordId");
return (Criteria) this;
}
public Criteria andQuestionRecordIdGreaterThanOrEqualTo(Long value) {
addCriterion("question_record_id >=", value, "questionRecordId");
return (Criteria) this;
}
public Criteria andQuestionRecordIdLessThan(Long value) {
addCriterion("question_record_id <", value, "questionRecordId");
return (Criteria) this;
}
public Criteria andQuestionRecordIdLessThanOrEqualTo(Long value) {
addCriterion("question_record_id <=", value, "questionRecordId");
return (Criteria) this;
}
public Criteria andQuestionRecordIdIn(List<Long> values) {
addCriterion("question_record_id in", values, "questionRecordId");
return (Criteria) this;
}
public Criteria andQuestionRecordIdNotIn(List<Long> values) {
addCriterion("question_record_id not in", values, "questionRecordId");
return (Criteria) this;
}
public Criteria andQuestionRecordIdBetween(Long value1, Long value2) {
addCriterion("question_record_id between", value1, value2, "questionRecordId");
return (Criteria) this;
}
public Criteria andQuestionRecordIdNotBetween(Long value1, Long value2) {
addCriterion("question_record_id not between", value1, value2, "questionRecordId");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(Integer value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(Integer value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(Integer value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(Integer value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(Integer value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(Integer value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<Integer> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<Integer> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(Integer value1, Integer value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(Integer value1, Integer value2) {
addCriterion("sort not between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andDataKeyIsNull() {
addCriterion("data_key is null");
return (Criteria) this;
}
public Criteria andDataKeyIsNotNull() {
addCriterion("data_key is not null");
return (Criteria) this;
}
public Criteria andDataKeyEqualTo(String value) {
addCriterion("data_key =", value, "dataKey");
return (Criteria) this;
}
public Criteria andDataKeyNotEqualTo(String value) {
addCriterion("data_key <>", value, "dataKey");
return (Criteria) this;
}
public Criteria andDataKeyGreaterThan(String value) {
addCriterion("data_key >", value, "dataKey");
return (Criteria) this;
}
public Criteria andDataKeyGreaterThanOrEqualTo(String value) {
addCriterion("data_key >=", value, "dataKey");
return (Criteria) this;
}
public Criteria andDataKeyLessThan(String value) {
addCriterion("data_key <", value, "dataKey");
return (Criteria) this;
}
public Criteria andDataKeyLessThanOrEqualTo(String value) {
addCriterion("data_key <=", value, "dataKey");
return (Criteria) this;
}
public Criteria andDataKeyLike(String value) {
addCriterion("data_key like", value, "dataKey");
return (Criteria) this;
}
public Criteria andDataKeyNotLike(String value) {
addCriterion("data_key not like", value, "dataKey");
return (Criteria) this;
}
public Criteria andDataKeyIn(List<String> values) {
addCriterion("data_key in", values, "dataKey");
return (Criteria) this;
}
public Criteria andDataKeyNotIn(List<String> values) {
addCriterion("data_key not in", values, "dataKey");
return (Criteria) this;
}
public Criteria andDataKeyBetween(String value1, String value2) {
addCriterion("data_key between", value1, value2, "dataKey");
return (Criteria) this;
}
public Criteria andDataKeyNotBetween(String value1, String value2) {
addCriterion("data_key not between", value1, value2, "dataKey");
return (Criteria) this;
}
public Criteria andDataValueIsNull() {
addCriterion("data_value is null");
return (Criteria) this;
}
public Criteria andDataValueIsNotNull() {
addCriterion("data_value is not null");
return (Criteria) this;
}
public Criteria andDataValueEqualTo(String value) {
addCriterion("data_value =", value, "dataValue");
return (Criteria) this;
}
public Criteria andDataValueNotEqualTo(String value) {
addCriterion("data_value <>", value, "dataValue");
return (Criteria) this;
}
public Criteria andDataValueGreaterThan(String value) {
addCriterion("data_value >", value, "dataValue");
return (Criteria) this;
}
public Criteria andDataValueGreaterThanOrEqualTo(String value) {
addCriterion("data_value >=", value, "dataValue");
return (Criteria) this;
}
public Criteria andDataValueLessThan(String value) {
addCriterion("data_value <", value, "dataValue");
return (Criteria) this;
}
public Criteria andDataValueLessThanOrEqualTo(String value) {
addCriterion("data_value <=", value, "dataValue");
return (Criteria) this;
}
public Criteria andDataValueLike(String value) {
addCriterion("data_value like", value, "dataValue");
return (Criteria) this;
}
public Criteria andDataValueNotLike(String value) {
addCriterion("data_value not like", value, "dataValue");
return (Criteria) this;
}
public Criteria andDataValueIn(List<String> values) {
addCriterion("data_value in", values, "dataValue");
return (Criteria) this;
}
public Criteria andDataValueNotIn(List<String> values) {
addCriterion("data_value not in", values, "dataValue");
return (Criteria) this;
}
public Criteria andDataValueBetween(String value1, String value2) {
addCriterion("data_value between", value1, value2, "dataValue");
return (Criteria) this;
}
public Criteria andDataValueNotBetween(String value1, String value2) {
addCriterion("data_value not between", value1, value2, "dataValue");
return (Criteria) this;
}
public Criteria andRemarkIsNull() {
addCriterion("remark is null");
return (Criteria) this;
}
public Criteria andRemarkIsNotNull() {
addCriterion("remark is not null");
return (Criteria) this;
}
public Criteria andRemarkEqualTo(String value) {
addCriterion("remark =", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotEqualTo(String value) {
addCriterion("remark <>", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThan(String value) {
addCriterion("remark >", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThanOrEqualTo(String value) {
addCriterion("remark >=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThan(String value) {
addCriterion("remark <", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThanOrEqualTo(String value) {
addCriterion("remark <=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLike(String value) {
addCriterion("remark like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotLike(String value) {
addCriterion("remark not like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkIn(List<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotIn(List<String> values) {
addCriterion("remark not in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkBetween(String value1, String value2) {
addCriterion("remark between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotBetween(String value1, String value2) {
addCriterion("remark not between", value1, value2, "remark");
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<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> 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<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> 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<Byte> values) {
addCriterion("is_del in", values, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotIn(List<Byte> 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);
}
}
}

393
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 {
@ -129,10 +129,49 @@ public class PatientReportVo {
private String hospital;
public List<PdfUtil.Row> toPdfRow(){
List<PdfUtil.Row> rows = getInitRows();
//第四栏
rows.add(
fillRow(
"临床诊断:" + this.clinicalDiagnosis,
"","")
);
return rows;
}
public List<PdfUtil.Row> toPdfSimpleCodeRow(){
List<PdfUtil.Row> rows = getInitRows();
//第四栏
Date date = new Date();
if (this.reportTime != null && this.reportTime > 0) {
date.setTime(this.reportTime);
}
PdfUtil.Row fourRow = new PdfUtil.Row();
PdfUtil.Cell cell = new PdfUtil.Cell();
cell.setContent("临床诊断:" + (StrUtil.isEmpty(this.clinicalDiagnosis) ? "" : this.clinicalDiagnosis) );
cell.setCenter(false);
cell.setColSpan(2);
cell.setBorderLeft(0);
cell.setBorderBottom(0);
fourRow.addCell(cell);
PdfUtil.Cell cell2 = new PdfUtil.Cell();
cell2.setContent("检查日期:" + DateUtil.format(date, "yyyy-MM-dd"));
cell2.setCenter(false);
cell2.setBorderLeft(0);
cell2.setBorderBottom(0);
fourRow.addCell(cell2);
rows.add(fourRow);
return rows;
}
private List<PdfUtil.Row> getInitRows() {
Map<Byte, String> careerMap = new HashMap<>(16);
String careerMsg = "1:农林牧渔水利生产人员 2:教师 3:医务工作者 4:专业技术人员 5:生产、运输设备操作人员及有关人员 6:商业、服务业人员 7:国家机关、事业单位、企业负责人 8:国家机关、事业单位、企业办事人员和有关人员 9:军人 10:媒体、文体类工作人员 11:在校学生 12:未就业 13:家务 14:其他";
String splitStr = " ";
for (String careerOne: careerMsg.split(splitStr)) {
for (String careerOne : careerMsg.split(splitStr)) {
String splitStr2 = ":";
careerMap.put(Byte.parseByte(careerOne.split(splitStr2)[0]), careerOne.split(splitStr2)[1]);
}
@ -151,30 +190,16 @@ 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))
);
//第四栏
// Date date = null;
// if (this.reportTime > 0) {
// date = new Date();
// date.setTime(this.reportTime);
// }
rows.add(
fillRow(
"临床诊断:" + this.clinicalDiagnosis,
"","")
// "检查日期:" + (date == null ? "" : DateUtil.format(date, "yyyy-MM-dd")))
);
return rows;
}
@ -223,35 +248,57 @@ public class PatientReportVo {
this.subReport.add(score);
}
/**
* 将mmse的多层嵌套转成一层
* @param score 报告
* @param list 转换后的list
*/
public void dealMMSE(ReportScore score, List<ReportScore> list) {
if (CollectionUtil.isEmpty(score.subReport)) {
list.add(score);
} else {
score.subReport.forEach(subScore -> dealMMSE(subScore, list));
}
}
public List<PdfUtil.Row> toRow() {
int colNum = 8;
int colNum = 8;
int headNum = 2;
List<PdfUtil.Row> rows = new ArrayList<>();
if (CollectionUtil.isEmpty(subReport)) {
PdfUtil.Row row = new PdfUtil.Row();
PdfUtil.Cell cell1 = new PdfUtil.Cell();
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);
cell2.setBorderRight(1);
row.addCell(cell1);
row.addCell(cell2);
rows.add(row);
toRowOnlyTotal(colNum, headNum, rows);
} else {
String mmse = Constant.Ht.Report.MMSE;
String npi = Constant.Ht.Report.NPI;
if (mmse.equalsIgnoreCase(this.code) || npi.equalsIgnoreCase(this.code)) {
fillMmseOrNpi(headNum, rows, mmse, npi);
} else {
fillMoca(rows);
switch (this.code) {
case Constant.Ht.Report.MMSE:
case Constant.Ht.Report.NPI:
fillMmseOrNpi(headNum, rows, mmse, npi);
break;
case Constant.Ht.Report.MOCA:
fillMoca(rows);
break;
case Constant.Ht.Report.HAMD:
case Constant.Ht.Report.HAMA:
case Constant.Ht.Report.ADL:
toRowOnlyTotal(colNum, headNum, rows);
break;
default:
fillCommon(rows);
break;
}
}
toDescRow(colNum, headNum, rows);
return rows;
}
private void toDescRow(int colNum, int headNum, List<PdfUtil.Row> rows) {
if (StrUtil.isBlank(this.description)) {
return rows;
return ;
}
PdfUtil.Row descRow = new PdfUtil.Row();
PdfUtil.Cell cell = new PdfUtil.Cell();
@ -264,10 +311,166 @@ public class PatientReportVo {
// MOCA中,视直觉单独展示
fillSzj(colNum, headNum, rows);
}
private void toRowOnlyTotal(int colNum, int headNum, List<PdfUtil.Row> rows) {
PdfUtil.Row row = new PdfUtil.Row();
PdfUtil.Cell cell1 = new PdfUtil.Cell();
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);
cell2.setBorderRight(1);
row.addCell(cell1);
row.addCell(cell2);
rows.add(row);
}
public List<PdfUtil.Row> toSingleRow() {
int colNum = Constant.Ht.Report.HAMD.equalsIgnoreCase(code) ? 9 : 8;
int headNum = 2;
List<PdfUtil.Row> rows = new ArrayList<>();
if (CollectionUtil.isEmpty(subReport)) {
toRowOnlyTotal(colNum, headNum, rows);
} else {
String mmse = Constant.Ht.Report.MMSE;
String npi = Constant.Ht.Report.NPI;
switch (this.code) {
case Constant.Ht.Report.MMSE:
fillMMSE(rows);
break;
case Constant.Ht.Report.NPI:
fillMmseOrNpi(headNum, rows, mmse, npi);
break;
case Constant.Ht.Report.MOCA:
fillSingleMoca(rows);
break;
default:
fillCommon(rows);
break;
}
}
toDescRow(colNum, headNum, rows);
return rows;
}
private void fillMMSE(List<PdfUtil.Row> rows) {
List<ReportScore> mmseList = new ArrayList<>();
dealMMSE(this, mmseList);
PdfUtil.Row row = new PdfUtil.Row();
PdfUtil.Cell purposeCell = new PdfUtil.Cell(Constant.Export.MMSE_PURPOSE);
purposeCell.setColSpan(8);
purposeCell.setBorderRight(1);
purposeCell.setCenter(false);
purposeCell.setHeight(36);
row.addCell(purposeCell);
rows.add(row);
PdfUtil.Row titleRow = new PdfUtil.Row();
PdfUtil.Row scoreRow = new PdfUtil.Row();
for (int i = 0; i < mmseList.size() ; i++) {
if (i == 0) {
PdfUtil.Cell cell = new PdfUtil.Cell("简明心理状况测验(MMSE)");
cell.setRowSpan(4);
titleRow.addCell(cell);
rows.add(titleRow);
rows.add(scoreRow);
} else if (i==7){
titleRow = new PdfUtil.Row();
scoreRow = new PdfUtil.Row();
rows.add(titleRow);
rows.add(scoreRow);
}
ReportScore score = mmseList.get(i);
PdfUtil.Cell titleCell = new PdfUtil.Cell(score.getName());
titleRow.addCell(titleCell);
titleCell.setBorderRight(i == 6 ? 1 : 0);
PdfUtil.Cell scoreCell = new PdfUtil.Cell(score.score == null ? "" : score.score + (score.totalScore > 0 ? "/" + score.totalScore : ""));
scoreCell.setBorderRight(i == 6 ? 1 : 0);
scoreRow.addCell(scoreCell);
if (i == mmseList.size() - 1) {
PdfUtil.Cell titleTotalCell = new PdfUtil.Cell("总分");
titleTotalCell.setColSpan(3);
titleTotalCell.setBorderRight(1);
titleRow.addCell(titleTotalCell);
PdfUtil.Cell scoreTotalCell = new PdfUtil.Cell(this.score == null ? "" : this.score + (this.totalScore > 0 ? "/" + this.totalScore : ""));
scoreTotalCell.setColSpan(3);
scoreTotalCell.setBorderRight(1);
scoreRow.addCell(scoreTotalCell);
}
}
}
/**
* 通用项目得分
* @param rows pdf的内容
*/
private void fillCommon(List<PdfUtil.Row> rows) {
//总列数
int total = Constant.Ht.Report.HAMD.equalsIgnoreCase(code) ? 9 : 8;
// 标题
PdfUtil.Row row = new PdfUtil.Row();
PdfUtil.Cell cell = new PdfUtil.Cell();
cell.setContent(this.name + "(" + this.code + ")各项目的因子分和总分");
cell.setColSpan(total);
cell.setBorderTop(0);
cell.setBorderRight(0);
cell.setBorderLeft(0);
row.addCell(cell);
rows.add(row);
// 默认两行
PdfUtil.Row row1 = new PdfUtil.Row();
PdfUtil.Row row2 = new PdfUtil.Row();
// 题目
PdfUtil.Cell firstCell1 = new PdfUtil.Cell();
firstCell1.setContent("项目");
row1.addCell(firstCell1);
PdfUtil.Cell firstCell2 = new PdfUtil.Cell();
firstCell2.setContent("计分");
row2.addCell(firstCell2);
// 子类型
int colspan = (total - 1) / (this.subReport.size() + 1);
int lastSpan = total - 1 - colspan * this.subReport.size();
this.subReport.forEach(score -> {
PdfUtil.Cell cell1 = new PdfUtil.Cell();
PdfUtil.Cell cell2 = new PdfUtil.Cell();
cell1.setContent(score.name);
cell1.setColSpan(colspan);
cell2.setContent(score.score == null ? "" : score.score + (score.totalScore > 0 ? "/" + score.totalScore : ""));
cell2.setColSpan(colspan);
row1.addCell(cell1);
row2.addCell(cell2);
});
// 总分
PdfUtil.Cell lastCell1 = new PdfUtil.Cell();
lastCell1.setContent("总分");
lastCell1.setColSpan(lastSpan);
lastCell1.setBorderRight(1);
row1.addCell(lastCell1);
PdfUtil.Cell lastCell2 = new PdfUtil.Cell();
lastCell2.setContent(this.score == null ? "" : this.score + (this.totalScore > 0 ? "/" + this.totalScore : ""));
lastCell2.setColSpan(lastSpan);
lastCell2.setBorderRight(1);
row2.addCell(lastCell2);
rows.add(row1);
rows.add(row2);
}
private void fillMmseOrNpi(int headNum, List<PdfUtil.Row> rows, String mmse, String npi) {
PdfUtil.Row row1 = new PdfUtil.Row();
PdfUtil.Cell cell = new PdfUtil.Cell();
@ -293,8 +496,29 @@ public class PatientReportVo {
rows.add(row2);
}
private void fillMoca(List<PdfUtil.Row> rows) {
fillMocaScore(rows);
}
private void fillSingleMoca(List<PdfUtil.Row> rows) {
//moca
PdfUtil.Row row = new PdfUtil.Row();
PdfUtil.Cell purposeCell = new PdfUtil.Cell(Constant.Export.MOCA_PURPOSE);
purposeCell.setColSpan(8);
purposeCell.setCenter(false);
purposeCell.setBorderRight(1);
purposeCell.setHeight(36);
row.addCell(purposeCell);
rows.add(row);
fillMocaScore(rows);
}
private void fillMocaScore(List<PdfUtil.Row> rows) {
int firstIndex = 5;
PdfUtil.Row row1 = new PdfUtil.Row();
PdfUtil.Cell cell = new PdfUtil.Cell();
@ -397,8 +621,8 @@ public class PatientReportVo {
//名称
PdfUtil.Cell cell1 = new PdfUtil.Cell();
cell1.setContent(name);
cell1.setBorderTop(isTop? 1 : 0);
cell1.setBorderRight(isRight? 1 : 0);
cell1.setBorderTop(isTop? 1 : null);
cell1.setBorderRight(isRight? 1 : null);
cell1.setColSpan(colspan == null || colspan.length == 0 ? 1 : colspan[0]);
row1.addCell(cell1);
@ -406,13 +630,12 @@ public class PatientReportVo {
PdfUtil.Cell cell2 = new PdfUtil.Cell();
cell2.setContent(score);
cell2.setColSpan(colspan == null || colspan.length <= 1 ? 1 : colspan[1]);
cell2.setBorderRight(isRight? 1 : 0);
cell2.setBorderRight(isRight? 1 : null);
row2.addCell(cell2);
}
}
/**医生对报告单权限*/
@ApiModel("PatientReportVoAuthority")
@ApiModel("医生对报告单权限")
@Data
public static class Authority{
@ApiModelProperty("对报告单的操作权限 0:仅查看 1: 可修改 2:可审查")
@ -519,4 +742,86 @@ public class PatientReportVo {
@ApiModelProperty("图片路径")
private String imgPath;
}
@Data
@ApiModel("导出试题")
public static class QuestionAndAnswer{
private Long id;
@ApiModelProperty("排序")
private int sort;
@ApiModelProperty("试题")
private String question;
@ApiModelProperty("选项")
private List<Option> optionList;
}
@ApiModel("导出选项")
@Data
public static class Option{
private Long id;
@ApiModelProperty("选项内容")
private String name;
@ApiModelProperty("选中状态 0:未选中 1:选中")
private byte chooseStatus;
@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<MMSEScore> mmseScores;
@ApiModelProperty("moca分数")
private List<MoCAScore> mocaScores;
@ApiModelProperty("总分")
private List<TotalScore> 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;
}
}

146
ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java

@ -7,9 +7,11 @@ import com.ccsens.ht.bean.po.HtQuestionIntroducer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.ibatis.javassist.runtime.Desc;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -70,12 +72,14 @@ public class QuestionVo {
}
@Data
@ApiModel("QuestionVoReport")
@ApiModel("报告单类型")
public static class Report{
@ApiModelProperty("报告单编码")
private String code;
@ApiModelProperty("")
@ApiModelProperty("名字")
private String name;
@ApiModelProperty("补充内容")
List<QuestionRecord> codeRecords;
}
@Data
@ -113,6 +117,8 @@ public class QuestionVo {
public static class Question{
@ApiModelProperty("试题ID")
private Long id;
@ApiModelProperty("一级评测类型")
private String evaluationCode;
@ApiModelProperty("评测类型")
private String parentCode;
@ApiModelProperty("排序")
@ -137,15 +143,16 @@ public class QuestionVo {
private Integer clearTimes;
@ApiModelProperty("定时器时长")
private Integer timingLength;
@ApiModelProperty("答案路径")
private String path;
// @ApiModelProperty("答案路径")
// private String path;
@ApiModelProperty("共享答案的试题Id")
private List<Long> shareAnswerIds;
@ApiModelProperty("是否展示关联的试题的答案 0否 1是")
private byte showShareAnswer;
@ApiModelProperty("关联试题")
List<QuestionOption> relationQuestions = new ArrayList<>();
@ApiModelProperty("补充内容")
List<QuestionRecord> questionRecords;
/**
* 将HtQuestion转化成Question
* @param question
@ -176,6 +183,64 @@ public class QuestionVo {
}
}
@Data
@ApiModel("题目或code补充")
public static final class QuestionRecord{
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("0:点击过程 1:自动计算 2:手动计算")
private Byte calcType;
@ApiModelProperty("显示内容")
private String showTitle;
@ApiModelProperty("显示形式")
private String showForm;
@ApiModelProperty("默认值")
private String defaultValue;
@ApiModelProperty("自动计算规则:0:答案个数 1:插入数 同一物品两次以上插入算为一个插入 2:重复数 每次重复均算为一次重复")
private Byte type;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("答案")
private List<String> answers;
@ApiModelProperty("选项")
private List<RecordOption> options;
public List<RecordOption> getOptions() {
if (CollectionUtil.isNotEmpty(answers) && CollectionUtil.isNotEmpty(options)) {
for (RecordOption option: options) {
for (String answer: answers) {
if (option.getDataKey().equals(answer)) {
option.choose = 1;
}
}
}
}
return options;
}
}
@Data
@ApiModel("record的选项")
public static final class RecordOption {
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("提交值")
private String dataKey;
@ApiModelProperty("显示值")
private String dataValue;
@ApiModelProperty("是否选中 0:否 1:是")
private byte choose = 0;
}
@Data
@ApiModel("选项补充")
public static final class OptionDesc{
@ApiModelProperty("id")
private Long id;
private Byte type;
private String content;
}
@Data
@ApiModel("(可以共享答案的试题)关联的试题id")
@ -215,8 +280,13 @@ public class QuestionVo {
private String answer;
@ApiModelProperty("是否选中")
private Byte choose;
@ApiModelProperty("选项补充")
private List<OptionDesc> optionDescList;
}
@Data
@ApiModel("QuestionVoIntroduce")
public static class Introduce {
@ -311,10 +381,27 @@ public class QuestionVo {
private Long pointId;
@ApiModelProperty("颜色")
private Integer color;
@ApiModelProperty("轨迹坐标值")
@ApiModelProperty("轨迹坐标值 x,y,time,type type:0 普通 1左 2右 3 上 4 下")
private String value;
}
@Data
@ApiModel("坐标")
public static class Coordinate {
@ApiModelProperty("横坐标")
private int x;
@ApiModelProperty("横坐标")
private int y;
public Coordinate() {
}
public Coordinate(int x, int y) {
this.x = x;
this.y = y;
}
}
@Data
@ApiModel("画板信息")
@ -343,8 +430,12 @@ public class QuestionVo {
private int lineNums;
@ApiModelProperty("最长笔画长度")
private double longLine;
@ApiModelProperty("最长笔画速度")
private double longSpeed;
@ApiModelProperty("最短笔画长度")
private double shortLine;
@ApiModelProperty("最短笔画速度")
private double shortSpeed;
@ApiModelProperty("笔画中间值")
private double centre;
@ApiModelProperty("平均每分钟画几笔")
@ -356,16 +447,48 @@ public class QuestionVo {
/*20210112新加统计数据*/
@ApiModelProperty("思考总时间(所有笔画间隔时间)")
private Long reflectOnTime;
@ApiModelProperty("落笔总时间(所有笔画绘图时间)")
private long paintTime;
@ApiModelProperty("原点坐标 x,y")
private String center;
@ApiModelProperty("中心 暂定为坐标:X,Y")
private String centreCoordinate;
@ApiModelProperty("面积 暂定均为最小外接长方形 单位为px")
private double acreage;
@ApiModelProperty("中心相对原点坐标 X,Y")
private Coordinate showCentreCoordinate;
@ApiModelProperty("重心 暂定为坐标:X,Y")
private String barycenterCoordinate;
// 上下左右应部分图片存在倒转展示的问题,前端应反向展示
@ApiModelProperty("定点坐标(y最大,图上反而在最下)")
private Coordinate top;
@ApiModelProperty("底点坐标")
private Coordinate bottom ;
@ApiModelProperty("最左点")
private Coordinate left;
@ApiModelProperty("最右点")
private Coordinate right;
@ApiModelProperty("最小外接长方形面积 单位为px")
private double minRectangleAcreage;
@ApiModelProperty("最小外接圆面积 单位为px 保留两位小数")
private BigDecimal minCircleAcreage;
@ApiModelProperty("平均笔画长度")
private double aveLength;
@ApiModelProperty("平均思考时间")
private double aveReflectOnTime;
@ApiModelProperty("长笔画数量")
private int longNums;
@ApiModelProperty("长笔画数量")
@ApiModelProperty("笔画数量")
private int shortNums;
@ApiModelProperty("快速思考数量")
private int quickNums;
@ApiModelProperty("长久思考数量")
private int slowNums;
@ApiModelProperty("过渡时间(在所有短-长笔画序列中画出一个短笔划后开始一个长笔划的总时间)")
private long transitionTime;
@ApiModelProperty("5个早期长笔画的经过时间(从点击开始绘图至前5个长笔画绘制完成")
private long fiveLongLinesTime;
@ApiModelProperty("前5笔长笔画率(前5个笔画中长笔画所占比率)")
private BigDecimal longLineRate;
}
@Data
@ -379,5 +502,10 @@ public class QuestionVo {
private double speed;
@ApiModelProperty("时间间隔,和上一笔比较")
private long intervalDuration;
@ApiModelProperty("长度状态 0:短笔画 1:长笔画 ")
private byte lengthStatus;
@ApiModelProperty("思考时间状态 0:快速 1:迟疑")
private byte reflectOnStatus;
}
}

73
ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java

@ -18,39 +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
*@return: com.ccsens.ht.bean.vo.PatientReportVo.ReportScore
*@Author: wuHuiJuan
* @param id 报告单ID
* @param rey 是否查询rey
* @param report 报告单类型
*@return com.ccsens.ht.bean.vo.PatientReportVo.ReportScore
*@author wuHuiJuan
*@date: 2019/11/19 11:46
*/
List<PatientReportVo.ReportScore> queryReportScore(@Param("id") Long id,@Param("rey") int rey);
List<PatientReportVo.ReportScore> queryReportScore(@Param("id") Long id,@Param("rey") int rey, @Param("report") String report);
/**
* 查询NPI的分数
* @param id
* @return
* @param id 报告单ID
* @return npi分数
*/
List<Map<String, Object>> queryNPIScore(@Param("id") Long id);
List<Map<String, Object>> 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);
@ -58,35 +60,35 @@ public interface HtPatientReportDao extends HtPatientReportMapper {
* 查询报告单名字ID名字导出路径
* @param doctorId 医生ID
* @param patientId 病人ID
* @return
* @return 报告单id,名字和pdf路径
*/
List<PatientReportVo.ReportName> queryReportName(@Param("doctorId")Long doctorId, @Param("patientId") Long patientId);
/**
* 管理员查询报告单
* @param adminQueryReport
* @return
* @param adminQueryReport 搜索条件
* @return 报告单
*/
List<PatientReportVo.ReportName> queryAllReports(PatientReportDto.AdminQueryReport adminQueryReport);
/**
* 根据临床诊断统计
* @param param
* @return
* @param param 统计条件
* @return 临床诊断统计
*/
List<PatientReportVo.ClinicalDiagnosis> countByClinicalDiagnosis(PatientReportDto.ClinicalDiagnosis param);
/**
* 根据年龄性别统计
* @param param
* @return
* @param param 年龄性别
* @return 年龄性别统计
*/
List<PatientReportVo.AgeAndSex> countBySexAndAge(PatientReportDto.AgeAndSex param);
/**
* 根据日期统计
* @param param
* @return
* @param param 日期
* @return 统计
*/
List<PatientReportVo.Day> countByDay(PatientReportDto.Day param);
@ -94,7 +96,7 @@ public interface HtPatientReportDao extends HtPatientReportMapper {
* 查询报告单的详细答题洗洗
* @param id 报告单id
* @param evaluationCode 测试类型
* @return
* @return 报告单的详细答题明细
*/
List<PatientReportVo.ReportDetailAnswer> queryReportAnswer(@Param("id")Long id, @Param("evaluationCode")String evaluationCode);
@ -104,4 +106,27 @@ public interface HtPatientReportDao extends HtPatientReportMapper {
* @return 报告单
*/
List<PatientReportSearchVo.Search> search(@Param("codes") List<PatientReportSearchDto.Search> codes);
/**
* 根据病人报告单ID查询报告单各项相关分数
* @param id 报告单ID
* @param code 量表类型
* @return 报告单分数
*/
List<PatientReportVo.ReportScore> queryReportScore2(@Param("id") Long id, @Param("code") String code);
/**
* 查询evaluate_code = code的所有试题选项及答案
* @param id 报告单ID
* @param code code
* @return 题目
*/
List<PatientReportVo.QuestionAndAnswer> queryQuestionAndScore(@Param("id") Long id, @Param("code") String code);
/**
*
* @param ids 指定报告单ID
* @return 报告单分数 mmse 分类 moca 试题和分数 其他总分
*/
List<PatientReportVo.Analyse> queryReportAnalyseScore(@Param("ids") List<Long> ids);
}

18
ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportRecordDescDao.java

@ -0,0 +1,18 @@
package com.ccsens.ht.persist.dao;
import com.ccsens.ht.bean.po.HtPatientReportRecordDesc;
import com.ccsens.ht.persist.mapper.HtPatientReportRecordDescMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author whj
*/
public interface HtPatientReportRecordDescDao extends HtPatientReportRecordDescMapper {
/**
* 批量保存答案
* @param records 保存答案
*/
void batchSave(@Param("list") List<HtPatientReportRecordDesc> records);
}

9
ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionDao.java

@ -28,4 +28,13 @@ public interface HtQuestionDao extends HtQuestionMapper {
* 查询可以共享答案的试题id
*/
List<QuestionVo.ShareAnswer> queryShareAnswer(@Param("questionId")Long questionId, @Param("patientReportId") Long patientReportId);
/**
* 查询试题和其他记录以及其他记录的答案
* @param code evaluation_code
* @param num sort
* @param patientReportId 报告单ID
* @return 试题
*/
QuestionVo.Question queryQuestionAndRecord(@Param("code") String code, @Param("num") int num, @Param("patientReportId") Long patientReportId);
}

26
ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionOptionDescDao.java

@ -0,0 +1,26 @@
package com.ccsens.ht.persist.dao;
import com.ccsens.ht.bean.po.HtQuestionOptionDesc;
import com.ccsens.ht.persist.mapper.HtQuestionOptionDescMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @description: 选项补充
* @author: whj
* @time: 2021/4/21 0:43
*/
public interface HtQuestionOptionDescDao extends HtQuestionOptionDescMapper {
/**
* 删除指定选项的补充
* @param optionDescDelList 指定选项
*/
void delete(@Param("list") List<Long> optionDescDelList);
/**
* 批量插入
* @param optionDescList 选项补充
*/
void insertBatch(List<HtQuestionOptionDesc> optionDescList);
}

16
ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionRecordDao.java

@ -0,0 +1,16 @@
package com.ccsens.ht.persist.dao;
import com.ccsens.ht.bean.po.HtQuestionRecord;
import com.ccsens.ht.persist.mapper.HtQuestionRecordMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface HtQuestionRecordDao extends HtQuestionRecordMapper {
/**
* 批量添加试题
* @param questionRecords 试题
*/
void insertBatch(@Param("list") List<HtQuestionRecord> questionRecords);
}

15
ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionRecordOptionDao.java

@ -0,0 +1,15 @@
package com.ccsens.ht.persist.dao;
import com.ccsens.ht.bean.po.HtQuestionRecordOption;
import com.ccsens.ht.persist.mapper.HtQuestionRecordOptionMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface HtQuestionRecordOptionDao extends HtQuestionRecordOptionMapper {
/**
* 批量插入
* @param questionRecordOptions options
*/
void insertBatch(@Param("list") List<HtQuestionRecordOption> questionRecordOptions);
}

16
ht/src/main/java/com/ccsens/ht/persist/dao/HtReportDao.java

@ -2,6 +2,7 @@ package com.ccsens.ht.persist.dao;
import com.ccsens.ht.bean.po.HtReport;
import com.ccsens.ht.bean.vo.PatientReportSearchVo;
import com.ccsens.ht.bean.vo.QuestionVo;
import com.ccsens.ht.persist.mapper.HtReportMapper;
import org.apache.ibatis.annotations.Param;
@ -37,4 +38,19 @@ public interface HtReportDao extends HtReportMapper {
* @return 搜索条件
*/
List<PatientReportSearchVo.SearchParam> queryParam(@Param("parentCode") String parentCode);
/**
* 查询指定等级的报告单code
* @param type type
* @return code
*/
List<String> queryCode(@Param("type") byte type);
/**
* 查询报告单和记录
* @param code code
* @param patientReportId patientReportId
* @return report+record
*/
QuestionVo.Report queryReportAndRecord(@Param("code") String code, @Param("patientReportId") Long patientReportId);
}

30
ht/src/main/java/com/ccsens/ht/persist/mapper/HtPatientReportRecordDescMapper.java

@ -0,0 +1,30 @@
package com.ccsens.ht.persist.mapper;
import com.ccsens.ht.bean.po.HtPatientReportRecordDesc;
import com.ccsens.ht.bean.po.HtPatientReportRecordDescExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface HtPatientReportRecordDescMapper {
long countByExample(HtPatientReportRecordDescExample example);
int deleteByExample(HtPatientReportRecordDescExample example);
int deleteByPrimaryKey(Long id);
int insert(HtPatientReportRecordDesc record);
int insertSelective(HtPatientReportRecordDesc record);
List<HtPatientReportRecordDesc> selectByExample(HtPatientReportRecordDescExample example);
HtPatientReportRecordDesc selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") HtPatientReportRecordDesc record, @Param("example") HtPatientReportRecordDescExample example);
int updateByExample(@Param("record") HtPatientReportRecordDesc record, @Param("example") HtPatientReportRecordDescExample example);
int updateByPrimaryKeySelective(HtPatientReportRecordDesc record);
int updateByPrimaryKey(HtPatientReportRecordDesc record);
}

30
ht/src/main/java/com/ccsens/ht/persist/mapper/HtQuestionOptionDescMapper.java

@ -0,0 +1,30 @@
package com.ccsens.ht.persist.mapper;
import com.ccsens.ht.bean.po.HtQuestionOptionDesc;
import com.ccsens.ht.bean.po.HtQuestionOptionDescExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface HtQuestionOptionDescMapper {
long countByExample(HtQuestionOptionDescExample example);
int deleteByExample(HtQuestionOptionDescExample example);
int deleteByPrimaryKey(Long id);
int insert(HtQuestionOptionDesc record);
int insertSelective(HtQuestionOptionDesc record);
List<HtQuestionOptionDesc> selectByExample(HtQuestionOptionDescExample example);
HtQuestionOptionDesc selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") HtQuestionOptionDesc record, @Param("example") HtQuestionOptionDescExample example);
int updateByExample(@Param("record") HtQuestionOptionDesc record, @Param("example") HtQuestionOptionDescExample example);
int updateByPrimaryKeySelective(HtQuestionOptionDesc record);
int updateByPrimaryKey(HtQuestionOptionDesc record);
}

30
ht/src/main/java/com/ccsens/ht/persist/mapper/HtQuestionRecordMapper.java

@ -0,0 +1,30 @@
package com.ccsens.ht.persist.mapper;
import com.ccsens.ht.bean.po.HtQuestionRecord;
import com.ccsens.ht.bean.po.HtQuestionRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface HtQuestionRecordMapper {
long countByExample(HtQuestionRecordExample example);
int deleteByExample(HtQuestionRecordExample example);
int deleteByPrimaryKey(Long id);
int insert(HtQuestionRecord record);
int insertSelective(HtQuestionRecord record);
List<HtQuestionRecord> selectByExample(HtQuestionRecordExample example);
HtQuestionRecord selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") HtQuestionRecord record, @Param("example") HtQuestionRecordExample example);
int updateByExample(@Param("record") HtQuestionRecord record, @Param("example") HtQuestionRecordExample example);
int updateByPrimaryKeySelective(HtQuestionRecord record);
int updateByPrimaryKey(HtQuestionRecord record);
}

30
ht/src/main/java/com/ccsens/ht/persist/mapper/HtQuestionRecordOptionMapper.java

@ -0,0 +1,30 @@
package com.ccsens.ht.persist.mapper;
import com.ccsens.ht.bean.po.HtQuestionRecordOption;
import com.ccsens.ht.bean.po.HtQuestionRecordOptionExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface HtQuestionRecordOptionMapper {
long countByExample(HtQuestionRecordOptionExample example);
int deleteByExample(HtQuestionRecordOptionExample example);
int deleteByPrimaryKey(Long id);
int insert(HtQuestionRecordOption record);
int insertSelective(HtQuestionRecordOption record);
List<HtQuestionRecordOption> selectByExample(HtQuestionRecordOptionExample example);
HtQuestionRecordOption selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") HtQuestionRecordOption record, @Param("example") HtQuestionRecordOptionExample example);
int updateByExample(@Param("record") HtQuestionRecordOption record, @Param("example") HtQuestionRecordOptionExample example);
int updateByPrimaryKeySelective(HtQuestionRecordOption record);
int updateByPrimaryKey(HtQuestionRecordOption record);
}

15
ht/src/main/java/com/ccsens/ht/service/IImportService.java

@ -1,6 +1,7 @@
package com.ccsens.ht.service;
import java.io.File;
import java.util.List;
/**
* @program: ptpro
@ -30,13 +31,14 @@ public interface IImportService {
String importTitle(File file, int sheetIndex) throws Exception;
/**
*@Description:导入测评报告单分类
*@param file
*@param sheetIndex
*@return: void
*@Author: wuhuijuan
*@date: 2019/10/21 15:08
* @return 报告单类型
* @param file 文件
* @param index report是第几个sheet
*/
void importReport(File file, int sheetIndex) throws Exception;
List<String> importReport(File file, int index) throws Exception;
/**
*@Description:导入测评报告单分类
@ -47,4 +49,11 @@ public interface IImportService {
*@date: 2019/10/21 15:08
*/
void importQuestion(File file, String type) throws Exception;
/**
* 导入报告单其他记录
* @param excelFile excel
* @param sheetIndex 第几个
*/
void importReportRecord(File excelFile, int sheetIndex) throws Exception;
}

113
ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java

@ -8,6 +8,7 @@ import com.ccsens.ht.bean.vo.PatientReportVo;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.JsonResponse;
import com.github.pagehelper.PageInfo;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.IOException;
import java.util.List;
@ -17,19 +18,19 @@ public interface IPatientReportService {
/**
* 生成病人报告单
* @param patientReport
* @param userId
*@return: com.ccsens.ptpro.util.JsonResponse
*@Author: wuHuiJuan
* @param patientReport patientReport
* @param userId userId
*@return com.ccsens.ptpro.util.JsonResponse
*@author wuHuiJuan
*@date: 2019/10/30 16:45
*/
JsonResponse<PatientReportVo.Generate> generatePatientReport(PatientReportDto.Generate patientReport, Long userId);
/**
* 编辑病人报告单其他信息初步印象临床诊断床号
* @param patientReport
* @param userId
*@return: com.ccsens.ptpro.util.CodeEnum
*@Author: wuHuiJuan
* @param patientReport patientReport
* @param userId userId
*@return com.ccsens.ptpro.util.CodeEnum
*@author wuHuiJuan
*@date: 2019/11/18 16:16
*/
CodeEnum editPatientReport(PatientReportDto.Edit patientReport, Long userId);
@ -37,101 +38,100 @@ public interface IPatientReportService {
/**
*查询报告单列表
* @param query
* @param userId
*@return: com.github.pagehelper.PageInfo<com.ccsens.ht.bean.vo.PatientReportVo.ReportName>
*@Author: wuHuiJuan
* @param query query
* @param userId userId
*@return com.github.pagehelper.PageInfo<com.ccsens.ht.bean.vo.PatientReportVo.ReportName>
*@author wuHuiJuan
*@date: 2019/11/18 17:00
*/
PageInfo<PatientReportVo.ReportName> queryReports(PatientReportDto.QueryReports query, Long userId);
/**
* 查询报告单详细信息
* @param queryDetail
* @param userId
*@return: com.ccsens.ht.bean.vo.PatientReportVo.ReprotDetail
*@Author: wuHuiJuan
* @param queryDetail queryDetail
* @param userId userId
*@return com.ccsens.ht.bean.vo.PatientReportVo.ReprotDetail
*@author wuHuiJuan
*@date: 2019/11/19 10:18
*/
PatientReportVo.ReprotDetail queryReportDetail(PatientReportDto.QueryDetail queryDetail, Long userId);
/**
* 查询医生对该报告单的权限
* @param authority
* @param userId
*@return: com.ccsens.ht.bean.vo.PatientReportVo.Authority
*@Author: wuHuiJuan
*@date: 2019/11/19 15:50
* @param authority authority
* @param userId userId
* @return com.ccsens.ht.bean.vo.PatientReportVo.Authority
* @author wuHuiJuan
* @date: 2019/11/19 15:50
*/
PatientReportVo.Authority queryReportAuthority(PatientReportDto.Authority authority, Long userId);
/**
* 导出报告单
* @param queryDetail
* @param userId
* @return
* @param queryDetail queryDetail
* @param userId userId
* @return 报告单路径
*/
String exportReport(PatientReportDto.QueryDetail queryDetail, Long userId);
/**
* 生成二维码
* @param queryDetail
* @param userId
* @return
* @param queryDetail queryDetail
* @param userId userId
* @return 二维码路径
*/
String generateQRCode(PatientReportDto.QueryDetail queryDetail, Long userId) throws IOException;
String generateQrCode(PatientReportDto.QueryDetail queryDetail, Long userId) throws IOException;
/**
* 检查有无未完成的报告
* @param userId
* @return
* @param userId userId
* @return 未完成的报告单
*/
PatientReportVo.Complete checkComplete(Long userId);
/**
* 忽略未完成的报告单
* @param ignore
* @param userId
* @return
* @param ignore ignore
* @param userId userId
*/
void ignoreComplete(PatientReportDto.Ignore ignore, Long userId);
/**
* 查询某个医生的报告单列表
* @param param
* @param doctor
* @param userId
* @return
* @param param param
* @param doctor doctor
* @param userId userId
* @return 报告单名字
*/
PageInfo<PatientReportVo.ReportName> queryDoctorReports(PatientReportDto.Doctor param, HtDoctor doctor, Long userId);
/**
* 管理员查询报告单列表
* @param param
* @param userId
* @return
* @param param param
* @param userId userId
* @return 报告单名字
*/
PageInfo<PatientReportVo.ReportName> queryAllReports(PatientReportDto.AdminQueryReport param, Long userId);
/**
* 根据临床诊断统计
* @param param
* @param userId
* @return
* @param param param
* @param userId userId
* @return 临床诊断统计
*/
List<PatientReportVo.ClinicalDiagnosis> countByClinicalDiagnosis(PatientReportDto.ClinicalDiagnosis param, Long userId);
/**
* 根据性别年龄统计
* @param param
* @param userId
* @return
* @param param param
* @param userId userId
* @return 年龄统计
*/
List<PatientReportVo.AgeAndSexGroup> countBySexAndAge(PatientReportDto.AgeAndSex param, Long userId);
/**
* 根据日期统计
* @param param
* @param userId
* @return
* @param param param
* @param userId userId
* @return 统计结果
*/
List<PatientReportVo.Day> countByDay(PatientReportDto.Day param, Long userId);
@ -157,4 +157,19 @@ public interface IPatientReportService {
* @return 报告单
*/
PageInfo<PatientReportSearchVo.Search> search(PatientReportSearchDto.SearchList param);
/**
* 导出指定报告单
* @param param 指定报告单类型
* @param userId userId
* @return path
*/
String export(PatientReportDto.ExportCode param, Long userId);
/**
* 导出指定报告单分析
* @param ids 报告单ID列表
* @return workbook
*/
Workbook exportAnalyse(List<Long> ids);
}

33
ht/src/main/java/com/ccsens/ht/service/IQuestionService.java

@ -17,33 +17,33 @@ public interface IQuestionService {
/**
* 根据类型和题号查询试题
* @param query
* @param userId
* @return
* @param query 类型和题号
* @param userId userId
* @return 试题及相关
*/
QuestionVo.Query queryQuestion(QuestionDto.Query query, Long userId);
/**
* 保存试题得分
* @param score
* @param userId
* @return
* @param score 分数
* @param userId userId
* @return 成功与否
*/
CodeEnum saveScore(QuestionDto.Score score, Long userId) throws IOException, NotSupportedFileTypeException;
CodeEnum saveScore(QuestionDto.Score score, Long userId);
/**
* 保存画图轨迹信息
* @param param
* @param userId
* @return
* @param param 画图
* @param userId userId
* @return 轨迹
*/
List<QuestionVo.PatientCanvas> saveCanvas(QuestionDto.SavePatientCanvas param, Long userId);
/**
* 查看用户画图信息
* @param param
* @param userId
* @return
* @param param 报告单+试题
* @param userId userId
* @return 画图及分析
*/
List<QuestionVo.PatientCanvas> getCanvas(QuestionDto.QueryPatientCanvas param, Long userId);
@ -61,4 +61,11 @@ public interface IQuestionService {
* @param userId userId
*/
void delCanvas(QuestionDto.DelPatientCanvas param, Long userId);
/**
* 保存题目的其他记录
* @param records 记录
* @param userId 用户ID
*/
void saveRecord(QuestionDto.Record records, Long userId);
}

280
ht/src/main/java/com/ccsens/ht/service/ImportService.java

@ -3,21 +3,25 @@ package com.ccsens.ht.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ccsens.ht.bean.po.*;
import com.ccsens.ht.persist.dao.*;
import com.ccsens.ht.uitl.Constant;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.PoiUtil;
import com.ccsens.util.PropUtil;
import com.ccsens.util.StringUtil;
import com.ccsens.util.exception.BaseException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.io.File;
import java.util.*;
@ -31,22 +35,29 @@ import java.util.*;
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class ImportService implements IImportService {
@Autowired
@Resource
private Snowflake snowflake;
@Autowired
@Resource
private HtTitleDao htTitleDao;
@Autowired
@Resource
private HtPositionDao htPositionDao;
@Autowired
@Resource
private HtReportDao htReportDao;
@Autowired
@Resource
private HtQuestionDao htQuestionDao;
@Autowired
@Resource
private HtQuestionOptionDao htQuestionOptionDao;
@Autowired
@Resource
private HtQuestionIntroducerDao htQuestionIntroducerDao;
@Autowired
@Resource
private HtQuestionScoringRuleDao htQuestionScoringRuleDao;
@Resource
private HtQuestionRecordDao htQuestionRecordDao;
@Resource
private HtQuestionRecordOptionDao htQuestionRecordOptionDao;
@Resource
private HtQuestionOptionDescDao htQuestionOptionDescDao;
@Override
public String importPosition(File file, int sheetIndex) throws Exception {
@ -189,7 +200,8 @@ public class ImportService implements IImportService {
}
@Override
public void importReport(File file, int sheetIndex) throws Exception{
public List<String> importReport(File file, int sheetIndex) throws Exception{
List<String> codes = new ArrayList<>();
List<Object[]> reports = PoiUtil.readExce(file, sheetIndex, null,1, false);
log.info("导入职务,读取数据完成");
List<HtReport> reportList = new ArrayList<>();
@ -200,10 +212,14 @@ public class ImportService implements IImportService {
}
HtReport report = initReport(objs);
reportList.add(report);
if (report.getType() == Constant.Ht.Report.TYPE_EVALUATION) {
codes.add(report.getCode());
}
}
if (!reportList.isEmpty()) {
htReportDao.insertBatch(reportList);
}
return codes;
}
@Override
@ -211,18 +227,51 @@ public class ImportService implements IImportService {
log.info("导入试题参数:{}, {}", file, type);
List<String> types = new ArrayList<>();
if (Constant.Ht.Question.ALL.equalsIgnoreCase(type)) {
types.addAll(Constant.Ht.Question.QUESTION_TYPE);
types.addAll(htReportDao.queryCode(Constant.Ht.Report.TYPE_EVALUATION));
} else {
types.add(type);
}
log.info("导入试题类型:{}", types);
StringBuilder builder = new StringBuilder();
for (String sheetName: types) {
List<Object[]> questions = PoiUtil.readExce(file, -1, sheetName,1, true);
saveQuestions(questions, sheetName);
}
}
@Override
public void importReportRecord(File excelFile, int sheetIndex) throws Exception {
List<Object[]> reports = PoiUtil.readExce(excelFile, sheetIndex, null,1, false);
log.info("导入报告单其他记录,读取数据完成");
List<HtReport> htReports = htReportDao.selectByExample(new HtReportExample());
Map<String, Long> reportMap = new HashMap<>();
htReports.forEach(htReport -> reportMap.put(htReport.getCode(), htReport.getId()));
log.info("报告单类型查询完成");
List<HtQuestionRecord> reportRecordList = new ArrayList<>();
List<HtQuestionRecordOption> optionList = new ArrayList<>();
for (Object[] objs: reports) {
if (!pageData(objs)) {
log.info("测评报告单数据不足,跳转下一行");
continue;
}
Long id = reportMap.get(String.valueOf(objs[0]));
if (id == null) {
log.info("报告单类型不存在:{}", objs[0]);
throw new BaseException(CodeEnum.PARAM_ERROR);
}
HtQuestionRecord record = initRecord(objs, id , optionList, Constant.Ht.QuestionRecord.RECORD_TYPE_CODE, 1);
reportRecordList.add(record);
}
if (!reportRecordList.isEmpty()) {
htQuestionRecordDao.insertBatch(reportRecordList);
}
if (!optionList.isEmpty()) {
htQuestionRecordOptionDao.insertBatch(optionList);
}
}
/**
* 保存试题
* */
@ -231,6 +280,10 @@ public class ImportService implements IImportService {
List<HtQuestionOption> optionList = new ArrayList<>();
List<HtQuestionIntroducer> introduceList = new ArrayList<>();
List<HtQuestionScoringRule> ruleList = new ArrayList<>();
List<HtQuestionRecord> questionRecordList = new ArrayList<>();
List<HtQuestionRecordOption> questionRecordOptionList = new ArrayList<>();
List<HtQuestionOptionDesc> optionDescList = new ArrayList<>();
List<Long> optionDescDelList = new ArrayList<>();
//记录那类型题是关联试题
Map<String, String> parentCode = new HashMap<>();
for(Object[] objs : questions) {
@ -241,48 +294,7 @@ public class ImportService implements IImportService {
int sort = objs.length > 3 && StringUtil.checkNum(String.valueOf(objs[3]), false) ? Integer.parseInt(String.valueOf(objs[3])) : 1;
String type = String.valueOf(objs[0]);
switch (type) {
case "题目" :
HtQuestion question = initQuestion(objs, evaluationCode, sort);
if (StrUtil.isNotEmpty(question.getRelationCode())) {
String[] split = question.getRelationCode().split("[,,]");
for (String code: split) {
parentCode.put(code, question.getParentCode());
}
}
if (parentCode.containsKey(question.getParentCode())) {
question.setEvaluationCode(parentCode.get(question.getParentCode()));
}
questionList.add(question);
break;
case "选项" :
if (questionList.isEmpty()) {
break;
}
HtQuestionOption option = initOption(objs, questionList.get(questionList.size()-1).getId(), sort);
optionList.add(option);
break;
case "解析" :
if (questionList.isEmpty()) {
break;
}
HtQuestionIntroducer introduce = initIntroduce(objs, questionList.get(questionList.size()-1).getId(), sort);
introduceList.add(introduce);
break;
case "规则" :
if (questionList.isEmpty()) {
break;
}
HtQuestionScoringRule rule = initRule(objs, questionList.get(questionList.size() - 1).getId());
ruleList.add(rule);
break;
default:
log.info("{}类型未知,不解析", type);
break;
}
initData(evaluationCode, questionList, optionList, introduceList, ruleList, questionRecordList, questionRecordOptionList, optionDescList, optionDescDelList, parentCode, objs, sort, type);
}
if (!questionList.isEmpty()) {
@ -297,8 +309,133 @@ public class ImportService implements IImportService {
if (!ruleList.isEmpty()) {
htQuestionScoringRuleDao.insertBatch(ruleList);
}
if (!questionRecordList.isEmpty()) {
htQuestionRecordDao.insertBatch(questionRecordList);
}
if (!questionRecordOptionList.isEmpty()) {
htQuestionRecordOptionDao.insertBatch(questionRecordOptionList);
}
if (!optionDescDelList.isEmpty()) {
htQuestionOptionDescDao.delete(optionDescDelList);
}
if (!optionDescList.isEmpty()) {
htQuestionOptionDescDao.insertBatch(optionDescList);
}
}
/**
* 试题导入将obj[] 转换成 对应的data
*/
private void initData(String evaluationCode, List<HtQuestion> questionList, List<HtQuestionOption> optionList, List<HtQuestionIntroducer> introduceList, List<HtQuestionScoringRule> ruleList, List<HtQuestionRecord> questionRecordList, List<HtQuestionRecordOption> questionRecordOptionList, List<HtQuestionOptionDesc> optionDescList, List<Long> optionDescDelList, Map<String, String> parentCode, Object[] objs, int sort, String type) {
switch (type) {
case Constant.Import.EVALUATION_QUESTION :
HtQuestion question = initQuestion(objs, evaluationCode, sort);
question.setEvaluationCode(parentCode.getOrDefault(question.getParentCode(), question.getEvaluationCode()));
questionList.add(question);
break;
case Constant.Import.EVALUATION_RELATION:
HtQuestion relationQuestion = initQuestion(objs, evaluationCode, sort);
relationQuestion.setEvaluationCode(parentCode.getOrDefault(relationQuestion.getParentCode(), relationQuestion.getEvaluationCode()));
if (CollectionUtil.isNotEmpty(questionList)) {
HtQuestion prev = questionList.get(questionList.size() - 1);
if (prev.getRelationId() != null && prev.getRelationId() >0) {
relationQuestion.setRelationId(prev.getRelationId());
} else {
relationQuestion.setRelationId(prev.getId());
}
}
questionList.add(relationQuestion);
break;
case Constant.Import.EVALUATION_OPTION :
if (questionList.isEmpty()) {
break;
}
HtQuestionOption option = initOption(objs, questionList.get(questionList.size()-1).getId(), sort, optionDescList, optionDescDelList);
optionList.add(option);
break;
case Constant.Import.EVALUATION_PARSE :
if (questionList.isEmpty()) {
break;
}
HtQuestionIntroducer introduce = initIntroduce(objs, questionList.get(questionList.size()-1).getId(), sort);
introduceList.add(introduce);
break;
case Constant.Import.EVALUATION_RULE :
if (questionList.isEmpty()) {
break;
}
HtQuestionScoringRule rule = initRule(objs, questionList.get(questionList.size() - 1).getId());
ruleList.add(rule);
break;
case Constant.Import.EVALUATION_RECORD:
if (questionList.isEmpty()) {
break;
}
HtQuestionRecord record = initRecord(objs, questionList.get(questionList.size() - 1).getId(), questionRecordOptionList, Constant.Ht.QuestionRecord.RECORD_TYPE_QUESTION, (byte)3);
questionRecordList.add(record);
break;
default:
log.info("{}类型未知,不解析", type);
break;
}
}
/**
* 封装record option
* @param objs 一列
* @param questionId 试题ID
* @param questionRecordOptions record选项
* @return record
*/
private HtQuestionRecord initRecord(Object[] objs, Long questionId, List<HtQuestionRecordOption> questionRecordOptions, byte recordType, int sortIndex ) {
String content = (String)objs[2];
JSONObject json = JSONObject.parseObject(content);
HtQuestionRecord record = JSONObject.parseObject(content, HtQuestionRecord.class);
record.setRecordType(recordType);
record.setQuestionId(questionId);
// 判断是否存在,设置id
int sort = StringUtil.checkNum(String.valueOf(objs[sortIndex]), false) ?
Integer.parseInt(String.valueOf(objs[sortIndex])) : Constant.Ht.Question.RULE_TYPE_DEFAULT;
record.setSort(sort);
HtQuestionRecordExample recordExample = new HtQuestionRecordExample();
recordExample.createCriteria().andQuestionIdEqualTo(questionId).andSortEqualTo(sort);
List<HtQuestionRecord> questionRecords = htQuestionRecordDao.selectByExample(recordExample);
if (CollectionUtil.isEmpty(questionRecords)) {
record.setId(snowflake.nextId());
} else {
record.setId(questionRecords.get(0).getId());
}
log.info("添加record:{}", record);
if (!json.containsKey(Constant.Import.RELATION_OPTION)) {
return record;
}
log.info("追加选项{}", json.get(Constant.Import.RELATION_OPTION));
JSONArray options = json.getJSONArray(Constant.Import.RELATION_OPTION);
for (Object obj: options) {
log.info("导入的选项信息{}", obj);
HtQuestionRecordOption recordOption = JSONObject.parseObject(((JSONObject) obj).toJSONString(), HtQuestionRecordOption.class);
if (CollectionUtil.isEmpty(questionRecords)) {
recordOption.setId(snowflake.nextId());
questionRecordOptions.add(recordOption);
continue;
}
HtQuestionRecordOptionExample optionExample = new HtQuestionRecordOptionExample();
optionExample.createCriteria().andQuestionRecordIdEqualTo(questionRecords.get(0).getId())
.andSortEqualTo(recordOption.getSort());
List<HtQuestionRecordOption> optionList = htQuestionRecordOptionDao.selectByExample(optionExample);
if (CollectionUtil.isNotEmpty(optionList)) {
recordOption.setId(optionList.get(0).getId());
} else {
recordOption.setId(snowflake.nextId());
}
recordOption.setQuestionRecordId(record.getId());
questionRecordOptions.add(recordOption);
}
return record;
}
private HtQuestionScoringRule initRule(Object[] objs, Long questionId) {
@ -340,8 +477,14 @@ public class ImportService implements IImportService {
return introduce;
}
/**初始化选项*/
private HtQuestionOption initOption(Object[] objs, Long questionId, int sort) throws Exception {
/**初始化选项
* @param objs 表格一行
* @param questionId 试题ID
* @param sort 排序
* @param optionDescList 记录其他补充
* @return 选项
*/
private HtQuestionOption initOption(Object[] objs, Long questionId, int sort, List<HtQuestionOptionDesc> optionDescList, List<Long> optionIds) {
HtQuestionOptionExample example = new HtQuestionOptionExample();
@ -363,7 +506,28 @@ public class ImportService implements IImportService {
option.setQuestionId(questionId);
option.setSort(sort);
option.setScore(option.getScore() == null ? Constant.Ht.NUMBER_DEFAULT_BIGDECIMAL : option.getScore());
// 判断有无补充
JSONObject json = JSONObject.parseObject(String.valueOf(objs[2]));
if (json.containsKey(Constant.Import.OPTION_DESC)) {
log.info("选项补充:{}",json.get(Constant.Import.OPTION_DESC));
// 删除原有的补充
if (CollectionUtil.isNotEmpty(options)) {
// 统计选项是否有补充
HtQuestionOptionDescExample descExample = new HtQuestionOptionDescExample();
descExample.createCriteria().andOptionIdEqualTo(option.getId());
long count = htQuestionOptionDescDao.countByExample(descExample);
if (count > 0) {
optionIds.add(options.get(0).getId());
}
}
JSONArray descArr = json.getJSONArray(Constant.Import.OPTION_DESC);
for (Object obj: descArr) {
HtQuestionOptionDesc desc = JSONObject.parseObject(JSON.toJSONString(obj), HtQuestionOptionDesc.class);
desc.setId(snowflake.nextId());
optionDescList.add(desc);
}
}
log.info("导入选项:{}", option);
return option;
}
@ -512,7 +676,7 @@ public class ImportService implements IImportService {
report.setParentCode(objs.length > 2 && !StringUtils.isEmpty(objs[2]) ? (String) objs[2] : Constant.Ht.STRING_DEFAULT);
report.setDescription(objs.length > 3 && !StringUtils.isEmpty(objs[3]) ? (String) objs[3] : Constant.Ht.STRING_DEFAULT);
report.setTotalScore(objs.length > 4 && StringUtil.checkNum(String.valueOf(objs[4]), false) ? Integer.parseInt(String.valueOf(objs[4])) : Constant.Ht.NUMBER_DEFAULT);
report.setType(objs.length > 5 && Constant.Ht.Report.TYPE.get((String)objs[5])!=null ? Constant.Ht.Report.TYPE.get((String)objs[5]) : Constant.Ht.NUMBER_DEFAULT);
report.setType(objs.length > 5 && Constant.Ht.Report.TYPE.get(objs[5])!=null ? Constant.Ht.Report.TYPE.get((String)objs[5]) : Constant.Ht.NUMBER_DEFAULT);
report.setIsShow(objs.length>6 && StringUtil.checkNum(String.valueOf(objs[6]), false) ? Byte.parseByte(String.valueOf(objs[6])) : Constant.Ht.NUMBER_DEFAULT);
report.setRemark(objs.length>7 && !StringUtils.isEmpty(objs[7]) ? (String) objs[7] : Constant.Ht.STRING_DEFAULT);
report.setSort(objs.length > 8 && StringUtil.checkNum(String.valueOf(objs[8]), false) ? Integer.parseInt(String.valueOf(objs[8])) : Constant.Ht.NUMBER_DEFAULT);

704
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;
@ -25,6 +24,8 @@ import com.github.pagehelper.PageHelper;
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;
@ -64,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<PatientReportVo.Generate> generatePatientReport(PatientReportDto.Generate generate, Long userId) {
@ -116,7 +123,7 @@ public class PatientReportService implements IPatientReportService {
example.createCriteria().andUserIdEqualTo(userId).andAuditStateEqualTo(Constant.Ht.Doctor.CHECK_SUCCESS);
List<HtDoctor> doctors = htDoctorDao.selectByExample(example);
if (CollectionUtils.isEmpty(doctors)) {
log.info("{}医生信息尚未审核通过");
log.info("{}医生信息尚未审核通过", userId);
return CodeEnum.AUDIT_NOT_PASS;
}
HtDoctor doctor = doctors.get(0);
@ -223,54 +230,25 @@ public class PatientReportService implements IPatientReportService {
//查询报告单信息和病人信息
PatientReportVo.ReprotPatient reportPatient = htPatientReportDao.queryReportResult(queryDetail.getId());
//查询报告单分数
List<PatientReportVo.ReportScore> reportScore = htPatientReportDao.queryReportScore(queryDetail.getId(),queryDetail.getRey());
List<PatientReportVo.ReportScore> reportScore = htPatientReportDao.queryReportScore(queryDetail.getId(), queryDetail.getRey(), queryDetail.getReport());
long reportId = queryDetail.getId();
//重新封装报告单信息
Map<String, PatientReportVo.ReportScore> map = new HashMap<>(32);
List<PatientReportVo.ReportScore> scores = new ArrayList<>();
reportScore.forEach(score -> {
if(ObjectUtil.isNotNull(score.getScore())){
if(BigDecimal.valueOf(score.getScore().intValue()).compareTo(score.getScore()) == 0){
score.setScore(score.getScore().setScale(0,BigDecimal.ROUND_HALF_UP));
}
}
map.put(score.getCode(), score);
//测评类(MOCA等)
if (Constant.Ht.Report.TYPE_EVALUATION.equals(score.getType())) {
String specialCode = "NPI";
if (specialCode.equalsIgnoreCase(score.getCode())) {
initNPI(queryDetail, score);
}
scores.add(score);
} else {
log.info("score:{}", score);
map.get(score.getParentCode()).addSub(score);
}
});
scores.forEach(score -> {
if (Constant.Ht.Report.MOCA_SJZ.equalsIgnoreCase(score.getCode())) {
return;
}
sumScore(score);
});
List<PatientReportVo.ReportScore> scores = getReportScores(reportScore, reportId);
detail.setPatient(reportPatient);
detail.setScores(scores);
return detail;
}
private void initNPI(PatientReportDto.QueryDetail queryDetail, PatientReportVo.ReportScore score) {
List<Map<String, Object>> list = htPatientReportDao.queryNPIScore(queryDetail.getId());
private void initNPI(long id, PatientReportVo.ReportScore score) {
List<Map<String, Object>> list = htPatientReportDao.queryNpiScore(id);
Map<String,Object> npiScore = new HashMap<>();
list.forEach(map -> {
npiScore.put((String)map.get("optionName"), map.get("score"));
});
list.forEach(map -> npiScore.put((String)map.get("optionName"), map.get("score")));
PatientReportVo.ReportScore carer = new PatientReportVo.ReportScore();
carer.setCode("carer");
carer.setName("照顾者");
carer.setTotalScore(-1);
carer.setScore(npiScore == null || npiScore.get("carer") == null ? null : ((BigDecimal)npiScore.get("carer")));
carer.setScore(npiScore.get("carer") == null ? null : ((BigDecimal)npiScore.get("carer")));
if(ObjectUtil.isNotNull(carer.getScore())){
carer.setScore(carer.getScore().setScale(0,BigDecimal.ROUND_HALF_UP));
}
@ -281,7 +259,7 @@ public class PatientReportService implements IPatientReportService {
patient.setCode("result");
patient.setName("患者");
patient.setTotalScore(-1);
patient.setScore(npiScore == null || npiScore.get("result") == null ? null : ((BigDecimal) npiScore.get("result")));
patient.setScore(npiScore.get("result") == null ? null : ((BigDecimal) npiScore.get("result")));
if(ObjectUtil.isNotNull(patient.getScore())){
patient.setScore(patient.getScore().setScale(0,BigDecimal.ROUND_HALF_UP));
}
@ -331,27 +309,24 @@ public class PatientReportService implements IPatientReportService {
/**
* 为上级求和
* @param score
*@return: java.lang.Integer
*@Author: wuHuiJuan
* @param score 分数
*@author wuHuiJuan
*@date: 2019/11/19 15:42
*/
private BigDecimal sumScore(PatientReportVo.ReportScore score){
AtomicReference<BigDecimal> sum = new AtomicReference<>(score.getScore() == null ? BigDecimal.valueOf(0) : score.getScore());
AtomicBoolean hasAdd = new AtomicBoolean(false);
if (!CollectionUtils.isEmpty(score.getSubReport())) {
score.getSubReport().forEach(sub -> {
sum.updateAndGet(v -> {
BigDecimal sumScore = sumScore(sub);
if (sumScore== null) {
return v;
}
hasAdd.set(true);
// return v += sumScore;
v = v.add(sumScore);
score.getSubReport().forEach(sub -> sum.updateAndGet(v -> {
BigDecimal sumScore = sumScore(sub);
if (sumScore== null) {
return v;
});
});
}
hasAdd.set(true);
// return v += sumScore;
v = v.add(sumScore);
return v;
}));
} else {
if (StringUtil.isNotEmpty(score.getRemark()) && score.getRemark().matches(Constant.Ht.Report.IGNORE_SCORE)) {
return score.getScore() == null ? null : BigDecimal.valueOf(0);
@ -387,9 +362,7 @@ public class PatientReportService implements IPatientReportService {
throw new BaseException(CodeEnum.REPORT_NOT_FOUND);
}
List<PdfUtil.Row> content = new ArrayList<>();
detail.getScores().forEach(reportScore -> {
content.addAll(reportScore.toRow());
});
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);
@ -398,16 +371,11 @@ public class PatientReportService implements IPatientReportService {
initImplCell.setBorderRight(1);
initImplCell.setCenter(false);
content.add(row);
PdfUtil.Row row2 = new PdfUtil.Row();
PdfUtil.Cell doctorCell = addCell(row2, "测评员:", 4, 1, 0);
doctorCell.setBorderBottom(null);
doctorCell.setBorderLeft(null);
PdfUtil.Cell dateCell = addCell(row2, "报告日期:", 4, 1, 0);
dateCell.setBorderBottom(null);
dateCell.setBorderLeft(null);
content.add(row2);
initLast(content, 8);
String path = PropUtil.imgDomain + "/" + PdfUtil.credatePdf(PropUtil.path, detail.getPatient().getHospital(), Constant.Ht.Report.PARENT_NAME, detail.getPatient().toPdfRow(), content, new PdfUtil.Margin());
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);
@ -431,12 +399,11 @@ public class PatientReportService implements IPatientReportService {
@Override
public PatientReportVo.Complete checkComplete(Long userId) {
PatientReportVo.Complete complete = htPatientReportDao.checkComplete(userId);
return complete;
return htPatientReportDao.checkComplete(userId);
}
@Override
public String generateQRCode(PatientReportDto.QueryDetail queryDetail, Long userId) throws IOException {
public String generateQrCode(PatientReportDto.QueryDetail queryDetail, Long userId) throws IOException {
log.info("报告单分享:{},用户ID:{}", queryDetail, userId);
HtPatientReport report = htPatientReportDao.selectByPrimaryKey(queryDetail.getId());
if (report == null) {
@ -491,15 +458,26 @@ public class PatientReportService implements IPatientReportService {
log.info("未查询到报告单");
return new PageInfo<>(reports);
}
reports.forEach(report -> {
report.setAuthority((byte)1);
});
reports.forEach(report -> report.setAuthority((byte)1));
return new PageInfo<>(reports);
}
@Override
public PageInfo<PatientReportVo.ReportName> queryAllReports(PatientReportDto.AdminQueryReport adminQueryReport, Long userId) {
PageHelper.startPage(adminQueryReport.getPageNum(), adminQueryReport.getPageSize());
List<PatientReportDto.Score> scores = adminQueryReport.getScores();
if (CollectionUtil.isNotEmpty(scores)) {
Iterator<PatientReportDto.Score> iterator = scores.iterator();
while (iterator.hasNext()) {
PatientReportDto.Score next = iterator.next();
if (next.getStart() == null && next.getEnd() == null) {
iterator.remove();
}
}
}
List<PatientReportVo.ReportName> reportNames = htPatientReportDao.queryAllReports(adminQueryReport);
return new PageInfo<>(reportNames);
}
@ -531,7 +509,7 @@ public class PatientReportService implements IPatientReportService {
}
byte prevAge = ages.get(ages.size() - 1);
PatientReportVo.AgeAndSexGroup prevGroup = groups.get(groups.size()-1);
byte nowAge = ageAndSex.getAgeLevel().byteValue();
byte nowAge = ageAndSex.getAgeLevel();
if (prevAge == nowAge) {
fillBySex(ageAndSex, prevGroup);
} else {
@ -564,8 +542,7 @@ public class PatientReportService implements IPatientReportService {
private void fillBySex(PatientReportVo.AgeAndSex ageAndSex, PatientReportVo.AgeAndSexGroup group) {
if (ageAndSex.getAgeLevel() == null) {
log.info("性别不确定");
return;
} else if (ageAndSex.getSex().byteValue() == Constant.Ht.SEX_MAN) {
} else if (ageAndSex.getSex()== Constant.Ht.SEX_MAN) {
group.setMan(ageAndSex);
} else {
group.setWoman(ageAndSex);
@ -610,5 +587,578 @@ public class PatientReportService implements IPatientReportService {
return new PageInfo<>(list);
}
@Override
public String export(PatientReportDto.ExportCode param, Long userId) {
// 详细试题
List<PdfUtil.Row> questionTable = new ArrayList<>();
if (Constant.Export.TITLE_MAP.containsKey(param.getCode())) {
List<PatientReportVo.QuestionAndAnswer> questionAndAnswerList = htPatientReportDao.queryQuestionAndScore(param.getId(), param.getCode());
// 几列试题
int cols = questionAndAnswerList.size() > 20 ? 2 : 1;
// 题目占几行
int questionSpan = 2;
// 表格头
initQuestionTitle(param.getCode(), cols, questionSpan, questionTable);
// 表格体
int rowNum = cols > 1 ? (questionAndAnswerList.size() + 1)/ 2 : questionAndAnswerList.size();
int optionSize = Constant.Export.TITLE_MAP.get(param.getCode()).optionList.size();
for (int i = 0; i < rowNum; i++) {
PatientReportVo.QuestionAndAnswer question = questionAndAnswerList.get(i);
PdfUtil.Row row = new PdfUtil.Row();
initQuestionBody(questionSpan, question, row, cols == 1, optionSize);
if (cols > 1) {
PatientReportVo.QuestionAndAnswer question2 = null;
if (rowNum + i < questionAndAnswerList.size()) {
question2 = questionAndAnswerList.get(rowNum + i);
}
initQuestionBody(questionSpan, question2, row, true, Constant.Export.TITLE_MAP.get(param.getCode()).optionList.size());
}
questionTable.add(row);
}
if (Constant.Ht.Report.ADL.equals(param.getCode())) {
List<PatientReportVo.ReportScore> reportScores = htPatientReportDao.queryReportScore2(param.getId(),param.getCode());
PdfUtil.Row row = new PdfUtil.Row();
addCell(row, "总分", questionSpan+1, 1);
int scoreSpan = 1+questionSpan + cols * optionSize;
String score = (reportScores.isEmpty() ? "" : reportScores.get(0).getScore() == null ? "" : reportScores.get(0).getScore().intValue()) + (reportScores.get(0).getTotalScore() > 0 ? "/" + reportScores.get(0).getTotalScore() : "");
PdfUtil.Cell scoreCell = addCell(row, score, scoreSpan, 1);
scoreCell.setBorderRight(1);
questionTable.add(row);
PdfUtil.Row tempRow = new PdfUtil.Row();
PdfUtil.Cell cell = addCell(tempRow, "仅供临床医生参考。", scoreSpan + questionSpan + 1, 1);
initLast(questionTable, scoreSpan + questionSpan + 1);
}
}
List<PdfUtil.Row> content = new ArrayList<>();
//查询报告单信息和病人信息
PatientReportVo.ReprotPatient reportPatient = htPatientReportDao.queryReportResult(param.getId());
if (reportPatient == null) {
throw new BaseException(CodeEnum.PARAM_ERROR);
}
//查询报告单分数
List<PatientReportVo.ReportScore> reportScores = htPatientReportDao.queryReportScore2(param.getId(),param.getCode());
if (!Constant.Ht.Report.ADL.equals(param.getCode())) {
getReportScores(param, content, reportScores, reportPatient);
}
String subHead = CollectionUtil.isEmpty(reportScores) ? "" : reportScores.get(0).getName() + "(" + reportScores.get(0).getCode() + ")报告单";
PdfUtil.Margin margin = new PdfUtil.Margin();
margin.setTop(24);
margin.setBottom(24);
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;
}
@Override
public Workbook exportAnalyse(List<Long> ids) {
List<PatientReportVo.Analyse> analyses = htPatientReportDao.queryReportAnalyseScore(ids);
int total = 124;
List<List< PoiUtil.PoiUtilCell >> 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<PoiUtil.PoiUtilCell> 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;
}
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<HtQuestion> htQuestions = htQuestionDao.selectByExample(questionExample);
if (CollectionUtil.isEmpty(htQuestions)) {
return null;
}
Long id = htQuestions.get(0).getId();
redisUtil.set(key, id);
return id;
}
/**
* 填充导出分析
* @param row 表格
* @param analyse 分析
*/
private void fillAnalyse(List<PoiUtil.PoiUtilCell> 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()));
// MMSE分数
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;
}
});
}
// 画钟
// 画钟题目ID
Long hzId = getQuestionId("HZ", 3);
QuestionDto.QueryPatientCanvas hzQuery = new QuestionDto.QueryPatientCanvas();
hzQuery.setPatientReportId(analyse.getId());
hzQuery.setQuestionId(hzId);
List<QuestionVo.PatientCanvas> patientCanvas = questionService.getCanvas(hzQuery, null);
if (CollectionUtil.isNotEmpty(patientCanvas)) {
Integer height = patientCanvas.get(0).getCanvas().getHeight();
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(), height) + "mm");
row.get(47).setValue(pxToMm(parameters.getLongLine(), height) + "mm");
row.get(51).setValue(pxToMm(parameters.getLongSpeed() * 1000, height) + "mm/s");
row.get(52).setValue(pxToSquare(parameters.getMinCircleAcreage().doubleValue(), height) + "mm²");
row.get(53).setValue(pxToMm(parameters.getShowCentreCoordinate().getX(), height) + "mm");
row.get(54).setValue(pxToMm(parameters.getShowCentreCoordinate().getY(), height) + "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, Integer height) {
return new BigDecimal(144).multiply(new BigDecimal(length)).divide(new BigDecimal(height), 2, BigDecimal.ROUND_HALF_UP).toString();
}
public String pxToSquare(double length, Integer height) {
return new BigDecimal(144 * 144).multiply(new BigDecimal(length)).divide(new BigDecimal(height * height), 2, BigDecimal.ROUND_HALF_UP).toString();
}
private void initSimple(List<PoiUtil.PoiUtilCell> row, PatientReportVo.Analyse analyse, Long simpleId, int startIndex) {
QuestionDto.QueryPatientCanvas simpleQuery = new QuestionDto.QueryPatientCanvas();
simpleQuery.setPatientReportId(analyse.getId());
simpleQuery.setQuestionId(simpleId);
List<QuestionVo.PatientCanvas> simpleCanvas = questionService.getCanvas(simpleQuery, null);
if (CollectionUtil.isNotEmpty(simpleCanvas)) {
QuestionVo.Parameter parameters = simpleCanvas.get(0).getParameters();
Integer height = simpleCanvas.get(0).getCanvas().getHeight();
// 完成总时间
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() + "");
row.get(startIndex + 5).setValue(pxToMm(parameters.getAveLength(), height) + "mm");
row.get(startIndex + 6).setValue(pxToMm(parameters.getLongLine(), height) + "mm");
row.get(startIndex + 8).setValue(pxToMm(parameters.getLongSpeed() * 1000, height) + "mm/s");
row.get(startIndex + 9).setValue(pxToSquare(parameters.getMinRectangleAcreage(), height) + "mm²");
row.get(startIndex + 10).setValue(pxToMm(parameters.getShowCentreCoordinate().getX(), height) + "mm");
row.get(startIndex + 11).setValue(pxToMm(parameters.getShowCentreCoordinate().getY(), height) + "mm");
row.get(startIndex + 12).setValue(pxToMm(parameters.getRight().getX(), height) + "mm");
row.get(startIndex + 13).setValue(pxToMm(parameters.getRight().getY(), height) + "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<List<PoiUtil.PoiUtilCell>> rows, int total) {
List<PoiUtil.PoiUtilCell> headRow = new ArrayList<>();
PoiUtil.PoiUtilCell headCell = new PoiUtil.PoiUtilCell();
headCell.setColspan(total);
headCell.setValue("认知功能神经心理量表检查报告单");
headRow.add(headCell);
rows.add(headRow);
log.info("标题:{}", headCell);
List<PoiUtil.PoiUtilCell> 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 < 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<PoiUtil.PoiUtilCell> 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总分"));
// 画钟
//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<PoiUtil.PoiUtilCell> 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<PatientReportVo.ReportScore> getReportScores(PatientReportDto.ExportCode param, List<PdfUtil.Row> content, List<PatientReportVo.ReportScore> reportScores, PatientReportVo.ReprotPatient reportPatient) {
long reportId = param.getId();
//重新封装报告单信息
List<PatientReportVo.ReportScore> scores = getReportScores(reportScores, reportId);
// 分数汇总
int colNum = Constant.Ht.Report.HAMD.equalsIgnoreCase(param.getCode()) ? 9 : 8;
scores.forEach(reportScore -> content.addAll(reportScore.toSingleRow()));
PdfUtil.Row row = new PdfUtil.Row();
int titleSpan = 2;
PdfUtil.Cell initWordCell = addCell(row, "初步印象", titleSpan, 2);
initWordCell.setHeight(PdfUtil.Cell.defaultHeight * 2);
String initialImpression = reportPatient.getInitialImpression();
PdfUtil.Cell initImplCell = addCell(row, "", colNum - titleSpan, 2);
initImplCell.setHeight(PdfUtil.Cell.defaultHeight * 2);
initImplCell.setBorderRight(1);
initImplCell.setCenter(false);
content.add(row);
PdfUtil.Row tempRow = new PdfUtil.Row();
PdfUtil.Cell cell = addCell(tempRow, "仅供临床医生参考。", colNum, 1);
initLast(content, colNum);
return scores;
}
private List<PatientReportVo.ReportScore> getReportScores(List<PatientReportVo.ReportScore> reportScores, long reportId) {
Map<String, PatientReportVo.ReportScore> map = new HashMap<>(32);
List<PatientReportVo.ReportScore> scores = new ArrayList<>();
reportScores.forEach(score -> {
if (ObjectUtil.isNotNull(score.getScore())) {
if (BigDecimal.valueOf(score.getScore().intValue()).compareTo(score.getScore()) == 0) {
score.setScore(score.getScore().setScale(0, BigDecimal.ROUND_HALF_UP));
}
}
map.put(score.getCode(), score);
//测评类(MOCA等)
if (Constant.Ht.Report.TYPE_EVALUATION == score.getType()) {
String specialCode = "NPI";
if (specialCode.equalsIgnoreCase(score.getCode())) {
initNPI(reportId, score);
}
scores.add(score);
} else {
log.info("score:{}", score);
map.get(score.getParentCode()).addSub(score);
}
});
scores.forEach(score -> {
if (Constant.Ht.Report.MOCA_SJZ.equalsIgnoreCase(score.getCode())) {
return;
}
sumScore(score);
});
return scores;
}
private void initQuestionBody(int questionSpan, PatientReportVo.QuestionAndAnswer question, PdfUtil.Row row, boolean isLast, int optionSize) {
addCell(row, question == null ? Constant.Ht.STRING_DEFAULT : String.valueOf(question.getSort()), 1, 1);
addCell(row, question == null ? Constant.Ht.STRING_DEFAULT : question.getQuestion(), questionSpan, 1);
if (question == null) {
for (int i = 0; i < optionSize; i++) {
PdfUtil.Cell cell = addCell(row, "", 1, 1);
cell.setBorderRight(isLast && i == optionSize - 1 ? 1 : 0);
}
return ;
}
int size = question.getOptionList().size();
for (int j = 0; j < size ; j++) {
String content = question.getOptionList().get(j).getChooseStatus() == 1 ? "√" : "--";
PdfUtil.Cell cell = addCell(row, content, 1, 1);
cell.setBorderRight(isLast && j == optionSize - 1 ? 1 : 0);
}
if (size >= optionSize) {
return;
}
for (int i = size; i < optionSize; i++) {
PdfUtil.Cell cell = addCell(row, "--", 1, 1);
cell.setBorderRight(isLast && i == optionSize - 1 ? 1 : 0);
}
}
/**
* 表格头
* @param code code
* @param cols 几列题目
* @param questionSpan 题目占几列
* @param questionTable 表格
*/
private void initQuestionTitle(String code, int cols, int questionSpan, List<PdfUtil.Row> questionTable) {
Constant.ReportExportTitle title = Constant.Export.TITLE_MAP.get(code);
// 检查目的
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);
if (StrUtil.isBlank(title.projectDesc)) {
addCell(row1, "项目", questionSpan, 2);
// addCell(row2, "", questionSpan, 1);
} else {
addCell(row1, title.projectDesc, questionSpan, 1);
addCell(row2, "项目", questionSpan, 1);
}
// 选项
PdfUtil.Cell optionDescCell = addCell(row1, title.optionDesc, title.optionList.size(), 1);
optionDescCell.setBorderRight(i == cols - 1 ? 1 : 0);
for (int j = 0; j < title.optionList.size() ; j++) {
PdfUtil.Cell optionCell = addCell(row2, title.optionList.get(j), 1, 1);
optionCell.setBorderRight(i == cols - 1 && j == title.optionList.size() - 1 ? 1 : 0);
}
}
questionTable.add(row1);
questionTable.add(row2);
}
private void initLast(List<PdfUtil.Row> content, int totalSpan) {
PdfUtil.Row row2 = new PdfUtil.Row();
PdfUtil.Cell doctorCell = addCell(row2, "测评员:", 4, 1, 0);
doctorCell.setBorderBottom(null);
doctorCell.setBorderLeft(null);
PdfUtil.Cell dateCell = addCell(row2, "报告日期:", totalSpan - 4, 1, 0);
dateCell.setBorderBottom(null);
dateCell.setBorderLeft(null);
content.add(row2);
}
}

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

@ -15,13 +15,14 @@ import com.ccsens.ht.persist.mapper.*;
import com.ccsens.ht.uitl.Constant;
import com.ccsens.util.*;
import com.ccsens.util.exception.BaseException;
import io.swagger.annotations.ApiModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import javax.script.ScriptEngine;
@ -66,6 +67,9 @@ public class QuestionService implements IQuestionService {
private HtPatientCanvasDao patientCanvasDao;
@Resource
private HtPatientCanvasLineMapper patientCanvasLineMapper;
@Resource
private HtPatientReportRecordDescDao htPatientReportRecordDescDao;
@ -74,22 +78,19 @@ public class QuestionService implements IQuestionService {
@Override
public QuestionVo.Query queryQuestion(QuestionDto.Query query, Long userId) {
log.info("请求参数:{},{}", query, userId);
//1.根据类型和题号,查询试题
HtQuestionExample questionExample = new HtQuestionExample();
questionExample.createCriteria().andEvaluationCodeEqualTo(query.getCode()).andSortEqualTo(query.getNum());
List<HtQuestion> questionList = htQuestionDao.selectByExample(questionExample);
log.info("测评试题:{}", questionList);
if (CollectionUtils.isEmpty(questionList)) {
//1.根据类型和题号,查询试题 和 补充内容
QuestionVo.Question questionVo = htQuestionDao.queryQuestionAndRecord(query.getCode(), query.getNum(), query.getPatientReportId());
if (questionVo == null) {
throw new BaseException(CodeEnum.QUESTION_NOT_FOUND);
}
HtQuestion question = questionList.get(0);
QuestionVo.Question questionVo = QuestionVo.Question.toQuestionVo(question);
//获取code信息及补充信息
QuestionVo.Report reportVo = htReportDao.queryReportAndRecord(questionVo.getParentCode(), query.getPatientReportId());
//检查当前试题是否有答案,共享答案的试题是否有答案
boolean f = false;
if(ObjectUtil.isNotNull(query.getPatientReportId())){
HtPatientScoreExample scoreExample = new HtPatientScoreExample();
scoreExample.createCriteria().andPatientReportIdEqualTo(query.getPatientReportId()).andQuestionIdEqualTo(question.getId())
scoreExample.createCriteria().andPatientReportIdEqualTo(query.getPatientReportId()).andQuestionIdEqualTo(questionVo.getId())
.andTypeBetween((byte)0,(byte)1);
if(htPatientScoreDao.countByExample(scoreExample) > 0){
f = true;
@ -99,7 +100,7 @@ public class QuestionService implements IQuestionService {
//查询可以共享答案的试题的id
List<Long> shareAnswerIds = new ArrayList<>();
List<QuestionVo.ShareAnswer> shareAnswers = htQuestionDao.queryShareAnswer(question.getId(),query.getPatientReportId());
List<QuestionVo.ShareAnswer> shareAnswers = htQuestionDao.queryShareAnswer(questionVo.getId(),query.getPatientReportId());
log.info("答案关联的试题id:{}", shareAnswers);
if(CollectionUtil.isNotEmpty(shareAnswers)){
for(QuestionVo.ShareAnswer shareAnswer : shareAnswers){
@ -118,53 +119,38 @@ public class QuestionService implements IQuestionService {
//获取评测信息
HtReportExample reportExample = new HtReportExample();
reportExample.createCriteria().andCodeEqualTo(question.getEvaluationCode());
List<HtReport> htReports = htReportDao.selectByExample(reportExample);
QuestionVo.Report reportVo = new QuestionVo.Report();
if (CollectionUtil.isNotEmpty(htReports)) {
HtReport htReport = htReports.get(0);
reportVo.setCode(htReport.getCode());
reportVo.setName(htReport.getName());
}
Integer maxSort = htQuestionDao.selectMaxSort(query.getCode());
//查询关联题目
if (!StringUtils.isEmpty(question.getRelationCode())) {
String[] codes = question.getRelationCode().split(Constant.COMMA);
HtQuestionExample example = new HtQuestionExample();
example.createCriteria().andParentCodeIn(CollectionUtils.arrayToList(codes));
example.setOrderByClause("id");
List<HtQuestion> relationQuestions = htQuestionDao.selectByExample(example);
List<QuestionVo.QuestionOption> vos = new ArrayList<>();
if (CollectionUtil.isNotEmpty(relationQuestions)) {
relationQuestions.forEach(relation -> {
//试题选项
List<QuestionVo.Option> options = htQuestionOptionDao.queryOption(relation.getId(), query.getPatientReportId());
QuestionVo.QuestionOption questionOption = QuestionVo.QuestionOption.toQuestionOption(relation, options);
vos.add(questionOption);
});
}
log.info("关联试题:{}", vos);
questionVo.setRelationQuestions(vos);
HtQuestionExample example = new HtQuestionExample();
example.createCriteria().andRelationIdEqualTo(questionVo.getId());
example.setOrderByClause("id");
List<HtQuestion> relationQuestions = htQuestionDao.selectByExample(example);
List<QuestionVo.QuestionOption> vos = new ArrayList<>();
if (CollectionUtil.isNotEmpty(relationQuestions)) {
relationQuestions.forEach(relation -> {
//试题选项
List<QuestionVo.Option> options = htQuestionOptionDao.queryOption(relation.getId(), query.getPatientReportId());
QuestionVo.QuestionOption questionOption = QuestionVo.QuestionOption.toQuestionOption(relation, options);
vos.add(questionOption);
});
}
log.info("关联试题:{}", vos);
questionVo.setRelationQuestions(vos);
//试题引导语
HtQuestionIntroducerExample introduceExample = new HtQuestionIntroducerExample();
introduceExample.createCriteria().andQuestionIdEqualTo(question.getId());
introduceExample.createCriteria().andQuestionIdEqualTo(questionVo.getId());
introduceExample.setOrderByClause("sort");
List<HtQuestionIntroducer> introduces = htQuestionIntroducerDao.selectByExample(introduceExample);
List<QuestionVo.Introduce> introduceVos = QuestionVo.Introduce.toIntroduces(introduces);
//试题选项
List<QuestionVo.Option> optionList = htQuestionOptionDao.queryOption(question.getId(), query.getPatientReportId());
List<QuestionVo.Option> optionList = htQuestionOptionDao.queryOption(questionVo.getId(), query.getPatientReportId());
//答题记录
List<QuestionVo.Record> recordVos;
if (query.getPatientReportId() != null && query.getPatientReportId() != 0) {
HtPatientQuestionRecordExample recordExample = new HtPatientQuestionRecordExample();
recordExample.createCriteria().andPatientReportIdEqualTo(query.getPatientReportId()).andQuestionIdEqualTo(question.getId());
recordExample.createCriteria().andPatientReportIdEqualTo(query.getPatientReportId()).andQuestionIdEqualTo(questionVo.getId());
recordExample.setOrderByClause("record_time");
List<HtPatientQuestionRecord> records = htPatientQuestionRecordMapper.selectByExample(recordExample);
recordVos = QuestionVo.Record.toRecords(records);
@ -202,7 +188,7 @@ public class QuestionService implements IQuestionService {
}
@Override
public CodeEnum saveScore(QuestionDto.Score score, Long userId) throws IOException, NotSupportedFileTypeException {
public CodeEnum saveScore(QuestionDto.Score score, Long userId) {
log.info("保存分数{}", score);
if (score.getPatientReportId() == null) {
@ -326,13 +312,18 @@ public class QuestionService implements IQuestionService {
private void saveAnswerRecord(QuestionDto.Score score, HtQuestion question) {
if (StrUtil.isNotBlank(score.getPath())) {
HtPatientQuestionRecordExample example = new HtPatientQuestionRecordExample();
String type = "";
String type;
switch (question.getOperateType()) {
case 1://语音
case 4://敲击
case Constant.Ht.Operation.VOICE://语音
case Constant.Ht.Operation.KNOCK://敲击
type = Constant.Ht.Record.ANSWER_AUDIO;
break;
case 2: //画图
case Constant.Ht.Operation.PAINT: //画图
case Constant.Ht.Operation.PAINT_HALF: //画图
case Constant.Ht.Operation.PAINT_HALF_IMG: //画图
case Constant.Ht.Operation.PAINT_NO_IMG: //画图
type = Constant.Ht.Record.ANSWER_IMG;
break;
default:
@ -412,7 +403,7 @@ public class QuestionService implements IQuestionService {
* @throws IOException
* @throws NotSupportedFileTypeException
*/
private List<HtPatientScore> getHtPatientScores(QuestionDto.Score score, HtQuestion question, HtPatientReport report, List<HtQuestionScoringRule> ruleList, Map<String, HtQuestionOption> nameOption, Map<Long, HtQuestionOption> idOption) throws IOException, NotSupportedFileTypeException {
private List<HtPatientScore> getHtPatientScores(QuestionDto.Score score, HtQuestion question, HtPatientReport report, List<HtQuestionScoringRule> ruleList, Map<String, HtQuestionOption> nameOption, Map<Long, HtQuestionOption> idOption) {
List<HtPatientScore> scores = new ArrayList<>();
for(QuestionDto.Option option : score.getOptions()) {
HtQuestionOption questionOption = idOption.get(option.getId());
@ -515,11 +506,14 @@ public class QuestionService implements IQuestionService {
if(CollectionUtil.isNotEmpty(param.getPoints())){
param.getPoints().forEach(point -> {
log.info("添加轨迹信息");
HtPatientCanvasLine patientCanvasLine = new HtPatientCanvasLine();
patientCanvasLine.setId(snowflake.nextId());
patientCanvasLine.setPatientCanvasId(patientCanvas.getId());
patientCanvasLine.setPoints(point);
patientCanvasLineMapper.insertSelective(patientCanvasLine);
if (StrUtil.isNotBlank(point)) {
HtPatientCanvasLine patientCanvasLine = new HtPatientCanvasLine();
patientCanvasLine.setId(snowflake.nextId());
patientCanvasLine.setPatientCanvasId(patientCanvas.getId());
patientCanvasLine.setPoints(point);
patientCanvasLineMapper.insertSelective(patientCanvasLine);
}
});
}
//查询轨迹信息
@ -571,7 +565,7 @@ public class QuestionService implements IQuestionService {
List<QuestionVo.Point> canvasPoints = getCanvasPoints(htPatientCanvas);
patientCanvas.setPoints(canvasPoints);
//计算参数
QuestionVo.Parameter parameter = getParameter(htPatientCanvas);
QuestionVo.Parameter parameter = getParameter(question, htPatientCanvas, param);
patientCanvas.setParameters(parameter);
canvasList.add(patientCanvas);
});
@ -611,12 +605,46 @@ public class QuestionService implements IQuestionService {
return canvasPoints;
}
/**
* 点位置
*/
private static class PointPosition{
/** 对应值 */
public int value;
/** 第几条线 */
public int line;
/** 第几个点 */
public int point;
public int x;
public int y;
public PointPosition(){}
public PointPosition(int value, int line, int point, int x, int y) {
this.value = value;
this.line = line;
this.point = point;
this.x = x;
this.y = y;
}
public void change(int value, int line, int point, int x, int y) {
this.value = value;
this.line = line;
this.point = point;
this.x = x;
this.y = y;
}
}
/**
* 统计画图的参数
*
* @param question
* @param htPatientCanvas 画板信息
* @param param 请求参数 参考长度 参考思考时间
* @return 返回此次画图的参数
*/
private QuestionVo.Parameter getParameter(HtPatientCanvas htPatientCanvas) {
private QuestionVo.Parameter getParameter(HtQuestion question, HtPatientCanvas htPatientCanvas, QuestionDto.QueryPatientCanvas param) {
QuestionVo.Parameter parameter = new QuestionVo.Parameter();
//开始画图时长:打开画板到第一笔画图时长
parameter.setStartDuration(htPatientCanvas.getBeginTime() - htPatientCanvas.getOpenCanvasTime());
@ -638,46 +666,78 @@ public class QuestionService implements IQuestionService {
//超出占比
parameter.setBeyondProportion(htPatientCanvas.getBeyondProportion());
//画图总时长
parameter.setTotalDuration(endTime);
parameter.setTotalDuration(endTime + parameter.getStartDuration());
//总笔画数
parameter.setLineNums(canvasPoints.size());
//共几分钟
double d = (double) endTime / 1000 / 60;
double d = (double) (parameter.getTotalDuration()) / 1000 / 60;
//每分钟几笔
parameter.setAveTimes((int) Math.round(canvasPoints.size() / d));
//每笔数据
List<QuestionVo.LineParameter> lineParameterList = new ArrayList<>();
long intervalDuration = 0;
// long intervalDuration = 0;
//最长的笔画
double longLine = 0;
int longIndex = 0;
//最短的笔画
double shortLine = 0;
int shortIndex = 0;
//思考总时间 每笔间隔相加
long reflectOnTime = 0;
// 落笔总时间(所有笔画绘图时间)
long paintTime = 0;
//X最小值
int minX = 0;
PointPosition minX = null;
//X最大值
int maxX = 0;
PointPosition maxX = null;
//Y最小值
int minY = 0;
PointPosition minY = null;
//Y最大值
int maxY = 0;
PointPosition maxY = null;
//总长度
double totalLength = 0;
for(QuestionVo.Point canvas : canvasPoints){
/**已经给最大最小点赋值*/
boolean hadValue = false;
for (int i = 0; i < canvasPoints.size(); i++) {
QuestionVo.Point canvas = canvasPoints.get(i);
//时间
QuestionVo.LineParameter lineParameter = new QuestionVo.LineParameter();
String[] a = canvas.getValue().split(";");
if(a.length <= 0){
continue;
}
//获取最边缘的四个点
for (String value : a) {
for (int j = 0; j < a.length ; j++) {
String value = a[j];
String[] split1 = value.split(",");
minX = Math.min(Integer.parseInt(split1[0]), minX);
maxX = Math.max(Integer.parseInt(split1[0]), maxX);
minY = Math.min(Integer.parseInt(split1[1]), minY);
maxY = Math.max(Integer.parseInt(split1[1]), maxY);
int x = Integer.parseInt(split1[0]);
int y = Integer.parseInt(split1[1]);
if (!hadValue) {
minX = new PointPosition(x, i, j, x, y);
maxX = new PointPosition(x, i, j, x, y);
minY = new PointPosition(y, i, j, x, y);
maxY = new PointPosition(y, i, j, x, y);
hadValue = true;
continue;
}
// 最大最小横坐标
if (minX.value > x) {
minX.change(x,i,j, x, y);
} else if (maxX.value < x) {
maxX.change(x,i,j, x, y);
}
// 最大最小纵坐标
if (minY.value > y) {
minY.change(y,i,j, x, y);
} else if (maxY.value < y) {
maxY.change(y,i,j, x, y);
}
}
String[] s = a[0].split(",");
if(s.length <= 0){
@ -697,13 +757,17 @@ public class QuestionService implements IQuestionService {
//计算最长最短
if(longLine == 0){
longLine = length;
longIndex = i;
}else if(length > longLine){
longLine = length;
longIndex = i;
}
if(shortLine == 0){
shortLine = length;
shortIndex = i;
}else if(length < shortLine){
shortLine = length;
shortIndex = i;
}
//速度
double speed = 0;
@ -711,64 +775,236 @@ public class QuestionService implements IQuestionService {
speed = BigDecimal.valueOf(length / duration).setScale(2, RoundingMode.HALF_UP).doubleValue();
}
lineParameter.setSpeed(speed);
// 落笔总时间
paintTime += Long.parseLong(e[e.length - 1]) - Long.parseLong(s[s.length - 1]);
//和上一笔的间隔 & 思考总时长
if(Long.parseLong(e[e.length - 1]) == 0){
lineParameter.setIntervalDuration(htPatientCanvas.getBeginTime() - htPatientCanvas.getOpenCanvasTime());
reflectOnTime += htPatientCanvas.getBeginTime() - htPatientCanvas.getOpenCanvasTime();
}else {
intervalDuration = Long.parseLong(e[e.length - 1]) - intervalDuration;
lineParameter.setIntervalDuration(intervalDuration);
reflectOnTime += intervalDuration;
// if(Long.parseLong(e[e.length - 1]) == 0){
// lineParameter.setIntervalDuration(htPatientCanvas.getBeginTime() - htPatientCanvas.getOpenCanvasTime());
// reflectOnTime += htPatientCanvas.getBeginTime() - htPatientCanvas.getOpenCanvasTime();
// }else {
// intervalDuration = Long.parseLong(e[e.length - 1]) - intervalDuration;
// lineParameter.setIntervalDuration(intervalDuration);
// reflectOnTime += intervalDuration;
// }
if (i == 0) {
lineParameter.setIntervalDuration(parameter.getStartDuration());
reflectOnTime += parameter.getStartDuration();
} else {
String[] prevPoints = canvasPoints.get(i - 1).getValue().split(";");
String prevEnd = prevPoints[prevPoints.length - 1].split(",")[2];
lineParameter.setIntervalDuration(Long.parseLong(s[s.length - 1]) - Long.parseLong(prevEnd));
reflectOnTime += lineParameter.getIntervalDuration();
}
lineParameterList.add(lineParameter);
}
parameter.setLineParameterList(lineParameterList);
//最长笔画
parameter.setLongLine(longLine);
//最短笔画
parameter.setShortLine(shortLine);
//思考总时长
parameter.setReflectOnTime(reflectOnTime);
//计算中心
int x = minX + ((maxX - minX) / 2);
int y = minY + ((maxY - minY) / 2);
// 落笔总时长
parameter.setPaintTime(paintTime);
// 计算原点(画板中心) 画板是否为canvas的一半
int canvasHeight = htPatientCanvas.getCanvasHeight();
int canvasWidth = htPatientCanvas.getCanvasWidth();
boolean half = question.getOperateType() == Constant.Ht.Operation.PAINT_HALF ||
question.getOperateType() == Constant.Ht.Operation.PAINT_HALF_IMG;
int centerX = half ? (canvasWidth / 2 + 30) / 2 : canvasWidth / 2;
int centerY = canvasHeight / 2;
log.info("画板中心:{},{}", centerX, centerY);
//计算图形中心
int x = (maxX.value + minX.value) / 2;
int y = (maxY.value + minY.value) / 2;
String centreCoordinate = x + "," + y;
parameter.setCentreCoordinate(centreCoordinate);
//面积
double acreage = (maxX - minX) * (maxY - minY);
parameter.setAcreage(acreage);
// TODO 重心
parameter.setBarycenterCoordinate(centreCoordinate);
//最小长方形面积
double acreage = (maxX.value - minX.value) * (maxY.value - minY.value);
parameter.setMinRectangleAcreage(acreage);
// 最小圆面积 距离中心最远点-->最小长方形长宽一半的平均数
double radius = ((double)(maxX.value - minX.value + maxY.value - minY.value)) /2 /2;
parameter.setMinCircleAcreage(new BigDecimal(Math.PI * radius * radius).setScale(2, BigDecimal.ROUND_HALF_UP));
// 四个边界点 四舍五入 sqrt
setFourPoint(canvasPoints, minX, maxX, minY, maxY);
log.info("half:{}",half);
if (half) {
parameter.setShowCentreCoordinate(new QuestionVo.Coordinate(y-centerY, x-centerX ));
// x:y, y:x
parameter.setTop(new QuestionVo.Coordinate(maxY.y - centerY, maxY.x - centerX ));
parameter.setBottom(new QuestionVo.Coordinate(minY.y - centerY, minY.x - centerX));
parameter.setLeft(new QuestionVo.Coordinate(minX.y - centerY, minX.x - centerX));
parameter.setRight(new QuestionVo.Coordinate(maxX.y - centerY, maxX.x - centerX));
} else {
parameter.setShowCentreCoordinate(new QuestionVo.Coordinate(centerX - x, y - centerY));
parameter.setTop(new QuestionVo.Coordinate(centerX - maxY.x , maxY.y - centerY));
parameter.setBottom(new QuestionVo.Coordinate(centerX - minY.x, minY.y - centerY));
parameter.setLeft(new QuestionVo.Coordinate(centerX - minX.x , minX.y - centerY));
parameter.setRight(new QuestionVo.Coordinate(centerX - maxX.x , maxX.y - centerY));
}
//平均长度
double aveLength = BigDecimal.valueOf(totalLength / canvasPoints.size()).setScale(2, RoundingMode.HALF_UP).doubleValue();
parameter.setAveLength(aveLength);
BigDecimal aveLength = BigDecimal.valueOf(totalLength / canvasPoints.size()).setScale(2, RoundingMode.HALF_UP);
BigDecimal aveReflectOnTime = BigDecimal.valueOf(reflectOnTime / canvasPoints.size()).setScale(2, RoundingMode.HALF_UP);
parameter.setAveLength(aveLength.doubleValue());
parameter.setAveReflectOnTime(aveReflectOnTime.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
//短笔画数量
double coefficient = 1.00;
int shortNums = getShortNums(aveLength,coefficient,lineParameterList);
parameter.setShortNums(shortNums);
BigDecimal referenceLength = param.getReferenceLength() != null && param.getReferenceLength().compareTo(new BigDecimal(0)) > 0 ? param.getReferenceLength() : aveLength;
BigDecimal referenceReflectOnTime = param.getReferenceReflectOnTime() != null && param.getReferenceReflectOnTime().compareTo(new BigDecimal(0)) > 0 ? param.getReferenceReflectOnTime() : aveReflectOnTime;
// 获取短笔画数量、快思考数量,计算并赋值最长最短笔画速度
Nums nums = getShortNums( referenceLength, referenceReflectOnTime, lineParameterList, longIndex, shortIndex, parameter);
parameter.setShortNums(nums.shortNums);
//长笔画数量,等于总笔画减去短笔画的数量
parameter.setLongNums(lineParameterList.size() - shortNums);
//TODO 笔画中间值
parameter.setLongNums(lineParameterList.size() - nums.shortNums);
parameter.setQuickNums(nums.quickNums);
parameter.setSlowNums(lineParameterList.size() - nums.quickNums);
return parameter;
}
/**
* 设置 四个特殊点计算中心点四个特殊点相对原点画板中心的距离 计算点到中心点距离的平方的最大值
* @param canvasPoints 记录
* @param minX 最左点
* @param maxX 最右点
* @param minY 最上点
* @param maxY 最下点
*/
private void setFourPoint(List<QuestionVo.Point> canvasPoints, PointPosition minX, PointPosition maxX, PointPosition minY, PointPosition maxY) {
// int max = 0;
for (int i = 0; i < canvasPoints.size(); i++) {
QuestionVo.Point point = canvasPoints.get(i);
if (StrUtil.isEmpty(point.getValue())) {
continue;
}
String[] pointArr = point.getValue().split(";");
if (pointArr == null || pointArr.length <= 0) {
continue;
}
//1左 2右 3 上 4 下
for (int j = 0; j < pointArr.length; j++) {
String s = pointArr[j];
if (StrUtil.isEmpty(s)) {
continue;
}
if (i == minX.line && j == minX.point) {
pointArr[j] += ",1";
} else if (i == maxX.line && j == maxX.point) {
pointArr[j] += ",2";
} else if (i == minY.line && j == minY.point) {
pointArr[j] += ",4";
} else if (i == maxY.line && j == maxY.point) {
pointArr[j] += ",3";
} else {
pointArr[j] += ",0";
}
String[] strArr = s.split(",");
if (strArr == null || strArr.length < 2) {
continue;
}
// int pointX = Integer.parseInt(strArr[0]);
// int pointY = Integer.parseInt(strArr[1]);
// max = (int) Math.max(max, Math.pow(pointX-x, 2) + Math.pow(pointY - y, 2));
}
point.setValue(StringUtils.join(pointArr, ";"));
}
// return max;
}
@ApiModel("短线和短时间思考数目")
private static class Nums{
public int shortNums;
public int quickNums;
}
/**
* 获取短笔画的数量
* @param aveLength 平均长度
* @param coefficient 自定义系数
* 标志线条为长/短线条 /慢思考
* 计算最长最短线条的速度
* 过渡时间在所有短-长笔画序列中画出一个短笔划后开始一个长笔划的总时间
* 5个早期长笔画的经过时间从点击开始绘图至前5个长笔画绘制完成
* 前5笔长笔画率前5个笔画中长笔画所占比率
* @param aveLength 参考长度
* @param referenceReflectOnTime 参考思考时间
* @param lineParameterList 所有笔画的参数
* @param longIndex 长笔画序号
* @param shortIndex 短笔画序号
* @param parameter 参数
* @return 返回短笔画的数量
*/
private int getShortNums(double aveLength, double coefficient, List<QuestionVo.LineParameter> lineParameterList) {
private Nums getShortNums(BigDecimal aveLength, BigDecimal referenceReflectOnTime, List<QuestionVo.LineParameter> lineParameterList, int longIndex, int shortIndex, QuestionVo.Parameter parameter) {
Nums nums = new Nums();
// 短笔画数
int shortNums = 0;
double a = aveLength * coefficient;
// 长笔画数
int quickNums = 0;
// 前5个长笔画的时间
int longLineCount = 5;
int longLineIndex = 0;
// 统计前5条线中长笔画的数量
int lineCount = 5;
int lineIndex = 0;
if(CollectionUtil.isNotEmpty(lineParameterList)){
for(QuestionVo.LineParameter lineParameter : lineParameterList){
if(lineParameter.getLength() <= a){
for (int i = 0; i < lineParameterList.size(); i++) {
QuestionVo.LineParameter lineParameter = lineParameterList.get(i);
// 长短笔画
if(aveLength.compareTo(new BigDecimal(lineParameter.getLength())) >= 0){
lineParameter.setLengthStatus(Constant.LineColour.LENGTH_STATUS_SHORT);
shortNums++;
} else {
// 长笔画
lineParameter.setLengthStatus(Constant.LineColour.LENGTH_STATUS_LONG);
// 判断前一笔是否是短笔画,如果是,计算过渡时间
if (i > 0 && lineParameterList.get(i-1).getLengthStatus() == Constant.LineColour.LENGTH_STATUS_SHORT) {
parameter.setTransitionTime(parameter.getTransitionTime() + lineParameter.getIntervalDuration());
}
longLineIndex++;
}
// 计算前5个长笔画的耗时
if (longLineIndex <= longLineCount) {
parameter.setFiveLongLinesTime(parameter.getFiveLongLinesTime() + lineParameter.getIntervalDuration() + lineParameter.getDuration());
}
// 快慢思考
if(referenceReflectOnTime.compareTo(new BigDecimal(lineParameter.getIntervalDuration())) >= 0){
lineParameter.setReflectOnStatus(Constant.LineColour.REFLECT_ON_STATUS_QUICK);
quickNums++;
} else {
lineParameter.setReflectOnStatus(Constant.LineColour.REFLECT_ON_STATUS_SLOW);
}
// 最长/短笔画速度
if (longIndex == i) {
parameter.setLongSpeed(lineParameter.getSpeed());
}
if (shortIndex == i) {
parameter.setShortSpeed(lineParameter.getSpeed());
}
lineIndex++;
// 第5条线时,计算长线段的比例
if (lineIndex == lineCount) {
parameter.setLongLineRate(new BigDecimal(longLineIndex * 100).divide(new BigDecimal(lineCount)));
}
}
}
return shortNums;
nums.shortNums = shortNums;
nums.quickNums = quickNums;
return nums;
}
private double getLengthByCanvas(String[] canvas) {
@ -796,4 +1032,39 @@ public class QuestionService implements IQuestionService {
});
}
}
@Override
public void saveRecord(QuestionDto.Record batchRecordMsg, Long userId) {
if (batchRecordMsg == null || CollectionUtil.isEmpty(batchRecordMsg.getDetails())) {
return;
}
// 删除原有答案
List<Long> recordIds = new ArrayList<>();
List<HtPatientReportRecordDesc> records = new ArrayList<>();
batchRecordMsg.getDetails().forEach(detail -> {
recordIds.add(detail.getRecordId());
if (CollectionUtil.isEmpty(detail.getAnswers())) {
return;
}
detail.getAnswers().forEach(answer -> {
HtPatientReportRecordDesc recordDesc = new HtPatientReportRecordDesc();
recordDesc.setId(snowflake.nextId());
recordDesc.setPatientReportId(batchRecordMsg.getPatientReportId());
recordDesc.setRecordId(detail.getRecordId());
recordDesc.setAnswer(answer);
records.add(recordDesc);
});
});
HtPatientReportRecordDescExample recordDescExample = new HtPatientReportRecordDescExample();
recordDescExample.createCriteria().andPatientReportIdEqualTo(batchRecordMsg.getPatientReportId())
.andRecordIdIn(recordIds).andIsDelEqualTo(Constant.Ht.NO_DEL);
HtPatientReportRecordDesc update = new HtPatientReportRecordDesc();
update.setIsDel(Constant.Ht.IS_DEL);
htPatientReportRecordDescDao.updateByExampleSelective(update, recordDescExample);
log.info("删除其他记录答案:{},{}", recordIds, batchRecordMsg.getPatientReportId());
// 保存新答案
htPatientReportRecordDescDao.batchSave(records);
log.info("保存新答案");
}
}

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

@ -1,6 +1,6 @@
package com.ccsens.ht.uitl;
import com.ccsens.util.PropUtil;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.ArrayList;
@ -23,8 +23,79 @@ public class Constant {
/**上传图片访问路径*/
public static final String UPLOAD_URL = "uploads/";
/**导入相关*/
public static final class Import{
public final static String EVALUATION_RECORD = "其他记录";
public final static String EVALUATION_QUESTION = "题目";
public final static String EVALUATION_OPTION = "选项";
public final static String EVALUATION_RELATION = "关联题目";
public final static String EVALUATION_PARSE = "解析";
public final static String EVALUATION_RULE = "规则";
public final static String RELATION_OPTION = "option";
public static final String RELATION_OPTION_SORT = "sort";
public static final String OPTION_DESC = "desc";
}
public static final class Export{
public final static Map<String, ReportExportTitle> TITLE_MAP = new HashMap<>();
static {
TITLE_MAP.put("HAMA", new ReportExportTitle("检查目的:用于焦虑症的诊断及程度划分的依据。",
"近一周内", "圈出最符合病人情况的分数",
"无(0)","轻度(1)","中度(2)","重度(3)","极重度(4)"));
TITLE_MAP.put("HAMD", new ReportExportTitle("检查目的:临床评定抑郁状态。",
"", "圈出最符合病人情况的分数",
"无(0)","轻度(1)","中度(2)","重度(3)","极重度(4)"));
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{
@ApiModelProperty("检查目的")
public String checkPurpose;
@ApiModelProperty("项目描述")
public String projectDesc;
@ApiModelProperty("选项描述")
public String optionDesc;
@ApiModelProperty("选项描述")
public List<String> optionList = new ArrayList<>();
public ReportExportTitle() {
}
public ReportExportTitle(String checkPurpose, String projectDesc, String optionDesc, String... options) {
this.checkPurpose = checkPurpose;
this.projectDesc = projectDesc;
this.optionDesc = optionDesc;
if (options == null || options.length <= 0) {
return;
}
for (String option: options) {
this.optionList.add(option);
}
}
public List<String> addOption(String option) {
optionList.add(option);
return optionList;
}
}
/**病友画图轨迹颜色*/
public static final class LineColour {
public final static byte LENGTH_STATUS_SHORT = 0;
public final static byte LENGTH_STATUS_LONG = 1;
public final static byte REFLECT_ON_STATUS_QUICK = 0;
public final static byte REFLECT_ON_STATUS_SLOW = 1;
public final static List<Integer> COLOUR = new ArrayList<>();
static {
COLOUR.add(0);
@ -44,6 +115,7 @@ public class Constant {
/**
* 医疗职称相关常量
*/
@ -58,9 +130,77 @@ 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 final static byte NO_DEL = 0;
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;
public static final byte RECORD_TYPE_QUESTION = 1;
}
public final static class Operation {
//用户操作类型(0无,1语音,2画图,3.画图显示中线和图形,4敲击,5画图不显示图形,6画图只显示中线)
/**画图*/
public final static byte VOICE = 1;
/**画图*/
public final static byte PAINT = 2;
/**画图显示中线和图形*/
public final static byte PAINT_HALF_IMG = 3;
/**画图显示中线和图形*/
public final static byte KNOCK = 4;
/**画图显示中线和图形*/
public final static byte PAINT_NO_IMG = 5;
/**画图只显示中线*/
public final static byte PAINT_HALF = 6;
}
public final static class Rule {
public static final byte SMALL = 0;
public static final String SMALL_NUM = "small";
@ -127,10 +267,13 @@ public class Constant {
public static class Report{
public final static String PARENT_CODE = "REPORT1.0";
public final static String PARENT_NAME = "认知功能神经心理量表检查报告单";
public final static Byte TYPE_EVALUATION = 2;
public final static byte TYPE_EVALUATION = 2;
public final static String IGNORE_SCORE = "[个]";
public final static String MOCA_SJZ = "SZJ";
public final static String MOCA = "MoCA";
public final static String HAMD = "HAMD";
public static final String HAMA = "HAMA";
public static final String ADL = "ADL";
public final static String MMSE = "MMSE";
public final static String NPI = "NPI";
public final static String REY = "Rey";
@ -142,9 +285,15 @@ public class Constant {
/**忽略报告单*/
public final static Byte COMPLETE_IGNORE = 2;
/**在历史报告单中显示*/
public final static byte SHOW_HISTORY = 1;
public final static Map<String, Byte> TYPE = new HashMap<>();
static {
//1:报告单 2:测评 3:测评子类 4:二级子类
TYPE.put("报告单",(byte)1);

3
ht/src/main/resources/application-dev.yml

@ -8,7 +8,8 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:
host: 127.0.0.1
host: 192.168.31.13
# host: 127.0.0.1
password: 111111
port: 5672
username: admin

2
ht/src/main/resources/application-prod.yml

@ -39,4 +39,4 @@ ht:
name: 认知功能评测云平台系统
eureka:
instance:
ip-address: 81.70.54.64
ip-address: 119.3.214.36

34
ht/src/main/resources/application-test.yml

@ -7,23 +7,23 @@ spring:
name: ht
datasource:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:
host: 127.0.0.1
password: 111111
port: 5672
username: admin
redis:
database: 0
host: 127.0.0.1
jedis:
pool:
max-active: 200
max-idle: 10
max-wait: -1ms
min-idle: 0
password: ''
port: 6379
timeout: 1000ms
rabbitmq:
host: 127.0.0.1
password: guest
port: 5672
username: guest
redis:
database: 0
host: 127.0.0.1
jedis:
pool:
max-active: 200
max-idle: 10
max-wait: -1ms
min-idle: 0
password: ''
port: 6379
timeout: 1000ms
swagger:

3
ht/src/main/resources/application.yml

@ -1,4 +1,5 @@
spring:
profiles:
active: prod
include: common, util-prod
include: common, util-prod

4
ht/src/main/resources/druid-prod.yml

@ -15,7 +15,7 @@ spring:
maxWait: 60000
minEvictableIdleTimeMillis: 300000
minIdle: 5
password:
password: b3fd300ad4694070007fdcca961c4018211dc53235dd806ad62abc0cc0abb8e5
poolPreparedStatements: true
servletLogSlowSql: true
servletLoginPassword: 111111
@ -27,7 +27,7 @@ spring:
testOnReturn: false
testWhileIdle: true
timeBetweenEvictionRunsMillis: 60000
url: jdbc:mysql://127.0.0.1/ht?useUnicode=true&characterEncoding=UTF-8
url: jdbc:mysql://www.tall.wiki/ht?useUnicode=true&characterEncoding=UTF-8
username: root
validationQuery: SELECT 1 FROM DUAL
env: CCSENS_HT

207
ht/src/main/resources/mapper_dao/HtPatientReportDao.xml

@ -37,6 +37,40 @@
<result column="type" jdbcType="TINYINT" property="type"/>
<result column="score" jdbcType="INTEGER" property="score"/>
</resultMap>
<resultMap id="QuestionMap" type="com.ccsens.ht.bean.vo.PatientReportVo$QuestionAndAnswer">
<id column="id" property="id"/>
<result column="question" property="question"/>
<result column="sort" property="sort"/>
<collection property="optionList" ofType="com.ccsens.ht.bean.vo.PatientReportVo$Option">
<id column="optionId" property="id"/>
<result column="name" property="name"/>
<result column="answer" property="answer"/>
<result column="chooseStatus" property="chooseStatus"/>
</collection>
</resultMap>
<resultMap id="AnalyseMap" type="com.ccsens.ht.bean.vo.PatientReportVo$Analyse">
<id column="id" property="id"/>
<result column="report_time" property="reportTime"/>
<result column="patientName" property="patientName"/>
<result column="patient_age" property="patientAge"/>
<result column="pasi" property="pasi"/>
<result column="clinical_diagnosis" property="clinicalDiagnosis"/>
<result column="sex" property="sex"/>
<result column="educational_status" property="educationalStatus"/>
<result column="career" property="career"/>
<collection property="mmseScores" ofType="com.ccsens.ht.bean.vo.PatientReportVo$MMSEScore">
<id column="mmseCode" property="code"/>
<result column="mmseScore" property="score"/>
</collection>
<collection property="mocaScores" ofType="com.ccsens.ht.bean.vo.PatientReportVo$MoCAScore">
<id column="mocaSort" property="sort"/>
<result column="mocaScore" property="score"/>
</collection>
<collection property="totalScores" ofType="com.ccsens.ht.bean.vo.PatientReportVo$TotalScore">
<id column="evaluationCode" property="evaluationCode"/>
<result column="totalScore" property="totalScore"/>
</collection>
</resultMap>
<select id="queryReportResult" resultMap="BaseResultMap">
select r.*, d.name as doctor_name, p.name as patient_name, p.sex, p.educational_status, p.educational_status_unit, p.career, p.hospital_number, p.patient_number
@ -47,24 +81,32 @@
<select id="queryReportScore" resultMap="ScoreMap">
select t1.code,t1.name, t1.description, t1.total_score, t1.remark,t1.type,t1.parent_code, sum(t2.score) as score
from
(select code,name, description, total_score, remark, type, parent_code, sort from t_ht_report
where is_show = 1 and is_del = 0
<if test="rey == 1">
and `code` != 'Rey' and `code` != 'XFXPD' and parent_code != 'Rey'
</if>
(
select code,name, description, total_score, remark, type, parent_code, sort from (
select t1.*, if (find_in_set(t1.parent_code, @pcode) > 0, @pcode := concat(@pcode,',',t1.code) ,0 )as ischild
from
(select * from t_ht_report where is_show = 1 and is_del = 0
<if test="rey == 1">
and `code` != 'Rey' and `code` != 'XFXPD' and parent_code != 'Rey'
</if>
<if test="rey == 2">
AND (`code` = 'Rey' or parent_code = 'Rey')
</if>
ORDER BY type, sort) t1 ,
(select @pcode:=#{report} ) t2
) t where ischild != '0'
) t1
left join t_ht_question q on t1.code = q.parent_code and q.is_del = 0
left join t_ht_patient_score t2
on t1.code = t2.question_parent_code and
on q.id = t2.question_id and
(
(t2.patient_report_id = #{id, jdbcType=BIGINT} and t2.type in (0,2) and t2.is_del = 0) or t2.id is null
)
GROUP BY t1.code
order by t1.type,t1.sort
</select>
<select id="queryNPIScore" resultType="java.util.Map">
<select id="queryNpiScore" resultType="java.util.Map">
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'
@ -101,9 +143,36 @@
order by create_time desc
</select>
<select id="queryAllReports" resultType="com.ccsens.ht.bean.vo.PatientReportVo$ReportName">
select r.id, r.name, r.url, r.doctor_id as doctorId, 1 as authority
select t.* from
(select r.id, r.name, r.url, r.doctor_id as doctorId, 1 as authority, r.create_time
<if test="scores != null and scores.size() > 0">
,
SUM(CASE report.code WHEN 'moca' THEN s.score ELSE 0 END) as 'moca',
SUM(CASE report.code WHEN 'mmse' THEN s.score ELSE 0 END) as 'mmse',
SUM(CASE report.code WHEN 'rey' THEN s.score ELSE 0 END) as 'rey',
SUM(CASE report.code WHEN 'hama' THEN s.score ELSE 0 END) as 'hama',
SUM(CASE report.code WHEN 'hamd' THEN s.score ELSE 0 END) as 'hamd',
SUM(CASE report.code WHEN 'adl' THEN s.score ELSE 0 END) as 'adl',
SUM(CASE report.code WHEN 'npi' THEN s.score ELSE 0 END) as 'npi'
</if>
from t_ht_patient_report r, t_ht_patient p
<if test="scores != null and scores.size() > 0">
,
t_ht_report report,
t_ht_question q,
t_ht_patient_score s
</if>
where r.patient_id = p.id
<if test="scores != null and scores.size() > 0">
AND r.id = s.patient_report_id
AND report.CODE = q.evaluation_code
AND q.id = s.question_id
AND report.type = 2
AND s.type IN ( 0, 2 )
</if>
<if test="patientName != null and patientName != ''">
and p.name = #{patientName}
</if>
<if test="patientSex != null">
and p.sex = #{patientSex}
</if>
@ -116,9 +185,18 @@
<if test="clinicalDiagnosis != null and clinicalDiagnosis != ''">
and r.clinical_diagnosis = #{clinicalDiagnosis}
</if>
<if test="pasi != null">
<if test="pasi != null and pasi != ''">
and r.pasi = #{pasi}
</if>
<if test="educationalStatus != null and educationalStatus != ''">
and p.educational_status = #{educationalStatus}
</if>
<if test="startEducationalStatusUnit != null">
and p.educational_status_unit &gt;= #{startEducationalStatusUnit}
</if>
<if test="endEducationalStatusUnit != null">
and p.educational_status_unit &lt;= #{endEducationalStatusUnit}
</if>
<if test="startTime != null">
and r.report_time &gt;= #{startTime}
</if>
@ -126,8 +204,22 @@
and r.report_time &lt;= #{endTime}
</if>
and r.show_status = 1
AND r.complete_status = 1
and r.is_del = 0
order by r.create_time desc
group by r.id
) t
where 1=1
<if test="scores != null and scores.size() > 0">
<foreach collection="scores" item="score">
<if test="score.start != null">
AND ${score.code} &gt;= #{score.start}
</if>
<if test="score.end != null">
AND ${score.code} &lt;= #{score.end}
</if>
</foreach>
</if>
order by create_time desc
</select>
<select id="countByClinicalDiagnosis" resultType="com.ccsens.ht.bean.vo.PatientReportVo$ClinicalDiagnosis">
select clinical_diagnosis as diagnosis, count(*) as count from t_ht_patient_report
@ -256,6 +348,101 @@
</foreach>
</select>
<select id="queryReportScore2" resultMap="ScoreMap">
select t1.code,t1.name, t1.description, t1.total_score, t1.remark,t1.type,t1.parent_code, sum(t2.score) as score
from
(
select code,name, description, total_score, remark, type, parent_code, sort from (
select t1.*, if (find_in_set(t1.parent_code, @pcode) > 0 or t1.code = @pcode, @pcode := concat(@pcode,',',t1.code) ,0 )as ischild
from
(select * from t_ht_report where is_show = 1 and is_del = 0
ORDER BY type, sort) t1 ,
(select @pcode:=#{code} ) t2
) t where ischild != '0'
) t1
left join t_ht_question q on t1.code = q.parent_code and q.is_del = 0
left join t_ht_patient_score t2
on q.id = t2.question_id and
(
(t2.patient_report_id = #{id, jdbcType=BIGINT} and t2.type in (0,2) and t2.is_del = 0) or t2.id is null
)
GROUP BY t1.code
order by t1.type,t1.sort
</select>
<select id="queryQuestionAndScore" resultMap="QuestionMap">
SELECT
q.id,
q.question,
q.sort,
o.id AS optionId,
o.NAME,
IF( s.id IS NULL, 0, 1 ) AS chooseStatus,
s.answer
FROM
( SELECT * FROM t_ht_question WHERE evaluation_code = #{code} AND is_del = 0 ) q
LEFT JOIN t_ht_question_option o ON q.id = o.question_id
AND o.is_del = 0
LEFT JOIN t_ht_patient_score s ON q.id = s.question_id
AND o.id = s.option_id
AND s.is_del = 0
AND s.patient_report_id = #{id}
ORDER BY
q.sort,
o.sort
</select>
<select id="queryReportAnalyseScore" resultMap="AnalyseMap">
select * from
-- 患者信息
(select r.id, r.patient_age, r.pasi, r.clinical_diagnosis, p.sex, p.educational_status, p.career, r.report_time, p.name as patientName from t_ht_patient_report r , t_ht_patient p where r.patient_id = p.id and r.id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
and r.is_del = 0 and p.is_del = 0) report
left join
-- MMSE 分数
(select s.patient_report_id as mmseReportId, t.code as mmseCode, sum(s.score) as mmseScore from
(
select if(r.parent_code = 'MMSE', r.code, r.parent_code) as code, q.id from
(
select code, parent_code from
(
select code, parent_code, if(FIND_IN_SET(parent_code,@pcode), @pcode := concat(@pcode,',',code),'') as pcode from
t_ht_report,
(select @pcode := 'MMSE') t
where is_del = 0
) r where pcode != ''
) r, t_ht_question q where (q.parent_code = r.code or q.parent_code = r.parent_code) and q.is_del = 0
) t left join t_ht_patient_score s
on t.id = s.question_id and s.is_del = 0 and s.patient_report_id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
and s.type in (0, 2)
group by s.patient_report_id, t.code) mmse
on report.id = mmse.mmseReportId
left join
-- MOCA
(select s.patient_report_id as mocaReportId, q.sort as mocaSort, sum(s.score) as mocaScore from
(select * from t_ht_question where evaluation_code = 'MOCA' AND is_del = 0) q
left join t_ht_patient_score s on q.id = s.question_id and s.patient_report_id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
and s.type in (0, 2)
and s.is_del = 0
group by s.patient_report_id,q.sort
) moca
on report.id = moca.mocaReportId
left join
-- 总成绩
(select q.evaluation_code as evaluationCode, s.patient_report_id as scoreReportId, sum(s.score) as totalScore from t_ht_question q left join t_ht_patient_score s on q.id = s.question_id and s.is_del = 0 where q.is_del = 0 and s.patient_report_id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
group by q.evaluation_code, s.patient_report_id) score
on report.id = score.scoreReportId
</select>
</mapper>

12
ht/src/main/resources/mapper_dao/HtPatientReportRecordDescDao.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ht.persist.dao.HtPatientReportRecordDescDao">
<insert id="batchSave">
insert into t_ht_patient_report_record_desc(id, patient_report_id, record_id, answer) values
<foreach collection="list" item="item" separator=",">
(#{item.id}, #{item.patientReportId}, #{item.recordId}, #{item.answer})
</foreach>
</insert>
</mapper>

120
ht/src/main/resources/mapper_dao/HtQuestionDao.xml

@ -1,32 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ht.persist.dao.HtQuestionDao">
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.po.HtQuestion">
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.vo.QuestionVo$Question">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="evaluation_code" jdbcType="VARCHAR" property="evaluationCode" />
<result column="parent_code" jdbcType="VARCHAR" property="parentCode" />
<result column="evaluationCode" jdbcType="VARCHAR" property="evaluationCode" />
<result column="parentCode" jdbcType="VARCHAR" property="parentCode" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="question" jdbcType="VARCHAR" property="question" />
<result column="type" jdbcType="TINYINT" property="type" />
<result column="record_type" jdbcType="VARCHAR" property="recordType" />
<result column="record_content" jdbcType="VARCHAR" property="recordContent" />
<result column="relation_code" jdbcType="VARCHAR" property="relationCode" />
<result column="operate_type" jdbcType="TINYINT" property="operateType" />
<result column="recode_starttime" jdbcType="TINYINT" property="recodeStarttime" />
<result column="time_wabei" jdbcType="TINYINT" property="timeWabei" />
<result column="allow_clear" jdbcType="TINYINT" property="allowClear" />
<result column="clear_times" jdbcType="INTEGER" property="clearTimes" />
<result column="timing_length" jdbcType="INTEGER" property="timingLength" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_del" jdbcType="TINYINT" property="isDel" />
<result column="recordType" jdbcType="VARCHAR" property="recordType" />
<result column="recordContent" jdbcType="VARCHAR" property="recordContent" />
<result column="operateType" jdbcType="TINYINT" property="operateType" />
<result column="recodeStarttime" jdbcType="TINYINT" property="recodeStarttime" />
<result column="timeWabei" jdbcType="TINYINT" property="timeWabei" />
<result column="allowClear" jdbcType="TINYINT" property="allowClear" />
<result column="clearTimes" jdbcType="INTEGER" property="clearTimes" />
<result column="timingLength" jdbcType="INTEGER" property="timingLength" />
<collection property="questionRecords" ofType="com.ccsens.ht.bean.vo.QuestionVo$QuestionRecord">
<id column="rid" property="id"></id>
<result column="rCalcType" property="calcType"/>
<result column="rShowTitle" property="showTitle"/>
<result column="rShowForm" property="showForm"/>
<result column="rDefaultValue" property="defaultValue"/>
<result column="rType" property="type"/>
<result column="rRemark" property="remark"/>
<collection property="answers" ofType="String">
<id column="answer"/>
</collection>
<collection property="options" ofType="com.ccsens.ht.bean.vo.QuestionVo$RecordOption">
<id column="optionId" property="id"/>
<result column="dataKey" property="dataKey"/>
<result column="dataValue" property="dataValue"/>
</collection>
</collection>
</resultMap>
<insert id="insertBatch" parameterType="List">
<insert id="insertBatch" parameterType="java.util.List">
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,
@ -36,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},
<choose>
<when test="question.relationId == null">
0,
</when>
<otherwise>
#{question.relationId},
</otherwise>
</choose>
#{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 )
@ -60,4 +80,68 @@
r.question_id = #{questionId}
GROUP BY r.relevance_id
</select>
<select id="queryQuestionAndRecord" resultMap="BaseResultMap">
SELECT
*
FROM
(
SELECT
q.id,
q.evaluation_code AS evaluationCode,
q.parent_code AS parentCode,
q.sort,
q.question,
q.type,
q.record_type AS recordType,
q.record_content AS recordContent,
q.operate_type AS operateType,
q.recode_starttime AS recodeStarttime,
q.time_wabei AS timeWabei,
q.allow_clear AS allowClear,
q.clear_times AS clearTimes,
q.timing_length AS timingLength
FROM
t_ht_question q
WHERE
q.evaluation_code = #{code}
AND q.sort = #{num}
AND q.relation_id = 0
AND q.is_del = 0
LIMIT 1
) q
LEFT JOIN (
SELECT
r.id AS rId,
r.question_id,
r.calc_type AS rCalcType,
r.show_title AS rShowTitle,
r.show_form AS rShowForm,
r.default_value AS rDefaultValue,
r.type AS rType,
r.remark AS rRemark,
qr.answer
FROM
( SELECT * FROM t_ht_question_record WHERE record_type = 1 AND is_del = 0 ) r
LEFT JOIN ( SELECT * FROM t_ht_patient_report_record_desc WHERE
<choose>
<when test="patientReportId != null and patientReportId != 0">
patient_report_id = #{patientReportId} AND is_del = 0
</when>
<otherwise>
1=2
</otherwise>
</choose>
) qr ON r.id = qr.record_id
ORDER BY
r.question_id,
r.sort
) r ON q.id = r.question_id
left join
(select id as optionId,
data_key as dataKey,
data_value as dataValue,
question_record_id from t_ht_question_record_option where is_del = 0) o
on r.rId = o.question_record_id
</select>
</mapper>

15
ht/src/main/resources/mapper_dao/HtQuestionOptionDao.xml

@ -23,9 +23,14 @@
<result column="display" jdbcType="VARCHAR" property="display" />
<result column="choose" jdbcType="TINYINT" property="choose" />
<result column="answer" jdbcType="VARCHAR" property="answer" />
<collection property="optionDescList" ofType="com.ccsens.ht.bean.vo.QuestionVo$OptionDesc">
<id column="descId" property="id"/>
<result column="descType" property="type"/>
<result column="content" property="content"/>
</collection>
</resultMap>
<insert id="insertBatch" parameterType="List">
<insert id="insertBatch" parameterType="java.util.List">
replace into t_ht_question_option (id, question_id, sort,
type, name, score,
display, remark, create_time,
@ -41,11 +46,15 @@
<select id="queryOption" resultMap="OptionMap">
select t1.id, t1.type, t1.question_id, t1.name, t1.score, t1.display, case when t1.type = 'hidden' then 0 when t2.id is null then 0 else 1 end as choose , if(t2.type = 3, null, t2.answer) as answer
select t1.id, t1.type, t1.question_id, t1.name, t1.score, t1.display,
case when t1.type = 'hidden' then 0 when t2.id is null then 0 else 1 end as choose ,
if(t2.type = 3, null, t2.answer) as answer,
t3.id as descId, t3.type as descType, t3.content
from t_ht_question_option t1 left join t_ht_patient_score t2 on t1.id = t2.option_id and (t2.id is null or (t2.patient_report_id = #{patientReportId,jdbcType=BIGINT} and t2.is_del = 0))
left join (select * from t_ht_question_option_desc where is_del = 0) t3 on t1.id = t3.option_id
where t1.question_id = #{questionId,jdbcType=BIGINT}
and t1.is_del = 0
group by t1.id
order by t1.sort
order by t1.sort, t3.sort
</select>
</mapper>

21
ht/src/main/resources/mapper_dao/HtQuestionOptionDescDao.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ht.persist.dao.HtQuestionOptionDescDao">
<insert id="insertBatch">
replace into t_ht_question_option_desc (id, option_id, type,
sort, content, remark)
values
<foreach collection="list" item="item" separator=",">
(#{item.id}, #{item.optionId}, #{item.type}, #{item.sort},
#{item.content}, #{item.remark})
</foreach>
</insert>
<delete id="delete">
update t_ht_question_option_desc set rec_status = 0 where option_id in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</delete>
</mapper>

16
ht/src/main/resources/mapper_dao/HtQuestionRecordDao.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ht.persist.dao.HtQuestionRecordDao">
<insert id="insertBatch">
replace into t_ht_question_record (id, record_type, question_id,
sort, calc_type, show_title, show_form, default_value, type, remark)
values
<foreach collection="list" item="item" separator=",">
(#{item.id}, #{item.recordType}, #{item.questionId}, #{item.sort},
#{item.calcType}, #{item.showTitle}, #{item.showForm}, #{item.defaultValue},
#{item.type}, #{item.remark})
</foreach>
</insert>
</mapper>

14
ht/src/main/resources/mapper_dao/HtQuestionRecordOptionDao.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ht.persist.dao.HtQuestionRecordOptionDao">
<insert id="insertBatch">
replace into t_ht_question_record_option (id, question_record_id, sort, data_key, data_value, remark)
values
<foreach collection="list" item="item" separator=",">
(#{item.id}, #{item.questionRecordId}, #{item.sort}, #{item.dataKey},
#{item.dataValue}, #{item.remark})
</foreach>
</insert>
</mapper>

64
ht/src/main/resources/mapper_dao/HtReportDao.xml

@ -1,23 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ht.persist.dao.HtReportDao">
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.po.HtReport">
<id column="id" jdbcType="BIGINT" property="id" />
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.vo.QuestionVo$Report">
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="parent_code" jdbcType="VARCHAR" property="parentCode" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="total_score" jdbcType="INTEGER" property="totalScore" />
<result column="type" jdbcType="TINYINT" property="type" />
<result column="is_show" jdbcType="TINYINT" property="isShow" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_del" jdbcType="TINYINT" property="isDel" />
<collection property="codeRecords" ofType="com.ccsens.ht.bean.vo.QuestionVo$QuestionRecord">
<id column="rid" property="id"></id>
<result column="rCalcType" property="calcType"/>
<result column="rShowTitle" property="showTitle"/>
<result column="rShowForm" property="showForm"/>
<result column="rDefaultValue" property="defaultValue"/>
<result column="rType" property="type"/>
<result column="rRemark" property="remark"/>
<collection property="answers" ofType="String">
<id column="answer"/>
</collection>
</collection>
</resultMap>
<insert id="insertBatch" parameterType="List">
<insert id="insertBatch" parameterType="java.util.List">
replace into t_ht_report (id, code, name,
parent_code, description, total_score,
type, is_show, sort,
@ -32,7 +33,7 @@
</foreach>
</insert>
<select id="queryReportShow" resultMap="BaseResultMap">
<select id="queryReportShow" resultMap="com.ccsens.ht.persist.mapper.HtReportMapper.BaseResultMap">
select * from t_ht_report where is_show = 1 and is_del = 0 order by type,sort
</select>
<select id="queryParam" resultType="com.ccsens.ht.bean.vo.PatientReportSearchVo$SearchParam">
@ -66,5 +67,40 @@
GROUP BY t.CODE
ORDER BY t.type,t.parent_code,t.sort
</select>
<select id="queryCode" resultType="java.lang.String">
select code from t_ht_report where type = #{type} and is_del = 0
</select>
<select id="queryReportAndRecord" resultMap="BaseResultMap">
select * from
(select id, code, name from t_ht_report where code = #{code} and is_del = 0 ) report
left join
(
SELECT
r.id AS rId,
r.question_id,
r.calc_type AS rCalcType,
r.show_title AS rShowTitle,
r.show_form AS rShowForm,
r.default_value AS rDefaultValue,
r.type AS rType,
r.remark AS rRemark,
qr.answer
FROM
( SELECT * FROM t_ht_question_record WHERE record_type = 0 AND is_del = 0 ) r
LEFT JOIN ( SELECT * FROM t_ht_patient_report_record_desc WHERE
<choose>
<when test="patientReportId != null and patientReportId != 0">
patient_report_id = #{patientReportId} AND is_del = 0
</when>
<otherwise>
1=2
</otherwise>
</choose>
) qr ON r.id = qr.record_id
ORDER BY
r.question_id,
r.sort
) record on report.id = record.question_id
</select>
</mapper>

276
ht/src/main/resources/mapper_raw/HtPatientReportRecordDescMapper.xml

@ -0,0 +1,276 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ht.persist.mapper.HtPatientReportRecordDescMapper">
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.po.HtPatientReportRecordDesc">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="patient_report_id" jdbcType="BIGINT" property="patientReportId" />
<result column="record_id" jdbcType="BIGINT" property="recordId" />
<result column="answer" jdbcType="VARCHAR" property="answer" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_del" jdbcType="TINYINT" property="isDel" />
<result column="answer_time" jdbcType="BIGINT" property="answerTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, patient_report_id, record_id, answer, remark, create_time, update_time, is_del,
answer_time
</sql>
<select id="selectByExample" parameterType="com.ccsens.ht.bean.po.HtPatientReportRecordDescExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_ht_patient_report_record_desc
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_ht_patient_report_record_desc
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_ht_patient_report_record_desc
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.ht.bean.po.HtPatientReportRecordDescExample">
delete from t_ht_patient_report_record_desc
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.ht.bean.po.HtPatientReportRecordDesc">
insert into t_ht_patient_report_record_desc (id, patient_report_id, record_id,
answer, remark, create_time,
update_time, is_del, answer_time
)
values (#{id,jdbcType=BIGINT}, #{patientReportId,jdbcType=BIGINT}, #{recordId,jdbcType=BIGINT},
#{answer,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT}, #{answerTime,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="com.ccsens.ht.bean.po.HtPatientReportRecordDesc">
insert into t_ht_patient_report_record_desc
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="patientReportId != null">
patient_report_id,
</if>
<if test="recordId != null">
record_id,
</if>
<if test="answer != null">
answer,
</if>
<if test="remark != null">
remark,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="isDel != null">
is_del,
</if>
<if test="answerTime != null">
answer_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="patientReportId != null">
#{patientReportId,jdbcType=BIGINT},
</if>
<if test="recordId != null">
#{recordId,jdbcType=BIGINT},
</if>
<if test="answer != null">
#{answer,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDel != null">
#{isDel,jdbcType=TINYINT},
</if>
<if test="answerTime != null">
#{answerTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.ht.bean.po.HtPatientReportRecordDescExample" resultType="java.lang.Long">
select count(*) from t_ht_patient_report_record_desc
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_ht_patient_report_record_desc
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.patientReportId != null">
patient_report_id = #{record.patientReportId,jdbcType=BIGINT},
</if>
<if test="record.recordId != null">
record_id = #{record.recordId,jdbcType=BIGINT},
</if>
<if test="record.answer != null">
answer = #{record.answer,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.isDel != null">
is_del = #{record.isDel,jdbcType=TINYINT},
</if>
<if test="record.answerTime != null">
answer_time = #{record.answerTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_ht_patient_report_record_desc
set id = #{record.id,jdbcType=BIGINT},
patient_report_id = #{record.patientReportId,jdbcType=BIGINT},
record_id = #{record.recordId,jdbcType=BIGINT},
answer = #{record.answer,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_del = #{record.isDel,jdbcType=TINYINT},
answer_time = #{record.answerTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.ht.bean.po.HtPatientReportRecordDesc">
update t_ht_patient_report_record_desc
<set>
<if test="patientReportId != null">
patient_report_id = #{patientReportId,jdbcType=BIGINT},
</if>
<if test="recordId != null">
record_id = #{recordId,jdbcType=BIGINT},
</if>
<if test="answer != null">
answer = #{answer,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDel != null">
is_del = #{isDel,jdbcType=TINYINT},
</if>
<if test="answerTime != null">
answer_time = #{answerTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.ht.bean.po.HtPatientReportRecordDesc">
update t_ht_patient_report_record_desc
set patient_report_id = #{patientReportId,jdbcType=BIGINT},
record_id = #{recordId,jdbcType=BIGINT},
answer = #{answer,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_del = #{isDel,jdbcType=TINYINT},
answer_time = #{answerTime,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

35
ht/src/main/resources/mapper_raw/HtQuestionMapper.xml

@ -11,6 +11,7 @@
<result column="record_type" jdbcType="VARCHAR" property="recordType" />
<result column="record_content" jdbcType="VARCHAR" property="recordContent" />
<result column="relation_code" jdbcType="VARCHAR" property="relationCode" />
<result column="relation_id" jdbcType="BIGINT" property="relationId" />
<result column="operate_type" jdbcType="TINYINT" property="operateType" />
<result column="recode_starttime" jdbcType="TINYINT" property="recodeStarttime" />
<result column="time_wabei" jdbcType="TINYINT" property="timeWabei" />
@ -82,8 +83,8 @@
</sql>
<sql id="Base_Column_List">
id, evaluation_code, parent_code, sort, question, type, record_type, record_content,
relation_code, operate_type, recode_starttime, time_wabei, allow_clear, clear_times,
timing_length, remark, create_time, update_time, is_del
relation_code, relation_id, operate_type, recode_starttime, time_wabei, allow_clear,
clear_times, timing_length, remark, create_time, update_time, is_del
</sql>
<select id="selectByExample" parameterType="com.ccsens.ht.bean.po.HtQuestionExample" resultMap="BaseResultMap">
select
@ -119,17 +120,17 @@
insert into t_ht_question (id, evaluation_code, parent_code,
sort, question, type,
record_type, record_content, relation_code,
operate_type, recode_starttime, time_wabei,
allow_clear, clear_times, timing_length,
remark, create_time, update_time,
is_del)
relation_id, operate_type, recode_starttime,
time_wabei, allow_clear, clear_times,
timing_length, remark, create_time,
update_time, is_del)
values (#{id,jdbcType=BIGINT}, #{evaluationCode,jdbcType=VARCHAR}, #{parentCode,jdbcType=VARCHAR},
#{sort,jdbcType=INTEGER}, #{question,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT},
#{recordType,jdbcType=VARCHAR}, #{recordContent,jdbcType=VARCHAR}, #{relationCode,jdbcType=VARCHAR},
#{operateType,jdbcType=TINYINT}, #{recodeStarttime,jdbcType=TINYINT}, #{timeWabei,jdbcType=TINYINT},
#{allowClear,jdbcType=TINYINT}, #{clearTimes,jdbcType=INTEGER}, #{timingLength,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{isDel,jdbcType=TINYINT})
#{relationId,jdbcType=BIGINT}, #{operateType,jdbcType=TINYINT}, #{recodeStarttime,jdbcType=TINYINT},
#{timeWabei,jdbcType=TINYINT}, #{allowClear,jdbcType=TINYINT}, #{clearTimes,jdbcType=INTEGER},
#{timingLength,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.ht.bean.po.HtQuestion">
insert into t_ht_question
@ -161,6 +162,9 @@
<if test="relationCode != null">
relation_code,
</if>
<if test="relationId != null">
relation_id,
</if>
<if test="operateType != null">
operate_type,
</if>
@ -220,6 +224,9 @@
<if test="relationCode != null">
#{relationCode,jdbcType=VARCHAR},
</if>
<if test="relationId != null">
#{relationId,jdbcType=BIGINT},
</if>
<if test="operateType != null">
#{operateType,jdbcType=TINYINT},
</if>
@ -288,6 +295,9 @@
<if test="record.relationCode != null">
relation_code = #{record.relationCode,jdbcType=VARCHAR},
</if>
<if test="record.relationId != null">
relation_id = #{record.relationId,jdbcType=BIGINT},
</if>
<if test="record.operateType != null">
operate_type = #{record.operateType,jdbcType=TINYINT},
</if>
@ -334,6 +344,7 @@
record_type = #{record.recordType,jdbcType=VARCHAR},
record_content = #{record.recordContent,jdbcType=VARCHAR},
relation_code = #{record.relationCode,jdbcType=VARCHAR},
relation_id = #{record.relationId,jdbcType=BIGINT},
operate_type = #{record.operateType,jdbcType=TINYINT},
recode_starttime = #{record.recodeStarttime,jdbcType=TINYINT},
time_wabei = #{record.timeWabei,jdbcType=TINYINT},
@ -375,6 +386,9 @@
<if test="relationCode != null">
relation_code = #{relationCode,jdbcType=VARCHAR},
</if>
<if test="relationId != null">
relation_id = #{relationId,jdbcType=BIGINT},
</if>
<if test="operateType != null">
operate_type = #{operateType,jdbcType=TINYINT},
</if>
@ -418,6 +432,7 @@
record_type = #{recordType,jdbcType=VARCHAR},
record_content = #{recordContent,jdbcType=VARCHAR},
relation_code = #{relationCode,jdbcType=VARCHAR},
relation_id = #{relationId,jdbcType=BIGINT},
operate_type = #{operateType,jdbcType=TINYINT},
recode_starttime = #{recodeStarttime,jdbcType=TINYINT},
time_wabei = #{timeWabei,jdbcType=TINYINT},

275
ht/src/main/resources/mapper_raw/HtQuestionOptionDescMapper.xml

@ -0,0 +1,275 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ht.persist.mapper.HtQuestionOptionDescMapper">
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.po.HtQuestionOptionDesc">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="option_id" jdbcType="BIGINT" property="optionId" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="type" jdbcType="TINYINT" property="type" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_del" jdbcType="TINYINT" property="isDel" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, option_id, sort, type, content, remark, create_time, update_time, is_del
</sql>
<select id="selectByExample" parameterType="com.ccsens.ht.bean.po.HtQuestionOptionDescExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_ht_question_option_desc
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_ht_question_option_desc
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_ht_question_option_desc
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.ht.bean.po.HtQuestionOptionDescExample">
delete from t_ht_question_option_desc
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.ht.bean.po.HtQuestionOptionDesc">
insert into t_ht_question_option_desc (id, option_id, sort,
type, content, remark,
create_time, update_time, is_del
)
values (#{id,jdbcType=BIGINT}, #{optionId,jdbcType=BIGINT}, #{sort,jdbcType=INTEGER},
#{type,jdbcType=TINYINT}, #{content,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT}
)
</insert>
<insert id="insertSelective" parameterType="com.ccsens.ht.bean.po.HtQuestionOptionDesc">
insert into t_ht_question_option_desc
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="optionId != null">
option_id,
</if>
<if test="sort != null">
sort,
</if>
<if test="type != null">
type,
</if>
<if test="content != null">
content,
</if>
<if test="remark != null">
remark,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="isDel != null">
is_del,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="optionId != null">
#{optionId,jdbcType=BIGINT},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="type != null">
#{type,jdbcType=TINYINT},
</if>
<if test="content != null">
#{content,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDel != null">
#{isDel,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.ht.bean.po.HtQuestionOptionDescExample" resultType="java.lang.Long">
select count(*) from t_ht_question_option_desc
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_ht_question_option_desc
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.optionId != null">
option_id = #{record.optionId,jdbcType=BIGINT},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if test="record.type != null">
type = #{record.type,jdbcType=TINYINT},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.isDel != null">
is_del = #{record.isDel,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_ht_question_option_desc
set id = #{record.id,jdbcType=BIGINT},
option_id = #{record.optionId,jdbcType=BIGINT},
sort = #{record.sort,jdbcType=INTEGER},
type = #{record.type,jdbcType=TINYINT},
content = #{record.content,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_del = #{record.isDel,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.ht.bean.po.HtQuestionOptionDesc">
update t_ht_question_option_desc
<set>
<if test="optionId != null">
option_id = #{optionId,jdbcType=BIGINT},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="type != null">
type = #{type,jdbcType=TINYINT},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDel != null">
is_del = #{isDel,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.ht.bean.po.HtQuestionOptionDesc">
update t_ht_question_option_desc
set option_id = #{optionId,jdbcType=BIGINT},
sort = #{sort,jdbcType=INTEGER},
type = #{type,jdbcType=TINYINT},
content = #{content,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_del = #{isDel,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

338
ht/src/main/resources/mapper_raw/HtQuestionRecordMapper.xml

@ -0,0 +1,338 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ht.persist.mapper.HtQuestionRecordMapper">
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.po.HtQuestionRecord">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="record_type" jdbcType="TINYINT" property="recordType" />
<result column="question_id" jdbcType="BIGINT" property="questionId" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="calc_type" jdbcType="TINYINT" property="calcType" />
<result column="show_title" jdbcType="VARCHAR" property="showTitle" />
<result column="show_form" jdbcType="VARCHAR" property="showForm" />
<result column="default_value" jdbcType="VARCHAR" property="defaultValue" />
<result column="type" jdbcType="TINYINT" property="type" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_del" jdbcType="TINYINT" property="isDel" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, record_type, question_id, sort, calc_type, show_title, show_form, default_value,
type, remark, create_time, update_time, is_del
</sql>
<select id="selectByExample" parameterType="com.ccsens.ht.bean.po.HtQuestionRecordExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_ht_question_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_ht_question_record
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_ht_question_record
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.ht.bean.po.HtQuestionRecordExample">
delete from t_ht_question_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.ht.bean.po.HtQuestionRecord">
insert into t_ht_question_record (id, record_type, question_id,
sort, calc_type, show_title,
show_form, default_value, type,
remark, create_time, update_time,
is_del)
values (#{id,jdbcType=BIGINT}, #{recordType,jdbcType=TINYINT}, #{questionId,jdbcType=BIGINT},
#{sort,jdbcType=INTEGER}, #{calcType,jdbcType=TINYINT}, #{showTitle,jdbcType=VARCHAR},
#{showForm,jdbcType=VARCHAR}, #{defaultValue,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT},
#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{isDel,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.ht.bean.po.HtQuestionRecord">
insert into t_ht_question_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="recordType != null">
record_type,
</if>
<if test="questionId != null">
question_id,
</if>
<if test="sort != null">
sort,
</if>
<if test="calcType != null">
calc_type,
</if>
<if test="showTitle != null">
show_title,
</if>
<if test="showForm != null">
show_form,
</if>
<if test="defaultValue != null">
default_value,
</if>
<if test="type != null">
type,
</if>
<if test="remark != null">
remark,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="isDel != null">
is_del,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="recordType != null">
#{recordType,jdbcType=TINYINT},
</if>
<if test="questionId != null">
#{questionId,jdbcType=BIGINT},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="calcType != null">
#{calcType,jdbcType=TINYINT},
</if>
<if test="showTitle != null">
#{showTitle,jdbcType=VARCHAR},
</if>
<if test="showForm != null">
#{showForm,jdbcType=VARCHAR},
</if>
<if test="defaultValue != null">
#{defaultValue,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=TINYINT},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDel != null">
#{isDel,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.ht.bean.po.HtQuestionRecordExample" resultType="java.lang.Long">
select count(*) from t_ht_question_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_ht_question_record
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.recordType != null">
record_type = #{record.recordType,jdbcType=TINYINT},
</if>
<if test="record.questionId != null">
question_id = #{record.questionId,jdbcType=BIGINT},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if test="record.calcType != null">
calc_type = #{record.calcType,jdbcType=TINYINT},
</if>
<if test="record.showTitle != null">
show_title = #{record.showTitle,jdbcType=VARCHAR},
</if>
<if test="record.showForm != null">
show_form = #{record.showForm,jdbcType=VARCHAR},
</if>
<if test="record.defaultValue != null">
default_value = #{record.defaultValue,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
type = #{record.type,jdbcType=TINYINT},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.isDel != null">
is_del = #{record.isDel,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_ht_question_record
set id = #{record.id,jdbcType=BIGINT},
record_type = #{record.recordType,jdbcType=TINYINT},
question_id = #{record.questionId,jdbcType=BIGINT},
sort = #{record.sort,jdbcType=INTEGER},
calc_type = #{record.calcType,jdbcType=TINYINT},
show_title = #{record.showTitle,jdbcType=VARCHAR},
show_form = #{record.showForm,jdbcType=VARCHAR},
default_value = #{record.defaultValue,jdbcType=VARCHAR},
type = #{record.type,jdbcType=TINYINT},
remark = #{record.remark,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_del = #{record.isDel,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.ht.bean.po.HtQuestionRecord">
update t_ht_question_record
<set>
<if test="recordType != null">
record_type = #{recordType,jdbcType=TINYINT},
</if>
<if test="questionId != null">
question_id = #{questionId,jdbcType=BIGINT},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="calcType != null">
calc_type = #{calcType,jdbcType=TINYINT},
</if>
<if test="showTitle != null">
show_title = #{showTitle,jdbcType=VARCHAR},
</if>
<if test="showForm != null">
show_form = #{showForm,jdbcType=VARCHAR},
</if>
<if test="defaultValue != null">
default_value = #{defaultValue,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,jdbcType=TINYINT},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDel != null">
is_del = #{isDel,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.ht.bean.po.HtQuestionRecord">
update t_ht_question_record
set record_type = #{recordType,jdbcType=TINYINT},
question_id = #{questionId,jdbcType=BIGINT},
sort = #{sort,jdbcType=INTEGER},
calc_type = #{calcType,jdbcType=TINYINT},
show_title = #{showTitle,jdbcType=VARCHAR},
show_form = #{showForm,jdbcType=VARCHAR},
default_value = #{defaultValue,jdbcType=VARCHAR},
type = #{type,jdbcType=TINYINT},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_del = #{isDel,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

276
ht/src/main/resources/mapper_raw/HtQuestionRecordOptionMapper.xml

@ -0,0 +1,276 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ht.persist.mapper.HtQuestionRecordOptionMapper">
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.po.HtQuestionRecordOption">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="question_record_id" jdbcType="BIGINT" property="questionRecordId" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="data_key" jdbcType="VARCHAR" property="dataKey" />
<result column="data_value" jdbcType="VARCHAR" property="dataValue" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_del" jdbcType="TINYINT" property="isDel" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, question_record_id, sort, data_key, data_value, remark, create_time, update_time,
is_del
</sql>
<select id="selectByExample" parameterType="com.ccsens.ht.bean.po.HtQuestionRecordOptionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_ht_question_record_option
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_ht_question_record_option
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_ht_question_record_option
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.ht.bean.po.HtQuestionRecordOptionExample">
delete from t_ht_question_record_option
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.ht.bean.po.HtQuestionRecordOption">
insert into t_ht_question_record_option (id, question_record_id, sort,
data_key, data_value, remark,
create_time, update_time, is_del
)
values (#{id,jdbcType=BIGINT}, #{questionRecordId,jdbcType=BIGINT}, #{sort,jdbcType=INTEGER},
#{dataKey,jdbcType=VARCHAR}, #{dataValue,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT}
)
</insert>
<insert id="insertSelective" parameterType="com.ccsens.ht.bean.po.HtQuestionRecordOption">
insert into t_ht_question_record_option
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="questionRecordId != null">
question_record_id,
</if>
<if test="sort != null">
sort,
</if>
<if test="dataKey != null">
data_key,
</if>
<if test="dataValue != null">
data_value,
</if>
<if test="remark != null">
remark,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="isDel != null">
is_del,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="questionRecordId != null">
#{questionRecordId,jdbcType=BIGINT},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="dataKey != null">
#{dataKey,jdbcType=VARCHAR},
</if>
<if test="dataValue != null">
#{dataValue,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDel != null">
#{isDel,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.ht.bean.po.HtQuestionRecordOptionExample" resultType="java.lang.Long">
select count(*) from t_ht_question_record_option
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_ht_question_record_option
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.questionRecordId != null">
question_record_id = #{record.questionRecordId,jdbcType=BIGINT},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if test="record.dataKey != null">
data_key = #{record.dataKey,jdbcType=VARCHAR},
</if>
<if test="record.dataValue != null">
data_value = #{record.dataValue,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.isDel != null">
is_del = #{record.isDel,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_ht_question_record_option
set id = #{record.id,jdbcType=BIGINT},
question_record_id = #{record.questionRecordId,jdbcType=BIGINT},
sort = #{record.sort,jdbcType=INTEGER},
data_key = #{record.dataKey,jdbcType=VARCHAR},
data_value = #{record.dataValue,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_del = #{record.isDel,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.ht.bean.po.HtQuestionRecordOption">
update t_ht_question_record_option
<set>
<if test="questionRecordId != null">
question_record_id = #{questionRecordId,jdbcType=BIGINT},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="dataKey != null">
data_key = #{dataKey,jdbcType=VARCHAR},
</if>
<if test="dataValue != null">
data_value = #{dataValue,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDel != null">
is_del = #{isDel,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.ht.bean.po.HtQuestionRecordOption">
update t_ht_question_record_option
set question_record_id = #{questionRecordId,jdbcType=BIGINT},
sort = #{sort,jdbcType=INTEGER},
data_key = #{dataKey,jdbcType=VARCHAR},
data_value = #{dataValue,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_del = #{isDel,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

2
pom.xml

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

14
question/src/main/java/com/ccsens/question/api/PatientReportController.java

@ -52,6 +52,20 @@ public class PatientReportController {
return JsonResponse.newInstance().ok();
}
@MustLogin
@DoctorAudit
@ApiOperation(value = "检查患者是否有未完成的报告单, 无则生成",notes = "检查患者是否有未完成的报告单")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "报告单信息", required = true)
})
@RequestMapping(value="/checkPatientComplete", method = RequestMethod.POST)
public JsonResponse<PatientReportVo.CompleteSimple> checkPatientComplete(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.Patient> dto){
log.info("检查患者是否有未完成的报告单:{}", dto);
PatientReportVo.CompleteSimple complete = patientReportService.checkPatientComplete(dto.getParam(), dto.getUserId());
log.info("检查患者是否有未完成的报告单返回:{}", complete);
return JsonResponse.newInstance().ok(complete);
}
@MustLogin
@DoctorAudit
@ApiOperation(value = "检查是否有未完成的报告单",notes = "检查是否有未完成的报告单")

12
question/src/main/java/com/ccsens/question/bean/dto/PatientReportDto.java

@ -19,6 +19,16 @@ import javax.validation.constraints.NotNull;
*/
public class PatientReportDto {
@Data
@ApiModel("患者信息")
public static class Patient{
@ApiModelProperty("病人ID")
@NotNull(message = "请选择患者信息")
private Long patientId;
@ApiModelProperty("病案号")
private String serialNumber;
}
@Data
@ApiModel("忽略未完成的报告单")
public static class Ignore{
@ -33,6 +43,8 @@ public class PatientReportDto {
@ApiModelProperty("病人ID")
@NotNull(message = "病人ID不能为空")
private Long patientId;
@ApiModelProperty("病案号")
private String serialNumber;
}
@ApiModel("PatientReportDtoEdit")

80
question/src/main/java/com/ccsens/question/bean/vo/PatientReportVo.java

@ -1,6 +1,7 @@
package com.ccsens.question.bean.vo;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.ccsens.question.uitl.Constant;
import com.ccsens.util.PdfUtil;
@ -20,6 +21,22 @@ import java.util.*;
*/
public class PatientReportVo {
@Data
@ApiModel("报告单遗留未完成简单版")
public static class CompleteSimple {
@ApiModelProperty("是否有未完成的项目 1:有 0:无")
private byte hasUnfinished = 0;
@ApiModelProperty("报告单ID")
private Long id;
@ApiModelProperty("报告单名字")
private String name;
@ApiModelProperty("病人ID")
private Long patientId;
@ApiModelProperty("病案号")
private String serialNumber;
}
@Data
@ApiModel("报告单遗留未完成")
public static class Complete {
@ -139,41 +156,46 @@ public class PatientReportVo {
List<PdfUtil.Row> rows = new ArrayList<>();
//第一栏
rows.add(
fillRow(
"姓名:" + (StrUtil.isEmpty(this.patientName) ? "" : this.patientName),
"性别:" + (this.sex == null ? "" : this.sex == 0 ? "男" : "女"),
"年龄:" + (this.patientAge != null && this.patientAge != 0 ? this.patientAge + " 岁" : ""))
);
//第二栏
rows.add(
fillRow(
"文化程度:" + (StrUtil.isEmpty(this.educationalStatusUnit) ? "" : this.educationalStatusUnit + "年"),
"编号:" + (StrUtil.isEmpty(this.serialNumber) ? "" : this.serialNumber),
"职业:" + (this.career != null ? careerMap.get(this.career) : ""))
);
//第三栏
rows.add(
fillRow(
"科别:" + (StrUtil.isEmpty(this.department) ? "" : this.department),
"床号:" + (StrUtil.isEmpty(this.bedNumber) ? "" : this.bedNumber),
"病案号:" + (StrUtil.isEmpty(this.hospitalNumber) ? "" : this.hospitalNumber))
);
// //第一栏
// rows.add(
// fillRow(
// "姓名:" + (StrUtil.isEmpty(this.patientName) ? "" : this.patientName),
// "性别:" + (this.sex == null ? "" : this.sex == 0 ? "男" : "女"),
// "年龄:" + (this.patientAge != null && this.patientAge != 0 ? this.patientAge + " 岁" : ""))
// );
// //第二栏
// rows.add(
// fillRow(
// "文化程度:" + (StrUtil.isEmpty(this.educationalStatusUnit) ? "" : this.educationalStatusUnit + "年"),
// "编号:" + (StrUtil.isEmpty(this.serialNumber) ? "" : this.serialNumber),
// "职业:" + (this.career != null ? careerMap.get(this.career) : ""))
// );
// //第三栏
// rows.add(
// fillRow(
// "科别:" + (StrUtil.isEmpty(this.department) ? "" : this.department),
// "床号:" + (StrUtil.isEmpty(this.bedNumber) ? "" : this.bedNumber),
// "病案号:" + (StrUtil.isEmpty(this.hospitalNumber) ? "" : this.hospitalNumber))
// );
//第四栏
// Date date = null;
// if (this.reportTime > 0) {
// date = new Date();
// date.setTime(this.reportTime);
// }
Date date = null;
if (this.reportTime > 0) {
date = new Date();
date.setTime(this.reportTime);
}
String pasiStr = this.pasi == 3 ? "重度" : this.pasi == 2 ? "中度" : this.pasi == 1 ? "轻度" : "";
rows.add(
fillRow(
"病案号:" + (StrUtil.isEmpty(serialNumber) ? "" : serialNumber),
"临床诊断:" + (StrUtil.isEmpty(this.clinicalDiagnosis) ? "" : this.clinicalDiagnosis),
"","")
"严重程度:" + pasiStr)
// "检查日期:" + (date == null ? "" : DateUtil.format(date, "yyyy-MM-dd")))
);
rows.add(
fillRow(
"检查日期:" + (date == null ? "" : DateUtil.format(date, "yyyy-MM-dd")))
// )
);
return rows;
}

8
question/src/main/java/com/ccsens/question/persist/dao/HtPatientReportDao.java

@ -104,4 +104,12 @@ public interface HtPatientReportDao extends HtPatientReportMapper {
* @return 报告单
*/
List<PatientReportSearchVo.Search> search(@Param("codes") List<PatientReportSearchDto.Search> codes);
/**
* 检查患者未完成的报告单
* @param param 患者信息
* @param userId 用户ID
* @return 报告单
*/
PatientReportVo.CompleteSimple checkPatientComplete(@Param("patient") PatientReportDto.Patient param, @Param("userId") Long userId);
}

8
question/src/main/java/com/ccsens/question/service/IPatientReportService.java

@ -157,4 +157,12 @@ public interface IPatientReportService {
* @return 报告单
*/
List<PatientReportSearchVo.Search> search(PatientReportSearchDto.SearchList param);
/**
*
* @param param
* @param userId
* @return
*/
PatientReportVo.CompleteSimple checkPatientComplete(PatientReportDto.Patient param, Long userId);
}

191
question/src/main/java/com/ccsens/question/service/PatientReportService.java

@ -3,7 +3,6 @@ package com.ccsens.question.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.ccsens.question.bean.dto.PatientReportDto;
@ -69,37 +68,39 @@ public class PatientReportService implements IPatientReportService {
public JsonResponse<PatientReportVo.Generate> generatePatientReport(PatientReportDto.Generate generate, Long userId) {
log.info("生成报告单请求参数:userId:{}, patientReport:{}", userId, generate);
//查询医生信息
HtDoctorExample doctorExample = new HtDoctorExample();
doctorExample.createCriteria().andUserIdEqualTo(userId).andAuditStateEqualTo(Constant.Ht.Doctor.CHECK_SUCCESS).andIsDelEqualTo(Constant.Ht.NUMBER_DEFAULT);
List<HtDoctor> doctors = htDoctorDao.selectByExample(doctorExample);
if (CollectionUtils.isEmpty(doctors)) {
log.info("根据userId未找到审核通过的医生信息:{}", userId);
return JsonResponse.newInstance().ok(CodeEnum.PARAM_ERROR);
}
//查询病人信息
HtPatient htPatient = htPatientMapper.selectByPrimaryKey(generate.getPatientId());
if (htPatient == null) {
log.info("根据patientId未找到病友信息:{}", generate.getPatientId());
return JsonResponse.newInstance().ok(CodeEnum.PARAM_ERROR);
}
// HtDoctorExample doctorExample = new HtDoctorExample();
// doctorExample.createCriteria().andUserIdEqualTo(userId).andAuditStateEqualTo(Constant.Ht.Doctor.CHECK_SUCCESS).andIsDelEqualTo(Constant.Ht.NUMBER_DEFAULT);
// List<HtDoctor> doctors = htDoctorDao.selectByExample(doctorExample);
// if (CollectionUtils.isEmpty(doctors)) {
// log.info("根据userId未找到审核通过的医生信息:{}", userId);
// return JsonResponse.newInstance().ok(CodeEnum.PARAM_ERROR);
// }
// //查询病人信息
// HtPatient htPatient = htPatientMapper.selectByPrimaryKey(generate.getPatientId());
// if (htPatient == null) {
// log.info("根据patientId未找到病友信息:{}", generate.getPatientId());
// return JsonResponse.newInstance().ok(CodeEnum.PARAM_ERROR);
// }
HtPatientReport htPatientReport = new HtPatientReport();
htPatientReport.setId(snowflake.nextId());
htPatientReport.setDoctorId(doctors.get(0).getId());
// htPatientReport.setDoctorId(doctors.get(0).getId());
htPatientReport.setPatientId(generate.getPatientId());
htPatientReport.setPatientIdcard(htPatient.getIdcard());
htPatientReport.setPatientAge(StrUtil.isEmpty(htPatient.getIdcard()) ? null : (byte)IdcardUtil.getAgeByIdCard(htPatient.getIdcard()));
htPatientReport.setSerialNumber(generate.getSerialNumber());
// htPatientReport.setPatientIdcard(htPatient.getIdcard());
// htPatientReport.setPatientAge(StrUtil.isEmpty(htPatient.getIdcard()) ? null : (byte)IdcardUtil.getAgeByIdCard(htPatient.getIdcard()));
htPatientReport.setEvaluationCode(Constant.Ht.Report.PARENT_CODE);
htPatientReport.setName(Constant.Ht.Report.PARENT_NAME + DateUtil.today());
htPatientReport.setReportTime(System.currentTimeMillis());
// 查询医院信息
String hospital = htPositionDao.queryHospital(doctors.get(0).getPositionId());
htPatientReport.setHospital(hospital);
// String hospital = htPositionDao.queryHospital(doctors.get(0).getPositionId());
// htPatientReport.setHospital(hospital);
htPatientReportDao.insertSelective(htPatientReport);
log.info("生成病友报告单:{}", generate);
PatientReportVo.Generate generateVo = new PatientReportVo.Generate();
generateVo.setId(htPatientReport.getId());
generateVo.setName(htPatientReport.getName());
return JsonResponse.newInstance().ok(generateVo);
}
@ -112,39 +113,39 @@ public class PatientReportService implements IPatientReportService {
return CodeEnum.PARAM_ERROR;
}
//查询修改医生信息
HtDoctorExample example = new HtDoctorExample();
example.createCriteria().andUserIdEqualTo(userId).andAuditStateEqualTo(Constant.Ht.Doctor.CHECK_SUCCESS);
List<HtDoctor> doctors = htDoctorDao.selectByExample(example);
if (CollectionUtils.isEmpty(doctors)) {
log.info("{}医生信息尚未审核通过");
return CodeEnum.AUDIT_NOT_PASS;
}
HtDoctor doctor = doctors.get(0);
//判断该报告单是否为该医生的
HtDoctor reportDoctor = htDoctorDao.selectByPrimaryKey(htPatientReport.getDoctorId());
// 上级医生和报告单医生允许修改
List<Long> lowerPositionIds = htPositionDao.queryAllLowerPosition(doctor.getPositionId());
if (!doctor.getId().equals(reportDoctor.getId()) && !lowerPositionIds.contains(reportDoctor.getPositionId())) {
log.info("不具备修改权限");
return CodeEnum.REPORT_DOCTOR_ERROR;
}
//记录病人的随访记录
if (StrUtil.isEmpty(htPatientReport.getInitialImpression())) {
//1.统计病人的报告单的总数
HtPatientReportExample patientReportExample = new HtPatientReportExample();
patientReportExample.createCriteria().andPatientIdEqualTo(htPatientReport.getPatientId()).andInitialImpressionIsNotNull();
long count = htPatientReportDao.countByExample(patientReportExample);
HtPatientFollowUp followUp = new HtPatientFollowUp();
followUp.setId(snowflake.nextId());
followUp.setPatientId(htPatientReport.getPatientId());
followUp.setFollowUpDatetime(new Date());
followUp.setFollowUpTimes((int)count+1);
followUp.setRecorder(htPatientReport.getDoctorId());
followUp.setDiagnose(doctor.getId());
htPatientFollowUpMapper.insertSelective(followUp);
}
// HtDoctorExample example = new HtDoctorExample();
// example.createCriteria().andUserIdEqualTo(userId).andAuditStateEqualTo(Constant.Ht.Doctor.CHECK_SUCCESS);
// List<HtDoctor> doctors = htDoctorDao.selectByExample(example);
// if (CollectionUtils.isEmpty(doctors)) {
// log.info("{}医生信息尚未审核通过");
// return CodeEnum.AUDIT_NOT_PASS;
// }
// HtDoctor doctor = doctors.get(0);
// //判断该报告单是否为该医生的
// HtDoctor reportDoctor = htDoctorDao.selectByPrimaryKey(htPatientReport.getDoctorId());
// // 上级医生和报告单医生允许修改
// List<Long> lowerPositionIds = htPositionDao.queryAllLowerPosition(doctor.getPositionId());
// if (!doctor.getId().equals(reportDoctor.getId()) && !lowerPositionIds.contains(reportDoctor.getPositionId())) {
// log.info("不具备修改权限");
// return CodeEnum.REPORT_DOCTOR_ERROR;
// }
// //记录病人的随访记录
// if (StrUtil.isEmpty(htPatientReport.getInitialImpression())) {
// //1.统计病人的报告单的总数
// HtPatientReportExample patientReportExample = new HtPatientReportExample();
// patientReportExample.createCriteria().andPatientIdEqualTo(htPatientReport.getPatientId()).andInitialImpressionIsNotNull();
// long count = htPatientReportDao.countByExample(patientReportExample);
// HtPatientFollowUp followUp = new HtPatientFollowUp();
// followUp.setId(snowflake.nextId());
// followUp.setPatientId(htPatientReport.getPatientId());
// followUp.setFollowUpDatetime(new Date());
// followUp.setFollowUpTimes((int)count+1);
// followUp.setRecorder(htPatientReport.getDoctorId());
// followUp.setDiagnose(doctor.getId());
// htPatientFollowUpMapper.insertSelective(followUp);
// }
//修改报告单
HtPatientReport copy = patientReport.copy();
copy.setUrl(Constant.Ht.STRING_DEFAULT);
@ -156,7 +157,7 @@ public class PatientReportService implements IPatientReportService {
HtPatientReportRecord record = new HtPatientReportRecord();
record.setId(snowflake.nextId());
record.setReportId(htPatientReport.getId());
record.setDoctorId(doctor.getId());
record.setDoctorId(userId);
record.setContent(patientReport.toString());
htPatientReportRecordMapper.insertSelective(record);
log.info("记录编辑日志");
@ -186,34 +187,34 @@ public class PatientReportService implements IPatientReportService {
//分页查询报告单列表
PageHelper.startPage(query.getPageNum(), query.getPageSize());
List<PatientReportVo.ReportName> reportVos = htPatientReportDao.queryReportName(doctorId, patientId);
if (CollectionUtils.isEmpty(reportVos)) {
return new PageInfo<>(reportVos);
}
if (CollectionUtil.isEmpty(doctors)) {
return new PageInfo<>(reportVos);
}
HtDoctor doctor = doctors.get(0);
//查询下属职务
List<Long> lowerPositionIds = htPositionDao.queryAllLowerPosition(doctor.getPositionId());
reportVos.forEach(reportVo -> {
//自己的可见详情
if (doctor.getId().equals(reportVo.getDoctorId())) {
reportVo.setAuthority((byte)1);
} else if (CollectionUtils.isEmpty(lowerPositionIds)) {
reportVo.setAuthority((byte)0);
} else {
HtDoctor reportDoctor = htDoctorDao.selectByPrimaryKey(reportVo.getDoctorId());
//自己下属的可见详情
if (lowerPositionIds.contains(reportDoctor.getPositionId())) {
reportVo.setAuthority((byte)1);
} else {
reportVo.setAuthority((byte)0);
}
}
});
// if (CollectionUtils.isEmpty(reportVos)) {
// return new PageInfo<>(reportVos);
// }
//
//
// if (CollectionUtil.isEmpty(doctors)) {
// return new PageInfo<>(reportVos);
// }
// HtDoctor doctor = doctors.get(0);
// //查询下属职务
// List<Long> lowerPositionIds = htPositionDao.queryAllLowerPosition(doctor.getPositionId());
// reportVos.forEach(reportVo -> {
//
// //自己的可见详情
// if (doctor.getId().equals(reportVo.getDoctorId())) {
// reportVo.setAuthority((byte)1);
// } else if (CollectionUtils.isEmpty(lowerPositionIds)) {
// reportVo.setAuthority((byte)0);
// } else {
// HtDoctor reportDoctor = htDoctorDao.selectByPrimaryKey(reportVo.getDoctorId());
// //自己下属的可见详情
// if (lowerPositionIds.contains(reportDoctor.getPositionId())) {
// reportVo.setAuthority((byte)1);
// } else {
// reportVo.setAuthority((byte)0);
// }
// }
// });
return new PageInfo<>(reportVos);
}
@ -407,7 +408,7 @@ public class PatientReportService implements IPatientReportService {
dateCell.setBorderLeft(null);
content.add(row2);
String path = PropUtil.imgDomain + "/" + PdfUtil.credatePdf(PropUtil.path, detail.getPatient().getHospital(), Constant.Ht.Report.PARENT_NAME, detail.getPatient().toPdfRow(), content, new PdfUtil.Margin());
String path = PropUtil.imgDomain + "/" + PdfUtil.createPdf(PropUtil.path, detail.getPatient().getHospital(), Constant.Ht.Report.PARENT_NAME, new PdfUtil.Margin(), detail.getPatient().toPdfRow(), content);
report.setUrl(path);
htPatientReportDao.updateByPrimaryKeySelective(report);
log.info("生成文件路径:{}", path);
@ -608,5 +609,31 @@ public class PatientReportService implements IPatientReportService {
return list;
}
@Override
public PatientReportVo.CompleteSimple checkPatientComplete(PatientReportDto.Patient param, Long userId) {
PatientReportVo.CompleteSimple simple = htPatientReportDao.checkPatientComplete(param, userId);
log.info("检查患者未完成的报告单:{}", simple);
if (simple != null) {
simple.setHasUnfinished(Constant.Ht.UNCLOSED_REPORT);
return simple;
}
PatientReportDto.Generate generate = new PatientReportDto.Generate();
generate.setPatientId(param.getPatientId());
generate.setSerialNumber(param.getSerialNumber());
JsonResponse<PatientReportVo.Generate> result = generatePatientReport(generate, userId);
if (result.getCode() != CodeEnum.SUCCESS.getCode().intValue()) {
throw new BaseException(result.getCode(), result.getMsg());
}
simple = new PatientReportVo.CompleteSimple();
PatientReportVo.Generate data = result.getData();
simple.setId(data.getId());
simple.setName(data.getName());
simple.setPatientId(param.getPatientId());
simple.setSerialNumber(param.getSerialNumber());
return simple;
}
}

2
question/src/main/java/com/ccsens/question/uitl/Constant.java

@ -62,6 +62,8 @@ public class Constant {
public final static byte SEX_WOMAN = 1;
/**删除*/
public final static byte IS_DEL = 1;
/**未结束的报告单*/
public final static byte UNCLOSED_REPORT = 1;

6
question/src/main/resources/application-green.yml

@ -31,11 +31,11 @@ swagger:
file:
path: /home/cloud/question/uploads/
#domain: https://api.ccsens.com/test/
domain: https://www.sxwikionline.com/gateway/question/
imgDomain: https://www.sxwikionline.com/gateway/question/uploads
domain: https://sxzxyzzlm.tall.wiki/gateway/question/
imgDomain: https://sxzxyzzlm.tall.wiki/gateway/question/uploads
ht:
project:
patientUrl: https://www.sxwikionline.com/ht-dev/htPatientRegister
patientUrl: https://sxzxyzzlm.tall.wiki/ht-dev/htPatientRegister
name: 认知功能评测云平台系统
eureka:
instance:

7
question/src/main/resources/application-prod.yml

@ -8,7 +8,7 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:
host: 127.0.0.1
host: 121.36.3.207
password: 111111
port: 5672
username: admin
@ -21,7 +21,8 @@ spring:
max-idle: 10
max-wait: -1ms
min-idle: 0
password: 'areowqr!@43ef'
password: ''
# password: 'areowqr!@43ef'
port: 6379
timeout: 1000ms
@ -38,4 +39,4 @@ ht:
name: 认知功能评测云平台系统
eureka:
instance:
ip-address: 81.70.54.64
ip-address: 119.3.214.36

4
question/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: green
include: common, util-green
active: prod
include: common, util-prod

4
question/src/main/resources/druid-prod.yml

@ -15,7 +15,7 @@ spring:
maxWait: 60000
minEvictableIdleTimeMillis: 300000
minIdle: 5
password:
password: b3fd300ad4694070007fdcca961c4018211dc53235dd806ad62abc0cc0abb8e5
poolPreparedStatements: true
servletLogSlowSql: true
servletLoginPassword: 111111
@ -27,7 +27,7 @@ spring:
testOnReturn: false
testWhileIdle: true
timeBetweenEvictionRunsMillis: 60000
url: jdbc:mysql://127.0.0.1/question?useUnicode=true&characterEncoding=UTF-8
url: jdbc:mysql://www.tall.wiki/question?useUnicode=true&characterEncoding=UTF-8
username: root
validationQuery: SELECT 1 FROM DUAL
env: CCSENS_HT

6
question/src/main/resources/mapper_dao/HtPatientReportDao.xml

@ -256,6 +256,12 @@
</if>
</foreach>
</select>
<select id="checkPatientComplete" resultType="com.ccsens.question.bean.vo.PatientReportVo$CompleteSimple">
select r.id, r.name, r.patient_id as patientId, r.serial_number as serialNumber, r.create_time as createTime
from t_ht_patient_report r
where r.patient_id = #{patient.patientId} and r.complete_status = 0 and r.is_del = 0
order by r.create_time desc limit 1
</select>
</mapper>

1
tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java

@ -157,6 +157,7 @@ public class ProTaskDetailService implements IProTaskDetailService {
}
ProTaskDetailExample proTaskDetailExample = new ProTaskDetailExample();
proTaskDetailExample.createCriteria().andProjectIdEqualTo(projectId).andLevelEqualTo((byte) 1);
proTaskDetailExample.setOrderByClause("begin_time");
List<ProTaskDetail> firstTaskDetailList = taskDetailDao.selectByExample(proTaskDetailExample);
if (CollectionUtil.isNotEmpty(firstTaskDetailList)) {
int sequence = 1;

8
tall/src/main/resources/application-dev.yml

@ -11,11 +11,11 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:
# host: 192.168.0.99
host: 127.0.0.1
password: guest
host: 192.168.4.113
# host: 127.0.0.1
password: 111111
port: 5672
username: guest
username: admin
redis:
database: 0
host: 127.0.0.1

5
tall/src/main/resources/application-test.yml

@ -12,9 +12,9 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:
host: 127.0.0.1
password: 111111
password: guest
port: 5672
username: admin
username: guest
redis:
database: 0
host: 127.0.0.1
@ -31,6 +31,7 @@ swagger:
enable: true
eureka:
instance:
ip-address: 127.0.0.1
gatewayUrl: http://test.tall.wiki/gateway/
smsCode: 0

4
tall/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: test
include: util-test,common
active: dev
include: util-dev,common

1
tall/src/main/resources/mapper_dao/TaskDetailDao.xml

@ -109,6 +109,7 @@
AND
(c.place_location = 0 or c.id is null)
group by s.task_detail_id
ORDER BY s.begin_time
</select>

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

@ -28,14 +28,14 @@ public class PdfUtil {
/**
* 生成pdf
* @param parentPath
* @param title
* @param parentPath 文件夹路径
* @param title 标题
* @param subhead 副标题
* @param intros
* @param content
* @param intros 介绍
* @param contentArr 正文
* @return
*/
public static String credatePdf(String parentPath, String title, String subhead, List<Row> intros, List<Row> content, Margin margin) {
public static String createPdf(String parentPath, String title, String subhead, Margin margin, List<Row> intros, List<Row>... contentArr) {
String fileName = "pdf/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".pdf";
log.info("pdf文件名:{}", fileName );
File file = new File(parentPath, fileName);
@ -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,22 +59,27 @@ 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, titleChinese);
fillBlankRow(document, new Font(bfChinese, 8, Font.NORMAL));
//设置介绍内容
if (CollectionUtil.isNotEmpty(intros)) {
fillRow(intros, document);
}
if (CollectionUtil.isNotEmpty(content)) {
fillRow(content, document);
if (contentArr != null && contentArr.length > 0 ) {
for (List<Row> content:contentArr) {
if (CollectionUtil.isNotEmpty(content)) {
fillRow(content, document);
}
}
}
} catch (DocumentException e) {
e.printStackTrace();
log.error("导出pdf异常", e);
@ -121,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);
@ -131,6 +136,7 @@ public class PdfUtil {
PdfPCell pdfpCell = new PdfPCell(new Phrase(cell.content,font));
pdfpCell.setBorderWidthTop(j == 0 && cell.borderTop == null && cell.borderBottom != null ? cell.borderBottom : cell.borderTop == null ? 0 : cell.borderTop);
pdfpCell.setBorderWidthLeft(cell.borderLeft == null ? 0 : cell.borderLeft);
// pdfpCell.setBorderWidthRight(i==row.cells.size() && cell.borderRight == null && cell.borderLeft != null ? cell.borderLeft : cell.borderRight == null ? 0 : cell.borderRight);
pdfpCell.setBorderWidthRight(cell.borderRight == null ? 0 : cell.borderRight);
pdfpCell.setBorderWidthBottom(cell.borderBottom == null ? 0 : cell.borderBottom);
pdfpCell.setColspan(cell.colSpan);
@ -195,6 +201,11 @@ public class PdfUtil {
// 单元格是否居中
private boolean isCenter = true;
public Cell() {
}
public Cell(String content) {
this.content = content;
}
}
/**
@ -203,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;
}

516
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<List<PoiUtilCell>> 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<PoiUtilCell> 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<PoiUtilCell> 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<Object[]> readExce(File file, int sheetIndex, String sheetName, int dataIndex, boolean hasImg) throws Exception{
public static List<Object[]> 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<Object[]> list = new ArrayList<>();
List<Object[]> list = new ArrayList<>();
Sheet sheet = createSheet(file, sheetIndex, sheetName);
//读取放在首列的图片
Map<String, String> 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<String, String> 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<Object[]> 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<PoiUtilCell> cells = new ArrayList<>();
cells.add(poiUtilCell);
cells.add(poiUtilCell1);
cells.add(poiUtilCell3);
cells.add(poiUtilCell2);
List<List<PoiUtilCell>> list = new ArrayList<>();
list.add(cells);
// list.add(cells);
//
// List<PoiUtilCell> cells1 = new ArrayList<>();
// cells1.add(new PoiUtilCell("两列一行", 2, 1));
// list.add(cells1);
//
// List<PoiUtilCell> cells2 = new ArrayList<>();
// cells2.add(new PoiUtilCell("一列两行", 1, 2));
// list.add(cells2);
// List<PoiUtilCell> cells3 = new ArrayList<>();
// cells3.add(new PoiUtilCell("5"));
// cells3.add(new PoiUtilCell("6"));
// list.add(cells3);
// List<PoiUtilCell> cells4 = new ArrayList<>();
// list.add(cells4);
// List<PoiUtilCell> 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();
}
}
}

3
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;
/**数据已删除*/

2
util/src/test/java/com/ccsens/util/PdfUtilTest.java

@ -49,7 +49,7 @@ public class PdfUtilTest {
contents.add(row);
contents.add(row2);
}
PdfUtil.credatePdf("/home/", "山大一院","评测", rows, contents, new PdfUtil.Margin());
PdfUtil.createPdf("/home/", "山大一院","评测", new PdfUtil.Margin(), rows, contents);
}

Loading…
Cancel
Save