|
@@ -0,0 +1,68 @@
|
|
|
+package org.diagbot.push.convert;
|
|
|
+
|
|
|
+import org.diagbot.common.work.LisDetail;
|
|
|
+import org.diagbot.common.work.SearchData;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+public class PreProcess {
|
|
|
+
|
|
|
+ private static String up = "升高";
|
|
|
+ private static String down = "降低";
|
|
|
+ private static String normal = "正常";
|
|
|
+
|
|
|
+ private static String pos = "阳性";
|
|
|
+ private static String neg = "阴性";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理临床数据
|
|
|
+ *
|
|
|
+ * @param searchdata
|
|
|
+ * @return ResponseData
|
|
|
+ */
|
|
|
+ public SearchData processClinicalData(SearchData searchdata) {
|
|
|
+ SearchData sData = searchdata;
|
|
|
+
|
|
|
+ sData.setLisArr(processLis(sData.getLisArr()));
|
|
|
+
|
|
|
+ if (sData.getLisArr().size() > 0) {
|
|
|
+ List<String> otherVal = sData.getLisArr().stream().map(lisArr -> lisArr.getOtherValue()).collect(Collectors.toList());
|
|
|
+ sData.setLis(String.join(",", otherVal));
|
|
|
+ }
|
|
|
+
|
|
|
+ return sData;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<LisDetail> processLis(List<LisDetail> lisArr) {
|
|
|
+ if (lisArr.size() == 0) {
|
|
|
+ return lisArr;
|
|
|
+ }
|
|
|
+
|
|
|
+ String Otherval = "";
|
|
|
+
|
|
|
+ for (int i = 0; i < lisArr.size(); i++) {
|
|
|
+ LisDetail lisres = lisArr.get(i);
|
|
|
+
|
|
|
+// Otherval = (lisres.getOtherValue().trim().length() > 0) ? lisres.getOtherValue().trim() + "\n" : "";
|
|
|
+ Otherval = lisres.getOtherValue();
|
|
|
+
|
|
|
+ if (Otherval.indexOf(pos) >= 0 || Otherval.indexOf(neg) >= 0) {
|
|
|
+ lisres.setOtherValue(lisres.getDetailName() + Otherval);
|
|
|
+ } else {
|
|
|
+ Otherval = (Otherval.trim().length() > 0) ? Otherval.trim() + "\n" : "";
|
|
|
+ if (lisres.getValue() == null) {
|
|
|
+ continue;
|
|
|
+ } else if (lisres.getMaxValue() != null && lisres.getValue() > lisres.getMaxValue()) {
|
|
|
+ lisres.setOtherValue(Otherval + lisres.getDetailName() + up);
|
|
|
+ } else if (lisres.getMinValue() != null && lisres.getValue() < lisres.getMinValue()) {
|
|
|
+ lisres.setOtherValue(Otherval + lisres.getDetailName() + down);
|
|
|
+ } else {
|
|
|
+ lisres.setOtherValue(Otherval + lisres.getDetailName() + normal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return lisArr;
|
|
|
+ }
|
|
|
+}
|