Commit b45dac241556d7afbc7d2167167a8d02fe602708

Authored by zhangchao
1 parent 358e3917b8
Exists in dev

#fix:开发小程序营养报告接口

Showing 8 changed files with 161 additions and 35 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PostpartumReportService.java View file @ b45dac2
... ... @@ -59,6 +59,7 @@
59 59 Map<String,Object> params=new HashMap<>();
60 60 params.put("id",postpartumReport.getId());
61 61 params.put("num",postpartumReport.getNum());
  62 + params.put("name",postpartumReport.getName());
62 63 params.put("riskFactorName",postpartumReport.getRiskFactorName());
63 64 params.put("created",postpartumReport.getCreated());
64 65 params.put("deliveryModel",postpartumReport.getDeliveryModel());
platform-dal/src/main/java/com/lyms/platform/query/PostpartumReportQuery.java View file @ b45dac2
... ... @@ -25,8 +25,19 @@
25 25 private String rFactor;
26 26 //次数
27 27 private Integer num;
  28 +
28 29 private String riskFactorNames;
29 30  
  31 + private String name;
  32 +
  33 + public String getName() {
  34 + return name;
  35 + }
  36 +
  37 + public void setName(String name) {
  38 + this.name = name;
  39 + }
  40 +
30 41 public String getRiskFactorNames() {
31 42 return riskFactorNames;
32 43 }
... ... @@ -102,6 +113,9 @@
102 113 }
103 114 if (num!=null){
104 115 condition=condition.and("num",num,MongoOper.IS);
  116 + }
  117 + if (StringUtils.isNotEmpty(name)){
  118 + condition=condition.and("name",name,MongoOper.IS);
105 119 }
106 120 if (StringUtils.isNotEmpty(riskFactorNames)){
107 121 condition=condition.and("riskFactorName",riskFactorNames,MongoOper.IS);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PostpartumReportController.java View file @ b45dac2
... ... @@ -14,6 +14,9 @@
14 14  
15 15 import javax.servlet.http.HttpServletRequest;
16 16  
  17 +/**
  18 + * 产后营养报告模版
  19 + */
17 20 @Controller
18 21 @RequestMapping("/postpartumReport")
19 22 public class PostpartumReportController extends BaseController {
... ... @@ -30,6 +33,7 @@
30 33 @TokenRequired
31 34 public BaseResponse getPostpartumReportList(@RequestParam(required = false) String rFactor,
32 35 @RequestParam(required = false) Integer deliveryModel,
  36 + @RequestParam(required = false) String name,
33 37 @RequestParam("page") Integer page,
34 38 @RequestParam("limit") Integer limit,
35 39 HttpServletRequest request) {
... ... @@ -37,6 +41,7 @@
37 41 PostpartumReportQuery postpartumReportQuery=new PostpartumReportQuery();
38 42 postpartumReportQuery.setrFactor(rFactor);
39 43 postpartumReportQuery.setDeliveryModel(deliveryModel);
  44 + postpartumReportQuery.setName(name);
40 45 postpartumReportQuery.setPage(page);
41 46 postpartumReportQuery.setLimit(limit);
42 47 return postpartumReportFacade.queryPatient(postpartumReportQuery,getUserId(request));
... ... @@ -66,6 +71,7 @@
66 71 baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setObject(postpartumReportFacade.getPatient(id));
67 72 return baseResponse;
68 73 }
  74 +
69 75 @RequestMapping(method = RequestMethod.POST, value = "/update")
70 76 @ResponseBody
71 77 @TokenRequired
... ... @@ -75,6 +81,23 @@
75 81 }
76 82 postpartumReportFacade.updateById(postpartumReport,postpartumReport.getId());
77 83 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  84 + }
  85 +
  86 + /**
  87 + * 获取产妇报告详情
  88 + * @return
  89 + */
  90 + @RequestMapping(method = RequestMethod.GET, value = "/getPatientInfo")
  91 + @ResponseBody
  92 + @TokenRequired
  93 + public BaseResponse getPatientInfo(@RequestParam String rFactor,
  94 + @RequestParam Integer deliveryModel,
  95 + @RequestParam Integer num,HttpServletRequest request){
  96 + PostpartumReportQuery postpartumReportQuery=new PostpartumReportQuery();
  97 + postpartumReportQuery.setDeliveryModel(deliveryModel);
  98 + postpartumReportQuery.setNum(num);
  99 + postpartumReportQuery.setrFactorList(StringUtils.covertToList(rFactor, String.class));
  100 + return postpartumReportFacade.getPatientInfo(postpartumReportQuery,getUserId(request));
78 101 }
79 102 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PregnancyReportController.java View file @ b45dac2
... ... @@ -97,6 +97,26 @@
97 97 return pregnancyReportFacade.getInfo(id,week);
98 98 }
99 99  
  100 + /**
  101 + * 获取小程序
  102 + * @param rFactor
  103 + * @param week
  104 + * @return
  105 + */
  106 +
  107 + @RequestMapping(method = RequestMethod.GET, value = "/wx/getPatientReport")
  108 + @ResponseBody
  109 + public BaseResponse getWxPatientReport(@RequestParam String rFactor,
  110 + @RequestParam Integer week,
  111 + @RequestParam String hospitalId
  112 + ){
  113 + PregnancyReportQuery pregnancyReportQuery=new PregnancyReportQuery();
  114 + pregnancyReportQuery.setWeek(week);
  115 + pregnancyReportQuery.setHospitalId(hospitalId);
  116 + pregnancyReportQuery.setrFactorList(StringUtils.covertToList(rFactor, String.class));
  117 + return pregnancyReportFacade.getWxPatientReport(pregnancyReportQuery);
  118 + }
  119 +
