| | |
| | | } |
| | | |
| | | /** |
| | | * 判定医院科室的套餐是否到期 以及到期时间 |
| | | * 判定医院科室的套餐是否到期 以及剩余的读片量 |
| | | * @param hospitalId |
| | | * @param departmentId |
| | | * @param diagnosticId |
| | | * @return |
| | | */ |
| | | public ResultBody<UserProductData> UserProductDetailData(Long hospitalId,Long departmentId,String diagnosticId) |
| | | @Override |
| | | public ResultBody<UserProductData> userProductDetailData(Long hospitalId,Long departmentId,String diagnosticId) |
| | | { |
| | | UserProductData userProductData=new UserProductData(); |
| | | userProductData.setEnd(true); |
| | | userProductData.setIsEnd(true); |
| | | userProductData.setRecordCount(0); |
| | | userProductData.setAilightCount(0); |
| | | userProductData.setLimitDays(0); |
| | | UserProductDetail userProductDetail = this.getUserProductDetail(hospitalId, departmentId); |
| | | if (userProductDetail != null) { |
| | | //合并集合 |
| | | userProductDetail.getProductOrderJoinDetailListShare().addAll(userProductDetail.getProductOrderJoinDetailsListDep()); |
| | | List<ProductOrderJoinDetail> productOrderJoinDetailList = userProductDetail.getProductOrderJoinDetailListShare(); |
| | | if (productOrderJoinDetailList.size() > 0) { |
| | | userProductData.setEnd(false); |
| | | userProductData.setIsEnd(false); |
| | | //合并后按id排序并筛除已用完的套餐 |
| | | List<ProductOrderJoinDetail> productOrderJoinDetailsNewList = productOrderJoinDetailList.stream().filter(f -> f.getAilightCount() >= 0).sorted(Comparator.comparing(ProductOrderJoinDetail::getProEndtime).reversed()).collect(Collectors.toList()); |
| | | userProductData.setMaxEndTime(productOrderJoinDetailsNewList.get(0).getProEndtime()); |
| | | List<ProductOrderJoinDetail> productOrderJoinDetailsNewList = productOrderJoinDetailList.stream().filter(f -> f.getAilightCount() >= 0).sorted(Comparator.comparing(ProductOrderJoinDetail::getProEndtime)).collect(Collectors.toList()); |
| | | for (int i = 0; i <productOrderJoinDetailsNewList.size(); i++) { |
| | | userProductData.setAilightCount(productOrderJoinDetailsNewList.get(i).getAilightCount()); |
| | | userProductData.setRecordCount(productOrderJoinDetailsNewList.get(i).getRecordCount()); |
| | | Double days=DateUtils.getDays(new Date(),productOrderJoinDetailsNewList.get(i).getProEndtime()); |
| | | if (i<productOrderJoinDetailsNewList.size()-1) { |
| | | //按照结束日期正序排序后,如果第二条的开始时间减去第一条的结束时间 差值大于0 说明套餐间有中断 则以当前这条套餐作为当前套餐的剩余天数 |
| | | Double daysTemp=DateUtils.getDays(productOrderJoinDetailsNewList.get(i).getProEndtime(), |
| | | productOrderJoinDetailsNewList.get(i+1).getProBegintime()); |
| | | if (daysTemp>0) { |
| | | userProductData.setLimitDays(Integer.valueOf(Double.valueOf(days).intValue())); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | userProductData.setLimitDays(Integer.valueOf(Double.valueOf(days).intValue())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //是否已经结束 |
| | | if (userProductData.isEnd()&& StringUtils.isNotBlank(diagnosticId)) { |
| | | if (userProductData.getIsEnd()&& StringUtils.isNotBlank(diagnosticId)) { |
| | | //写入redis中,防止扣非后不能生成报告 |
| | | redisUtils.lSet(CommonConstant.SAAS_LAST_SERVER+diagnosticId,diagnosticId); |
| | | } |
| | |
| | | public List<OrderChartVo> proCountChart() { |
| | | return baseMapper.proCountChart(); |
| | | } |
| | | @Override |
| | | public int getUserdProduct(Long hospitalId, Long departmentId) { |
| | | return baseMapper.getUserdProduct(hospitalId,departmentId); |
| | | } |
| | | /** |
| | | *获取该科室下的所有的套餐信息 |
| | | * @param params |
| | |
| | | List<ProductOrderDetail> list = |
| | | baseMapper.departmentProductDetail(page, Long.parseLong(params.get("hospitalId").toString()),Long.parseLong(params.get("departmentId").toString())); |
| | | return PageResult.<ProductOrderDetail>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<ProductEndVo> productEndList(Map<String, Object> params) { |
| | | Page<ProductEndVo> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); |
| | | List<ProductEndVo> list = |
| | | baseMapper.productEndList(page,MapUtils.getIntValue(params,"monthPar"),MapUtils.getIntValue(params,"aiCountPar")); |
| | | return PageResult.<ProductEndVo>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | } |
| | | |
| | | /** |
| | |
| | | List<GroupProductDetail> list = baseMapper.groupProductDetail(page,params); |
| | | return PageResult.<GroupProductDetail>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | } |
| | | |
| | | /** |
| | | * 根据ProductOrderDetail对象当做查询条件进行查询 |
| | | * @param productOrderDetail |