Commit da6e750602414fe81708eb39b6f95a1e0eaaa795
1 parent
526d7972a9
Exists in
master
and in
6 other branches
update
Showing 1 changed file with 9 additions and 4 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java
View file @
da6e750
... | ... | @@ -744,6 +744,7 @@ |
744 | 744 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg("儿童建档数据缺失"); |
745 | 745 | } |
746 | 746 | Integer checkMonth = DateUtil.getBabyAgeMonth(babyModel.getBirth(), new Date()); |
747 | + double monthDay = checkMonth+DateUtil.getMonthDays(babyModel.getBirth()); | |
747 | 748 | paramModel.setName(babyModel.getName()); |
748 | 749 | paramModel.setGender(babyModel.getSex()); |
749 | 750 | paramModel.setBirth(babyModel.getBirth()); |
... | ... | @@ -754,7 +755,7 @@ |
754 | 755 | update(userId, configId, id, paramModel); |
755 | 756 | } else { |
756 | 757 | // 新增 |
757 | - paramModel = getLevelByConfigId(paramModel, checkMonth); | |
758 | + paramModel = getLevelByConfigId(paramModel, checkMonth, monthDay); | |
758 | 759 | paramModel.setHospitalId(hospitalId); |
759 | 760 | paramModel.setCreateTime(new Date()); |
760 | 761 | paramModel.setCreateUser(userId.toString()); |
... | ... | @@ -816,7 +817,7 @@ |
816 | 817 | * @param paramModel |
817 | 818 | * @return |
818 | 819 | */ |
819 | - private BabyNeuroPsychologicalModel getLevelByConfigId(BabyNeuroPsychologicalModel paramModel, Integer checkMonth) { | |
820 | + private BabyNeuroPsychologicalModel getLevelByConfigId(BabyNeuroPsychologicalModel paramModel, Integer checkMonth,double monthDay) { | |
820 | 821 | List<String> configIds = paramModel.getConfigId(); |
821 | 822 | Double val = 0d; |
822 | 823 | for (String configId : configIds) { |
... | ... | @@ -824,6 +825,8 @@ |
824 | 825 | val += evaluationCriterionModel.getProjectVal(); |
825 | 826 | } |
826 | 827 | |
828 | + paramModel.setDevelopmentQuotient((int)(val/5/monthDay*100)); | |
829 | + | |
827 | 830 | Integer month = DateUtil.getBabyMonthAge1(paramModel.getBirth(), new Date()); |
828 | 831 | int [] months = null; |
829 | 832 | months = getInts(months, month); |
... | ... | @@ -858,7 +861,7 @@ |
858 | 861 | aptitudeName = criterionModel.getAptitudeName(); |
859 | 862 | levelName = criterionModel.getLevelName(); |
860 | 863 | } |
861 | - paramModel.setDevelopmentQuotient(developmentQuotient.intValue()); | |
864 | + | |
862 | 865 | paramModel.setAptitudeName(aptitudeName); |
863 | 866 | paramModel.setLevelName(levelName); |
864 | 867 | return paramModel; |
... | ... | @@ -874,7 +877,9 @@ |
874 | 877 | private void update(Integer userId, List<String> configId, String id, BabyNeuroPsychologicalModel paramModel) { |
875 | 878 | BabyNeuroPsychologicalModel model = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(id)), BabyNeuroPsychologicalModel.class); |
876 | 879 | Integer checkMonth = model.getCheckMonth(); |
877 | - paramModel = getLevelByConfigId(paramModel, checkMonth); | |
880 | + BabyModel babyModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(model.getBabyId())), BabyModel.class); | |
881 | + double monthDay = checkMonth+DateUtil.getMonthDays(babyModel.getBirth()); | |
882 | + paramModel = getLevelByConfigId(paramModel, checkMonth,monthDay); | |
878 | 883 | Query query = Query.query(Criteria.where("_id").is(id)); |
879 | 884 | Update update = new Update(); |
880 | 885 | update.set("configId", configId); |