Commit 1f2e61d9903d66f823ff33b03b345adbd82bbcdd

Authored by shiyang
1 parent 1defc04769

隆化:0-6岁儿童健康体检统计表

Showing 5 changed files with 94 additions and 3 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBabyCheckDao.java View file @ 1f2e61d
... ... @@ -30,5 +30,7 @@
30 30 List<HashMap> babyStatisticsManagerWeekAgeGroup(MongoQuery mongoQuery);
31 31  
32 32 void updateBabyCheckBirthByBuild(BabyModel babyModel);
  33 +
  34 + List<HashMap> babyCheckBuildIdGroup(MongoQuery mongoQuery);
33 35 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyCheckDaoImpl.java View file @ 1f2e61d
... ... @@ -98,6 +98,13 @@
98 98 Update.update("birth", babyModel.getBirth()), BabyCheckModel.class);
99 99 }
100 100  
101   -
  101 + @Override
  102 + public List<HashMap> babyCheckBuildIdGroup(MongoQuery mongoQuery) {
  103 + AggregationOperation match = Aggregation.match(mongoQuery.getCriteria());
  104 + AggregationOperation group = Aggregation.group("buildId").max("created").as("created");;
  105 + Aggregation aggregation = Aggregation.newAggregation(match, group);
  106 + AggregationResults<HashMap> result = mongoTemplate.aggregate(aggregation, "lyms_babycheck", HashMap.class);
  107 + return result.getMappedResults();
  108 + }
102 109 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java View file @ 1f2e61d
... ... @@ -157,5 +157,8 @@
157 157  
158 158 babyCheckDao.updateBabyCheckBirthByBuild(babyModel);
159 159 }
  160 + public List<HashMap> babyCheckBuildIdGroup(BabyCheckModelQuery babyCheckModelQuery) {
  161 + return babyCheckDao.babyCheckBuildIdGroup(babyCheckModelQuery.convertToQuery());
  162 + }
160 163 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java View file @ 1f2e61d
... ... @@ -19,6 +19,7 @@
19 19 import com.lyms.platform.operate.web.utils.CollectionUtils;
20 20 import com.lyms.platform.permission.model.BabyDiagnoseQuery;
21 21 import com.lyms.platform.permission.service.CouponService;
  22 +import com.lyms.platform.query.BabyCheckModelQuery;
22 23 import com.lyms.platform.query.BabyModelQuery;
23 24 import org.apache.log4j.Logger;
24 25 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -32,6 +33,7 @@
32 33 import java.io.IOException;
33 34 import java.io.InputStream;
34 35 import java.io.UnsupportedEncodingException;
  36 +import java.util.Date;
