Преглед изворни кода

更新化验其它提醒的结果数值比较逻辑

MarkHuang пре 4 година
родитељ
комит
4065a59731
1 измењених фајлова са 25 додато и 14 уклоњено
  1. 25 14
      src/main/java/com/diagbot/facade/NeoFacade.java

+ 25 - 14
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -323,22 +323,22 @@ public class NeoFacade {
                         unit = lis.getUnits();
                         for (LisRemind lisRemind : lrlist) {
                             if (lisRemind.getRange() == 0) { /*&& lisRemind.getUnit().equals(unit) &&*/
-                                if (null!=lisRemind.getMinval() && null!=lisRemind.getMaxval() &&
-                                    val <= lisRemind.getMaxval() && val >= lisRemind.getMinval()){
-                                    OtherTipNeoDTO otherTipNeoDTO = new OtherTipNeoDTO();
-                                    BeanUtils.copyProperties(lis, otherTipNeoDTO);
-
-                                    otherTipNeoDTO.setFactor(getReminds(lisRemind));
-                                    otherTipNeoDTOS.add(otherTipNeoDTO);
+                                if (null==lisRemind.getMinval() && val <= lisRemind.getMaxval()) {
+                                    otherTipNeoDTOS = updateTipNeoDTO(otherTipNeoDTOS, lis, lisRemind);
+                                }
+                                else if(null==lisRemind.getMaxval() && val >= lisRemind.getMinval()) {
+                                    otherTipNeoDTOS = updateTipNeoDTO(otherTipNeoDTOS, lis, lisRemind);
+                                }
+                                else if (null!=lisRemind.getMinval() && null!=lisRemind.getMaxval() &&
+                                  val <= lisRemind.getMaxval() && val >= lisRemind.getMinval()) {
+                                    otherTipNeoDTOS = updateTipNeoDTO(otherTipNeoDTOS, lis, lisRemind);
                                 }
                             } else if (lisRemind.getRange() == 1) { /*&& lisRemind.getUnit().equals(unit) &&*/
-                                if ((null!=lisRemind.getMaxval() && val > lisRemind.getMaxval()) ||
-                                    (null!=lisRemind.getMinval() && val < lisRemind.getMinval())){
-                                    OtherTipNeoDTO otherTipNeoDTO = new OtherTipNeoDTO();
-                                    BeanUtils.copyProperties(lis, otherTipNeoDTO);
-
-                                    otherTipNeoDTO.setFactor(getReminds(lisRemind));
-                                    otherTipNeoDTOS.add(otherTipNeoDTO);
+                                if (null!=lisRemind.getMaxval() && val > lisRemind.getMaxval()) {
+                                    otherTipNeoDTOS = updateTipNeoDTO(otherTipNeoDTOS, lis, lisRemind);
+                                }
+                                else if (null!=lisRemind.getMinval() && val < lisRemind.getMinval()){
+                                    otherTipNeoDTOS = updateTipNeoDTO(otherTipNeoDTOS, lis, lisRemind);
                                 }
                             }
                         }
@@ -365,6 +365,17 @@ public class NeoFacade {
     }
 
 
+    public List<OtherTipNeoDTO> updateTipNeoDTO(List<OtherTipNeoDTO> otherTipNeoDTOS, Lis lis, LisRemind lisRemind) {
+        OtherTipNeoDTO otherTipNeoDTO = new OtherTipNeoDTO();
+        BeanUtils.copyProperties(lis, otherTipNeoDTO);
+
+        otherTipNeoDTO.setFactor(getReminds(lisRemind));
+        otherTipNeoDTOS.add(otherTipNeoDTO);
+
+        return otherTipNeoDTOS;
+    }
+
+
     public List<NodeNeoDTO> getReminds(LisRemind lisRemind) {
         List<NodeNeoDTO> nodeNeoDTOS = new ArrayList<>();
         NodeNeoDTO nodeNeoDTO;