| | |
| | | @ApiParam(value = "报告结束时间") @RequestParam(required = false) Date bgendTime, |
| | | @ApiParam(value = "单位") @RequestParam(required = false) String dw) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Long> cusIds =null; |
| | | if (null != name) { |
| | | List<TjCustomer> customerList; |
| | | // List<TjCustomer> customerList; |
| | | LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.like(TjCustomer::getCusName, name); |
| | | if (StrUtil.isNotBlank(dw)){ |
| | | wqq.like(TjCustomer::getCompName,dw); |
| | | customerList = tjCustomerService.list(wqq); |
| | | }else { |
| | | customerList = tjCustomerService.list(wqq); |
| | | } |
| | | if (null != customerList && !customerList.isEmpty()) { |
| | | List<TjOrder> list = new ArrayList<>(); |
| | | for (TjCustomer customer : customerList) { |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | if (null != djbeginTime && null != djendTime) { |
| | | wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(djbeginTime), DateUtil.endOfDay(djendTime)); |
| | | } |
| | | wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | list.addAll(tjOrderService.list(wq)); |
| | | } |
| | | List<TjOrder> collect = null; |
| | | if (!list.isEmpty()) { |
| | | for (TjOrder order : list) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | // order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | // order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | order.setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | // order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | order.setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setCareer(tjCustomer.getCareer()); |
| | | order.setIdType(tjCustomer.getIdType()); |
| | | order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | | order.setTjCount(String.valueOf(tjCustomer.getCusNumber())); |
| | | if (null != tjCustomer.getCompName()) { |
| | | order.setDictCompName(tjCustomer.getCompName()); |
| | | } else { |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | | order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName()); |
| | | } |
| | | } |
| | | |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | | order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | } |
| | | if (null != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | if (null != dycs) order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | } |
| | | } |
| | | collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | if (null != collect) { |
| | | map.put("total", collect.size()); |
| | | } else { |
| | | map.put("total", 0); |
| | | } |
| | | map.put("list", collect); |
| | | return AjaxResult.success(map); |
| | | } |
| | | else { |
| | | if (StrUtil.isNotBlank(dw)){ |
| | | wqq = new LambdaQueryWrapper<>(); |
| | | wqq.like(TjCustomer::getCusName, name); |
| | | customerList = tjCustomerService.list(wqq); |
| | | LambdaQueryWrapper<DictComp> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.like(DictComp::getCnName,dw); |
| | | List<String> list = iDictCompService.list(wrapper).stream().map(DictComp::getCnName).collect(Collectors.toList()); |
| | | if (null != customerList && !customerList.isEmpty()) { |
| | | List<TjOrder> list1 = new ArrayList<>(); |
| | | for (TjCustomer customer : customerList) { |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | if (null != djbeginTime && null != djendTime) { |
| | | wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(djbeginTime), DateUtil.endOfDay(djendTime)); |
| | | wq.in(TjOrder::getFirmId, list); |
| | | } |
| | | wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | list1.addAll(tjOrderService.list(wq)); |
| | | } |
| | | List<TjOrder> collect = null; |
| | | if (!list1.isEmpty()) { |
| | | for (TjOrder order : list1) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | // order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | // order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | order.setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | // order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | order.setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setCareer(tjCustomer.getCareer()); |
| | | order.setIdType(tjCustomer.getIdType()); |
| | | order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | | order.setTjCount(String.valueOf(tjCustomer.getCusNumber())); |
| | | if (null != tjCustomer.getCompName()) { |
| | | order.setDictCompName(tjCustomer.getCompName()); |
| | | } else { |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | | order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName()); |
| | | } |
| | | } |
| | | |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | | order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | } |
| | | if (null != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | if (null != dycs) order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | } |
| | | } |
| | | collect = list1.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | if (null != collect) { |
| | | map.put("total", collect.size()); |
| | | } else { |
| | | map.put("total", 0); |
| | | } |
| | | map.put("list", collect); |
| | | return AjaxResult.success(map); |
| | | } |
| | | } |
| | | } |
| | | cusIds = tjCustomerService.list(wqq).stream().map(TjCustomer::getCusId).collect(Collectors.toList()); |
| | | // if (StrUtil.isNotBlank(dw)){ |
| | | // wqq.like(TjCustomer::getCompName,dw); |
| | | // customerList = tjCustomerService.list(wqq); |
| | | // }else { |
| | | // customerList = tjCustomerService.list(wqq); |
| | | // } |
| | | // if (null != customerList && !customerList.isEmpty()) { |
| | | // List<TjOrder> list = new ArrayList<>(); |
| | | // for (TjCustomer customer : customerList) { |
| | | // LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | // if (null != djbeginTime && null != djendTime) { |
| | | // wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(djbeginTime), DateUtil.endOfDay(djendTime)); |
| | | // } |
| | | // wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | // list.addAll(tjOrderService.list(wq)); |
| | | // } |
| | | // List<TjOrder> collect = null; |
| | | // if (!list.isEmpty()) { |
| | | // for (TjOrder order : list) { |
| | | // TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | // if (null != tjCustomer) { |
| | | //// order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | // order.setTjCustomerName(tjCustomer.getCusName()); |
| | | //// order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | // order.setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | //// order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | // order.setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | // order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | // order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | // order.setCareer(tjCustomer.getCareer()); |
| | | // order.setIdType(tjCustomer.getIdType()); |
| | | // order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | | // order.setTjCount(String.valueOf(tjCustomer.getCusNumber())); |
| | | // if (null != tjCustomer.getCompName()) { |
| | | // order.setDictCompName(tjCustomer.getCompName()); |
| | | // } else { |
| | | // String firmId = order.getFirmId(); |
| | | // if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | | // order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName()); |
| | | // } |
| | | // } |
| | | // |
| | | // if (null != order.getPacId()) { |
| | | // if (null != tjPackageService.getById(order.getPacId())) { |
| | | // order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | // } |
| | | // if (null != dwDeptService.getById(order.getPacId())) { |
| | | // order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | // } |
| | | // } |
| | | // TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | // if (null != dycs) order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | // } |
| | | // } |
| | | // collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | // } |
| | | // if (null != collect) { |
| | | // map.put("total", collect.size()); |
| | | // } else { |
| | | // map.put("total", 0); |
| | | // } |
| | | // map.put("list", collect); |
| | | // return AjaxResult.success(map); |
| | | // } |
| | | // else { |
| | | // if (StrUtil.isNotBlank(dw)){ |
| | | // wqq = new LambdaQueryWrapper<>(); |
| | | // wqq.like(TjCustomer::getCusName, name); |
| | | // customerList = tjCustomerService.list(wqq); |
| | | // LambdaQueryWrapper<DictComp> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.like(DictComp::getCnName,dw); |
| | | // List<String> list = iDictCompService.list(wrapper).stream().map(DictComp::getCnName).collect(Collectors.toList()); |
| | | // if (null != customerList && !customerList.isEmpty()) { |
| | | // List<TjOrder> list1 = new ArrayList<>(); |
| | | // for (TjCustomer customer : customerList) { |
| | | // LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | // if (null != djbeginTime && null != djendTime) { |
| | | // wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(djbeginTime), DateUtil.endOfDay(djendTime)); |
| | | // wq.in(TjOrder::getFirmId, list); |
| | | // } |
| | | // wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | // list1.addAll(tjOrderService.list(wq)); |
| | | // } |
| | | // List<TjOrder> collect = null; |
| | | // if (!list1.isEmpty()) { |
| | | // for (TjOrder order : list1) { |
| | | // TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | // if (null != tjCustomer) { |
| | | //// order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | // order.setTjCustomerName(tjCustomer.getCusName()); |
| | | //// order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | // order.setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | //// order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | // order.setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | // order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | // order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | // order.setCareer(tjCustomer.getCareer()); |
| | | // order.setIdType(tjCustomer.getIdType()); |
| | | // order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | | // order.setTjCount(String.valueOf(tjCustomer.getCusNumber())); |
| | | // if (null != tjCustomer.getCompName()) { |
| | | // order.setDictCompName(tjCustomer.getCompName()); |
| | | // } else { |
| | | // String firmId = order.getFirmId(); |
| | | // if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | | // order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName()); |
| | | // } |
| | | // } |
| | | // |
| | | // if (null != order.getPacId()) { |
| | | // if (null != tjPackageService.getById(order.getPacId())) { |
| | | // order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | // } |
| | | // if (null != dwDeptService.getById(order.getPacId())) { |
| | | // order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | // } |
| | | // } |
| | | // TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | // if (null != dycs) order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | // } |
| | | // } |
| | | // collect = list1.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | // } |
| | | // if (null != collect) { |
| | | // map.put("total", collect.size()); |
| | | // } else { |
| | | // map.put("total", 0); |
| | | // } |
| | | // map.put("list", collect); |
| | | // return AjaxResult.success(map); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | } |
| | | Page<TjOrder> page1 = new Page<>(pageNum, pageSize); |
| | |
| | | } |
| | | |
| | | if (StrUtil.isNotBlank(dw)){ |
| | | LambdaQueryWrapper<DictComp> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.like(DictComp::getCnName,dw); |
| | | List<String> list = iDictCompService.list(wrapper).stream().map(DictComp::getDrugManufacturerId).collect(Collectors.toList()); |
| | | wq.in(TjOrder::getFirmId,list); |
| | | wq.like(TjOrder::getFirmName,dw); |
| | | } |
| | | |
| | | if(null !=cusIds && !cusIds.isEmpty()){ |
| | | wq.in(TjOrder::getUserId, cusIds); |
| | | } |
| | | |
| | | // if (StrUtil.isNotBlank(dw)){ |
| | | // LambdaQueryWrapper<DictComp> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.like(DictComp::getCnName,dw); |
| | | // List<String> list = iDictCompService.list(wrapper).stream().map(DictComp::getDrugManufacturerId).collect(Collectors.toList()); |
| | | // wq.in(TjOrder::getFirmId,list); |
| | | // } |
| | | |
| | | wq.orderByDesc(TjOrder::getCreateTime); |
| | | Page<TjOrder> page2 = tjOrderService.page(page1, wq); |
| | |
| | | @ApiParam(value = "报告开始时间") @RequestParam(required = false) String djbeginTime, |
| | | @ApiParam(value = "报告结束时间") @RequestParam(required = false) String djendTime) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Long> cusIds =null; |
| | | if (StringUtil.isNotBlank(name)) { |
| | | LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.like(TjCustomer::getCusName, name); |
| | | List<TjCustomer> customerList = tjCustomerService.list(wqq); |
| | | if (null != customerList && !customerList.isEmpty()) { |
| | | List<TjOrder> list = new ArrayList<>(); |
| | | for (TjCustomer customer : customerList) { |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | if (dyzt == 0) { |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); |
| | | } else { |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | } |
| | | list.addAll(tjOrderService.list(wq)); |
| | | } |
| | | List<TjOrder> collect = null; |
| | | if (!list.isEmpty()) { |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId()); |
| | | if (null == tjCustomer) { |
| | | list.remove(list.get(i)); |
| | | continue; |
| | | } |
| | | list.get(i).setTjCustomerSex(tjCustomer.getCusSex()); |
| | | list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | list.get(i).setTjCustomerName(tjCustomer.getCusName()); |
| | | list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | |
| | | if (null != tjCustomer.getCompName()) { |
| | | list.get(i).setDictCompName(tjCustomer.getCompName()); |
| | | } else { |
| | | String firmId = list.get(i).getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) { |
| | | list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName()); |
| | | } |
| | | } |
| | | |
| | | if (null != list.get(i).getPacId()) { |
| | | if (null != tjPackageService.getById(list.get(i).getPacId())) { |
| | | list.get(i).setPacName(tjPackageService.getById(list.get(i).getPacId()).getPacName()); |
| | | } |
| | | if (null != dwDeptService.getById(list.get(i).getPacId())) { |
| | | list.get(i).setPacName(dwDeptService.getById(list.get(i).getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | } |
| | | collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | if (null != collect) { |
| | | map.put("total", collect.size()); |
| | | } else { |
| | | map.put("total", 0); |
| | | } |
| | | if (collect == null) collect = new ArrayList<>(); |
| | | map.put("list", collect); |
| | | return AjaxResult.success(map); |
| | | } |
| | | cusIds = tjCustomerService.list(wqq).stream().map(TjCustomer::getCusId).collect(Collectors.toList()); |
| | | // if (null != customerList && !customerList.isEmpty()) { |
| | | // List<TjOrder> list = new ArrayList<>(); |
| | | // for (TjCustomer customer : customerList) { |
| | | // LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | // wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | // if (dyzt == 0) { |
| | | // wq.isNull(TjOrder::getPrintLastTime); |
| | | // wq.eq(TjOrder::getHeshouStatus, 1); |
| | | // } else { |
| | | // wq.isNotNull(TjOrder::getPrintLastTime); |
| | | // } |
| | | // list.addAll(tjOrderService.list(wq)); |
| | | // } |
| | | // List<TjOrder> collect = null; |
| | | // if (!list.isEmpty()) { |
| | | // |
| | | // for (int i = 0; i < list.size(); i++) { |
| | | // TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId()); |
| | | // if (null == tjCustomer) { |
| | | // list.remove(list.get(i)); |
| | | // continue; |
| | | // } |
| | | // list.get(i).setTjCustomerSex(tjCustomer.getCusSex()); |
| | | // list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | // list.get(i).setTjCustomerName(tjCustomer.getCusName()); |
| | | // list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | // list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | // |
| | | // if (null != tjCustomer.getCompName()) { |
| | | // list.get(i).setDictCompName(tjCustomer.getCompName()); |
| | | // } else { |
| | | // String firmId = list.get(i).getFirmId(); |
| | | // if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) { |
| | | // list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName()); |
| | | // } |
| | | // } |
| | | // |
| | | // if (null != list.get(i).getPacId()) { |
| | | // if (null != tjPackageService.getById(list.get(i).getPacId())) { |
| | | // list.get(i).setPacName(tjPackageService.getById(list.get(i).getPacId()).getPacName()); |
| | | // } |
| | | // if (null != dwDeptService.getById(list.get(i).getPacId())) { |
| | | // list.get(i).setPacName(dwDeptService.getById(list.get(i).getPacId()).getDwDeptName()); |
| | | // } |
| | | // } |
| | | // } |
| | | // collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | // } |
| | | // if (null != collect) { |
| | | // map.put("total", collect.size()); |
| | | // } else { |
| | | // map.put("total", 0); |
| | | // } |
| | | // if (collect == null) collect = new ArrayList<>(); |
| | | // map.put("list", collect); |
| | | // return AjaxResult.success(map); |
| | | // } |
| | | |
| | | } |
| | | if (StringUtil.isNotBlank(dw)) { |
| | | LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.like(TjCustomer::getCompName, dw); |
| | | List<TjCustomer> customerList = tjCustomerService.list(wqq); |
| | | List<TjOrder> list = new ArrayList<>(); |
| | | if (null != customerList && !customerList.isEmpty()) { |
| | | for (TjCustomer customer : customerList) { |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | if (dyzt == 0) { |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); |
| | | } else { |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | } |
| | | list.addAll(tjOrderService.list(wq)); |
| | | } |
| | | } |
| | | List<String> dwIds = iDictCompService.getdwIdByDwName(dw); |
| | | |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | wq.in(TjOrder::getFirmId, dwIds); |
| | | list.addAll(tjOrderService.list(wq)); |
| | | List<TjOrder> collect = null; |
| | | if (!list.isEmpty()) { |
| | | List<TjOrder> orders = list.stream().distinct().collect(Collectors.toList()); |
| | | for (int i = 0; i < orders.size(); i++) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId()); |
| | | if (null == tjCustomer) { |
| | | list.remove(list.get(i)); |
| | | continue; |
| | | } |
| | | list.get(i).setTjCustomerSex(tjCustomer.getCusSex()); |
| | | list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | list.get(i).setTjCustomerName(tjCustomer.getCusName()); |
| | | list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | |
| | | if (null != tjCustomer.getCompName()) { |
| | | list.get(i).setDictCompName(tjCustomer.getCompName()); |
| | | } else { |
| | | String firmId = list.get(i).getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) { |
| | | list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName()); |
| | | } |
| | | } |
| | | |
| | | if (null != list.get(i).getPacId()) { |
| | | if (null != tjPackageService.getById(list.get(i).getPacId())) { |
| | | list.get(i).setPacName(tjPackageService.getById(list.get(i).getPacId()).getPacName()); |
| | | } |
| | | if (null != dwDeptService.getById(list.get(i).getPacId())) { |
| | | list.get(i).setPacName(dwDeptService.getById(list.get(i).getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | } |
| | | collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | if (null != collect) { |
| | | map.put("total", collect.size()); |
| | | } else { |
| | | map.put("total", 0); |
| | | } |
| | | map.put("list", collect); |
| | | return AjaxResult.success(map); |
| | | // if (StringUtil.isNotBlank(dw)) { |
| | | // LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>(); |
| | | // wqq.like(TjCustomer::getCompName, dw); |
| | | // List<TjCustomer> customerList = tjCustomerService.list(wqq); |
| | | // List<TjOrder> list = new ArrayList<>(); |
| | | // if (null != customerList && !customerList.isEmpty()) { |
| | | // for (TjCustomer customer : customerList) { |
| | | // LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | // wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | // if (dyzt == 0) { |
| | | // wq.isNull(TjOrder::getPrintLastTime); |
| | | // wq.eq(TjOrder::getHeshouStatus, 1); |
| | | // } else { |
| | | // wq.isNotNull(TjOrder::getPrintLastTime); |
| | | // } |
| | | // list.addAll(tjOrderService.list(wq)); |
| | | // } |
| | | // } |
| | | // List<String> dwIds = iDictCompService.getdwIdByDwName(dw); |
| | | // |
| | | // LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | // wq.in(TjOrder::getFirmId, dwIds); |
| | | // list.addAll(tjOrderService.list(wq)); |
| | | // List<TjOrder> collect = null; |
| | | // if (!list.isEmpty()) { |
| | | // List<TjOrder> orders = list.stream().distinct().collect(Collectors.toList()); |
| | | // for (int i = 0; i < orders.size(); i++) { |
| | | // TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId()); |
| | | // if (null == tjCustomer) { |
| | | // list.remove(list.get(i)); |
| | | // continue; |
| | | // } |
| | | // list.get(i).setTjCustomerSex(tjCustomer.getCusSex()); |
| | | // list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | // list.get(i).setTjCustomerName(tjCustomer.getCusName()); |
| | | // list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | // list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | // |
| | | // if (null != tjCustomer.getCompName()) { |
| | | // list.get(i).setDictCompName(tjCustomer.getCompName()); |
| | | // } else { |
| | | // String firmId = list.get(i).getFirmId(); |
| | | // if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) { |
| | | // list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName()); |
| | | // } |
| | | // } |
| | | // |
| | | // if (null != list.get(i).getPacId()) { |
| | | // if (null != tjPackageService.getById(list.get(i).getPacId())) { |
| | | // list.get(i).setPacName(tjPackageService.getById(list.get(i).getPacId()).getPacName()); |
| | | // } |
| | | // if (null != dwDeptService.getById(list.get(i).getPacId())) { |
| | | // list.get(i).setPacName(dwDeptService.getById(list.get(i).getPacId()).getDwDeptName()); |
| | | // } |
| | | // } |
| | | // } |
| | | // collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | // } |
| | | // if (null != collect) { |
| | | // map.put("total", collect.size()); |
| | | // } else { |
| | | // map.put("total", 0); |
| | | // } |
| | | // map.put("list", collect); |
| | | // return AjaxResult.success(map); |
| | | // |
| | | // |
| | | // } |
| | | |
| | | |
| | | } |
| | | Page<TjOrder> page1 = new Page<>(pageNum, pageSize); |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | if (dyzt == 0) { |
| | |
| | | if (null != tjNum) { |
| | | wq.like(TjOrder::getTjNumber, tjNum); |
| | | } |
| | | if (StringUtil.isNotBlank(dw)){ |
| | | wq.like(TjOrder::getFirmName, dw); |
| | | } |
| | | if(null !=cusIds && !cusIds.isEmpty()){ |
| | | wq.in(TjOrder::getUserId, cusIds); |
| | | } |
| | | wq.orderByDesc(TjOrder::getCreateTime); |
| | | Page<TjOrder> page2 = tjOrderService.page(page1, wq); |
| | | List<TjOrder> list = page2.getRecords(); |