Commit 707dbf166876a1d2b8f54090c07d78886427d6ae
1 parent
33f64793f9
Exists in
master
and in
6 other branches
修复bug
Showing 2 changed files with 36 additions and 32 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEvaluationCriterionController.java
View file @
707dbf1
... | ... | @@ -70,6 +70,9 @@ |
70 | 70 | return babyEvaluationCriterionService.saveOrUpdateNeuropsychology(param, getUserId(request)); |
71 | 71 | } |
72 | 72 | |
73 | + | |
74 | + /****************************************************20项神经运动筛查**********************************************/ | |
75 | + | |
73 | 76 | /** |
74 | 77 | * 根据查询号查询神经运动 |
75 | 78 | * |
... | ... | @@ -127,6 +130,9 @@ |
127 | 130 | return babyEvaluationCriterionService.nerveMovementByIdList(getUserId(request), jsonObject); |
128 | 131 | } |
129 | 132 | |
133 | + | |
134 | + | |
135 | + /************************************运动测评******************************************************************/ | |
130 | 136 | /** |
131 | 137 | * 儿童量表--运动测评--save or update |
132 | 138 | * |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java
View file @
707dbf1
... | ... | @@ -42,9 +42,6 @@ |
42 | 42 | @Autowired |
43 | 43 | MasterUsersMapper usersMapper; |
44 | 44 | |
45 | - private String babyId; | |
46 | - | |
47 | - | |
48 | 45 | /** |
49 | 46 | * 获取儿童神经心理发育检查项 最近三/四/五个月的检查项 |
50 | 47 | * |
... | ... | @@ -55,7 +52,6 @@ |
55 | 52 | Map<String, Object> stringObjectMap = new HashMap<>(); |
56 | 53 | int [] months = null; |
57 | 54 | if (StringUtils.isNotEmpty(babyId)) { |
58 | - this.babyId = babyId; | |
59 | 55 | BabyModel babyModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(babyId)), BabyModel.class); |
60 | 56 | if (null != babyModel) { |
61 | 57 | Date birth = babyModel.getBirth(); |
62 | 58 | |
63 | 59 | |
... | ... | @@ -124,13 +120,13 @@ |
124 | 120 | private Integer getCurrentMonth(Integer month, Integer index){ |
125 | 121 | Query query = new Query(); |
126 | 122 | if (2 == index){ |
127 | - query.addCriteria(Criteria.where("month").gt(month).and("yn").is(YnEnums.YES.getId())); | |
123 | + query.addCriteria(Criteria.where("month").lt(month).and("yn").is(YnEnums.YES.getId())); | |
128 | 124 | query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "month"))); |
129 | 125 | } else if (3 == index) { |
130 | - query.addCriteria(Criteria.where("month").gte(month).and("yn").is(YnEnums.YES.getId())); | |
126 | + query.addCriteria(Criteria.where("month").lte(month).and("yn").is(YnEnums.YES.getId())); | |
131 | 127 | query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "month"))); |
132 | 128 | } else if (4 == index) { |
133 | - query.addCriteria(Criteria.where("month").lt(month).and("yn").is(YnEnums.YES.getId())); | |
129 | + query.addCriteria(Criteria.where("month").gt(month).and("yn").is(YnEnums.YES.getId())); | |
134 | 130 | query.with(new Sort(new Sort.Order(Sort.Direction.ASC, "month"))); |
135 | 131 | } |
136 | 132 | |
... | ... | @@ -152,7 +148,7 @@ |
152 | 148 | * @return |
153 | 149 | */ |
154 | 150 | private Map<String, Object> getListMap(int [] months, String babyId, Integer checkMonth) { |
155 | - Map<String, Object> resultMap = new HashMap<>(16); | |
151 | + Map<String, Object> resultMap = new HashMap<>(); | |
156 | 152 | String neuroPsychologicalId = null; |
157 | 153 | // 智龄 |
158 | 154 | Integer mentalAge = 0; |
... | ... | @@ -163,7 +159,7 @@ |
163 | 159 | int currentMonth = months[i]; |
164 | 160 | // 月龄对应的数据 |
165 | 161 | Map<String, Object> objectMap = new HashMap<>(); |
166 | - Query query = Query.query(Criteria.where("month").is(currentMonth).and("yn").is(YnEnums.YES.getId())); | |
162 | + Query query = Query.query(Criteria.where("month").is(currentMonth).and("yn").is(YnEnums.YES.getId()).and("type").is(3)); | |
167 | 163 | query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "month"))); |
168 | 164 | |
169 | 165 | List<BabyEvaluationCriterionModel > babyEvaluationCriterionModels = mongoTemplate.find(query, BabyEvaluationCriterionModel.class); |
... | ... | @@ -289,8 +285,8 @@ |
289 | 285 | // 出错直接return |
290 | 286 | return itemListByBabyId; |
291 | 287 | } |
292 | - List<Map<String, Object>> mapList = (List<Map<String, Object>>) itemListByBabyId.getObject(); | |
293 | - objectList.add(mapList); | |
288 | + Map<String, Object> objectMap = (Map<String, Object>) itemListByBabyId.getObject(); | |
289 | + objectList.add(objectMap); | |
294 | 290 | } |
295 | 291 | BaseResponse baseResponse = new BaseResponse(); |
296 | 292 | baseResponse.setObject(objectList); |
... | ... | @@ -313,7 +309,8 @@ |
313 | 309 | public BaseResponse saveOrUpdateNeuropsychology(EvaluationCriterionNeuropsychologyRequest param, Integer userId) { |
314 | 310 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
315 | 311 | List<String> configId = param.getConfigId(); |
316 | - if (CollectionUtils.isEmpty(configId) || StringUtils.isEmpty(param.getBabyId())) { | |
312 | + String babyId = param.getBabyId(); | |
313 | + if (CollectionUtils.isEmpty(configId) || StringUtils.isEmpty(babyId)) { | |
317 | 314 | return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("参数缺失"); |
318 | 315 | } |
319 | 316 | BabyNeuroPsychologicalModel paramModel = param; |
... | ... | @@ -379,6 +376,9 @@ |
379 | 376 | if (CollectionUtils.isNotEmpty(models)) { |
380 | 377 | BabyNerveMovementModel model = models.get(0); |
381 | 378 | Map<String, String> stringStringMap = BeanUtils.objectToStringMap(model); |
379 | + stringStringMap.put("ageStr", DateUtil.getBabyMonthAge(model.getBirth(), new Date())); | |
380 | + stringStringMap.put("checkTimeStr", DateUtil.getyyyy_MM_dd(model.getCheckTime())); | |
381 | + stringStringMap.put("checkDoctorStr", usersMapper.getUsers(Integer.parseInt(model.getCheckDoctor())).getName()); | |
382 | 382 | list.add(stringStringMap); |
383 | 383 | } |
384 | 384 | BaseResponse baseResponse = new BaseResponse(); |
... | ... | @@ -426,7 +426,7 @@ |
426 | 426 | if (null != startMonth && null != endMonth && startMonth <= endMonth) { |
427 | 427 | Calendar instance = Calendar.getInstance(); |
428 | 428 | instance.setTime(new Date()); |
429 | - instance.set(Calendar.MONTH, - startMonth); | |
429 | + instance.add(Calendar.MONTH, - startMonth); | |
430 | 430 | Date lastSecond = DateUtil.getDayLastSecond(instance.getTime()); |
431 | 431 | |
432 | 432 | instance.setTime(new Date()); |
433 | 433 | |
... | ... | @@ -477,12 +477,12 @@ |
477 | 477 | @Override |
478 | 478 | public BaseResponse saveOrUpdateNerveMovement(Integer userId, NerveMovementSaveOrUpdateRequest param) { |
479 | 479 | BaseResponse response = new BaseResponse(); |
480 | - if (StringUtils.isEmpty(param.getBabyId()) || StringUtils.isEmpty(param.getCheckDoctor()) || param.getCheckTime() == null) { | |
480 | + if (StringUtils.isEmpty(param.getBabyId()) || StringUtils.isEmpty(param.getCheckDoctor()) ) { | |
481 | 481 | return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("参数缺失"); |
482 | 482 | } |
483 | 483 | String id = param.getId(); |
484 | 484 | BabyNerveMovementModel model = param; |
485 | - model.setCheckTime(new Date(model.getCheckTime().getTime() - 28800000)); | |
485 | + model.setCheckTime(new Date()); | |
486 | 486 | if (StringUtils.isNotEmpty(id)) { |
487 | 487 | model.setCreateTime(null); |
488 | 488 | model.setCreateUser(null); |
489 | 489 | |
... | ... | @@ -501,11 +501,21 @@ |
501 | 501 | boolean exists = mongoTemplate.exists(Query.query(Criteria.where("babyId").is(model.getBabyId()).and("createTime").gte(firstSecond).lte(dayLastSecond)), BabyNerveMovementModel.class); |
502 | 502 | if (!exists) { |
503 | 503 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
504 | + BabyModel babyModel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(model.getBabyId())), BabyModel.class); | |
505 | + if (babyModel == null) { | |
506 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("查无数据"); | |
507 | + } | |
508 | + model.setCheckTime(new Date()); | |
504 | 509 | model.setYn(YnEnums.YES.getId()); |
505 | 510 | model.setCreateUser(userId.toString()); |
506 | 511 | model.setCreateTime(new Date()); |
507 | 512 | model.setHospitalId(hospitalId); |
508 | - model.setBirth(new Date(model.getBirth().getTime() - 28800000)); | |
513 | + model.setName(babyModel.getName()); | |
514 | + model.setGender(babyModel.getSex().toString()); | |
515 | + model.setMname(babyModel.getMname()); | |
516 | + model.setMphone(babyModel.getMphone()); | |
517 | + model.setMcertNo(babyModel.getMcertNo()); | |
518 | + model.setBirth(babyModel.getBirth()); | |
509 | 519 | mongoTemplate.insert(model); |
510 | 520 | return response; |
511 | 521 | } |
... | ... | @@ -623,6 +633,7 @@ |
623 | 633 | String babyId = param.getBabyId(); |
624 | 634 | boolean isPass = paramValid(param); |
625 | 635 | ExerciseAppraisalModel model = param; |
636 | + model.setCheckTime(new Date()); | |
626 | 637 | if (!isPass) { |
627 | 638 | return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("参数缺失"); |
628 | 639 | } |
... | ... | @@ -648,7 +659,7 @@ |
648 | 659 | } |
649 | 660 | |
650 | 661 | if (StringUtils.isNotEmpty(id)) { |
651 | - model.setCheckTime(new Date(model.getCheckTime().getTime() - 28800000)); | |
662 | + model.setCheckTime(null); | |
652 | 663 | model.setCreateUser(null); |
653 | 664 | model.setCreateTime(null); |
654 | 665 | model.setBirth(null); |
655 | 666 | |
... | ... | @@ -681,20 +692,8 @@ |
681 | 692 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
682 | 693 | BaseResponse baseResponse = new BaseResponse(); |
683 | 694 | Query query = new Query(); |
684 | - query.addCriteria(Criteria.where("hospitalId").is(hospitalId).and("yn").is(YnEnums.YES.getId()).and("_id").is(babyId)); | |
695 | + query.addCriteria(Criteria.where("hospitalId").is(hospitalId).and("yn").is(YnEnums.YES.getId()).and("babyId").is(babyId)); | |
685 | 696 | query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "createTime"))); |
686 | - /*Map<String, Object> objectHashMap = new HashMap<>(); | |
687 | - BabyModel babyModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(babyId)), BabyModel.class); | |
688 | - Map<String, String> map = new HashMap<>(); | |
689 | - if (babyModel == null) { | |
690 | - return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("数据异常"); | |
691 | - } | |
692 | - map.put("age", DateUtil.getBabyMonthAge(babyModel.getBirth(), new Date())); | |
693 | - map.put("name", babyModel.getName()); | |
694 | - map.put("mname", babyModel.getMname()); | |
695 | - map.put("carNo", babyModel.getCardNo()); | |
696 | - map.put("", babyModel.) | |
697 | - objectHashMap.put("babyModel",map);*/ | |
698 | 697 | final List<ExerciseAppraisalModel> models = mongoTemplate.find(query, ExerciseAppraisalModel.class); |
699 | 698 | List<Map<String, String>> modelList = new ArrayList<Map<String, String>>(){{ |
700 | 699 | if (CollectionUtils.isNotEmpty(models)) { |
... | ... | @@ -704,7 +703,6 @@ |
704 | 703 | } |
705 | 704 | } |
706 | 705 | }}; |
707 | - //objectHashMap.put("list", models); | |
708 | 706 | baseResponse.setObject(modelList); |
709 | 707 | return baseResponse; |
710 | 708 | } |
... | ... | @@ -778,7 +776,7 @@ |
778 | 776 | * @return |
779 | 777 | */ |
780 | 778 | private boolean paramValid(ExerciseAppraisalRequest param) { |
781 | - if (StringUtils.isEmpty(param.getBabyId()) || StringUtils.isEmpty(param.getCheckDoctor()) || param.getCheckTime() == null | |
779 | + if (StringUtils.isEmpty(param.getBabyId()) || StringUtils.isEmpty(param.getCheckDoctor()) | |
782 | 780 | || param.getLieProstratComponent() == null || param.getLieProstrateInside() == null |
783 | 781 | || param.getLieProstrateOutside() == null || param.getLieProstrateInsideIndexs() == null |
784 | 782 | || param.getLieProstrateOutsideIndexs() == null |