|
@@ -18,10 +18,12 @@ import thyyxxk.webserver.utils.FilterUtil;
|
|
|
import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @ClassName YbStatService
|
|
@@ -1281,4 +1283,97 @@ public class YbStatService {
|
|
|
return ResultVoUtil.success(siSetlInfoList);
|
|
|
}
|
|
|
|
|
|
+ public ResultVo<List<Map<String, Object>>> selectBarChangeData(YbStatDto dto){
|
|
|
+ String beginTime = dto.getStartTime();
|
|
|
+ String endTime = DateUtil.getMonthEndtime(dto.getEndTime());
|
|
|
+ // 不限制查询险种类型
|
|
|
+ String setlType = dto.getSetlType();
|
|
|
+
|
|
|
+ List<Map<String, Object>> list = dao.selectBarChangeData(beginTime, endTime, setlType);
|
|
|
+
|
|
|
+ if (null == list || list.isEmpty()) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, List<Map<String, Object>>> map1 = list.stream().collect(Collectors.groupingBy(f -> String.valueOf(f.get("yf")), Collectors.toList()));
|
|
|
+ List<Map<String, Object>> result = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> list1 = new ArrayList<>();
|
|
|
+ for(Map.Entry<String, List<Map<String, Object>>> entry : map1.entrySet()){
|
|
|
+ List<Map<String, Object>> list2 = entry.getValue();
|
|
|
+ if(list2 == null && list2.size() < 1){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(result != null && result.size()< 1){
|
|
|
+ list1.addAll(list2);
|
|
|
+ result.addAll(list2);
|
|
|
+ } else {
|
|
|
+ List<Map<String, Object>> sl = new ArrayList<>();
|
|
|
+ for(Map<String, Object> m1 : list1){
|
|
|
+ Map<String, Object> m = new HashMap<>();
|
|
|
+ String medinsType1 = m1.get("medins_type") + "";
|
|
|
+ boolean flag = true;
|
|
|
+ for(Map<String, Object> m2 : list2){
|
|
|
+ String medinsType2 = m2.get("medins_type") + "";
|
|
|
+ if(medinsType1.equals(medinsType2)){
|
|
|
+ flag = false;
|
|
|
+ m.put("yf", entry.getKey());
|
|
|
+ m.put("medins_type", medinsType1);
|
|
|
+ m.put("psnCount", DecimalUtil.add(new BigDecimal(String.valueOf(m2.get("psnCount"))), new BigDecimal(String.valueOf(m1.get("psnCount")))));
|
|
|
+ m.put("inDays", DecimalUtil.add(new BigDecimal(String.valueOf(m2.get("inDays"))), new BigDecimal(String.valueOf(m1.get("inDays")))));
|
|
|
+ m.put("totalFee", DecimalUtil.add(new BigDecimal(String.valueOf(m2.get("totalFee"))), new BigDecimal(String.valueOf(m1.get("totalFee")))));
|
|
|
+ m.put("fundPooling", DecimalUtil.add(new BigDecimal(String.valueOf(m2.get("fundPooling"))), new BigDecimal(String.valueOf(m1.get("fundPooling")))));
|
|
|
+ m.put("bigIllFundPooling", DecimalUtil.add(new BigDecimal(String.valueOf(m2.get("bigIllFundPooling"))), new BigDecimal(String.valueOf(m1.get("bigIllFundPooling")))));
|
|
|
+ m.put("civilServiceFund", DecimalUtil.add(new BigDecimal(String.valueOf(m2.get("civilServiceFund"))), new BigDecimal(String.valueOf(m1.get("civilServiceFund")))));
|
|
|
+ m.put("otherFunds", DecimalUtil.add(new BigDecimal(String.valueOf(m2.get("otherFunds"))), new BigDecimal(String.valueOf(m1.get("otherFunds")))));
|
|
|
+ m.put("allFunds", DecimalUtil.add(new BigDecimal(String.valueOf(m2.get("allFunds"))), new BigDecimal(String.valueOf(m1.get("allFunds")))));
|
|
|
+ m.put("drugFee", DecimalUtil.add(new BigDecimal(String.valueOf(m2.get("drugFee"))), new BigDecimal(String.valueOf(m1.get("drugFee")))));
|
|
|
+ m.put("matFee", DecimalUtil.add(new BigDecimal(String.valueOf(m2.get("matFee"))), new BigDecimal(String.valueOf(m1.get("matFee")))));
|
|
|
+ m.put("otherFunds", DecimalUtil.add(new BigDecimal(String.valueOf(m2.get("otherFunds"))), new BigDecimal(String.valueOf(m1.get("otherFunds")))));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(flag){
|
|
|
+ m.put("yf", entry.getKey());
|
|
|
+ m.put("medins_type", medinsType1);
|
|
|
+ m.put("psnCount", m1.get("psnCount"));
|
|
|
+ m.put("inDays", m1.get("inDays"));
|
|
|
+ m.put("totalFee", m1.get("totalFee"));
|
|
|
+ m.put("fundPooling", m1.get("fundPooling"));
|
|
|
+ m.put("bigIllFundPooling", m1.get("bigIllFundPooling"));
|
|
|
+ m.put("civilServiceFund", m1.get("civilServiceFund"));
|
|
|
+ m.put("otherFunds", m1.get("otherFunds"));
|
|
|
+ m.put("allFunds", m1.get("allFunds"));
|
|
|
+ m.put("drugFee", m1.get("drugFee"));
|
|
|
+ m.put("matFee", m1.get("matFee"));
|
|
|
+ m.put("otherFunds", m1.get("otherFunds"));
|
|
|
+ }
|
|
|
+ sl.add(m);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下个月没有上个月的险种的数据,也需要添加到下个月展示
|
|
|
+ for(Map<String, Object> m2 : list2){
|
|
|
+ String medinsType2 = m2.get("medins_type") + "";
|
|
|
+ boolean flag = true;
|
|
|
+ for(Map<String, Object> m1 : sl){
|
|
|
+ String medinsType1 = m1.get("medins_type") + "";
|
|
|
+ if(medinsType2.equals(medinsType1)){
|
|
|
+ flag = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(flag){
|
|
|
+ sl.add(m2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.addAll(sl);
|
|
|
+ list1.clear();
|
|
|
+ list1.addAll(sl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultVoUtil.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
}
|