Browse Source

恢复删除的笔画

sd
zhizhi wu 4 years ago
parent
commit
6950b97cd3
  1. 13
      ht/src/main/java/com/ccsens/ht/api/QuestionController.java
  2. 8
      ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java
  3. 14
      ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java
  4. 8
      ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientCanvasDao.java
  5. 7
      ht/src/main/java/com/ccsens/ht/service/IQuestionService.java
  6. 19
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java
  7. 10
      ht/src/main/resources/mapper_dao/HtPatientCanvasDao.xml

13
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<QuestionDto.BackPatientCanvas> 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)

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

@ -145,6 +145,14 @@ public class QuestionDto {
@ApiModelProperty("轨迹的id")
private List<Long> pointId;
}
@Data
@ApiModel("恢复画图笔画")
public static class BackPatientCanvas{
@ApiModelProperty("轨迹的id")
private Long pointId;
}
@Data
@ApiModel("导出线条长度")
public static class ExportLine {

14
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<Point> points;
private List<PointStatus> 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("坐标")

8
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<QuestionVo.PointStatus> 画图轨迹
*/
List<QuestionVo.Point> getCanvasPoints(@Param("canvasId") Long canvasId);
/**
* 查看用户全部画图轨迹含删除轨迹
* @param id 画板ID
* @return List<QuestionVo.PointStatus> 画图轨迹
*/
List<QuestionVo.PointStatus> getCanvasPointsDel(@Param("canvasId") Long id);
}

7
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);
}

19
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<QuestionVo.Point> canvasPoints = getCanvasPoints(htPatientCanvas);
List<QuestionVo.PointStatus> 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<QuestionVo.Point> getCanvasPoints(HtPatientCanvas htPatientCanvas) {
List<QuestionVo.Point> canvasPoints = patientCanvasDao.getCanvasPoints(htPatientCanvas.getId());
private List<QuestionVo.PointStatus> getCanvasPoints(HtPatientCanvas htPatientCanvas) {
// List<QuestionVo.Point> canvasPoints = patientCanvasDao.getCanvasPoints(htPatientCanvas.getId());
List<QuestionVo.PointStatus> 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<Integer> 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);
}
}

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

@ -13,4 +13,14 @@
cl.patient_canvas_id = #{canvasId}
and cl.is_del = 0
</select>
<select id="getCanvasPointsDel" resultType="com.ccsens.ht.bean.vo.QuestionVo$PointStatus">
SELECT
id as pointId,
points as `value`,
if(cl.is_del=0,0,1) as delStatus
FROM
t_ht_patient_canvas_line cl
WHERE
cl.patient_canvas_id = #{canvasId}
</select>
</mapper>
Loading…
Cancel
Save