Commit 69ea88f4228bd77fe228c3d9e4fcda81db7d61ac

Authored by wangbo
1 parent 056f4ee039

Merge branch 'master' of F:\workspace with conflicts.

Showing 5 changed files with 512 additions and 319 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java View file @ 69ea88f
... ... @@ -4210,7 +4210,7 @@
4210 4210 continue;
4211 4211 case 2:
4212 4212 List<String> list2 = Arrays.asList(str.split("\n"));
4213   - babyDiet.setWeeklyRecipes(list2);
  4213 + babyDiet.setOneDayRecipes(list2);
4214 4214 continue;
4215 4215 case 3:
4216 4216 List<String> list3 = Arrays.asList(str.split("\n"));
... ... @@ -4225,7 +4225,7 @@
4225 4225 }
4226 4226  
4227 4227 Sheet s1 = wb.getSheet(1);
4228   - System.out.println(s.getName() + " : ");
  4228 + System.out.println(s1.getName() + " : ");
4229 4229 int rows1 = s1.getRows();
4230 4230 if (rows1 > 0) {
4231 4231 for (int i = 1; i < rows1; i++) {
... ... @@ -4243,7 +4243,7 @@
4243 4243 babyDiet.setMonthAge(Integer.parseInt(str));
4244 4244 continue;
4245 4245 case 1:
4246   - babyDiet.setKcal(str);
  4246 + babyDiet.setKcal(Integer.parseInt(str));
4247 4247 continue;
4248 4248 case 2:
4249 4249 List<String> list1 = Arrays.asList(str.split("\n"));
4250 4250  
... ... @@ -4300,7 +4300,195 @@
4300 4300 }
4301 4301 }
4302 4302  
  4303 + Sheet s3 = wb.getSheet(3);
  4304 + System.out.println(s3.getName() + " : ");
  4305 + int rows3 = s3.getRows();
  4306 + if (rows3 > 0) {
  4307 + //遍历每行
  4308 + for (int i = 1; i < rows3; i++) {
  4309 + System.out.println("rows=" + i);
  4310 + BabyDietReportModel babyDiet = new BabyDietReportModel();
  4311 + Cell[] cells = s3.getRow(i);
  4312 + if (cells.length > 0) {
  4313 + //遍历每行中的每列
  4314 + for (int j = 0; j < cells.length; j++) {
  4315 + String str = cells[j].getContents().trim();
  4316 + switch (j) {
  4317 + case 0:
  4318 + babyDiet.setStartMonthAge(Integer.parseInt(str));
  4319 + continue;
  4320 + case 1:
  4321 + babyDiet.setEndMonthAge(Integer.parseInt(str));
  4322 + continue;
  4323 + case 2:
  4324 + babyDiet.setKcal(Integer.parseInt(str));
  4325 + continue;
  4326 + case 3:
  4327 + babyDiet.setShape(Integer.parseInt(str));
  4328 + continue;
  4329 + case 4:
  4330 + List<String> list2 = Arrays.asList(str.split("\n"));
  4331 + babyDiet.setDietStructure(list2);
  4332 + continue;
  4333 + case 5:
  4334 + List<String> list3 = Arrays.asList(str.split("\n"));
  4335 + babyDiet.setOneDayRecipes(list3);
  4336 + continue;
  4337 + case 6:
  4338 + List<String> list4 = Arrays.asList(str.split("\n"));
  4339 + babyDiet.setRecommendRecipes(list4);
  4340 + continue;
  4341 + }
  4342 + }
4303 4343  
  4344 + }
  4345 + mongoTemplate.save(babyDiet);
  4346 + }
  4347 + }
  4348 +
  4349 +
  4350 + Sheet s4 = wb.getSheet(4);
  4351 + System.out.println(s4.getName() + " : ");
  4352 + int rows4 = s4.getRows();
  4353 + if (rows4 > 0) {
  4354 + //遍历每行
  4355 + for (int i = 1; i < rows4; i++) {
  4356 + System.out.println("rows=" + i);
  4357 + BabyDietReportModel babyDiet = new BabyDietReportModel();
  4358 + Cell[] cells = s4.getRow(i);
  4359 + if (cells.length > 0) {
  4360 + //遍历每行中的每列
  4361 + for (int j = 0; j < cells.length; j++) {
  4362 + String str = cells[j].getContents().trim();
  4363 + switch (j) {
  4364 + case 0:
  4365 + babyDiet.setKcal(Integer.parseInt(str));
  4366 + continue;
  4367 + case 1:
  4368 + babyDiet.setMonthAge(Integer.parseInt(str));
  4369 + continue;
  4370 + case 2:
  4371 + babyDiet.setShape(Integer.parseInt(str));
  4372 + continue;
  4373 + case 3:
  4374 + List<String> list2 = Arrays.asList(str.split("\n"));
  4375 + babyDiet.setDietStructure(list2);
  4376 + continue;
  4377 + case 4:
  4378 + List<String> list3 = Arrays.asList(str.split("\n"));
  4379 + babyDiet.setOneDayRecipes(list3);
  4380 + continue;
  4381 + case 5:
  4382 + List<String> list4 = Arrays.asList(str.split("\n"));
  4383 + babyDiet.setRecommendRecipes(list4);
  4384 + continue;
  4385 + }
  4386 + }
  4387 +
  4388 + }
  4389 + mongoTemplate.save(babyDiet);
  4390 + }
  4391 + }
  4392 +
  4393 + Sheet s5 = wb.getSheet(5);
  4394 + System.out.println(s5.getName() + " : ");
  4395 + int rows5 = s5.getRows();
  4396 + if (rows5 > 0) {
  4397 + //遍历每行
  4398 + for (int i = 1; i < rows5; i++) {
  4399 + System.out.println("rows=" + i);
  4400 + BabyDietReportModel babyDiet = new BabyDietReportModel();
  4401 + Cell[] cells = s5.getRow(i);
  4402 + if (cells.length > 0) {
  4403 + //遍历每行中的每列
  4404 + for (int j = 0; j < cells.length; j++) {
  4405 + String str = cells[j].getContents().trim();
  4406 + switch (j) {
  4407 + case 0:
  4408 + babyDiet.setStartMonthAge(Integer.parseInt(str));
  4409 + continue;
  4410 + case 1:
  4411 + babyDiet.setEndMonthAge(Integer.parseInt(str));
  4412 + continue;
  4413 + case 2:
  4414 + List<String> list4 = Arrays.asList(str.split("\n"));
  4415 + babyDiet.setFeedingGuide(list4);
  4416 + continue;
  4417 + }
  4418 + }
  4419 +
  4420 + }
  4421 + mongoTemplate.save(babyDiet);
  4422 + }
  4423 + }
  4424 +
  4425 + Sheet s6 = wb.getSheet(6);
  4426 + System.out.println(s6.getName() + " : ");
  4427 + int rows6 = s6.getRows();
  4428 + if (rows6 > 0) {
  4429 + //遍历每行
  4430 + for (int i = 1; i < rows6; i++) {
  4431 + System.out.println("rows=" + i);
  4432 + BabyDietReportModel babyDiet = new BabyDietReportModel();
  4433 + Cell[] cells = s6.getRow(i);
  4434 + if (cells.length > 0) {
  4435 + //遍历每行中的每列
  4436 + for (int j = 0; j < cells.length; j++) {
  4437 + String str = cells[j].getContents().trim();
  4438 + switch (j) {
  4439 + case 0:
  4440 + babyDiet.setShape(Integer.parseInt(str));
  4441 +
  4442 + continue;
  4443 + case 1:
  4444 + babyDiet.setStartMonthAge(Integer.parseInt(str));
  4445 + continue;
  4446 + case 2:
  4447 + babyDiet.setEndMonthAge(Integer.parseInt(str));
  4448 + continue;
  4449 + case 3:
  4450 + List<String> list1 = Arrays.asList(str.split("\n"));
  4451 + babyDiet.setDietStructure(list1);
  4452 + continue;
  4453 + case 4:
  4454 + List<String> list2 = Arrays.asList(str.split("\n"));
  4455 + babyDiet.setRecommendRecipes(list2);
  4456 + continue;
  4457 + case 5:
  4458 + List<String> list3 = Arrays.asList(str.split("\n"));
  4459 + babyDiet.setMonday(list3);
  4460 + continue;
  4461 + case 6:
  4462 + List<String> list4 = Arrays.asList(str.split("\n"));
  4463 + babyDiet.setTuesday(list4);
  4464 + continue;
  4465 + case 7:
  4466 + List<String> list5 = Arrays.asList(str.split("\n"));
  4467 + babyDiet.setWednesday(list5);
  4468 + continue;
  4469 + case 8:
  4470 + List<String> list6 = Arrays.asList(str.split("\n"));
  4471 + babyDiet.setThursday(list6);
  4472 + continue;
  4473 + case 9:
  4474 + List<String> list7 = Arrays.asList(str.split("\n"));
  4475 + babyDiet.setFriday(list7);
  4476 + continue;
  4477 + case 10:
  4478 + List<String> list8 = Arrays.asList(str.split("\n"));
  4479 + babyDiet.setSaturday(list8);
  4480 + continue;
  4481 + case 11:
  4482 + List<String> list9 = Arrays.asList(str.split("\n"));
  4483 + babyDiet.setSunday(list9);
  4484 + continue;
  4485 + }
  4486 + }
  4487 +
  4488 + }
  4489 + mongoTemplate.save(babyDiet);
  4490 + }
  4491 + }
