Commit 781bc3822af6a7ecc53d78e4c055df08bdf2666d

Authored by zhangchao
1 parent a2bc2b8396
Exists in dev

#fix:新增高危饮食原则逻辑

Showing 7 changed files with 164 additions and 8 deletions

platform-dal/src/main/java/com/lyms/platform/pojo/PregnancyReportMatters.java View file @ 781bc38
... ... @@ -4,6 +4,7 @@
4 4 import org.springframework.data.mongodb.core.mapping.Document;
5 5  
6 6 import java.util.Date;
  7 +import java.util.List;
7 8  
8 9 /**
9 10 * 孕期营养报告注意事项
... ... @@ -12,6 +13,12 @@
12 13 public class PregnancyReportMatters extends BaseModel {
13 14 private static final long serialVersionUID = -1;
14 15 private String id;
  16 + //高危饮食原则名称
  17 + private String name;
  18 + //类型 1为高危饮食原则 其它为注意事项
  19 + private Integer type;
  20 + //高危风险id
  21 + private List<String> riskFactorId;
15 22 //医院ID
16 23 private String hospitalId;
17 24 //0是健康 1是高危
... ... @@ -22,6 +29,30 @@
22 29 private String matters;
23 30 private Integer yn;
24 31 private Date created;
  32 +
  33 + public String getName() {
  34 + return name;
  35 + }
  36 +
  37 + public void setName(String name) {
  38 + this.name = name;
  39 + }
  40 +
  41 + public Integer getType() {
  42 + return type;
  43 + }
  44 +
  45 + public void setType(Integer type) {
  46 + this.type = type;
  47 + }
  48 +
  49 + public List<String> getRiskFactorId() {
  50 + return riskFactorId;
  51 + }
  52 +
  53 + public void setRiskFactorId(List<String> riskFactorId) {
  54 + this.riskFactorId = riskFactorId;
  55 + }
25 56  
26 57 public String getId() {
27 58 return id;
platform-dal/src/main/java/com/lyms/platform/query/PregnancyReportMattersQuery.java View file @ 781bc38
... ... @@ -5,7 +5,11 @@
5 5 import com.lyms.platform.common.dao.operator.MongoCondition;
6 6 import com.lyms.platform.common.dao.operator.MongoOper;
7 7 import com.lyms.platform.common.dao.operator.MongoQuery;
  8 +import com.lyms.platform.common.utils.StringUtils;
  9 +import org.apache.commons.collections.CollectionUtils;
8 10  
  11 +import java.util.List;
  12 +
9 13 public class PregnancyReportMattersQuery extends BaseQuery implements IConvertToNativeQuery {
10 14 private String hospitalId;
11 15 private Integer yn=-1;
... ... @@ -15,6 +19,12 @@
15 19 //当前孕周
16 20 private Integer week;
17 21  
  22 + private Integer type;
  23 +
  24 + private String name;
  25 +
  26 + private List<String> riskFactorId;
  27 +
18 28 public String getHospitalId() {
19 29 return hospitalId;
20 30 }
... ... @@ -47,6 +57,30 @@
47 57 this.week = week;
48 58 }
49 59  
  60 + public Integer getType() {
  61 + return type;
  62 + }
  63 +
  64 + public void setType(Integer type) {
  65 + this.type = type;
  66 + }
  67 +
  68 + public String getName() {
  69 + return name;
  70 + }
  71 +
  72 + public void setName(String name) {
  73 + this.name = name;
  74 + }
  75 +
  76 + public List<String> getRiskFactorId() {
  77 + return riskFactorId;
  78 + }
  79 +
  80 + public void setRiskFactorId(List<String> riskFactorId) {
  81 + this.riskFactorId = riskFactorId;
  82 + }
  83 +
50 84 @Override
51 85 public MongoQuery convertToQuery() {
52 86 MongoCondition condition = MongoCondition.newInstance();
... ... @@ -61,6 +95,19 @@
61 95 }
62 96 if (-1 != yn) {
63 97 condition = condition.and("yn", yn, MongoOper.IS);
  98 + }
  99 + if (type!=null){
  100 + if (type!=1){
  101 + condition = condition.and("type", 1, MongoOper.NE);
  102 + }else {
  103 + condition = condition.and("type", type, MongoOper.IS);
  104 + }
  105 + }
  106 + if (StringUtils.isNotEmpty(name)){
  107 + condition = condition.and("name", name, MongoOper.IS);
  108 + }
  109 + if (CollectionUtils.isNotEmpty(riskFactorId)){
  110 + condition = condition.and("riskFactorId", riskFactorId, MongoOper.IN);
64 111 }
65 112 return condition.toMongoQuery();
66 113 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PostpartumReportController.java View file @ 781bc38
... ... @@ -99,5 +99,21 @@
99 99 postpartumReportQuery.setrFactorList(StringUtils.covertToList(rFactor, String.class));
100 100 return postpartumReportFacade.getPatientInfo(postpartumReportQuery,getUserId(request));
101 101 }
  102 +
  103 + /**
  104 + * 获取小程序产妇报告详情
  105 + * @return
  106 + */
  107 + @RequestMapping(method = RequestMethod.GET, value = "/wx/getPatientInfo")
  108 + @ResponseBody
  109 + public BaseResponse getWxPatientInfo(@RequestParam String rFactor,
  110 + @RequestParam Integer deliveryModel,
  111 + @RequestParam Integer num,HttpServletRequest request){
  112 + PostpartumReportQuery postpartumReportQuery=new PostpartumReportQuery();
  113 + postpartumReportQuery.setDeliveryModel(deliveryModel);
  114 + postpartumReportQuery.setNum(num);
  115 + postpartumReportQuery.setrFactorList(StringUtils.covertToList(rFactor, String.class));
  116 + return postpartumReportFacade.getPatientInfo(postpartumReportQuery,getUserId(request));
  117 + }