100 120  
101 121 /**
102 122 * 获取体重报告列表
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ b45dac2
... ... @@ -5109,41 +5109,56 @@
5109 5109 }
5110 5110  
5111 5111 }
5112   - //yunBookbuildingService.updatePregnant(patient, patient.getId());
5113 5112 //patientServiceService.deletePatientServiceByPatientId(patient.getId());
5114   - for (int i = 0; i < 2; i++) {
5115   - List<Map<String, String>> serInfos = new ArrayList<>();
5116   - Map<String, String> params = new HashMap<>();
5117   - PatientService patientService = new PatientService();
5118   - if (i == 0) {
5119   - params.put("serType", "1");
5120   - } else {
5121   - params.put("serType", "6");
5122   - }
  5113 + /* PatientServiceQuery query=new PatientServiceQuery();
  5114 + query.setParentid(patient.getId());
  5115 + query.setSerType(1);
  5116 + List<PatientService> patientServiceList= patientServiceService.queryPatientService(query);
  5117 + if (CollectionUtils.isNotEmpty(patientServiceList)){*/
  5118 + //yunBookbuildingService.updatePregnant(patient, patient.getId());
5123 5119  
5124   - params.put("doctorWeek", "0");
5125   - params.put("serviceWeek", "42");
5126   - serInfos.add(params);
5127   - patientService.setSerInfos(serInfos);
5128   - patientService.setPerType(1);
5129   - patientService.setCreateUser(patient.getFirstCheckId());
5130   - //开通日期与建档日期一致
5131   - patientService.setCreateDate(patient.getBookbuildingDate());
5132   - patientService.setParentid(patient.getId());
5133   - patientService.setPid(patient.getPid());
5134   - try {
5135   - patientServiceFacade.addPatientService(patientService, patient.getOperator(), "2100001504");
5136   - } catch (Exception e) {
5137   - System.out.println("孕妇建档服务开通异常!" + patient.toString());
5138   - e.printStackTrace();
5139   - }
5140   - }
  5120 + for (int i = 0; i < 2; i++) {
  5121 + List<Map<String, String>> serInfos = new ArrayList<>();
  5122 + Map<String, String> params = new HashMap<>();
  5123 + PatientService patientService = new PatientService();
  5124 + if (i == 0) {
  5125 + params.put("serType", "1");
  5126 + } else {
  5127 + params.put("serType", "6");
  5128 + }
  5129 +
  5130 + params.put("doctorWeek", "0");
  5131 + params.put("serviceWeek", "42");
  5132 + serInfos.add(params);
  5133 + patientService.setSerInfos(serInfos);
  5134 + patientService.setPerType(1);
  5135 + patientService.setCreateUser(patient.getFirstCheckId());
  5136 + //开通日期与建档日期一致
  5137 + patientService.setCreateDate(patient.getBookbuildingDate());
  5138 + patientService.setParentid(patient.getId());
  5139 + patientService.setPid(patient.getPid());
  5140 + try {
  5141 + patientServiceFacade.addPatientService(patientService, patient.getOperator(), "2100001504");
  5142 + } catch (Exception e) {
  5143 + System.out.println("孕妇建档服务开通异常!" + patient.toString());
  5144 + e.printStackTrace();
  5145 + }
  5146 + }
  5147 +
  5148 +
