Commit 75fd384bea31bc7b36ddba4720e6b63e1c251a31

Authored by hujiaqi

Merge remote-tracking branch 'origin/master'

Showing 11 changed files

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBabyCheckDao.java View file @ 75fd384
... ... @@ -20,5 +20,7 @@
20 20 List<BabyCheckModel> queryLastCheck(List<String> ids);
21 21  
22 22 List<BabyCheckModel> queryLastDiagnoseCheck(List<String> ids);
  23 +
  24 + int queryBabyCheckCount(MongoQuery mongoQuery);
23 25 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyCheckDaoImpl.java View file @ 75fd384
... ... @@ -64,6 +64,11 @@
64 64 return result.getMappedResults();
65 65 }
66 66  
  67 + @Override
  68 + public int queryBabyCheckCount(MongoQuery mongoQuery) {
  69 + return (int) count(mongoQuery.convertToMongoQuery());
  70 + }
  71 +
67 72  
68 73 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java View file @ 75fd384
... ... @@ -51,7 +51,7 @@
51 51 }
52 52  
53 53 public List<BabyCheckModel> queryBabyCheckRecord(BabyCheckModelQuery query,String sortkey,Sort.Direction sort) {
54   - return babyCheckDao.queryBabyCheckRecord(query.convertToQuery().addOrder(sort,sortkey));
  54 + return babyCheckDao.queryBabyCheckRecord(query.convertToQuery().addOrder(sort, sortkey));
55 55 }
56 56  
57 57 public List<HwModel> queryHWByHeight(Double height, Integer sex) {
... ... @@ -85,6 +85,11 @@
85 85 public List<BabyCheckModel> queryLastDiagnoseCheck(List<String> ids) {
86 86 return babyCheckDao.queryLastDiagnoseCheck(ids);
87 87  
  88 + }
  89 +
  90 + public int queryBabyCheckCount(BabyCheckModelQuery babyQuery) {
  91 +
  92 + return babyCheckDao.queryBabyCheckCount(babyQuery.convertToQuery());
88 93 }
89 94 }
platform-dal/src/main/java/com/lyms/platform/pojo/BabyCheckModel.java View file @ 75fd384
... ... @@ -232,6 +232,16 @@
232 232 //头围评价
233 233 private String headEvaluate;
234 234  
  235 + private Date birth;
  236 +
  237 + public Date getBirth() {
  238 + return birth;
  239 + }
  240 +
  241 + public void setBirth(Date birth) {
  242 + this.birth = birth;
  243 + }
  244 +
235 245 public String getWeightEvaluate() {
236 246 return weightEvaluate;
237 247 }
platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java View file @ 75fd384
... ... @@ -31,6 +31,31 @@
31 31  
32 32 private String hospitalId;
33 33  
  34 + //体重评价
  35 + private String weightEvaluate;
  36 + //身长评价
  37 + private String heightEvaluate;
  38 + //头围评价
  39 + private String headEvaluate;
  40 +
  41 + //身长别体重
  42 + private String heightWeight;
  43 +
  44 + /**
  45 + * 生日
  46 + */
  47 + private Date birthStart;
  48 +
  49 + /**
  50 + * 生日
  51 + */
  52 + private Date birthEnd;
  53 +
  54 + private Date checkDateStart;
  55 + private Date checkDateEnd;
  56 +
  57 +
  58 +
