Browse Source

排序整理

chengyao 3 years ago
parent
commit
ac1117e580

+ 33 - 2
src/main/java/com/diagbot/facade/DataAnalysisDeptFacade.java

@@ -23,11 +23,13 @@ import javax.servlet.http.HttpServletResponse;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 
 /**
@@ -97,8 +99,7 @@ public class DataAnalysisDeptFacade {
         List<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDeptDTOS = DataAnalysisFacade.page(getEntryDefectImproveDeptDTOList, size, current);
         if (ListUtil.isNotEmpty(getEntryDefectImproveDeptDTOS)) {
             //排序操作
-        //    getEntryDefectImproveDeptDTOS = DataAnalysisFacade.sortList(getEntryDefectImproveDeptDTOS, getEntryDefectImproveDeptVO.getAsc() != null ? getEntryDefectImproveDeptVO.getAsc() : getEntryDefectImproveDeptVO.getDesc() + " desc");
-        }
+            getEntryDefectImproveDeptDTOS =  sortEntryDefectListByDdept( getEntryDefectImproveDeptDTOS ,getEntryDefectImproveDeptVO); }
         ;
         page.setRecords(getEntryDefectImproveDeptDTOS);
         return page;
@@ -149,6 +150,36 @@ public class DataAnalysisDeptFacade {
         }
         getEntryDefectImproveDeptVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
     }
+    public  List<GetEntryDefectImproveDeptDTO>  sortEntryDefectListByDdept(List<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDeptDTOS, GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO) {
+        if(StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getAsc())){
+            if("totalNum".equals(getEntryDefectImproveDeptVO.getAsc())){
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getTotalNum)).collect(Collectors.toList());
+
+            }
+            if("handleNum".equals(getEntryDefectImproveDeptVO.getAsc())){
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getHandleNum)).collect(Collectors.toList());
+
+            }
+            if("improveleNum".equals(getEntryDefectImproveDeptVO.getAsc())){
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getImproveleNum)).collect(Collectors.toList());
+            }
+        }
+
+        if(StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getDesc())){
+            if("totalNum".equals(getEntryDefectImproveDeptVO.getDesc())){
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getTotalNum).reversed()).collect(Collectors.toList());
+
+            }
+            if("handleNum".equals(getEntryDefectImproveDeptVO.getDesc())){
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getHandleNum).reversed()).collect(Collectors.toList());
+
+            }
+            if("improveleNum".equals(getEntryDefectImproveDeptVO.getDesc())){
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getImproveleNum).reversed()).collect(Collectors.toList());
+            }
+        }
+        return getEntryDefectImproveDeptDTOS;
+    }
 
     /**
      * @Description: 缺陷信息封装

+ 108 - 4
src/main/java/com/diagbot/facade/DataAnalysisFacade.java

@@ -44,6 +44,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -250,8 +251,8 @@ public class DataAnalysisFacade {
         List<GetEntryDefectImproveDTO> getEntryDefectImproveDTOS = page(getEntryDefectImproveDTO, size, current);
         if (ListUtil.isNotEmpty(getEntryDefectImproveDTOS)) {
             //排序操作
-         //   getEntryDefectImproveDTOS = sortList(getEntryDefectImproveDTOS, getEntryDefectImproveVO.getAsc() != null ? getEntryDefectImproveVO.getAsc() : getEntryDefectImproveVO.getDesc() + " desc");
-        };
+            getEntryDefectImproveDTOS =  sortEntryDefectList( getEntryDefectImproveDTOS ,getEntryDefectImproveVO);
+       };
         page.setRecords(getEntryDefectImproveDTOS);
         return page;
     }
@@ -332,6 +333,110 @@ public class DataAnalysisFacade {
         return currentPageList;
     }
 
+    public  List<BehospitalInfoDTO>  getEntryDefectImproveInnerDTOS( List<BehospitalInfoDTO> behospitalInfoDTOList ,GetEntryDefectImproveInnerVO
+            getEntryDefectImproveInnerVO) {
+        if(StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getAsc())){
+            if("behDeptName".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getBehDeptName)).collect(Collectors.toList());
+
+            }
+            if("doctorName".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getDoctorName)).collect(Collectors.toList());
+
+            }
+            if("name".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getName)).collect(Collectors.toList());
+            }
+            if("fileCode".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getFileCode)).collect(Collectors.toList());
+            }
+            if("age".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getAge)).collect(Collectors.toList());
+            }
+            if("behospitalDate".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getBehospitalDate)).collect(Collectors.toList());
+            }
+            if("leaveHospitalDate".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getLeaveHospitalDate)).collect(Collectors.toList());
+            }
+            if("scoreRes".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getScoreRes)).collect(Collectors.toList());
+            }
+            if("level".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getLevel)).collect(Collectors.toList());
+            }
+            if("gradeTime".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getGradeTime)).collect(Collectors.toList());
+            }
+        }
+
+        if(StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getDesc())){
+            if("behDeptName".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getBehDeptName).reversed()).collect(Collectors.toList());
+
+            }
+            if("doctorName".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getDoctorName).reversed()).collect(Collectors.toList());
+
+            }
+            if("name".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getName).reversed()).collect(Collectors.toList());
+            }
+            if("fileCode".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getFileCode).reversed()).collect(Collectors.toList());
+            }
+            if("age".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getAge).reversed()).collect(Collectors.toList());
+            }
+            if("behospitalDate".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getBehospitalDate).reversed()).collect(Collectors.toList());
+            }
+            if("leaveHospitalDate".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getLeaveHospitalDate).reversed()).collect(Collectors.toList());
+            }
+            if("scoreRes".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getScoreRes).reversed()).collect(Collectors.toList());
+            }
+            if("level".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getLevel).reversed()).collect(Collectors.toList());
+            }
+            if("gradeTime".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalInfoDTO::getGradeTime).reversed()).collect(Collectors.toList());
+            }
+        }
+        return behospitalInfoDTOList;
+    }
+    public  List<GetEntryDefectImproveDTO>  sortEntryDefectList( List<GetEntryDefectImproveDTO> getEntryDefectImproveDTOS ,GetEntryDefectImproveVO getEntryDefectImproveVO) {
+        if(StringUtils.isNotBlank(getEntryDefectImproveVO.getAsc())){
+            if("totalNum".equals(getEntryDefectImproveVO.getAsc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getTotalNum)).collect(Collectors.toList());
+
+            }
+            if("handleNum".equals(getEntryDefectImproveVO.getAsc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getHandleNum)).collect(Collectors.toList());
+
+            }
+            if("improveleNum".equals(getEntryDefectImproveVO.getAsc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getImproveleNum)).collect(Collectors.toList());
+            }
+        }
+
+        if(StringUtils.isNotBlank(getEntryDefectImproveVO.getDesc())){
+            if("totalNum".equals(getEntryDefectImproveVO.getDesc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getTotalNum).reversed()).collect(Collectors.toList());
+
+            }
+            if("handleNum".equals(getEntryDefectImproveVO.getDesc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getHandleNum).reversed()).collect(Collectors.toList());
+
+            }
+            if("improveleNum".equals(getEntryDefectImproveVO.getDesc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getImproveleNum).reversed()).collect(Collectors.toList());
+            }
+        }
+        return getEntryDefectImproveDTOS;
+    }
+
     public static Map getEntryTotalMap(List<QcResultDetailInfo> qcResultDetailInfos, Map<String, Long> totalMap) {
         Set<String> totalSet = new HashSet<String>();
         for (QcResultDetailInfo qcResultDetailInfo : qcResultDetailInfos) {
@@ -437,8 +542,7 @@ public class DataAnalysisFacade {
         List<BehospitalInfoDTO> behospitalInfoDTOList = page(behospitalInfoDTOS, size, current);
         if (ListUtil.isNotEmpty(behospitalInfoDTOList)) {
             //排序操作
-        //    behospitalInfoDTOList = sortList(behospitalInfoDTOList, getEntryDefectImproveInnerVO.getAsc() != null ? getEntryDefectImproveInnerVO.getAsc() : getEntryDefectImproveInnerVO.getDesc() + " desc");
-        }
+            behospitalInfoDTOList =  getEntryDefectImproveInnerDTOS( behospitalInfoDTOList ,getEntryDefectImproveInnerVO); }
         page.setRecords(behospitalInfoDTOList);
         return page;
     }