List<OutFeeListMidDO> list = outFeeListMidDAO.selectList(new QueryWrapper<OutFeeListMidDO>().select("sum( DET_ITEM_FEE_SUMAMT ) as detItemFeeSumamt",
"sum( PRESELFPAY_AMT ) AS preselfpayAmt", "sum( FULAMT_OWNPAY_AMT ) AS fulamtOwnpayAmt", "MED_CHRGITM_TYPE AS medChrgitmType")
.eq("vali_flag", "1").eq("mdtrt_id", medicalId).groupBy("MED_CHRGITM_TYPE"));
String str = "01|02|03|04|05|06|07|08|09|10|11|12|13";
List<OutFeeListMidDO> mathList = new ArrayList<>();
OutFeeListMidDO dto = new OutFeeListMidDO();
dto.setDetItemFeeSumamt(BigDecimal.ZERO);
dto.setPreselfpayAmt(BigDecimal.ZERO);
dto.setFulamtOwnpayAmt(BigDecimal.ZERO);
for (OutFeeListMidDO feeListMidDO : list) {
if(feeListMidDO.getMedChrgitmType().matches(str)){
mathList.add(feeListMidDO);
}else{
dto.setMedChrgitmType("14");
dto.setDetItemFeeSumamt(dto.getDetItemFeeSumamt().add(
NumberUtil.null2Zero(feeListMidDO.getDetItemFeeSumamt())));
dto.setPreselfpayAmt(dto.getPreselfpayAmt().add(
NumberUtil.null2Zero(feeListMidDO.getPreselfpayAmt())));
dto.setFulamtOwnpayAmt(dto.getFulamtOwnpayAmt().add(
NumberUtil.null2Zero(feeListMidDO.getFulamtOwnpayAmt())));
}
}
mathList.add(dto);
return mathList;
请问有没有网友,这个for循环用java8的特性一次性处理完??我们领导说这个三行代码key解决。