34 59 @Override
35 60 public MongoQuery convertToQuery() {
36 61 MongoCondition condition = MongoCondition.newInstance();
37 62  
38 63  
... ... @@ -41,16 +66,65 @@
41 66 if(null!=yn){
42 67 condition=condition.and("yn", yn, MongoOper.IS);
43 68 }
  69 +
  70 + if (null != weightEvaluate) {
  71 + condition = condition.and("weightEvaluate", weightEvaluate, MongoOper.IS);
  72 + }
  73 + if (null != heightEvaluate) {
  74 + condition = condition.and("heightEvaluate", heightEvaluate, MongoOper.IS);
  75 + }
  76 + if (null != headEvaluate) {
  77 + condition = condition.and("headEvaluate", headEvaluate, MongoOper.IS);
  78 + }
  79 + if (null != heightWeight) {
  80 + condition = condition.and("heightWeight", heightWeight, MongoOper.IS);
  81 + }
  82 +
44 83 if(null!=buildId){
45 84 condition=condition.and("buildId", buildId, MongoOper.IS);
46 85 }
47 86 if(null!=hospitalId){
48   - condition=condition.and("hospitalId",hospitalId,MongoOper.IS);
  87 + condition=condition.and("hospitalId", hospitalId, MongoOper.IS);
49 88 }
50 89 if(null!=buildIds && buildIds.length > 0){
51 90 Criteria c = Criteria.where("buildId").in(Arrays.asList(buildIds));
52 91 condition.andCondition( new MongoCondition(c));
53 92 }
  93 +
  94 +
  95 + Criteria c = null;
  96 + if (null != birthStart) {
  97 + c = Criteria.where("birth").gte(birthStart);
  98 + }
  99 +
  100 + if (null != birthEnd) {
  101 + if (null != c) {
  102 + c = c.lte(birthEnd);
  103 + } else {
  104 + c = Criteria.where("birth").lte(birthEnd);
  105 + }
  106 + }
  107 +
  108 + if (null != checkDateStart) {
  109 + if (null != c) {
  110 + c = c.and("checkDate").gte(checkDateStart);
  111 + } else {
  112 + c = Criteria.where("checkDate").gte(checkDateStart);
  113 + }
  114 + }
  115 +
  116 + if (null != checkDateEnd) {
  117 + if (null != c) {
  118 + c = c.lte(checkDateEnd);
  119 + } else {
  120 + c = Criteria.where("checkDate").lte(checkDateEnd);
  121 + }
  122 + }
  123 +
  124 + if (c != null) {
  125 + return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery();
  126 + }
  127 +
54 128 return condition.toMongoQuery();
55 129 }
56 130  
... ... @@ -92,6 +166,70 @@
92 166  
93 167 public void setBuildIds(String[] buildIds) {
94 168 this.buildIds = buildIds;
  169 + }
  170 +
  171 + public String getWeightEvaluate() {
  172 + return weightEvaluate;
  173 + }
  174 +
  175 + public void setWeightEvaluate(String weightEvaluate) {
  176 + this.weightEvaluate = weightEvaluate;
  177 + }
  178 +
  179 + public String getHeightEvaluate() {
  180 + return heightEvaluate;
  181 + }
  182 +
  183 + public void setHeightEvaluate(String heightEvaluate) {
  184 + this.heightEvaluate = heightEvaluate;
  185 + }
  186 +
  187 + public String getHeadEvaluate() {
  188 + return headEvaluate;
  189 + }
  190 +
  191 + public void setHeadEvaluate(String headEvaluate) {
  192 + this.headEvaluate = headEvaluate;
  193 + }
  194 +
  195 + public String getHeightWeight() {
  196 + return heightWeight;
  197 + }
  198 +
  199 + public void setHeightWeight(String heightWeight) {
  200 + this.heightWeight = heightWeight;
  201 + }
  202 +
  203 + public Date getBirthStart() {
  204 + return birthStart;
  205 + }
  206 +
  207 + public void setBirthStart(Date birthStart) {
  208 + this.birthStart = birthStart;
  209 + }
  210 +
  211 + public Date getBirthEnd() {
  212 + return birthEnd;
  213 + }
  214 +
  215 + public void setBirthEnd(Date birthEnd) {
  216 + this.birthEnd = birthEnd;
  217 + }
  218 +
  219 + public Date getCheckDateStart() {
  220 + return checkDateStart;
  221 + }
  222 +
  223 + public void setCheckDateStart(Date checkDateStart) {
  224 + this.checkDateStart = checkDateStart;
  225 + }
  226 +
  227 + public Date getCheckDateEnd() {
  228 + return checkDateEnd;
  229 + }
  230 +
  231 + public void setCheckDateEnd(Date checkDateEnd) {
  232 + this.checkDateEnd = checkDateEnd;
95 233 }
96 234 }
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java View file @ 75fd384
... ... @@ -498,10 +498,10 @@
498 498 condition = condition.and("heightEvaluate", heightEvaluate, MongoOper.IS);
499 499 }
500 500 if (null != headEvaluate) {
501   - condition = condition.and("pregnancyOut", headEvaluate, MongoOper.IS);
  501 + condition = condition.and("headEvaluate", headEvaluate, MongoOper.IS);
502 502 }
503 503 if (null != heightWeight) {
504   - condition = condition.and("pregnancyOut", heightWeight, MongoOper.IS);
  504 + condition = condition.and("heightWeight", heightWeight, MongoOper.IS);
505 505 }
506 506  
507 507  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java View file @ 75fd384
... ... @@ -55,7 +55,7 @@
55 55 if (request != null && !StringUtils.isEmpty(request.getId())) {
56 56 return babyBookbuildingFacade.updateBabyBookbuilding(request,loginState.getId());
57 57 }
58   - return babyBookbuildingFacade.addBabyBookbuilding(request,loginState.getId());
  58 + return babyBookbuildingFacade.addBabyBookbuilding(request, loginState.getId());
