Browse Source

20210628画图信息添加背景图

sd
zy_Java 4 years ago
parent
commit
4ba3430d22
  1. 4
      ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java
  2. 11
      ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvas.java
  3. 70
      ht/src/main/java/com/ccsens/ht/bean/po/HtPatientCanvasExample.java
  4. 2
      ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java
  5. 41
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java
  6. 21
      ht/src/main/java/com/ccsens/ht/uitl/Constant.java
  7. 4
      ht/src/main/resources/application.yml
  8. 26
      ht/src/main/resources/mapper_raw/HtPatientCanvasMapper.xml
  9. 4
      tall/src/main/resources/application.yml

4
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

11
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();
}

70
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<String> values) {
addCriterion("background_url in", values, "backgroundUrl");
return (Criteria) this;
}
public Criteria andBackgroundUrlNotIn(List<String> 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 {

2
ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java

@ -412,6 +412,8 @@ public class QuestionVo {
private List<Point> points;
@ApiModelProperty("画板大小")
private Canvas canvas;
@ApiModelProperty("背景图片路径")
private String backgroundUrl;
@ApiModelProperty("笔触信息")
private CanvasLine line;
@ApiModelProperty("统计参数")

41
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<QuestionVo.PatientCanvas> 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<HtPatientCanvas> patientCanvasList = patientCanvasDao.selectByExample(canvasExample);
if(CollectionUtil.isNotEmpty(patientCanvasList)){
patientCanvasList.forEach(htPatientCanvas -> {
//删除笔迹信息
HtPatientCanvasLineExample canvasLineExample = new HtPatientCanvasLineExample();
canvasLineExample.createCriteria().andPatientCanvasIdEqualTo(htPatientCanvas.getId());
List<HtPatientCanvasLine> 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());

21
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;

4
ht/src/main/resources/application.yml

@ -1,5 +1,5 @@
spring:
profiles:
active: test
include: common, util-test
active: prod
include: common, util-prod

26
ht/src/main/resources/mapper_raw/HtPatientCanvasMapper.xml

@ -15,6 +15,7 @@
<result column="is_del" jdbcType="TINYINT" property="isDel" />
<result column="open_canvas_time" jdbcType="BIGINT" property="openCanvasTime" />
<result column="beyond_proportion" jdbcType="VARCHAR" property="beyondProportion" />
<result column="background_url" jdbcType="VARCHAR" property="backgroundUrl" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -76,7 +77,8 @@
</sql>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByExample" parameterType="com.ccsens.ht.bean.po.HtPatientCanvasExample" resultMap="BaseResultMap">
select
@ -113,12 +115,12 @@
begin_time, canvas_width, canvas_height,
line_color, line_width, create_time,
update_time, is_del, open_canvas_time,
beyond_proportion)
beyond_proportion, background_url)
values (#{id,jdbcType=BIGINT}, #{patientReportId,jdbcType=BIGINT}, #{questionId,jdbcType=BIGINT},
#{beginTime,jdbcType=BIGINT}, #{canvasWidth,jdbcType=INTEGER}, #{canvasHeight,jdbcType=INTEGER},
#{lineColor,jdbcType=VARCHAR}, #{lineWidth,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT}, #{openCanvasTime,jdbcType=BIGINT},
#{beyondProportion,jdbcType=VARCHAR})
#{beyondProportion,jdbcType=VARCHAR}, #{backgroundUrl,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.ht.bean.po.HtPatientCanvas">
insert into t_ht_patient_canvas
@ -162,6 +164,9 @@
<if test="beyondProportion != null">
beyond_proportion,
</if>
<if test="backgroundUrl != null">
background_url,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -203,6 +208,9 @@
<if test="beyondProportion != null">
#{beyondProportion,jdbcType=VARCHAR},
</if>
<if test="backgroundUrl != null">
#{backgroundUrl,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.ht.bean.po.HtPatientCanvasExample" resultType="java.lang.Long">
@ -253,6 +261,9 @@
<if test="record.beyondProportion != null">
beyond_proportion = #{record.beyondProportion,jdbcType=VARCHAR},
</if>
<if test="record.backgroundUrl != null">
background_url = #{record.backgroundUrl,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -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}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -316,6 +328,9 @@
<if test="beyondProportion != null">
beyond_proportion = #{beyondProportion,jdbcType=VARCHAR},
</if>
<if test="backgroundUrl != null">
background_url = #{backgroundUrl,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -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}
</update>
</mapper>

4
tall/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: test
include: util-test,common
active: prod
include: util-prod,common
Loading…
Cancel
Save