35 37 import java.util.HashMap;
36 38 import java.util.List;
37 39 import java.util.Map;
... ... @@ -1036,6 +1038,31 @@
1036 1038 public BaseResponse queryBabyBuildStatistical(BabyModelQuery babyModelQuery,HttpServletRequest httpServletRequest) {
1037 1039 LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext");
1038 1040 return babyBookbuildingFacade.queryBabyBuildStatistical(babyModelQuery, loginState.getId());
  1041 + }
  1042 +
  1043 + /**
  1044 + * 0-6岁儿童健康体检统计表
  1045 + * @param httpServletRequest
  1046 + * @param checkDateStart
  1047 + * @param checkDateEnd
  1048 + * @param babyProvinceId 隆化定制省市县乡镇
  1049 + * @param babyCityId
  1050 + * @param babyAreaId
  1051 + * @param babyStreetId
  1052 + * @return
  1053 + */
  1054 + @RequestMapping(method = RequestMethod.GET, value = "/queryBabyCheck0_6Statistical")
  1055 + @ResponseBody
  1056 + @TokenRequired
  1057 + public BaseResponse queryBabyCheck0_6Statistical(HttpServletRequest httpServletRequest,
  1058 + @RequestParam(value = "checkDateStart", required = false) Date checkDateStart,
  1059 + @RequestParam(value = "checkDateEnd", required = false) Date checkDateEnd,
  1060 + @RequestParam(value = "babyProvinceId", required = false) String babyProvinceId,
  1061 + @RequestParam(value = "babyCityId", required = false) String babyCityId,
  1062 + @RequestParam(value = "babyAreaId", required = false) String babyAreaId,
  1063 + @RequestParam(value = "babyStreetId", required = false) String babyStreetId) {
  1064 + LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext");
  1065 + return babyBookbuildingFacade.queryBabyCheck0_6Statistical(checkDateStart,checkDateEnd,babyProvinceId,babyCityId,babyAreaId,babyStreetId ,loginState.getId());
1039 1066 }
1040 1067 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java View file @ 1f2e61d
... ... @@ -6227,8 +6227,60 @@
6227 6227 return new BaseObjectResponse().setData(map);
6228 6228 }
6229 6229  
6230   - public BaseResponse queryBabyCheck0_6Statistical(BabyModelQuery babyModelQuery, Integer id) {
6231   - return null;
  6230 + public BaseResponse queryBabyCheck0_6Statistical(Date checkDateStart, Date checkDateEnd, String babyProvinceId,
  6231 + String babyCityId, String babyAreaId, String babyStreetId, Integer userId) {
  6232 + //儿保检查分组
  6233 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  6234 + BabyCheckModelQuery babyCheckModelQuery=new BabyCheckModelQuery();
  6235 + babyCheckModelQuery.setHospitalId(hospitalId);
  6236 + babyCheckModelQuery.setYn(YnEnums.YES.getId());
  6237 + Date currentDate = DateUtil.formatDate(new Date());
  6238 + Date end_6 = DateUtil.addDay(DateUtil.addMonth(currentDate, -72 - 1), 1);
  6239 + babyCheckModelQuery.setBirthStart(end_6);
  6240 + babyCheckModelQuery.setBirthEnd(currentDate);
  6241 + babyCheckModelQuery.setCheckDateStart(checkDateStart);
  6242 + babyCheckModelQuery.setCheckDateEnd(DateUtil.getDayLastSecond(checkDateEnd));
  6243 + List<HashMap> hashMaps = babyCheckService.babyCheckBuildIdGroup(babyCheckModelQuery);
  6244 + List<Map> result=new ArrayList<>();
  6245 + for (Map map : hashMaps) {
  6246 + //儿童档案
  6247 + BabyModelQuery babyModelQuery=new BabyModelQuery();
  6248 + babyModelQuery.setId(map.get("_id").toString());
  6249 + if(StringUtils.isNotEmpty(babyProvinceId) && StringUtils.isNotEmpty(babyCityId) &&
  6250 + StringUtils.isNotEmpty(babyAreaId) && StringUtils.isNotEmpty(babyStreetId)){
  6251 + babyModelQuery.setBabyProvinceId(babyProvinceId);
  6252 + babyModelQuery.setBabyCityId(babyCityId);
  6253 + babyModelQuery.setBabyAreaId(babyAreaId);
  6254 + babyModelQuery.setBabyStreetId(babyStreetId);
  6255 + }
  6256 + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
  6257 + for (BabyModel babyModel : babyModels) {
  6258 + Map resultMap=new HashMap();
  6259 + String cunName=CommonsHelper.getName1(babyModel.getBabyStreetId(), basicConfigService);
  6260 + resultMap.put("cunName",cunName);
  6261 + resultMap.put("mName",babyModel.getMname());
  6262 + resultMap.put("name",babyModel.getName());
  6263 + resultMap.put("birth",DateUtil.getYyyyMmDd(babyModel.getBirth()));
  6264 + resultMap.put("mPhone",babyModel.getMphone());
  6265 + //每个人的儿保检查信息
  6266 + babyCheckModelQuery=new BabyCheckModelQuery();
  6267 + babyCheckModelQuery.setBuildId(babyModel.getId());
  6268 + List<BabyCheckModel> babyCheckModels = babyCheckService.queryBabyCheckRecord(babyCheckModelQuery);
  6269 + List<Map> tcTypeList=new ArrayList<>();
  6270 + for (BabyCheckModel babyCheckModel : babyCheckModels) {
  6271 + Map tcTypeMap=new HashMap();
  6272 + tcTypeMap.put("tcType",babyCheckModel.getTcType());
  6273 + tcTypeMap.put("checkData",DateUtil.getMM_dd(babyCheckModel.getCheckDate()));
  6274 + tcTypeList.add(tcTypeMap);
  6275 + }
  6276 + resultMap.put("tcTypeList",tcTypeList);
  6277 + result.add(resultMap);
  6278 + }
  6279 +
  6280 + }
  6281 +
  6282 + return new BaseObjectResponse().setData(result);
  6283 +
6232 6284 }
6233 6285 }