Browse Source

体质辨识初步印象和总分入库

lhqzyy
ccsens_zhengzhichuan 2 months ago
parent
commit
1ae3230311
  1. 11
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/TzbsRmsReportResult.java
  2. 70
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/TzbsRmsReportResultExample.java
  3. 11
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/TzbsRmsReportYsjy.java
  4. 70
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/TzbsRmsReportYsjyExample.java
  5. 398
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/ClientEvaVo.java
  6. 37
      ruisi_java/ruisi-system/src/main/resources/mapper/system/TzbsRmsReportResultMapper.xml
  7. 37
      ruisi_java/ruisi-system/src/main/resources/mapper/system/TzbsRmsReportYsjyMapper.xml
  8. 12
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/ClientEvaDao.java
  9. 8
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IRmsService.java
  10. 219
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/RmsServiceImpl.java
  11. 72
      ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/ClientEvaDao.xml

11
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/TzbsRmsReportResult.java

@ -9,6 +9,8 @@ public class TzbsRmsReportResult implements Serializable {
private Long reportId; private Long reportId;
private String scaleCode;
private String constiCode; private String constiCode;
private String constiName; private String constiName;
@ -45,6 +47,14 @@ public class TzbsRmsReportResult implements Serializable {
this.reportId = reportId; this.reportId = reportId;
} }
public String getScaleCode() {
return scaleCode;
}
public void setScaleCode(String scaleCode) {
this.scaleCode = scaleCode == null ? null : scaleCode.trim();
}
public String getConstiCode() { public String getConstiCode() {
return constiCode; return constiCode;
} }
@ -125,6 +135,7 @@ public class TzbsRmsReportResult implements Serializable {
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", resultId=").append(resultId); sb.append(", resultId=").append(resultId);
sb.append(", reportId=").append(reportId); sb.append(", reportId=").append(reportId);
sb.append(", scaleCode=").append(scaleCode);
sb.append(", constiCode=").append(constiCode); sb.append(", constiCode=").append(constiCode);
sb.append(", constiName=").append(constiName); sb.append(", constiName=").append(constiName);
sb.append(", constiLevel=").append(constiLevel); sb.append(", constiLevel=").append(constiLevel);

70
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/TzbsRmsReportResultExample.java

