From 8bc5bfcbec1469dd0c1fec88f0b36fa165e39f85 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Fri, 11 Mar 2022 15:55:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=94=E8=BE=B9=E5=BD=A2=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E6=B5=8B=E8=AF=84=EF=BC=8C=E5=BE=85=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ht/pom.xml | 6 +- .../ccsens/ht/api/IntelligenceController.java | 48 ++ .../ccsens/ht/bean/dto/IntelligenceDto.java | 24 + .../ht/bean/po/HtPatientIntelligence.java | 106 +++ .../bean/po/HtPatientIntelligenceExample.java | 701 ++++++++++++++++++ .../ht/bean/po/HtQuestionIntelligence.java | 95 +++ .../po/HtQuestionIntelligenceExample.java | 631 ++++++++++++++++ .../com/ccsens/ht/bean/vo/IntelligenceVo.java | 22 + .../com/ccsens/ht/bean/vo/QuestionVo.java | 2 + .../mapper/HtPatientIntelligenceMapper.java | 30 + .../mapper/HtQuestionIntelligenceMapper.java | 30 + .../ht/service/IIntelligenceService.java | 18 + .../ht/service/IntelligenceService.java | 135 ++++ .../java/com/ccsens/ht/uitl/Constant.java | 10 + ht/src/main/resources/application-prod.yml | 2 +- .../resources/mapper_dao/HtQuestionDao.xml | 7 +- .../HtPatientIntelligenceMapper.xml | 258 +++++++ .../HtQuestionIntelligenceMapper.xml | 243 ++++++ 18 files changed, 2363 insertions(+), 5 deletions(-) create mode 100644 ht/src/main/java/com/ccsens/ht/api/IntelligenceController.java create mode 100644 ht/src/main/java/com/ccsens/ht/bean/dto/IntelligenceDto.java create mode 100644 ht/src/main/java/com/ccsens/ht/bean/po/HtPatientIntelligence.java create mode 100644 ht/src/main/java/com/ccsens/ht/bean/po/HtPatientIntelligenceExample.java create mode 100644 ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionIntelligence.java create mode 100644 ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionIntelligenceExample.java create mode 100644 ht/src/main/java/com/ccsens/ht/bean/vo/IntelligenceVo.java create mode 100644 ht/src/main/java/com/ccsens/ht/persist/mapper/HtPatientIntelligenceMapper.java create mode 100644 ht/src/main/java/com/ccsens/ht/persist/mapper/HtQuestionIntelligenceMapper.java create mode 100644 ht/src/main/java/com/ccsens/ht/service/IIntelligenceService.java create mode 100644 ht/src/main/java/com/ccsens/ht/service/IntelligenceService.java create mode 100644 ht/src/main/resources/mapper_raw/HtPatientIntelligenceMapper.xml create mode 100644 ht/src/main/resources/mapper_raw/HtQuestionIntelligenceMapper.xml diff --git a/ht/pom.xml b/ht/pom.xml index 121898bf..708c5eee 100644 --- a/ht/pom.xml +++ b/ht/pom.xml @@ -23,7 +23,11 @@ com.ccsens 1.0-SNAPSHOT - + + org.python + jython-standalone + 2.7.0 + diff --git a/ht/src/main/java/com/ccsens/ht/api/IntelligenceController.java b/ht/src/main/java/com/ccsens/ht/api/IntelligenceController.java new file mode 100644 index 00000000..7b1ef9f5 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/api/IntelligenceController.java @@ -0,0 +1,48 @@ +package com.ccsens.ht.api; + +import com.ccsens.cloudutil.annotation.MustLogin; +import com.ccsens.ht.annotation.DoctorAudit; +import com.ccsens.ht.bean.dto.IntelligenceDto; +import com.ccsens.ht.bean.dto.QuestionDto; +import com.ccsens.ht.bean.vo.IntelligenceVo; +import com.ccsens.ht.bean.vo.QuestionVo; +import com.ccsens.ht.service.IIntelligenceService; +import com.ccsens.util.JsonResponse; +import com.ccsens.util.bean.dto.QueryDto; +import io.swagger.annotations.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.validation.Valid; + +/** + * @description: + * @author: whj + * @time: 2022/3/11 9:56 + */ +@Slf4j +@Api(tags = "智能测评",value = "智能测评,1:五边形测评") +@RestController +public class IntelligenceController { + + @Resource + private IIntelligenceService intelligenceService; + + @MustLogin + @DoctorAudit + @ApiOperation(value = "智能测评",notes = "智能测评") + @ApiImplicitParams({ + @ApiImplicitParam(name = "json", value = "智能测评", required = true) + }) + @RequestMapping(value="/intelligence", method = RequestMethod.POST) + public JsonResponse intelligence(@RequestBody @ApiParam @Valid QueryDto queryDto){ + log.info("智能测评:{}", queryDto); + IntelligenceVo.Result result = intelligenceService.intelligence(queryDto.getParam(), queryDto.getUserId()); + log.info("智能测评结果:{}", result); + return JsonResponse.newInstance().ok(result); + } +} diff --git a/ht/src/main/java/com/ccsens/ht/bean/dto/IntelligenceDto.java b/ht/src/main/java/com/ccsens/ht/bean/dto/IntelligenceDto.java new file mode 100644 index 00000000..4dc3a483 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/bean/dto/IntelligenceDto.java @@ -0,0 +1,24 @@ +package com.ccsens.ht.bean.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @description: + * @author: whj + * @time: 2022/3/11 10:32 + */ +public class IntelligenceDto { + + @Data + @ApiModel("智能测评-请求") + public static class Query { + @ApiModelProperty("报告单ID") + private Long patientReportId; + @ApiModelProperty("题目ID") + private Long questionId; + @ApiModelProperty("图片路径") + private String url; + } +} diff --git a/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientIntelligence.java b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientIntelligence.java new file mode 100644 index 00000000..964aa37b --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientIntelligence.java @@ -0,0 +1,106 @@ +package com.ccsens.ht.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class HtPatientIntelligence implements Serializable { + private Long id; + + private Long patientReportId; + + private Long questionId; + + private String url; + + private String result; + + private Date createTime; + + private Date updateTime; + + private Byte isDel; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getPatientReportId() { + return patientReportId; + } + + public void setPatientReportId(Long patientReportId) { + this.patientReportId = patientReportId; + } + + public Long getQuestionId() { + return questionId; + } + + public void setQuestionId(Long questionId) { + this.questionId = questionId; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url == null ? null : url.trim(); + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result == null ? null : result.trim(); + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Byte getIsDel() { + return isDel; + } + + public void setIsDel(Byte isDel) { + this.isDel = isDel; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", patientReportId=").append(patientReportId); + sb.append(", questionId=").append(questionId); + sb.append(", url=").append(url); + sb.append(", result=").append(result); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", isDel=").append(isDel); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientIntelligenceExample.java b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientIntelligenceExample.java new file mode 100644 index 00000000..963eb9ce --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/bean/po/HtPatientIntelligenceExample.java @@ -0,0 +1,701 @@ +package com.ccsens.ht.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class HtPatientIntelligenceExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public HtPatientIntelligenceExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andPatientReportIdIsNull() { + addCriterion("patient_report_id is null"); + return (Criteria) this; + } + + public Criteria andPatientReportIdIsNotNull() { + addCriterion("patient_report_id is not null"); + return (Criteria) this; + } + + public Criteria andPatientReportIdEqualTo(Long value) { + addCriterion("patient_report_id =", value, "patientReportId"); + return (Criteria) this; + } + + public Criteria andPatientReportIdNotEqualTo(Long value) { + addCriterion("patient_report_id <>", value, "patientReportId"); + return (Criteria) this; + } + + public Criteria andPatientReportIdGreaterThan(Long value) { + addCriterion("patient_report_id >", value, "patientReportId"); + return (Criteria) this; + } + + public Criteria andPatientReportIdGreaterThanOrEqualTo(Long value) { + addCriterion("patient_report_id >=", value, "patientReportId"); + return (Criteria) this; + } + + public Criteria andPatientReportIdLessThan(Long value) { + addCriterion("patient_report_id <", value, "patientReportId"); + return (Criteria) this; + } + + public Criteria andPatientReportIdLessThanOrEqualTo(Long value) { + addCriterion("patient_report_id <=", value, "patientReportId"); + return (Criteria) this; + } + + public Criteria andPatientReportIdIn(List values) { + addCriterion("patient_report_id in", values, "patientReportId"); + return (Criteria) this; + } + + public Criteria andPatientReportIdNotIn(List values) { + addCriterion("patient_report_id not in", values, "patientReportId"); + return (Criteria) this; + } + + public Criteria andPatientReportIdBetween(Long value1, Long value2) { + addCriterion("patient_report_id between", value1, value2, "patientReportId"); + return (Criteria) this; + } + + public Criteria andPatientReportIdNotBetween(Long value1, Long value2) { + addCriterion("patient_report_id not between", value1, value2, "patientReportId"); + return (Criteria) this; + } + + public Criteria andQuestionIdIsNull() { + addCriterion("question_id is null"); + return (Criteria) this; + } + + public Criteria andQuestionIdIsNotNull() { + addCriterion("question_id is not null"); + return (Criteria) this; + } + + public Criteria andQuestionIdEqualTo(Long value) { + addCriterion("question_id =", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdNotEqualTo(Long value) { + addCriterion("question_id <>", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdGreaterThan(Long value) { + addCriterion("question_id >", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdGreaterThanOrEqualTo(Long value) { + addCriterion("question_id >=", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdLessThan(Long value) { + addCriterion("question_id <", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdLessThanOrEqualTo(Long value) { + addCriterion("question_id <=", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdIn(List values) { + addCriterion("question_id in", values, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdNotIn(List values) { + addCriterion("question_id not in", values, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdBetween(Long value1, Long value2) { + addCriterion("question_id between", value1, value2, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdNotBetween(Long value1, Long value2) { + addCriterion("question_id not between", value1, value2, "questionId"); + return (Criteria) this; + } + + public Criteria andUrlIsNull() { + addCriterion("url is null"); + return (Criteria) this; + } + + public Criteria andUrlIsNotNull() { + addCriterion("url is not null"); + return (Criteria) this; + } + + public Criteria andUrlEqualTo(String value) { + addCriterion("url =", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlNotEqualTo(String value) { + addCriterion("url <>", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlGreaterThan(String value) { + addCriterion("url >", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlGreaterThanOrEqualTo(String value) { + addCriterion("url >=", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlLessThan(String value) { + addCriterion("url <", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlLessThanOrEqualTo(String value) { + addCriterion("url <=", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlLike(String value) { + addCriterion("url like", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlNotLike(String value) { + addCriterion("url not like", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlIn(List values) { + addCriterion("url in", values, "url"); + return (Criteria) this; + } + + public Criteria andUrlNotIn(List values) { + addCriterion("url not in", values, "url"); + return (Criteria) this; + } + + public Criteria andUrlBetween(String value1, String value2) { + addCriterion("url between", value1, value2, "url"); + return (Criteria) this; + } + + public Criteria andUrlNotBetween(String value1, String value2) { + addCriterion("url not between", value1, value2, "url"); + return (Criteria) this; + } + + public Criteria andResultIsNull() { + addCriterion("result is null"); + return (Criteria) this; + } + + public Criteria andResultIsNotNull() { + addCriterion("result is not null"); + return (Criteria) this; + } + + public Criteria andResultEqualTo(String value) { + addCriterion("result =", value, "result"); + return (Criteria) this; + } + + public Criteria andResultNotEqualTo(String value) { + addCriterion("result <>", value, "result"); + return (Criteria) this; + } + + public Criteria andResultGreaterThan(String value) { + addCriterion("result >", value, "result"); + return (Criteria) this; + } + + public Criteria andResultGreaterThanOrEqualTo(String value) { + addCriterion("result >=", value, "result"); + return (Criteria) this; + } + + public Criteria andResultLessThan(String value) { + addCriterion("result <", value, "result"); + return (Criteria) this; + } + + public Criteria andResultLessThanOrEqualTo(String value) { + addCriterion("result <=", value, "result"); + return (Criteria) this; + } + + public Criteria andResultLike(String value) { + addCriterion("result like", value, "result"); + return (Criteria) this; + } + + public Criteria andResultNotLike(String value) { + addCriterion("result not like", value, "result"); + return (Criteria) this; + } + + public Criteria andResultIn(List values) { + addCriterion("result in", values, "result"); + return (Criteria) this; + } + + public Criteria andResultNotIn(List values) { + addCriterion("result not in", values, "result"); + return (Criteria) this; + } + + public Criteria andResultBetween(String value1, String value2) { + addCriterion("result between", value1, value2, "result"); + return (Criteria) this; + } + + public Criteria andResultNotBetween(String value1, String value2) { + addCriterion("result not between", value1, value2, "result"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andIsDelIsNull() { + addCriterion("is_del is null"); + return (Criteria) this; + } + + public Criteria andIsDelIsNotNull() { + addCriterion("is_del is not null"); + return (Criteria) this; + } + + public Criteria andIsDelEqualTo(Byte value) { + addCriterion("is_del =", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelNotEqualTo(Byte value) { + addCriterion("is_del <>", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelGreaterThan(Byte value) { + addCriterion("is_del >", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelGreaterThanOrEqualTo(Byte value) { + addCriterion("is_del >=", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelLessThan(Byte value) { + addCriterion("is_del <", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelLessThanOrEqualTo(Byte value) { + addCriterion("is_del <=", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelIn(List values) { + addCriterion("is_del in", values, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelNotIn(List values) { + addCriterion("is_del not in", values, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelBetween(Byte value1, Byte value2) { + addCriterion("is_del between", value1, value2, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelNotBetween(Byte value1, Byte value2) { + addCriterion("is_del not between", value1, value2, "isDel"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionIntelligence.java b/ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionIntelligence.java new file mode 100644 index 00000000..0f9e904b --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionIntelligence.java @@ -0,0 +1,95 @@ +package com.ccsens.ht.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class HtQuestionIntelligence implements Serializable { + private Long id; + + private Long questionId; + + private String url; + + private Byte type; + + private Date createTime; + + private Date updateTime; + + private Byte isDel; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getQuestionId() { + return questionId; + } + + public void setQuestionId(Long questionId) { + this.questionId = questionId; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url == null ? null : url.trim(); + } + + public Byte getType() { + return type; + } + + public void setType(Byte type) { + this.type = type; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Byte getIsDel() { + return isDel; + } + + public void setIsDel(Byte isDel) { + this.isDel = isDel; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", questionId=").append(questionId); + sb.append(", url=").append(url); + sb.append(", type=").append(type); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", isDel=").append(isDel); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionIntelligenceExample.java b/ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionIntelligenceExample.java new file mode 100644 index 00000000..cbde5c37 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/bean/po/HtQuestionIntelligenceExample.java @@ -0,0 +1,631 @@ +package com.ccsens.ht.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class HtQuestionIntelligenceExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public HtQuestionIntelligenceExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andQuestionIdIsNull() { + addCriterion("question_id is null"); + return (Criteria) this; + } + + public Criteria andQuestionIdIsNotNull() { + addCriterion("question_id is not null"); + return (Criteria) this; + } + + public Criteria andQuestionIdEqualTo(Long value) { + addCriterion("question_id =", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdNotEqualTo(Long value) { + addCriterion("question_id <>", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdGreaterThan(Long value) { + addCriterion("question_id >", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdGreaterThanOrEqualTo(Long value) { + addCriterion("question_id >=", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdLessThan(Long value) { + addCriterion("question_id <", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdLessThanOrEqualTo(Long value) { + addCriterion("question_id <=", value, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdIn(List values) { + addCriterion("question_id in", values, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdNotIn(List values) { + addCriterion("question_id not in", values, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdBetween(Long value1, Long value2) { + addCriterion("question_id between", value1, value2, "questionId"); + return (Criteria) this; + } + + public Criteria andQuestionIdNotBetween(Long value1, Long value2) { + addCriterion("question_id not between", value1, value2, "questionId"); + return (Criteria) this; + } + + public Criteria andUrlIsNull() { + addCriterion("url is null"); + return (Criteria) this; + } + + public Criteria andUrlIsNotNull() { + addCriterion("url is not null"); + return (Criteria) this; + } + + public Criteria andUrlEqualTo(String value) { + addCriterion("url =", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlNotEqualTo(String value) { + addCriterion("url <>", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlGreaterThan(String value) { + addCriterion("url >", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlGreaterThanOrEqualTo(String value) { + addCriterion("url >=", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlLessThan(String value) { + addCriterion("url <", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlLessThanOrEqualTo(String value) { + addCriterion("url <=", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlLike(String value) { + addCriterion("url like", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlNotLike(String value) { + addCriterion("url not like", value, "url"); + return (Criteria) this; + } + + public Criteria andUrlIn(List values) { + addCriterion("url in", values, "url"); + return (Criteria) this; + } + + public Criteria andUrlNotIn(List values) { + addCriterion("url not in", values, "url"); + return (Criteria) this; + } + + public Criteria andUrlBetween(String value1, String value2) { + addCriterion("url between", value1, value2, "url"); + return (Criteria) this; + } + + public Criteria andUrlNotBetween(String value1, String value2) { + addCriterion("url not between", value1, value2, "url"); + return (Criteria) this; + } + + public Criteria andTypeIsNull() { + addCriterion("type is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("type is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(Byte value) { + addCriterion("type =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(Byte value) { + addCriterion("type <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(Byte value) { + addCriterion("type >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(Byte value) { + addCriterion("type >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(Byte value) { + addCriterion("type <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(Byte value) { + addCriterion("type <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("type in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("type not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(Byte value1, Byte value2) { + addCriterion("type between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(Byte value1, Byte value2) { + addCriterion("type not between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andIsDelIsNull() { + addCriterion("is_del is null"); + return (Criteria) this; + } + + public Criteria andIsDelIsNotNull() { + addCriterion("is_del is not null"); + return (Criteria) this; + } + + public Criteria andIsDelEqualTo(Byte value) { + addCriterion("is_del =", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelNotEqualTo(Byte value) { + addCriterion("is_del <>", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelGreaterThan(Byte value) { + addCriterion("is_del >", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelGreaterThanOrEqualTo(Byte value) { + addCriterion("is_del >=", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelLessThan(Byte value) { + addCriterion("is_del <", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelLessThanOrEqualTo(Byte value) { + addCriterion("is_del <=", value, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelIn(List values) { + addCriterion("is_del in", values, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelNotIn(List values) { + addCriterion("is_del not in", values, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelBetween(Byte value1, Byte value2) { + addCriterion("is_del between", value1, value2, "isDel"); + return (Criteria) this; + } + + public Criteria andIsDelNotBetween(Byte value1, Byte value2) { + addCriterion("is_del not between", value1, value2, "isDel"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ht/src/main/java/com/ccsens/ht/bean/vo/IntelligenceVo.java b/ht/src/main/java/com/ccsens/ht/bean/vo/IntelligenceVo.java new file mode 100644 index 00000000..c63f4423 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/bean/vo/IntelligenceVo.java @@ -0,0 +1,22 @@ +package com.ccsens.ht.bean.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @description: + * @author: whj + * @time: 2022/3/11 10:32 + */ +public class IntelligenceVo { + + @Data + @ApiModel("智能测评结果-返回") + public static class Result{ + @ApiModelProperty("有无返回结果 0:无答案 1:有答案") + private byte result; + @ApiModelProperty("选项ID") + private Long optionId; + } +} 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 b4dc1b6d..7eb4c379 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 @@ -196,6 +196,8 @@ public class QuestionVo { private Integer timingLength; // @ApiModelProperty("答案路径") // private String path; + @ApiModelProperty("是否进行智能测评 0: 否 1:是") + private byte intelligence; @ApiModelProperty("共享答案的试题Id") private List shareAnswerIds; @ApiModelProperty("是否展示关联的试题的答案 0否 1是") diff --git a/ht/src/main/java/com/ccsens/ht/persist/mapper/HtPatientIntelligenceMapper.java b/ht/src/main/java/com/ccsens/ht/persist/mapper/HtPatientIntelligenceMapper.java new file mode 100644 index 00000000..4b37d5e5 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/persist/mapper/HtPatientIntelligenceMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.ht.persist.mapper; + +import com.ccsens.ht.bean.po.HtPatientIntelligence; +import com.ccsens.ht.bean.po.HtPatientIntelligenceExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface HtPatientIntelligenceMapper { + long countByExample(HtPatientIntelligenceExample example); + + int deleteByExample(HtPatientIntelligenceExample example); + + int deleteByPrimaryKey(Long id); + + int insert(HtPatientIntelligence record); + + int insertSelective(HtPatientIntelligence record); + + List selectByExample(HtPatientIntelligenceExample example); + + HtPatientIntelligence selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") HtPatientIntelligence record, @Param("example") HtPatientIntelligenceExample example); + + int updateByExample(@Param("record") HtPatientIntelligence record, @Param("example") HtPatientIntelligenceExample example); + + int updateByPrimaryKeySelective(HtPatientIntelligence record); + + int updateByPrimaryKey(HtPatientIntelligence record); +} \ No newline at end of file diff --git a/ht/src/main/java/com/ccsens/ht/persist/mapper/HtQuestionIntelligenceMapper.java b/ht/src/main/java/com/ccsens/ht/persist/mapper/HtQuestionIntelligenceMapper.java new file mode 100644 index 00000000..610f6a89 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/persist/mapper/HtQuestionIntelligenceMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.ht.persist.mapper; + +import com.ccsens.ht.bean.po.HtQuestionIntelligence; +import com.ccsens.ht.bean.po.HtQuestionIntelligenceExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface HtQuestionIntelligenceMapper { + long countByExample(HtQuestionIntelligenceExample example); + + int deleteByExample(HtQuestionIntelligenceExample example); + + int deleteByPrimaryKey(Long id); + + int insert(HtQuestionIntelligence record); + + int insertSelective(HtQuestionIntelligence record); + + List selectByExample(HtQuestionIntelligenceExample example); + + HtQuestionIntelligence selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") HtQuestionIntelligence record, @Param("example") HtQuestionIntelligenceExample example); + + int updateByExample(@Param("record") HtQuestionIntelligence record, @Param("example") HtQuestionIntelligenceExample example); + + int updateByPrimaryKeySelective(HtQuestionIntelligence record); + + int updateByPrimaryKey(HtQuestionIntelligence record); +} \ No newline at end of file diff --git a/ht/src/main/java/com/ccsens/ht/service/IIntelligenceService.java b/ht/src/main/java/com/ccsens/ht/service/IIntelligenceService.java new file mode 100644 index 00000000..eeda9078 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/service/IIntelligenceService.java @@ -0,0 +1,18 @@ +package com.ccsens.ht.service; + +import com.ccsens.ht.bean.dto.IntelligenceDto; +import com.ccsens.ht.bean.vo.IntelligenceVo; + +/** + * @author: whj + * @time: 2022/3/11 10:58 + */ +public interface IIntelligenceService { + /** + * 智能测评 + * @param param 请求参数 + * @param userId 操作人ID + * @return 结果 + */ + IntelligenceVo.Result intelligence(IntelligenceDto.Query param, Long userId); +} diff --git a/ht/src/main/java/com/ccsens/ht/service/IntelligenceService.java b/ht/src/main/java/com/ccsens/ht/service/IntelligenceService.java new file mode 100644 index 00000000..52dabd45 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/service/IntelligenceService.java @@ -0,0 +1,135 @@ +package com.ccsens.ht.service; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.StrUtil; +import com.ccsens.ht.bean.dto.IntelligenceDto; +import com.ccsens.ht.bean.po.*; +import com.ccsens.ht.bean.vo.IntelligenceVo; +import com.ccsens.ht.persist.mapper.HtPatientIntelligenceMapper; +import com.ccsens.ht.persist.mapper.HtQuestionIntelligenceMapper; +import com.ccsens.ht.persist.mapper.HtQuestionOptionMapper; +import com.ccsens.ht.uitl.Constant; +import com.ccsens.util.PropUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; + + +import java.io.*; +import java.math.BigDecimal; +import java.util.List; + +/** + * @description: + * @author: whj + * @time: 2022/3/11 10:58 + */ +@Slf4j +@Service +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +public class IntelligenceService implements IIntelligenceService { + + @Resource + private Snowflake snowflake; + @Resource + private HtQuestionIntelligenceMapper htQuestionIntelligenceMapper; + @Resource + private HtPatientIntelligenceMapper htPatientIntelligenceMapper; + @Resource + private HtQuestionOptionMapper htQuestionOptionMapper; + + + @Override + public IntelligenceVo.Result intelligence(IntelligenceDto.Query param, Long userId) { + IntelligenceVo.Result result = new IntelligenceVo.Result(); + // 查询智能请求 + HtQuestionIntelligenceExample intelligenceExample = new HtQuestionIntelligenceExample(); + intelligenceExample.createCriteria().andQuestionIdEqualTo(param.getQuestionId()); + intelligenceExample.setOrderByClause("id desc limit 1"); + List htQuestionIntelligences = + htQuestionIntelligenceMapper.selectByExample(intelligenceExample); + log.info("测评路径:{}", htQuestionIntelligences); + if (CollectionUtil.isEmpty(htQuestionIntelligences)) { + result.setResult(Constant.Intelligence.RESULT_FAIL); + return result; + } + HtQuestionIntelligence url = htQuestionIntelligences.get(0); + StringBuilder builder = new StringBuilder(); + switch (url.getType()) { + case Constant.Intelligence.METHOD_TYPE_PYTHON: + String path = PropUtil.path + "python/" + param.getPatientReportId() + "/" + param.getQuestionId() + ".txt"; + File file = new File(path); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + String python = url.getUrl().replace("{img}", getImg(param.getUrl())); + log.info("python:{}", python); + Process proc = null; + BufferedReader in = null; + String line = null; + try { + + proc = Runtime.getRuntime().exec(python, null, file); + +// InputStream inputStream = proc.getInputStream(); +// byte[] buf = new byte[1024]; +// int length = -1; +// while ((length = inputStream.read(buf) ) > 0) { +// builder.append(new String(buf, 0, length)); +// } + in = new BufferedReader(new InputStreamReader(proc.getInputStream())); + while ((line = in.readLine()) != null) { + builder.append(line); + } + in.close(); + proc.waitFor(); + } catch (Exception e) { + log.error("执行python异常", e); + result.setResult(Constant.Intelligence.RESULT_FAIL); + return result; + } + } + log.info("智能测评结果:{}", builder.toString()); + if (StrUtil.isEmpty(builder.toString()) || !(builder.toString().endsWith("1") || builder.toString().endsWith("0")) ) { + result.setResult(Constant.Intelligence.RESULT_FAIL); + return result; + } + + HtQuestionOptionExample optionExample = new HtQuestionOptionExample(); + optionExample.createCriteria().andQuestionIdEqualTo(param.getQuestionId()).andScoreEqualTo(new BigDecimal(builder.toString().substring(builder.length() - 2))); + List options = htQuestionOptionMapper.selectByExample(optionExample); + if (CollectionUtil.isEmpty(options)) { + result.setResult(Constant.Intelligence.RESULT_FAIL); + } else { + result.setResult(Constant.Intelligence.RESULT_SUCCESS); + result.setOptionId(options.get(0).getId()); + } + + // 记录智能测评答案 + HtPatientIntelligence intelligence = new HtPatientIntelligence(); + intelligence.setId(snowflake.nextId()); + intelligence.setPatientReportId(param.getPatientReportId()); + intelligence.setQuestionId(param.getQuestionId()); + intelligence.setResult(builder.toString()); + intelligence.setUrl(param.getUrl()); + htPatientIntelligenceMapper.insertSelective(intelligence); + return result; + } + + private String getImg(String url) { + return url.replace(PropUtil.imgDomain + "/", PropUtil.path); + } + + +} 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 4d5ca2cd..c5ffa7fe 100644 --- a/ht/src/main/java/com/ccsens/ht/uitl/Constant.java +++ b/ht/src/main/java/com/ccsens/ht/uitl/Constant.java @@ -23,6 +23,16 @@ public class Constant { /**上传图片访问路径*/ public static final String UPLOAD_URL = "uploads/"; + /**智能测评*/ + public static final class Intelligence{ + /**测评失败*/ + public final static byte RESULT_FAIL = 0; + /**测评成功*/ + public final static byte RESULT_SUCCESS = 1; + /**调用方式:python*/ + public final static byte METHOD_TYPE_PYTHON = 0; + } + /**导入相关*/ public static final class Import{ diff --git a/ht/src/main/resources/application-prod.yml b/ht/src/main/resources/application-prod.yml index d33ef5bc..5ed7a0e3 100644 --- a/ht/src/main/resources/application-prod.yml +++ b/ht/src/main/resources/application-prod.yml @@ -1,5 +1,5 @@ server: - port: 7040 + port: 7050 servlet: context-path: spring: diff --git a/ht/src/main/resources/mapper_dao/HtQuestionDao.xml b/ht/src/main/resources/mapper_dao/HtQuestionDao.xml index 19cbf8cc..0af8c2a6 100644 --- a/ht/src/main/resources/mapper_dao/HtQuestionDao.xml +++ b/ht/src/main/resources/mapper_dao/HtQuestionDao.xml @@ -5,6 +5,7 @@ + @@ -101,10 +102,10 @@ q.time_wabei AS timeWabei, q.allow_clear AS allowClear, q.clear_times AS clearTimes, - q.timing_length AS timingLength - + q.timing_length AS timingLength, + if (i.id is null, 0, 1) as intelligence FROM - t_ht_question q + t_ht_question q left join t_ht_question_intelligence i on q.id = i.question_id and i.is_del = 0 WHERE q.evaluation_code = #{code} AND q.sort = #{num} diff --git a/ht/src/main/resources/mapper_raw/HtPatientIntelligenceMapper.xml b/ht/src/main/resources/mapper_raw/HtPatientIntelligenceMapper.xml new file mode 100644 index 00000000..77a0f4d8 --- /dev/null +++ b/ht/src/main/resources/mapper_raw/HtPatientIntelligenceMapper.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, patient_report_id, question_id, url, result, create_time, update_time, is_del + + + + + delete from t_ht_patient_intelligence + where id = #{id,jdbcType=BIGINT} + + + delete from t_ht_patient_intelligence + + + + + + insert into t_ht_patient_intelligence (id, patient_report_id, question_id, + url, result, create_time, + update_time, is_del) + values (#{id,jdbcType=BIGINT}, #{patientReportId,jdbcType=BIGINT}, #{questionId,jdbcType=BIGINT}, + #{url,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT}) + + + insert into t_ht_patient_intelligence + + + id, + + + patient_report_id, + + + question_id, + + + url, + + + result, + + + create_time, + + + update_time, + + + is_del, + + + + + #{id,jdbcType=BIGINT}, + + + #{patientReportId,jdbcType=BIGINT}, + + + #{questionId,jdbcType=BIGINT}, + + + #{url,jdbcType=VARCHAR}, + + + #{result,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{isDel,jdbcType=TINYINT}, + + + + + + update t_ht_patient_intelligence + + + id = #{record.id,jdbcType=BIGINT}, + + + patient_report_id = #{record.patientReportId,jdbcType=BIGINT}, + + + question_id = #{record.questionId,jdbcType=BIGINT}, + + + url = #{record.url,jdbcType=VARCHAR}, + + + result = #{record.result,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + is_del = #{record.isDel,jdbcType=TINYINT}, + + + + + + + + update t_ht_patient_intelligence + set id = #{record.id,jdbcType=BIGINT}, + patient_report_id = #{record.patientReportId,jdbcType=BIGINT}, + question_id = #{record.questionId,jdbcType=BIGINT}, + url = #{record.url,jdbcType=VARCHAR}, + result = #{record.result,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + is_del = #{record.isDel,jdbcType=TINYINT} + + + + + + update t_ht_patient_intelligence + + + patient_report_id = #{patientReportId,jdbcType=BIGINT}, + + + question_id = #{questionId,jdbcType=BIGINT}, + + + url = #{url,jdbcType=VARCHAR}, + + + result = #{result,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + is_del = #{isDel,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_ht_patient_intelligence + set patient_report_id = #{patientReportId,jdbcType=BIGINT}, + question_id = #{questionId,jdbcType=BIGINT}, + url = #{url,jdbcType=VARCHAR}, + result = #{result,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + is_del = #{isDel,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/ht/src/main/resources/mapper_raw/HtQuestionIntelligenceMapper.xml b/ht/src/main/resources/mapper_raw/HtQuestionIntelligenceMapper.xml new file mode 100644 index 00000000..baa43686 --- /dev/null +++ b/ht/src/main/resources/mapper_raw/HtQuestionIntelligenceMapper.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, question_id, url, type, create_time, update_time, is_del + + + + + delete from t_ht_question_intelligence + where id = #{id,jdbcType=BIGINT} + + + delete from t_ht_question_intelligence + + + + + + insert into t_ht_question_intelligence (id, question_id, url, + type, create_time, update_time, + is_del) + values (#{id,jdbcType=BIGINT}, #{questionId,jdbcType=BIGINT}, #{url,jdbcType=VARCHAR}, + #{type,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, + #{isDel,jdbcType=TINYINT}) + + + insert into t_ht_question_intelligence + + + id, + + + question_id, + + + url, + + + type, + + + create_time, + + + update_time, + + + is_del, + + + + + #{id,jdbcType=BIGINT}, + + + #{questionId,jdbcType=BIGINT}, + + + #{url,jdbcType=VARCHAR}, + + + #{type,jdbcType=TINYINT}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{isDel,jdbcType=TINYINT}, + + + + + + update t_ht_question_intelligence + + + id = #{record.id,jdbcType=BIGINT}, + + + question_id = #{record.questionId,jdbcType=BIGINT}, + + + url = #{record.url,jdbcType=VARCHAR}, + + + type = #{record.type,jdbcType=TINYINT}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + is_del = #{record.isDel,jdbcType=TINYINT}, + + + + + + + + update t_ht_question_intelligence + set id = #{record.id,jdbcType=BIGINT}, + question_id = #{record.questionId,jdbcType=BIGINT}, + url = #{record.url,jdbcType=VARCHAR}, + type = #{record.type,jdbcType=TINYINT}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + is_del = #{record.isDel,jdbcType=TINYINT} + + + + + + update t_ht_question_intelligence + + + question_id = #{questionId,jdbcType=BIGINT}, + + + url = #{url,jdbcType=VARCHAR}, + + + type = #{type,jdbcType=TINYINT}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + is_del = #{isDel,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_ht_question_intelligence + set question_id = #{questionId,jdbcType=BIGINT}, + url = #{url,jdbcType=VARCHAR}, + type = #{type,jdbcType=TINYINT}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + is_del = #{isDel,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file