Commit 209d28a77017e54deed397b37b4e8eda4e856daa

Authored by dongqin
1 parent e758fe4b1f

添加列表

Showing 5 changed files with 322 additions and 33 deletions

platform-dal/src/main/java/com/lyms/platform/pojo/BabyNeuroPsychologicalModel.java View file @ 209d28a
... ... @@ -22,6 +22,29 @@
22 22  
23 23 private String babyId;
24 24  
  25 + private String mphone;
  26 +
  27 + private String mcertNo;
  28 +
  29 + private Integer gender;
  30 +
  31 + private Date birth;
  32 +
  33 + /**
  34 + * 发育商
  35 + */
  36 + private Integer developmentQuotient;
  37 +
  38 + /**
  39 + * 智能
  40 + */
  41 + private String aptitudeName;
  42 +
  43 + /**
  44 + * 等级评价
  45 + */
  46 + private String levelName;
  47 +
25 48 private List<String> configId;
26 49  
27 50 private String hospitalId;
... ... @@ -39,6 +62,62 @@
39 62 private String updateUser;
40 63  
41 64 private Integer yn;
  65 +
  66 + public String getMphone() {
  67 + return mphone;
  68 + }
  69 +
  70 + public void setMphone(String mphone) {
  71 + this.mphone = mphone;
  72 + }
  73 +
  74 + public String getMcertNo() {
  75 + return mcertNo;
  76 + }
  77 +
  78 + public void setMcertNo(String mcertNo) {
  79 + this.mcertNo = mcertNo;
  80 + }
  81 +
  82 + public Integer getGender() {
  83 + return gender;
  84 + }
  85 +
  86 + public void setGender(Integer gender) {
  87 + this.gender = gender;
  88 + }
  89 +
  90 + public Date getBirth() {
  91 + return birth;
  92 + }
  93 +
  94 + public void setBirth(Date birth) {
  95 + this.birth = birth;
  96 + }
  97 +
  98 + public Integer getDevelopmentQuotient() {
  99 + return developmentQuotient;
  100 + }
  101 +
  102 + public void setDevelopmentQuotient(Integer developmentQuotient) {
  103 + this.developmentQuotient = developmentQuotient;
  104 + }
  105 +
  106 + public String getAptitudeName() {
  107 + return aptitudeName;
  108 + }
  109 +
  110 + public void setAptitudeName(String aptitudeName) {
  111 + this.aptitudeName = aptitudeName;
  112 + }
  113 +
  114 + public String getLevelName() {
  115 + return levelName;
  116 + }
  117 +
  118 + public void setLevelName(String levelName) {
  119 + this.levelName = levelName;
  120 + }
42 121  
43 122 public Integer getCheckMonth() {
44 123 return checkMonth;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEvaluationCriterionController.java View file @ 209d28a
... ... @@ -70,6 +70,19 @@
70 70 return babyEvaluationCriterionService.saveOrUpdateNeuropsychology(param, getUserId(request));
71 71 }
72 72  
  73 + /**
  74 + * 神经心理项目--列表
  75 + *
  76 + * @param param
  77 + * @param request
  78 + * @return
  79 + */
  80 + @ResponseBody
  81 + @TokenRequired
  82 + @RequestMapping(method = RequestMethod.POST, value = "/list")
  83 + private BaseResponse neuropsychologylList(@RequestBody EvaluationCriterionNeuropsychologyListRequest param, HttpServletRequest request) {
  84 + return babyEvaluationCriterionService.neuropsychologylList(getUserId(request), param);
  85 + }
