Browse Source

修改画图返回值

sd
zy_Java 5 years ago
parent
commit
4cfe555902
  1. 13
      ht/src/main/java/com/ccsens/ht/api/PatientReportController.java
  2. 26
      ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java
  3. 6
      ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java
  4. 22
      ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvas.java
  5. 130
      ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvasExample.java
  6. 22
      ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvasLine.java
  7. 70
      ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvasLineExample.java
  8. 43
      ht/src/main/java/com/ccsens/ht/bean/vo/PatientReportVo.java
  9. 53
      ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java
  10. 3
      ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientCanvasDao.java
  11. 8
      ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java
  12. 6
      ht/src/main/java/com/ccsens/ht/persist/mapper/HtPatientCanvasLineMapper.java
  13. 10
      ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java
  14. 7
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  15. 148
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java
  16. 12
      ht/src/main/java/com/ccsens/ht/uitl/Constant.java
  17. 4
      ht/src/main/resources/mapper_dao/HtPatientCanvasDao.xml
  18. 262
      ht/src/main/resources/mapper_dao/HtPatientReportDao.xml
  19. 84
      ht/src/main/resources/mapper_raw/HtPatientCanvasLineMapper.xml
  20. 42
      ht/src/main/resources/mapper_raw/HtPatientCanvasMapper.xml
  21. 4
      tall/src/main/resources/application.yml
  22. 55
      util/src/test/java/com/ccsens/util/Base64Test.java

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

@ -248,5 +248,18 @@ public class PatientReportController {
return JsonResponse.newInstance().ok(reportNamePageInfo);
}
@MustLogin
@DoctorAudit
@ApiOperation(value = "查询报告单详细答题信息",notes = "根据报告单id和测评类型,查看报告单的详细信息")
@ApiImplicitParams({
})
@RequestMapping(value="/queryReportAnswer", method = RequestMethod.POST)
public JsonResponse<List<PatientReportVo.ReportDetailAnswer>> queryReportAnswer(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.QueryReportAnswer> param){
log.info("查询报告单详细答题信息:{}", param);
List<PatientReportVo.ReportDetailAnswer> reportDetailAnswers = patientReportService.queryReportAnswer(param.getParam(), param.getUserId());
log.info("查询报告单详细答题信息完成");
return JsonResponse.newInstance().ok(reportDetailAnswers);
}
}

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

