Commit 5f05205ca02f8ae9fccd89052d95a7380e3ecffe
1 parent
2228809189
Exists in
master
and in
6 other branches
孕产-社区医生统计
Showing 3 changed files with 148 additions and 1 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PregnantBuildController.java
View file @
5f05205
| ... | ... | @@ -16,7 +16,6 @@ |
| 16 | 16 | import com.lyms.platform.operate.web.request.*; |
| 17 | 17 | import net.sf.json.JSONObject; |
| 18 | 18 | import org.apache.commons.httpclient.HttpClient; |
| 19 | -import org.apache.ibatis.annotations.Param; | |
| 20 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | 20 | import org.springframework.stereotype.Controller; |
| 22 | 21 | import org.springframework.web.bind.annotation.*; |
| ... | ... | @@ -725,5 +724,30 @@ |
| 725 | 724 | return bookbuildingFacade.getWifeHubbyAddress(cardNo); |
| 726 | 725 | } |
| 727 | 726 | |
| 727 | + /** | |
| 728 | + * 推荐人统计(社区医生) | |
| 729 | + * @param recommendQuery | |
| 730 | + * @param request | |
| 731 | + * @return | |
| 732 | + */ | |
| 733 | + @RequestMapping(value = "/queryRecommend", method = RequestMethod.GET) | |
| 734 | + @ResponseBody | |
| 735 | + @TokenRequired | |
| 736 | + public BaseObjectResponse queryRecommend(RecommendQuery recommendQuery, HttpServletRequest request) { | |
| 737 | + BaseObjectResponse objectResponse = bookbuildingFacade.queryRecommend(recommendQuery); | |
| 738 | + return objectResponse; | |
| 739 | + } | |
| 740 | + /** | |
| 741 | + * 推荐人统计-选择社区医生统计该医生建档人信息(社区医生) | |
| 742 | + * | |
| 743 | + * @return | |
| 744 | + */ | |
| 745 | + @RequestMapping(value = "/queryRecommendInfo", method = RequestMethod.GET) | |
| 746 | + @ResponseBody | |
| 747 | + @TokenRequired | |
| 748 | + public BaseObjectResponse queryRecommendInfo(RecommendQuery recommendQuery, HttpServletRequest request) { | |
| 749 | + BaseObjectResponse objectResponse = bookbuildingFacade.queryRecommendInfo(recommendQuery); | |
| 750 | + return objectResponse; | |
| 751 | + } | |
| 728 | 752 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
5f05205
| ... | ... | @@ -15,6 +15,7 @@ |
| 15 | 15 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 16 | 16 | import com.lyms.platform.common.dao.operator.MongoCondition; |
| 17 | 17 | import com.lyms.platform.common.dao.operator.MongoOper; |
| 18 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 18 | 19 | import com.lyms.platform.common.enums.*; |
| 19 | 20 | import com.lyms.platform.common.result.BaseListResponse; |
| 20 | 21 | import com.lyms.platform.common.result.BaseObjectResponse; |
| ... | ... | @@ -3397,6 +3398,33 @@ |
| 3397 | 3398 | map.put("FQ_ZZXZQHDM", organizationService.getAreaCode(FQZZQX)); |
| 3398 | 3399 | } |
| 3399 | 3400 | return map; |
| 3401 | + } | |
| 3402 | + | |
| 3403 | + public BaseObjectResponse queryRecommend(RecommendQuery recommendQuery) { | |
| 3404 | + MongoQuery query = recommendQuery.convertToQuery().addOrder(Sort.Direction.DESC, "bookbuildingDate"); | |
| 3405 | + List<Patients> patientses = mongoTemplate.find(query.convertToMongoQuery(), Patients.class); | |
| 3406 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 3407 | + objectResponse.setData(patientses); | |
| 3408 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 3409 | + objectResponse.setErrormsg("成功"); | |
| 3410 | + return objectResponse; | |
| 3411 | + } | |
| 3412 | + | |
| 3413 | + public BaseObjectResponse queryRecommendInfo(RecommendQuery recommendQuery) { | |
| 3414 | + MongoQuery query = recommendQuery.convertToQuery(); | |
| 3415 | + //分页后总数量 | |
| 3416 | + recommendQuery.mysqlBuild((int)mongoTemplate.count(query.convertToMongoQuery(),Patients.class)); | |
| 3417 | + //分页 | |
| 3418 | + query.start(recommendQuery.getOffset()).end(recommendQuery.getLimit()); | |
| 3419 | + //排序 | |
| 3420 | + query.addOrder(Sort.Direction.DESC, "bookbuildingDate"); | |
| 3421 | + List<Patients> patientses = mongoTemplate.find(query.convertToMongoQuery(), Patients.class); | |
| 3422 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 3423 | + objectResponse.setData(patientses); | |
| 3424 | + objectResponse.setPageInfo(recommendQuery.getPageInfo()); | |
| 3425 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 3426 | + objectResponse.setErrormsg("成功"); | |
| 3427 | + return objectResponse; | |
| 3400 | 3428 | } |
| 3401 | 3429 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/RecommendQuery.java
View file @
5f05205
| 1 | +package com.lyms.platform.operate.web.request; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.base.IConvertToNativeQuery; | |
| 4 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.common.utils.DateUtil; | |
| 9 | +import com.lyms.platform.common.utils.StringUtils; | |
| 10 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 11 | + | |
| 12 | +import java.util.Date; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * | |
| 16 | + * @Author dongqin | |
| 17 | + * @Description | |
| 18 | + * @Date 9:30 2019/8/23 | |
| 19 | + */ | |
| 20 | + | |
| 21 | +public class RecommendQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 卫生院 | |
| 25 | + */ | |
| 26 | + private String townOrgId; | |
| 27 | + /** | |
| 28 | + * 社区医生(推荐人) | |
| 29 | + */ | |
| 30 | + private String recommend; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 开始时间 | |
| 34 | + */ | |
| 35 | + private Date startTime; | |
| 36 | + /** | |
| 37 | + * 结束时间 | |
| 38 | + */ | |
| 39 | + private Date endTime; | |
| 40 | + | |
| 41 | + public String getTownOrgId() { | |
| 42 | + return townOrgId; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setTownOrgId(String townOrgId) { | |
| 46 | + this.townOrgId = townOrgId; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public String getRecommend() { | |
| 50 | + return recommend; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setRecommend(String recommend) { | |
| 54 | + this.recommend = recommend; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public Date getStartTime() { | |
| 58 | + return startTime; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setStartTime(Date startTime) { | |
| 62 | + this.startTime = startTime; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public Date getEndTime() { | |
| 66 | + return endTime; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setEndTime(Date endTime) { | |
| 70 | + this.endTime = endTime; | |
| 71 | + } | |
| 72 | + | |
| 73 | + @Override | |
| 74 | + public MongoQuery convertToQuery() { | |
| 75 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 76 | + if (StringUtils.isNotEmpty(recommend)) { | |
| 77 | + condition = condition.and("recommend", recommend, MongoOper.IS); | |
| 78 | + } | |
| 79 | + if (StringUtils.isNotEmpty(townOrgId)) { | |
| 80 | + condition = condition.and("townOrgId", townOrgId, MongoOper.IS); | |
| 81 | + } | |
| 82 | + Criteria c = null; | |
| 83 | + | |
| 84 | + c = Criteria.where("recommend").ne(""); | |
| 85 | + | |
| 86 | + if (null!=startTime && null!=endTime) { | |
| 87 | + c = c.where("bookbuildingDate").gte(DateUtil.getDayFirstSecond(startTime)).lte(DateUtil.getDayLastSecond(endTime)); | |
| 88 | + } | |
| 89 | + if (c != null) { | |
| 90 | + return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); | |
| 91 | + } | |
| 92 | + | |
| 93 | + return condition.toMongoQuery(); | |
| 94 | + } | |
| 95 | +} |