59 59 }
60 60  
61 61  
... ... @@ -284,7 +284,7 @@
284 284 @TokenRequired
285 285 public BaseResponse babyGuildSms(@Valid @RequestBody BabyGuideSmsequest param,HttpServletRequest request) {
286 286 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
287   - return babyBookbuildingFacade.sendBabyGuideSms(param,loginState.getId());
  287 + return babyBookbuildingFacade.sendBabyGuideSms(param, loginState.getId());
288 288 }
289 289  
290 290  
291 291  
... ... @@ -378,10 +378,24 @@
378 378 */
379 379 @RequestMapping(method = RequestMethod.GET, value = "/getBabyGroupCount")
380 380 @ResponseBody
  381 + @TokenRequired
381 382 public BaseResponse getBabyGroupCount(@Valid @RequestBody BabyManageRequest babyManageRequest,
382 383 HttpServletRequest request) {
383 384 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
384   - return babyBookbuildingFacade.getBabyGroupCount(babyManageRequest,loginState.getId());
  385 + return babyBookbuildingFacade.getBabyGroupCount(babyManageRequest, loginState.getId());
  386 + }
  387 +
  388 + /**
  389 + * 儿童生长统计右边列表
  390 + * @param babyManageRequest
  391 + * @return
  392 + */
  393 + @RequestMapping(method = RequestMethod.GET, value = "/getBabyGroupRightCount")
  394 + @ResponseBody
  395 + @TokenRequired
  396 + public BaseResponse getBabyGroupRightCount(@Valid @RequestBody BabyManageRequest babyManageRequest,HttpServletRequest request){
  397 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  398 + return babyBookbuildingFacade.getBabyGroupRightCount(babyManageRequest,loginState.getId());
385 399 }
386 400  
387 401  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 75fd384
... ... @@ -792,7 +792,7 @@
792 792 checkModel.setHeightWeight(hw);
793 793  
794 794 }
795   -
  795 + checkModel.setBirth(babyModel.getBirth());
796 796 babyCheckService.updateBabyCheck(checkModel,checkModel.getId());
797 797 }
798 798 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 75fd384
... ... @@ -60,8 +60,6 @@
60 60 private DeleteProcessHandler deleteProcessHandler;
61 61 @Autowired
62 62 private AntExRecordService recordService;
63   - @Value(("#{configProperties['run.region']}"))
64   - private String runType;
65 63  
66 64 @Autowired
67 65 private OrganizationGroupsFacade groupsFacade;
... ... @@ -89,7 +87,7 @@
89 87 }
90 88  
91 89 //表示区域的
92   - if (ErrorCodeConstants.RUN_MODE.equals(runType) && StringUtils.isEmpty(parentId) && StringUtils.isNotEmpty(pid)) {
  90 + if (StringUtils.isNotEmpty(groupsFacade.findByCurrentUserId(hospitalId)) && StringUtils.isNotEmpty(pid)) {
93 91 patients = findOnePatient(null, null, null, null, 1, false, pid, false);
94 92 patients.setSource(patients.getId());
95 93 patients.setId(null);
... ... @@ -296,7 +294,7 @@
296 294 String hospitalId = autoMatchFacade.getHospitalId(userId);
297 295  
298 296 //表示区域的
299   - if (ErrorCodeConstants.RUN_MODE.equals(runType)) {
  297 + if (StringUtils.isNotEmpty(groupsFacade.findByCurrentUserId(hospitalId))) {
300 298 String parentId = handHideBuild(excAddRequest.getPid(), excAddRequest.getParentId(), userId);
301 299 if (StringUtils.isEmpty(parentId)) {
302 300 //打印日志
... ... @@ -1713,9 +1711,6 @@
1713 1711 patients = list.get(0);
1714 1712 }
1715 1713 } else {
1716   -
1717   - //区域模式
1718   -
1719 1714 patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, groupsFacade.findGroupHospital(userId), 1, false, null, og.getbStatus() == 1);
1720 1715 //查询产妇数据
1721 1716 // patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospitalId, 1, false, null, false);
1722 1717  
1723 1718  
... ... @@ -1729,16 +1724,13 @@
1729 1724 // //查询是否还有其他记录
1730 1725 // patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospitalId, 3, false, null, false);
1731 1726 // }
1732   - patients=findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, groupsFacade.findGroupHospital(userId), 3, false, null, og.getbStatus() == 1);
  1727 + patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, groupsFacade.findGroupHospital(userId), 3, false, null, og.getbStatus() == 1);
1733 1728  
1734   - //区域模式
1735   - if (ErrorCodeConstants.RUN_MODE.equals(runType)) {
1736   - //原来单机
1737   - if (null != patients) {
1738   - return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("该孕妇在系统中已分娩/已终止妊娠不能再进行产检,请重新建档");
1739   - }
1740   - return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("该孕妇还未在本院建档不能进行产检");
  1729 + //原来单机
  1730 + if (null != patients) {
  1731 + return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("该孕妇在系统中已分娩/已终止妊娠不能再进行产检,请重新建档");
1741 1732 }
  1733 + return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("该孕妇还未在本院建档不能进行产检");
1742 1734 }
1743 1735  
1744 1736  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java View file @ 75fd384
... ... @@ -1747,7 +1747,7 @@
1747 1747 }
1748 1748 babyQuery.setBuildDateEnd(date);
1749 1749 }
1750   - }
  1750 + }
