Commit 00e9e207b83a05f7e07b52cdcaf31a1ea73ba3dc

Authored by litao@lymsh.com
1 parent 521b41dc6f

123

Showing 3 changed files with 40 additions and 4 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java View file @ 00e9e20
... ... @@ -88,9 +88,9 @@
88 88  
89 89 @Override
90 90 public BaseResponse list(String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit, Integer userId) {
91   - List<String> hospitalIds = accessPermissionFacade.getCurrentUserHospPermissions(userId);
92   - Criteria criteria = Criteria.where("yn").ne("0").and("hospitalId").in(hospitalIds);
93   - Criteria pCriteria = Criteria.where("yn").ne("0").and("hospitalId").in(hospitalIds);
  91 +// List<String> hospitalIds = accessPermissionFacade.getCurrentUserHospPermissions(userId);
  92 + Criteria criteria = Criteria.where("yn").is(1); //.and("hospitalId").in(hospitalIds);
  93 + Criteria pCriteria = Criteria.where("yn").is(1); //.and("hospitalId").in(hospitalIds);
94 94 if(StringUtils.isNotEmpty(key)) {
95 95 pCriteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("username").regex(key), Criteria.where("cardNo").is(key));
96 96 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java View file @ 00e9e20
... ... @@ -54,6 +54,7 @@
54 54 bloodSugarService.update(one);
55 55 return RespBuilder.buildSuccess(one.getId());
56 56 }
  57 + bloodSugar.setParentId(mongoUtil.doHidePatient(bloodSugar.getParentId(), autoMatchFacade.getHospitalId(userId)));
57 58 bloodSugar.setHospitalId(autoMatchFacade.getHospitalId(userId));
58 59 bloodSugar.setCreated(new Date());
59 60 bloodSugar.setCreateUser(userId);
... ... @@ -69,7 +70,8 @@
69 70 public BaseResponse list(String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit, Integer userId) {
70 71 List<String> hospitalIds = accessPermissionFacade.getCurrentUserHospPermissions(userId);
71 72 Criteria criteria = Criteria.where("yn").is(1).and("hospitalId").in(hospitalIds);
72   - List<String> patientIds = mongoUtil.getPatientIdsByCondition(hospitalIds, key, vcCardNo, weekStart, weekEnd, age);
  73 + List<String> patientIds = mongoUtil.getPatientIdsByCondition2(hospitalIds, key, vcCardNo, weekStart, weekEnd, age);
  74 + System.out.println(patientIds);
73 75 criteria.and("parentId").in(patientIds);
74 76 PageResult pageResult = findMongoPage(BloodSugar.class, Query.query(criteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit);
75 77 List<BloodSugar> bloodSugars = (List<BloodSugar>) pageResult.getGrid();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java View file @ 00e9e20
... ... @@ -636,6 +636,40 @@
636 636 return ids;
637 637 }
638 638  
  639 + public List<String> getPatientIdsByCondition2(List<String> hospitalIds, String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age) {
  640 + List<Patients> patients = getPatientByCondition2(hospitalIds, key, vcCardNo, weekStart, weekEnd, age);
  641 + List<String> ids = new ArrayList<>();
  642 + if(CollectionUtils.isNotEmpty(patients)) {
  643 + for (Patients patient : patients) {
  644 + ids.add(patient.getId());
  645 + }
  646 + }
  647 + return ids;
  648 + }
  649 +
  650 + public List<Patients> getPatientByCondition2(List<String> hospitalIds, String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age) {
  651 + Criteria pCriteria = Criteria.where("yn").is(1);
  652 + if(StringUtils.isNotEmpty(key)) {
  653 + pCriteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("username").regex(key), Criteria.where("cardNo").is(key));
  654 + }
  655 + if(StringUtils.isNotEmpty(vcCardNo)) {
  656 + pCriteria.and("vcCardNo").is(vcCardNo);
  657 + }
  658 + if(weekStart != null && weekEnd != null) {
  659 + Date start = DateUtil.getWeekStart(weekEnd);
  660 + Date end = DateUtil.getWeekEnd(weekStart);
  661 + pCriteria.and("lastMenses").gt(start).lte(end);
  662 + }
  663 + if(age != null) {
  664 + Date start = DateUtil.getBeforeAge(age);
  665 + Date end = DateUtil.getBeforeAge(age + 1);
  666 + pCriteria.and("birth").gt(end).lte(start);
  667 + }
  668 + List<Patients> patients = mongoTemplate.find(Query.query(pCriteria), Patients.class);
  669 +
  670 + return patients;
  671 + }
  672 +
639 673 public String getHidByParentId(String parentId) {
640 674 Patients patients = mongoTemplate.findById(parentId, Patients.class);
641 675 return patients == null ? null : patients.getHospitalId();