| | |
| | | package com.kidgrow.oprationcenter.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.common.constant.CommonConstant; |
| | | import com.kidgrow.common.model.*; |
| | |
| | | import com.kidgrow.oprationcenter.model.ConsumptionRecord; |
| | | import com.kidgrow.oprationcenter.model.ProductOrder; |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.oprationcenter.model.SysProduct; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderDetailService; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderService; |
| | | import com.kidgrow.oprationcenter.service.ISysProductService; |
| | | import com.kidgrow.oprationcenter.vo.*; |
| | | import com.kidgrow.redis.util.RedisUtils; |
| | | import com.kidgrow.usercenter.feign.SysDoctorService; |
| | |
| | | @Autowired |
| | | private IProductOrderService iProductOrderService; |
| | | @Autowired |
| | | private ISysProductService productService; |
| | | @Autowired |
| | | private RedisUtils redisUtils; |
| | | /** |
| | | * 列表 |
| | |
| | | public PageResult<ProductOrderDetail> findList(Map<String, Object> params){ |
| | | Page<ProductOrderDetail> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); |
| | | List<ProductOrderDetail> list = baseMapper.findList(page, params); |
| | | for (ProductOrderDetail productOrderDetail : list) { |
| | | if(productOrderDetail.getOrderAilightCount()==null){ |
| | | SysProduct byId = productService.getById(productOrderDetail.getProId()); |
| | | if(byId!=null){ |
| | | productOrderDetail.setOrderAilightCount(byId.getAilightCount()); |
| | | productOrderDetail.setOrderRecordCount(byId.getRecordCount()); |
| | | } |
| | | } |
| | | } |
| | | return PageResult.<ProductOrderDetail>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | } |
| | | /** |
| | |
| | | public List<OrderChartVo> proCountChart() { |
| | | return baseMapper.proCountChart(); |
| | | } |
| | | @Override |
| | | public int getUserdProduct(Long hospitalId, Long departmentId) { |
| | | return baseMapper.getUserdProduct(hospitalId,departmentId); |
| | | } |
| | | /** |
| | | *获取该科室下的所有的套餐信息 |
| | | * @param params |
| | |
| | | { |
| | | //查询当前医院正在使用的套餐 |
| | | Map<String, Object> selectMap = new HashMap<>(); |
| | | selectMap.put("hospitalId", hospitalId); |
| | | List<ProductOrderJoinDetail> productOrderDetailList = this.findAllList(selectMap); |
| | | if (productOrderDetailList.size() > 0) { |
| | | UserProductDetail userProductDetail=new UserProductDetail(); |
| | | //包含共享的数据 |
| | | userProductDetail.setProductOrderJoinDetailListShare(productOrderDetailList.stream().filter(f -> f.getIsShare()).collect(Collectors.toList())); |
| | | //科室私有的数据 |
| | | userProductDetail.setProductOrderJoinDetailsListDep(productOrderDetailList.stream().filter((f -> departmentId.equals(f.getDepartmentId()) && !f.getIsShare())).collect(Collectors.toList())); |
| | | return userProductDetail; |
| | | selectMap.put("hospital_id", hospitalId); |
| | | selectMap.put("is_del",0); |
| | | selectMap.put("enabled",1); |
| | | List<ProductOrder> productOrders = iProductOrderService.listByMap(selectMap); |
| | | if(productOrders!=null&&productOrders.size()>0){ |
| | | // List<ProductOrderJoinDetail> productOrderDetailList = this.findAllList(selectMap); |
| | | QueryWrapper queryWrapper=new QueryWrapper(); |
| | | queryWrapper.eq("is_del",0); |
| | | queryWrapper.eq("enabled",1); |
| | | queryWrapper.in("order_id",productOrders.stream().map(ProductOrder::getId).collect(Collectors.toList())); |
| | | List<ProductOrderJoinDetail> productOrderDetailList = this.baseMapper.selectList(queryWrapper); |
| | | if (productOrderDetailList.size() > 0) { |
| | | UserProductDetail userProductDetail=new UserProductDetail(); |
| | | //包含共享的数据 |
| | | userProductDetail.setProductOrderJoinDetailListShare(productOrderDetailList.stream().filter(f -> f.getIsShare()).collect(Collectors.toList())); |
| | | //科室私有的数据 |
| | | userProductDetail.setProductOrderJoinDetailsListDep(productOrderDetailList.stream().filter((f -> departmentId.equals(f.getDepartmentId()) && !f.getIsShare())).collect(Collectors.toList())); |
| | | return userProductDetail; |
| | | } |
| | | } |
| | | return null; |
| | | } |