Commit 296e1adeaa8279c0d5102039037fe7fc53ddab90
1 parent
d6136f9e73
Exists in
master
and in
6 other branches
儿童量表-智力发育项
Showing 1 changed file with 58 additions and 18 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java
View file @
296e1ad
| ... | ... | @@ -23,6 +23,7 @@ |
| 23 | 23 | import org.springframework.data.mongodb.core.query.Update; |
| 24 | 24 | import org.springframework.stereotype.Service; |
| 25 | 25 | |
| 26 | +import java.math.BigDecimal; | |
| 26 | 27 | import java.util.*; |
| 27 | 28 | |
| 28 | 29 | /** |
| ... | ... | @@ -47,7 +48,7 @@ |
| 47 | 48 | |
| 48 | 49 | |
| 49 | 50 | /** |
| 50 | - * 获取儿童神经心理发育检查项 最近五个月的检查项 | |
| 51 | + * 获取儿童神经心理发育检查项 最近三/四/五个月的检查项 | |
| 51 | 52 | * |
| 52 | 53 | * @param babyId |
| 53 | 54 | * @return |
| 54 | 55 | |
| 55 | 56 | |
| 56 | 57 | |
| 57 | 58 | |
| 58 | 59 | |
| 59 | 60 | |
| 60 | 61 | |
| 61 | 62 | |
| 62 | 63 | |
| ... | ... | @@ -66,43 +67,45 @@ |
| 66 | 67 | } |
| 67 | 68 | int month3 = getCurrentMonth(month, 3); |
| 68 | 69 | if (month3 >= 3 && month3 <= 72) { |
| 70 | + | |
| 71 | + // 大于等于3月龄 小于等于72月龄 | |
| 69 | 72 | int month2 = getCurrentMonth(month3, 2); |
| 70 | 73 | int month1 = getCurrentMonth(month2, 2); |
| 71 | 74 | int month4 = getCurrentMonth(month3, 4); |
| 72 | 75 | int month5 = getCurrentMonth(month4, 4); |
| 73 | 76 | months = new int[]{month1, month2, month3, month4, month5}; |
| 74 | - //mapList = getListMap(months, babyId, checkMonth); | |
| 75 | - } | |
| 76 | 77 | |
| 77 | - if (month3 < 3) { | |
| 78 | + }else if (month3 < 3) { | |
| 78 | 79 | if (month3 == 1) { |
| 80 | + | |
| 81 | + // 等于1月龄 | |
| 79 | 82 | int month4 = getCurrentMonth(month3, 4); |
| 80 | 83 | int month5 = getCurrentMonth(month4, 4); |
| 81 | 84 | months = new int[] {month3, month4, month5}; |
| 82 | - //mapList = getListMap(months); | |
| 83 | - } | |
| 84 | - if (month3 == 2) { | |
| 85 | + | |
| 86 | + }else if (month3 == 2) { | |
| 87 | + | |
| 88 | + // 等于2月龄 | |
| 85 | 89 | int month2 = getCurrentMonth(month3, 2); |
| 86 | 90 | int month4 = getCurrentMonth(month3, 4); |
| 87 | 91 | int month5 = getCurrentMonth(month4, 4); |
| 88 | 92 | months = new int[] {month2, month3, month4, month5}; |
| 89 | - //mapList = getListMap(months); | |
| 90 | 93 | } |
| 91 | - } | |
| 92 | - | |
| 93 | - if (month3 > 72 && month3 <= 84) { | |
| 94 | + } else if (month3 > 72 && month3 <= 84) { | |
| 94 | 95 | if (month3 == 78) { |
| 96 | + | |
| 97 | + // 等于78月龄 | |
| 95 | 98 | int month2 = getCurrentMonth(month3, 2); |
| 96 | 99 | int month1 = getCurrentMonth(month2, 2); |
| 97 | 100 | int month4 = getCurrentMonth(month3, 4); |
| 98 | 101 | months = new int[]{month1, month2, month3, month4}; |
| 99 | - //mapList = getListMap(months); | |
| 100 | - } | |
| 101 | - if (month3 == 84) { | |
| 102 | + | |
| 103 | + }else if (month3 == 84) { | |
| 104 | + | |
| 105 | + // 等于84月龄 | |
| 102 | 106 | int month2 = getCurrentMonth(month3, 2); |
| 103 | 107 | int month1 = getCurrentMonth(month2, 2); |
| 104 | 108 | months = new int[]{month1, month2, month3}; |
| 105 | - //mapList = getListMap(months); | |
| 106 | 109 | } |
| 107 | 110 | } |
| 108 | 111 | stringObjectMap = getListMap(months, babyId, checkMonth); |
| 109 | 112 | |
| ... | ... | @@ -153,9 +156,12 @@ |
| 153 | 156 | private Map<String, Object> getListMap(int [] months, String babyId, Integer checkMonth) { |
| 154 | 157 | Map<String, Object> resultMap = new HashMap<>(16); |
| 155 | 158 | String neuroPsychologicalId = null; |
| 156 | - Double totalProjectVal = 0D; | |
| 159 | + // 智龄 | |
| 160 | + Integer mentalAge = 0; | |
| 157 | 161 | List<Map<String, Object>> mapList = new LinkedList<>(); |
| 158 | - for (int i = 0; i < months.length ; i++) { | |
| 162 | + for (int i = 0, size = months.length; i < size ; i++) { | |
| 163 | + // 当前本月的被勾选的总分数 | |
| 164 | + Double currentProjectVal = 0D; | |
| 159 | 165 | int currentMonth = months[i]; |
| 160 | 166 | // 月龄对应的数据 |
| 161 | 167 | Map<String, Object> objectMap = new HashMap<>(); |
| ... | ... | @@ -181,7 +187,7 @@ |
| 181 | 187 | and("babyId").is(babyId).and("yn").is(YnEnums.YES.getId()).and("checkMonth").is(checkMonth)), BabyNeuroPsychologicalModel.class); |
| 182 | 188 | if (one != null) { |
| 183 | 189 | isSelected = true; |
| 184 | - totalProjectVal += projectVal; | |
| 190 | + currentProjectVal += projectVal; | |
| 185 | 191 | if (neuroPsychologicalId == null) { |
| 186 | 192 | neuroPsychologicalId = one.getId(); |
| 187 | 193 | } |
| 188 | 194 | |
| 189 | 195 | |
| ... | ... | @@ -197,8 +203,39 @@ |
| 197 | 203 | map.put("projectType", entry.getKey()); |
| 198 | 204 | map.put("detailList", list); |
| 199 | 205 | } |
| 206 | + | |
| 207 | + int developmentQuotient = 0; | |
| 208 | + if (currentProjectVal > 0) { | |
| 209 | + mentalAge = new BigDecimal(currentProjectVal).divide(new BigDecimal(5), 0, BigDecimal.ROUND_HALF_UP).intValue(); | |
| 210 | + developmentQuotient = new BigDecimal(mentalAge).divide(new BigDecimal(checkMonth), 0, BigDecimal.ROUND_HALF_UP).intValue(); | |
| 211 | + developmentQuotient *= 100; | |
| 212 | + } | |
| 213 | + // 当前测试时月龄 | |
| 214 | + objectMap.put("checkMonth", checkMonth); | |
| 215 | + // 配置对应的月龄 | |
| 200 | 216 | objectMap.put("month", currentMonth); |
| 217 | + // 领域组 | |
| 201 | 218 | objectMap.put("listGroup", listGroup); |
| 219 | + BabyEvaluationCriterionModel criterionModel = mongoTemplate.findOne(Query.query(Criteria.where("type").is(2). | |
| 220 | + and("minBorder").lte(developmentQuotient).and("maxBorder").gte(developmentQuotient)), BabyEvaluationCriterionModel.class); | |
| 221 | + String aptitudeName = null,levelName = null; | |
| 222 | + if (criterionModel != null) { | |
| 223 | + aptitudeName = criterionModel.getAptitudeName(); | |
| 224 | + levelName = criterionModel.getLevelName(); | |
| 225 | + } | |
| 226 | + // 发育商、智能、等级评价 | |
| 227 | + objectMap.put("developmentQuotient", developmentQuotient); | |
| 228 | + objectMap.put("aptitudeName", aptitudeName); | |
| 229 | + objectMap.put("levelName", levelName); | |
| 230 | + | |
| 231 | + // 当前检查时间 | |
| 232 | + BabyNeuroPsychologicalModel one = mongoTemplate.findOne(Query.query( | |
| 233 | + Criteria.where("babyId").is(babyId).and("yn").is(YnEnums.YES.getId()).and("checkMonth").is(checkMonth)), BabyNeuroPsychologicalModel.class); | |
| 234 | + String currentCheckTime = one == null | |
| 235 | + ? "" | |
| 236 | + : (one.getUpdateTime() == null ? DateUtil.getYmd(one.getCreateTime()) : DateUtil.getYmd(one.getUpdateTime())); | |
| 237 | + objectMap.put("currentCheckTime", currentCheckTime); | |
| 238 | + | |
| 202 | 239 | mapList.add(objectMap); |
| 203 | 240 | } |
| 204 | 241 | resultMap.put("configs", mapList); |
| 205 | 242 | |
| ... | ... | @@ -246,10 +283,12 @@ |
| 246 | 283 | with(new Sort(new Sort.Order(Sort.Direction.ASC, "createTime"))), BabyNeuroPsychologicalModel.class); |
| 247 | 284 | List<Object> objectList = new ArrayList<>(); |
| 248 | 285 | if (CollectionUtils.isNotEmpty(models)) { |
| 286 | + | |
| 249 | 287 | // 若该儿童做过该项检查,一次查出 |
| 250 | 288 | for (BabyNeuroPsychologicalModel model : models) { |
| 251 | 289 | BaseResponse itemListByBabyId = getItemListByBabyId(model.getBabyId(), model.getCheckMonth()); |
| 252 | 290 | if (itemListByBabyId.getErrorcode() != 0) { |
| 291 | + // 出错直接return | |
| 253 | 292 | return itemListByBabyId; |
| 254 | 293 | } |
| 255 | 294 | List<Map<String, Object>> mapList = (List<Map<String, Object>>) itemListByBabyId.getObject(); |
| ... | ... | @@ -260,6 +299,7 @@ |
| 260 | 299 | return baseResponse; |
| 261 | 300 | } else { |
| 262 | 301 | |
| 302 | + // 根据当前儿童显示项目领域的配置信息,以供save | |
| 263 | 303 | return getItemListByBabyId(babyId,null); |
| 264 | 304 | } |
| 265 | 305 | } |