102 118 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PregnancyReportController.java View file @ 781bc38
... ... @@ -179,29 +179,65 @@
179 179 public BaseResponse getMattersList(
180 180 @RequestParam(required = false) Integer week,
181 181 @RequestParam(required = false) Integer riskType,
  182 + @RequestParam Integer type,
  183 + @RequestParam(required = false) String name,
182 184 @RequestParam("page") Integer page,
183 185 @RequestParam("limit") Integer limit
184 186 ,HttpServletRequest request){
185 187 PregnancyReportMattersQuery postpartumReportQuery=new PregnancyReportMattersQuery();
186 188 postpartumReportQuery.setWeek(week);
  189 + postpartumReportQuery.setType(type);
187 190 postpartumReportQuery.setRiskType(riskType);
188 191 postpartumReportQuery.setPage(page);
189 192 postpartumReportQuery.setLimit(limit);
  193 + postpartumReportQuery.setName(name);
190 194 return pregnancyReportMattersServiceFacade.getList(postpartumReportQuery,getUserId(request));
191 195 }
192 196  
193 197 /**
194   - * 获取模版详情
  198 + * 获取高危饮食原则模版详情
195 199 * @return
196 200 */
197   - @RequestMapping(method = RequestMethod.GET, value = "/matters/getInfo")
  201 + @RequestMapping(method = RequestMethod.GET, value = "/matters/getRisk")
