Commit c540a3fbe10569520c0da2c718ae19c7cf90f541

Authored by yangfei

Merge remote-tracking branch 'origin/master'

Showing 1 changed file

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ c540a3f
... ... @@ -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,14 @@
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 + System.out.println(DateUtil.getyyyy_MM_dd_hms(p.getCreated()) + " >> " + DateUtil.getyyyy_MM_dd_hms(((Date) map.get("create_date"))));
  754 + if(p.getFmDate() != null && p.getFmDate().getTime() < ((Date) map.get("create_date")).getTime()) { // 如果手动终止妊娠了, 那么fmDate应该小于优惠券发放的时间
  755 + continue;
  756 + }
  757 + if(p.getCreated().getTime() > ((Date) map.get("create_date")).getTime()) { // 同一个产程中 patient的创建时间肯定小于优惠券的创建时间
  758 + continue;
  759 + }
  760 + String checkTime = getCheckTime((Integer) map.get("type"), (String) map.get("user_id"), patientId);
754 761 if(StringUtils.isNotEmpty(checkTime)) { /** 如果没有做检查 那么返回的时间就是空字符串 这里等于做了检查但是没用券 */
755 762 unUsedIds.add(p.getId());
756 763 unUsedCouponCount ++;
... ... @@ -895,7 +902,7 @@
895 902 * 过滤掉全部优惠券所对应的项目都没做的userid
896 903 * @param userIds
897 904 */
898   - private void doFilter(List<String> userIds, String hospitalId) {
  905 + /*private void doFilter(List<String> userIds, String hospitalId) {
899 906 if(CollectionUtils.isNotEmpty(userIds) && StringUtils.isNotEmpty(hospitalId)) {
900 907 List<Map<String, Object>> lists = couponMapper.findUserTypeInfo(CollectionUtils.createMap("userIds", userIds, "hospitalId", hospitalId));
901 908 if(CollectionUtils.isNotEmpty(lists)) {
... ... @@ -907,7 +914,7 @@
907 914 for (Map<String, Object> map : lists) {
908 915 Integer type = (Integer) map.get("type");
909 916 String userId = (String) map.get("user_id");
910   - String checkTime = getCheckTime(type, userId, (Date) map.get("create_date"));
  917 + String checkTime = getCheckTime(type, userId, (Date) map.get("create_date"), patientId);
911 918 if(!"".equals(checkTime)) { // 找到对应信息
912 919 temp.put(userId, false);
913 920 }
... ... @@ -919,7 +926,7 @@
919 926 }
920 927 }
921 928 }
922   - }
  929 + }*/
923 930  
924 931  
925 932 @Override
... ... @@ -1602,7 +1609,7 @@
1602 1609 checkDate = antenatal.getCheckDate();
1603 1610 username = findUserNameByPid(antenatal.getPid());
1604 1611 week = antenatal.getCurrentDueDate();
1605   - List<AntenatalExaminationModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(antenatal.getPid())).with(new Sort(Sort.Direction.ASC, "created")), AntenatalExaminationModel.class);
  1612 + List<AntenatalExaminationModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(antenatal.getPid()).and("parentId").is(antenatal.getParentId())).with(new Sort(Sort.Direction.ASC, "created")), AntenatalExaminationModel.class);
1606 1613  
1607 1614 id = antenatal.getId();
1608 1615 if(CollectionUtils.isNotEmpty(antExChuModels)) {