73 86  
74 87 /****************************************************20项神经运动筛查**********************************************/
75 88  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/EvaluationCriterionNeuropsychologyListRequest.java View file @ 209d28a
  1 +package com.lyms.platform.operate.web.request;
  2 +
  3 +import com.lyms.platform.common.dao.BaseQuery;
  4 +
  5 +import java.io.Serializable;
  6 +
  7 +/**
  8 + *
  9 + * @Author dongqin
  10 + * @Description
  11 + * @Date 14:27 2019/8/1
  12 + */
  13 +public class EvaluationCriterionNeuropsychologyListRequest extends BaseQuery implements Serializable {
  14 +
  15 + private String queryNo;
  16 +
  17 + private Integer checkMonth;
  18 +
  19 + /**
  20 + * 优秀\聪明\正常\偏低\低下
  21 + */
  22 + private String levelName;
  23 +
  24 + private String startCheckTime;
  25 +
  26 + private String endCheckTime;
  27 +
  28 + private String checkDoctor;
  29 + /**
  30 + * 是否加密 1|是 2|否
  31 + */
  32 + private String isEncrypt = "2";
  33 +
  34 + public String getIsEncrypt() {
  35 + return isEncrypt;
  36 + }
  37 +
  38 + public void setIsEncrypt(String isEncrypt) {
  39 + this.isEncrypt = isEncrypt;
  40 + }
  41 +
  42 + public String getQueryNo() {
  43 + return queryNo;
  44 + }
  45 +
  46 + public void setQueryNo(String queryNo) {
  47 + this.queryNo = queryNo;
  48 + }
  49 +
  50 + public Integer getCheckMonth() {
  51 + return checkMonth;
  52 + }
  53 +
  54 + public void setCheckMonth(Integer checkMonth) {
  55 + this.checkMonth = checkMonth;
  56 + }
  57 +
  58 + public String getLevelName() {
  59 + return levelName;
  60 + }
  61 +
  62 + public void setLevelName(String levelName) {
  63 + this.levelName = levelName;
  64 + }
  65 +
  66 + public String getStartCheckTime() {
  67 + return startCheckTime;
  68 + }
  69 +
  70 + public void setStartCheckTime(String startCheckTime) {
  71 + this.startCheckTime = startCheckTime;
  72 + }
  73 +
  74 + public String getEndCheckTime() {
  75 + return endCheckTime;
  76 + }
  77 +
  78 + public void setEndCheckTime(String endCheckTime) {
  79 + this.endCheckTime = endCheckTime;
  80 + }
  81 +
  82 + public String getCheckDoctor() {
  83 + return checkDoctor;
  84 + }
  85 +
  86 + public void setCheckDoctor(String checkDoctor) {
  87 + this.checkDoctor = checkDoctor;
  88 + }
  89 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEvaluationCriterionService.java View file @ 209d28a
... ... @@ -104,5 +104,14 @@
104 104 * @return
105 105 */
106 106 BaseResponse exerciseAppraisalList(Integer userId, ExerciseAppraisalListRequest param);
  107 +
  108 + /**
  109 + * 神经心理项目--列表
  110 + *
  111 + * @param userId
  112 + * @param param
  113 + * @return
  114 + */
  115 + BaseResponse neuropsychologylList(Integer userId, EvaluationCriterionNeuropsychologyListRequest param);
107 116 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java View file @ 209d28a
... ... @@ -159,7 +159,6 @@
159 159 Integer mentalAge = 0;
160 160  
161 161 // 当前本月的被勾选的总分数
162   - Double currentProjectVal = 0D;
163 162 List<Map<String, Object>> mapList = new LinkedList<>();
164 163 for (int i = 0, size = months.length; i < size ; i++) {
165 164  
... ... @@ -189,7 +188,6 @@
189 188 and("babyId").is(babyId).and("yn").is(YnEnums.YES.getId()).and("checkMonth").is(checkMonth)), BabyNeuroPsychologicalModel.class);
190 189 if (one != null) {
191 190 isSelected = true;
192   - currentProjectVal += projectVal;
193 191 if (neuroPsychologicalId == null) {
194 192 neuroPsychologicalId = one.getId();
195 193 }
... ... @@ -226,34 +224,6 @@
226 224  
227 225 mapList.add(objectMap);
228 226 }
229   - BigDecimal defOldVal = BigDecimal.ZERO;
230   - if (checkMonth - 2 > 1) {
231   - /*MatchOperation match = Aggregation.match(Criteria.where(""));
232   - GroupOperation group = Aggregation.group();
233   - Aggregation aggregation = Aggregation.newAggregation(match, group);
234   - AggregationResults<Map> aggregate = mongoTemplate.aggregate(aggregation, Map.class);
235   - List<Map> mappedResults = aggregate.getMappedResults();*/
236   - //mongoTemplate.find(Query.query(Criteria.where().))
237   - }
238   - int developmentQuotient = 0;
239   - if (currentProjectVal > 0) {
240   - mentalAge = new BigDecimal(currentProjectVal).divide(new BigDecimal(5), 0, BigDecimal.ROUND_HALF_UP).intValue();
241   - developmentQuotient = new BigDecimal(mentalAge).divide(new BigDecimal(checkMonth), 0, BigDecimal.ROUND_HALF_UP).intValue();
242   - developmentQuotient *= 100;
243   - }
244   -
245   - // 发育商、智能、等级评价
246   - BabyEvaluationCriterionModel criterionModel = mongoTemplate.findOne(Query.query(Criteria.where("type").is(2).
247   - and("minBorder").lte(developmentQuotient).and("maxBorder").gte(developmentQuotient)), BabyEvaluationCriterionModel.class);
248   - String aptitudeName = null,levelName = null;
249   - if (criterionModel != null) {
250   - aptitudeName = criterionModel.getAptitudeName();
251   - levelName = criterionModel.getLevelName();
252   - }
253   - resultMap.put("developmentQuotient", developmentQuotient);
254   - resultMap.put("aptitudeName", aptitudeName);
255   - resultMap.put("levelName", levelName);
256   -
257 227 resultMap.put("configs", mapList);
258 228 return resultMap;
259 229 }
... ... @@ -317,6 +287,12 @@
317 287 }
318 288 objectMap.put("checkMonth", checkMonthStr);
319 289 objectMap.put("id", model.getId());
  290 +
  291 + // 发育商、智能、等级评价
  292 + objectMap.put("developmentQuotient", model.getDevelopmentQuotient());
  293 + objectMap.put("aptitudeName", model.getAptitudeName());
  294 + objectMap.put("levelName", model.getLevelName());
  295 +
