Commit 7b106527ed0bf5f5100177320965c92c5b29b831

Authored by dongqin
1 parent a423a6b7e6

update

Showing 1 changed file with 58 additions and 43 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java View file @ 7b10652
... ... @@ -66,55 +66,60 @@
66 66 if (month > 84) {
67 67 return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("操作失败,当前儿童年龄大于7岁");
68 68 }
69   - int month3 = getCurrentMonth(month, 3, 3);
70   - if (month3 >= 3 && month3 <= 72) {
  69 + months = getInts(months, month);
  70 + stringObjectMap = getListMap(months, babyId, checkMonth, id);
  71 + }
  72 + }
  73 + BaseResponse baseResponse = new BaseResponse();
  74 + baseResponse.setObject(stringObjectMap);
  75 + return baseResponse;
  76 + }
71 77  
72   - // 大于等于3月龄 小于等于72月龄
73   - int month2 = getCurrentMonth(month3, 2, 3);
74   - int month1 = getCurrentMonth(month2, 2, 3);
75   - int month4 = getCurrentMonth(month3, 4, 3);
76   - int month5 = getCurrentMonth(month4, 4, 3);
77   - months = new int[]{month1, month2, month3, month4, month5};
  78 + private int[] getInts(int[] months, Integer month) {
  79 + int month3 = getCurrentMonth(month, 3, 3);
  80 + if (month3 >= 3 && month3 <= 72) {
78 81  
79   - }else if (month3 < 3) {
80   - if (month3 == 1) {
  82 + // 大于等于3月龄 小于等于72月龄
  83 + int month2 = getCurrentMonth(month3, 2, 3);
  84 + int month1 = getCurrentMonth(month2, 2, 3);
  85 + int month4 = getCurrentMonth(month3, 4, 3);
  86 + int month5 = getCurrentMonth(month4, 4, 3);
  87 + months = new int[]{month1, month2, month3, month4, month5};
81 88  
82   - // 等于1月龄
83   - int month4 = getCurrentMonth(month3, 4, 3);
84   - int month5 = getCurrentMonth(month4, 4, 3);
85   - months = new int[] {month3, month4, month5};
  89 + }else if (month3 < 3) {
  90 + if (month3 == 1) {
86 91  
87   - }else if (month3 == 2) {
  92 + // 等于1月龄
  93 + int month4 = getCurrentMonth(month3, 4, 3);
  94 + int month5 = getCurrentMonth(month4, 4, 3);
  95 + months = new int[] {month3, month4, month5};
88 96  
89   - // 等于2月龄
90   - int month2 = getCurrentMonth(month3, 2, 3);
91   - int month4 = getCurrentMonth(month3, 4, 3);
92   - int month5 = getCurrentMonth(month4, 4, 3);
93   - months = new int[] {month2, month3, month4, month5};
94   - }
95   - } else if (month3 > 72 && month3 <= 84) {
96   - if (month3 == 78) {
  97 + }else if (month3 == 2) {
97 98  
98   - // 等于78月龄
99   - int month2 = getCurrentMonth(month3, 2, 3);
100   - int month1 = getCurrentMonth(month2, 2, 3);
101   - int month4 = getCurrentMonth(month3, 4, 3);
102   - months = new int[]{month1, month2, month3, month4};
  99 + // 等于2月龄
  100 + int month2 = getCurrentMonth(month3, 2, 3);
  101 + int month4 = getCurrentMonth(month3, 4, 3);
  102 + int month5 = getCurrentMonth(month4, 4, 3);
  103 + months = new int[] {month2, month3, month4, month5};
  104 + }
  105 + } else if (month3 > 72 && month3 <= 84) {
  106 + if (month3 == 78) {
103 107  
104   - }else if (month3 == 84) {
  108 + // 等于78月龄
  109 + int month2 = getCurrentMonth(month3, 2, 3);
  110 + int month1 = getCurrentMonth(month2, 2, 3);
  111 + int month4 = getCurrentMonth(month3, 4, 3);
  112 + months = new int[]{month1, month2, month3, month4};
105 113  
106   - // 等于84月龄
107   - int month2 = getCurrentMonth(month3, 2, 3);
108   - int month1 = getCurrentMonth(month2, 2, 3);
109   - months = new int[]{month1, month2, month3};
110   - }
111   - }
112   - stringObjectMap = getListMap(months, babyId, checkMonth, id);
  114 + }else if (month3 == 84) {
  115 +
  116 + // 等于84月龄
  117 + int month2 = getCurrentMonth(month3, 2, 3);
  118 + int month1 = getCurrentMonth(month2, 2, 3);
  119 + months = new int[]{month1, month2, month3};
113 120 }
114 121 }
115   - BaseResponse baseResponse = new BaseResponse();
116   - baseResponse.setObject(stringObjectMap);
117   - return baseResponse;
  122 + return months;
118 123 }
119 124  
120 125 /**
... ... @@ -403,6 +408,16 @@
403 408 }
404 409 }
405 410 }
  411 + Date birth = babyModel.getBirth();
  412 + Integer month = checkMonth == null ? DateUtil.getBabyAgeMonth(birth, new Date()) : checkMonth;
  413 + int [] months = null;
  414 + months = getInts(months, month);
  415 + int month1 = months[0];
  416 + List<BabyEvaluationCriterionModel> ecmodels = mongoTemplate.find(Query.query(Criteria.where("month").lte(month1).and("type").is(3)), BabyEvaluationCriterionModel.class);
  417 + for (BabyEvaluationCriterionModel m : ecmodels) {
  418 + zl += m.getProjectVal();
  419 + }
  420 +
406 421 DecimalFormat df = new DecimalFormat("0.00");
407 422 String zlStr = "";
408 423 if (zl != 0.00) {