1751 1751  
1752 1752 // 省
1753 1753 babyQuery.setProvinceId(StringUtils.isEmpty(request.getProvinceId())?null:request.getProvinceId());
... ... @@ -2083,7 +2083,7 @@
2083 2083 public QueryHospitalListResult queryHospitalList(QueryHospitalListRequest queryHospitalListRequest) {
2084 2084 QueryHospitalListResult queryHospitalListResult = new QueryHospitalListResult();
2085 2085 OrganizationQuery organizationQuery = new OrganizationQuery();
2086   - BeanUtils.copy(queryHospitalListRequest,organizationQuery);
  2086 + BeanUtils.copy(queryHospitalListRequest, organizationQuery);
2087 2087 List<Integer> typeList = new ArrayList<>();
2088 2088 typeList.add(OrganizationTypeEnum.NY.getId());
2089 2089 typeList.add(OrganizationTypeEnum.FB.getId());
2090 2090  
2091 2091  
2092 2092  
2093 2093  
2094 2094  
2095 2095  
2096 2096  
2097 2097  
2098 2098  
2099 2099  
2100 2100  
2101 2101  
2102 2102  
2103 2103  
2104 2104  
2105 2105  
2106 2106  
2107 2107  
2108 2108  
2109 2109  
2110 2110  
... ... @@ -2130,103 +2130,174 @@
2130 2130 }
2131 2131 }
2132 2132  
2133   - BabyModelQuery babyQuery = new BabyModelQuery();
2134   - List buildType = new ArrayList();
2135   - buildType.add(1);
2136   - buildType.add(2);
2137   - babyQuery.setBuildTypeList(buildType);
  2133 + BabyCheckModelQuery babyQuery = new BabyCheckModelQuery();
2138 2134 babyQuery.setHospitalId(hospitalId);
2139 2135  
2140 2136 babyQuery.setYn(YnEnums.YES.getId());
2141 2137 Date currentDate = DateUtil.formatDate(new Date());
2142 2138  
2143   - if(StringUtils.isNotEmpty(request.getBirth()) && request.getMonthAgeStart() != null && request.getMonthAgeEnd() != null)
  2139 + if (StringUtils.isNotEmpty(request.getBirth()))
2144 2140 {
2145   -
2146   - Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
2147 2141 String birthStr = request.getBirth();
2148 2142 String[] dates = birthStr.split(" - ");
  2143 + babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
  2144 + babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
  2145 + }
  2146 + if (request.getMonthAgeStart() != null)
  2147 + {
  2148 + Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
  2149 + babyQuery.setCheckDateEnd(start);
  2150 + }
  2151 + if (request.getMonthAgeEnd() != null)
  2152 + {
  2153 + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
  2154 + babyQuery.setCheckDateStart(end);
  2155 + }
  2156 + Map<String,List<BabyGrowthCountResult>> result = new HashMap<>();
