Commit 2b8f377d81779cb91ef1ae704356644fbeee742f

Authored by litao@lymsh.com
1 parent d872ec2c49

改bug

Showing 2 changed files with 37 additions and 12 deletions

platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ 2b8f377
... ... @@ -262,10 +262,12 @@
262 262 ) b
263 263 where a.used_hospital_id = b.hospital_id and a.coupon_template_id = b.id and a.status = 2
264 264 <if test="startDate != null">
265   - and a.use_date >= #{startDate}
  265 +-- and a.use_date >= #{startDate}
  266 + and a.create_date >= #{startDate}
266 267 </if>
267 268 <if test="endDate != null">
268   - and a.use_date <![CDATA[ < ]]> #{endDate}
  269 +-- and a.use_date <![CDATA[ < ]]> #{endDate}
  270 + and a.create_date <![CDATA[ < ]]> #{endDate}
269 271 </if>
270 272 group by b.coupon_order, b.type, a.used_hospital_id
271 273 </select>
... ... @@ -388,7 +390,7 @@
388 390 <if test="endDate != null">
389 391 and a.create_date <![CDATA[ < ]]> #{endDate}
390 392 </if>
391   - order by a.use_date desc, a.user_id desc
  393 + order by a.user_id, a.use_date desc
392 394 <if test="needPage == true">
393 395 limit #{currentPage},#{pageSize}
394 396 </if>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 2b8f377
... ... @@ -705,6 +705,14 @@
705 705 return "";
706 706 }
707 707  
  708 + private List<String> getNeedUsedIds(List<Patients> patients, List<AntExChuModel> antExChuModels, List<AntenatalExaminationModel> antenatalExaminationModels, List<MaternalDeliverModel> maternalDeliverModels, List<DischargeAbstractMotherModel> deliverModels, List<PostReviewModel> postReviewModels) {
  709 + List<String> needUsedIds = new ArrayList<>();
  710 + for (Patients patient : patients) {
  711 + needUsedIds.add(patient.getId());
  712 + }
  713 + return needUsedIds;
  714 + }
  715 +
708 716 @Override
709 717 public BaseObjectResponse unUsed(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId) {
710 718 List<String> hospitalIds = getHospitalIds(userId, hospitalId);
711 719  
712 720  
713 721  
714 722  
715 723  
716 724  
... ... @@ -716,19 +724,34 @@
716 724 if(startDate != null && endDate != null) {
717 725 c.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1));
718 726 }
  727 +
719 728 List<Patients> patients = mongoTemplate.find(Query.query(c).with(new Sort(Sort.Direction.DESC, "created")), Patients.class);
  729 + List<String> parentIds = new ArrayList<>();
720 730 for (Patients patient : patients) {
721   - System.out.println(patient);
  731 + parentIds.add(patient.getId());
722 732 }
  733 + List<BabyModel> babyModels = mongoTemplate.find(Query.query(Criteria.where("yn").ne(0).and("parentId").in(parentIds)), BabyModel.class);
  734 + List<String> babyIds = new ArrayList<>();
  735 + for (BabyModel babyModel : babyModels) {
  736 + babyIds.add(babyModel.getId());
  737 + }
  738 + List<BabyCheckModel> babyCheckModels = mongoTemplate.find(Query.query(Criteria.where("yn").ne(0).and("buildId").in(babyModels)), BabyCheckModel.class);
  739 + List<AntExChuModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("yn").ne(0).and("parentId").in(parentIds)), AntExChuModel.class);
  740 + List<AntenatalExaminationModel> antenatalExaminationModels = mongoTemplate.find(Query.query(Criteria.where("yn").ne(0).and("parentId").in(parentIds)), AntenatalExaminationModel.class);
  741 + List<MaternalDeliverModel> maternalDeliverModels = mongoTemplate.find(Query.query(Criteria.where("yn").ne(0).and("parentId").in(parentIds)), MaternalDeliverModel.class);
  742 + List<DischargeAbstractMotherModel> deliverModels = mongoTemplate.find(Query.query(Criteria.where("yn").ne(0).and("patientId").in(parentIds)), DischargeAbstractMotherModel.class);
  743 + List<PostReviewModel> postReviewModels = mongoTemplate.find(Query.query(Criteria.where("yn").ne(0).and("parentId").in(parentIds)), PostReviewModel.class);
723 744  
724   - List<String> userIds = new ArrayList<>(); // 存储patientId
725   -// List<Map<String, String>> patientInfos = new ArrayList<>();
  745 + List<String> usedIds = getNeedUsedIds(patients, antExChuModels, antenatalExaminationModels, maternalDeliverModels, deliverModels, postReviewModels);
  746 +
  747 +
  748 +
  749 +
  750 + return null;
  751 +
  752 + /*List<String> userIds = new ArrayList<>(); // 存储patientId
726 753 for (Patients patient : patients) {
727   -// Map<String, String> temp = new HashMap<>();
728   -// temp.put("userId", patient.getPid());
729   -// temp.put("date", DateUtil.getyyyy_MM_dd(patient.getCreated()));
730 754 userIds.add(patient.getPid());
731   -// patientInfos.add(temp);
732 755 }
733 756 System.out.println(userIds);
734 757 // Map<String, Object> param = CollectionUtils.createMap("hospitalIds", hospitalIds, "userIds", userIds, "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "page", (page - 1) * limit, "limit", limit);
... ... @@ -771,7 +794,7 @@
771 794 continue;
772 795 }
773 796 String checkTime = getCheckTime((Integer) map.get("type"), (String) map.get("user_id"), patientId);
774   - if(StringUtils.isNotEmpty(checkTime)) { /** 如果没有做检查 那么返回的时间就是空字符串 这里等于做了检查但是没用券 */
  797 + if(StringUtils.isNotEmpty(checkTime)) { *//** 如果没有做检查 那么返回的时间就是空字符串 这里等于做了检查但是没用券 *//*
775 798 unUsedIds.add(p.getId());
776 799 unUsedCouponCount ++;
777 800 map.put("couponName", (couponReportMap.get(map.get("type") + "_" + map.get("coupon_order"))).toString()
... ... @@ -803,7 +826,7 @@
803 826 }
804 827 return RespBuilder.buildSuccess(new PageResult(restList.size(), page, limit, restList));
805 828 }
806   - return RespBuilder.buildSuccess(new PageResult(0, page, limit, null));
  829 + return RespBuilder.buildSuccess(new PageResult(0, page, limit, null));*/
807 830 }
808 831  
809 832