320 296 objectList.add(objectMap);
321 297 }
322 298  
323 299  
... ... @@ -354,9 +330,13 @@
354 330 return new BaseResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg("儿童建档数据缺失");
355 331 }
356 332 Integer checkMonth = DateUtil.getBabyAgeMonth(babyModel.getBirth(), new Date());
  333 + paramModel.setGender(babyModel.getSex());
  334 + paramModel.setBirth(babyModel.getBirth());
  335 + paramModel.setMcertNo(babyModel.getMcertNo());
  336 + paramModel.setMphone(babyModel.getMphone());
357 337 if (StringUtils.isNotEmpty(id)) {
358 338 // 更新
359   - update(userId, configId, id);
  339 + update(userId, configId, id, paramModel);
360 340 } else {
361 341 Date dayFirstSecond = DateUtil.getDayFirstSecond(new Date());
362 342 Date dayLastSecond = DateUtil.getDayLastSecond(new Date());
... ... @@ -365,7 +345,7 @@
365 345 .gte(dayFirstSecond).lte(dayLastSecond).and("yn").is(YnEnums.YES.getId())), BabyNeuroPsychologicalModel.class);
366 346 if (model != null) {
367 347 // 更新
368   - update(userId, configId, model.getId());
  348 + update(userId, configId, model.getId(), paramModel);
369 349 } else {
370 350 // 新增
371 351 paramModel.setHospitalId(hospitalId);
372 352  
373 353  
... ... @@ -380,16 +360,63 @@
380 360 }
381 361  
382 362 /**
  363 + * 根据configId 计算智力商
  364 + * @param paramModel
  365 + * @return
  366 + */
  367 + private BabyNeuroPsychologicalModel getLevelByConfigId(BabyNeuroPsychologicalModel paramModel, Integer checkMonth) {
  368 + List<String> configIds = paramModel.getConfigId();
  369 + Double val = 0d;
  370 + for (String configId : configIds) {
  371 + BabyEvaluationCriterionModel evaluationCriterionModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(configId)), BabyEvaluationCriterionModel.class);
  372 + val += evaluationCriterionModel.getProjectVal();
  373 + }
  374 + if (checkMonth - 2 >1){
  375 + // 默认之前的全部通过
  376 + Integer currentMonth = getCurrentMonth(checkMonth, 3, 3);
  377 + List<BabyEvaluationCriterionModel> modelList = mongoTemplate.find(Query.query(Criteria.where("month").gte(currentMonth).and("type").is(3)), BabyEvaluationCriterionModel.class);
  378 + for (BabyEvaluationCriterionModel model : modelList) {
  379 + val += model.getProjectVal();
  380 + }
  381 + }
  382 + int developmentQuotient = 0;
  383 + if (val > 0) {
  384 + int mentalAge = new BigDecimal(val.toString()).divide(new BigDecimal(5), 0, BigDecimal.ROUND_HALF_UP).intValue();
  385 + developmentQuotient = new BigDecimal(mentalAge).divide(new BigDecimal(checkMonth), 0, BigDecimal.ROUND_HALF_UP).intValue();
  386 + developmentQuotient *= 100;
  387 + }
  388 +
  389 + // 发育商、智能、等级评价
  390 + BabyEvaluationCriterionModel criterionModel = mongoTemplate.findOne(Query.query(Criteria.where("type").is(2).
  391 + and("minBorder").lte(developmentQuotient).and("maxBorder").gte(developmentQuotient)), BabyEvaluationCriterionModel.class);
  392 + String aptitudeName = null,levelName = null;
  393 + if (criterionModel != null) {
  394 + aptitudeName = criterionModel.getAptitudeName();
  395 + levelName = criterionModel.getLevelName();
  396 + }
  397 + paramModel.setDevelopmentQuotient(developmentQuotient);
  398 + paramModel.setAptitudeName(aptitudeName);
  399 + paramModel.setLevelName(levelName);
  400 + return paramModel;
  401 + }
  402 +
  403 + /**
383 404 * 更新检查项
384 405 *
385 406 * @param userId
386 407 * @param configId
387 408 * @param id
388 409 */
389   - private void update(Integer userId, List<String> configId, String id) {
  410 + private void update(Integer userId, List<String> configId, String id, BabyNeuroPsychologicalModel paramModel) {
  411 + BabyNeuroPsychologicalModel model = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(id)), BabyNeuroPsychologicalModel.class);
  412 + Integer checkMonth = model.getCheckMonth();
  413 + paramModel = getLevelByConfigId(paramModel, checkMonth);
