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. 38
      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 javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.List;
/** /**
* @description: * @description:
@ -64,28 +65,28 @@ public class QuestionController {
} }
@MustLogin @MustLogin
// @DoctorAudit @DoctorAudit
@ApiOperation(value = "保存用户画图信息",notes = "zy:保存画板信息画图轨迹等") @ApiOperation(value = "保存用户画图信息",notes = "zy:保存画板信息画图轨迹等")
@ApiImplicitParams({ @ApiImplicitParams({
}) })
@RequestMapping(value="/saveCanvas", method = RequestMethod.POST) @RequestMapping(value="/saveCanvas", method = RequestMethod.POST)
public JsonResponse<QuestionVo.PatientCanvas> saveCanvas(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.SavePatientCanvas> queryDto) throws IOException, NotSupportedFileTypeException { public JsonResponse<List<QuestionVo.PatientCanvas>> saveCanvas(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.SavePatientCanvas> queryDto) throws IOException, NotSupportedFileTypeException {
log.info("保存用户画图信息:{}", queryDto); log.info("保存用户画图信息");
QuestionVo.PatientCanvas patientCanvas = questionService.saveCanvas(queryDto.getParam(), queryDto.getUserId()); List<QuestionVo.PatientCanvas> patientCanvas = questionService.saveCanvas(queryDto.getParam(), queryDto.getUserId());
log.info("保存用户画图信息成功后返回:{}", patientCanvas); log.info("保存用户画图信息成功后返回");
return JsonResponse.newInstance().ok(patientCanvas); return JsonResponse.newInstance().ok(patientCanvas);
} }
@MustLogin @MustLogin
// @DoctorAudit @DoctorAudit
@ApiOperation(value = "查看用户画图信息",notes = "zy:查看画板信息画图轨迹等") @ApiOperation(value = "查看用户画图信息",notes = "zy:查看画板信息画图轨迹等")
@ApiImplicitParams({ @ApiImplicitParams({
}) })
@RequestMapping(value="/queryCanvas", method = RequestMethod.POST) @RequestMapping(value="/queryCanvas", method = RequestMethod.POST)
public JsonResponse<QuestionVo.PatientCanvas> queryCanvas(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.QueryPatientCanvas> queryDto) throws IOException, NotSupportedFileTypeException { public JsonResponse<List<QuestionVo.PatientCanvas>> queryCanvas(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.QueryPatientCanvas> queryDto) throws IOException, NotSupportedFileTypeException {
log.info("查看用户画图信息:{}", queryDto); log.info("查看用户画图信息");
QuestionVo.PatientCanvas patientCanvas = questionService.getCanvas(queryDto.getParam(), queryDto.getUserId()); List<QuestionVo.PatientCanvas> patientCanvas = questionService.getCanvas(queryDto.getParam(), queryDto.getUserId());
log.info("查看用户画图信息成功:{}", patientCanvas); log.info("查看用户画图信息成功");
return JsonResponse.newInstance().ok(patientCanvas); 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 com.ccsens.util.NotSupportedFileTypeException;
import java.io.IOException; import java.io.IOException;
import java.util.List;
/** /**
* @description: * @description:
@ -36,7 +37,7 @@ public interface IQuestionService {
* @param userId * @param userId
* @return * @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 * @param userId
* @return * @return
*/ */
QuestionVo.PatientCanvas getCanvas(QuestionDto.QueryPatientCanvas param, Long userId); List<QuestionVo.PatientCanvas> getCanvas(QuestionDto.QueryPatientCanvas param, Long userId);
} }

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

