Commit 3494bc2aae0cd4dd5d5d7fae3c8198791091b9cd

Authored by litao@lymsh.com
1 parent 471ed12206

改bug

Showing 1 changed file with 18 additions and 15 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 3494bc2
... ... @@ -628,11 +628,11 @@
628 628 * 9=新生儿访视 lyms_newborn_visit
629 629 * 10=血红蛋白检查 lyms_babycheck
630 630 */
631   - private String getCheckTime(Integer type, String userId, Date createDate) {
632   - String parentId = null;
633   - List<Patients> patients = mongoTemplate.find(Query.query(Criteria.where("pid").is(userId)).with(new Sort(Sort.Direction.DESC, "created")), Patients.class);
  631 + private String getCheckTime(Integer type, String userId,String parentId) {
  632 +// String parentId = null;
  633 + /* List<Patients> patients = mongoTemplate.find(Query.query(Criteria.where("pid").is(userId)).with(new Sort(Sort.Direction.DESC, "created")), Patients.class);
634 634 for (Patients patient : patients) {
635   -// System.out.println(patient.getId() + " " + DateUtil.getyyyy_MM_dd_hms(patient.getCreated()));
  635 + System.out.println(patient.getId() + " " + DateUtil.getyyyy_MM_dd_hms(patient.getCreated()) + " >> " + DateUtil.getyyyy_MM_dd_hms(createDate));
636 636 if(patient.getCreated().getTime() <= createDate.getTime()) {
637 637 parentId = patient.getId();
638 638 if(type != 1 && type != 3) {
... ... @@ -645,7 +645,7 @@
645 645 }
646 646 if(StringUtils.isEmpty(parentId) && type != 8 && type != 10) {
647 647 return "";
648   - }
  648 + }*/
649 649 if(type == 2) {
650 650 AntExChuModel exChuModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(userId).and("parentId").is(parentId)).with(new Sort(Sort.Direction.DESC, "created")), AntExChuModel.class);
651 651 if(exChuModel != null) {
652 652  
653 653  
... ... @@ -708,14 +708,14 @@
708 708 System.out.println(patient);
709 709 }
710 710  
711   - List<String> userIds = new ArrayList<>();
712   - List<Map<String, String>> patientInfos = new ArrayList<>();
  711 + List<String> userIds = new ArrayList<>(); // 存储patientId
  712 +// List<Map<String, String>> patientInfos = new ArrayList<>();
713 713 for (Patients patient : patients) {
714   - Map<String, String> temp = new HashMap<>();
715   - temp.put("userId", patient.getPid());
716   - temp.put("date", DateUtil.getyyyy_MM_dd(patient.getCreated()));
  714 +// Map<String, String> temp = new HashMap<>();
  715 +// temp.put("userId", patient.getPid());
  716 +// temp.put("date", DateUtil.getyyyy_MM_dd(patient.getCreated()));
717 717 userIds.add(patient.getPid());
718   - patientInfos.add(temp);
  718 +// patientInfos.add(temp);
719 719 }
720 720 System.out.println(userIds);
721 721 // Map<String, Object> param = CollectionUtils.createMap("hospitalIds", hospitalIds, "userIds", userIds, "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "page", (page - 1) * limit, "limit", limit);
... ... @@ -750,7 +750,10 @@
750 750 for (Patients p : patients) {
751 751 if(p.getId().equals(patientId)) {
752 752 for (Map<String, Object> map : entry.getValue()) {
753   - String checkTime = getCheckTime((Integer) map.get("type"), (String) map.get("user_id"), (Date) map.get("create_date"));
  753 + if(p.getCreated().getTime() > ((Date) map.get("create_date")).getTime()) { // 同一个产程中 patient的创建时间肯定小于优惠券的创建时间
  754 + continue;
  755 + }
  756 + String checkTime = getCheckTime((Integer) map.get("type"), (String) map.get("user_id"), patientId);
754 757 if(StringUtils.isNotEmpty(checkTime)) { /** 如果没有做检查 那么返回的时间就是空字符串 这里等于做了检查但是没用券 */
755 758 unUsedIds.add(p.getId());
756 759 unUsedCouponCount ++;
... ... @@ -895,7 +898,7 @@
895 898 * 过滤掉全部优惠券所对应的项目都没做的userid
896 899 * @param userIds
897 900 */
898   - private void doFilter(List<String> userIds, String hospitalId) {
  901 + /*private void doFilter(List<String> userIds, String hospitalId) {
899 902 if(CollectionUtils.isNotEmpty(userIds) && StringUtils.isNotEmpty(hospitalId)) {
900 903 List<Map<String, Object>> lists = couponMapper.findUserTypeInfo(CollectionUtils.createMap("userIds", userIds, "hospitalId", hospitalId));
901 904 if(CollectionUtils.isNotEmpty(lists)) {
... ... @@ -907,7 +910,7 @@
907 910 for (Map<String, Object> map : lists) {
908 911 Integer type = (Integer) map.get("type");
909 912 String userId = (String) map.get("user_id");
910   - String checkTime = getCheckTime(type, userId, (Date) map.get("create_date"));
  913 + String checkTime = getCheckTime(type, userId, (Date) map.get("create_date"), patientId);
911 914 if(!"".equals(checkTime)) { // 找到对应信息
912 915 temp.put(userId, false);
913 916 }
... ... @@ -919,7 +922,7 @@
919 922 }
920 923 }
921 924 }
922   - }
  925 + }*/
923 926  
924 927  
925 928 @Override