5141 5149 }
5142 5150 });
  5151 +
5143 5152 //logger.info("建档信息异常---》" + patients.toString());
5144 5153 //continue;
  5154 + }else {
  5155 + logger.info("建档信息异常---》" + map.get("cardNo"));
5145 5156 }
  5157 +
  5158 + }else {
  5159 + System.out.println("cardNo exception---》" + map.get("cardNo"));
5146 5160 }
  5161 +
5147 5162 /* if (map.get("phone") != null) {
5148 5163 patientsQuery.setCardNo(null);
5149 5164 patientsQuery.setPhone(map.get("phone"));
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostpartumReportFacade.java View file @ b45dac2
1 1 package com.lyms.platform.operate.web.facade;
2 2  
3 3 import com.lyms.platform.biz.service.PostpartumReportService;
  4 +import com.lyms.platform.common.constants.ErrorCodeConstants;
4 5 import com.lyms.platform.common.result.BaseResponse;
5 6 import com.lyms.platform.operate.web.utils.CollectionUtils;
6 7 import com.lyms.platform.pojo.PostpartumReport;
... ... @@ -48,6 +49,16 @@
48 49 return postpartumReportService.getPatient(id);
49 50 }
50 51  
51   -
  52 + public BaseResponse getPatientInfo(PostpartumReportQuery postpartumReportQuery, Integer userId) {
  53 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  54 + postpartumReportQuery.setHospitalId(hospitalId);
  55 + postpartumReportQuery.setYn(1);
  56 + List<PostpartumReport> list= postpartumReportService.queryPatientList(postpartumReportQuery);
  57 + BaseResponse baseResponse=new BaseResponse();
  58 + baseResponse.setObject(list);
  59 + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  60 + baseResponse.setErrormsg("成功");
  61 + return baseResponse;
  62 + }
52 63 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PregnancyReportFacade.java View file @ b45dac2
... ... @@ -77,6 +77,35 @@
77 77 }
78 78  
79 79  
  80 + public BaseResponse getWxPatientReport(PregnancyReportQuery pregnancyReportQuery){
  81 + pregnancyReportQuery.setYn(1);
  82 + Integer week= pregnancyReportQuery.getWeek();
  83 + pregnancyReportQuery.setWeek(getWeek(week));
  84 + List<PregnancyReport> list= pregnancyReportService.queryPregnancyReport(pregnancyReportQuery);
  85 + BaseResponse baseResponse=new BaseResponse();
  86 + if (CollectionUtils.isNotEmpty(list)){
  87 + PregnancyReport pregnancyReport= list.get(0);
  88 + PregnancyReportMattersQuery postpartumReportQuery=new PregnancyReportMattersQuery();
  89 + postpartumReportQuery.setYn(1);
  90 + postpartumReportQuery.setHospitalId(pregnancyReportQuery.getHospitalId());
  91 + postpartumReportQuery.setWeek(week);
  92 + Integer riskType=1;
  93 + if (pregnancyReport.getRiskFactorName().contains("健康")){
  94 + riskType=0;
  95 + }
  96 + postpartumReportQuery.setRiskType(riskType);
  97 + List<PregnancyReportMatters> mattersList= pregnancyReportMattersService.queryPregnancyReport(postpartumReportQuery);
  98 + if (CollectionUtils.isNotEmpty(mattersList)){
  99 + pregnancyReport.setMatters(mattersList.get(0).getMatters());
  100 + }
  101 + baseResponse.setObject(pregnancyReport);
  102 + }
  103 + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  104 + baseResponse.setErrormsg("成功");
  105 + return baseResponse;
  106 + }
  107 +
  108 +
80 109 public BaseResponse getList(PregnancyReportQuery pregnancyReportQuery,Integer userId){
81 110 String hospitalId= autoMatchFacade.getHospitalId(userId);
82 111 pregnancyReportQuery.setHospitalId(hospitalId);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ b45dac2
... ... @@ -198,7 +198,7 @@
198 198 map.put("date", ymdDate);
199 199 map.put("nowWeight", nowWeight);
200 200 if ("2100002419".equals(hospitalId)){
201   - map.put("riskFactorId", patients.getRiskFactorId());
  201 + map.put("riskFactorId", CollectionUtils.isNotEmpty(patients.getRiskFactorId())?patients.getRiskFactorId():null);
202 202 map.put("week", patientWeight.getWeek());
203 203 }
204 204 }
... ... @@ -211,7 +211,7 @@
211 211 m.put("nowWeight", nowWeight);
212 212 /*m.put("doctorId", doctorId);*/
213 213 if ("2100002419".equals(hospitalId)){
214   - m.put("riskFactorId", patients.getRiskFactorId());
  214 + m.put("riskFactorId", CollectionUtils.isNotEmpty(patients.getRiskFactorId())?patients.getRiskFactorId():null);
215 215 m.put("week", patientWeight.getWeek());
216 216 }
217 217 dayWeights2.add(m);
... ... @@ -251,7 +251,7 @@
251 251 m.put("date", DateUtil.getyyyy_MM_dd(new Date()));
252 252 m.put("nowWeight", nowWeight);
253 253 if ("2100002419".equals(hospitalId)){
254   - m.put("riskFactorId", patients.getRiskFactorId());
  254 + m.put("riskFactorId", CollectionUtils.isNotEmpty(patients.getRiskFactorId())?patients.getRiskFactorId():null);
255 255 m.put("week", patientWeight.getWeek());
256 256 }
257 257 /*m.put("doctorId", doctorId);*/
... ... @@ -886,6 +886,7 @@
886 886 public BaseResponse lastCheckTime(String pid, String time) {
887 887 PatientWeight patientWeight = queryPatientWeight(pid);
888 888 Integer week = 0;
  889 + Map<String,Object> params=new HashMap<>();
889 890 if (null != patientWeight) {
890 891 Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class);
891 892 if (patients != null) {
892 893  
... ... @@ -898,9 +899,21 @@
898 899 }
899 900 }
900 901 week = DateUtil.getWeek2(patients.getLastMenses(), recordDate);
  902 + params.put("week",week);
  903 + if (CollectionUtils.isNotEmpty(patientWeight.getDayWeights2())){
  904 + Map<String, Object> map= patientWeight.getDayWeights2().get(0);
  905 + if (map.get("riskFactorId")!=null){
  906 + params.put("riskFactorId",map.get("riskFactorId"));
  907 + }else {
  908 + params.put("riskFactorId",patients.getRiskFactorId());
  909 + }
  910 +
  911 + }else {
  912 + params.put("riskFactorId",null);
  913 + }
