Commit 76df7f227c1ffec6952848eb3e06700b497aafc5

Authored by zhangchao
1 parent 1b7dcc6f42
Exists in dev

#fix:优化产后康复高危匹配原则

Showing 2 changed files with 30 additions and 3 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PregnancyReportController.java View file @ 76df7f2
... ... @@ -219,12 +219,13 @@
219 219 */
220 220 @RequestMapping(method = RequestMethod.GET, value = "/wx/matters/getRisk")
221 221 @ResponseBody
222   - public BaseResponse getWxReportByRisk(@RequestParam Integer week,
  222 + public BaseResponse getWxReportByRisk(@RequestParam Integer week,@RequestParam Integer type,
223 223 @RequestParam String riskFactorId,
224 224 @RequestParam String hospitalId){
225 225 BaseResponse baseResponse= new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
226 226 PregnancyReportMattersQuery postpartumReportQuery=new PregnancyReportMattersQuery();
227 227 postpartumReportQuery.setWeek(week);
  228 + postpartumReportQuery.setType(type);
228 229 postpartumReportQuery.setHospitalId(hospitalId);
229 230 postpartumReportQuery.setRiskFactorId(StringUtils.covertToList(riskFactorId, String.class));
230 231 List<PregnancyReportMatters> reportByRisk = pregnancyReportMattersServiceFacade.getReportByRisk(postpartumReportQuery, null);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostpartumReportFacade.java View file @ 76df7f2
... ... @@ -12,7 +12,10 @@
12 12 import org.springframework.beans.factory.annotation.Autowired;
13 13 import org.springframework.stereotype.Component;
14 14  
  15 +import java.util.Arrays;
  16 +import java.util.HashSet;
15 17 import java.util.List;
  18 +import java.util.Set;
16 19  
17 20 @Component
18 21 public class PostpartumReportFacade {
19 22  
20 23  
21 24  
... ... @@ -55,18 +58,41 @@
55 58 }
56 59  
57 60 public BaseResponse getPatientInfo(PostpartumReportQuery postpartumReportQuery, Integer userId) {
58   - //TODO 根据不同的type查询模版中公共的逻辑
59 61 if (userId!=null){
60 62 String hospitalId = autoMatchFacade.getHospitalId(userId);
61 63 postpartumReportQuery.setHospitalId(hospitalId);
62 64 }
63 65 postpartumReportQuery.setYn(1);
64 66 List<PostpartumReport> list= postpartumReportService.queryPatientList(postpartumReportQuery);
  67 + PostpartumReport postpartumReport=null;
  68 + if (CollectionUtils.isNotEmpty(list)){
  69 + boolean b=false;
  70 + Integer num=0;
  71 + for (PostpartumReport postpartumReport1:list){
  72 + Integer size= checkRisk(postpartumReport1.getRiskFactorId()
  73 + ,postpartumReportQuery.getrFactorList());
  74 + if (size>num){
  75 + num=size;
  76 + postpartumReport=postpartumReport1;
  77 + b=true;
  78 + }
  79 + }
  80 + if (!b){
  81 + postpartumReport=list.get(0);
  82 + }
  83 + }
65 84 BaseResponse baseResponse=new BaseResponse();
66   - baseResponse.setObject(list.get(0));
  85 + baseResponse.setObject(postpartumReport);
67 86 baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
68 87 baseResponse.setErrormsg("成功");
69 88 return baseResponse;
  89 + }
  90 +
  91 + private static Integer checkRisk(List<String> riskIds,List<String> rFactor){
  92 + Set<String> set1 = new HashSet<>(riskIds);
  93 + Set<String> set2 = new HashSet<>(rFactor);
  94 + set1.retainAll(set2);
  95 + return set1.size();
70 96 }
71 97  
72 98 public PostpartumReportModel addModel(PostpartumReportModel postpartumReport, Integer userId){