@ -6,10 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.*;
/**
* @program: ptpro
@ -159,4 +156,25 @@ public class PatientReportDto {
private Long endTime;
}
@ApiModel("查询报告单答题信息")
@Data
public static class QueryReportAnswer {
@NotNull(message = "报到单id不能为空")
@ApiModelProperty("报告单id")
private Long id;
@NotBlank(message = "测评类型不能为空")
@ApiModelProperty("测评类型")
private String evaluationCode;
}
@ApiModel("查询病友画图原图")
@Data
public static class QueryQuestionImg {
@NotNull(message = "报到单id不能为空")
@ApiModelProperty("报告单id")
private Long id;
@NotNull(message = "题目id不能为空")
@ApiModelProperty("题目id")
private Long questionId;
}
}

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

@ -62,7 +62,9 @@ public class QuestionDto {
@NotNull(message = "测评试题id不能为空")
@ApiModelProperty("测评试题id")
private Long questionId;
@ApiModelProperty("时间")
@ApiModelProperty("打开画板时间")
private Long openCanvasTime;
@ApiModelProperty("开始画图时间")
private Long beginTime;
@ApiModelProperty("轨迹,每个字符串是一条轨迹,轨迹内格式(x,y,time;x,y,time;.....)")
private List<String> points;
@ -70,6 +72,8 @@ public class QuestionDto {
private Canvas canvas;
@ApiModelProperty("笔触信息")
private CanvasLine line;
@ApiModelProperty("超出占比")
private String beyondProportion;
}
@Data
@ApiModel("画板信息")

22
ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvas.java

@ -26,6 +26,10 @@ public class HtPatientCanvas implements Serializable {
private Byte isDel;
private Long openCanvasTime;
private String beyondProportion;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -116,6 +120,22 @@ public class HtPatientCanvas implements Serializable {
this.isDel = isDel;
}
public Long getOpenCanvasTime() {
return openCanvasTime;
}
public void setOpenCanvasTime(Long openCanvasTime) {
this.openCanvasTime = openCanvasTime;
}
public String getBeyondProportion() {
return beyondProportion;
}
public void setBeyondProportion(String beyondProportion) {
this.beyondProportion = beyondProportion == null ? null : beyondProportion.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -133,6 +153,8 @@ public class HtPatientCanvas implements Serializable {
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isDel=").append(isDel);
sb.append(", openCanvasTime=").append(openCanvasTime);
sb.append(", beyondProportion=").append(beyondProportion);
sb.append("]");
return sb.toString();
}

130
ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvasExample.java

@ -774,6 +774,136 @@ public class HtPatientCanvasExample {
addCriterion("is_del not between", value1, value2, "isDel");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeIsNull() {
addCriterion("open_canvas_time is null");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeIsNotNull() {
addCriterion("open_canvas_time is not null");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeEqualTo(Long value) {
addCriterion("open_canvas_time =", value, "openCanvasTime");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeNotEqualTo(Long value) {
addCriterion("open_canvas_time <>", value, "openCanvasTime");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeGreaterThan(Long value) {
addCriterion("open_canvas_time >", value, "openCanvasTime");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeGreaterThanOrEqualTo(Long value) {
addCriterion("open_canvas_time >=", value, "openCanvasTime");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeLessThan(Long value) {
addCriterion("open_canvas_time <", value, "openCanvasTime");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeLessThanOrEqualTo(Long value) {
addCriterion("open_canvas_time <=", value, "openCanvasTime");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeIn(List<Long> values) {
addCriterion("open_canvas_time in", values, "openCanvasTime");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeNotIn(List<Long> values) {
addCriterion("open_canvas_time not in", values, "openCanvasTime");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeBetween(Long value1, Long value2) {
addCriterion("open_canvas_time between", value1, value2, "openCanvasTime");
return (Criteria) this;
}
public Criteria andOpenCanvasTimeNotBetween(Long value1, Long value2) {
addCriterion("open_canvas_time not between", value1, value2, "openCanvasTime");
return (Criteria) this;
}
public Criteria andBeyondProportionIsNull() {
addCriterion("beyond_proportion is null");
return (Criteria) this;
}
public Criteria andBeyondProportionIsNotNull() {
addCriterion("beyond_proportion is not null");
return (Criteria) this;
}
public Criteria andBeyondProportionEqualTo(String value) {
addCriterion("beyond_proportion =", value, "beyondProportion");
return (Criteria) this;
}
public Criteria andBeyondProportionNotEqualTo(String value) {
addCriterion("beyond_proportion <>", value, "beyondProportion");
return (Criteria) this;
}
public Criteria andBeyondProportionGreaterThan(String value) {
addCriterion("beyond_proportion >", value, "beyondProportion");
return (Criteria) this;
}
public Criteria andBeyondProportionGreaterThanOrEqualTo(String value) {
addCriterion("beyond_proportion >=", value, "beyondProportion");
return (Criteria) this;
}
public Criteria andBeyondProportionLessThan(String value) {
addCriterion("beyond_proportion <", value, "beyondProportion");
return (Criteria) this;
}
public Criteria andBeyondProportionLessThanOrEqualTo(String value) {
addCriterion("beyond_proportion <=", value, "beyondProportion");
return (Criteria) this;
}
public Criteria andBeyondProportionLike(String value) {
addCriterion("beyond_proportion like", value, "beyondProportion");
return (Criteria) this;
}
public Criteria andBeyondProportionNotLike(String value) {
addCriterion("beyond_proportion not like", value, "beyondProportion");
return (Criteria) this;
}
public Criteria andBeyondProportionIn(List<String> values) {
addCriterion("beyond_proportion in", values, "beyondProportion");
return (Criteria) this;
}
public Criteria andBeyondProportionNotIn(List<String> values) {
addCriterion("beyond_proportion not in", values, "beyondProportion");
return (Criteria) this;
}
public Criteria andBeyondProportionBetween(String value1, String value2) {
addCriterion("beyond_proportion between", value1, value2, "beyondProportion");
return (Criteria) this;
}
public Criteria andBeyondProportionNotBetween(String value1, String value2) {
addCriterion("beyond_proportion not between", value1, value2, "beyondProportion");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

22
ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvasLine.java

@ -8,14 +8,14 @@ public class HtPatientCanvasLine implements Serializable {
private Long patientCanvasId;
private String points;
private Date createTime;
private Date updateTime;
private Byte isDel;
private String points;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -34,14 +34,6 @@ public class HtPatientCanvasLine implements Serializable {
this.patientCanvasId = patientCanvasId;
}
public String getPoints() {
return points;
}
public void setPoints(String points) {
this.points = points == null ? null : points.trim();
}
public Date getCreateTime() {
return createTime;
}
@ -66,6 +58,14 @@ public class HtPatientCanvasLine implements Serializable {
this.isDel = isDel;
}
public String getPoints() {
return points;
}
public void setPoints(String points) {
this.points = points == null ? null : points.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -74,10 +74,10 @@ public class HtPatientCanvasLine implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", patientCanvasId=").append(patientCanvasId);
sb.append(", points=").append(points);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isDel=").append(isDel);
sb.append(", points=").append(points);
sb.append("]");
return sb.toString();
}

70
ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvasLineExample.java

@ -225,76 +225,6 @@ public class HtPatientCanvasLineExample {
return (Criteria) this;
}
public Criteria andPointsIsNull() {
addCriterion("points is null");
return (Criteria) this;
}
public Criteria andPointsIsNotNull() {
addCriterion("points is not null");
return (Criteria) this;
}
public Criteria andPointsEqualTo(String value) {
addCriterion("points =", value, "points");
return (Criteria) this;
}
public Criteria andPointsNotEqualTo(String value) {
addCriterion("points <>", value, "points");
return (Criteria) this;
}
public Criteria andPointsGreaterThan(String value) {
addCriterion("points >", value, "points");
return (Criteria) this;
}
public Criteria andPointsGreaterThanOrEqualTo(String value) {
addCriterion("points >=", value, "points");
return (Criteria) this;
}
public Criteria andPointsLessThan(String value) {
addCriterion("points <", value, "points");
return (Criteria) this;
}
public Criteria andPointsLessThanOrEqualTo(String value) {
addCriterion("points <=", value, "points");
return (Criteria) this;
}
public Criteria andPointsLike(String value) {
addCriterion("points like", value, "points");
return (Criteria) this;
}
public Criteria andPointsNotLike(String value) {
addCriterion("points not like", value, "points");
return (Criteria) this;
}
public Criteria andPointsIn(List<String> values) {
addCriterion("points in", values, "points");
return (Criteria) this;
}
public Criteria andPointsNotIn(List<String> values) {
addCriterion("points not in", values, "points");
return (Criteria) this;
}
public Criteria andPointsBetween(String value1, String value2) {
addCriterion("points between", value1, value2, "points");
return (Criteria) this;
}
public Criteria andPointsNotBetween(String value1, String value2) {
addCriterion("points not between", value1, value2, "points");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;

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

@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.ccsens.ht.uitl.Constant;
import com.ccsens.util.PdfUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -475,4 +476,46 @@ public class PatientReportVo {
private Integer count;
}
@ApiModel("报告单的详细答题信息")
@Data
public static class ReportDetailAnswer {
@ApiModelProperty("上级选项名")
private String parentCode;
@ApiModelProperty("题目信息")
private List<QuestionInfo> questionList;
}
@ApiModel("题目详情")
@Data
public static class QuestionInfo {
@ApiModelProperty("试题id")
private Long questionId;
@ApiModelProperty("题目名")
private String questionName;
@ApiModelProperty("题目类型")
private byte type;
@ApiModelProperty("用户操作类型")
private byte operateType;
@ApiModelProperty("题目答案")
private List<Answer> answers;
@ApiModelProperty("答题信息(图片路径等)")
private String otherValue;
}
@ApiModel("病友的答案")
@Data
public static class Answer {
@JsonIgnore
private String optionName;
@ApiModelProperty("答案")
private String answer;
}
@ApiModel("病友画图详情")
@Data
public static class QueryQuestionImg {
@ApiModelProperty("图片路径")
private String imgPath;
}
}

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

@ -273,15 +273,31 @@ public class QuestionVo {
private Long patientReportId;
@ApiModelProperty("测评试题id")
private Long questionId;
@ApiModelProperty("题目类型")
private byte questionType;
@ApiModelProperty("题目详情(画图题的图片)")
private String questionName;
@ApiModelProperty("时间")
private Long beginTime;
@ApiModelProperty("轨迹,每个字符串是一条轨迹,轨迹内格式(x,y,time;x,y,time;.....)")
private List<String> points;
private List<Point> points;
@ApiModelProperty("画板大小")
private Canvas canvas;
@ApiModelProperty("笔触信息")
private CanvasLine line;
@ApiModelProperty("统计参数")
private Parameter parameters;
}
@Data
@ApiModel("轨迹信息及颜色")
public static class Point{
@ApiModelProperty("颜色")
private Integer color;
@ApiModelProperty("轨迹坐标值")
private String value;
}
@Data
@ApiModel("画板信息")
public static class Canvas{
@ -298,6 +314,39 @@ public class QuestionVo {
@ApiModelProperty("笔触粗细")
private Integer width;
}
@Data
@ApiModel("轨迹参数统计")
public static class Parameter{
@ApiModelProperty("打开画板至开始画图的时间")
private Long startDuration;
@ApiModelProperty("画图总时长,下笔到结束")
private Long totalDuration;
@ApiModelProperty("总笔画数")
private int lineNums;
@ApiModelProperty("最长笔画")
private double longLine;
@ApiModelProperty("最短笔画")
private double shortLine;
@ApiModelProperty("笔画中间值")
private double centre;
@ApiModelProperty("平均每分钟画几笔")
private int aveTimes;
@ApiModelProperty("超出占比")
private String beyondProportion;
@ApiModelProperty("每条轨迹的参数")
private List<LineParameter> lineParameterList;
}
@Data
@ApiModel("每条轨迹信息")
public static class LineParameter{
@ApiModelProperty("笔画长度")
private double length;
@ApiModelProperty("用时")
private long duration;
@ApiModelProperty("速度")
private double speed;
@ApiModelProperty("时间间隔,和上一笔比较")
private long intervalDuration;
}
}

3
ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientCanvasDao.java

@ -1,5 +1,6 @@
package com.ccsens.ht.persist.dao;
import com.ccsens.ht.bean.vo.QuestionVo;
import com.ccsens.ht.persist.mapper.HtPatientCanvasMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -15,5 +16,5 @@ public interface HtPatientCanvasDao extends HtPatientCanvasMapper {
/**
* 查看用户画图轨迹
*/
List<String> getCanvasPoints(@Param("canvasId") Long canvasId);
List<QuestionVo.Point> getCanvasPoints(@Param("canvasId") Long canvasId);
}

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