@ -432,7 +432,8 @@ public class QuestionService implements IQuestionService {
* 保存画图轨迹信息 * 保存画图轨迹信息
*/ */
@Override @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(); HtPatientCanvas patientCanvas = new HtPatientCanvas();
patientCanvas.setId(snowflake.nextId()); patientCanvas.setId(snowflake.nextId());
@ -452,6 +453,7 @@ public class QuestionService implements IQuestionService {
//添加轨迹信息 //添加轨迹信息
if(CollectionUtil.isNotEmpty(param.getPoints())){ if(CollectionUtil.isNotEmpty(param.getPoints())){
param.getPoints().forEach(point -> { param.getPoints().forEach(point -> {
log.info("添加轨迹信息");
HtPatientCanvasLine patientCanvasLine = new HtPatientCanvasLine(); HtPatientCanvasLine patientCanvasLine = new HtPatientCanvasLine();
patientCanvasLine.setId(snowflake.nextId()); patientCanvasLine.setId(snowflake.nextId());
patientCanvasLine.setPatientCanvasId(patientCanvas.getId()); patientCanvasLine.setPatientCanvasId(patientCanvas.getId());
@ -470,31 +472,35 @@ public class QuestionService implements IQuestionService {
* 查看用户画图信息 * 查看用户画图信息
*/ */
@Override @Override
public QuestionVo.PatientCanvas getCanvas(QuestionDto.QueryPatientCanvas param, Long userId) { public List<QuestionVo.PatientCanvas> getCanvas(QuestionDto.QueryPatientCanvas param, Long userId) {
QuestionVo.PatientCanvas patientCanvas = new QuestionVo.PatientCanvas(); List<QuestionVo.PatientCanvas> canvasList = new ArrayList<>();
log.info("报告单id:{},试题id:{}",param.getPatientReportId(),param.getQuestionId());
HtPatientCanvasExample canvasExample = new HtPatientCanvasExample(); HtPatientCanvasExample canvasExample = new HtPatientCanvasExample();
canvasExample.createCriteria().andPatientReportIdEqualTo(param.getPatientReportId()).andQuestionIdEqualTo(param.getQuestionId()); canvasExample.createCriteria().andPatientReportIdEqualTo(param.getPatientReportId()).andQuestionIdEqualTo(param.getQuestionId());
canvasExample.setOrderByClause("begin_time DESC");
List<HtPatientCanvas> patientCanvasList = patientCanvasDao.selectByExample(canvasExample); List<HtPatientCanvas> patientCanvasList = patientCanvasDao.selectByExample(canvasExample);
if(CollectionUtil.isEmpty(patientCanvasList)){ if(CollectionUtil.isEmpty(patientCanvasList)){
return patientCanvas; return canvasList;
} }
patientCanvas.setPatientCanvasId(patientCanvasList.get(0).getId()); patientCanvasList.forEach(htPatientCanvas ->{
patientCanvas.setPatientReportId(patientCanvasList.get(0).getPatientReportId()); QuestionVo.PatientCanvas patientCanvas = new QuestionVo.PatientCanvas();
patientCanvas.setQuestionId(patientCanvasList.get(0).getQuestionId()); patientCanvas.setPatientCanvasId(htPatientCanvas.getId());
patientCanvas.setBeginTime(patientCanvasList.get(0).getBeginTime()); patientCanvas.setPatientReportId(htPatientCanvas.getPatientReportId());
patientCanvas.setQuestionId(htPatientCanvas.getQuestionId());
patientCanvas.setBeginTime(htPatientCanvas.getBeginTime());
QuestionVo.Canvas canvas = new QuestionVo.Canvas(); QuestionVo.Canvas canvas = new QuestionVo.Canvas();
canvas.setWidth(patientCanvasList.get(0).getCanvasWidth()); canvas.setWidth(htPatientCanvas.getCanvasWidth());
canvas.setHeight(patientCanvasList.get(0).getCanvasHeight()); canvas.setHeight(htPatientCanvas.getCanvasHeight());
patientCanvas.setCanvas(canvas); patientCanvas.setCanvas(canvas);
QuestionVo.CanvasLine canvasLine = new QuestionVo.CanvasLine(); QuestionVo.CanvasLine canvasLine = new QuestionVo.CanvasLine();
canvasLine.setColor(patientCanvasList.get(0).getLineColor()); canvasLine.setColor(htPatientCanvas.getLineColor());
canvasLine.setWidth(patientCanvasList.get(0).getLineWidth()); canvasLine.setWidth(htPatientCanvas.getLineWidth());
patientCanvas.setLine(canvasLine); patientCanvas.setLine(canvasLine);
patientCanvas.setPoints(patientCanvasDao.getCanvasPoints(patientCanvasList.get(0).getId())); patientCanvas.setPoints(patientCanvasDao.getCanvasPoints(htPatientCanvas.getId()));
canvasList.add(patientCanvas);
return patientCanvas; });
return canvasList;
} }
} }

Loading…
Cancel
Save