Commit 637d76fbe5227620cbc6ea6363059e6e0fdddac0
1 parent
f1c3a22788
Exists in
master
and in
6 other branches
入园体检用手机号查询儿童档案。
Showing 2 changed files with 59 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyKindergartenCheckController.java
View file @
637d76f
| ... | ... | @@ -179,6 +179,20 @@ |
| 179 | 179 | HttpServletRequest request) { |
| 180 | 180 | return babyKindergartenCheckFacade.queryEyeInfoByPhoneOrName(mPhone,childName, getUserId(request)); |
| 181 | 181 | } |
| 182 | + /** | |
| 183 | + * 入园体检用手机号查询儿童档案。 | |
| 184 | + * @param mPhone | |
| 185 | + * @param request | |
| 186 | + * @return | |
| 187 | + */ | |
| 188 | + @RequestMapping(value = "/queryBabyByPhone", method = RequestMethod.GET) | |
| 189 | + @ResponseBody | |
| 190 | + @TokenRequired | |
| 191 | + public BaseResponse queryBabyByPhone(@RequestParam(required = false) String mPhone, | |
| 192 | + @RequestParam(required = false) String babyId, | |
| 193 | + HttpServletRequest request) { | |
| 194 | + return babyKindergartenCheckFacade.queryBabyByPhone(mPhone,babyId, getUserId(request)); | |
| 195 | + } | |
| 182 | 196 | |
| 183 | 197 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyKindergartenCheckFacade.java
View file @
637d76f
| ... | ... | @@ -30,6 +30,9 @@ |
| 30 | 30 | import org.apache.commons.lang.math.NumberUtils; |
| 31 | 31 | import org.springframework.beans.factory.annotation.Autowired; |
| 32 | 32 | import org.springframework.data.domain.Sort; |
| 33 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 34 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 35 | +import org.springframework.data.mongodb.core.query.Query; | |
| 33 | 36 | import org.springframework.stereotype.Component; |
| 34 | 37 | |
| 35 | 38 | import javax.servlet.http.HttpServletResponse; |
| ... | ... | @@ -66,6 +69,8 @@ |
| 66 | 69 | private BabyCheckService babyCheckService; |
| 67 | 70 | @Autowired |
| 68 | 71 | private LhBabyEyeCheckService lhBabyEyeCheckService; |
| 72 | + @Autowired | |
| 73 | + private MongoTemplate mongoTemplate; | |
| 69 | 74 | /** |
| 70 | 75 | * 构造保存对象 |
| 71 | 76 | * |
| ... | ... | @@ -784,6 +789,46 @@ |
| 784 | 789 | map.put("lhaxisl",lhBabyEyeCheck.getLhaxisl()); |
| 785 | 790 | } |
| 786 | 791 | |
| 792 | + } | |
| 793 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 794 | + objectResponse.setData(map); | |
| 795 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 796 | + objectResponse.setErrormsg("成功"); | |
| 797 | + return objectResponse; | |
| 798 | + } | |
| 799 | + | |
| 800 | + public BaseResponse queryBabyByPhone(String mPhone, String babyId,Integer userId) { | |
| 801 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 802 | + Map map = new HashMap(); | |
| 803 | + Criteria criteria = new Criteria(); | |
| 804 | + criteria.and("hospitalId").is(hospitalId); | |
| 805 | + if(StringUtils.isNotEmpty(mPhone)) { | |
| 806 | + criteria.and("mphone").is(mPhone); | |
| 807 | + } | |
| 808 | + if(StringUtils.isNotEmpty(babyId)){ | |
| 809 | + criteria.and("id").is(babyId); | |
| 810 | + } | |
| 811 | + List<BabyModel> list = mongoTemplate.find(new Query(criteria), BabyModel.class); | |
| 812 | + List <Map> mapList = new ArrayList <>(); | |
| 813 | + if(StringUtils.isNotEmpty(mPhone)) { | |
| 814 | + for (BabyModel model : list) { | |
| 815 | + Map<String, String> map1 = new HashMap<>(); | |
| 816 | + map1.put("id", model.getId()); | |
| 817 | + map1.put("name", model.getName()); | |
| 818 | + if (model.getSex() == 0) { | |
| 819 | + map1.put("gender", "女"); | |
| 820 | + } else if (model.getSex() == 1) { | |
| 821 | + map1.put("gender", "男"); | |
| 822 | + } else { | |
| 823 | + map1.put("gender", "_"); | |
| 824 | + } | |
| 825 | + map1.put("birth", DateUtil.getYyyyMmDd(model.getBirth())); | |
| 826 | + mapList.add(map1); | |
| 827 | + } | |
| 828 | + map.put("babyResultList", mapList);//这个手机号下所有儿童 | |
| 829 | + } | |
| 830 | + if(StringUtils.isNotEmpty(babyId) && list.size()!=0){ | |
| 831 | + map.put("babyInfo",list.get(0)); | |
| 787 | 832 | } |
| 788 | 833 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
| 789 | 834 | objectResponse.setData(map); |