forked from kidgrow-microservices-platform

zhaoxiaohao
2020-06-16 bdc56ebc9534620766d787a1dacb4c962ea10797
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderRecordServiceImpl.java
@@ -26,6 +26,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
@@ -96,7 +97,7 @@
    }
    /**
     * 统计用户套餐使用情况
     * 统计用户所有套餐剩余
     * @param hospitalId
     * @param departmentId
     * @return
@@ -108,16 +109,25 @@
            Map<String,Object> selectMap=new HashMap<>();
            selectMap.put("hospitalId",hospitalId);
            List<ProductOrderJoinDetail>  productOrderDetailList=productOrderDetailService.findAllList(selectMap);
            Long userAICount=0l;
            if (productOrderDetailList.size()>0) {
                //
                //包含共享的数据
                List<ProductOrderJoinDetail> productOrderJoinDetailListShare=productOrderDetailList.stream().filter(f->f.getIsShare()).collect(Collectors.toList());
                //科室私有的数据
                List<ProductOrderJoinDetail> productOrderJoinDetailsListDep=productOrderDetailList.stream().filter((f->departmentId.equals(f.getDepartmentId())&&f.getIsShare()==false)).collect(Collectors.toList());
                //本医院可共享的读片总量
                Long shareCount=productOrderJoinDetailListShare.stream().collect(Collectors.summingLong(ProductOrderJoinDetail::getAilightCount));
                //本科室私有读片总量
                Long depCount=productOrderJoinDetailsListDep.stream().collect(Collectors.summingLong(ProductOrderJoinDetail::getAilightCount));
                //可用的总量
                userAICount=shareCount+depCount;
            }
            return null;
            return ResultBody.ok().data(userAICount);
        }
        else
        {
            return ResultBody.failed("医院和科室数据有误!");
        }
    }
    /**