Commit 88a563276dfd0a822309a81a27c4e4ffc4aeaf6a
1 parent
5a6059b08e
Exists in
master
and in
6 other branches
儿心量表业务添加
Showing 3 changed files with 190 additions and 5 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java
View file @
88a5632
... | ... | @@ -799,8 +799,9 @@ |
799 | 799 | */ |
800 | 800 | @RequestMapping(value = "/scale", method = RequestMethod.POST) |
801 | 801 | @ResponseBody |
802 | - public BaseResponse scaleDetail(@RequestParam String babyId) { | |
803 | - return viewFacade.scaleDetail(babyId); | |
802 | + public BaseResponse scaleDetail(@RequestParam String babyId, HttpServletRequest request) { | |
803 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
804 | + return viewFacade.scaleDetail(babyId, loginState.getId()); | |
804 | 805 | } |
805 | 806 | |
806 | 807 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
88a5632
1 | 1 | package com.lyms.platform.operate.web.facade; |
2 | 2 | |
3 | +import com.alibaba.fastjson.JSONObject; | |
3 | 4 | import com.lyms.platform.biz.SequenceConstant; |
4 | 5 | import com.lyms.platform.biz.service.*; |
5 | 6 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
... | ... | @@ -12,6 +13,7 @@ |
12 | 13 | import com.lyms.platform.operate.web.request.AntExcAddOther; |
13 | 14 | import com.lyms.platform.operate.web.request.MatDeliverAddRequest; |
14 | 15 | import com.lyms.platform.operate.web.result.*; |
16 | +import com.lyms.platform.operate.web.service.BabyEvaluationCriterionService; | |
15 | 17 | import com.lyms.platform.operate.web.utils.*; |
16 | 18 | import com.lyms.platform.permission.dao.master.CouponMapper; |
17 | 19 | import com.lyms.platform.permission.model.Organization; |
... | ... | @@ -123,6 +125,8 @@ |
123 | 125 | @Autowired |
124 | 126 | private CommonService commonService; |
125 | 127 | |
128 | + @Autowired | |
129 | + private BabyEvaluationCriterionService babyEvaluationCriterionService; | |
126 | 130 | /** |
127 | 131 | * 建档查询 |
128 | 132 | * |
... | ... | @@ -6030,7 +6034,7 @@ |
6030 | 6034 | * @param babyId |
6031 | 6035 | * @return |
6032 | 6036 | */ |
6033 | - public BaseResponse scaleDetail(String babyId) { | |
6037 | + public BaseResponse scaleDetail(String babyId, Integer userId) { | |
6034 | 6038 | Date firstSecond = DateUtil.getDayFirstSecond(new Date()); |
6035 | 6039 | Query query = Query.query(Criteria.where("babyId").is(babyId).and("createTime").gte(firstSecond)).with(new Sort(Sort.Direction.DESC, "createTime")); |
6036 | 6040 | // 运动测评结果 |
6037 | 6041 | |
6038 | 6042 | |
... | ... | @@ -6059,14 +6063,88 @@ |
6059 | 6063 | developmentQuotient = model.getDevelopmentQuotient().toString(); |
6060 | 6064 | } |
6061 | 6065 | |
6066 | + // 单项十项 | |
6067 | + HashMap<String, String> tenItem = getTenItem(babyId, userId); | |
6068 | + | |
6069 | + | |
6062 | 6070 | HashMap<String, String> map = new HashMap<>(); |
6063 | 6071 | map.put("percentileScore", percentileScore); |
6064 | 6072 | map.put("abnormalSize", abnormalSize); |
6065 | 6073 | map.put("okSize", okSize); |
6066 | 6074 | map.put("developmentQuotient", developmentQuotient); |
6075 | + map.putAll(tenItem); | |
6067 | 6076 | BaseResponse response = new BaseResponse(); |
6068 | 6077 | response.setObject(map); |
6069 | 6078 | return response; |
6079 | + } | |
6080 | + | |
6081 | + /** | |
6082 | + * 单项十项 | |
6083 | + * | |
6084 | + * @param babyId | |
6085 | + * @param userId | |
6086 | + * @return | |
6087 | + */ | |
6088 | + private HashMap<String, String> getTenItem(String babyId, Integer userId) { | |
6089 | + JSONObject jsonObject = new JSONObject(); | |
6090 | + jsonObject.put("babyId", babyId); | |
6091 | + BaseResponse baseQuery = babyEvaluationCriterionService.query(userId, jsonObject); | |
6092 | + Object object = baseQuery.getObject(); | |
6093 | + HashMap<String, String> hashMap = new HashMap<>(); | |
6094 | + // 运动智龄、发育商 | |
6095 | + String exerciseIA =""; | |
6096 | + String exerciseDQ = ""; | |
6097 | + // 动作 | |
6098 | + String movementIA = ""; | |
6099 | + String movementDQ = ""; | |
6100 | + // 适应 | |
6101 | + String adaptationIA = ""; | |
6102 | + String adaptationDQ = ""; | |
6103 | + // 语言 | |
6104 | + String languageIA = ""; | |
6105 | + String languageDQ = ""; | |
6106 | + // 社交 | |
6107 | + String socialContactIA = ""; | |
6108 | + String socialContactDQ = ""; | |
6109 | + if (object != null) { | |
6110 | + if (object instanceof Map) { | |
6111 | + Map map = (Map) object; | |
6112 | + if (map.containsKey("report")) { | |
6113 | + Map<String, Object> report = (Map<String, Object>) map.get("report"); | |
6114 | + List list1 = (List) report.get("1"); | |
6115 | + exerciseIA = list1.get(0) + ""; | |
6116 | + exerciseDQ = list1.get(1) + ""; | |
6117 | + | |
6118 | + List list2 = (List) report.get("2"); | |
6119 | + movementIA = list2.get(0) + ""; | |
6120 | + movementDQ = list2.get(1) + ""; | |
6121 | + | |
6122 | + List list3 = (List) report.get("3"); | |
6123 | + adaptationIA = list3.get(0) + ""; | |
6124 | + adaptationDQ = list3.get(1) + ""; | |
6125 | + | |
6126 | + List list4 = (List) report.get("4"); | |
6127 | + languageIA = list4.get(0) + ""; | |
6128 | + languageDQ = list4.get(1) + ""; | |
6129 | + | |
6130 | + List list5 = (List) report.get("5"); | |
6131 | + socialContactIA = list5.get(0) + ""; | |
6132 | + socialContactDQ = list5.get(1) + ""; | |
6133 | + } | |
6134 | + } | |
6135 | + } | |
6136 | + hashMap.put("exerciseIA", exerciseIA); | |
6137 | + hashMap.put("exerciseDQ", exerciseDQ); | |
6138 | + hashMap.put("movementIA", movementIA); | |
6139 | + hashMap.put("movementDQ", movementDQ); | |
6140 | + hashMap.put("adaptationIA", adaptationIA); | |
6141 | + hashMap.put("adaptationDQ", adaptationDQ); | |
6142 | + hashMap.put("languageIA", languageIA); | |
6143 | + hashMap.put("languageDQ", languageDQ); | |
6144 | + hashMap.put("socialContactIA", socialContactIA); | |
6145 | + hashMap.put("socialContactDQ", socialContactDQ); | |
6146 | + | |
6147 | + return hashMap; | |
6070 | 6148 | } |
6071 | 6149 | |
6072 | 6150 | public BaseResponse checkReport(List<String> antexId, Integer userId) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java
View file @
88a5632
... | ... | @@ -28,6 +28,7 @@ |
28 | 28 | import org.springframework.stereotype.Service; |
29 | 29 | |
30 | 30 | import java.math.BigDecimal; |
31 | +import java.text.DecimalFormat; | |
31 | 32 | import java.util.*; |
32 | 33 | |
33 | 34 | /** |
... | ... | @@ -157,7 +158,16 @@ |
157 | 158 | Map<String, Object> resultMap = new HashMap<>(); |
158 | 159 | String neuroPsychologicalId = null; |
159 | 160 | // 智龄 |
160 | - Integer mentalAge = 0; | |
161 | + String double1Dq = "", | |
162 | + double2Dq = "", | |
163 | + double3Dq = "", | |
164 | + double4Dq = "", | |
165 | + double5Dq = ""; | |
166 | + Double double1Z = 0.00D, | |
167 | + double2Z = 0.00D, | |
168 | + double3Z = 0.00D, | |
169 | + double4Z = 0.00D, | |
170 | + double5Z = 0.00D; | |
161 | 171 | |
162 | 172 | // 当前本月的被勾选的总分数 |
163 | 173 | List<Map<String, Object>> mapList = new LinkedList<>(); |
164 | 174 | |
165 | 175 | |
... | ... | @@ -189,9 +199,25 @@ |
189 | 199 | and("_id").is(id)), BabyNeuroPsychologicalModel.class); |
190 | 200 | if (one != null) { |
191 | 201 | isSelected = true; |
202 | + String oneId = one.getId(); | |
192 | 203 | if (neuroPsychologicalId == null) { |
193 | - neuroPsychologicalId = one.getId(); | |
204 | + neuroPsychologicalId = oneId; | |
194 | 205 | } |
206 | + BabyEvaluationCriterionModel criterionModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(oneId)), BabyEvaluationCriterionModel.class); | |
207 | + // 1/大动作 2/精细动作 3/适应能力 4/语音 5/社交行为 | |
208 | + if (criterionModel != null) { | |
209 | + if ("1".equals(criterionModel.getProjectType())) { | |
210 | + double1Z += criterionModel.getProjectVal(); | |
211 | + } else if ("2".equals(criterionModel.getProjectType())) { | |
212 | + double2Z += criterionModel.getProjectVal(); | |
213 | + } else if ("3".equals(criterionModel.getProjectType())) { | |
214 | + double3Z += criterionModel.getProjectVal(); | |
215 | + } else if ("4".equals(criterionModel.getProjectType())) { | |
216 | + double4Z += criterionModel.getProjectVal(); | |
217 | + } else if ("5".equals(criterionModel.getProjectType())) { | |
218 | + double5Z += criterionModel.getProjectVal(); | |
219 | + } | |
220 | + } | |
195 | 221 | } |
196 | 222 | } |
197 | 223 | Map<String, Object> m = new HashMap<>(16); |
198 | 224 | |
... | ... | @@ -226,7 +252,87 @@ |
226 | 252 | mapList.add(objectMap); |
227 | 253 | } |
228 | 254 | resultMap.put("configs", mapList); |
255 | + | |
256 | + | |
257 | + // 报表 | |
258 | + Map<String, Object> reportMap = getStringObjectMap(checkMonth, | |
259 | + double1Dq, double2Dq, double3Dq, double4Dq, double5Dq, | |
260 | + double1Z, double2Z, double3Z, double4Z, double5Z); | |
261 | + | |
262 | + resultMap.put("report", reportMap); | |
229 | 263 | return resultMap; |
264 | + } | |
265 | + | |
266 | + /** | |
267 | + * | |
268 | + * @param checkMonth 月龄 | |
269 | + * @param double1Dq 1dq -- > 大运动的发育商 | |
270 | + * @param double2Dq | |
271 | + * @param double3Dq | |
272 | + * @param double4Dq | |
273 | + * @param double5Dq | |
274 | + * | |
275 | + * @param double1Z 1z -- > 大运动的智商 | |
276 | + * @param double2Z | |
277 | + * @param double3Z | |
278 | + * @param double4Z | |
279 | + * @param double5Z | |
280 | + * @return | |
281 | + */ | |
282 | + private Map<String, Object> getStringObjectMap(Integer checkMonth, String double1Dq, String double2Dq, String double3Dq, String double4Dq, String double5Dq, Double double1Z, Double double2Z, Double double3Z, Double double4Z, Double double5Z) { | |
283 | + Map<String, Object> reportMap = new HashMap<>(); | |
284 | + LinkedList<Object> objects1 = new LinkedList<>(); | |
285 | + String s1z = ""; | |
286 | + DecimalFormat df = new DecimalFormat("#.00"); | |
287 | + if (double1Z != 0.00) { | |
288 | + double1Dq = String.format(df.format(double1Z / checkMonth)); | |
289 | + s1z = double1Z.toString(); | |
290 | + } | |
291 | + objects1.add(s1z); | |
292 | + objects1.add(double1Dq); | |
293 | + | |
294 | + LinkedList<Object> objects2 = new LinkedList<>(); | |
295 | + String s2z = ""; | |
296 | + if (double2Z != 0.00) { | |
297 | + s2z = double2Z.toString(); | |
298 | + double2Dq = String.format(df.format(double2Z / checkMonth)); | |
299 | + } | |
300 | + objects2.add(s2z); | |
301 | + objects2.add(double2Dq); | |
302 | + | |
303 | + LinkedList<Object> objects3 = new LinkedList<>(); | |
304 | + String s3z = ""; | |
305 | + if (double3Z != 0.00) { | |
306 | + s3z = double3Z.toString(); | |
307 | + double3Dq = String.format(df.format(double3Z / checkMonth)); | |
308 | + } | |
309 | + objects3.add(s3z); | |
310 | + objects3.add(double3Dq); | |
311 | + | |
312 | + LinkedList<Object> objects4 = new LinkedList<>(); | |
313 | + String s4z = ""; | |
314 | + if (double4Z != 0.00) { | |
315 | + s4z = double4Z.toString(); | |
316 | + double4Dq = String.format(df.format(double4Z / checkMonth)); | |
317 | + } | |
318 | + objects4.add(s4z); | |
319 | + objects4.add(double4Dq); | |
320 | + | |
321 | + | |
322 | + LinkedList<Object> objects5 = new LinkedList<>(); | |
323 | + String s5z = ""; | |
324 | + if (double5Z != 0.00) { | |
325 | + s5z = double5Z.toString(); | |
326 | + double5Dq = String.format(df.format(double5Z / checkMonth)); | |
327 | + } | |
328 | + objects5.add(s5z); | |
329 | + objects5.add(double5Dq); | |
330 | + reportMap.put("1", objects1); | |
331 | + reportMap.put("2", objects2); | |
332 | + reportMap.put("3", objects3); | |
333 | + reportMap.put("4", objects4); | |
334 | + reportMap.put("5", objects5); | |
335 | + return reportMap; | |
230 | 336 | } |
231 | 337 | |
232 | 338 | /** |