|
|
@ -18,6 +18,7 @@ import com.ccsens.ht.persist.mapper.HtPatientQuestionRecordMapper; |
|
|
|
import com.ccsens.ht.persist.mapper.HtPatientReportMapper; |
|
|
|
import com.ccsens.ht.uitl.Constant; |
|
|
|
import com.ccsens.util.CodeEnum; |
|
|
|
import com.ccsens.util.PoiUtil; |
|
|
|
import com.ccsens.util.bean.message.common.InMessage; |
|
|
|
import com.ccsens.util.bean.message.common.MessageRule; |
|
|
|
import com.ccsens.util.config.RabbitMQConfig; |
|
|
@ -26,6 +27,8 @@ import io.swagger.annotations.ApiModel; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.concurrent.BasicThreadFactory; |
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
|
import org.springframework.amqp.core.AmqpTemplate; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
@ -614,10 +617,9 @@ public class QuestionService implements IQuestionService { |
|
|
|
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("create_time DESC"); |
|
|
|
List<HtPatientCanvas> patientCanvasList = patientCanvasDao.selectByExample(canvasExample); |
|
|
|
Long patientReportId = param.getPatientReportId(); |
|
|
|
Long questionId = param.getQuestionId(); |
|
|
|
List<HtPatientCanvas> patientCanvasList = getHtPatientCanvas(patientReportId, questionId); |
|
|
|
log.info("查询画图记录:{}",patientCanvasList); |
|
|
|
if(CollectionUtil.isEmpty(patientCanvasList)){ |
|
|
|
return canvasList; |
|
|
@ -666,6 +668,13 @@ public class QuestionService implements IQuestionService { |
|
|
|
return canvasList; |
|
|
|
} |
|
|
|
|
|
|
|
private List<HtPatientCanvas> getHtPatientCanvas(Long patientReportId, Long questionId) { |
|
|
|
HtPatientCanvasExample canvasExample = new HtPatientCanvasExample(); |
|
|
|
canvasExample.createCriteria().andPatientReportIdEqualTo(patientReportId).andQuestionIdEqualTo(questionId); |
|
|
|
canvasExample.setOrderByClause("create_time DESC"); |
|
|
|
return patientCanvasDao.selectByExample(canvasExample); |
|
|
|
} |
|
|
|
|
|
|
|
private List<QuestionVo.Point> getCanvasPoints(HtPatientCanvas htPatientCanvas) { |
|
|
|
List<QuestionVo.Point> canvasPoints = patientCanvasDao.getCanvasPoints(htPatientCanvas.getId()); |
|
|
|
int num = 16; |
|
|
@ -1187,4 +1196,57 @@ public class QuestionService implements IQuestionService { |
|
|
|
log.info("保存新答案"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Workbook exportLine(QuestionDto.ExportLine answer) { |
|
|
|
int total = 4; |
|
|
|
List<List<PoiUtil.PoiUtilCell>> rows = new ArrayList<>(); |
|
|
|
// 标题
|
|
|
|
List<PoiUtil.PoiUtilCell> title = new ArrayList<>(); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("序号")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("长度")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("完成时间")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("思考时间")); |
|
|
|
rows.add(title); |
|
|
|
// 查询画图记录
|
|
|
|
List<HtPatientCanvas> patientCanvasList = getHtPatientCanvas(answer.getPatientReportId(), answer.getQuestionId()); |
|
|
|
log.info("查询画图记录:{}",patientCanvasList); |
|
|
|
if(CollectionUtil.isEmpty(patientCanvasList)){ |
|
|
|
Workbook workbook = new XSSFWorkbook(); |
|
|
|
PoiUtil.exportWB("笔画长度", rows, workbook); |
|
|
|
return workbook; |
|
|
|
} |
|
|
|
AtomicInteger index = new AtomicInteger(1); |
|
|
|
patientCanvasList.forEach(canvas -> { |
|
|
|
Integer height = canvas.getCanvasHeight(); |
|
|
|
List<QuestionVo.Point> canvasPoints = patientCanvasDao.getCanvasPoints(canvas.getId()); |
|
|
|
for (int i = 0; i < canvasPoints.size(); i++) { |
|
|
|
// 坐标点
|
|
|
|
QuestionVo.Point point = canvasPoints.get(i); |
|
|
|
String[] points = point.getValue().split(";"); |
|
|
|
// 组装单元格
|
|
|
|
List<PoiUtil.PoiUtilCell> content = new ArrayList<>(); |
|
|
|
// 长度计算
|
|
|
|
content.add(new PoiUtil.PoiUtilCell(index.get() + "")); |
|
|
|
double length = getLengthByCanvas(points); |
|
|
|
content.add(new PoiUtil.PoiUtilCell(PatientReportService.pxToMm(length, height) + "mm")); |
|
|
|
// 画图时间计算
|
|
|
|
content.add(new PoiUtil.PoiUtilCell(Long.parseLong(points[points.length - 1].split(",")[2]) - Long.parseLong(points[0].split(",")[2]) + "ms")); |
|
|
|
// 间隔时长
|
|
|
|
long time; |
|
|
|
if (i == 0) { |
|
|
|
time = canvas.getBeginTime() - canvas.getOpenCanvasTime() + Long.parseLong(points[0].split(",")[2]); |
|
|
|
} else { |
|
|
|
String[] prevPoints = canvasPoints.get(i - 1).getValue().split(";"); |
|
|
|
time = Long.parseLong(points[0].split(",")[2]) - Long.parseLong(prevPoints[prevPoints.length - 1].split(",")[2]); |
|
|
|
} |
|
|
|
content.add(new PoiUtil.PoiUtilCell(time + "ms")); |
|
|
|
rows.add(content); |
|
|
|
index.incrementAndGet(); |
|
|
|
} |
|
|
|
}); |
|
|
|
Workbook workbook = new XSSFWorkbook(); |
|
|
|
PoiUtil.exportWB("笔画长度", rows, workbook); |
|
|
|
return workbook; |
|
|
|
} |
|
|
|
} |
|
|
|