@ -87,4 +87,12 @@ public interface HtPatientReportDao extends HtPatientReportMapper {
* @return
*/
List<PatientReportVo.Day> countByDay(PatientReportDto.Day param);
/**
* 查询报告单的详细答题洗洗
* @param id 报告单id
* @param evaluationCode 测试类型
* @return
*/
List<PatientReportVo.ReportDetailAnswer> queryReportAnswer(@Param("id")Long id, @Param("evaluationCode")String evaluationCode);
}

6
ht/src/main/java/com/ccsens/ht/persist/mapper/HtPatientCanvasLineMapper.java

@ -16,15 +16,21 @@ public interface HtPatientCanvasLineMapper {
int insertSelective(HtPatientCanvasLine record);
List<HtPatientCanvasLine> selectByExampleWithBLOBs(HtPatientCanvasLineExample example);
List<HtPatientCanvasLine> selectByExample(HtPatientCanvasLineExample example);
HtPatientCanvasLine selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") HtPatientCanvasLine record, @Param("example") HtPatientCanvasLineExample example);
int updateByExampleWithBLOBs(@Param("record") HtPatientCanvasLine record, @Param("example") HtPatientCanvasLineExample example);
int updateByExample(@Param("record") HtPatientCanvasLine record, @Param("example") HtPatientCanvasLineExample example);
int updateByPrimaryKeySelective(HtPatientCanvasLine record);
int updateByPrimaryKeyWithBLOBs(HtPatientCanvasLine record);
int updateByPrimaryKey(HtPatientCanvasLine record);
}

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

@ -132,4 +132,14 @@ public interface IPatientReportService {
* @return
*/
List<PatientReportVo.Day> countByDay(PatientReportDto.Day param, Long userId);
/**
* 查询报告单的详细答题信息
* @param param 报告单ID和测评类型
* @param userId userId
* @return 返回每个题目和答案
*/
List<PatientReportVo.ReportDetailAnswer> queryReportAnswer(PatientReportDto.QueryReportAnswer param, Long userId);
}

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

@ -554,4 +554,11 @@ public class PatientReportService implements IPatientReportService {
public List<PatientReportVo.Day> countByDay(PatientReportDto.Day param, Long userId) {
return htPatientReportDao.countByDay(param);
}
@Override
public List<PatientReportVo.ReportDetailAnswer> queryReportAnswer(PatientReportDto.QueryReportAnswer param, Long userId) {
return htPatientReportDao.queryReportAnswer(param.getId(),param.getEvaluationCode());
}
}

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