901 914 }
902 915 }
903   - return new BaseObjectResponse().setData(week).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  916 + return new BaseObjectResponse().setData(params).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
904 917 }
905 918  
906 919 @Override
... ... @@ -1417,7 +1430,7 @@
1417 1430 map.put("nowWeight", nowWeight);
1418 1431 //如果是大同添加当前患者高危因素
1419 1432 if ("2100002419".equals(hospitalId)){
1420   - map.put("riskFactorId", patients.getRiskFactorId());
  1433 + map.put("riskFactorId", CollectionUtils.isNotEmpty(patients.getRiskFactorId())?patients.getRiskFactorId():null);
1421 1434 map.put("week", patientWeight.getWeek());
1422 1435 }
1423 1436 } else {
... ... @@ -1434,7 +1447,7 @@
1434 1447 m.put("nowWeight", nowWeight);
1435 1448 //如果是大同添加当前患者高危因素
1436 1449 if ("2100002419".equals(hospitalId)){
1437   - m.put("riskFactorId", patients.getRiskFactorId());
  1450 + m.put("riskFactorId", CollectionUtils.isNotEmpty(patients.getRiskFactorId())?patients.getRiskFactorId():null);
1438 1451 m.put("week", patientWeight.getWeek());
1439 1452 }
1440 1453 dayWeights2.add(m);
... ... @@ -1454,7 +1467,7 @@
1454 1467 m.put("nowWeight", nowWeight);
1455 1468 //如果是大同添加当前患者高危因素
1456 1469 if ("2100002419".equals(hospitalId)){
1457   - m.put("riskFactorId", patients.getRiskFactorId());
  1470 + m.put("riskFactorId", CollectionUtils.isNotEmpty(patients.getRiskFactorId())?patients.getRiskFactorId():null);
1458 1471 m.put("week", patientWeight.getWeek());
1459 1472 }
1460 1473 dayWeights2.add(m);