| | |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.hosp.vodomain.AddNewReservationConfirm; |
| | | import com.ltkj.hosp.vodomain.PieChartVo; |
| | | import com.ltkj.hosp.vodomain.QjDomainVo; |
| | | import com.ltkj.mall.mallOrderUtils.TjConstants; |
| | | import com.ltkj.system.service.ISysUserService; |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Async("async") |
| | | public void getLineChart() { |
| | | redisCache.setCacheObject("getLineChart",getLineCharts()); |
| | | } |
| | | |
| | | @Override |
| | | @Async("async") |
| | | public void getPieChart() { |
| | | redisCache.setCacheObject("getPieChart",getPieCharts()); |
| | | } |
| | | |
| | | //首页饼状图登记人数接口 |
| | | private AjaxResult getPieCharts() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | | //获取体检登记数 |
| | | LambdaQueryWrapper<TjOrder> wq0 = new LambdaQueryWrapper<>(); |
| | | wq0.between(TjOrder::getCreateTime, DateUtil.lastMonth(), DateUtil.now()); |
| | | List<TjOrder> orderCountList = orderService.list(wq0); |
| | | if (null != orderCountList && orderCountList.size() > 0) { |
| | | List<PieChartVo> pieChartVoList = getTjorderCountMap(orderCountList); |
| | | map.put("tjdj", pieChartVoList); |
| | | } else { |
| | | map.put("tjdj", 0); |
| | | } |
| | | //获取体检异常数 |
| | | LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.between(TjOrder::getFinishTime, DateUtil.lastMonth(), DateUtil.now()); |
| | | wq1.eq(TjOrder::getCheckStatus, 1); |
| | | List<TjOrder> orderAbnormalCountList = orderService.list(wq1); |
| | | if (null != orderAbnormalCountList && orderAbnormalCountList.size() > 0) { |
| | | List<PieChartVo> pieChartVoList = getTjorderAbnormalCountMap(orderAbnormalCountList); |
| | | map.put("tjyc", pieChartVoList); |
| | | } else { |
| | | map.put("tjyc", 0); |
| | | } |
| | | |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | //首页折线图数据 |
| | | private AjaxResult getLineCharts() { |
| | | List<Map<Object, Object>> line = orderService.getLine(); |
| | | Collections.reverse(line); |
| | | return AjaxResult.success("折线图数据", line); |
| | | } |
| | | |
| | | |
| | | //获取体检登记数 |
| | | private List<PieChartVo> getTjorderCountMap(List<TjOrder> orderList) { |
| | | int a = 0; |
| | | int b = 0; |
| | | int c = 0; |
| | | int d = 0; |
| | | int e = 0; |
| | | Map<String, Object> map = null; |
| | | for (TjOrder tjOrder : orderList) { |
| | | map = new HashMap<>(); |
| | | TjCustomer customer = tjCustomerService.getById(tjOrder.getUserId()); |
| | | if (null != customer) { |
| | | int age = DateUtil.ageOfNow(customer.getCusBrithday()); |
| | | if (age >= 0 && age <= 3) { |
| | | a += 1; |
| | | } else if (age > 3 && age <= 16) { |
| | | b += 1; |
| | | } else if (age > 16 && age <= 40) { |
| | | c += 1; |
| | | } else if (age > 40 && age <= 60) { |
| | | d += 1; |
| | | } else { |
| | | e += 1; |
| | | } |
| | | } |
| | | map.put("0-3岁", a); |
| | | map.put("3-16岁", b); |
| | | map.put("16-40岁", c); |
| | | map.put("40-60岁", d); |
| | | map.put("60岁以上", e); |
| | | } |
| | | List<PieChartVo> pieChartVoList = new ArrayList<>(); |
| | | assert map != null; |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | PieChartVo pieChartVo = new PieChartVo(); |
| | | pieChartVo.setName(entry.getKey()); |
| | | pieChartVo.setCount((Integer) entry.getValue()); |
| | | pieChartVoList.add(pieChartVo); |
| | | } |
| | | return pieChartVoList; |
| | | } |
| | | |
| | | //获取体检异常数 |
| | | private List<PieChartVo> getTjorderAbnormalCountMap(List<TjOrder> orderList) { |
| | | int a = 0; |
| | | int b = 0; |
| | | int c = 0; |
| | | int d = 0; |
| | | int e = 0; |
| | | Map<String, Object> map = null; |
| | | for (TjOrder tjOrder : orderList) { |
| | | map = new HashMap<>(); |
| | | LambdaQueryWrapper<TjOrderDetail> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjOrderDetail::getOrderId, tjOrder.getOrderId()); |
| | | wq.eq(TjOrderDetail::getExceptionDesc, 1); |
| | | List<TjOrderDetail> list = tjOrderDetailService.list(wq); |
| | | if (null != list && list.size() > 0) { |
| | | TjCustomer customer = tjCustomerService.getById(tjOrder.getUserId()); |
| | | if (null != customer) { |
| | | int age = DateUtil.ageOfNow(customer.getCusBrithday()); |
| | | if (age >= 0 && age <= 3) { |
| | | a += 1; |
| | | } else if (age > 3 && age <= 16) { |
| | | b += 1; |
| | | } else if (age > 16 && age <= 40) { |
| | | c += 1; |
| | | } else if (age > 40 && age <= 60) { |
| | | d += 1; |
| | | } else { |
| | | e += 1; |
| | | } |
| | | } |
| | | map.put("0-3岁", a); |
| | | map.put("3-16岁", b); |
| | | map.put("16-40岁", c); |
| | | map.put("40-60岁", d); |
| | | map.put("60岁以上", e); |
| | | } |
| | | } |
| | | List<PieChartVo> pieChartVoList = new ArrayList<>(); |
| | | assert map != null; |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | PieChartVo pieChartVo = new PieChartVo(); |
| | | pieChartVo.setName(entry.getKey()); |
| | | pieChartVo.setCount((Integer) entry.getValue()); |
| | | pieChartVoList.add(pieChartVo); |
| | | } |
| | | return pieChartVoList; |
| | | } |
| | | |
| | | private List<DictSfxm> getDictSfxm() { |
| | | List<DictSfxm> dictSfxms = dictSfxmService.getYjDictSfxmList(); |
| | | if (null != dictSfxms && dictSfxms.size() > 0) { |