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 5ea2ab61..70a59576 100644 --- a/ht/src/main/java/com/ccsens/ht/api/QuestionController.java +++ b/ht/src/main/java/com/ccsens/ht/api/QuestionController.java @@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.io.IOException; +import java.util.List; /** * @description: @@ -64,28 +65,28 @@ public class QuestionController { } @MustLogin -// @DoctorAudit + @DoctorAudit @ApiOperation(value = "保存用户画图信息",notes = "zy:保存画板信息画图轨迹等") @ApiImplicitParams({ }) @RequestMapping(value="/saveCanvas", method = RequestMethod.POST) - public JsonResponse saveCanvas(@RequestBody @ApiParam @Valid QueryDto queryDto) throws IOException, NotSupportedFileTypeException { - log.info("保存用户画图信息:{}", queryDto); - QuestionVo.PatientCanvas patientCanvas = questionService.saveCanvas(queryDto.getParam(), queryDto.getUserId()); - log.info("保存用户画图信息成功后返回:{}", patientCanvas); + public JsonResponse> saveCanvas(@RequestBody @ApiParam @Valid QueryDto queryDto) throws IOException, NotSupportedFileTypeException { + log.info("保存用户画图信息"); + List patientCanvas = questionService.saveCanvas(queryDto.getParam(), queryDto.getUserId()); + log.info("保存用户画图信息成功后返回"); return JsonResponse.newInstance().ok(patientCanvas); } @MustLogin -// @DoctorAudit + @DoctorAudit @ApiOperation(value = "查看用户画图信息",notes = "zy:查看画板信息画图轨迹等") @ApiImplicitParams({ }) @RequestMapping(value="/queryCanvas", method = RequestMethod.POST) - public JsonResponse queryCanvas(@RequestBody @ApiParam @Valid QueryDto queryDto) throws IOException, NotSupportedFileTypeException { - log.info("查看用户画图信息:{}", queryDto); - QuestionVo.PatientCanvas patientCanvas = questionService.getCanvas(queryDto.getParam(), queryDto.getUserId()); - log.info("查看用户画图信息成功:{}", patientCanvas); + public JsonResponse> queryCanvas(@RequestBody @ApiParam @Valid QueryDto queryDto) throws IOException, NotSupportedFileTypeException { + log.info("查看用户画图信息"); + List patientCanvas = questionService.getCanvas(queryDto.getParam(), queryDto.getUserId()); + log.info("查看用户画图信息成功"); return JsonResponse.newInstance().ok(patientCanvas); } } 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 d6ce3394..e08dc243 100644 --- a/ht/src/main/java/com/ccsens/ht/service/IQuestionService.java +++ b/ht/src/main/java/com/ccsens/ht/service/IQuestionService.java @@ -6,6 +6,7 @@ import com.ccsens.util.CodeEnum; import com.ccsens.util.NotSupportedFileTypeException; import java.io.IOException; +import java.util.List; /** * @description: @@ -36,7 +37,7 @@ public interface IQuestionService { * @param userId * @return */ - QuestionVo.PatientCanvas saveCanvas(QuestionDto.SavePatientCanvas param, Long userId); + List saveCanvas(QuestionDto.SavePatientCanvas param, Long userId); /** * 查看用户画图信息 @@ -44,5 +45,5 @@ public interface IQuestionService { * @param userId * @return */ - QuestionVo.PatientCanvas getCanvas(QuestionDto.QueryPatientCanvas param, Long userId); + List getCanvas(QuestionDto.QueryPatientCanvas 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 3b27074f..174c18eb 100644 --- a/ht/src/main/java/com/ccsens/ht/service/QuestionService.java +++ b/ht/src/main/java/com/ccsens/ht/service/QuestionService.java @@ -432,7 +432,8 @@ public class QuestionService implements IQuestionService { * 保存画图轨迹信息 */ @Override - public QuestionVo.PatientCanvas saveCanvas(QuestionDto.SavePatientCanvas param, Long userId) { + public List saveCanvas(QuestionDto.SavePatientCanvas param, Long userId) { + log.info("添加数据,报告单id:{},试题id:{}",param.getPatientReportId(),param.getQuestionId()); //添加画板基本信息 HtPatientCanvas patientCanvas = new HtPatientCanvas(); patientCanvas.setId(snowflake.nextId()); @@ -452,6 +453,7 @@ 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()); @@ -470,31 +472,35 @@ public class QuestionService implements IQuestionService { * 查看用户画图信息 */ @Override - public QuestionVo.PatientCanvas getCanvas(QuestionDto.QueryPatientCanvas param, Long userId) { - QuestionVo.PatientCanvas patientCanvas = new QuestionVo.PatientCanvas(); - + public List getCanvas(QuestionDto.QueryPatientCanvas param, Long userId) { + List canvasList = new ArrayList<>(); + log.info("报告单id:{},试题id:{}",param.getPatientReportId(),param.getQuestionId()); HtPatientCanvasExample canvasExample = new HtPatientCanvasExample(); canvasExample.createCriteria().andPatientReportIdEqualTo(param.getPatientReportId()).andQuestionIdEqualTo(param.getQuestionId()); + canvasExample.setOrderByClause("begin_time DESC"); List patientCanvasList = patientCanvasDao.selectByExample(canvasExample); if(CollectionUtil.isEmpty(patientCanvasList)){ - return patientCanvas; + return canvasList; } - patientCanvas.setPatientCanvasId(patientCanvasList.get(0).getId()); - patientCanvas.setPatientReportId(patientCanvasList.get(0).getPatientReportId()); - patientCanvas.setQuestionId(patientCanvasList.get(0).getQuestionId()); - patientCanvas.setBeginTime(patientCanvasList.get(0).getBeginTime()); - - QuestionVo.Canvas canvas = new QuestionVo.Canvas(); - canvas.setWidth(patientCanvasList.get(0).getCanvasWidth()); - canvas.setHeight(patientCanvasList.get(0).getCanvasHeight()); - patientCanvas.setCanvas(canvas); - QuestionVo.CanvasLine canvasLine = new QuestionVo.CanvasLine(); - canvasLine.setColor(patientCanvasList.get(0).getLineColor()); - canvasLine.setWidth(patientCanvasList.get(0).getLineWidth()); - patientCanvas.setLine(canvasLine); - patientCanvas.setPoints(patientCanvasDao.getCanvasPoints(patientCanvasList.get(0).getId())); - - return patientCanvas; + patientCanvasList.forEach(htPatientCanvas ->{ + QuestionVo.PatientCanvas patientCanvas = new QuestionVo.PatientCanvas(); + patientCanvas.setPatientCanvasId(htPatientCanvas.getId()); + patientCanvas.setPatientReportId(htPatientCanvas.getPatientReportId()); + patientCanvas.setQuestionId(htPatientCanvas.getQuestionId()); + patientCanvas.setBeginTime(htPatientCanvas.getBeginTime()); + + QuestionVo.Canvas canvas = new QuestionVo.Canvas(); + canvas.setWidth(htPatientCanvas.getCanvasWidth()); + canvas.setHeight(htPatientCanvas.getCanvasHeight()); + patientCanvas.setCanvas(canvas); + QuestionVo.CanvasLine canvasLine = new QuestionVo.CanvasLine(); + canvasLine.setColor(htPatientCanvas.getLineColor()); + canvasLine.setWidth(htPatientCanvas.getLineWidth()); + patientCanvas.setLine(canvasLine); + patientCanvas.setPoints(patientCanvasDao.getCanvasPoints(htPatientCanvas.getId())); + canvasList.add(patientCanvas); + }); + return canvasList; } }