2149 2157  
2150   - if (DateUtil.parseYMD(dates[1]).getTime() < start.getTime())
2151   - {
2152   - babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
  2158 + Map<String,List<BabyGrowthCountResult>> mapItems = getCountGroupItemMaps();
  2159 + for(String key : mapItems.keySet())
  2160 + {
  2161 + List<BabyGrowthCountResult> groups = mapItems.get(key);
  2162 + GrowthCountTask task = new GrowthCountTask(groups,babyQuery,babyCheckService,key);
  2163 + result.put(key,task.getResults());
  2164 + }
2153 2165  
2154   - }
2155   - else
2156   - {
2157   - babyQuery.setBirthEnd(start);
2158   - }
  2166 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  2167 + objectResponse.setData(result);
  2168 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  2169 + objectResponse.setErrormsg("成功");
  2170 + return objectResponse;
  2171 + }
2159 2172  
2160   - Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
2161 2173  
2162   - if (DateUtil.parseYMD(dates[0]).getTime() < end.getTime())
2163   - {
2164   - babyQuery.setBirthStart(end);
2165   - }
2166   - else
2167   - {
2168   - babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
2169   - }
2170   - }
2171   - else if (StringUtils.isNotEmpty(request.getBirth()) && request.getMonthAgeStart() != null )
2172   - {
2173 2174  
2174   - Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
2175   - String birthStr = request.getBirth();
2176   - String[] dates = birthStr.split(" - ");
2177 2175  
2178   - if (DateUtil.parseYMD(dates[1]).getTime() < start.getTime())
2179   - {
2180   - babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
  2176 + /**
  2177 + * 儿童生长发育统计右边统计列表
  2178 + * @param request
  2179 + * @param userId
  2180 + * @return
  2181 + */
  2182 + public BaseResponse getBabyGroupRightCount(BabyManageRequest request, Integer userId) {
  2183 + String hospitalId = "";
  2184 + //得到当前登录的医院id
  2185 + if (userId != null) {
  2186 + Users dbuser = usersService.getUsers(userId);
  2187 + if (dbuser != null) {
  2188 + hospitalId = String.valueOf(dbuser.getOrgId());
2181 2189 }
2182   - else
2183   - {
2184   - babyQuery.setBirthEnd(start);
2185   - }
  2190 + }
2186 2191  
2187   - babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
  2192 + BabyCheckModelQuery babyQuery = new BabyCheckModelQuery();
  2193 + babyQuery.setHospitalId(hospitalId);
2188 2194  
2189   - }
2190   - else if (StringUtils.isNotEmpty(request.getBirth()))
  2195 + babyQuery.setYn(YnEnums.YES.getId());
  2196 + Date currentDate = DateUtil.formatDate(new Date());
  2197 +
  2198 + if (StringUtils.isNotEmpty(request.getBirth()))
2191 2199 {
2192 2200 String birthStr = request.getBirth();
2193 2201 String[] dates = birthStr.split(" - ");
2194 2202 babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
2195 2203 babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
2196 2204 }
2197   - else if (request.getMonthAgeStart() != null && request.getMonthAgeEnd() != null)
  2205 + if (request.getMonthAgeStart() != null)
2198 2206 {
2199 2207 Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
2200   - babyQuery.setBirthEnd(start);
2201   -
2202   - Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
2203   - babyQuery.setBirthStart(end);
  2208 + babyQuery.setCheckDateEnd(start);
2204 2209 }
2205   - else if (request.getMonthAgeStart() != null)
  2210 + if (request.getMonthAgeEnd() != null)
2206 2211 {
2207   - Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
2208   - babyQuery.setBirthEnd(start);
2209   - }
2210   - else if (request.getMonthAgeEnd() != null)
2211   - {
2212 2212 Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
2213   - babyQuery.setBirthStart(end);
  2213 + babyQuery.setCheckDateStart(end);
2214 2214 }
2215   - Map<String,List<BabyGrowthCountResult>> result = new HashMap<>();
2216 2215  
2217   - Map<String,List<BabyGrowthCountResult>> mapItems = getCountGroupItemMaps();
2218   - for(String key : mapItems.keySet())
2219   - {
2220   - List<BabyGrowthCountResult> groups = mapItems.get(key);
2221   - GrowthCountTask task = new GrowthCountTask(groups,babyQuery,babyBookbuildingService,key);
2222   - result.put(key,task.getResults());
  2216 + List<Map<String,String>> results = new ArrayList<>();
  2217 +
  2218 + List<BabyCheckModel> babyCheckModels = babyCheckService.queryBabyCheckRecord(babyQuery);
  2219 + if (CollectionUtils.isNotEmpty(babyCheckModels)) {
  2220 + int batchSize = 50;
  2221 + int end = 0;
  2222 + List<Future> futures = new ArrayList<>();
  2223 + for (int i = 0; i < babyCheckModels.size(); i += batchSize) {
  2224 + end = (end + batchSize);
  2225 + if (end > babyCheckModels.size()) {
  2226 + end = babyCheckModels.size();
  2227 + }
  2228 + final List<BabyCheckModel> checkModels = babyCheckModels.subList(i, end);
  2229 + Callable c = new Callable()
  2230 + {
  2231 + @Override
  2232 + public List<Map<String,String>> call() throws Exception {
  2233 + List<Map<String,String>> list = new ArrayList<>();
  2234 + if (CollectionUtils.isNotEmpty(checkModels))
  2235 + {
  2236 + for(BabyCheckModel checkModel : checkModels)
  2237 + {
  2238 + if (StringUtils.isNotEmpty(checkModel.getBuildId()))
  2239 + {
  2240 + BabyModel model = getBabyModelById(checkModel.getBuildId());
  2241 + Map<String,String> map = new HashMap<>();
  2242 + map.put("babyId",model.getId());
  2243 + map.put("checkId",checkModel.getId());
  2244 + map.put("sex", StringUtils.emptyDeal(SexEnum.getTextById(model.getSex()))); //性别
  2245 + map.put("babyName", StringUtils.emptyDeal(model.getName())); //儿童名称
  2246 + map.put("birthday", StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(model.getBirth()))); //生日
  2247 + map.put("age",""); //当前月龄
  2248 + map.put("height",checkModel.getHeight()); //身长
  2249 + map.put("weight", checkModel.getWeight()); //体重
  2250 + map.put("growthEvaluate",checkModel.getGrowthEvaluate()); //体格发育评价
  2251 + map.put("checkDate",StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(checkModel.getCheckDate())));
  2252 + String checkDoctorId = checkModel.getCheckDoctor() ;
  2253 + String checkDoctor = "";
  2254 + if (StringUtils.isNotEmpty(checkDoctorId))
  2255 + {
  2256 + Users user = usersService.getUsers(Integer.parseInt(checkDoctorId));
  2257 + if (user != null)
  2258 + {
  2259 + checkDoctor = user.getName();
  2260 + }
  2261 + }
  2262 + map.put("checkDoctor",checkDoctor);
  2263 + }
  2264 +
  2265 + }
  2266 + }
  2267 + return list;
  2268 + }
  2269 + };
  2270 +
  2271 + Future f = pool.submit(c);
  2272 + futures.add(f);
  2273 + }
  2274 + for (Future f : futures) {
  2275 + try {
  2276 + results.addAll((List) f.get(30, TimeUnit.SECONDS));
  2277 + } catch (Exception e) {
  2278 + ExceptionUtils.catchException(e, "baby check list");
  2279 + }
  2280 + }
2223 2281 }
2224 2282  
2225 2283 BaseObjectResponse objectResponse = new BaseObjectResponse();
2226   - objectResponse.setData(result);
  2284 + objectResponse.setData(results);
2227 2285 objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
2228 2286 objectResponse.setErrormsg("成功");
2229 2287 return objectResponse;
  2288 + }
  2289 +
  2290 + private BabyModel getBabyModelById(String id)
  2291 + {
  2292 + BabyModelQuery query = new BabyModelQuery();
  2293 + query.setId(id);
  2294 + query.setYn(YnEnums.YES.getId());
  2295 + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(query);
  2296 + if (CollectionUtils.isNotEmpty(models))
  2297 + {
  2298 + return models.get(0);
  2299 + }
  2300 + return null;
2230 2301 }
2231 2302  
2232 2303  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/GrowthCountTask.java View file @ 75fd384
1 1 package com.lyms.platform.operate.web.utils;
2 2  
3 3 import com.lyms.platform.biz.service.BabyBookbuildingService;
  4 +import com.lyms.platform.biz.service.BabyCheckService;