198 202 @ResponseBody
199 203 @TokenRequired
200   - public BaseResponse getMattersList(String id){
  204 + public BaseResponse getReportByRisk(@RequestParam Integer week,
  205 + @RequestParam String riskFactorId,HttpServletRequest request){
201 206 BaseResponse baseResponse= new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
202   - baseResponse.setObject(pregnancyReportMattersServiceFacade.getPregnancyReport(id));
  207 + PregnancyReportMattersQuery postpartumReportQuery=new PregnancyReportMattersQuery();
  208 + postpartumReportQuery.setWeek(week);
  209 + postpartumReportQuery.setRiskFactorId(StringUtils.covertToList(riskFactorId, String.class));
  210 + baseResponse.setObject(pregnancyReportMattersServiceFacade.getReportByRisk(postpartumReportQuery,getUserId(request)));
203 211 return baseResponse;
204 212 }
205 213  
  214 + /**
  215 + * 获取高危饮食原则模版详情小程序
  216 + * @return
  217 + */
  218 + @RequestMapping(method = RequestMethod.GET, value = "/wx/matters/getRisk")
  219 + @ResponseBody
  220 + public BaseResponse getWxReportByRisk(@RequestParam Integer week,
  221 + @RequestParam String riskFactorId,HttpServletRequest request){
  222 + BaseResponse baseResponse= new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  223 + PregnancyReportMattersQuery postpartumReportQuery=new PregnancyReportMattersQuery();
  224 + postpartumReportQuery.setWeek(week);
  225 + postpartumReportQuery.setRiskFactorId(StringUtils.covertToList(riskFactorId, String.class));
  226 + baseResponse.setObject(pregnancyReportMattersServiceFacade.getReportByRisk(postpartumReportQuery,getUserId(request)));
  227 + return baseResponse;
  228 + }
  229 +
  230 + /**
  231 + * 获取模版详情
  232 + * @return
  233 + */
  234 + @RequestMapping(method = RequestMethod.GET, value = "/matters/getInfo")
  235 + @ResponseBody
  236 + @TokenRequired
  237 + public BaseResponse getMattersList(String id){
  238 + BaseResponse baseResponse= new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  239 + baseResponse.setObject(pregnancyReportMattersServiceFacade.getPregnancyReport(id));
  240 + return baseResponse;
  241 + }
206 242 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostpartumReportFacade.java View file @ 781bc38
... ... @@ -55,7 +55,7 @@
55 55 postpartumReportQuery.setYn(1);
56 56 List<PostpartumReport> list= postpartumReportService.queryPatientList(postpartumReportQuery);
57 57 BaseResponse baseResponse=new BaseResponse();
58   - baseResponse.setObject(list);
  58 + baseResponse.setObject(list.get(0));
59 59 baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
60 60 baseResponse.setErrormsg("成功");
61 61 return baseResponse;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PregnancyReportFacade.java View file @ 781bc38
... ... @@ -12,6 +12,7 @@
12 12 import com.lyms.platform.pojo.PregnancyReportMatters;
13 13 import com.lyms.platform.query.PregnancyReportMattersQuery;
14 14 import com.lyms.platform.query.PregnancyReportQuery;
  15 +import oracle.jdbc.proxy.annotation.Pre;
15 16 import org.springframework.beans.factory.annotation.Autowired;
16 17 import org.springframework.stereotype.Component;
17 18  
18 19  
... ... @@ -29,13 +30,31 @@
29 30 private BasicConfigService basicConfigService;
30 31  
31 32 public BaseResponse add(PregnancyReport postpartumReport){
32   - postpartumReport.setWeek(postpartumReport.getWeek());
  33 + //postpartumReport.setWeek(postpartumReport.getWeek());
  34 + PregnancyReportQuery pregnancyReportQuery=new PregnancyReportQuery();
  35 + pregnancyReportQuery.setYn(1);
  36 + pregnancyReportQuery.setName(postpartumReport.getName());
  37 + List<PregnancyReport> reportList= pregnancyReportService.queryPregnancyReport(pregnancyReportQuery);
  38 + if (CollectionUtils.isNotEmpty(reportList)){
  39 + return new BaseResponse().setErrorcode(ErrorCodeConstants.NAME_EXIST).setErrormsg("模版已存在");
  40 + }
33 41 pregnancyReportService.add(postpartumReport);
34 42 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
35 43 }
36 44  
37 45 public BaseResponse update(PregnancyReport postpartumReport){
38   - postpartumReport.setWeek(postpartumReport.getWeek());
  46 + //postpartumReport.setWeek(postpartumReport.getWeek());
  47 + String name=postpartumReport.getName();
  48 + PregnancyReport pregnancyReport1= pregnancyReportService.getPregnancyReport(postpartumReport.getId());
  49 + if (!pregnancyReport1.getName().equals(name)){
  50 + PregnancyReportQuery pregnancyReportQuery=new PregnancyReportQuery();
  51 + pregnancyReportQuery.setYn(1);
  52 + pregnancyReportQuery.setName(name);
  53 + List<PregnancyReport> reportList= pregnancyReportService.queryPregnancyReport(pregnancyReportQuery);
  54 + if (CollectionUtils.isNotEmpty(reportList)){
  55 + return new BaseResponse().setErrorcode(ErrorCodeConstants.NAME_EXIST).setErrormsg("模版已存在");
  56 + }
  57 + }
39 58 pregnancyReportService.updateById(postpartumReport,postpartumReport.getId());
40 59 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
41 60 }
42 61  
... ... @@ -93,9 +112,10 @@
93 112 baseResponse.setErrormsg("成功");
94 113 return baseResponse;
95 114 }
96   - //1是孕早期 14周之前 2是孕中期 14-27周+6 3是孕晚期28周及以后
  115 + //根据规则生成模版名称
97 116 private static String getReportName(String name,Integer week,Integer weightType){
98 117 String sb;
  118 + //1是孕早期 14周之前 2是孕中期 14-27周+6 3是孕晚期28周及以后
99 119 if (week==1){
100 120 sb="孕早期";
101 121 }else if (week==2){
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PregnancyReportMattersServiceFacade.java View file @ 781bc38
... ... @@ -44,5 +44,11 @@
44 44 public PregnancyReportMatters getPregnancyReport(String id){
45 45 return pregnancyReportMattersService.getPregnancyReport(id);
46 46 }
  47 + public List<PregnancyReportMatters> getReportByRisk(PregnancyReportMattersQuery postpartumReportQuery,Integer userId){
  48 + String hospitalId= autoMatchFacade.getHospitalId(userId);
  49 + postpartumReportQuery.setHospitalId(hospitalId);
  50 + postpartumReportQuery.setYn(1);
  51 + return pregnancyReportMattersService.queryPregnancyReport(postpartumReportQuery);
  52 + }
47 53 }