@ -226,6 +226,76 @@ public class TzbsRmsReportResultExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andScaleCodeIsNull() {
addCriterion("scale_code is null");
return (Criteria) this;
}
public Criteria andScaleCodeIsNotNull() {
addCriterion("scale_code is not null");
return (Criteria) this;
}
public Criteria andScaleCodeEqualTo(String value) {
addCriterion("scale_code =", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeNotEqualTo(String value) {
addCriterion("scale_code <>", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeGreaterThan(String value) {
addCriterion("scale_code >", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeGreaterThanOrEqualTo(String value) {
addCriterion("scale_code >=", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeLessThan(String value) {
addCriterion("scale_code <", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeLessThanOrEqualTo(String value) {
addCriterion("scale_code <=", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeLike(String value) {
addCriterion("scale_code like", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeNotLike(String value) {
addCriterion("scale_code not like", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeIn(List<String> values) {
addCriterion("scale_code in", values, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeNotIn(List<String> values) {
addCriterion("scale_code not in", values, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeBetween(String value1, String value2) {
addCriterion("scale_code between", value1, value2, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeNotBetween(String value1, String value2) {
addCriterion("scale_code not between", value1, value2, "scaleCode");
return (Criteria) this;
}
public Criteria andConstiCodeIsNull() { public Criteria andConstiCodeIsNull() {
addCriterion("consti_code is null"); addCriterion("consti_code is null");
return (Criteria) this; return (Criteria) this;

11
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/TzbsRmsReportYsjy.java

@ -8,6 +8,8 @@ public class TzbsRmsReportYsjy implements Serializable {
private Long reportId; private Long reportId;
private String scaleCode;
private String constiCode; private String constiCode;
private String constiName; private String constiName;
@ -40,6 +42,14 @@ public class TzbsRmsReportYsjy implements Serializable {
this.reportId = reportId; this.reportId = reportId;
} }
public String getScaleCode() {
return scaleCode;
}
public void setScaleCode(String scaleCode) {
this.scaleCode = scaleCode == null ? null : scaleCode.trim();
}
public String getConstiCode() { public String getConstiCode() {
return constiCode; return constiCode;
} }
@ -104,6 +114,7 @@ public class TzbsRmsReportYsjy implements Serializable {
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", ysjyId=").append(ysjyId); sb.append(", ysjyId=").append(ysjyId);
sb.append(", reportId=").append(reportId); sb.append(", reportId=").append(reportId);
sb.append(", scaleCode=").append(scaleCode);
sb.append(", constiCode=").append(constiCode); sb.append(", constiCode=").append(constiCode);
sb.append(", constiName=").append(constiName); sb.append(", constiName=").append(constiName);
sb.append(", createBy=").append(createBy); sb.append(", createBy=").append(createBy);

70
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/TzbsRmsReportYsjyExample.java

@ -225,6 +225,76 @@ public class TzbsRmsReportYsjyExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andScaleCodeIsNull() {
addCriterion("scale_code is null");
return (Criteria) this;
}
public Criteria andScaleCodeIsNotNull() {
addCriterion("scale_code is not null");
return (Criteria) this;
}
public Criteria andScaleCodeEqualTo(String value) {
addCriterion("scale_code =", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeNotEqualTo(String value) {
addCriterion("scale_code <>", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeGreaterThan(String value) {
addCriterion("scale_code >", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeGreaterThanOrEqualTo(String value) {
addCriterion("scale_code >=", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeLessThan(String value) {
addCriterion("scale_code <", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeLessThanOrEqualTo(String value) {
addCriterion("scale_code <=", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeLike(String value) {
addCriterion("scale_code like", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeNotLike(String value) {
addCriterion("scale_code not like", value, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeIn(List<String> values) {
addCriterion("scale_code in", values, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeNotIn(List<String> values) {
addCriterion("scale_code not in", values, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeBetween(String value1, String value2) {
addCriterion("scale_code between", value1, value2, "scaleCode");
return (Criteria) this;
}
public Criteria andScaleCodeNotBetween(String value1, String value2) {
addCriterion("scale_code not between", value1, value2, "scaleCode");
return (Criteria) this;
}
public Criteria andConstiCodeIsNull() { public Criteria andConstiCodeIsNull() {
addCriterion("consti_code is null"); addCriterion("consti_code is null");
return (Criteria) this; return (Criteria) this;

398
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/ClientEvaVo.java

@ -0,0 +1,398 @@
package com.ccsens.system.domain.vo;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author zezha
*/
public class ClientEvaVo {
@Data
public static class PatientQuery {
private Long patientId;
private String name;
private Integer gender;
private String birthday;
private String idcard;
private String phone;
private String height;
private String weight;
private String waistline;
private List<String> sickness;
public Integer getAge() {
Integer age = null;
try {
if (StrUtil.isNotBlank(idcard) && IdcardUtil.isValidCard(idcard)) {
age = IdcardUtil.getAgeByIdCard(idcard);
} else if (StrUtil.isNotBlank(birthday)) {
age = DateUtil.ageOfNow(DateUtil.parse(birthday));
}
} catch (Exception ignored) {
}
return age;
}
}
@Data
public static class PatientSaveOrUpdate {
private Long patientId;
private String name;
private Integer gender;
private String birthday;
private String idcard;
private String phone;
private String height;
private String weight;
private String waistline;
private List<String> sickness;
public Integer getAge() {
Integer age = null;
try {
if (StrUtil.isNotBlank(idcard) && IdcardUtil.isValidCard(idcard)) {
age = IdcardUtil.getAgeByIdCard(idcard);
} else if (StrUtil.isNotBlank(birthday)) {
age = DateUtil.ageOfNow(DateUtil.parse(birthday));
}
} catch (Exception ignored) {
}
return age;
}
}
@Data
public static class EvaSave {
private Long evaId;
private Long patientId;
private String scaleCode;
private String scaleName;
private Integer evaStatus;
}
@Data
public static class EvaQuestionList {
private Long evaId;
private Long patientId;
private String scaleCode;
private String scaleName;
private Integer evaStatus;
private List<Question> questions;
@Data
public static class Question {
private String quesCode;
private String quesName;
private String quesSort;
private List<Option> options;
@Data
public static class Option {
private String optionCode;
private String optionName;
private String optionScore;
private String optionSort;
private String optionChecked;
}
}
}
@Data
public static class ReportView {
//报告单信息
private Long reportId;
//患者信息
private Long patientId;
private String name;
private Integer gender;
private String birthday;
private String age;
private String height;
private String weight;
private String waistline;
private String idcard;
private String phone;
//测评信息
private Long evaId;
private Date evaTime;
private String evaUsername;
private String evaNickname;
private String evaScaleCode;
private String evaScaleName;
private String blh;
//分数明细
private List<Score> scores;
//养生方案
private List<Ysfa> ysfa;
//测评结论
private String result;
//主体质
private String result1;
//兼夹体质
private String result2;
@Data
public static class Score {
private String constiCode;
private String constiName;
private String constiLevel;
private String constiScore;
private Integer mainFlag;
//参考分数(是)
private String refScoreYes;
//参考分数(倾向是)
private String refScoreMaybe;
//满分
private String fullScore;
public String getConstiScore() {
if (constiScore != null && new BigDecimal(constiScore).compareTo(BigDecimal.ZERO) < 0) {
return "0.00";
}
return constiScore;
}
}
@Data
public static class Ysfa {
private String constiCode;
private String constiName;
private String ysjy;
}
public BigDecimal getTotalScore() {
if (CollectionUtil.isEmpty(scores)) {
return BigDecimal.ZERO;
}
return scores.stream().map(Score::getConstiScore).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
}
public String getResult() {
if (CollectionUtil.isEmpty(scores)) {
return "";
}
StringBuilder result = new StringBuilder();
String yesStr = "", jbsStr = "", qxsStr = "";
//拼接三部分字符串(是,基本是,倾向是)
for (Score score : scores) {
if (score.getConstiLevel().equals("00")) {
yesStr = yesStr + score.getConstiName() + "、";
}
if (score.getConstiLevel().equals("10")) {
jbsStr = jbsStr + score.getConstiName() + "、";
}
if (score.getConstiLevel().equals("11")) {
qxsStr = qxsStr + score.getConstiName() + "、";
}
}
//去掉尾部,
if (StrUtil.isNotBlank(yesStr)) {
yesStr = yesStr.substring(0, yesStr.length() - 1);
}
if (StrUtil.isNotBlank(jbsStr)) {
jbsStr = jbsStr.substring(0, jbsStr.length() - 1);
}
if (StrUtil.isNotBlank(qxsStr)) {
qxsStr = qxsStr.substring(0, qxsStr.length() - 1);
}
//拼接
result.append(StrUtil.isNotBlank(yesStr) ? "【" + yesStr + "】 " : "")
.append(StrUtil.isNotBlank(jbsStr) ? "基本是【" + yesStr + "】 " : "")
.append(StrUtil.isNotBlank(qxsStr) ? "有 【" + qxsStr + "】 倾向 " : "");
return result.toString();
}
// public String getResult() {
// if (CollectionUtil.isEmpty(scores)) {
// return "";
// }
//
// //找到主体质
// Score mainSCore = null;
// for (Score score : scores) {
// if (score.getMainFlag() == 1) {
// mainSCore = score;
// }
// }
// if (mainSCore == null) {
// return "";
// }
// if (Objects.equals(mainSCore.getConstiLevel(), "00")) {
// return "【" + mainSCore.getConstiName() + "】";
// } else if (Objects.equals(mainSCore.getConstiLevel(), "10")) {
// return "基本是【" + mainSCore.getConstiName() + "】";
// } else if (Objects.equals(mainSCore.getConstiLevel(), "11")) {
// return "倾向是【" + mainSCore.getConstiName() + "】";
// } else {
// return "";
// }
// }
public String getResult1() {
if (CollectionUtil.isEmpty(scores)) {
return "";
}
scores = scores.stream().filter(e -> e.getMainFlag() != null).collect(Collectors.toList());
//找到主体质
Score mainSCore = null;
for (Score score : scores) {
if (score.getMainFlag() == 1) {
mainSCore = score;
}
}
if (mainSCore == null) {
return "";
}
if (Objects.equals(mainSCore.getConstiLevel(), "00")) {
return "【" + mainSCore.getConstiName() + "】";
} else if (Objects.equals(mainSCore.getConstiLevel(), "10")) {
return "基本是【" + mainSCore.getConstiName() + "】";
} else if (Objects.equals(mainSCore.getConstiLevel(), "11")) {
return "倾向是【" + mainSCore.getConstiName() + "】";
} else {
return "";
}
}
public String getResult2() {
if (CollectionUtil.isEmpty(scores)) {
return "";
}
scores = scores.stream().filter(e -> e.getMainFlag() != null).collect(Collectors.toList());
//找到兼夹体质并按照分数从大到小排序
List<Score> jianjiaScores = scores.stream().filter(score -> score.getMainFlag() == 2).sorted(Comparator.comparing(Score::getConstiScore).reversed())
.collect(Collectors.toList());
StringBuilder res = new StringBuilder();
for (Score score : jianjiaScores) {
if (Objects.equals(score.getConstiLevel(), "00")) {
res.append("【" + score.getConstiName() + "】");
} else if (Objects.equals(score.getConstiLevel(), "10")) {
res.append("基本是【" + score.getConstiName() + "】");
} else if (Objects.equals(score.getConstiLevel(), "11")) {
res.append("倾向是【" + score.getConstiName() + "】");
} else {
res.append("");
}
res.append("、");
}
//去掉尾部
if (StrUtil.isNotBlank(res.toString())) {
res = new StringBuilder(res.substring(0, res.length() - 1));
}
return res.toString();
}
}
@Data
public static class EvaList {
//报告单信息
private Long reportId;
//患者信息
private Long patientId;
private String name;
private Integer gender;
private String birthday;
private String age;
private String height;
private String weight;
private String waistline;
private String idcard;
private String phone;
//测评信息
private Long evaId;
private Date evaTime;
private String evaUsername;
private String evaNickname;
private String evaScaleCode;
private String evaScaleName;
private Integer evaStatus;
private String blh;
//分数明细
private List<Score> scores;
//测评结论
private String result;
@Data
public static class Score {
private String constiCode;
private String constiName;
private String constiLevel;
private String constiScore;
private Integer mainFlag;
//参考分数(是)
private String refScoreYes;
//参考分数(倾向是)
private String refScoreMaybe;
//满分
private String fullScore;
public String getConstiScore() {
if (constiScore != null && new BigDecimal(constiScore).compareTo(BigDecimal.ZERO) < 0) {
return "0.00";
}
return constiScore;
}
}
public String getResult() {
if (CollectionUtil.isEmpty(scores)) {
return "";
}
StringBuilder result = new StringBuilder();
String yesStr = "", jbsStr = "", qxsStr = "";
//拼接三部分字符串(是,基本是,倾向是)
for (Score score : scores) {
if (score.getConstiLevel().equals("00")) {
yesStr = yesStr + score.getConstiName() + "、";
}
if (score.getConstiLevel().equals("10")) {
jbsStr = jbsStr + score.getConstiName() + "、";
}
if (score.getConstiLevel().equals("11")) {
qxsStr = qxsStr + score.getConstiName() + "、";
}
}
//去掉尾部,
if (StrUtil.isNotBlank(yesStr)) {
yesStr = yesStr.substring(0, yesStr.length() - 1);
}
if (StrUtil.isNotBlank(jbsStr)) {
jbsStr = jbsStr.substring(0, jbsStr.length() - 1);
}
if (StrUtil.isNotBlank(qxsStr)) {
qxsStr = qxsStr.substring(0, qxsStr.length() - 1);
}
//拼接
result.append(StrUtil.isNotBlank(yesStr) ? "【" + yesStr + "】 " : "")
.append(StrUtil.isNotBlank(jbsStr) ? "基本是【" + yesStr + "】 " : "")
.append(StrUtil.isNotBlank(qxsStr) ? "有 【" + qxsStr + "】 倾向 " : "");
return result.toString();
}
}
}

37
ruisi_java/ruisi-system/src/main/resources/mapper/system/TzbsRmsReportResultMapper.xml

@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.ccsens.system.domain.po.TzbsRmsReportResult"> <resultMap id="BaseResultMap" type="com.ccsens.system.domain.po.TzbsRmsReportResult">
<id column="result_id" jdbcType="BIGINT" property="resultId" /> <id column="result_id" jdbcType="BIGINT" property="resultId" />
<result column="report_id" jdbcType="BIGINT" property="reportId" /> <result column="report_id" jdbcType="BIGINT" property="reportId" />
<result column="scale_code" jdbcType="VARCHAR" property="scaleCode" />
<result column="consti_code" jdbcType="VARCHAR" property="constiCode" /> <result column="consti_code" jdbcType="VARCHAR" property="constiCode" />
<result column="consti_name" jdbcType="VARCHAR" property="constiName" /> <result column="consti_name" jdbcType="VARCHAR" property="constiName" />
<result column="consti_level" jdbcType="VARCHAR" property="constiLevel" /> <result column="consti_level" jdbcType="VARCHAR" property="constiLevel" />
@ -73,8 +74,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
result_id, report_id, consti_code, consti_name, consti_level, consti_score, main_flag, result_id, report_id, scale_code, consti_code, consti_name, consti_level, consti_score,
create_by, create_time, update_by, update_time main_flag, create_by, create_time, update_by, update_time
</sql> </sql>
<select id="selectByExample" parameterType="com.ccsens.system.domain.po.TzbsRmsReportResultExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.ccsens.system.domain.po.TzbsRmsReportResultExample" resultMap="BaseResultMap">
select select
@ -107,14 +108,16 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.ccsens.system.domain.po.TzbsRmsReportResult"> <insert id="insert" parameterType="com.ccsens.system.domain.po.TzbsRmsReportResult">
insert into tzbs_rms_report_result (result_id, report_id, consti_code, insert into tzbs_rms_report_result (result_id, report_id, scale_code,
consti_name, consti_level, consti_score, consti_code, consti_name, consti_level,
main_flag, create_by, create_time, consti_score, main_flag, create_by,
update_by, update_time) create_time, update_by, update_time
values (#{resultId,jdbcType=BIGINT}, #{reportId,jdbcType=BIGINT}, #{constiCode,jdbcType=VARCHAR}, )
#{constiName,jdbcType=VARCHAR}, #{constiLevel,jdbcType=VARCHAR}, #{constiScore,jdbcType=DECIMAL}, values (#{resultId,jdbcType=BIGINT}, #{reportId,jdbcType=BIGINT}, #{scaleCode,jdbcType=VARCHAR},
#{mainFlag,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{constiCode,jdbcType=VARCHAR}, #{constiName,jdbcType=VARCHAR}, #{constiLevel,jdbcType=VARCHAR},
#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}) #{constiScore,jdbcType=DECIMAL}, #{mainFlag,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert> </insert>
<insert id="insertSelective" parameterType="com.ccsens.system.domain.po.TzbsRmsReportResult"> <insert id="insertSelective" parameterType="com.ccsens.system.domain.po.TzbsRmsReportResult">
insert into tzbs_rms_report_result insert into tzbs_rms_report_result
@ -125,6 +128,9 @@
<if test="reportId != null"> <if test="reportId != null">
report_id, report_id,
</if> </if>
<if test="scaleCode != null">
scale_code,
</if>
<if test="constiCode != null"> <if test="constiCode != null">
consti_code, consti_code,
</if> </if>
@ -160,6 +166,9 @@
<if test="reportId != null"> <if test="reportId != null">
#{reportId,jdbcType=BIGINT}, #{reportId,jdbcType=BIGINT},
</if> </if>
<if test="scaleCode != null">
#{scaleCode,jdbcType=VARCHAR},
</if>
<if test="constiCode != null"> <if test="constiCode != null">
#{constiCode,jdbcType=VARCHAR}, #{constiCode,jdbcType=VARCHAR},
</if> </if>
@ -204,6 +213,9 @@
<if test="record.reportId != null"> <if test="record.reportId != null">
report_id = #{record.reportId,jdbcType=BIGINT}, report_id = #{record.reportId,jdbcType=BIGINT},
</if> </if>
<if test="record.scaleCode != null">
scale_code = #{record.scaleCode,jdbcType=VARCHAR},
</if>
<if test="record.constiCode != null"> <if test="record.constiCode != null">
consti_code = #{record.constiCode,jdbcType=VARCHAR}, consti_code = #{record.constiCode,jdbcType=VARCHAR},
</if> </if>
@ -240,6 +252,7 @@
update tzbs_rms_report_result update tzbs_rms_report_result
set result_id = #{record.resultId,jdbcType=BIGINT}, set result_id = #{record.resultId,jdbcType=BIGINT},
report_id = #{record.reportId,jdbcType=BIGINT}, report_id = #{record.reportId,jdbcType=BIGINT},
scale_code = #{record.scaleCode,jdbcType=VARCHAR},
consti_code = #{record.constiCode,jdbcType=VARCHAR}, consti_code = #{record.constiCode,jdbcType=VARCHAR},
consti_name = #{record.constiName,jdbcType=VARCHAR}, consti_name = #{record.constiName,jdbcType=VARCHAR},
consti_level = #{record.constiLevel,jdbcType=VARCHAR}, consti_level = #{record.constiLevel,jdbcType=VARCHAR},
@ -259,6 +272,9 @@
<if test="reportId != null"> <if test="reportId != null">
report_id = #{reportId,jdbcType=BIGINT}, report_id = #{reportId,jdbcType=BIGINT},
</if> </if>
<if test="scaleCode != null">
scale_code = #{scaleCode,jdbcType=VARCHAR},
</if>
<if test="constiCode != null"> <if test="constiCode != null">
consti_code = #{constiCode,jdbcType=VARCHAR}, consti_code = #{constiCode,jdbcType=VARCHAR},
</if> </if>
@ -292,6 +308,7 @@
<update id="updateByPrimaryKey" parameterType="com.ccsens.system.domain.po.TzbsRmsReportResult"> <update id="updateByPrimaryKey" parameterType="com.ccsens.system.domain.po.TzbsRmsReportResult">
update tzbs_rms_report_result update tzbs_rms_report_result
set report_id = #{reportId,jdbcType=BIGINT}, set report_id = #{reportId,jdbcType=BIGINT},
scale_code = #{scaleCode,jdbcType=VARCHAR},
consti_code = #{constiCode,jdbcType=VARCHAR}, consti_code = #{constiCode,jdbcType=VARCHAR},
consti_name = #{constiName,jdbcType=VARCHAR}, consti_name = #{constiName,jdbcType=VARCHAR},
consti_level = #{constiLevel,jdbcType=VARCHAR}, consti_level = #{constiLevel,jdbcType=VARCHAR},

37
ruisi_java/ruisi-system/src/main/resources/mapper/system/TzbsRmsReportYsjyMapper.xml

@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.ccsens.system.domain.po.TzbsRmsReportYsjy"> <resultMap id="BaseResultMap" type="com.ccsens.system.domain.po.TzbsRmsReportYsjy">
<id column="ysjy_id" jdbcType="BIGINT" property="ysjyId" /> <id column="ysjy_id" jdbcType="BIGINT" property="ysjyId" />
<result column="report_id" jdbcType="BIGINT" property="reportId" /> <result column="report_id" jdbcType="BIGINT" property="reportId" />
<result column="scale_code" jdbcType="VARCHAR" property="scaleCode" />
<result column="consti_code" jdbcType="VARCHAR" property="constiCode" /> <result column="consti_code" jdbcType="VARCHAR" property="constiCode" />
<result column="consti_name" jdbcType="VARCHAR" property="constiName" /> <result column="consti_name" jdbcType="VARCHAR" property="constiName" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" /> <result column="create_by" jdbcType="VARCHAR" property="createBy" />
@ -73,8 +74,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
ysjy_id, report_id, consti_code, consti_name, create_by, create_time, update_by, ysjy_id, report_id, scale_code, consti_code, consti_name, create_by, create_time,
update_time update_by, update_time
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
consti_ysjy consti_ysjy
@ -128,14 +129,14 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.ccsens.system.domain.po.TzbsRmsReportYsjy"> <insert id="insert" parameterType="com.ccsens.system.domain.po.TzbsRmsReportYsjy">
insert into tzbs_rms_report_ysjy (ysjy_id, report_id, consti_code, insert into tzbs_rms_report_ysjy (ysjy_id, report_id, scale_code,
consti_name, create_by, create_time, consti_code, consti_name, create_by,
update_by, update_time, consti_ysjy create_time, update_by, update_time,
) consti_ysjy)
values (#{ysjyId,jdbcType=BIGINT}, #{reportId,jdbcType=BIGINT}, #{constiCode,jdbcType=VARCHAR}, values (#{ysjyId,jdbcType=BIGINT}, #{reportId,jdbcType=BIGINT}, #{scaleCode,jdbcType=VARCHAR},
#{constiName,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{constiCode,jdbcType=VARCHAR}, #{constiName,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{constiYsjy,jdbcType=LONGVARCHAR} #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
) #{constiYsjy,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.ccsens.system.domain.po.TzbsRmsReportYsjy"> <insert id="insertSelective" parameterType="com.ccsens.system.domain.po.TzbsRmsReportYsjy">
insert into tzbs_rms_report_ysjy insert into tzbs_rms_report_ysjy
@ -146,6 +147,9 @@
<if test="reportId != null"> <if test="reportId != null">
report_id, report_id,
</if> </if>
<if test="scaleCode != null">
scale_code,
</if>
<if test="constiCode != null"> <if test="constiCode != null">
consti_code, consti_code,
</if> </if>
@ -175,6 +179,9 @@
<if test="reportId != null"> <if test="reportId != null">
#{reportId,jdbcType=BIGINT}, #{reportId,jdbcType=BIGINT},
</if> </if>
<if test="scaleCode != null">
#{scaleCode,jdbcType=VARCHAR},
</if>
<if test="constiCode != null"> <if test="constiCode != null">
#{constiCode,jdbcType=VARCHAR}, #{constiCode,jdbcType=VARCHAR},
</if> </if>
@ -213,6 +220,9 @@
<if test="record.reportId != null"> <if test="record.reportId != null">
report_id = #{record.reportId,jdbcType=BIGINT}, report_id = #{record.reportId,jdbcType=BIGINT},
</if> </if>
<if test="record.scaleCode != null">
scale_code = #{record.scaleCode,jdbcType=VARCHAR},
</if>
<if test="record.constiCode != null"> <if test="record.constiCode != null">
consti_code = #{record.constiCode,jdbcType=VARCHAR}, consti_code = #{record.constiCode,jdbcType=VARCHAR},
</if> </if>
@ -243,6 +253,7 @@
update tzbs_rms_report_ysjy update tzbs_rms_report_ysjy
set ysjy_id = #{record.ysjyId,jdbcType=BIGINT}, set ysjy_id = #{record.ysjyId,jdbcType=BIGINT},
report_id = #{record.reportId,jdbcType=BIGINT}, report_id = #{record.reportId,jdbcType=BIGINT},
scale_code = #{record.scaleCode,jdbcType=VARCHAR},
consti_code = #{record.constiCode,jdbcType=VARCHAR}, consti_code = #{record.constiCode,jdbcType=VARCHAR},
consti_name = #{record.constiName,jdbcType=VARCHAR}, consti_name = #{record.constiName,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR}, create_by = #{record.createBy,jdbcType=VARCHAR},
@ -258,6 +269,7 @@
update tzbs_rms_report_ysjy update tzbs_rms_report_ysjy
set ysjy_id = #{record.ysjyId,jdbcType=BIGINT}, set ysjy_id = #{record.ysjyId,jdbcType=BIGINT},
report_id = #{record.reportId,jdbcType=BIGINT}, report_id = #{record.reportId,jdbcType=BIGINT},
scale_code = #{record.scaleCode,jdbcType=VARCHAR},
consti_code = #{record.constiCode,jdbcType=VARCHAR}, consti_code = #{record.constiCode,jdbcType=VARCHAR},
consti_name = #{record.constiName,jdbcType=VARCHAR}, consti_name = #{record.constiName,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR}, create_by = #{record.createBy,jdbcType=VARCHAR},
@ -274,6 +286,9 @@
<if test="reportId != null"> <if test="reportId != null">
report_id = #{reportId,jdbcType=BIGINT}, report_id = #{reportId,jdbcType=BIGINT},
</if> </if>
<if test="scaleCode != null">
scale_code = #{scaleCode,jdbcType=VARCHAR},
</if>
<if test="constiCode != null"> <if test="constiCode != null">
consti_code = #{constiCode,jdbcType=VARCHAR}, consti_code = #{constiCode,jdbcType=VARCHAR},
</if> </if>
@ -301,6 +316,7 @@
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.ccsens.system.domain.po.TzbsRmsReportYsjy"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.ccsens.system.domain.po.TzbsRmsReportYsjy">
update tzbs_rms_report_ysjy update tzbs_rms_report_ysjy
set report_id = #{reportId,jdbcType=BIGINT}, set report_id = #{reportId,jdbcType=BIGINT},
scale_code = #{scaleCode,jdbcType=VARCHAR},
consti_code = #{constiCode,jdbcType=VARCHAR}, consti_code = #{constiCode,jdbcType=VARCHAR},
consti_name = #{constiName,jdbcType=VARCHAR}, consti_name = #{constiName,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR}, create_by = #{createBy,jdbcType=VARCHAR},
@ -313,6 +329,7 @@
<update id="updateByPrimaryKey" parameterType="com.ccsens.system.domain.po.TzbsRmsReportYsjy"> <update id="updateByPrimaryKey" parameterType="com.ccsens.system.domain.po.TzbsRmsReportYsjy">
update tzbs_rms_report_ysjy update tzbs_rms_report_ysjy
set report_id = #{reportId,jdbcType=BIGINT}, set report_id = #{reportId,jdbcType=BIGINT},
scale_code = #{scaleCode,jdbcType=VARCHAR},
consti_code = #{constiCode,jdbcType=VARCHAR}, consti_code = #{constiCode,jdbcType=VARCHAR},
consti_name = #{constiName,jdbcType=VARCHAR}, consti_name = #{constiName,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR}, create_by = #{createBy,jdbcType=VARCHAR},

12
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/ClientEvaDao.java

@ -2,6 +2,7 @@ package com.ccsens.client.persist.dao;
import com.ccsens.system.domain.po.TzbsRmsReportResult; import com.ccsens.system.domain.po.TzbsRmsReportResult;
import com.ccsens.system.domain.po.TzbsRmsReportYsjy; import com.ccsens.system.domain.po.TzbsRmsReportYsjy;
import com.ccsens.system.domain.vo.ClientEvaVo;
import com.ccsens.system.domain.vo.ReportVo; import com.ccsens.system.domain.vo.ReportVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -32,5 +33,14 @@ public interface ClientEvaDao {
* @param deptId * @param deptId
* @return * @return
*/ */
String queryYsjy(@Param("constiCode") String constiCode, @Param("deptId") Long deptId); String queryYsjy(@Param("constiCode") String constiCode);
/**
* 查询报告单
*
* @param evaId
* @return
*/
ClientEvaVo.ReportView getTzbsResult(@Param("evaId") Long evaId,
@Param("code") String code);
} }

8
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IRmsService.java

@ -2,6 +2,7 @@ package com.ccsens.client.service;
import com.ccsens.common.core.domain.model.LoginUser; import com.ccsens.common.core.domain.model.LoginUser;
import com.ccsens.system.domain.dto.RmsDto; import com.ccsens.system.domain.dto.RmsDto;
import com.ccsens.system.domain.vo.ClientEvaVo;
import com.ccsens.system.domain.vo.RmsVo; import com.ccsens.system.domain.vo.RmsVo;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
@ -14,6 +15,13 @@ import java.util.List;
public interface IRmsService { public interface IRmsService {
RmsVo.ReportDetail queryReportDetail(RmsDto.QueryDetail dto); RmsVo.ReportDetail queryReportDetail(RmsDto.QueryDetail dto);
/**
* 查看报告单
* @param param
* @return
*/
ClientEvaVo.ReportView reportView(Long evaluationId, String code);
List<RmsVo.ReportScore> getReportScores(List<RmsVo.ReportScore> reportScores, long reportId); List<RmsVo.ReportScore> getReportScores(List<RmsVo.ReportScore> reportScores, long reportId);
List<RmsVo.QueryReportHistory> queryReportListByTime(RmsDto.QueryReportHistory dto, Long userId, String dataScope); List<RmsVo.QueryReportHistory> queryReportListByTime(RmsDto.QueryReportHistory dto, Long userId, String dataScope);

219
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/RmsServiceImpl.java

@ -8,6 +8,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HtmlUtil;
import com.ccsens.client.persist.dao.AmsDao; import com.ccsens.client.persist.dao.AmsDao;
import com.ccsens.client.persist.dao.ClientEvaDao; import com.ccsens.client.persist.dao.ClientEvaDao;
import com.ccsens.client.persist.dao.RmsDao; import com.ccsens.client.persist.dao.RmsDao;
@ -26,6 +27,7 @@ import com.ccsens.system.domain.dto.RmsDto;
import com.ccsens.system.domain.dto.message.MessageDto; import com.ccsens.system.domain.dto.message.MessageDto;
import com.ccsens.system.domain.po.*; import com.ccsens.system.domain.po.*;
import com.ccsens.system.domain.vo.AmsVo; import com.ccsens.system.domain.vo.AmsVo;
import com.ccsens.system.domain.vo.ClientEvaVo;
import com.ccsens.system.domain.vo.ReportVo; import com.ccsens.system.domain.vo.ReportVo;
import com.ccsens.system.domain.vo.RmsVo; import com.ccsens.system.domain.vo.RmsVo;
import com.ccsens.system.persist.mapper.*; import com.ccsens.system.persist.mapper.*;
@ -148,7 +150,7 @@ public class RmsServiceImpl implements IRmsService {
//查询报告单分数 //查询报告单分数
List<RmsVo.ReportScore> reportScore = rmsDao.queryReportScore1(dto.getEvaluationId(), null, dto.getSex()); List<RmsVo.ReportScore> reportScore = rmsDao.queryReportScore1(dto.getEvaluationId(), null, dto.getSex());
//重新封装报告单信息 //重新封装报告单信息
scores = getReportScores(reportScore, dto.getEvaluationId()); scores = getReportScores(reportScore, dto.getEvaluationId(), report.getId());
if (CollUtil.isNotEmpty(scores)) { if (CollUtil.isNotEmpty(scores)) {
scores.forEach(score -> { scores.forEach(score -> {
@ -157,6 +159,7 @@ public class RmsServiceImpl implements IRmsService {
reportScaleScore.setId(IDGenerator.nextSnowflakeId()); reportScaleScore.setId(IDGenerator.nextSnowflakeId());
reportScaleScore.setReportId(report.getId()); reportScaleScore.setReportId(report.getId());
reportScaleScore.setScaleCode(score.getCode()); reportScaleScore.setScaleCode(score.getCode());
reportScaleScore.setImpression(score.getImpression());
reportScaleScore.setScore(score.getScore()); reportScaleScore.setScore(score.getScore());
rmsReportScaleScoreMapper.insertSelective(reportScaleScore); rmsReportScaleScoreMapper.insertSelective(reportScaleScore);
@ -164,10 +167,6 @@ public class RmsServiceImpl implements IRmsService {
}); });
} }
//生成中医体质辨识结果
zytzbs(dto, report, scores);
} else { } else {
report = rmsReports.get(0); report = rmsReports.get(0);
//查找测评信息 //查找测评信息
@ -212,7 +211,6 @@ public class RmsServiceImpl implements IRmsService {
score.setQuestionDuration(emsEvaluationQuestionDurations.stream().mapToLong(EmsEvaluationQuestionDuration::getDuration).sum()); score.setQuestionDuration(emsEvaluationQuestionDurations.stream().mapToLong(EmsEvaluationQuestionDuration::getDuration).sum());
} }
} }
}); });
} }
@ -322,45 +320,60 @@ public class RmsServiceImpl implements IRmsService {
return detail; return detail;
} }
private void zytzbs(RmsDto.QueryDetail dto, RmsReport report, List<RmsVo.ReportScore> scores) { @Override
if (CollUtil.isNotEmpty(scores)) { public ClientEvaVo.ReportView reportView(Long evaluationId, String code) {
for (RmsVo.ReportScore score : scores) { ClientEvaVo.ReportView vo = clientEvaDao.getTzbsResult(evaluationId, code);
if ("TZBS_LN".equals(score.getCode()) || "TZBS_BZ".equals(score.getCode())) { if (vo != null && CollectionUtil.isNotEmpty(vo.getYsfa())) {
//3.2 生成报告单辨识结果 for (ClientEvaVo.ReportView.Ysfa ysfa : vo.getYsfa()) {
List<ReportVo.EvaResult> resultList = countReportResult(dto.getEvaluationId(), report.getId()); //html转义
List<TzbsRmsReportResult> reportResultList = CollectionUtil.newArrayList(); ysfa.setYsjy(HtmlUtil.unescape(ysfa.getYsjy()));
for (ReportVo.EvaResult resultVo : resultList) { }
//转换为RmsReportResult对象 }
TzbsRmsReportResult reportResult = new TzbsRmsReportResult(); return vo;
reportResult.setResultId(IDGenerator.nextSnowflakeId()); }
reportResult.setReportId(report.getId());
reportResult.setConstiCode(resultVo.getConstiCode());
reportResult.setConstiName(resultVo.getConstiName());
reportResult.setConstiLevel(resultVo.getConstiLevel());
reportResult.setConstiScore(resultVo.getZhScore());
reportResult.setMainFlag(resultVo.getMainFlag());
reportResult.setCreateBy(SecurityUtils.getUsername());
reportResultList.add(reportResult);
}
clientEvaDao.batchInsertReportResult(reportResultList);
//3.3 生成养生建议 private void zytzbs(Long evaluationId, Long reportId, RmsVo.ReportScore score) {
for (TzbsRmsReportResult result : reportResultList) { if ("TZBS_LN".equals(score.getCode()) || "TZBS_BZ".equals(score.getCode())) {
if (StrUtil.isEmpty(result.getConstiLevel()) || result.getConstiLevel().equals("20")) { //3.2 生成报告单辨识结果
continue; List<ReportVo.EvaResult> resultList = countReportResult(evaluationId, reportId);
} List<TzbsRmsReportResult> reportResultList = CollectionUtil.newArrayList();
TzbsRmsReportYsjy rmsReportYsjy = new TzbsRmsReportYsjy(); for (ReportVo.EvaResult resultVo : resultList) {
rmsReportYsjy.setYsjyId(IDGenerator.nextSnowflakeId()); //转换为RmsReportResult对象
rmsReportYsjy.setReportId(result.getReportId()); TzbsRmsReportResult reportResult = new TzbsRmsReportResult();
rmsReportYsjy.setConstiCode(result.getConstiCode()); reportResult.setResultId(IDGenerator.nextSnowflakeId());
rmsReportYsjy.setConstiName(result.getConstiName()); reportResult.setScaleCode(score.getCode());
// rmsReportYsjy.setConstiYsjy( reportResult.setReportId(reportId);
// clientEvaDao.queryYsjy(result.getConstiCode(), SecurityUtils.getDeptId()) reportResult.setConstiCode(resultVo.getConstiCode());
// ); reportResult.setConstiName(resultVo.getConstiName());
rmsReportYsjyMapper.insertSelective(rmsReportYsjy); reportResult.setConstiLevel(resultVo.getConstiLevel());
} reportResult.setConstiScore(resultVo.getZhScore());
reportResult.setMainFlag(resultVo.getMainFlag());
reportResult.setCreateBy(SecurityUtils.getUsername());
reportResultList.add(reportResult);
}
clientEvaDao.batchInsertReportResult(reportResultList);
//3.3 生成养生建议
for (TzbsRmsReportResult result : reportResultList) {
if (StrUtil.isEmpty(result.getConstiLevel()) || result.getConstiLevel().equals("20")) {
continue;
} }
TzbsRmsReportYsjy rmsReportYsjy = new TzbsRmsReportYsjy();
rmsReportYsjy.setYsjyId(IDGenerator.nextSnowflakeId());
rmsReportYsjy.setReportId(result.getReportId());
rmsReportYsjy.setConstiCode(result.getConstiCode());
rmsReportYsjy.setConstiName(result.getConstiName());
rmsReportYsjy.setScaleCode(score.getCode());
rmsReportYsjy.setConstiYsjy(
clientEvaDao.queryYsjy(result.getConstiCode())
);
rmsReportYsjyMapper.insertSelective(rmsReportYsjy);
} }
//获取初步印象
ClientEvaVo.ReportView reportView = reportView(evaluationId, score.getCode());
score.setImpression(reportView.getResult());
score.setScore(reportView.getTotalScore());
} }
} }
@ -1004,6 +1017,128 @@ public class RmsServiceImpl implements IRmsService {
} }
}); });
//生成中医体质辨识结果
scores.forEach(score -> {
if ("TZBS_LN".equals(score.getCode()) || "TZBS_BZ".equals(score.getCode())) {
//获取初步印象
ClientEvaVo.ReportView reportView = reportView(evaluationId, score.getCode());
score.setImpression(reportView.getResult());
score.setScore(reportView.getTotalScore());
}
});
return scores;
}
public List<RmsVo.ReportScore> getReportScores(List<RmsVo.ReportScore> reportScores, long evaluationId, Long reportId) {
Map<String, RmsVo.ReportScore> map = new HashMap<>(32);
List<RmsVo.ReportScore> scores = new ArrayList<>();
reportScores.forEach(score -> {
if (ObjectUtil.isNotNull(score.getScore())) {
if (BigDecimal.valueOf(score.getScore().intValue()).compareTo(score.getScore()) == 0) {
score.setScore(score.getScore().setScale(0, BigDecimal.ROUND_HALF_UP));
}
}
map.put(score.getCode(), score);
//测评类(MOCA等)
if (GenConstants.Ht.Report.TYPE_EVALUATION == score.getType()) {
String specialCode = "NPI";
if (specialCode.equalsIgnoreCase(score.getCode())) {
initNPI(evaluationId, score);
}
//特殊处理NMS
if (GenConstants.Ht.Report.NMS.equalsIgnoreCase(score.getCode())) {
BigDecimal nms = rmsDao.countNmsScore(evaluationId);
score.setScore(nms);
}
//特殊处理CDR
if (GenConstants.Ht.Report.CDR.equalsIgnoreCase(score.getCode())) {
BigDecimal cdr = scoreService.getCDR(evaluationId);
score.setScore(cdr);
}
scores.add(score);
} else {
log.info("score:{}", score);
if (MoCA_B_8.equalsIgnoreCase(score.getCode())) {
//3个或3个以下物品 0
//4~5个物品 1
//6~8个物品 2
//9~10个物品 3
BigDecimal score1 = score.getScore();
if (score1 != null) {
if (new BigDecimal(3).compareTo(score1) >= 0) {
score.setScore(new BigDecimal(0));
}
if (new BigDecimal(5).compareTo(score1) >= 0 && new BigDecimal(4).compareTo(score1) <= 0) {
score.setScore(new BigDecimal(1));
}
if (new BigDecimal(8).compareTo(score1) >= 0 && new BigDecimal(6).compareTo(score1) <= 0) {
score.setScore(new BigDecimal(2));
}
if (new BigDecimal(10).compareTo(score1) >= 0 && new BigDecimal(9).compareTo(score1) <= 0) {
score.setScore(new BigDecimal(3));
}
}
}
if (StrUtil.isEmpty(score.getParentCode())) {
return;
}
RmsVo.ReportScore reportScore = map.get(score.getParentCode());
if (reportScore != null) {
reportScore.addSub(score);
}
}
});
scores.forEach(score -> {
if (GenConstants.Ht.Report.MOCA_SJZ.equalsIgnoreCase(score.getCode())) {
return;
}
if (GenConstants.Ht.Report.ADAS.equalsIgnoreCase(score.getCode())) {
scoreService.getADAS(evaluationId, score);
}
if (GenConstants.Ht.Report.ADAS14.equalsIgnoreCase(score.getCode())) {
scoreService.getADAS14(evaluationId, score);
}
sumScore(score);
//量表的分数为空,表示量表下没有其他认知域,直接使用量表的得分为总分
if (score.getScore() == null) {
score.setScore(score.getScaleScore());
}
});
scores.forEach(score -> {
if (score.getCode().equals("CTT")) {
if (CollectionUtil.isNotEmpty(score.getSubReport())) {
score.getSubReport().forEach(sub -> {
String errorNumKey = "";
if (sub.getCode().equals("ASJCS")) {
errorNumKey = "CTT_A_ERROR_NUMBER";
} else if (sub.getCode().equals("BSJCS")) {
errorNumKey = "CTT_B_ERROR_NUMBER";
}
if (StrUtil.isNotEmpty(errorNumKey)) {
//qms_question_record表中没有code字段用以标识record,此处只能先用show_title进行过滤
AmsPatientQuestionRecordDesc desc = queryCTTRecordDesc(evaluationId, sub.getCode(), "错误数");
sub.getRecordDescMap().put(errorNumKey, desc != null ? desc.getAnswer() : "");
}
});
}
}
});
scores.forEach(score -> {
if (score.getCode().equals("PSQI")) {
initPSQI(evaluationId, score);
}
});
//生成中医体质辨识结果
scores.forEach(score -> {
if ("TZBS_LN".equals(score.getCode()) || "TZBS_BZ".equals(score.getCode())) {
zytzbs(evaluationId, reportId, score);
}
});
return scores; return scores;
} }

72
ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/ClientEvaDao.xml

@ -2,10 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ccsens.client.persist.dao.ClientEvaDao"> <mapper namespace="com.ccsens.client.persist.dao.ClientEvaDao">
<insert id="batchInsertReportResult"> <insert id="batchInsertReportResult">
replace into tzbs_rms_report_result(result_id,report_id,consti_code,consti_name,consti_level,consti_score,main_flag,create_by) replace into tzbs_rms_report_result(result_id,report_id,scale_code,consti_code,consti_name,consti_level,consti_score,main_flag,create_by)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.resultId},#{item.reportId},#{item.constiCode},#{item.constiName},#{item.constiLevel},#{item.constiScore},#{item.mainFlag},#{item.createBy}) (#{item.resultId},#{item.reportId},#{item.scaleCode},#{item.constiCode},#{item.constiName},#{item.constiLevel},#{item.constiScore},#{item.mainFlag},#{item.createBy})
</foreach> </foreach>
</insert> </insert>
@ -20,16 +20,16 @@
count(q.id) AS quesNum count(q.id) AS quesNum
FROM FROM
ems_evaluation eva ems_evaluation eva
LEFT JOIN ems_evaluation_scale_relevance r ON r.evaluation_id = eva.id LEFT JOIN ems_evaluation_scale_relevance r ON r.evaluation_id = eva.id and r.del_flag = 0
LEFT JOIN qms_scale s ON r.scale_code = s.CODE LEFT JOIN qms_scale s ON r.scale_code = s.CODE
AND s.del_flag = 0 and s.code in ('TZBS_BZ', 'TZBS_LN') AND s.del_flag = 0 and s.code in ('TZBS_BZ', 'TZBS_LN')
LEFT JOIN tzbs_qms_scale_consti cst ON s.CODE = cst.scale_code LEFT JOIN tzbs_qms_scale_consti cst ON s.CODE = cst.scale_code
AND cst.del_flag = 0 AND cst.del_flag = 0
LEFT JOIN tzbs_qms_scale_cognitive rel ON cst.consti_code = rel.consti_code LEFT JOIN tzbs_qms_scale_cognitive rel ON cst.consti_code = rel.consti_code
AND rel.del_flag = 0 AND rel.del_flag = 0
LEFT JOIN qms_question q ON rel.ques_code = q.question_code LEFT JOIN qms_question q ON rel.ques_code = q.question_code and q.del_flag = 0
LEFT JOIN ams_patient_answer_score a ON eva.id = a.evaluation_id LEFT JOIN ams_patient_answer_score a ON eva.id = a.evaluation_id
AND a.question_id = q.id AND a.question_id = q.id and a.del_flag = 0
WHERE WHERE
eva.id = #{evaId} eva.id = #{evaId}
GROUP BY GROUP BY
@ -43,16 +43,70 @@
<select id="queryYsjy" resultType="java.lang.String"> <select id="queryYsjy" resultType="java.lang.String">
select select
if(hst.consti_ysfa_template is not null, hst.consti_ysfa_template, scy.consti_ysfa_template) as ysfa scy.consti_ysfa_template as ysfa
from from
qms_scale_consti cst tzbs_qms_scale_consti cst
left join qms_scale s on cst.scale_code = s.scale_code and s.del_flag = 0
left join tzbs_qms_scale_consti_ysfa scy on cst.consti_code = scy.consti_code and scy.del_flag = 0 left join tzbs_qms_scale_consti_ysfa scy on cst.consti_code = scy.consti_code and scy.del_flag = 0
left join hms_ysfa_template hst on cst.consti_code = hst.consti_code and hst.del_flag = 0 and hst.dept_id = #{deptId}
where where
cst.consti_code = #{constiCode} cst.consti_code = #{constiCode}
and cst.del_flag = 0 and cst.del_flag = 0
order by order by
cst.consti_id cst.consti_id
</select> </select>
<resultMap id="map_reportView" type="com.ccsens.system.domain.vo.ClientEvaVo$ReportView">
<id column="reportId" property="reportId"/>
<result column="patientId" property="patientId"/>
<result column="name" property="name"/>
<result column="birthday" property="birthday"/>
<result column="age" property="age"/>
<result column="gender" property="gender"/>
<result column="height" property="height"/>
<result column="weight" property="weight"/>
<result column="waistline" property="waistline"/>
<result column="idcard" property="idcard"/>
<result column="phone" property="phone"/>
<result column="evaId" property="evaId"/>
<result column="evaTime" property="evaTime"/>
<result column="evaUsername" property="evaUsername"/>
<result column="evaNickname" property="evaNickname"/>
<result column="evaScaleCode" property="evaScaleCode"/>
<result column="evaScaleName" property="evaScaleName"/>
<result column="blh" property="blh"/>
<collection property="scores" ofType="com.ccsens.system.domain.vo.ClientEvaVo$ReportView$Score">
<id column="constiCode" property="constiCode"/>
<result column="constiName" property="constiName"/>
<result column="constiLevel" property="constiLevel"/>
<result column="constiScore" property="constiScore"/>
<result column="mainFlag" property="mainFlag"/>
<result column="refScoreYes" property="refScoreYes"/>
<result column="refScoreMaybe" property="refScoreMaybe"/>
<result column="fullScore" property="fullScore"/>
</collection>
<collection property="ysfa" ofType="com.ccsens.system.domain.vo.ClientEvaVo$ReportView$Ysfa">
<id column="jyConstiCode" property="constiCode"/>
<result column="jyConstiName" property="constiName"/>
<result column="ysjy" property="ysjy"/>
</collection>
</resultMap>
<select id="getTzbsResult" resultMap="map_reportView">
SELECT
r.id AS reportId,
r.evaluation_id AS evaId,
res.consti_code AS constiCode,
res.consti_name AS constiName,
res.consti_level AS constiLevel,
res.consti_score AS constiScore,
res.main_flag AS mainFlag
FROM
rms_report r
LEFT JOIN tzbs_rms_report_result res ON r.id = res.report_id
WHERE
r.del_flag = 0
AND r.evaluation_id = #{evaId} and res.scale_code = #{code}
ORDER BY
res.result_id
</select>
</mapper> </mapper>
Loading…
Cancel
Save