Commit e7d55a03e073cca8d34695c375c80c9cc8afe704
1 parent
213620ab70
Exists in
master
and in
6 other branches
中医指导:儿童小程序接口-文章查询
Showing 2 changed files with 45 additions and 3 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MedicineArticleController.java
View file @
e7d55a0
| ... | ... | @@ -96,6 +96,16 @@ |
| 96 | 96 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 97 | 97 | return medicineArticleFacade.queryListPage(modelQuery,loginState.getId()); |
| 98 | 98 | } |
| 99 | + /** | |
| 100 | + * 儿童小程序接口-文章查询 | |
| 101 | + * @param id | |
| 102 | + * @return | |
| 103 | + */ | |
| 104 | + @ResponseBody | |
| 105 | + @RequestMapping(value = "/queryArticleBabyApp",method = RequestMethod.GET) | |
| 106 | + public BaseResponse queryArticleBabyApp(@RequestParam(value = "id") String id) { | |
| 107 | + return medicineArticleFacade.queryArticleBabyApp(id); | |
| 108 | + } | |
| 99 | 109 | |
| 100 | 110 | |
| 101 | 111 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MedicineArticleFacade.java
View file @
e7d55a0
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.BabyBookbuildingService; |
| 4 | +import com.lyms.platform.biz.service.BabyCheckService; | |
| 4 | 5 | import com.lyms.platform.biz.service.MedicineArticleService; |
| 5 | 6 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 6 | 7 | import com.lyms.platform.common.enums.OptActionEnums; |
| 7 | 8 | |
| 8 | 9 | |
| ... | ... | @@ -11,9 +12,11 @@ |
| 11 | 12 | import com.lyms.platform.common.utils.ReflectionUtils; |
| 12 | 13 | import com.lyms.platform.common.utils.StringUtils; |
| 13 | 14 | import com.lyms.platform.permission.dao.master.CouponMapper; |
| 14 | -import com.lyms.platform.permission.service.OrganizationService; | |
| 15 | +import com.lyms.platform.pojo.BabyCheckModel; | |
| 15 | 16 | import com.lyms.platform.pojo.MedicineArticleModel; |
| 17 | +import com.lyms.platform.query.BabyCheckModelQuery; | |
| 16 | 18 | import com.lyms.platform.query.MedicineArticleQuery; |
| 19 | +import org.apache.commons.collections.CollectionUtils; | |
| 17 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | 21 | import org.springframework.data.domain.Sort; |
| 19 | 22 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 20 | 23 | |
| ... | ... | @@ -36,13 +39,15 @@ |
| 36 | 39 | @Autowired |
| 37 | 40 | private MongoTemplate mongoTemplate; |
| 38 | 41 | @Autowired |
| 39 | - private OrganizationService organizationService; | |
| 40 | - @Autowired | |
| 41 | 42 | private CouponMapper couponMapper; |
| 42 | 43 | @Autowired |
| 43 | 44 | private OperateLogFacade operateLogFacade; |
| 44 | 45 | @Autowired |
| 45 | 46 | private MedicineArticleService medicineArticleService; |
| 47 | + @Autowired | |
| 48 | + private BabyBookbuildingService babyBookbuildingService; | |
| 49 | + @Autowired | |
| 50 | + private BabyCheckService babyCheckService; | |
| 46 | 51 | |
| 47 | 52 | |
| 48 | 53 | |
| ... | ... | @@ -123,6 +128,33 @@ |
| 123 | 128 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 124 | 129 | br.setData(result); |
| 125 | 130 | br.setPageInfo(request.getPageInfo()); |
| 131 | + br.setErrormsg("成功"); | |
| 132 | + return br; | |
| 133 | + } | |
| 134 | + | |
| 135 | + public BaseResponse queryArticleBabyApp(String id) { | |
| 136 | + if(StringUtils.isEmpty(id)){ | |
| 137 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("参数错误"); | |
| 138 | + } | |
| 139 | + BabyCheckModelQuery query = new BabyCheckModelQuery(); | |
| 140 | + query.setYn(YnEnums.YES.getId()); | |
| 141 | + query.setBuildId(id); | |
| 142 | + List <BabyCheckModel> checkModels = babyCheckService.queryBabyCheckRecord(query, "checkDate,created", Sort.Direction.DESC); | |
| 143 | + List<MedicineArticleModel> resultList=new ArrayList<>(); | |
| 144 | + if(CollectionUtils.isNotEmpty(checkModels) && | |
| 145 | + CollectionUtils.isNotEmpty(checkModels.get(0).getArticleTypes()) && | |
| 146 | + StringUtils.isNotEmpty(checkModels.get(0).getHospitalId())){ | |
| 147 | + | |
| 148 | + MedicineArticleQuery articleQuery=new MedicineArticleQuery(); | |
| 149 | + articleQuery.setYn(YnEnums.YES.getId()); | |
| 150 | + articleQuery.setHospitalId(checkModels.get(0).getHospitalId()); | |
| 151 | + articleQuery.setArticleTypes(checkModels.get(0).getArticleTypes()); | |
| 152 | + articleQuery.setNeed(null); | |
| 153 | + resultList=medicineArticleService.queryList(articleQuery, Sort.Direction.DESC,new String[]{"created"}); | |
| 154 | + } | |
| 155 | + BaseObjectResponse br = new BaseObjectResponse(); | |
| 156 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 157 | + br.setData(resultList); | |
| 126 | 158 | br.setErrormsg("成功"); |
| 127 | 159 | return br; |
| 128 | 160 | } |