@ -28,6 +28,7 @@ import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
@ -439,8 +440,9 @@ public class QuestionService implements IQuestionService {
patientCanvas.setId(snowflake.nextId());
patientCanvas.setPatientReportId(param.getPatientReportId());
patientCanvas.setQuestionId(param.getQuestionId());
patientCanvas.setOpenCanvasTime(param.getOpenCanvasTime());
patientCanvas.setBeginTime(param.getBeginTime());
patientCanvas.setBeyondProportion(param.getBeyondProportion());
if(ObjectUtil.isNotNull(param.getCanvas())){
patientCanvas.setCanvasWidth(param.getCanvas().getWidth());
patientCanvas.setCanvasHeight(param.getCanvas().getHeight());
@ -461,10 +463,10 @@ public class QuestionService implements IQuestionService {
patientCanvasLineMapper.insertSelective(patientCanvasLine);
});
}
//查询轨迹信息
QuestionDto.QueryPatientCanvas patient = new QuestionDto.QueryPatientCanvas();
patient.setPatientReportId(param.getPatientReportId());
patient.setQuestionId(param.getQuestionId());
return getCanvas(patient,userId);
}
@ -479,15 +481,22 @@ public class QuestionService implements IQuestionService {
canvasExample.createCriteria().andPatientReportIdEqualTo(param.getPatientReportId()).andQuestionIdEqualTo(param.getQuestionId());
canvasExample.setOrderByClause("begin_time DESC");
List<HtPatientCanvas> patientCanvasList = patientCanvasDao.selectByExample(canvasExample);
log.info("查询画图记录:{}",patientCanvasList);
if(CollectionUtil.isEmpty(patientCanvasList)){
return canvasList;
}
//查询题目信息
HtQuestion question = htQuestionDao.selectByPrimaryKey(param.getQuestionId());
if(ObjectUtil.isNull(question)){
throw new BaseException(CodeEnum.PARAM_ERROR);
}
patientCanvasList.forEach(htPatientCanvas ->{
QuestionVo.PatientCanvas patientCanvas = new QuestionVo.PatientCanvas();
patientCanvas.setPatientCanvasId(htPatientCanvas.getId());
patientCanvas.setPatientReportId(htPatientCanvas.getPatientReportId());
patientCanvas.setQuestionId(htPatientCanvas.getQuestionId());
patientCanvas.setQuestionType(question.getType());
patientCanvas.setQuestionName(question.getQuestion());
patientCanvas.setBeginTime(htPatientCanvas.getBeginTime());
QuestionVo.Canvas canvas = new QuestionVo.Canvas();
@ -498,9 +507,140 @@ public class QuestionService implements IQuestionService {
canvasLine.setColor(htPatientCanvas.getLineColor());
canvasLine.setWidth(htPatientCanvas.getLineWidth());
patientCanvas.setLine(canvasLine);
patientCanvas.setPoints(patientCanvasDao.getCanvasPoints(htPatientCanvas.getId()));
//颜色和轨迹坐标
List<QuestionVo.Point> canvasPoints = getCanvasPoints(htPatientCanvas);
patientCanvas.setPoints(canvasPoints);
//计算参数
QuestionVo.Parameter parameter = getParameter(htPatientCanvas);
patientCanvas.setParameters(parameter);
canvasList.add(patientCanvas);
});
return canvasList;
}
private List<QuestionVo.Point> getCanvasPoints(HtPatientCanvas htPatientCanvas) {
List<QuestionVo.Point> canvasPoints = patientCanvasDao.getCanvasPoints(htPatientCanvas.getId());
if(canvasPoints.size() > 16){
int c = 240 / (((canvasPoints.size() + 1) / 4) - 1);
int a = 0;
int b = 0;
for(QuestionVo.Point point : canvasPoints){
if(a < 4){
a++;
}else {
b += c;
a = 0;
}
point.setColor(b);
}
}else {
int a = 0;
int b = 0;
List<Integer> colours = Constant.LineColour.COLOUR;
for(QuestionVo.Point point : canvasPoints){
if(a < 4){
a++;
}else {
b++;
a = 0;
}
point.setColor(colours.get(b));
}
}
return canvasPoints;
}
/**
* 统计画图的参数
* @param htPatientCanvas 画板信息
* @return 返回此次画图的参数
*/
private QuestionVo.Parameter getParameter(HtPatientCanvas htPatientCanvas) {
QuestionVo.Parameter parameter = new QuestionVo.Parameter();
//开始画图时长:打开画板到第一笔画图时长
parameter.setStartDuration(htPatientCanvas.getBeginTime() - htPatientCanvas.getOpenCanvasTime());
//获取轨迹信息
List<QuestionVo.Point> canvasPoints = patientCanvasDao.getCanvasPoints(htPatientCanvas.getId());
//最后一笔的结束时间
String[] pointsLast = canvasPoints.get(canvasPoints.size() - 1).getValue().split(";");
String[] split = pointsLast[pointsLast.length - 1].split(",");
long endTime = Long.parseLong(split[split.length - 1]);
//超出占比
parameter.setBeyondProportion(htPatientCanvas.getBeyondProportion());
//画图总时长
parameter.setTotalDuration(endTime);
//总笔画数
parameter.setLineNums(canvasPoints.size());
//共几分钟
double d = (double) endTime / 1000 / 60;
//每分钟几笔
parameter.setAveTimes((int) Math.floor(canvasPoints.size() / d));
//每笔数据
List<QuestionVo.LineParameter> lineParameterList = new ArrayList<>();
long intervalDuration = 0;
//最长的笔画
double longLine = 0;
//最短的笔画
double shortLine = 0;
for(QuestionVo.Point canvas : canvasPoints){
//时间
QuestionVo.LineParameter lineParameter = new QuestionVo.LineParameter();
String[] a = canvas.getValue().split(";");
if(a.length <= 0){
continue;
}
String[] s = a[0].split(",");
String[] e = a[a.length - 1].split(",");
long duration = Long.parseLong(e[e.length - 1]) - Long.parseLong(s[s.length - 1]);
lineParameter.setDuration(duration);
//长度
double length = getLengthByCanvas(a);
lineParameter.setLength(length);
//计算最长最短
if(longLine == 0){
longLine = length;
}else if(length > longLine){
longLine = length;
}
if(shortLine == 0){
shortLine = length;
}else if(length < shortLine){
shortLine = length;
}
//速度
double speed = 0;
if(length != 0 && duration != 0){
speed = BigDecimal.valueOf(length / duration).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}
lineParameter.setSpeed(speed);
//和上一笔的间隔
if(Long.parseLong(e[e.length - 1]) == 0){
lineParameter.setIntervalDuration(htPatientCanvas.getBeginTime() - htPatientCanvas.getOpenCanvasTime());
}else {
intervalDuration = Long.parseLong(e[e.length - 1]) - intervalDuration;
lineParameter.setIntervalDuration(intervalDuration);
}
lineParameterList.add(lineParameter);
}
parameter.setLineParameterList(lineParameterList);
//最长笔画
parameter.setLongLine(longLine);
//最短笔画
parameter.setShortLine(shortLine);
//TODO 笔画中间值
return parameter;
}
private double getLengthByCanvas(String[] canvas) {
double l = 0;
for (int i = 1; i < canvas.length; i++){
String[] a = canvas[i].split(",");
String[] b = canvas[i - 1].split(",");
double pow = Math.pow(Integer.parseInt(a[0]) - Integer.parseInt(b[0]), 2);
double pow1 = Math.pow(Integer.parseInt(a[1]) - Integer.parseInt(b[1]), 2);
double sqrt = Math.sqrt(pow + pow1);
l += sqrt;
}
return BigDecimal.valueOf(l).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}
}

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

