From 3388a03f394c926eb2f6e801446753e3cd5ea01f Mon Sep 17 00:00:00 2001 From: dongqin <123456> Date: Fri, 2 Aug 2019 15:49:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BabyEvaluationCriterionController.java | 5 ++-- ...luationCriterionNeuropsychologyListRequest.java | 28 +++++++++++++++++----- .../web/request/ExerciseAppraisalListRequest.java | 9 +++++++ .../impl/BabyEvaluationCriterionServiceImpl.java | 22 ++++++++++++----- 4 files changed, 50 insertions(+), 14 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEvaluationCriterionController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEvaluationCriterionController.java index f2e07c5..44343f5 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEvaluationCriterionController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEvaluationCriterionController.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; /** * 儿童量表 @@ -80,7 +81,7 @@ public class BabyEvaluationCriterionController extends BaseController { @ResponseBody @TokenRequired @RequestMapping(method = RequestMethod.POST, value = "/list") - private BaseResponse neuropsychologylList(@RequestBody EvaluationCriterionNeuropsychologyListRequest param, HttpServletRequest request) { + private BaseResponse neuropsychologylList(@RequestBody @Valid EvaluationCriterionNeuropsychologyListRequest param, HttpServletRequest request) { return babyEvaluationCriterionService.neuropsychologylList(getUserId(request), param); } @@ -184,7 +185,7 @@ public class BabyEvaluationCriterionController extends BaseController { @ResponseBody @TokenRequired @RequestMapping(method = RequestMethod.POST, value = "/exerciseAppraisal/list") - private BaseResponse exerciseAppraisalList(@RequestBody ExerciseAppraisalListRequest param, HttpServletRequest request) { + private BaseResponse exerciseAppraisalList(@RequestBody @Valid ExerciseAppraisalListRequest param, HttpServletRequest request) { return babyEvaluationCriterionService.exerciseAppraisalList(getUserId(request), param); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/EvaluationCriterionNeuropsychologyListRequest.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/EvaluationCriterionNeuropsychologyListRequest.java index 867eaeb..24d7f40 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/EvaluationCriterionNeuropsychologyListRequest.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/EvaluationCriterionNeuropsychologyListRequest.java @@ -2,6 +2,10 @@ package com.lyms.platform.operate.web.request; import com.lyms.platform.common.dao.BaseQuery; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; import java.io.Serializable; /** @@ -12,9 +16,14 @@ import java.io.Serializable; */ public class EvaluationCriterionNeuropsychologyListRequest extends BaseQuery implements Serializable { + @Size(max = 24) private String queryNo; - private Integer checkMonth; + @Min(1) @Max(84) + private Integer startCheckMonth; + + @Min(1) @Max(84) + private Integer endCheckMonth; /** * 优秀\聪明\正常\偏低\低下 @@ -22,7 +31,6 @@ public class EvaluationCriterionNeuropsychologyListRequest extends BaseQuery imp private String levelName; private String startCheckTime; - private String endCheckTime; private String checkDoctor; @@ -47,12 +55,20 @@ public class EvaluationCriterionNeuropsychologyListRequest extends BaseQuery imp this.queryNo = queryNo; } - public Integer getCheckMonth() { - return checkMonth; + public Integer getStartCheckMonth() { + return startCheckMonth; + } + + public void setStartCheckMonth(Integer startCheckMonth) { + this.startCheckMonth = startCheckMonth; + } + + public Integer getEndCheckMonth() { + return endCheckMonth; } - public void setCheckMonth(Integer checkMonth) { - this.checkMonth = checkMonth; + public void setEndCheckMonth(Integer endCheckMonth) { + this.endCheckMonth = endCheckMonth; } public String getLevelName() { diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ExerciseAppraisalListRequest.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ExerciseAppraisalListRequest.java index 99373b8..0e98fe8 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ExerciseAppraisalListRequest.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ExerciseAppraisalListRequest.java @@ -3,6 +3,10 @@ package com.lyms.platform.operate.web.request; import com.lyms.platform.common.dao.BaseQuery; import com.lyms.platform.common.result.BaseResponse; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.Size; import java.io.Serializable; /** @@ -24,13 +28,17 @@ public class ExerciseAppraisalListRequest extends BaseQuery implements Serializa /** * 起止:总分数 */ + @Min(0) @Max(9999) private Integer startScore; + @Min(0) @Max(9999) private Integer endScore; /** * 起止:百分位 */ + @Min(0) @Max(99) private Integer startPercentileScore; + @Min(0) @Max(99) private Integer endPercentileScore; /** @@ -38,6 +46,7 @@ public class ExerciseAppraisalListRequest extends BaseQuery implements Serializa */ private String checkDoctor; + @Size(max = 24) private String queryNo; public String getQueryNo() { 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 55b009e..a6fd561 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 @@ -845,14 +845,20 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri // 总分 Integer startScore = param.getStartScore(); Integer endScore = param.getEndScore(); - if (startScore != null && endScore != null && endScore >= startScore) { + if (startScore != null && endScore != null) { + if (endScore < startScore || startScore < 0) { + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("参数有误,请重新输入"); + } query.addCriteria(Criteria.where("totalScore").gte(startScore).lte(endScore)); } // 百分位 Integer startPercentileScore = param.getStartPercentileScore(); Integer endPercentileScore = param.getEndPercentileScore(); - if (startPercentileScore != null && endPercentileScore != null && endPercentileScore >= startPercentileScore) { + if (startPercentileScore != null && endPercentileScore != null) { + if (endPercentileScore < startPercentileScore || startPercentileScore < 0) { + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("参数有误,请重新输入"); + } query.addCriteria(Criteria.where("percentileScore").gte(startPercentileScore).lte(endPercentileScore)); } @@ -903,9 +909,10 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri } // 测量月龄 - Integer checkMonth = param.getCheckMonth(); - if (checkMonth != null && checkMonth != 0) { - query.addCriteria(Criteria.where("checkMonth").is(checkMonth)); + Integer startCheckMonth = param.getStartCheckMonth(); + Integer endCheckMonth = param.getEndCheckMonth(); + if (startCheckMonth != null && endCheckMonth != null) { + query.addCriteria(Criteria.where("checkMonth").gte(startCheckMonth).lte(endCheckMonth)); } // 智能等级 @@ -940,12 +947,15 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri for (BabyNeuroPsychologicalModel model : models) { Map map = new HashedMap(); map.put("name", model.getName()); - map.put("age", model.getGender() == 0 ? "女" : model.getGender() == 1 ? "男" : "未知"); + map.put("sex", model.getGender() == 0 ? "女" : model.getGender() == 1 ? "男" : "未知"); + map.put("age", DateUtil.getBabyMonthAge(model.getBirth(), new Date())); map.put("birthStr", model.getBirth() != null ? DateUtil.getyyyy_MM_dd(model.getBirth()) : ""); map.put("mcarNo", "1".equals(param.getIsEncrypt()) ? EncryptUtil.numberEncrypt(model.getMcertNo()) : model.getMcertNo()); map.put("mphone", "1".equals(param.getIsEncrypt()) ? EncryptUtil.numberEncrypt(model.getMphone()) : model.getMphone()); map.put("currentMonth", DateUtil.getBabyMonthAge(model.getBirth(), new Date())); map.put("checkMonth", model.getCheckMonth().toString()); + map.put("checkTimeStr", DateUtil.getyyyy_MM_dd(model.getCreateTime())); + map.put("score", model.getDevelopmentQuotient().toString()); map.put("levelName", model.getLevelName()); Users users = usersMapper.getUsers(Integer.parseInt(model.getCreateUser())); map.put("checkDoctorStr",users == null ? "" : users.getName()); -- 1.8.3.1