Commit a86a8856debb95c7881cab21d0fcbd212abfa5a3
1 parent
5f05205ca0
Exists in
master
and in
6 other branches
孕产-社区医生统计,详细字段翻译
Showing 2 changed files with 50 additions and 5 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
a86a885
... | ... | @@ -3402,9 +3402,22 @@ |
3402 | 3402 | |
3403 | 3403 | public BaseObjectResponse queryRecommend(RecommendQuery recommendQuery) { |
3404 | 3404 | MongoQuery query = recommendQuery.convertToQuery().addOrder(Sort.Direction.DESC, "bookbuildingDate"); |
3405 | + System.out.println(query.convertToMongoQuery().toString()); | |
3405 | 3406 | List<Patients> patientses = mongoTemplate.find(query.convertToMongoQuery(), Patients.class); |
3407 | + List<Map> result=new ArrayList<>(); | |
3408 | + for (Patients patients : patientses) { | |
3409 | + recommendQuery.setRecommend(patients.getRecommend()); | |
3410 | + recommendQuery.setTownOrgId(patients.getTownOrgId()); | |
3411 | + final long count = mongoTemplate.count(recommendQuery.convertToQuery().convertToMongoQuery(), Patients.class); | |
3412 | + Map map=new HashMap(); | |
3413 | + map=MapUtil.beanToMap(patients); | |
3414 | + map.put("recommendCount", count); | |
3415 | + final String townOrgName = organizationService.getOrganizationName(patients.getTownOrgId()); | |
3416 | + map.put("townOrgName", townOrgName); | |
3417 | + result.add(map); | |
3418 | + } | |
3406 | 3419 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
3407 | - objectResponse.setData(patientses); | |
3420 | + objectResponse.setData(result); | |
3408 | 3421 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
3409 | 3422 | objectResponse.setErrormsg("成功"); |
3410 | 3423 | return objectResponse; |
3411 | 3424 | |
... | ... | @@ -3419,8 +3432,39 @@ |
3419 | 3432 | //排序 |
3420 | 3433 | query.addOrder(Sort.Direction.DESC, "bookbuildingDate"); |
3421 | 3434 | List<Patients> patientses = mongoTemplate.find(query.convertToMongoQuery(), Patients.class); |
3435 | + List<Map> result=new ArrayList<>(); | |
3436 | + for (Patients patients : patientses) { | |
3437 | + //孕周 | |
3438 | + String dueWeek=""; | |
3439 | + try { | |
3440 | + if (patients.getBookbuildingDate().getTime() - patients.getDueDate().getTime() > 0 && patients.getBuildType() == 2) { | |
3441 | + dueWeek = "已分娩"; | |
3442 | + } else { | |
3443 | + int days = DateUtil.daysBetween(patients.getLastMenses(), patients.getBookbuildingDate()); | |
3444 | + if (days > 7 * 42 - 1) { | |
3445 | + dueWeek = "已分娩"; | |
3446 | + } else { | |
3447 | + String week = (days / 7) + ""; | |
3448 | + int day = (days % 7); | |
3449 | + dueWeek = "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""); | |
3450 | + } | |
3451 | + } | |
3452 | + } catch (Exception e) { | |
3453 | + // 什么都不干 | |
3454 | + } | |
3455 | + //居住地 | |
3456 | + final String residenceAddress = CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(), patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService); | |
3457 | + //预约住院分娩医院 | |
3458 | + final String makeHospital = organizationService.getOrganizationName(patients.getYyzyfmHospitalId()); | |
3459 | + Map map=new HashMap(); | |
3460 | + map=MapUtil.beanToMap(patients); | |
3461 | + map.put("dueWeek",dueWeek); | |
3462 | + map.put("residenceAddress",residenceAddress); | |
3463 | + map.put("makeHospital",makeHospital); | |
3464 | + result.add(map); | |
3465 | + } | |
3422 | 3466 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
3423 | - objectResponse.setData(patientses); | |
3467 | + objectResponse.setData(result); | |
3424 | 3468 | objectResponse.setPageInfo(recommendQuery.getPageInfo()); |
3425 | 3469 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
3426 | 3470 | objectResponse.setErrormsg("成功"); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/RecommendQuery.java
View file @
a86a885
... | ... | @@ -77,15 +77,16 @@ |
77 | 77 | condition = condition.and("recommend", recommend, MongoOper.IS); |
78 | 78 | } |
79 | 79 | if (StringUtils.isNotEmpty(townOrgId)) { |
80 | - condition = condition.and("townOrgId", townOrgId, MongoOper.IS); | |
80 | + condition = condition.and("townOrgId", townOrgId, MongoOper.NE); | |
81 | 81 | } |
82 | 82 | Criteria c = null; |
83 | 83 | |
84 | - c = Criteria.where("recommend").ne(""); | |
84 | + c = Criteria.where("recommend").ne(null); | |
85 | 85 | |
86 | 86 | if (null!=startTime && null!=endTime) { |
87 | - c = c.where("bookbuildingDate").gte(DateUtil.getDayFirstSecond(startTime)).lte(DateUtil.getDayLastSecond(endTime)); | |
87 | + c = c.and("bookbuildingDate").gte(DateUtil.getDayFirstSecond(startTime)).lte(DateUtil.getDayLastSecond(endTime)); | |
88 | 88 | } |
89 | + | |
89 | 90 | if (c != null) { |
90 | 91 | return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); |
91 | 92 | } |