11 changed files with 873 additions and 72 deletions
@ -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(); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue