Commit 4fda458791c477d8dae1de271e2bd80bbd328d04
1 parent
64486c8b45
Exists in
master
and in
6 other branches
儿童营养报告
Showing 3 changed files with 189 additions and 11 deletions
platform-dal/src/main/java/com/lyms/platform/query/BabyNutritionQuery.java
View file @
4fda458
| ... | ... | @@ -24,15 +24,19 @@ |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | private String babyId; |
| 27 | + private List<String> babyIds; | |
| 27 | 28 | |
| 28 | 29 | private String hospitalId; |
| 29 | 30 | |
| 30 | 31 | private String doctorId; |
| 31 | 32 | |
| 32 | 33 | private Date createdStart; |
| 33 | - private Date modifiedEnd; | |
| 34 | + private Date createdEnd; | |
| 34 | 35 | |
| 36 | + private Date nutritiTimeStart; | |
| 37 | + private Date nutritiTimeEnd; | |
| 35 | 38 | |
| 39 | + | |
| 36 | 40 | @Override |
| 37 | 41 | public MongoQuery convertToQuery() { |
| 38 | 42 | MongoCondition condition = MongoCondition.newInstance(); |
| ... | ... | @@ -45,6 +49,9 @@ |
| 45 | 49 | if (null != babyId) { |
| 46 | 50 | condition = condition.and("babyId", babyId, MongoOper.IS); |
| 47 | 51 | } |
| 52 | + if (null != babyIds && babyIds.size() > 0) { | |
| 53 | + condition = condition.and("babyId", babyIds, MongoOper.IN); | |
| 54 | + } | |
| 48 | 55 | if (null != hospitalId) { |
| 49 | 56 | condition = condition.and("hospitalId", hospitalId, MongoOper.IS); |
| 50 | 57 | } |
| 51 | 58 | |
| 52 | 59 | |
| 53 | 60 | |
| ... | ... | @@ -54,13 +61,20 @@ |
| 54 | 61 | } |
| 55 | 62 | Criteria c = null; |
| 56 | 63 | |
| 57 | - if(null != createdStart && createdStart != null){ | |
| 64 | + if(null != createdStart && createdEnd != null){ | |
| 58 | 65 | if(c != null){ |
| 59 | - c = c.where("created").gte(createdStart).lte(createdStart); | |
| 66 | + c = c.where("created").gte(createdStart).lte(createdEnd); | |
| 60 | 67 | }else{ |
| 61 | - c = Criteria.where("created").gte(createdStart).lte(createdStart); | |
| 68 | + c = Criteria.where("created").gte(createdStart).lte(createdEnd); | |
| 62 | 69 | } |
| 63 | 70 | } |
| 71 | + if(null != nutritiTimeStart && nutritiTimeEnd != null){ | |
| 72 | + if(c != null){ | |
| 73 | + c = c.where("nutritiTime").gte(nutritiTimeStart).lte(nutritiTimeEnd); | |
| 74 | + }else{ | |
| 75 | + c = Criteria.where("nutritiTime").gte(nutritiTimeStart).lte(nutritiTimeEnd); | |
| 76 | + } | |
| 77 | + } | |
| 64 | 78 | |
| 65 | 79 | if (c != null) { |
| 66 | 80 | return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); |
| ... | ... | @@ -69,6 +83,38 @@ |
| 69 | 83 | } |
| 70 | 84 | |
| 71 | 85 | |
| 86 | + public Date getCreatedEnd() { | |
| 87 | + return createdEnd; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setCreatedEnd(Date createdEnd) { | |
| 91 | + this.createdEnd = createdEnd; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public Date getNutritiTimeStart() { | |
| 95 | + return nutritiTimeStart; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setNutritiTimeStart(Date nutritiTimeStart) { | |
| 99 | + this.nutritiTimeStart = nutritiTimeStart; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public Date getNutritiTimeEnd() { | |
| 103 | + return nutritiTimeEnd; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void setNutritiTimeEnd(Date nutritiTimeEnd) { | |
| 107 | + this.nutritiTimeEnd = nutritiTimeEnd; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public List<String> getBabyIds() { | |
| 111 | + return babyIds; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setBabyIds(List<String> babyIds) { | |
| 115 | + this.babyIds = babyIds; | |
| 116 | + } | |
| 117 | + | |
| 72 | 118 | public String getId() { |
| 73 | 119 | return id; |
| 74 | 120 | } |
| 75 | 121 | |
| ... | ... | @@ -125,12 +171,6 @@ |
| 125 | 171 | this.createdStart = createdStart; |
| 126 | 172 | } |
| 127 | 173 | |
| 128 | - public Date getModifiedEnd() { | |
| 129 | - return modifiedEnd; | |
| 130 | - } | |
| 131 | 174 | |
| 132 | - public void setModifiedEnd(Date modifiedEnd) { | |
| 133 | - this.modifiedEnd = modifiedEnd; | |
| 134 | - } | |
| 135 | 175 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyNutritionController.java
View file @
4fda458
| ... | ... | @@ -44,6 +44,30 @@ |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | + * 膳食列表 | |
| 48 | + * @param page | |
| 49 | + * @param limit | |
| 50 | + * @param queryNo | |
| 51 | + * @param vcCardNo | |
| 52 | + * @param babyName | |
| 53 | + * @param request | |
| 54 | + * @return | |
| 55 | + */ | |
| 56 | + @RequestMapping(value = "/queryBabyNutritionList", method = RequestMethod.GET) | |
| 57 | + @ResponseBody | |
| 58 | + @TokenRequired | |
| 59 | + public BaseResponse queryBabyNutritionList( @RequestParam("page") Integer page, | |
| 60 | + @RequestParam("limit") Integer limit, | |
| 61 | + @RequestParam(required = false)String queryNo, | |
| 62 | + @RequestParam(required = false)String vcCardNo, | |
| 63 | + @RequestParam(required = false)String babyName, | |
| 64 | + @RequestParam(required = false)String recordTime, | |
| 65 | + HttpServletRequest request){ | |
| 66 | + return babyNutritionFacade.queryBabyNutritionList(page, limit, queryNo, vcCardNo, babyName, getUserId(request),recordTime); | |
| 67 | + } | |
| 68 | + | |
| 69 | + | |
| 70 | + /** | |
| 47 | 71 | * 查询营养记录 |
| 48 | 72 | * @param babyId |
| 49 | 73 | * @return |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java
View file @
4fda458
| ... | ... | @@ -2,6 +2,9 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.*; |
| 4 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | +import com.lyms.platform.common.enums.SexEnum; | |
| 6 | +import com.lyms.platform.common.enums.YnEnums; | |
| 7 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 5 | 8 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 6 | 9 | import com.lyms.platform.common.result.BaseResponse; |
| 7 | 10 | import com.lyms.platform.common.utils.*; |
| ... | ... | @@ -20,6 +23,7 @@ |
| 20 | 23 | import org.apache.commons.lang.*; |
| 21 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | 25 | |
| 26 | +import org.springframework.data.domain.Sort; | |
| 23 | 27 | import org.springframework.stereotype.Component; |
| 24 | 28 | |
| 25 | 29 | import java.util.*; |
| ... | ... | @@ -38,6 +42,9 @@ |
| 38 | 42 | private BabyNutritionService babyNutritionService; |
| 39 | 43 | |
| 40 | 44 | @Autowired |
| 45 | + private BasicConfigFacade basicConfigFacade; | |
| 46 | + | |
| 47 | + @Autowired | |
| 41 | 48 | private MeasureDataInfoService mysqlMeasureDataInfoService; |
| 42 | 49 | |
| 43 | 50 | @Autowired |
| 44 | 51 | |
| ... | ... | @@ -46,7 +53,13 @@ |
| 46 | 53 | @Autowired |
| 47 | 54 | private OrganizationService organizationService; |
| 48 | 55 | |
| 56 | + @Autowired | |
| 57 | + private BabyBookbuildingService babyBookbuildingService; | |
| 49 | 58 | |
| 59 | + @Autowired | |
| 60 | + private BasicConfigService basicConfigService; | |
| 61 | + | |
| 62 | + | |
| 50 | 63 | public BaseObjectResponse queryBabyNutritionRecord(String babyId) { |
| 51 | 64 | Map<String, Object> resMap = new HashMap<>(); |
| 52 | 65 | BabyBasicResult base = new BabyBasicResult(); |
| 53 | 66 | |
| ... | ... | @@ -155,10 +168,111 @@ |
| 155 | 168 | |
| 156 | 169 | public List<FoodResult> getFoods(String ids) { |
| 157 | 170 | Map<String,String> map = new HashMap<String, String>(); |
| 158 | - map.put("ids",ids); | |
| 171 | + map.put("ids", ids); | |
| 159 | 172 | String data = HttpClientUtil.doGet(amsUrl + "/v1/getFoodsByIds", map, "utf-8", "3d19960bf3e81e7d816c4f26051c49ba"); |
| 160 | 173 | List<FoodResult> results = JsonUtil.toList(data, FoodResult.class); |
| 161 | 174 | return results; |
| 175 | + } | |
| 176 | + | |
| 177 | + public BaseResponse queryBabyNutritionList(Integer page, Integer limit, String queryNo, String vcCardNo, String babyName,Integer userId,String recordTime) { | |
| 178 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 179 | + List<Map> list = new ArrayList<>(); | |
| 180 | + List<String> babyIds = new ArrayList<>(); | |
| 181 | + BaseListResponse objectResponse = new BaseListResponse(); | |
| 182 | + | |
| 183 | + if (StringUtils.isNotEmpty(queryNo) || StringUtils.isNotEmpty(vcCardNo) || StringUtils.isNotEmpty(babyName)) | |
| 184 | + { | |
| 185 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 186 | + babyQuery.setName(babyName); | |
| 187 | + babyQuery.setQueryNo(queryNo); | |
| 188 | + babyQuery.setVcCardNo(vcCardNo); | |
| 189 | + babyQuery.setYn(YnEnums.YES.getId()); | |
| 190 | + List<BabyModel> babies = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
| 191 | + if (CollectionUtils.isNotEmpty(babies)) | |
| 192 | + { | |
| 193 | + for (BabyModel babyModel : babies) | |
| 194 | + { | |
| 195 | + babyIds.add(babyModel.getId()); | |
| 196 | + } | |
| 197 | + } | |
| 198 | + | |
| 199 | + if (CollectionUtils.isEmpty(babyIds)) | |
| 200 | + { | |
| 201 | + objectResponse.setData(list); | |
| 202 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 203 | + objectResponse.setErrormsg("成功"); | |
| 204 | + return objectResponse; | |
| 205 | + } | |
| 206 | + } | |
| 207 | + | |
| 208 | + BabyNutritionQuery babyQuery = new BabyNutritionQuery(); | |
| 209 | + babyQuery.setHospitalId(hospitalId); | |
| 210 | + babyQuery.setBabyIds(babyIds); | |
| 211 | + babyQuery.setLimit(limit); | |
| 212 | + babyQuery.setPage(page); | |
| 213 | + | |
| 214 | + if (StringUtils.isNotEmpty(recordTime)) { | |
| 215 | + String[] dates = recordTime.split(" - "); | |
| 216 | + babyQuery.setNutritiTimeStart(DateUtil.parseYMD(dates[0])); | |
| 217 | + if (dates.length == 2) { | |
| 218 | + babyQuery.setNutritiTimeEnd(DateUtil.addDay(DateUtil.parseYMD(dates[1]), 1)); | |
| 219 | + } | |
| 220 | + } | |
| 221 | + | |
| 222 | + babyQuery.setNeed("true"); | |
| 223 | + babyQuery.setSort(" nutritiTime desc "); | |
| 224 | + List<BabyNutritionModel> models = babyNutritionService.queryBabyNutritions(babyQuery); | |
| 225 | + | |
| 226 | + if (CollectionUtils.isNotEmpty(models)) | |
| 227 | + { | |
| 228 | + for (BabyNutritionModel model : models) | |
| 229 | + { | |
| 230 | + Map map = new HashMap(); | |
| 231 | + | |
| 232 | + map.put("id",model.getId()); | |
| 233 | + map.put("babyId",model.getBabyId()); | |
| 234 | + | |
| 235 | + BabyModel baby = babyBookbuildingService.queryBabyBuildById(model.getBabyId()); | |
| 236 | + map.put("babyName",baby.getName()); | |
| 237 | + map.put("babySex", SexEnum.getTextById(baby.getSex())); | |
| 238 | + map.put("monthAge",StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), new Date()))); | |
| 239 | + map.put("motherName", baby.getMname()); | |
| 240 | + map.put("phone", baby.getMphone()); | |
| 241 | + map.put("vcCardNo", baby.getVcCardNo()); | |
| 242 | + | |
| 243 | + String highRiskInfos = basicConfigFacade.queryBaseInfoByStr(baby.getHighRiskInfo()); | |
| 244 | + map.put("highRiskInfos",highRiskInfos); | |
| 245 | + | |
| 246 | + String diagnose = ""; | |
| 247 | + if (StringUtils.isNotEmpty(baby.getPid())) { | |
| 248 | + List diagList = babyCheckFacade.getBabyLastDiagnose(baby.getPid()); | |
| 249 | + if (CollectionUtils.isNotEmpty(diagList)) { | |
| 250 | + for (Object obj : diagList) { | |
| 251 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById((String) obj); | |
| 252 | + if (basicConfig != null) { | |
| 253 | + diagnose += basicConfig.getName() + " "; | |
| 254 | + } | |
| 255 | + } | |
| 256 | + } | |
| 257 | + } | |
| 258 | + | |
| 259 | + map.put("diagnose", StringUtils.emptyDeal(diagnose)); | |
| 260 | + | |
| 261 | + map.put("weight", model.getWeight()); | |
| 262 | + map.put("height", model.getHeight()); | |
| 263 | + map.put("recordTime", DateUtil.getyyyy_MM_dd(model.getNutritiTime())); | |
| 264 | + | |
| 265 | + list.add(map); | |
| 266 | + } | |
| 267 | + } | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + objectResponse.setData(list); | |
| 272 | + objectResponse.setPageInfo(babyQuery.getPageInfo()); | |
| 273 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 274 | + objectResponse.setErrormsg("成功"); | |
| 275 | + return objectResponse; | |
| 162 | 276 | } |
| 163 | 277 | } |