Commit 20add7c7fa18dad5f45b77c0609be32c57b1f2b0
1 parent
c9e911bd7b
Exists in
master
and in
1 other branch
儿童量表- 运动测评
Showing 5 changed files with 225 additions and 28 deletions
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEvaluationCriterionController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ExerciseAppraisalListRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEvaluationCriterionService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
20add7c
| ... | ... | @@ -1480,6 +1480,22 @@ |
| 1480 | 1480 | return calendar.getTime(); |
| 1481 | 1481 | } |
| 1482 | 1482 | |
| 1483 | + /** | |
| 1484 | + * 当前的开始时间 | |
| 1485 | + * | |
| 1486 | + * @param date | |
| 1487 | + * @return | |
| 1488 | + */ | |
| 1489 | + public static Date getDayFirstSecond(Date date) { | |
| 1490 | + Calendar instance = Calendar.getInstance(); | |
| 1491 | + instance.setTime(date); | |
| 1492 | + instance.add(Calendar.HOUR_OF_DAY, 0); | |
| 1493 | + instance.add(Calendar.MINUTE, 0); | |
| 1494 | + instance.add(Calendar.SECOND, 0); | |
| 1495 | + instance.add(Calendar.MILLISECOND, 0); | |
| 1496 | + return instance.getTime(); | |
| 1497 | + } | |
| 1498 | + | |
| 1483 | 1499 | private static List<Date> getMonthBetween(Date start, Date end) { |
| 1484 | 1500 | List<Date> result = new ArrayList<>(); |
| 1485 | 1501 | Calendar min = Calendar.getInstance(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEvaluationCriterionController.java
View file @
20add7c
| ... | ... | @@ -4,10 +4,7 @@ |
| 4 | 4 | import com.lyms.platform.common.annotation.TokenRequired; |
| 5 | 5 | import com.lyms.platform.common.base.BaseController; |
| 6 | 6 | import com.lyms.platform.common.result.BaseResponse; |
| 7 | -import com.lyms.platform.operate.web.request.EvaluationCriterionNeuropsychologyRequest; | |
| 8 | -import com.lyms.platform.operate.web.request.ExerciseAppraisalRequest; | |
| 9 | -import com.lyms.platform.operate.web.request.NerveMovementListRequest; | |
| 10 | -import com.lyms.platform.operate.web.request.NerveMovementSaveOrUpdateRequest; | |
| 7 | +import com.lyms.platform.operate.web.request.*; | |
| 11 | 8 | import com.lyms.platform.operate.web.service.BabyEvaluationCriterionService; |
| 12 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | 10 | import org.springframework.stereotype.Controller; |
| ... | ... | @@ -157,5 +154,20 @@ |
| 157 | 154 | private BaseResponse findExerciseAppraisal(@RequestBody JSONObject jsonObject, HttpServletRequest request) { |
| 158 | 155 | return babyEvaluationCriterionService.findExerciseAppraisal(getUserId(request), jsonObject); |
| 159 | 156 | } |
| 157 | + | |
| 158 | + /** | |
| 159 | + * 儿童量表--运动测评--列表 | |
| 160 | + * | |
| 161 | + * @param param | |
| 162 | + * @param request | |
| 163 | + * @return | |
| 164 | + */ | |
| 165 | + @ResponseBody | |
| 166 | + @TokenRequired | |
| 167 | + @RequestMapping(method = RequestMethod.POST, value = "/exerciseAppraisal/list") | |
| 168 | + private BaseResponse exerciseAppraisalList(@RequestBody ExerciseAppraisalListRequest param, HttpServletRequest request) { | |
| 169 | + return babyEvaluationCriterionService.exerciseAppraisalList(getUserId(request), param); | |
| 170 | + } | |
| 171 | + | |
| 160 | 172 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ExerciseAppraisalListRequest.java
View file @
20add7c
| 1 | +package com.lyms.platform.operate.web.request; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 4 | +import com.lyms.platform.common.result.BaseResponse; | |
| 5 | + | |
| 6 | +import java.io.Serializable; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * | |
| 10 | + * @Author dongqin | |
| 11 | + * @Description | |
| 12 | + * @Date 14:23 2019/7/26 | |
| 13 | + */ | |
| 14 | +public class ExerciseAppraisalListRequest extends BaseQuery implements Serializable { | |
| 15 | + | |
| 16 | + private static final long serialVersionUID = 5513357445788346435L; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 起止:检查时间 | |
| 20 | + */ | |
| 21 | + private String startCheckTime; | |
| 22 | + private String endCheckTime; | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 起止:总分数 | |
| 26 | + */ | |
| 27 | + private Integer startScore; | |
| 28 | + private Integer endScore; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 起止:百分位 | |
| 32 | + */ | |
| 33 | + private Integer startPercentileScore; | |
| 34 | + private Integer endPercentileScore; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 检查医生 | |
| 38 | + */ | |
| 39 | + private String checkDoctor; | |
| 40 | + | |
| 41 | + public String getStartCheckTime() { | |
| 42 | + return startCheckTime; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setStartCheckTime(String startCheckTime) { | |
| 46 | + this.startCheckTime = startCheckTime; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public String getEndCheckTime() { | |
| 50 | + return endCheckTime; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setEndCheckTime(String endCheckTime) { | |
| 54 | + this.endCheckTime = endCheckTime; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public Integer getStartScore() { | |
| 58 | + return startScore; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setStartScore(Integer startScore) { | |
| 62 | + this.startScore = startScore; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public Integer getEndScore() { | |
| 66 | + return endScore; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setEndScore(Integer endScore) { | |
| 70 | + this.endScore = endScore; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public Integer getStartPercentileScore() { | |
| 74 | + return startPercentileScore; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setStartPercentileScore(Integer startPercentileScore) { | |
| 78 | + this.startPercentileScore = startPercentileScore; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public Integer getEndPercentileScore() { | |
| 82 | + return endPercentileScore; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setEndPercentileScore(Integer endPercentileScore) { | |
| 86 | + this.endPercentileScore = endPercentileScore; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public String getCheckDoctor() { | |
| 90 | + return checkDoctor; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setCheckDoctor(String checkDoctor) { | |
| 94 | + this.checkDoctor = checkDoctor; | |
| 95 | + } | |
| 96 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEvaluationCriterionService.java
View file @
20add7c
| ... | ... | @@ -2,10 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.lyms.platform.common.result.BaseResponse; |
| 5 | -import com.lyms.platform.operate.web.request.EvaluationCriterionNeuropsychologyRequest; | |
| 6 | -import com.lyms.platform.operate.web.request.ExerciseAppraisalRequest; | |
| 7 | -import com.lyms.platform.operate.web.request.NerveMovementListRequest; | |
| 8 | -import com.lyms.platform.operate.web.request.NerveMovementSaveOrUpdateRequest; | |
| 5 | +import com.lyms.platform.operate.web.request.*; | |
| 9 | 6 | |
| 10 | 7 | import javax.servlet.http.HttpServletRequest; |
| 11 | 8 | |
| ... | ... | @@ -98,5 +95,14 @@ |
| 98 | 95 | * @return |
| 99 | 96 | */ |
| 100 | 97 | BaseResponse findExerciseAppraisal(Integer userId, JSONObject jsonObject); |
| 98 | + | |
| 99 | + /** | |
| 100 | + * 儿童量表--运动测评--列表 | |
| 101 | + * | |
| 102 | + * @param userId | |
| 103 | + * @param param | |
| 104 | + * @return | |
| 105 | + */ | |
| 106 | + BaseResponse exerciseAppraisalList(Integer userId, ExerciseAppraisalListRequest param); | |
| 101 | 107 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java
View file @
20add7c
| ... | ... | @@ -7,10 +7,7 @@ |
| 7 | 7 | import com.lyms.platform.common.result.BaseResponse; |
| 8 | 8 | import com.lyms.platform.common.utils.*; |
| 9 | 9 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| 10 | -import com.lyms.platform.operate.web.request.EvaluationCriterionNeuropsychologyRequest; | |
| 11 | -import com.lyms.platform.operate.web.request.ExerciseAppraisalRequest; | |
| 12 | -import com.lyms.platform.operate.web.request.NerveMovementListRequest; | |
| 13 | -import com.lyms.platform.operate.web.request.NerveMovementSaveOrUpdateRequest; | |
| 10 | +import com.lyms.platform.operate.web.request.*; | |
| 14 | 11 | import com.lyms.platform.operate.web.service.BabyEvaluationCriterionService; |
| 15 | 12 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
| 16 | 13 | import com.lyms.platform.permission.dao.master.MasterUsersMapper; |
| ... | ... | @@ -577,7 +574,7 @@ |
| 577 | 574 | if (StringUtils.isEmpty(babyId)) { |
| 578 | 575 | return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("参数缺失"); |
| 579 | 576 | } |
| 580 | - BabyModel model = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(hospitalId).and("hospitalId").is(hospitalId)), BabyModel.class); | |
| 577 | + BabyModel model = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(babyId).and("hospitalId").is(hospitalId)), BabyModel.class); | |
| 581 | 578 | BaseResponse baseResponse = new BaseResponse(); |
| 582 | 579 | if (model != null) { |
| 583 | 580 | map.put("babyId", babyId); |
| 584 | 581 | |
| 585 | 582 | |
| ... | ... | @@ -591,11 +588,15 @@ |
| 591 | 588 | StringBuilder builder = new StringBuilder(); |
| 592 | 589 | Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("phone").is(model.getMphone())), Patients.class); |
| 593 | 590 | if (patients != null) { |
| 591 | + List<String> list = new ArrayList<>(); | |
| 594 | 592 | List<String> riskFactorId = patients.getRiskFactorId(); |
| 593 | + if (CollectionUtils.isNotEmpty(riskFactorId)) { | |
| 594 | + list.addAll(riskFactorId); | |
| 595 | + } | |
| 595 | 596 | List<String> firstRiskFactorId = patients.getFirstRiskFactorId(); |
| 596 | - List<String> list = new ArrayList<>(); | |
| 597 | - list.addAll(riskFactorId); | |
| 598 | - list.addAll(firstRiskFactorId); | |
| 597 | + if (CollectionUtils.isNotEmpty(firstRiskFactorId)) { | |
| 598 | + list.addAll(firstRiskFactorId); | |
| 599 | + } | |
| 599 | 600 | if (list.size() > 0) { |
| 600 | 601 | for (String id : list) { |
| 601 | 602 | BasicConfig basicConfig = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(id).and("yn").is(YnEnums.YES.getId())), BasicConfig.class); |
| 602 | 603 | |
| 603 | 604 | |
| 604 | 605 | |
| 605 | 606 | |
| 606 | 607 | |
| 607 | 608 | |
| 608 | 609 | |
| 609 | 610 | |
| ... | ... | @@ -676,42 +677,108 @@ |
| 676 | 677 | */ |
| 677 | 678 | @Override |
| 678 | 679 | public BaseResponse findExerciseAppraisal(Integer userId, JSONObject jsonObject) { |
| 679 | - String cardNo = jsonObject.getString("queryNo"); | |
| 680 | - String patientIdCard = jsonObject.getString("patientIdCard"); | |
| 680 | + String babyId = jsonObject.getString("babyId"); | |
| 681 | 681 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
| 682 | 682 | BaseResponse baseResponse = new BaseResponse(); |
| 683 | 683 | Query query = new Query(); |
| 684 | - query.addCriteria(Criteria.where("hospitalId").is(hospitalId).and("yn").is(YnEnums.YES.getId())); | |
| 684 | + query.addCriteria(Criteria.where("hospitalId").is(hospitalId).and("yn").is(YnEnums.YES.getId()).and("_id").is(babyId)); | |
| 685 | 685 | query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "createTime"))); |
| 686 | - if (StringUtils.isNotEmpty(cardNo)) { | |
| 687 | - query.addCriteria(new Criteria().orOperator(Criteria.where("cardNo").is(cardNo), Criteria.where("mphone").is(cardNo))); | |
| 686 | + /*Map<String, Object> objectHashMap = new HashMap<>(); | |
| 687 | + BabyModel babyModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(babyId)), BabyModel.class); | |
| 688 | + Map<String, String> map = new HashMap<>(); | |
| 689 | + if (babyModel == null) { | |
| 690 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("数据异常"); | |
| 688 | 691 | } |
| 689 | - if (StringUtils.isNotEmpty(patientIdCard)) { | |
| 690 | - query.addCriteria(Criteria.where("vcCardNo").is(patientIdCard)); | |
| 691 | - } | |
| 692 | - | |
| 692 | + map.put("age", DateUtil.getBabyMonthAge(babyModel.getBirth(), new Date())); | |
| 693 | + map.put("name", babyModel.getName()); | |
| 694 | + map.put("mname", babyModel.getMname()); | |
| 695 | + map.put("carNo", babyModel.getCardNo()); | |
| 696 | + map.put("", babyModel.) | |
| 697 | + objectHashMap.put("babyModel",map);*/ | |
| 693 | 698 | final List<ExerciseAppraisalModel> models = mongoTemplate.find(query, ExerciseAppraisalModel.class); |
| 694 | - final List<Map<String, String>> modelList = new ArrayList<Map<String, String>>(){{ | |
| 699 | + List<Map<String, String>> modelList = new ArrayList<Map<String, String>>(){{ | |
| 695 | 700 | if (CollectionUtils.isNotEmpty(models)) { |
| 696 | 701 | for (ExerciseAppraisalModel model : models) { |
| 697 | 702 | Map<String, String> map = BeanUtils.objectToStringMap(model); |
| 698 | - map.put("age", DateUtil.getBabyMonthAge(model.getBirth(), new Date())); | |
| 699 | 703 | add(map); |
| 700 | 704 | } |
| 701 | 705 | } |
| 702 | 706 | }}; |
| 707 | + //objectHashMap.put("list", models); | |
| 703 | 708 | baseResponse.setObject(modelList); |
| 704 | 709 | return baseResponse; |
| 705 | 710 | } |
| 706 | 711 | |
| 707 | 712 | /** |
| 713 | + * 儿童量表--运动测评--列表 | |
| 714 | + * | |
| 715 | + * @param userId | |
| 716 | + * @param param | |
| 717 | + * @return | |
| 718 | + */ | |
| 719 | + @Override | |
| 720 | + public BaseResponse exerciseAppraisalList(Integer userId, ExerciseAppraisalListRequest param) { | |
| 721 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 722 | + Query query = new Query(); | |
| 723 | + query.addCriteria(Criteria.where("yn").is(YnEnums.YES.getId()).and("hospitalId").is(hospitalId)); | |
| 724 | + | |
| 725 | + // 检查时间 | |
| 726 | + String startCheckTime = param.getStartCheckTime(); | |
| 727 | + String endCheckTime = param.getEndCheckTime(); | |
| 728 | + if (StringUtils.isNotEmpty(startCheckTime) && StringUtils.isNotEmpty(endCheckTime)) { | |
| 729 | + Date start = DateUtil.getDayFirstSecond(DateUtil.parseYMD(startCheckTime)); | |
| 730 | + Date end = DateUtil.getDayLastSecond(DateUtil.parseYMD(endCheckTime)); | |
| 731 | + query.addCriteria(Criteria.where("checkTime").gte(start).lte(end)); | |
| 732 | + } | |
| 733 | + | |
| 734 | + // 总分 | |
| 735 | + Integer startScore = param.getStartScore(); | |
| 736 | + Integer endScore = param.getEndScore(); | |
| 737 | + if (startScore != null && endCheckTime != null && endScore >= startScore) { | |
| 738 | + query.addCriteria(Criteria.where("totalScore").gte(startScore).lte(endScore)); | |
| 739 | + } | |
| 740 | + | |
| 741 | + // 百分位 | |
| 742 | + Integer startPercentileScore = param.getStartPercentileScore(); | |
| 743 | + Integer endPercentileScore = param.getEndPercentileScore(); | |
| 744 | + if (startPercentileScore != null && endPercentileScore != null && endPercentileScore >= startPercentileScore) { | |
| 745 | + query.addCriteria(Criteria.where("percentileScore").gte(startPercentileScore).lte(endPercentileScore)); | |
| 746 | + } | |
| 747 | + | |
| 748 | + // 检查医生 | |
| 749 | + String checkDoctor = param.getCheckDoctor(); | |
| 750 | + if (StringUtils.isNotEmpty(checkDoctor)) { | |
| 751 | + query.addCriteria(Criteria.where("checkDoctor").is(checkDoctor)); | |
| 752 | + } | |
| 753 | + | |
| 754 | + long count = mongoTemplate.count(query, ExerciseAppraisalModel.class); | |
| 755 | + param.mysqlBuild((int) count); | |
| 756 | + query.skip(param.getLimit()).limit(param.getLimit()); | |
| 757 | + query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "createTime"))); | |
| 758 | + | |
| 759 | + List<ExerciseAppraisalModel> models = mongoTemplate.find(query, ExerciseAppraisalModel.class); | |
| 760 | + List<Map<String, String>> maps = new ArrayList<>(); | |
| 761 | + for (ExerciseAppraisalModel model : models) { | |
| 762 | + Map<String, String> map = BeanUtils.objectToStringMap(model); | |
| 763 | + map.put("age", DateUtil.getBabyMonthAge(model.getBirth(), new Date())); | |
| 764 | + map.put("checkTimeStr", DateUtil.gety_m_dhm(model.getCheckTime())); | |
| 765 | + map.put("checkDoctorStr", usersMapper.getUsers(Integer.parseInt(model.getCheckDoctor())).getName()); | |
| 766 | + maps.add(map); | |
| 767 | + } | |
| 768 | + BaseListResponse baseListResponse = new BaseListResponse(); | |
| 769 | + baseListResponse.setPageInfo(param.getPageInfo()); | |
| 770 | + baseListResponse.setData(maps); | |
| 771 | + return baseListResponse; | |
| 772 | + } | |
| 773 | + | |
| 774 | + /** | |
| 708 | 775 | * 参数效验 |
| 709 | 776 | * |
| 710 | 777 | * @param param |
| 711 | 778 | * @return |
| 712 | 779 | */ |
| 713 | 780 | private boolean paramValid(ExerciseAppraisalRequest param) { |
| 714 | - if (StringUtils.isEmpty(babyId) || StringUtils.isEmpty(param.getCheckDoctor()) || param.getCheckTime() == null | |
| 781 | + if (StringUtils.isEmpty(param.getBabyId()) || StringUtils.isEmpty(param.getCheckDoctor()) || param.getCheckTime() == null | |
| 715 | 782 | || param.getLieProstratComponent() == null || param.getLieProstrateInside() == null |
| 716 | 783 | || param.getLieProstrateOutside() == null || param.getLieProstrateInsideIndexs() == null |
| 717 | 784 | || param.getLieProstrateOutsideIndexs() == null |