diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java index 37735f5..1ab9fa5 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java @@ -66,49 +66,7 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri if (month > 84) { return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("操作失败,当前儿童年龄大于7岁"); } - int month3 = getCurrentMonth(month, 3, 3); - if (month3 >= 3 && month3 <= 72) { - - // 大于等于3月龄 小于等于72月龄 - int month2 = getCurrentMonth(month3, 2, 3); - int month1 = getCurrentMonth(month2, 2, 3); - int month4 = getCurrentMonth(month3, 4, 3); - int month5 = getCurrentMonth(month4, 4, 3); - months = new int[]{month1, month2, month3, month4, month5}; - - }else if (month3 < 3) { - if (month3 == 1) { - - // 等于1月龄 - int month4 = getCurrentMonth(month3, 4, 3); - int month5 = getCurrentMonth(month4, 4, 3); - months = new int[] {month3, month4, month5}; - - }else if (month3 == 2) { - - // 等于2月龄 - int month2 = getCurrentMonth(month3, 2, 3); - int month4 = getCurrentMonth(month3, 4, 3); - int month5 = getCurrentMonth(month4, 4, 3); - months = new int[] {month2, month3, month4, month5}; - } - } else if (month3 > 72 && month3 <= 84) { - if (month3 == 78) { - - // 等于78月龄 - int month2 = getCurrentMonth(month3, 2, 3); - int month1 = getCurrentMonth(month2, 2, 3); - int month4 = getCurrentMonth(month3, 4, 3); - months = new int[]{month1, month2, month3, month4}; - - }else if (month3 == 84) { - - // 等于84月龄 - int month2 = getCurrentMonth(month3, 2, 3); - int month1 = getCurrentMonth(month2, 2, 3); - months = new int[]{month1, month2, month3}; - } - } + months = getInts(months, month); stringObjectMap = getListMap(months, babyId, checkMonth, id); } } @@ -117,6 +75,53 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri return baseResponse; } + private int[] getInts(int[] months, Integer month) { + int month3 = getCurrentMonth(month, 3, 3); + if (month3 >= 3 && month3 <= 72) { + + // 大于等于3月龄 小于等于72月龄 + int month2 = getCurrentMonth(month3, 2, 3); + int month1 = getCurrentMonth(month2, 2, 3); + int month4 = getCurrentMonth(month3, 4, 3); + int month5 = getCurrentMonth(month4, 4, 3); + months = new int[]{month1, month2, month3, month4, month5}; + + }else if (month3 < 3) { + if (month3 == 1) { + + // 等于1月龄 + int month4 = getCurrentMonth(month3, 4, 3); + int month5 = getCurrentMonth(month4, 4, 3); + months = new int[] {month3, month4, month5}; + + }else if (month3 == 2) { + + // 等于2月龄 + int month2 = getCurrentMonth(month3, 2, 3); + int month4 = getCurrentMonth(month3, 4, 3); + int month5 = getCurrentMonth(month4, 4, 3); + months = new int[] {month2, month3, month4, month5}; + } + } else if (month3 > 72 && month3 <= 84) { + if (month3 == 78) { + + // 等于78月龄 + int month2 = getCurrentMonth(month3, 2, 3); + int month1 = getCurrentMonth(month2, 2, 3); + int month4 = getCurrentMonth(month3, 4, 3); + months = new int[]{month1, month2, month3, month4}; + + }else if (month3 == 84) { + + // 等于84月龄 + int month2 = getCurrentMonth(month3, 2, 3); + int month1 = getCurrentMonth(month2, 2, 3); + months = new int[]{month1, month2, month3}; + } + } + return months; + } + /** * 根据月龄匹配码表中最接近的月龄 * @@ -403,6 +408,16 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri } } } + Date birth = babyModel.getBirth(); + Integer month = checkMonth == null ? DateUtil.getBabyAgeMonth(birth, new Date()) : checkMonth; + int [] months = null; + months = getInts(months, month); + int month1 = months[0]; + List ecmodels = mongoTemplate.find(Query.query(Criteria.where("month").lte(month1).and("type").is(3)), BabyEvaluationCriterionModel.class); + for (BabyEvaluationCriterionModel m : ecmodels) { + zl += m.getProjectVal(); + } + DecimalFormat df = new DecimalFormat("0.00"); String zlStr = ""; if (zl != 0.00) {