zhizhi wu 4 years ago
parent
commit
5740f37ddd
  1. 9
      ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java
  2. 32
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java
  3. 17
      ht/src/main/java/com/ccsens/ht/uitl/Constant.java

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

@ -376,6 +376,15 @@ public class QuestionVo {
private String centreCoordinate; private String centreCoordinate;
@ApiModelProperty("重心 暂定为坐标:X,Y") @ApiModelProperty("重心 暂定为坐标:X,Y")
private String barycenterCoordinate; private String barycenterCoordinate;
// 上下左右应部分图片存在倒转展示的问题,前端应反向展示
@ApiModelProperty("上边距距离画板中心的距离")
private int topLength;
@ApiModelProperty("下边距距离画板中心的距离")
private int bottomLength;
@ApiModelProperty("上边距距离画板中心的距离")
private int leftLength;
@ApiModelProperty("下边距距离画板中心的距离")
private int rightLength;
@ApiModelProperty("最小外接长方形面积 单位为px") @ApiModelProperty("最小外接长方形面积 单位为px")
private double minRectangleAcreage; private double minRectangleAcreage;
@ApiModelProperty("最小外接圆面积 单位为px 保留两位小数") @ApiModelProperty("最小外接圆面积 单位为px 保留两位小数")

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

@ -327,13 +327,18 @@ public class QuestionService implements IQuestionService {
private void saveAnswerRecord(QuestionDto.Score score, HtQuestion question) { private void saveAnswerRecord(QuestionDto.Score score, HtQuestion question) {
if (StrUtil.isNotBlank(score.getPath())) { if (StrUtil.isNotBlank(score.getPath())) {
HtPatientQuestionRecordExample example = new HtPatientQuestionRecordExample(); HtPatientQuestionRecordExample example = new HtPatientQuestionRecordExample();
String type = ""; String type;
switch (question.getOperateType()) { switch (question.getOperateType()) {
case 1://语音
case 4://敲击 case Constant.Ht.Operation.VOICE://语音
case Constant.Ht.Operation.KNOCK://敲击
type = Constant.Ht.Record.ANSWER_AUDIO; type = Constant.Ht.Record.ANSWER_AUDIO;
break; 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; type = Constant.Ht.Record.ANSWER_IMG;
break; break;
default: default:
@ -572,7 +577,7 @@ public class QuestionService implements IQuestionService {
List<QuestionVo.Point> canvasPoints = getCanvasPoints(htPatientCanvas); List<QuestionVo.Point> canvasPoints = getCanvasPoints(htPatientCanvas);
patientCanvas.setPoints(canvasPoints); patientCanvas.setPoints(canvasPoints);
//计算参数 //计算参数
QuestionVo.Parameter parameter = getParameter(htPatientCanvas, param); QuestionVo.Parameter parameter = getParameter(question, htPatientCanvas, param);
patientCanvas.setParameters(parameter); patientCanvas.setParameters(parameter);
canvasList.add(patientCanvas); canvasList.add(patientCanvas);
}); });
@ -639,11 +644,13 @@ public class QuestionService implements IQuestionService {
/** /**
* 统计画图的参数 * 统计画图的参数
*
* @param question
* @param htPatientCanvas 画板信息 * @param htPatientCanvas 画板信息
* @param param 请求参数 参考长度 参考思考时间 * @param param 请求参数 参考长度 参考思考时间
* @return 返回此次画图的参数 * @return 返回此次画图的参数
*/ */
private QuestionVo.Parameter getParameter(HtPatientCanvas htPatientCanvas, QuestionDto.QueryPatientCanvas param) { private QuestionVo.Parameter getParameter(HtQuestion question, HtPatientCanvas htPatientCanvas, QuestionDto.QueryPatientCanvas param) {
QuestionVo.Parameter parameter = new QuestionVo.Parameter(); QuestionVo.Parameter parameter = new QuestionVo.Parameter();
//开始画图时长:打开画板到第一笔画图时长 //开始画图时长:打开画板到第一笔画图时长
parameter.setStartDuration(htPatientCanvas.getBeginTime() - htPatientCanvas.getOpenCanvasTime()); parameter.setStartDuration(htPatientCanvas.getBeginTime() - htPatientCanvas.getOpenCanvasTime());
@ -810,6 +817,19 @@ public class QuestionService implements IQuestionService {
parameter.setMinCircleAcreage(new BigDecimal(Math.PI * diameter * diameter / 4).setScale(2, BigDecimal.ROUND_HALF_UP)); parameter.setMinCircleAcreage(new BigDecimal(Math.PI * diameter * diameter / 4).setScale(2, BigDecimal.ROUND_HALF_UP));
// 四个边界点 // 四个边界点
setFourPoint(canvasPoints, minX, maxX, minY, maxY); setFourPoint(canvasPoints, minX, maxX, minY, maxY);
// 计算四个边界点构成的长方形距离画板重心的距离
int canvasHeight = htPatientCanvas.getCanvasHeight();
int canvasWidth = htPatientCanvas.getCanvasWidth();
// 画板是否为canvas的一半
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;
parameter.setTopLength(Math.abs(minY.value - centerY));
parameter.setBottomLength(Math.abs(maxY.value - centerY));
parameter.setLeftLength(Math.abs(minX.value - centerX));
parameter.setRightLength(Math.abs(maxX.value - centerX));
//平均长度 //平均长度
BigDecimal aveLength = BigDecimal.valueOf(totalLength / canvasPoints.size()).setScale(2, RoundingMode.HALF_UP); BigDecimal aveLength = BigDecimal.valueOf(totalLength / canvasPoints.size()).setScale(2, RoundingMode.HALF_UP);

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

@ -67,6 +67,23 @@ public class Constant {
/**删除*/ /**删除*/
public final static byte IS_DEL = 1; public final static byte IS_DEL = 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 final static class Rule {
public static final byte SMALL = 0; public static final byte SMALL = 0;
public static final String SMALL_NUM = "small"; public static final String SMALL_NUM = "small";

Loading…
Cancel
Save