390 414 Query query = Query.query(Criteria.where("_id").is(id));
391 415 Update update = new Update();
392 416 update.set("configId", configId);
  417 + update.set("developmentQuotient", paramModel.getDevelopmentQuotient());
  418 + update.set("aptitudeName", paramModel.getAptitudeName());
  419 + update.set("levelName", paramModel.getLevelName());
393 420 update.set("updateTime", new Date());
394 421 update.set("updateUser", userId.toString());
395 422 mongoTemplate.updateFirst(query, update, BabyNeuroPsychologicalModel.class);
... ... @@ -837,6 +864,78 @@
837 864 map.put("checkTimeStr", DateUtil.gety_m_dhm(model.getCheckTime()));
838 865 Users users = usersMapper.getUsers(Integer.parseInt(model.getCheckDoctor()));
839 866 map.put("checkDoctorStr",users == null ? "" : users.getName());
  867 + maps.add(map);
  868 + }
  869 + BaseListResponse baseListResponse = new BaseListResponse();
  870 + baseListResponse.setPageInfo(param.getPageInfo());
  871 + baseListResponse.setData(maps);
  872 + return baseListResponse;
  873 + }
  874 +
  875 + /**
  876 + * 神经心理项目--列表
  877 + *
  878 + * @param userId
  879 + * @param param
  880 + * @return
  881 + */
  882 + @Override
  883 + public BaseResponse neuropsychologylList(Integer userId, EvaluationCriterionNeuropsychologyListRequest param) {
  884 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  885 + Query query = new Query();
  886 + query.addCriteria(Criteria.where("yn").is(YnEnums.YES.getId()).and("hospitalId").is(hospitalId));
  887 +
  888 + // 查询号
  889 + String queryNo = param.getQueryNo();
  890 + if (StringUtils.isNotEmpty(queryNo)) {
  891 + query.addCriteria(new Criteria().orOperator(Criteria.where("name").is(queryNo), Criteria.where("mphone").is(queryNo), Criteria.where("mcertNo").is(queryNo)));
  892 + }
  893 +
  894 + // 测量月龄
  895 + Integer checkMonth = param.getCheckMonth();
  896 + if (checkMonth != null && checkMonth != 0) {
  897 + query.addCriteria(Criteria.where("checkMonth").is(checkMonth));
  898 + }
  899 +
  900 + // 智能等级
  901 + String levelName = param.getLevelName();
  902 + if (StringUtils.isNotEmpty(levelName)) {
  903 + query.addCriteria(Criteria.where("levelName").is(levelName));
  904 + }
  905 +
  906 + // 测量日期
  907 + String startCheckTime = param.getStartCheckTime();
  908 + String endCheckTime = param.getEndCheckTime();
  909 + if (StringUtils.isNotEmpty(startCheckTime) && StringUtils.isNotEmpty(endCheckTime)) {
  910 + Date start = DateUtil.parseYMDHMS(startCheckTime + " 00.00.00");
  911 + Date endt = DateUtil.parseYMDHMS(endCheckTime + " 23.59.59");
  912 + query.addCriteria(Criteria.where("createTime").gte(start).lte(endt));
  913 + }
  914 +
  915 + // 测量人
  916 + String checkDoctor = param.getCheckDoctor();
  917 + if (StringUtils.isNotEmpty(checkDoctor)) {
  918 + query.addCriteria(Criteria.where("createUser").is(checkDoctor));
  919 + }
  920 +
  921 +
  922 + long count = mongoTemplate.count(query, BabyNeuroPsychologicalModel.class);
  923 + param.mysqlBuild((int) count);
  924 + query.skip(param.getOffset()).limit(param.getLimit());
  925 + query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "createTime")));
  926 +
  927 + List<BabyNeuroPsychologicalModel> models = mongoTemplate.find(query, BabyNeuroPsychologicalModel.class);
  928 + List<Map<String, String>> maps = new ArrayList<>();
  929 + for (BabyNeuroPsychologicalModel model : models) {
  930 + Map<String, String> map = BeanUtils.objectToStringMap(model);
  931 + map.put("age", model.getGender() == 0 ? "女" : model.getGender() == 1 ? "男" : "未知");
  932 + map.put("birthStr", model.getBirth() != null ? DateUtil.getyyyy_MM_dd(model.getBirth()) : "");
  933 + map.put("mcarNo", "1".equals(param.getIsEncrypt()) ? EncryptUtil.numberEncrypt(model.getMcertNo()) : model.getMcertNo());
  934 + map.put("mphone", "1".equals(param.getIsEncrypt()) ? EncryptUtil.numberEncrypt(model.getMphone()) : model.getMphone());
  935 + map.put("currentMonth", DateUtil.getBabyMonthAge(model.getBirth(), new Date()));
  936 + Users users = usersMapper.getUsers(Integer.parseInt(model.getCreateUser()));
  937 + map.put("checkDoctorStr",users == null ? "" : users.getName());
  938 + map.remove("configId");
840 939 maps.add(map);
841 940 }
842 941 BaseListResponse baseListResponse = new BaseListResponse();