4304 4492  
4305 4493 } catch (IOException e) {
4306 4494 e.printStackTrace();
platform-dal/src/main/java/com/lyms/platform/pojo/BabyDietReportModel.java View file @ 69ea88f
... ... @@ -12,29 +12,116 @@
12 12 private Integer monthAge;
13 13  
14 14 //热量值
15   - private String kcal;
  15 + private Integer kcal;
16 16  
17 17 //膳食结构
18 18 private List<String> dietStructure;
19 19  
20   - //一周参考食谱
21   - private List<String> weeklyRecipes;
22   -
23 20 //推荐食谱
24 21 private List<String> recommendRecipes;
25 22 //超重消瘦一日喂养指南
26 23 private List<String> oneDayRecipes;
27   -
28 24 //6-11月膳食结构正常消瘦超重类型 0 正常 1超重消瘦
29 25 private Integer weightType;
30   -
31 26 //喂养方式 0 母乳喂养 1.混合喂养 2 人工喂养
32 27 private Integer feedingPattern;
33 28 //体型 0 消瘦 1.正常 2.超重
34 29 private Integer shape;
35   - //喂养方式
  30 + //喂养指南
36 31 private List<String> feedingGuide;
37 32  
  33 + private Integer startMonthAge;
  34 +
  35 + private Integer endMonthAge;
  36 +
  37 + //周一
  38 + private List<String> monday;
  39 + //周二
  40 + private List<String> tuesday;
  41 + //周三
  42 + private List<String> wednesday;
  43 + //周四
  44 + private List<String> thursday;
  45 + //周五
  46 + private List<String> friday;
  47 + //周六
  48 + private List<String> saturday;
  49 + //周日
  50 + private List<String> sunday;
  51 +
  52 +
  53 + public List<String> getMonday() {
  54 + return monday;
  55 + }
  56 +
  57 + public void setMonday(List<String> monday) {
  58 + this.monday = monday;
  59 + }
  60 +
  61 + public List<String> getTuesday() {
  62 + return tuesday;
  63 + }
  64 +
  65 + public void setTuesday(List<String> tuesday) {
  66 + this.tuesday = tuesday;
  67 + }
  68 +
  69 + public List<String> getWednesday() {
  70 + return wednesday;
  71 + }
  72 +
  73 + public void setWednesday(List<String> wednesday) {
  74 + this.wednesday = wednesday;
  75 + }
  76 +
  77 + public List<String> getThursday() {
  78 + return thursday;
  79 + }
  80 +
  81 + public void setThursday(List<String> thursday) {
  82 + this.thursday = thursday;
  83 + }
  84 +
  85 + public List<String> getFriday() {
  86 + return friday;
  87 + }
  88 +
  89 + public void setFriday(List<String> friday) {
  90 + this.friday = friday;
  91 + }
  92 +
  93 + public List<String> getSaturday() {
  94 + return saturday;
  95 + }
  96 +
  97 + public void setSaturday(List<String> saturday) {
  98 + this.saturday = saturday;
  99 + }
  100 +
  101 + public List<String> getSunday() {
  102 + return sunday;
  103 + }
  104 +
  105 + public void setSunday(List<String> sunday) {
  106 + this.sunday = sunday;
  107 + }
  108 +
  109 + public Integer getStartMonthAge() {
  110 + return startMonthAge;
  111 + }
  112 +
  113 + public void setStartMonthAge(Integer startMonthAge) {
  114 + this.startMonthAge = startMonthAge;
  115 + }
  116 +
  117 + public Integer getEndMonthAge() {
  118 + return endMonthAge;
  119 + }
  120 +
  121 + public void setEndMonthAge(Integer endMonthAge) {
  122 + this.endMonthAge = endMonthAge;
  123 + }
  124 +
38 125 public String getId() {
39 126 return id;
40 127 }
41 128  
... ... @@ -59,11 +146,11 @@
59 146 this.recommendRecipes = recommendRecipes;
60 147 }
61 148  
62   - public String getKcal() {
  149 + public Integer getKcal() {
63 150 return kcal;
64 151 }
65 152  
66   - public void setKcal(String kcal) {
  153 + public void setKcal(Integer kcal) {
67 154 this.kcal = kcal;
68 155 }
69 156  
... ... @@ -74,15 +161,6 @@
74 161 public void setDietStructure(List<String> dietStructure) {
75 162 this.dietStructure = dietStructure;
76 163 }
77   -
78   - public List<String> getWeeklyRecipes() {
79   - return weeklyRecipes;
80   - }
81   -
82   - public void setWeeklyRecipes(List<String> weeklyRecipes) {
83   - this.weeklyRecipes = weeklyRecipes;
84   - }
85   -
86 164  
87 165 public List<String> getOneDayRecipes() {
88 166 return oneDayRecipes;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyNutritionController.java View file @ 69ea88f
... ... @@ -126,8 +126,10 @@
126 126 * 秦皇岛儿童膳食报告模板
127 127 */
128 128 @RequestMapping(value = "/queryBabyDietReport/{id}", method = RequestMethod.GET)
  129 + @ResponseBody
  130 + @TokenRequired
129 131 public BaseObjectResponse queryBabyDietReport(@PathVariable("id") String id, HttpServletRequest request) {
130   - return null;
  132 + return babyNutritionFacade.queryBabyDietReport(id, getUserId(request));
131 133 }
132 134  
133 135 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java View file @ 69ea88f
... ... @@ -419,6 +419,8 @@
419 419  
420 420  
421 421 //新加字段
  422 +
  423 +
422 424 return model;
423 425 }
424 426  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java View file @ 69ea88f
Diff suppressed. Click to show
... ... @@ -94,16 +94,14 @@
94 94  
95 95 BabyNutritionQuery babyQuery = new BabyNutritionQuery();
96 96 babyQuery.setBabyId(babyId);
97   - List<BabyNutritionModel> models = babyNutritionService.queryBabyNutritions(babyQuery,"nutritiTime", Sort.Direction.ASC);
98   - if (CollectionUtils.isNotEmpty(models))
99   - {
100   - for (BabyNutritionModel model : models)
101   - {
  97 + List<BabyNutritionModel> models = babyNutritionService.queryBabyNutritions(babyQuery, "nutritiTime", Sort.Direction.ASC);
  98 + if (CollectionUtils.isNotEmpty(models)) {
  99 + for (BabyNutritionModel model : models) {
102 100 Map<String, String> map = new HashMap<>();
103   - map.put("id",model.getId());
104   - map.put("babyId",model.getBabyId());
105   - map.put("recordTime",DateUtil.getyyyy_MM_dd(model.getNutritiTime()));
106   - map.put("hospitalId",model.getHospitalId());
  101 + map.put("id", model.getId());
  102 + map.put("babyId", model.getBabyId());
  103 + map.put("recordTime", DateUtil.getyyyy_MM_dd(model.getNutritiTime()));
  104 + map.put("hospitalId", model.getHospitalId());
107 105 list.add(map);
108 106 }
109 107 }
110 108  
... ... @@ -119,15 +117,13 @@
119 117 return br;
120 118 }
121 119  
122   - private Map getBabyMeasureInfo(String babyId)
123   - {
  120 + private Map getBabyMeasureInfo(String babyId) {
124 121 Map map = new HashMap();
125 122 MeasureBabyDataInfoQuery query = new MeasureBabyDataInfoQuery();
126 123 query.setBabyId(babyId);
127 124 query.setSort(" modified desc ");
128   - List<MeasureBabyInfoModel> models = mysqlMeasureDataInfoService.queryMeasureBabyInfoList(query);
129   - if (CollectionUtils.isNotEmpty(models))
130   - {
  125 + List<MeasureBabyInfoModel> models = mysqlMeasureDataInfoService.queryMeasureBabyInfoList(query);
  126 + if (CollectionUtils.isNotEmpty(models)) {
131 127 MeasureBabyInfoModel model = models.get(0);
132 128 map.put("weight", model.getValueTwo());
133 129 map.put("hegiht", model.getValueOne());
134 130  
135 131  
... ... @@ -136,18 +132,15 @@
136 132 return map;
137 133 }
138 134  
139   - public BaseResponse addOrUpBabyNutrition(BabyNutritionRequest request,Integer userId) {
  135 + public BaseResponse addOrUpBabyNutrition(BabyNutritionRequest request, Integer userId) {
140 136  
141 137 String hospitalId = autoMatchFacade.getHospitalId(userId);
142 138  
143 139 BabyNutritionModel model = request.convertToDataModel();
144   - if (StringUtils.isNotEmpty(model.getId()))
145   - {
  140 + if (StringUtils.isNotEmpty(model.getId())) {
146 141 model.setModified(new Date());
147   - babyNutritionService.updateBabyNutrition(model,model.getId());
148   - }
149   - else
150   - {
  142 + babyNutritionService.updateBabyNutrition(model, model.getId());
  143 + } else {
151 144 model.setHospitalId(hospitalId);
152 145 model.setModified(new Date());
153 146 model.setCreated(new Date());
... ... @@ -163,9 +156,8 @@
163 156  
164 157 BabyNutritionQuery babyQuery = new BabyNutritionQuery();
165 158 babyQuery.setId(id);
166   - List<BabyNutritionModel> models = babyNutritionService.queryBabyNutritions(babyQuery);
167   - if (CollectionUtils.isNotEmpty(models))
168   - {
  159 + List<BabyNutritionModel> models = babyNutritionService.queryBabyNutritions(babyQuery);
  160 + if (CollectionUtils.isNotEmpty(models)) {
169 161 BabyNutritionResult result = new BabyNutritionResult();
170 162 result.convertToResult(models.get(0));
171 163 Organization org = organizationService.getOrganization(Integer.parseInt(result.getHospitalId()));
... ... @@ -180,7 +172,7 @@
180 172  
181 173 public BaseObjectResponse queryBabyNutritionFood() {
182 174 BaseObjectResponse objectResponse = new BaseObjectResponse();
183   - Map<String,String> map = new HashMap<String, String>();
  175 + Map<String, String> map = new HashMap<String, String>();
184 176 String data = HttpClientUtil.doGet(amsUrl + "/v1/getPlatfromCategoryFoods", map, "utf-8", "3d19960bf3e81e7d816c4f26051c49ba");
185 177 NutritionFoodResult result = JsonUtil.jkstr2Obj(data, NutritionFoodResult.class);
186 178 objectResponse.setData(result);
... ... @@ -191,7 +183,7 @@
191 183  
192 184  
193 185 public List<FoodResult> getFoods(String ids) {
194   - Map<String,String> map = new HashMap<String, String>();
  186 + Map<String, String> map = new HashMap<String, String>();
195 187 map.put("ids", ids);
196 188 String data = HttpClientUtil.doGet(amsUrl + "/v1/getFoodsByIds", map, "utf-8", "3d19960bf3e81e7d816c4f26051c49ba");
197 189 FoodBaseResult foodBaseResult = JsonUtil.jkstr2Obj(data, FoodBaseResult.class);
198 190  
199 191  
... ... @@ -219,24 +211,20 @@
219 211 List<String> babyIds = new ArrayList<>();
220 212 BaseListResponse objectResponse = new BaseListResponse();
221 213  
222   - if (StringUtils.isNotEmpty(queryNo) || StringUtils.isNotEmpty(vcCardNo) || StringUtils.isNotEmpty(babyName))
223   - {
  214 + if (StringUtils.isNotEmpty(queryNo) || StringUtils.isNotEmpty(vcCardNo) || StringUtils.isNotEmpty(babyName)) {
224 215 BabyModelQuery babyQuery = new BabyModelQuery();
225 216 babyQuery.setName(babyName);
226 217 babyQuery.setQueryNo(queryNo);
227 218 babyQuery.setVcCardNo(vcCardNo);
228 219 babyQuery.setYn(YnEnums.YES.getId());
229 220 List<BabyModel> babies = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
230   - if (CollectionUtils.isNotEmpty(babies))
231   - {
232   - for (BabyModel babyModel : babies)
233   - {
  221 + if (CollectionUtils.isNotEmpty(babies)) {
  222 + for (BabyModel babyModel : babies) {
234 223 babyIds.add(babyModel.getId());
235 224 }
236 225 }
237 226  
238   - if (CollectionUtils.isEmpty(babyIds))
239   - {
  227 + if (CollectionUtils.isEmpty(babyIds)) {
240 228 objectResponse.setData(list);
241 229 objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
242 230 objectResponse.setErrormsg("成功");
243 231  
244 232  
245 233  
246 234  
... ... @@ -260,30 +248,26 @@
260 248 }
261 249 }
262 250 babyQuery.setNeed("true");
263   - List<BabyNutritionModel> models = babyNutritionService.queryBabyNutritions(babyQuery,"nutritiTime", Sort.Direction.DESC);
  251 + List<BabyNutritionModel> models = babyNutritionService.queryBabyNutritions(babyQuery, "nutritiTime", Sort.Direction.DESC);
264 252  
265   - if (CollectionUtils.isNotEmpty(models))
266   - {
267   - for (BabyNutritionModel model : models)
268   - {
269   - Integer currentSettleStatus = getSettleStatus(model);
270   - if (settleStatus != null){
271   - if (currentSettleStatus != null && (currentSettleStatus == Integer.parseInt(settleStatus))){
272   - Map map = new HashMap();
273   - map.put("id",model.getId());
274   - map.put("babyId",model.getBabyId());
  253 + if (CollectionUtils.isNotEmpty(models)) {
  254 + for (BabyNutritionModel model : models) {
  255 + Map map = new HashMap();
275 256  
276   - BabyModel baby = babyBookbuildingService.queryBabyBuildById(model.getBabyId());
277   - map.put("babyName",baby.getName());
278   - map.put("babySex", SexEnum.getTextById(baby.getSex()));
279   - map.put("monthAge",StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), new Date())));
280   - map.put("motherName", baby.getMname());
281   - map.put("phone", baby.getMphone());
282   - map.put("vcCardNo", baby.getVcCardNo());
  257 + map.put("id", model.getId());
  258 + map.put("babyId", model.getBabyId());
283 259  
284   - String highRiskInfos = basicConfigFacade.queryBaseInfoByStr(baby.getHighRiskInfo());
285   - map.put("highRiskInfos",highRiskInfos);
  260 + BabyModel baby = babyBookbuildingService.queryBabyBuildById(model.getBabyId());
  261 + map.put("babyName", baby.getName());
  262 + map.put("babySex", SexEnum.getTextById(baby.getSex()));
  263 + map.put("monthAge", StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), new Date())));
  264 + map.put("motherName", baby.getMname());
  265 + map.put("phone", baby.getMphone());
  266 + map.put("vcCardNo", baby.getVcCardNo());
286 267  
  268 + String highRiskInfos = basicConfigFacade.queryBaseInfoByStr(baby.getHighRiskInfo());
  269 + map.put("highRiskInfos", highRiskInfos);
  270 +
287 271 String diagnose = "";
288 272 if (StringUtils.isNotEmpty(baby.getPid())) {
289 273 List diagList = babyCheckFacade.getBabyLastDiagnose(baby.getPid());
... ... @@ -323,7 +307,6 @@
323 307 }
324 308  
325 309  
326   -
327 310 objectResponse.setData(list);
328 311 objectResponse.setPageInfo(babyQuery.getPageInfo());
329 312 objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
... ... @@ -331,6 +314,7 @@
331 314 return objectResponse;
332 315 }
333 316  
  317 + public BaseObjectResponse queryBabyNutritionReport(String id, Integer userId) {
334 318 /**
335 319 * 获取结算状态
336 320 *
337 321  
338 322  
... ... @@ -358,18 +342,17 @@
358 342 babyQuery.setHospitalId(hospitalId);
359 343 babyQuery.setId(id);
360 344  
361   - List<BabyNutritionModel> models = babyNutritionService.queryBabyNutritions(babyQuery);
362   - if (CollectionUtils.isNotEmpty(models))
363   - {
364   - BabyNutritionModel model = models.get(0);
  345 + List<BabyNutritionModel> models = babyNutritionService.queryBabyNutritions(babyQuery);
  346 + if (CollectionUtils.isNotEmpty(models)) {
  347 + BabyNutritionModel model = models.get(0);
365 348 BabyModel baby = babyBookbuildingService.queryBabyBuildById(model.getBabyId());
366 349  
367 350 Map map = new HashMap();
368   - map.put("id",model.getId());
369   - map.put("babyId",model.getBabyId());
370   - map.put("babyName",baby.getName());
  351 + map.put("id", model.getId());
  352 + map.put("babyId", model.getBabyId());
  353 + map.put("babyName", baby.getName());
371 354 map.put("babySex", SexEnum.getTextById(baby.getSex()));
372   - map.put("monthAge",StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), new Date())));
  355 + map.put("monthAge", StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), new Date())));
373 356 map.put("motherName", baby.getMname());
374 357 map.put("phone", baby.getMphone());
375 358 map.put("vcCardNo", baby.getVcCardNo());
376 359  
377 360  
... ... @@ -377,16 +360,15 @@
377 360 map.put("height", model.getHeight());
378 361 Organization org = organizationService.getOrganization(Integer.parseInt(hospitalId));
379 362 map.put("hospitalName", org.getName());
380   - map.put("reportMonthAge",StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), model.getNutritiTime())));
  363 + map.put("reportMonthAge", StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), model.getNutritiTime())));
381 364  
382 365  
383 366 int month = DateUtil.getMonth(baby.getBirth(), model.getNutritiTime());
384 367  
385   - if (month > 36)
386   - {
  368 + if (month > 36) {
387 369 return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("月龄范围没有报告");
388 370 }
389   - String bmi = patientWeightService.getBmi(String.valueOf(model.getWeight()),String.valueOf(model.getHeight()));
  371 + String bmi = patientWeightService.getBmi(String.valueOf(model.getWeight()), String.valueOf(model.getHeight()));
390 372 String kaupEvaluate = getBabyStatus(month, baby.getSex(), model.getHeight(), model.getWeight(), bmi);
391 373  
392 374 double kaul = getKal(month, model.getWeight(), model.getHeight(), baby.getSex(), kaupEvaluate);
393 375  
394 376  
... ... @@ -395,15 +377,13 @@
395 377 map.put("kaupEvaluate", kaupEvaluate);
396 378 map.put("month", month);
397 379 map.put("bmi", bmi);
398   - map.put("kaul", String.format("%.1f",valueKaul));
  380 + map.put("kaul", String.format("%.1f", valueKaul));
399 381 data.put("baseInfo", map);
400 382  
401   - if (month < 12)
402   - {
  383 + if (month < 12) {
403 384 //根据喂养方式获取 合理喂养
404 385 Criteria ca = Criteria.where("monthAge").is(month).and("type").is(0).and("status").is(kaupEvaluate);
405   - if (month < 7 && StringUtils.isNotEmpty(model.getFeedType()))
406   - {
  386 + if (month < 7 && StringUtils.isNotEmpty(model.getFeedType())) {
407 387 String feedType = WyTypeEnums.getNameById(Integer.parseInt(model.getFeedType()));
408 388 ca.and("feedType").is(feedType);
409 389  
410 390  
411 391  
412 392  
413 393  
414 394  
415 395  
416 396  
417 397  
418 398  
419 399  
... ... @@ -420,56 +400,50 @@
420 400 Query.query(Criteria.where("monthAge").is(month).and("type").is(1)), BabyNutritionConfigModel.class);
421 401  
422 402 //每月营养素需求
423   - data.put("yysxq",babyNutritionConfig1.getContentOne());
  403 + data.put("yysxq", babyNutritionConfig1.getContentOne());
424 404  
425   - if (month > 5)
426   - {
  405 + if (month > 5) {
427 406 Double val = getMathRound(kaul);
428 407 BabyNutritionConfigModel babyNutritionConfig2 = mongoTemplate.findOne(
429 408 Query.query(Criteria.where("monthAge").is(month).and("type").is(6).and("kcal").is(val)), BabyNutritionConfigModel.class);
430 409  
431   - if (babyNutritionConfig2 != null)
432   - {
  410 + if (babyNutritionConfig2 != null) {
433 411 //食用须知
434   - data.put("syxz",babyNutritionConfig2.getContentOne());
  412 + data.put("syxz", babyNutritionConfig2.getContentOne());
435 413 //辅食添加
436   - data.put("fstj",babyNutritionConfig2.getContentTwo());
  414 + data.put("fstj", babyNutritionConfig2.getContentTwo());
437 415 //辅食制作
438   - data.put("fszz",babyNutritionConfig2.getContentThree());
  416 + data.put("fszz", babyNutritionConfig2.getContentThree());
439 417 }
440 418  
441 419 }
442 420  
443   - }
444   - else
445   - {
  421 + } else {
446 422 BabyNutritionConfigModel babyNutritionConfig1 = mongoTemplate.findOne(
447 423 Query.query(Criteria.where("monthAge").is(month).and("type").is(2)), BabyNutritionConfigModel.class);
448 424 //各月龄饮食指南
449   - data.put("yszl",babyNutritionConfig1.getContentOne());
  425 + data.put("yszl", babyNutritionConfig1.getContentOne());
450 426  
451 427  
452 428 int tempMonth = month < 36 ? 12 : 36;
453 429 List<BabyNutritionConfigModel> configModels = mongoTemplate.find(Query.query(
454 430 Criteria.where("kcal").is(kaul).and("status").is(kaupEvaluate).and("type").is(3).and("monthAge").is(tempMonth)), BabyNutritionConfigModel.class);
455   - if (CollectionUtils.isNotEmpty(configModels) && configModels.size() == 3)
456   - {
457   - List<Map<String,Object>> list = new ArrayList<>();
458   - for (BabyNutritionConfigModel configModel : configModels)
459   - {
460   - Map<String,Object> map1 = new HashMap<>();
461   - map1.put("title",configModel.getTitle());
462   - map1.put("contents",configModel.getContentOne());
  431 + if (CollectionUtils.isNotEmpty(configModels) && configModels.size() == 3) {
  432 + List<Map<String, Object>> list = new ArrayList<>();
  433 + for (BabyNutritionConfigModel configModel : configModels) {
  434 + Map<String, Object> map1 = new HashMap<>();
  435 + map1.put("title", configModel.getTitle());
  436 + map1.put("contents", configModel.getContentOne());
463 437 list.add(map1);
464 438 }
465 439 //热量计算
466   - data.put("foods",list);
  440 + data.put("foods", list);
467 441 }
468 442  
469 443  
470 444 List<String> yys = getYys(month);
471 445 //每日所需营养素
472   - data.put("yys",yys);
  446 + data.put("yys", yys);
473 447  
474 448 }
475 449  
476 450  
477 451  
478 452  
479 453  
480 454  
481 455  
482 456  
483 457  
484 458  
485 459  
486 460  
487 461  
488 462  
489 463  
490 464  
491 465  
492 466  
493 467  
494 468  
495 469  
496 470  
497 471  
498 472  
499 473  
500 474  
501 475  
502 476  
503 477  
... ... @@ -478,119 +452,108 @@
478 452  
479 453 List<Map> wlysMapList = new ArrayList<>();
480 454  
481   - Map<String,Double> elements = new HashMap();
  455 + Map<String, Double> elements = new HashMap();
482 456  
483 457 List<Map> mainFoods = model.getMainFood();
484   - getFoodElements(elements,mainFoods);
  458 + getFoodElements(elements, mainFoods);
485 459  
486 460 List<Map> vegYj = model.getVegYj();
487   - getFoodElements(elements,vegYj);
  461 + getFoodElements(elements, vegYj);
488 462  
489 463 List<Map> vegGj = model.getVegGj();
490   - getFoodElements(elements,vegGj);
  464 + getFoodElements(elements, vegGj);
491 465  
492 466 List<Map> vegGq = model.getVegGq();
493   - getFoodElements(elements,vegGq);
  467 + getFoodElements(elements, vegGq);
494 468  
495 469 List<Map> vegHc = model.getVegHc();
496   - getFoodElements(elements,vegHc);
  470 + getFoodElements(elements, vegHc);
497 471  
498 472 List<Map> vegJl = model.getVegJl();
499   - getFoodElements(elements,vegJl);
  473 + getFoodElements(elements, vegJl);
500 474  
501 475 List<Map> meatC = model.getMeatC();
502   - getFoodElements(elements,meatC);
  476 + getFoodElements(elements, meatC);
503 477  
504 478  
505 479 List<Map> meatQ = model.getMeatQ();
506   - getFoodElements(elements,meatQ);
  480 + getFoodElements(elements, meatQ);
507 481  
508 482 List<Map> meatD = model.getMeatD();
509   - getFoodElements(elements,meatD);
  483 + getFoodElements(elements, meatD);
510 484  
511 485 List<Map> meatX = model.getMeatX();
512   - getFoodElements(elements,meatX);
  486 + getFoodElements(elements, meatX);
513 487  
514 488 List<Map> meatH = model.getMeatH();
515   - getFoodElements(elements,meatH);
  489 + getFoodElements(elements, meatH);
516 490  
517 491 List<Map> meatY = model.getMeatY();
518   - getFoodElements(elements,meatY);
  492 + getFoodElements(elements, meatY);
519 493  
520 494  
521 495 List<Map> meatYz = model.getMeatYz();
522   - getFoodElements(elements,meatYz);
  496 + getFoodElements(elements, meatYz);
523 497  
524 498 List<Map> milk = model.getMilk();
525   - getFoodElements(elements,milk);
  499 + getFoodElements(elements, milk);
526 500  
527 501 List<Map> oilGg = model.getOilGg();
528   - getFoodElements(elements,oilGg);
  502 + getFoodElements(elements, oilGg);
529 503  
530 504  
531 505 List<Map> beansGd = model.getBeansGd();
532   - getFoodElements(elements,beansGd);
  506 + getFoodElements(elements, beansGd);
533 507  
534 508 List<Map> beansDl = model.getBeansDl();
535   - getFoodElements(elements,beansDl);
  509 + getFoodElements(elements, beansDl);
536 510  
537 511 List<Map> fruits = model.getFruits();
538   - getFoodElements(elements,fruits);
  512 + getFoodElements(elements, fruits);
539 513  
540 514 List<Map> vegXd = model.getVegXd();
541   - getFoodElements(elements,vegXd);
  515 + getFoodElements(elements, vegXd);
542 516  
543 517  
544   -
545 518 //能量计算
546   - double nl = getBasicKaul( month, model.getWeight(),model.getHeight(),baby.getSex());
  519 + double nl = getBasicKaul(month, model.getWeight(), model.getHeight(), baby.getSex());
547 520 Double nlCurrent = elements.get("能量") == null ? 0 : elements.get("能量");
548 521 getNl(yysMapList, nl, nlCurrent);
549 522  
550 523 Double tsCurrent = elements.get("碳素化合物") == null ? 0 : elements.get("碳素化合物");//碳素化合物
551 524 Double dbzCurrent = elements.get("蛋白质") == null ? 0 : elements.get("蛋白质");//蛋白质
552 525 Double zfCurrent = elements.get("脂肪") == null ? 0 : elements.get("脂肪");//脂肪
553   - if (month < 5)
554   - {
  526 + if (month < 5) {
555 527 getYysItems(yysMapList, nl, tsCurrent, "碳水化合物", 0.55, 0.65);
556 528 getYysItems(yysMapList, nl, dbzCurrent, "蛋白质", 0.07, 0.09);
557 529 getYysItems(yysMapList, nl, zfCurrent, "脂肪", 0.4, 0.5);
558 530  
559   - }
560   - else if (month < 12)
561   - {
  531 + } else if (month < 12) {
562 532  
563 533 getYysItems(yysMapList, nl, tsCurrent, "碳水化合物", 0.55, 0.65);
564 534  
565 535 getYysItems(yysMapList, nl, dbzCurrent, "蛋白质", 0.05, 0.07);
566 536  
567 537 getYysItems(yysMapList, nl, zfCurrent, "脂肪", 0.4, 0.5);
568   - }
569   - else if (month < 36)
570   - {
  538 + } else if (month < 36) {
571 539 getYysItems(yysMapList, nl, tsCurrent, "碳水化合物", 0.5, 0.7);
572 540  
573 541 getYysItems(yysMapList, nl, dbzCurrent, "蛋白质", 0.07, 0.2);
574 542  
575 543 getYysItems(yysMapList, nl, zfCurrent, "脂肪", 0.2, 0.35);
576   - }
577   - else
578   - {
  544 + } else {
579 545 getYysItems(yysMapList, nl, tsCurrent, "碳水化合物", 0.55, 0.7);
580 546 getYysItems(yysMapList, nl, dbzCurrent, "蛋白质", 0.07, 0.2);
581 547 getYysItems(yysMapList, nl, zfCurrent, "脂肪", 0.15, 0.3);
582 548 }
583 549  
584 550  
585   - if (elements.size() > 0)
586   - {
  551 + if (elements.size() > 0) {
587 552 int tempMonth = month < 6 ? 0 : (month < 12 ? 6 : 12);
588   - for (String key : elements.keySet())
589   - {
  553 + for (String key : elements.keySet()) {
590 554 BabyNutritionConfigModel babyNutritionConfig1 = mongoTemplate.findOne(
591 555 Query.query(Criteria.where("type").is(5).and("monthAge").is(tempMonth).and("title").is(key)), BabyNutritionConfigModel.class);
592   - if (babyNutritionConfig1 == null)
593   - {
  556 + if (babyNutritionConfig1 == null) {
594 557 continue;
595 558 }
596 559 Double value = elements.get(key);
597 560  
598 561  
599 562  
600 563  
601 564  
602 565  
603 566  
604 567  
605 568  
... ... @@ -599,55 +562,46 @@
599 562 String downValue = babyNutritionConfig1.getDownValue();
600 563  
601 564 int status = 0;
602   - if (StringUtils.isNotEmpty(upValue) && StringUtils.isNotEmpty(normalValue))
603   - {
  565 + if (StringUtils.isNotEmpty(upValue) && StringUtils.isNotEmpty(normalValue)) {
604 566 status = Double.parseDouble(upValue) < value ? 1 : (Double.parseDouble(normalValue) > value ? -1 : 0);
605   - }else if (StringUtils.isNotEmpty(downValue) && StringUtils.isNotEmpty(normalValue))
606   - {
  567 + } else if (StringUtils.isNotEmpty(downValue) && StringUtils.isNotEmpty(normalValue)) {
607 568 status = Double.parseDouble(normalValue) < value ? 1 : (Double.parseDouble(downValue) > value ? -1 : 0);
608   - }
609   - else if (StringUtils.isNotEmpty(normalValue))
610   - {
  569 + } else if (StringUtils.isNotEmpty(normalValue)) {
611 570 status = Double.parseDouble(normalValue) > value ? -1 : 0;
612 571 }
613 572  
614 573  
615 574 Map wly = new HashMap();
616   - wly.put("name",key);
  575 + wly.put("name", key);
617 576 wly.put("normalValue", normalValue);
618   - wly.put("currentValue", String.format("%.2f",value));
619   - wly.put("status", status);
  577 + wly.put("currentValue", String.format("%.2f", value));
  578 + wly.put("status", status);
620 579 wlysMapList.add(wly);
621 580 }
622 581 }
623 582  
624 583  
625   - data.put("yysMapList",yysMapList);
  584 + data.put("yysMapList", yysMapList);
626 585 data.put("wlysMapList", wlysMapList);
627 586  
628 587 List<Map> items = new ArrayList<>();
629   - if (CollectionUtils.isNotEmpty(yysMapList))
630   - {
631   - for (Map map1 : yysMapList)
632   - {
633   - if (map1 == null)
634   - {
  588 + if (CollectionUtils.isNotEmpty(yysMapList)) {
  589 + for (Map map1 : yysMapList) {
  590 + if (map1 == null) {
635 591 continue;
636 592 }
637 593  
638 594 Integer status = Integer.valueOf(String.valueOf(map1.get("status")));
639   - if (status != 0)
640   - {
  595 + if (status != 0) {
641 596 String str = status == -1 ? "摄入不足" : "摄入过量";
642 597 BabyNutritionConfigModel babyNutritionConfig1 = mongoTemplate.findOne(
643 598 Query.query(Criteria.where("type").is(7).and("status").is(str).and("title").is(String.valueOf(map1.get("name")))), BabyNutritionConfigModel.class);
644   - if (babyNutritionConfig1 == null)
645   - {
  599 + if (babyNutritionConfig1 == null) {
646 600 continue;
647 601 }
648 602 Map item = new HashMap();
649   - item.put("title",babyNutritionConfig1.getTitle()+str);
650   - item.put("content",babyNutritionConfig1.getContentOne());
  603 + item.put("title", babyNutritionConfig1.getTitle() + str);
  604 + item.put("content", babyNutritionConfig1.getContentOne());
651 605 items.add(item);
652 606 }
653 607 }
654 608  
655 609  
656 610  
... ... @@ -655,23 +609,19 @@
655 609 data.put("yysitems", items);
656 610  
657 611 List<Map> wlysitems = new ArrayList<>();
658   - if (CollectionUtils.isNotEmpty(wlysMapList))
659   - {
660   - for (Map map1 : wlysMapList)
661   - {
  612 + if (CollectionUtils.isNotEmpty(wlysMapList)) {
  613 + for (Map map1 : wlysMapList) {
662 614 Integer status = Integer.valueOf(String.valueOf(map1.get("status")));
663   - if (status != 0)
664   - {
  615 + if (status != 0) {
665 616 String str = status == -1 ? "摄入不足" : "摄入过量";
666 617 BabyNutritionConfigModel babyNutritionConfig1 = mongoTemplate.findOne(
667 618 Query.query(Criteria.where("type").is(7).and("status").is(str).and("title").is(String.valueOf(map1.get("name")))), BabyNutritionConfigModel.class);
668   - if (babyNutritionConfig1 == null)
669   - {
  619 + if (babyNutritionConfig1 == null) {
670 620 continue;
671 621 }
672 622 Map item = new HashMap();
673   - item.put("title",babyNutritionConfig1.getTitle()+str);
674   - item.put("content",babyNutritionConfig1.getContentOne());
  623 + item.put("title", babyNutritionConfig1.getTitle() + str);
  624 + item.put("content", babyNutritionConfig1.getContentOne());
675 625 wlysitems.add(item);
676 626 }
677 627 }
678 628  
679 629  
680 630  
681 631  
... ... @@ -688,35 +638,26 @@
688 638 return objectResponse;
689 639 }
690 640  
691   - private void getFoodElements(Map<String,Double> elements,List<Map> foods)
692   - {
693   - if (CollectionUtils.isNotEmpty(foods))
694   - {
695   - for (Map map1 : foods)
696   - {
697   - if (map1.get("val") == null || map1.get("ids") == null)
698   - {
  641 + private void getFoodElements(Map<String, Double> elements, List<Map> foods) {
  642 + if (CollectionUtils.isNotEmpty(foods)) {
  643 + for (Map map1 : foods) {
  644 + if (map1.get("val") == null || map1.get("ids") == null) {
699 645 continue;
700 646 }
701 647 String ids = String.valueOf(map1.get("ids"));
702 648 String val = String.valueOf(map1.get("val"));
703 649  
704   - if (StringUtils.isEmpty(ids) || StringUtils.isEmpty(val))
705   - {
  650 + if (StringUtils.isEmpty(ids) || StringUtils.isEmpty(val)) {
706 651 continue;
707 652 }
708 653  
709   - if (StringUtils.isNotEmpty(ids) && StringUtils.isNotEmpty(val))
710   - {
  654 + if (StringUtils.isNotEmpty(ids) && StringUtils.isNotEmpty(val)) {
711 655 List<FoodResult> foodResults = getFoods(ids);
712   - if (CollectionUtils.isNotEmpty(foodResults))
713   - {
714   - for (FoodResult food : foodResults)
715   - {
  656 + if (CollectionUtils.isNotEmpty(foodResults)) {
  657 + for (FoodResult food : foodResults) {
716 658 Double protein = (elements.get(food.getNutritionName()) == null ? 0 : elements.get(food.getNutritionName()));
717   - if (food.getProtein() != null)
718   - {
719   - elements.put(food.getNutritionName(),protein == null ? food.getProtein() : protein+(food.getProtein()*Double.parseDouble(val)/100));
  659 + if (food.getProtein() != null) {
  660 + elements.put(food.getNutritionName(), protein == null ? food.getProtein() : protein + (food.getProtein() * Double.parseDouble(val) / 100));
720 661 }
721 662  
722 663 }
723 664  
724 665  
725 666  
726 667  
727 668  
... ... @@ -726,40 +667,35 @@
726 667 }
727 668 }
728 669  
729   - private void getYysItems(List<Map> yysMapList,double nl,Double current,String title,double down,double up)
730   - {
731   - if (current == null || current == 0)
732   - {
  670 + private void getYysItems(List<Map> yysMapList, double nl, Double current, String title, double down, double up) {
  671 + if (current == null || current == 0) {
733 672 return;
734 673 }
735 674 Map map = new HashMap();
736   - map.put("name",title);
737   - map.put("normalValue", String.format("%.2f",(nl * down)) + "-" + String.format("%.2f",(nl * up)));
  675 + map.put("name", title);
  676 + map.put("normalValue", String.format("%.2f", (nl * down)) + "-" + String.format("%.2f", (nl * up)));
738 677 map.put("currentValue", String.format("%.2f", current));
739 678 map.put("status", (nl * up) < current ? 1 : (nl * down > current ? -1 : 0));
740 679 yysMapList.add(map);
741 680 }
742 681  
743   - private void getNl(List<Map> yysMapList,double nl,Double current)
744   - {
745   - if (current == null || current == 0)
746   - {
  682 + private void getNl(List<Map> yysMapList, double nl, Double current) {
  683 + if (current == null || current == 0) {
747 684 return;
748 685 }
749 686 Map nlMap = new HashMap();
750   - nlMap.put("name","能量");
751   - nlMap.put("normalValue",String.format("%.2f",(nl-50))+"-" +String.format("%.2f",(nl+50)));
752   - nlMap.put("currentValue",String.format("%.2f",current));
  687 + nlMap.put("name", "能量");
  688 + nlMap.put("normalValue", String.format("%.2f", (nl - 50)) + "-" + String.format("%.2f", (nl + 50)));
  689 + nlMap.put("currentValue", String.format("%.2f", current));
753 690 nlMap.put("status", nl + 50 < current ? 1 : (nl - 50 > current ? -1 : 0));
754 691 yysMapList.add(nlMap);
755 692 }
756 693  
757 694  
758   - private List<String> getYys(int month){
  695 + private List<String> getYys(int month) {
759 696 List<String> list = new ArrayList<>();
760 697  
761   - if (month < 36)
762   - {
  698 + if (month < 36) {
763 699 list.add("碳水化合物:总能量的50-70%");
764 700 list.add("蛋白质:总能量的7-20%,平均每日约0.96g/kg");
765 701 list.add("脂肪:总能量的20-35%");
... ... @@ -768,9 +704,7 @@
768 704 list.add("无机物:钙的推荐摄入量为600mg,磷的推荐摄入量为300mg,钠的充分摄入为700mg,钾的充分摄入量为900mg,镁的推荐摄入量为140mg,铁的推荐摄入量为9mg,锌的推荐摄入量为4mg,铜的推荐摄入量为0.3mg,氟的充分摄入量为0.6mg,猛的充分摄入量为1.4mg,碘的推荐摄入量为90μg,硒的推荐摄入量为25μg");
769 705 list.add("维生素:维生素A的推荐摄入量为310μgRE,维生素D的充分摄入量为10μg,维生素E的充分摄入量为6mg α-TE,维生素C的推荐摄入量为40mg,维生素B1的推荐摄入量为0.6mg,维生素B2(核黄素)的0.6mg,维生素B3烟酸的推荐摄入量为6mgNE,维生素B6的推荐摄入量0.6mg,叶酸的推荐摄入量为160μg DFE,维生素B12的推荐摄入量为1.0μg,泛酸的充分摄入量为2.1mg,维生素H(生物素)的充分摄入量17μg");
770 706 list.add("水分:1岁120-135ml/kg/day;2岁115-125ml/kg/day");
771   - }
772   - else
773   - {
  707 + } else {
774 708 list.add("碳水化合物:总能量的55-70%");
775 709 list.add("蛋白质:总能量的7-20%,平均每日约0.88g/kg");
776 710 list.add("脂肪:总能量的15-30%");
777 711  
... ... @@ -825,13 +759,12 @@
825 759 // return list;
826 760 // }
827 761  
828   - private String handleData(Double nl,double up,double down)
829   - {
830   - return String.format("%.2f",(nl * down))+"-"+String.format("%.2f",(nl * up));
  762 + private String handleData(Double nl, double up, double down) {
  763 + return String.format("%.2f", (nl * down)) + "-" + String.format("%.2f", (nl * up));
831 764 }
832   - private String handleData(Double nl,double value)
833   - {
834   - return String.format("%.2f",(nl * value));
  765 +
  766 + private String handleData(Double nl, double value) {
  767 + return String.format("%.2f", (nl * value));
835 768 }
836 769  
837 770 /**
838 771  
839 772  
840 773  
841 774  
842 775  
843 776  
844 777  
845 778  
846 779  
847 780  
848 781  
849 782  
850 783  
851 784  
852 785  
853 786  
854 787  
855 788  
856 789  
857 790  
... ... @@ -841,98 +774,61 @@
841 774 * 36月龄 男童:88.5-61.9×年龄(岁)+PA[26.7×体重(kg)+903×身长(m)]+20kcal/day PA=1.26
842 775 * 36月龄 女童:135.3-30.8×年龄(岁)+PA[10×体重(kg)+934×身长(m)]+20kcal/day PA=1.31
843 776 * 获取热量
  777 + *
844 778 * @return
845 779 */
846   - private double getBasicKaul(int month,Double weight,Double height,int sex)
847   - {
  780 + private double getBasicKaul(int month, Double weight, Double height, int sex) {
848 781 double kaul = 0;
849   - if (month < 12)
850   - {
  782 + if (month < 12) {
851 783 kaul = weight * (month < 6 ? 90 : 80);
852   - }
853   - else if (month < 36)
854   - {
  784 + } else if (month < 36) {
855 785 kaul = 89 * weight - 100 + 20;
856   - }
857   - else
858   - {
859   - if (sex == 1)
860   - {
861   - kaul = 88.5-61.9*3+1.26*(26.7*weight +903*(height/100))+20;
  786 + } else {
  787 + if (sex == 1) {
  788 + kaul = 88.5 - 61.9 * 3 + 1.26 * (26.7 * weight + 903 * (height / 100)) + 20;
  789 + } else {
  790 + kaul = 135.3 - 30.8 * 3 + 1.31 * (10 * weight + 934 * (height / 100)) + 20;
862 791 }
863   - else {
864   - kaul = 135.3-30.8*3+1.31*(10*weight +934*(height/100))+20;
865   - }
866 792 }
867 793 return kaul;
868 794 }
869 795  
870 796  
871   -
872   - private double getKal(int month,Double weight,Double height,int sex,String kaupEvaluate)
873   - {
  797 + private double getKal(int month, Double weight, Double height, int sex, String kaupEvaluate) {
874 798 double kaul = getBasicKaul(month, weight, height, sex);
875 799 kaul = getMathAbs(kaul);
876   - if (month < 12)
877   - {
878   - if (kaul < 400)
879   - {
  800 + if (month < 12) {
  801 + if (kaul < 400) {
880 802 kaul = 400;
881   - }
882   - else if (kaul > 1000)
883   - {
  803 + } else if (kaul > 1000) {
884 804 kaul = 1000;
885 805 }
886   - }
887   - else if (month < 36)
888   - {
889   - if (kaul < 600 && "正常".equals(kaupEvaluate))
890   - {
  806 + } else if (month < 36) {
  807 + if (kaul < 600 && "正常".equals(kaupEvaluate)) {
891 808 kaul = 600;
892   - }
893   - else if (kaul > 1550 && "正常".equals(kaupEvaluate))
894   - {
  809 + } else if (kaul > 1550 && "正常".equals(kaupEvaluate)) {
895 810 kaul = 1550;
896   - }else if (kaul < 500 && "消瘦".equals(kaupEvaluate))
897   - {
  811 + } else if (kaul < 500 && "消瘦".equals(kaupEvaluate)) {
898 812 kaul = 500;
899   - }
900   - else if (kaul > 1100 && "消瘦".equals(kaupEvaluate))
901   - {
  813 + } else if (kaul > 1100 && "消瘦".equals(kaupEvaluate)) {
902 814 kaul = 1100;
903   - }
904   - else if (kaul < 800 && "超重".equals(kaupEvaluate))
905   - {
  815 + } else if (kaul < 800 && "超重".equals(kaupEvaluate)) {
906 816 kaul = 800;
907   - }
908   - else if (kaul > 1750 && "超重".equals(kaupEvaluate))
909   - {
  817 + } else if (kaul > 1750 && "超重".equals(kaupEvaluate)) {
910 818 kaul = 1750;
911 819 }
912   - }
913   - else if (month == 36)
914   - {
915   - if (kaul < 1300 && "正常".equals(kaupEvaluate))
916   - {
  820 + } else if (month == 36) {
  821 + if (kaul < 1300 && "正常".equals(kaupEvaluate)) {
917 822 kaul = 1300;
918   - }
919   - else if (kaul > 1750 && "正常".equals(kaupEvaluate))
920   - {
  823 + } else if (kaul > 1750 && "正常".equals(kaupEvaluate)) {
921 824 kaul = 1750;
922   - }else if (kaul < 1200 && "消瘦".equals(kaupEvaluate))
923   - {
  825 + } else if (kaul < 1200 && "消瘦".equals(kaupEvaluate)) {
924 826 kaul = 1200;
925   - }
926   - else if (kaul > 1450 && "消瘦".equals(kaupEvaluate))
927   - {
  827 + } else if (kaul > 1450 && "消瘦".equals(kaupEvaluate)) {
928 828 kaul = 1450;
929   - }
930   - else if (kaul < 1500 && "超重".equals(kaupEvaluate))
931   - {
  829 + } else if (kaul < 1500 && "超重".equals(kaupEvaluate)) {
932 830 kaul = 1500;
933   - }
934   - else if (kaul > 1850 && "超重".equals(kaupEvaluate))
935   - {
  831 + } else if (kaul > 1850 && "超重".equals(kaupEvaluate)) {
936 832 kaul = 1850;
937 833 }
938 834 }
... ... @@ -943,7 +839,7 @@
943 839  
944 840  
945 841 private Double getMathAbs(Double kcal) {
946   - int k = (int)(kcal/100)*100;
  842 + int k = (int) (kcal / 100) * 100;
947 843 Double d = Math.floor(k);
948 844 Double md = d + 50;
949 845 if (md > kcal) {
950 846  
951 847  
952 848  
953 849  
954 850  
... ... @@ -954,28 +850,24 @@
954 850 }
955 851  
956 852 private Double getMathRound(Double kcal) {
957   - if (kcal % 100 != 0)
958   - {
959   - kcal+=50;
960   - }
  853 + if (kcal % 100 != 0) {
  854 + kcal += 50;
  855 + }
961 856 return kcal > 1000 ? 1000 : (kcal < 400 ? 400 : kcal);
962 857 }
963 858  
964 859  
965   -
966 860 /**
967 861 * 0-11分为正常、消瘦、超重及以上三种情况:-2SD ≤ BMI ≤ 1SD正常;BMI<-2SD消瘦;BMI>+1SD超重
968 862 * 12-26分为正常、消瘦、超重及以上三种情况:-2SD ≤ BMI ≤ 1SD正常;BMI<-2SD消瘦;BMI>+1SD超重
  863 + *
969 864 * @return
970 865 */
971   - private String getBabyStatus(int month,int sex,Double weight,Double hegiht,String bmi)
972   - {
  866 + private String getBabyStatus(int month, int sex, Double weight, Double hegiht, String bmi) {
973 867 String kaupEvaluate = "";
974   - if (weight != null && hegiht != null)
975   - {
  868 + if (weight != null && hegiht != null) {
976 869  
977   - if (StringUtils.isNotEmpty(bmi))
978   - {
  870 + if (StringUtils.isNotEmpty(bmi)) {
979 871 Double bbmi = Double.parseDouble(bmi);
980 872 //查询该月龄的年龄别体重值
981 873 // 正常 :-2SD ≤ A ≤ +1SD
982 874  
983 875  
... ... @@ -984,16 +876,11 @@
984 876 List<AwModel> list = babyCheckService.queryBabyHealthConfig(month, sex, 5);
985 877 if (CollectionUtils.isNotEmpty(list)) {
986 878 AwModel awModel = list.get(0);
987   - if (awModel.getPoneDs() < bbmi)
988   - {
  879 + if (awModel.getPoneDs() < bbmi) {
989 880 kaupEvaluate = "超重";
990   - }
991   - else if (awModel.getPoneDs() >= bbmi && awModel.getRtwoDs() <= bbmi)
992   - {
  881 + } else if (awModel.getPoneDs() >= bbmi && awModel.getRtwoDs() <= bbmi) {
993 882 kaupEvaluate = "正常";
994   - }
995   - else if (awModel.getRtwoDs() > bbmi)
996   - {
  883 + } else if (awModel.getRtwoDs() > bbmi) {
997 884 kaupEvaluate = "消瘦";
998 885 }
999 886 }
... ... @@ -1002,6 +889,42 @@
1002 889 return kaupEvaluate;
1003 890 }
1004 891  
  892 + public BaseObjectResponse queryBabyDietReport(String id, Integer userId) {
  893 + Map data = new HashMap();
  894 +
  895 + BabyNutritionQuery babyQuery = new BabyNutritionQuery();
  896 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  897 + babyQuery.setHospitalId(hospitalId);
  898 + babyQuery.setId(id);
  899 +
  900 + List<BabyNutritionModel> models = babyNutritionService.queryBabyNutritions(babyQuery);
  901 + if (CollectionUtils.isNotEmpty(models)) {
  902 + BabyNutritionModel model = models.get(0);
  903 + BabyModel baby = babyBookbuildingService.queryBabyBuildById(model.getBabyId());
  904 +
  905 + Map map = new HashMap();
  906 + map.put("id", model.getId());
  907 + map.put("babyId", model.getBabyId());
  908 + map.put("babyName", baby.getName());
  909 + map.put("babySex", SexEnum.getTextById(baby.getSex()));
  910 + map.put("monthAge", StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), new Date())));
  911 + map.put("motherName", baby.getMname());
  912 + map.put("phone", baby.getMphone());
  913 + map.put("vcCardNo", baby.getVcCardNo());
  914 + map.put("weight", model.getWeight());
  915 + map.put("height", model.getHeight());
  916 + Organization org = organizationService.getOrganization(Integer.parseInt(hospitalId));
  917 + map.put("hospitalName", org.getName());
  918 + map.put("reportMonthAge", StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), model.getNutritiTime())));
  919 + data.put("userInfo", map);
  920 + }
  921 +
  922 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  923 + objectResponse.setData(data);
  924 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  925 + objectResponse.setErrormsg("成功");
  926 + return objectResponse;
  927 + }
1005 928  
1006 929 /**
1007 930 * 未结算列表