@ -22,7 +22,17 @@ public class Constant {
/**上传图片访问路径*/
public static final String UPLOAD_URL = "uploads/";
/**病友画图轨迹颜色*/
public static final class LineColour {
public final static List<Integer> COLOUR = new ArrayList<>();
static {
COLOUR.add(0);
COLOUR.add(30);
COLOUR.add(120);
COLOUR.add(240);
}
}
/**注册来源*/
public static final class Regist {
public final static byte SOURCE = 0;
@ -31,6 +41,8 @@ public class Constant {
}
/**
* 医疗职称相关常量
*/

4
ht/src/main/resources/mapper_dao/HtPatientCanvasDao.xml

@ -3,9 +3,9 @@
<mapper namespace="com.ccsens.ht.persist.dao.HtPatientCanvasDao">
<select id="getCanvasPoints" resultType="java.lang.String">
<select id="getCanvasPoints" resultType="com.ccsens.ht.bean.vo.QuestionVo$Point">
SELECT
points
points as `value`
FROM
t_ht_patient_canvas_line cl
WHERE

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

@ -1,50 +1,50 @@
<?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.HtPatientReportDao">
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.vo.PatientReportVo$ReprotPatient">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="patient_id" jdbcType="BIGINT" property="patientId" />
<result column="patient_age" jdbcType="TINYINT" property="patientAge" />
<result column="doctor_id" jdbcType="BIGINT" property="doctorId" />
<result column="doctor_name" jdbcType="VARCHAR" property="doctorName" />
<result column="serial_number" jdbcType="VARCHAR" property="serialNumber" />
<result column="initial_impression" jdbcType="VARCHAR" property="initialImpression" />
<result column="clinical_diagnosis" jdbcType="VARCHAR" property="clinicalDiagnosis" />
<result column="pasi" jdbcType="TINYINT" property="pasi" />
<result column="department" jdbcType="VARCHAR" property="department" />
<result column="bed_number" jdbcType="VARCHAR" property="bedNumber" />
<result column="report_time" jdbcType="BIGINT" property="reportTime" />
<result column="check_time" jdbcType="BIGINT" property="checkTime" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="patient_name" jdbcType="VARCHAR" property="patientName"/>
<result column="patient_number" jdbcType="VARCHAR" property="patientNumber" />
<result column="hospital_number" jdbcType="VARCHAR" property="hospitalNumber" />
<result column="sex" jdbcType="TINYINT" property="sex" />
<result column="educational_status" jdbcType="TINYINT" property="educationalStatus" />
<result column="educational_status_unit" jdbcType="VARCHAR" property="educationalStatusUnit" />
<result column="career" jdbcType="TINYINT" property="career" />
<result column="hospital" jdbcType="VARCHAR" property="hospital" />
</resultMap>
<resultMap id="ScoreMap" type="com.ccsens.ht.bean.vo.PatientReportVo$ReportScore">
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="parent_code" jdbcType="VARCHAR" property="parentCode"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="total_score" jdbcType="INTEGER" property="totalScore"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="type" jdbcType="TINYINT" property="type"/>
<result column="score" jdbcType="INTEGER" property="score"/>
</resultMap>
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.vo.PatientReportVo$ReprotPatient">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="patient_id" jdbcType="BIGINT" property="patientId"/>
<result column="patient_age" jdbcType="TINYINT" property="patientAge"/>
<result column="doctor_id" jdbcType="BIGINT" property="doctorId"/>
<result column="doctor_name" jdbcType="VARCHAR" property="doctorName"/>
<result column="serial_number" jdbcType="VARCHAR" property="serialNumber"/>
<result column="initial_impression" jdbcType="VARCHAR" property="initialImpression"/>
<result column="clinical_diagnosis" jdbcType="VARCHAR" property="clinicalDiagnosis"/>
<result column="pasi" jdbcType="TINYINT" property="pasi"/>
<result column="department" jdbcType="VARCHAR" property="department"/>
<result column="bed_number" jdbcType="VARCHAR" property="bedNumber"/>
<result column="report_time" jdbcType="BIGINT" property="reportTime"/>
<result column="check_time" jdbcType="BIGINT" property="checkTime"/>
<result column="url" jdbcType="VARCHAR" property="url"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="patient_name" jdbcType="VARCHAR" property="patientName"/>
<result column="patient_number" jdbcType="VARCHAR" property="patientNumber"/>
<result column="hospital_number" jdbcType="VARCHAR" property="hospitalNumber"/>
<result column="sex" jdbcType="TINYINT" property="sex"/>
<result column="educational_status" jdbcType="TINYINT" property="educationalStatus"/>
<result column="educational_status_unit" jdbcType="VARCHAR" property="educationalStatusUnit"/>
<result column="career" jdbcType="TINYINT" property="career"/>
<result column="hospital" jdbcType="VARCHAR" property="hospital"/>
</resultMap>
<resultMap id="ScoreMap" type="com.ccsens.ht.bean.vo.PatientReportVo$ReportScore">
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="parent_code" jdbcType="VARCHAR" property="parentCode"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="total_score" jdbcType="INTEGER" property="totalScore"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="type" jdbcType="TINYINT" property="type"/>
<result column="score" jdbcType="INTEGER" property="score"/>
</resultMap>
<select id="queryReportResult" resultMap="BaseResultMap">
<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
from t_ht_patient_report r, t_ht_patient p, t_ht_doctor d
where r.patient_id = p.id and r.doctor_id = d.id and r.id = #{id, jdbcType=BIGINT}
and r.is_del = 0 and p.is_del = 0 and d.is_del = 0
</select>
<select id="queryReportScore" resultMap="ScoreMap">
<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) t1
@ -56,13 +56,13 @@
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'
and option_name in ('carer','result') and is_del = 0 group by option_name;
</select>
<select id="checkComplete" resultType="com.ccsens.ht.bean.vo.PatientReportVo$Complete">
<select id="checkComplete" resultType="com.ccsens.ht.bean.vo.PatientReportVo$Complete">
select r.id, r.name, p.id as patientId, p.name as patientName, p.idcard as patientIdCard,
r.create_time as createTime,
concat('检测到您在', r.create_time, '为患者', p.name,'的检测报告尚未完成,是否继续?') as description ,
@ -73,75 +73,149 @@
and r.complete_status = 0 and d.is_del = 0 and r.is_del = 0 and p.is_del = 0
order by r.create_time desc limit 1;
</select>
<select id="ignoreComplete">
<select id="ignoreComplete">
update t_ht_patient_report set complete_status = 2 , show_status = 0
where id = #{id, jdbcType=BIGINT} and complete_status = 0 and is_del = 0 and doctor_id in
(select doctor_id from t_ht_doctor where user_id = #{userId, jdbcType=BIGINT} and audit_state = 1 and is_del = 0)
</select>
<select id="queryReportName" resultType="com.ccsens.ht.bean.vo.PatientReportVo$ReportName">
select id, name, url, doctor_id as doctorId, 0 as authority from t_ht_patient_report
<where>
<if test="doctorId != null">
and doctor_id = #{doctorId, jdbcType=BIGINT}
select id, name, url, doctor_id as doctorId, 0 as authority from t_ht_patient_report
<where>
<if test="doctorId != null">
and doctor_id = #{doctorId, jdbcType=BIGINT}
</if>
<if test="patientId != null">
and patient_id = #{patientId, jdbcType=BIGINT}
</if>
and show_status = 1
and is_del = 0
</where>
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
from t_ht_patient_report r, t_ht_patient p
where r.patient_id = p.id
<if test="patientSex != null">
and p.sex = #{patientSex}
</if>
<if test="startAge != null">
and r.patient_age &gt; #{startAge}
</if>
<if test="endAge != null">
and r.patient_age &lt; #{endAge}
</if>
<if test="clinicalDiagnosis != null and clinicalDiagnosis != ''">
and r.clinical_diagnosis = #{clinicalDiagnosis}
</if>
<if test="patientId != null">
and patient_id = #{patientId, jdbcType=BIGINT}
<if test="pasi != null">
and r.pasi = #{pasi}
</if>
and show_status = 1
and is_del = 0
</where>
order by create_time desc
<if test="startTime != null">
and r.report_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and r.report_time &lt;= #{endTime}
</if>
and r.show_status = 1
and r.is_del = 0
order by r.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
from t_ht_patient_report r, t_ht_patient p
where r.patient_id = p.id
<if test="patientSex != null">
and p.sex = #{patientSex}
</if>
<if test="startAge != null">
and r.patient_age &gt; #{startAge}
</if>
<if test="endAge != null">
and r.patient_age &lt; #{endAge}
</if>
<if test="clinicalDiagnosis != null and clinicalDiagnosis != ''">
and r.clinical_diagnosis = #{clinicalDiagnosis}
</if>
<if test="pasi != null">
and r.pasi = #{pasi}
</if>
<if test="startTime != null">
and r.report_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and r.report_time &lt;= #{endTime}
</if>
and r.show_status = 1
and r.is_del = 0
order by r.create_time desc
</select>
<select id="countByClinicalDiagnosis" resultType="com.ccsens.ht.bean.vo.PatientReportVo$ClinicalDiagnosis">
<select id="countByClinicalDiagnosis" resultType="com.ccsens.ht.bean.vo.PatientReportVo$ClinicalDiagnosis">
select clinical_diagnosis as diagnosis, count(*) as count from t_ht_patient_report
where is_del = 0 and show_status = 1 group by diagnosis
</select>
<select id="countBySexAndAge" resultType="com.ccsens.ht.bean.vo.PatientReportVo$AgeAndSex">
<select id="countBySexAndAge" resultType="com.ccsens.ht.bean.vo.PatientReportVo$AgeAndSex">
select r.patient_age div 10 * 10 as ageLevel, p.sex as sex, count(*) as count from t_ht_patient_report r, t_ht_patient p
where r.patient_id = p.id and r.is_del = 0 and r.show_status = 1 group by ageLevel, sex
order by ageLevel, sex
</select>
<select id="countByDay" resultType="com.ccsens.ht.bean.vo.PatientReportVo$Day">
select FROM_UNIXTIME(report_time div 1000, '%Y-%m-%d') as dateDay, count(*) as count
from t_ht_patient_report
where is_del = 0 and show_status = 1
<if test="startTime != null">
and report_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and report_time &lt; #{endTime}
</if>
group by dateDay
</select>
<select id="countByDay" resultType="com.ccsens.ht.bean.vo.PatientReportVo$Day">
select FROM_UNIXTIME(report_time div 1000, '%Y-%m-%d') as dateDay, count(*) as count
from t_ht_patient_report
where is_del = 0 and show_status = 1
<if test="startTime != null">
and report_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and report_time &lt; #{endTime}
</if>
group by dateDay
</select>
<resultMap id="queryReportAnswer" type="com.ccsens.ht.bean.vo.PatientReportVo$ReportDetailAnswer">
<id column="parentCode" property="parentCode"/>
<collection property="questionList" ofType="com.ccsens.ht.bean.vo.PatientReportVo$QuestionInfo">
<id column="questionId" property="questionId"/>
<result column="questionName" property="questionName"/>
<result column="type" property="type"/>
<result column="operateType" property="operateType"/>
<result column="otherValue" property="otherValue"/>
<collection property="answers" ofType="com.ccsens.ht.bean.vo.PatientReportVo$Answer">
<id column="optionName" property="optionName"/>
<result column="answer" property="answer"/>
</collection>
</collection>
</resultMap>
<select id="queryReportAnswer" resultMap="queryReportAnswer">
SELECT
a.parentCode,
a.questionId,
a.questionName,
a.type,
a.operateType,
a.optionName,
t.answer,
r.record_value as otherValue
FROM
(
SELECT
q.id as questionId,
q.parent_code,
r.`name` as parentCode,
q.question as questionName,
q.type as type,
q.operate_type as operateType
,o.`name` as optionName
,o.id as optionId
,o.sort
FROM
t_ht_question q
LEFT JOIN t_ht_report r on q.parent_code = r.`code`
LEFT JOIN t_ht_question_option o on q.id = o.question_id
WHERE
q.evaluation_code = #{evaluationCode}
and q.is_del = 0
and r.is_del = 0
and o.is_del = 0
GROUP BY q.id ,o.`name`
) a
LEFT JOIN
(
SELECT * FROM t_ht_patient_question_record WHERE patient_report_id = #{id} and is_del = 0
)r on r.question_id = a.questionId
LEFT JOIN
(
SELECT
s.id,
s.question_id,
o.id as optionId,
o.`name` as optionName,
if(o.type = 'hidden',s.score,o.display) as answer
FROM
t_ht_patient_score s
LEFT JOIN t_ht_question_option o
on s.option_id = o.id
WHERE
s.patient_report_id = #{id}
and s.is_del = 0
and o.is_del = 0
) t
on a.optionName = t.optionName
and a.questionId = t.question_id
ORDER BY a.questionId ,a.sort
</select>
</mapper>

84
ht/src/main/resources/mapper_raw/HtPatientCanvasLineMapper.xml

@ -4,11 +4,13 @@
<resultMap id="BaseResultMap" type="com.ccsens.ht.bean.po.HtPatientCanvasLine">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="patient_canvas_id" jdbcType="BIGINT" property="patientCanvasId" />
<result column="points" jdbcType="VARCHAR" property="points" />
<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>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.ccsens.ht.bean.po.HtPatientCanvasLine">
<result column="points" jdbcType="LONGVARCHAR" property="points" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
@ -68,8 +70,27 @@
</where>
</sql>
<sql id="Base_Column_List">
id, patient_canvas_id, points, create_time, update_time, is_del
id, patient_canvas_id, create_time, update_time, is_del
</sql>
<sql id="Blob_Column_List">
points
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.ccsens.ht.bean.po.HtPatientCanvasLineExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from t_ht_patient_canvas_line
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="com.ccsens.ht.bean.po.HtPatientCanvasLineExample" resultMap="BaseResultMap">
select
<if test="distinct">
@ -84,9 +105,11 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from t_ht_patient_canvas_line
where id = #{id,jdbcType=BIGINT}
</select>
@ -101,11 +124,11 @@
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.ht.bean.po.HtPatientCanvasLine">
insert into t_ht_patient_canvas_line (id, patient_canvas_id, points,
create_time, update_time, is_del
insert into t_ht_patient_canvas_line (id, patient_canvas_id, create_time,
update_time, is_del, points
)
values (#{id,jdbcType=BIGINT}, #{patientCanvasId,jdbcType=BIGINT}, #{points,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT}
values (#{id,jdbcType=BIGINT}, #{patientCanvasId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT}, #{points,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.ccsens.ht.bean.po.HtPatientCanvasLine">
@ -117,9 +140,6 @@
<if test="patientCanvasId != null">
patient_canvas_id,
</if>
<if test="points != null">
points,
</if>
<if test="createTime != null">
create_time,
</if>
@ -129,6 +149,9 @@
<if test="isDel != null">
is_del,
</if>
<if test="points != null">
points,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -137,9 +160,6 @@
<if test="patientCanvasId != null">
#{patientCanvasId,jdbcType=BIGINT},
</if>
<if test="points != null">
#{points,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
@ -149,6 +169,9 @@
<if test="isDel != null">
#{isDel,jdbcType=TINYINT},
</if>
<if test="points != null">
#{points,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.ht.bean.po.HtPatientCanvasLineExample" resultType="java.lang.Long">
@ -166,9 +189,6 @@
<if test="record.patientCanvasId != null">
patient_canvas_id = #{record.patientCanvasId,jdbcType=BIGINT},
</if>
<if test="record.points != null">
points = #{record.points,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
@ -178,16 +198,30 @@
<if test="record.isDel != null">
is_del = #{record.isDel,jdbcType=TINYINT},
</if>
<if test="record.points != null">
points = #{record.points,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update t_ht_patient_canvas_line
set id = #{record.id,jdbcType=BIGINT},
patient_canvas_id = #{record.patientCanvasId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_del = #{record.isDel,jdbcType=TINYINT},
points = #{record.points,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_ht_patient_canvas_line
set id = #{record.id,jdbcType=BIGINT},
patient_canvas_id = #{record.patientCanvasId,jdbcType=BIGINT},
points = #{record.points,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_del = #{record.isDel,jdbcType=TINYINT}
@ -201,9 +235,6 @@
<if test="patientCanvasId != null">
patient_canvas_id = #{patientCanvasId,jdbcType=BIGINT},
</if>
<if test="points != null">
points = #{points,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
@ -213,13 +244,24 @@
<if test="isDel != null">
is_del = #{isDel,jdbcType=TINYINT},
</if>
<if test="points != null">
points = #{points,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.ccsens.ht.bean.po.HtPatientCanvasLine">
update t_ht_patient_canvas_line
set patient_canvas_id = #{patientCanvasId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_del = #{isDel,jdbcType=TINYINT},
points = #{points,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.ht.bean.po.HtPatientCanvasLine">
update t_ht_patient_canvas_line
set patient_canvas_id = #{patientCanvasId,jdbcType=BIGINT},
points = #{points,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_del = #{isDel,jdbcType=TINYINT}

42
ht/src/main/resources/mapper_raw/HtPatientCanvasMapper.xml

@ -13,6 +13,8 @@
<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="open_canvas_time" jdbcType="BIGINT" property="openCanvasTime" />
<result column="beyond_proportion" jdbcType="VARCHAR" property="beyondProportion" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -74,7 +76,7 @@
</sql>
<sql id="Base_Column_List">
id, patient_report_id, question_id, begin_time, canvas_width, canvas_height, line_color,
line_width, create_time, update_time, is_del
line_width, create_time, update_time, is_del, open_canvas_time, beyond_proportion
</sql>
<select id="selectByExample" parameterType="com.ccsens.ht.bean.po.HtPatientCanvasExample" resultMap="BaseResultMap">
select
@ -110,11 +112,13 @@
insert into t_ht_patient_canvas (id, patient_report_id, question_id,
begin_time, canvas_width, canvas_height,
line_color, line_width, create_time,
update_time, is_del)
update_time, is_del, open_canvas_time,
beyond_proportion)
values (#{id,jdbcType=BIGINT}, #{patientReportId,jdbcType=BIGINT}, #{questionId,jdbcType=BIGINT},
#{beginTime,jdbcType=BIGINT}, #{canvasWidth,jdbcType=INTEGER}, #{canvasHeight,jdbcType=INTEGER},
#{lineColor,jdbcType=VARCHAR}, #{lineWidth,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT})
#{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT}, #{openCanvasTime,jdbcType=BIGINT},
#{beyondProportion,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.ht.bean.po.HtPatientCanvas">
insert into t_ht_patient_canvas
@ -152,6 +156,12 @@
<if test="isDel != null">
is_del,
</if>
<if test="openCanvasTime != null">
open_canvas_time,
</if>
<if test="beyondProportion != null">
beyond_proportion,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -187,6 +197,12 @@
<if test="isDel != null">
#{isDel,jdbcType=TINYINT},
</if>
<if test="openCanvasTime != null">
#{openCanvasTime,jdbcType=BIGINT},
</if>
<if test="beyondProportion != null">
#{beyondProportion,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.ht.bean.po.HtPatientCanvasExample" resultType="java.lang.Long">
@ -231,6 +247,12 @@
<if test="record.isDel != null">
is_del = #{record.isDel,jdbcType=TINYINT},
</if>
<if test="record.openCanvasTime != null">
open_canvas_time = #{record.openCanvasTime,jdbcType=BIGINT},
</if>
<if test="record.beyondProportion != null">
beyond_proportion = #{record.beyondProportion,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -248,7 +270,9 @@
line_width = #{record.lineWidth,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_del = #{record.isDel,jdbcType=TINYINT}
is_del = #{record.isDel,jdbcType=TINYINT},
open_canvas_time = #{record.openCanvasTime,jdbcType=BIGINT},
beyond_proportion = #{record.beyondProportion,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -286,6 +310,12 @@
<if test="isDel != null">
is_del = #{isDel,jdbcType=TINYINT},
</if>
<if test="openCanvasTime != null">
open_canvas_time = #{openCanvasTime,jdbcType=BIGINT},
</if>
<if test="beyondProportion != null">
beyond_proportion = #{beyondProportion,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -300,7 +330,9 @@
line_width = #{lineWidth,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_del = #{isDel,jdbcType=TINYINT}
is_del = #{isDel,jdbcType=TINYINT},
open_canvas_time = #{openCanvasTime,jdbcType=BIGINT},
beyond_proportion = #{beyondProportion,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

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

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

55
util/src/test/java/com/ccsens/util/Base64Test.java

@ -11,6 +11,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
@ -34,4 +35,58 @@ public class Base64Test {
}
@Test
public void test02() throws Exception {
List<Integer> listX = new ArrayList<>();
List<Integer> listY = new ArrayList<>();
listX.add(724);
listX.add(724);
listX.add(723);
listX.add(719);
listX.add(716);
listX.add(713);
listX.add(710);
listX.add(707);
listX.add(704);
listX.add(696);
listX.add(696);
listX.add(696);
listX.add(696);
listX.add(696);
listX.add(696);
listX.add(696);
listX.add(696);
listX.add(696);
listY.add(267);
listY.add(268);
listY.add(273);
listY.add(290);
listY.add(303);
listY.add(315);
listY.add(330);
listY.add(351);
listY.add(374);
listY.add(516);
listY.add(537);
listY.add(557);
listY.add(583);
listY.add(592);
listY.add(598);
listY.add(602);
listY.add(604);
listY.add(605);
double a = 0;
for (int i = 1; i < listX.size(); i++){
double pow = Math.pow(listX.get(i) - listX.get(i - 1), 2);
double pow1 = Math.pow(listY.get(i) - listY.get(i - 1), 2);
double sqrt = Math.sqrt(pow + pow1);
a += sqrt;
System.out.println(a);
}
System.out.println("=====" + a);
}
}

Loading…
Cancel
Save