4 5 import com.lyms.platform.common.utils.ExceptionUtils;
5 6 import com.lyms.platform.operate.web.result.BabyGrowthCountResult;
  7 +import com.lyms.platform.query.BabyCheckModelQuery;
6 8 import com.lyms.platform.query.BabyModelQuery;
7 9 import org.apache.commons.collections.CollectionUtils;
8 10  
9 11  
10 12  
11 13  
... ... @@ -16,16 +18,16 @@
16 18 public class GrowthCountTask{
17 19  
18 20 private static ExecutorService pool = Executors.newFixedThreadPool(6);
19   - private BabyModelQuery babyQuery;
  21 + private BabyCheckModelQuery babyQuery;
20 22 private List<BabyGrowthCountResult> growth;
21   - private BabyBookbuildingService babyBookbuildingService;
  23 + private BabyCheckService babyCheckService;
22 24 private String type;
23   - public GrowthCountTask(List<BabyGrowthCountResult> growth,BabyModelQuery babyQuery,
24   - BabyBookbuildingService babyBookbuildingService,String type)
  25 + public GrowthCountTask(List<BabyGrowthCountResult> growth,BabyCheckModelQuery babyQuery,
  26 + BabyCheckService babyCheckService,String type)
25 27 {
26 28 this.babyQuery=babyQuery;
27 29 this.growth = growth;
28   - this.babyBookbuildingService = babyBookbuildingService;
  30 + this.babyCheckService = babyCheckService;
29 31 this.type = type;
30 32 }
31 33 public List<BabyGrowthCountResult> getResults() {
... ... @@ -59,8 +61,8 @@
59 61 {
60 62 babyQuery.setWeightEvaluate(grouwth.getEvaluate());
61 63 }
62   - int count = babyBookbuildingService.queryBabyCount(babyQuery);
63   - grouwth.setCount(String.valueOf(count));
  64 + int count = babyCheckService.queryBabyCheckCount(babyQuery);
  65 + grouwth.setCount(String.valueOf(count));
64 66 }
65 67 }
66 68  
... ... @@ -82,5 +84,62 @@
82 84  
83 85 return results;
84 86 }
  87 +
  88 +
  89 +
  90 +// public List<BabyGrowthCountResult> getResults() {
  91 +// List<BabyGrowthCountResult> results = new ArrayList<>();
  92 +// if (CollectionUtils.isNotEmpty(growth)) {
  93 +//
  94 +// int batchSize = 1;
  95 +// int end = 0;
  96 +// List<Future> futures = new ArrayList<>();
  97 +// for (int i = 0; i < growth.size(); i += batchSize) {
  98 +// end = (end + batchSize);
  99 +// if (end > growth.size()) {
  100 +// end = growth.size();
  101 +// }
  102 +//
  103 +// final List<BabyGrowthCountResult> growths = growth.subList(i, end);
  104 +// Callable c = new Callable()
  105 +// {
  106 +// @Override
  107 +// public List<BabyGrowthCountResult> call() throws Exception {
  108 +//
  109 +// if (CollectionUtils.isNotEmpty(growths))
  110 +// {
  111 +// for(BabyGrowthCountResult grouwth : growths)
  112 +// {
  113 +// if ("身长".equals(type))
  114 +// {
  115 +// babyQuery.setHeightEvaluate(grouwth.getEvaluate());
  116 +// }
  117 +// else if ("体重".equals(type))
  118 +// {
  119 +// babyQuery.setWeightEvaluate(grouwth.getEvaluate());
  120 +// }
  121 +// int count = babyBookbuildingService.queryBabyCount(babyQuery);
  122 +// grouwth.setCount(String.valueOf(count));
  123 +// }
  124 +// }
  125 +//
  126 +// return growths;
  127 +// }
  128 +// };
  129 +//
  130 +// Future f = pool.submit(c);
  131 +// futures.add(f);
  132 +// }
  133 +// for (Future f : futures) {
  134 +// try {
  135 +// results.addAll((List) f.get(30, TimeUnit.SECONDS));
  136 +// } catch (Exception e) {
  137 +// ExceptionUtils.catchException(e, "baby growth count");
  138 +// }
  139 +// }
  140 +// }
  141 +//
  142 +// return results;
  143 +// }
85 144 }