|
|
@@ -0,0 +1,222 @@
|
|
|
+package com.nb.web.service.bus.utils;
|
|
|
+
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.nb.web.api.entity.BusEvaluationEntity;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 不良反应工具类
|
|
|
+ * 用于筛选评价中的不良反应项并转换为字符串数组
|
|
|
+ */
|
|
|
+public class AdverseReactionUtil {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据评价实体筛选出不良反应项并转换为字符串数组
|
|
|
+ * 只返回不良反应的描述含义
|
|
|
+ *
|
|
|
+ * @param evaluation 评价实体
|
|
|
+ * @return 不良反应字符串数组
|
|
|
+ */
|
|
|
+ public static String getAdverseReactions(BusEvaluationEntity evaluation) {
|
|
|
+ List<String> reactions = new ArrayList<>();
|
|
|
+ if (evaluation == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ // 恶心呕吐
|
|
|
+ if (evaluation.getNauseaVomit() != null && evaluation.getNauseaVomit() > 0) {
|
|
|
+ reactions.add(getNauseaVomitDescription(evaluation.getNauseaVomit()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 瘙痒
|
|
|
+ if (evaluation.getItch() != null && evaluation.getItch() > 0) {
|
|
|
+ reactions.add(getItchDescription(evaluation.getItch()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 眩晕
|
|
|
+ if (evaluation.getVertigo() != null && evaluation.getVertigo() > 0) {
|
|
|
+ reactions.add(getVertigoDescription(evaluation.getVertigo()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 咽喉疼痛
|
|
|
+ if (evaluation.getSoreThroat() != null && evaluation.getSoreThroat() > 0) {
|
|
|
+ reactions.add(getSoreThroatDescription(evaluation.getSoreThroat()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 尿潴留
|
|
|
+ if (evaluation.getUroschesis() != null && evaluation.getUroschesis() > 0) {
|
|
|
+ reactions.add(getUroschesisDescription(evaluation.getUroschesis()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 呼吸抑制
|
|
|
+ if (evaluation.getBreathDepression() != null && evaluation.getBreathDepression() > 0) {
|
|
|
+ reactions.add(getBreathDepressionDescription(evaluation.getBreathDepression()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 声音嘶哑
|
|
|
+ if (evaluation.getHoarseness() != null && evaluation.getHoarseness() > 0) {
|
|
|
+ reactions.add(getHoarsenessDescription(evaluation.getHoarseness()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 认知障碍
|
|
|
+ if (evaluation.getCognitionObstacle() != null && evaluation.getCognitionObstacle() > 0) {
|
|
|
+ reactions.add(getCognitionObstacleDescription(evaluation.getCognitionObstacle()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 满意度
|
|
|
+ if (evaluation.getSatisfaction() != null) {
|
|
|
+ switch (evaluation.getSatisfaction()) {
|
|
|
+ case 0:
|
|
|
+ reactions.add("满意");
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ reactions.add("较满意");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ reactions.add("不满意");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 备注
|
|
|
+ if (StrUtil.isNotBlank(evaluation.getRemark())) {
|
|
|
+ reactions.add(evaluation.getRemark());
|
|
|
+ }
|
|
|
+
|
|
|
+ return reactions.stream()
|
|
|
+ .filter(StrUtil::isNotBlank)
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取恶心呕吐评分描述
|
|
|
+ * @param score 评分
|
|
|
+ * @return 描述
|
|
|
+ */
|
|
|
+ private static String getNauseaVomitDescription(Integer score) {
|
|
|
+ if (score == null || score <= 0) {
|
|
|
+ return "";
|
|
|
+ } else if (score == 1) {
|
|
|
+ return "仅恶心";
|
|
|
+ } else if (score == 2) {
|
|
|
+ return "恶心+呕吐";
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取瘙痒评分描述
|
|
|
+ * @param score 评分
|
|
|
+ * @return 描述
|
|
|
+ */
|
|
|
+ private static String getItchDescription(Integer score) {
|
|
|
+ if (score == null || score <= 0) {
|
|
|
+ return "";
|
|
|
+ } else if (score == 1) {
|
|
|
+ return "轻度瘙痒";
|
|
|
+ } else if (score == 2) {
|
|
|
+ return "中度瘙痒";
|
|
|
+ } else if (score >= 3) {
|
|
|
+ return "重度瘙痒";
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取眩晕评分描述
|
|
|
+ * @param score 评分
|
|
|
+ * @return 描述
|
|
|
+ */
|
|
|
+ private static String getVertigoDescription(Integer score) {
|
|
|
+ if (score == null || score <= 0) {
|
|
|
+ return "";
|
|
|
+ } else if (score == 1) {
|
|
|
+ return "轻度眩晕";
|
|
|
+ } else if (score == 2) {
|
|
|
+ return "中度眩晕";
|
|
|
+ } else if (score >= 3) {
|
|
|
+ return "重度眩晕";
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取咽喉疼痛评分描述
|
|
|
+ * @param score 评分
|
|
|
+ * @return 描述
|
|
|
+ */
|
|
|
+ private static String getSoreThroatDescription(Integer score) {
|
|
|
+ if (score == null || score <= 0) {
|
|
|
+ return "";
|
|
|
+ } else if (score == 1) {
|
|
|
+ return "轻微疼痛";
|
|
|
+ } else if (score == 2) {
|
|
|
+ return "吞咽困难";
|
|
|
+ } else if (score >= 3) {
|
|
|
+ return "无法进食";
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取尿潴留评分描述
|
|
|
+ * @param score 评分
|
|
|
+ * @return 描述
|
|
|
+ */
|
|
|
+ private static String getUroschesisDescription(Integer score) {
|
|
|
+ if (score == null || score <= 0) {
|
|
|
+ return "";
|
|
|
+ } else if (score == 1) {
|
|
|
+ return "排尿时间延长";
|
|
|
+ } else if (score == 2) {
|
|
|
+ return "排尿困难";
|
|
|
+ } else if (score >= 3) {
|
|
|
+ return "需导尿";
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取呼吸抑制评分描述
|
|
|
+ * @param score 评分
|
|
|
+ * @return 描述
|
|
|
+ */
|
|
|
+ private static String getBreathDepressionDescription(Integer score) {
|
|
|
+ if (score == null || score <= 0) {
|
|
|
+ return "";
|
|
|
+ } else if (score == 1) {
|
|
|
+ return "呼吸抑制";
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取声音嘶哑评分描述
|
|
|
+ * @param score 评分
|
|
|
+ * @return 描述
|
|
|
+ */
|
|
|
+ private static String getHoarsenessDescription(Integer score) {
|
|
|
+ if (score == null || score <= 0) {
|
|
|
+ return "";
|
|
|
+ } else if (score == 1) {
|
|
|
+ return "声音嘶哑";
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取认知障碍评分描述
|
|
|
+ * @param score 评分
|
|
|
+ * @return 描述
|
|
|
+ */
|
|
|
+ private static String getCognitionObstacleDescription(Integer score) {
|
|
|
+ if (score == null || score <= 0) {
|
|
|
+ return "";
|
|
|
+ } else if (score == 1) {
|
|
|
+ return "认知障碍";
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+}
|