diff --git a/ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java b/ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java index 606abaf7..5c8ce440 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java +++ b/ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java @@ -78,6 +78,10 @@ public class QuestionDto { private CanvasLine line; @ApiModelProperty("超出占比") private String beyondProportion; + @ApiModelProperty("背景图片路径") + private String backgroundUrl; + @ApiModelProperty("是否需要重置画图信息(删掉以前的画图信息) 0否 1是") + private byte isFirst; } @Data diff --git a/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvas.java b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvas.java index 0db7571d..a3b4cbdc 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvas.java +++ b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvas.java @@ -30,6 +30,8 @@ public class HtPatientCanvas implements Serializable { private String beyondProportion; + private String backgroundUrl; + private static final long serialVersionUID = 1L; public Long getId() { @@ -136,6 +138,14 @@ public class HtPatientCanvas implements Serializable { this.beyondProportion = beyondProportion == null ? null : beyondProportion.trim(); } + public String getBackgroundUrl() { + return backgroundUrl; + } + + public void setBackgroundUrl(String backgroundUrl) { + this.backgroundUrl = backgroundUrl == null ? null : backgroundUrl.trim(); + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -155,6 +165,7 @@ public class HtPatientCanvas implements Serializable { sb.append(", isDel=").append(isDel); sb.append(", openCanvasTime=").append(openCanvasTime); sb.append(", beyondProportion=").append(beyondProportion); + sb.append(", backgroundUrl=").append(backgroundUrl); sb.append("]"); return sb.toString(); } diff --git a/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvasExample.java b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvasExample.java index 1f86c70e..7bd4e4a1 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvasExample.java +++ b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvasExample.java @@ -904,6 +904,76 @@ public class HtPatientCanvasExample { addCriterion("beyond_proportion not between", value1, value2, "beyondProportion"); return (Criteria) this; } + + public Criteria andBackgroundUrlIsNull() { + addCriterion("background_url is null"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlIsNotNull() { + addCriterion("background_url is not null"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlEqualTo(String value) { + addCriterion("background_url =", value, "backgroundUrl"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlNotEqualTo(String value) { + addCriterion("background_url <>", value, "backgroundUrl"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlGreaterThan(String value) { + addCriterion("background_url >", value, "backgroundUrl"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlGreaterThanOrEqualTo(String value) { + addCriterion("background_url >=", value, "backgroundUrl"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlLessThan(String value) { + addCriterion("background_url <", value, "backgroundUrl"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlLessThanOrEqualTo(String value) { + addCriterion("background_url <=", value, "backgroundUrl"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlLike(String value) { + addCriterion("background_url like", value, "backgroundUrl"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlNotLike(String value) { + addCriterion("background_url not like", value, "backgroundUrl"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlIn(List values) { + addCriterion("background_url in", values, "backgroundUrl"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlNotIn(List values) { + addCriterion("background_url not in", values, "backgroundUrl"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlBetween(String value1, String value2) { + addCriterion("background_url between", value1, value2, "backgroundUrl"); + return (Criteria) this; + } + + public Criteria andBackgroundUrlNotBetween(String value1, String value2) { + addCriterion("background_url not between", value1, value2, "backgroundUrl"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java b/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java index f6eec212..a751f571 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java +++ b/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java @@ -412,6 +412,8 @@ public class QuestionVo { private List points; @ApiModelProperty("画板大小") private Canvas canvas; + @ApiModelProperty("背景图片路径") + private String backgroundUrl; @ApiModelProperty("笔触信息") private CanvasLine line; @ApiModelProperty("统计参数") 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 3797ae20..f17b74c5 100644 --- a/ht/src/main/java/com/ccsens/ht/service/QuestionService.java +++ b/ht/src/main/java/com/ccsens/ht/service/QuestionService.java @@ -365,9 +365,7 @@ public class QuestionService implements IQuestionService { } private void saveAnswerRecord(QuestionDto.Score score, HtQuestion question) { - if (CollectionUtil.isEmpty(score.getPaths())) { - return; - } + String type; switch (question.getOperateType()) { //语音 @@ -392,6 +390,9 @@ public class QuestionService implements IQuestionService { HtPatientQuestionRecord delRecord = new HtPatientQuestionRecord(); delRecord.setIsDel(Constant.Ht.IS_DEL); htPatientQuestionRecordMapper.updateByExampleSelective(delRecord, example); + if (CollectionUtil.isEmpty(score.getPaths())) { + return; + } score.getPaths().forEach(path->{ HtPatientQuestionRecord record = new HtPatientQuestionRecord(); record.setId(snowflake.nextId()); @@ -543,6 +544,29 @@ public class QuestionService implements IQuestionService { @Override public List saveCanvas(QuestionDto.SavePatientCanvas param, Long userId) { log.info("添加数据,报告单id:{},试题id:{}",param.getPatientReportId(),param.getQuestionId()); + //是否需要删除以前的画图信息 + if(param.getIsFirst() == 1){ + HtPatientCanvasExample canvasExample = new HtPatientCanvasExample(); + canvasExample.createCriteria().andQuestionIdEqualTo(param.getQuestionId()).andPatientReportIdEqualTo(param.getPatientReportId()); + List patientCanvasList = patientCanvasDao.selectByExample(canvasExample); + if(CollectionUtil.isNotEmpty(patientCanvasList)){ + patientCanvasList.forEach(htPatientCanvas -> { + //删除笔迹信息 + HtPatientCanvasLineExample canvasLineExample = new HtPatientCanvasLineExample(); + canvasLineExample.createCriteria().andPatientCanvasIdEqualTo(htPatientCanvas.getId()); + List htPatientCanvasLines = patientCanvasLineMapper.selectByExample(canvasLineExample); + if(CollectionUtil.isNotEmpty(htPatientCanvasLines)){ + htPatientCanvasLines.forEach(htPatientCanvasLine -> { + htPatientCanvasLine.setIsDel((byte) 1); + patientCanvasLineMapper.updateByPrimaryKeySelective(htPatientCanvasLine); + }); + } + htPatientCanvas.setIsDel((byte) 1); + patientCanvasDao.updateByPrimaryKeySelective(htPatientCanvas); + }); + } + } + //添加画板基本信息 HtPatientCanvas patientCanvas = new HtPatientCanvas(); patientCanvas.setId(snowflake.nextId()); @@ -551,6 +575,7 @@ public class QuestionService implements IQuestionService { patientCanvas.setOpenCanvasTime(param.getOpenCanvasTime()); patientCanvas.setBeginTime(param.getBeginTime()); patientCanvas.setBeyondProportion(param.getBeyondProportion()); + patientCanvas.setBackgroundUrl(param.getBackgroundUrl()); if(ObjectUtil.isNotNull(param.getCanvas())){ patientCanvas.setCanvasWidth(param.getCanvas().getWidth()); patientCanvas.setCanvasHeight(param.getCanvas().getHeight()); @@ -610,6 +635,16 @@ public class QuestionService implements IQuestionService { patientCanvas.setQuestionName(question.getQuestion()); patientCanvas.setOperateType(question.getOperateType()); patientCanvas.setBeginTime(htPatientCanvas.getBeginTime()); + //背景图 + if(StrUtil.isBlank(htPatientCanvas.getBackgroundUrl()) && + (question.getType() == Constant.Ht.Question.IMG || + question.getType() == Constant.Ht.Question.MATCHING_REVERSE || + question.getType() == Constant.Ht.Question.IMG_QUESTION_OPTION_EXCHANGE || + question.getType() == Constant.Ht.Question.IMG_REVERSE)){ + patientCanvas.setBackgroundUrl(question.getQuestion()); + }else { + patientCanvas.setBackgroundUrl(htPatientCanvas.getBackgroundUrl()); + } QuestionVo.Canvas canvas = new QuestionVo.Canvas(); canvas.setWidth(htPatientCanvas.getCanvasWidth()); diff --git a/ht/src/main/java/com/ccsens/ht/uitl/Constant.java b/ht/src/main/java/com/ccsens/ht/uitl/Constant.java index 6d3078d0..065bb495 100644 --- a/ht/src/main/java/com/ccsens/ht/uitl/Constant.java +++ b/ht/src/main/java/com/ccsens/ht/uitl/Constant.java @@ -284,6 +284,27 @@ public class Constant { } public static class Question { + + //题目类型 1文本,2图片,3语音,4选项,5连线且文字倒转,6文本倒转,7:图片且题目和选项位置互换,8:图片且图片颠倒', + /**文本*/ + public final static byte TEXT = 1; + /**图片*/ + public final static byte IMG = 2; + /**语音*/ + public final static byte VOICE = 3; + /**选项*/ + public final static byte OPTION = 4; + /**连线且文字倒转*/ + public final static byte MATCHING_REVERSE = 5; + /**文本倒转*/ + public final static byte TEXT_REVERSE = 6; + /**图片且题目和选项位置互换*/ + public final static byte IMG_QUESTION_OPTION_EXCHANGE = 7; + /**图片且图片颠倒*/ + public final static byte IMG_REVERSE = 8; + + + public final static String ALL = "all"; /**默认题目类型*/ public final static byte QUESTION_SHOW_TYPE = 1; diff --git a/ht/src/main/resources/application.yml b/ht/src/main/resources/application.yml index f59084b0..b9b264a7 100644 --- a/ht/src/main/resources/application.yml +++ b/ht/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: test - include: common, util-test + active: prod + include: common, util-prod diff --git a/ht/src/main/resources/mapper_raw/HtPatientCanvasMapper.xml b/ht/src/main/resources/mapper_raw/HtPatientCanvasMapper.xml index 3a13b063..2d6e3ec2 100644 --- a/ht/src/main/resources/mapper_raw/HtPatientCanvasMapper.xml +++ b/ht/src/main/resources/mapper_raw/HtPatientCanvasMapper.xml @@ -15,6 +15,7 @@ + @@ -76,7 +77,8 @@ id, patient_report_id, question_id, begin_time, canvas_width, canvas_height, line_color, - line_width, create_time, update_time, is_del, open_canvas_time, beyond_proportion + line_width, create_time, update_time, is_del, open_canvas_time, beyond_proportion, + background_url @@ -253,6 +261,9 @@ beyond_proportion = #{record.beyondProportion,jdbcType=VARCHAR}, + + background_url = #{record.backgroundUrl,jdbcType=VARCHAR}, + @@ -272,7 +283,8 @@ update_time = #{record.updateTime,jdbcType=TIMESTAMP}, is_del = #{record.isDel,jdbcType=TINYINT}, open_canvas_time = #{record.openCanvasTime,jdbcType=BIGINT}, - beyond_proportion = #{record.beyondProportion,jdbcType=VARCHAR} + beyond_proportion = #{record.beyondProportion,jdbcType=VARCHAR}, + background_url = #{record.backgroundUrl,jdbcType=VARCHAR} @@ -316,6 +328,9 @@ beyond_proportion = #{beyondProportion,jdbcType=VARCHAR}, + + background_url = #{backgroundUrl,jdbcType=VARCHAR}, + where id = #{id,jdbcType=BIGINT} @@ -332,7 +347,8 @@ update_time = #{updateTime,jdbcType=TIMESTAMP}, is_del = #{isDel,jdbcType=TINYINT}, open_canvas_time = #{openCanvasTime,jdbcType=BIGINT}, - beyond_proportion = #{beyondProportion,jdbcType=VARCHAR} + beyond_proportion = #{beyondProportion,jdbcType=VARCHAR}, + background_url = #{backgroundUrl,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT} \ No newline at end of file diff --git a/tall/src/main/resources/application.yml b/tall/src/main/resources/application.yml index eca66951..af245946 100644 --- a/tall/src/main/resources/application.yml +++ b/tall/src/main/resources/application.yml @@ -1,4 +1,4 @@ spring: profiles: - active: test - include: util-test,common \ No newline at end of file + active: prod + include: util-prod,common \ No newline at end of file