diff --git a/ht/src/main/java/com/ccsens/ht/api/QuestionController.java b/ht/src/main/java/com/ccsens/ht/api/QuestionController.java index 5a97b9ba..dfcb1797 100644 --- a/ht/src/main/java/com/ccsens/ht/api/QuestionController.java +++ b/ht/src/main/java/com/ccsens/ht/api/QuestionController.java @@ -133,6 +133,19 @@ public class QuestionController { return JsonResponse.newInstance().ok(); } + @MustLogin + @DoctorAudit + @ApiOperation(value = "恢复画图轨迹",notes = "恢复画图的轨迹") + @ApiImplicitParams({ + }) + @RequestMapping(value="/backCanvas", method = RequestMethod.POST) + public JsonResponse backCanvas(@RequestBody @ApiParam @Valid QueryDto queryDto) { + log.info("恢复画图轨迹"); + questionService.backCanvas(queryDto.getParam(), queryDto.getUserId()); + log.info("恢复画图轨迹成功"); + return JsonResponse.newInstance().ok(); + } + @ApiOperation(value = "导出图片的题目画图每笔的长度等",notes = "导出图片的题目画图每笔的长度等") @ApiImplicitParams({ @ApiImplicitParam(name = "json", value = "指定题目", required = true) diff --git a/ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java b/ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java index 42be9446..3b2c0850 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java +++ b/ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java @@ -145,6 +145,14 @@ public class QuestionDto { @ApiModelProperty("轨迹的id") private List pointId; } + + @Data + @ApiModel("恢复画图笔画") + public static class BackPatientCanvas{ + @ApiModelProperty("轨迹的id") + private Long pointId; + } + @Data @ApiModel("导出线条长度") public static class ExportLine { diff --git a/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java b/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java index 3cded2eb..b4dc1b6d 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java +++ b/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java @@ -409,7 +409,7 @@ public class QuestionVo { @ApiModelProperty("开始时间") private Long beginTime; @ApiModelProperty("轨迹,每个字符串是一条轨迹,轨迹内格式(x,y,time;x,y,time;.....)") - private List points; + private List points; @ApiModelProperty("画板大小") private Canvas canvas; @ApiModelProperty("背景图片路径") @@ -429,6 +429,18 @@ public class QuestionVo { @ApiModelProperty("轨迹坐标值 x,y,time,type type:0 普通 1左 2右 3 上 4 下") private String value; } + @Data + @ApiModel("轨迹信息及颜色") + public static class PointStatus{ + @ApiModelProperty("id") + private Long pointId; + @ApiModelProperty("颜色") + private Integer color; + @ApiModelProperty("轨迹坐标值 x,y,time,type type:0 普通 1左 2右 3 上 4 下") + private String value; + @ApiModelProperty("状态 0:未删除 1:删除") + private byte delStatus; + } @Data @ApiModel("坐标") diff --git a/ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientCanvasDao.java b/ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientCanvasDao.java index 1914869d..fb8fb848 100644 --- a/ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientCanvasDao.java +++ b/ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientCanvasDao.java @@ -15,6 +15,14 @@ public interface HtPatientCanvasDao extends HtPatientCanvasMapper { /** * 查看用户画图轨迹 + * @param canvasId 画板ID + * @return List 画图轨迹 */ List getCanvasPoints(@Param("canvasId") Long canvasId); + /** + * 查看用户全部画图轨迹,含删除轨迹 + * @param id 画板ID + * @return List 画图轨迹 + */ + List getCanvasPointsDel(@Param("canvasId") Long id); } diff --git a/ht/src/main/java/com/ccsens/ht/service/IQuestionService.java b/ht/src/main/java/com/ccsens/ht/service/IQuestionService.java index 20450c1e..0aabf37c 100644 --- a/ht/src/main/java/com/ccsens/ht/service/IQuestionService.java +++ b/ht/src/main/java/com/ccsens/ht/service/IQuestionService.java @@ -76,4 +76,11 @@ public interface IQuestionService { * @return */ Workbook exportLine(QuestionDto.ExportLine answer); + + /** + * 恢复画图轨迹 + * @param param 画图ID + * @param userId 操作人 + */ + void backCanvas(QuestionDto.BackPatientCanvas param, Long userId); } diff --git a/ht/src/main/java/com/ccsens/ht/service/QuestionService.java b/ht/src/main/java/com/ccsens/ht/service/QuestionService.java index f556da65..26761747 100644 --- a/ht/src/main/java/com/ccsens/ht/service/QuestionService.java +++ b/ht/src/main/java/com/ccsens/ht/service/QuestionService.java @@ -658,7 +658,7 @@ public class QuestionService implements IQuestionService { canvasLine.setWidth(htPatientCanvas.getLineWidth()); patientCanvas.setLine(canvasLine); //颜色和轨迹坐标 - List canvasPoints = getCanvasPoints(htPatientCanvas); + List canvasPoints = getCanvasPoints(htPatientCanvas); patientCanvas.setPoints(canvasPoints); //计算参数 QuestionVo.Parameter parameter = getParameter(question, htPatientCanvas, param); @@ -675,14 +675,15 @@ public class QuestionService implements IQuestionService { return patientCanvasDao.selectByExample(canvasExample); } - private List getCanvasPoints(HtPatientCanvas htPatientCanvas) { - List canvasPoints = patientCanvasDao.getCanvasPoints(htPatientCanvas.getId()); + private List getCanvasPoints(HtPatientCanvas htPatientCanvas) { +// List canvasPoints = patientCanvasDao.getCanvasPoints(htPatientCanvas.getId()); + List canvasPoints = patientCanvasDao.getCanvasPointsDel(htPatientCanvas.getId()); int num = 16; if(canvasPoints.size() > num){ int c = 240 / (((canvasPoints.size() + 1) / 4) - 1); int a = 0; int b = 0; - for(QuestionVo.Point point : canvasPoints){ + for(QuestionVo.PointStatus point : canvasPoints){ if(a < 4){ point.setColor(b); a++; @@ -696,7 +697,7 @@ public class QuestionService implements IQuestionService { int a = 0; int b = 0; List colours = Constant.LineColour.COLOUR; - for(QuestionVo.Point point : canvasPoints){ + for(QuestionVo.PointStatus point : canvasPoints){ if(a < 4){ a++; }else { @@ -1251,4 +1252,12 @@ public class QuestionService implements IQuestionService { PoiUtil.exportWB("笔画长度", rows, workbook); return workbook; } + + @Override + public void backCanvas(QuestionDto.BackPatientCanvas param, Long userId) { + HtPatientCanvasLine back = new HtPatientCanvasLine(); + back.setId(param.getPointId()); + back.setIsDel(Constant.Ht.NO_DEL); + patientCanvasLineMapper.updateByPrimaryKeySelective(back); + } } diff --git a/ht/src/main/resources/mapper_dao/HtPatientCanvasDao.xml b/ht/src/main/resources/mapper_dao/HtPatientCanvasDao.xml index 2604b099..cd2ef9d3 100644 --- a/ht/src/main/resources/mapper_dao/HtPatientCanvasDao.xml +++ b/ht/src/main/resources/mapper_dao/HtPatientCanvasDao.xml @@ -13,4 +13,14 @@ cl.patient_canvas_id = #{canvasId} and cl.is_del = 0 + \ No newline at end of file