Browse Source

查看画图信息返回list

sd
zy_Java 5 years ago
parent
commit
9875fa52fe
  1. 21
      ht/src/main/java/com/ccsens/ht/api/QuestionController.java
  2. 5
      ht/src/main/java/com/ccsens/ht/service/IQuestionService.java
  3. 48
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java

21
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<QuestionVo.PatientCanvas> saveCanvas(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.SavePatientCanvas> queryDto) throws IOException, NotSupportedFileTypeException {
log.info("保存用户画图信息:{}", queryDto);
QuestionVo.PatientCanvas patientCanvas = questionService.saveCanvas(queryDto.getParam(), queryDto.getUserId());
log.info("保存用户画图信息成功后返回:{}", patientCanvas);
public JsonResponse<List<QuestionVo.PatientCanvas>> saveCanvas(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.SavePatientCanvas> queryDto) throws IOException, NotSupportedFileTypeException {
log.info("保存用户画图信息");
List<QuestionVo.PatientCanvas> 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<QuestionVo.PatientCanvas> queryCanvas(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.QueryPatientCanvas> queryDto) throws IOException, NotSupportedFileTypeException {
log.info("查看用户画图信息:{}", queryDto);
QuestionVo.PatientCanvas patientCanvas = questionService.getCanvas(queryDto.getParam(), queryDto.getUserId());
log.info("查看用户画图信息成功:{}", patientCanvas);
public JsonResponse<List<QuestionVo.PatientCanvas>> queryCanvas(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.QueryPatientCanvas> queryDto) throws IOException, NotSupportedFileTypeException {
log.info("查看用户画图信息");
List<QuestionVo.PatientCanvas> patientCanvas = questionService.getCanvas(queryDto.getParam(), queryDto.getUserId());
log.info("查看用户画图信息成功");
return JsonResponse.newInstance().ok(patientCanvas);
}
}

5
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<QuestionVo.PatientCanvas> 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<QuestionVo.PatientCanvas> getCanvas(QuestionDto.QueryPatientCanvas param, Long userId);
}

48
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<QuestionVo.PatientCanvas> 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<QuestionVo.PatientCanvas> getCanvas(QuestionDto.QueryPatientCanvas param, Long userId) {
List<QuestionVo.PatientCanvas> 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<HtPatientCanvas> 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;
}
}

Loading…
Cancel
Save