Commit 38f9f506958c4e8284308482b760a942ab200d91

Authored by zhangchao
1 parent a10ac0813a
Exists in dev

#fix:新增产后模版字典

Showing 10 changed files with 309 additions and 12 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPostpartumReportModelDao.java View file @ 38f9f50
  1 +package com.lyms.platform.biz.dal;
  2 +
  3 +import com.lyms.platform.common.dao.operator.MongoQuery;
  4 +import com.lyms.platform.pojo.PostpartumReportModel;
  5 +
  6 +import java.util.List;
  7 +
  8 +public interface IPostpartumReportModelDao {
  9 + PostpartumReportModel add(PostpartumReportModel postpartumReport);
  10 + void updateById(PostpartumReportModel postpartumReport,String id);
  11 + public PostpartumReportModel getPatient(String id);
  12 +
  13 + public int queryPatientCount(MongoQuery query);
  14 +
  15 + public List<PostpartumReportModel> queryPatient(MongoQuery query);
  16 +
  17 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/IPostpartumReportModelDaoImpl.java View file @ 38f9f50
  1 +package com.lyms.platform.biz.dal.impl;
  2 +
  3 +import com.lyms.platform.biz.dal.IPostpartumReportModelDao;
  4 +import com.lyms.platform.common.dao.BaseMongoDAOImpl;
  5 +import com.lyms.platform.common.dao.operator.MongoCondition;
  6 +import com.lyms.platform.common.dao.operator.MongoOper;
  7 +import com.lyms.platform.common.dao.operator.MongoQuery;
  8 +import com.lyms.platform.pojo.PostpartumReportModel;
  9 +import org.springframework.stereotype.Repository;
  10 +
  11 +import java.util.Date;
  12 +import java.util.List;
  13 +@Repository("postpartumReportModelDao")
  14 +public class IPostpartumReportModelDaoImpl extends BaseMongoDAOImpl<PostpartumReportModel> implements IPostpartumReportModelDao {
  15 + @Override
  16 + public PostpartumReportModel add(PostpartumReportModel postpartumReport) {
  17 + postpartumReport.setYn(1);
  18 + postpartumReport.setCreated(new Date());
  19 + return save(postpartumReport);
  20 + }
  21 +
  22 + @Override
  23 + public void updateById(PostpartumReportModel postpartumReport, String id) {
  24 + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), postpartumReport);
  25 +
  26 + }
  27 +
  28 + @Override
  29 + public PostpartumReportModel getPatient(String id) {
  30 + return findById(id);
  31 + }
  32 +
  33 + @Override
  34 + public int queryPatientCount(MongoQuery query) {
  35 + return (int) count(query.convertToMongoQuery());
  36 + }
  37 +
  38 + @Override
  39 + public List<PostpartumReportModel> queryPatient(MongoQuery query) {
  40 + return find(query.convertToMongoQuery());
  41 + }
  42 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PostpartumReportModelService.java View file @ 38f9f50
  1 +package com.lyms.platform.biz.service;
  2 +
  3 +import com.lyms.platform.biz.dal.IPostpartumReportModelDao;
  4 +import com.lyms.platform.common.dao.operator.MongoQuery;
  5 +import com.lyms.platform.pojo.PostpartumReportModel;
  6 +import com.lyms.platform.query.PostpartumReportQuery;
  7 +import org.apache.commons.lang.StringUtils;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +
  11 +import java.util.List;
  12 +
  13 +@Service("postpartumReportModelService")
  14 +public class PostpartumReportModelService {
  15 + @Autowired
  16 + private IPostpartumReportModelDao postpartumReportModelDao;
  17 +
  18 + public PostpartumReportModel add(PostpartumReportModel postpartumReport){
  19 + return postpartumReportModelDao.add(postpartumReport);
  20 + }
  21 +
  22 +
  23 + public void updateById(PostpartumReportModel postpartumReport,String id){
  24 + postpartumReportModelDao.updateById(postpartumReport,id);
  25 + }
  26 +
  27 + public PostpartumReportModel getInfo(String id){
  28 + return postpartumReportModelDao.getPatient(id);
  29 + }
  30 +
  31 + public List<PostpartumReportModel> queryList(PostpartumReportQuery postpartumReportQuery){
  32 + MongoQuery query = postpartumReportQuery.convertToQuery();
  33 + if (StringUtils.isNotEmpty(postpartumReportQuery.getNeed())) {
  34 + postpartumReportQuery.mysqlBuild(postpartumReportModelDao.queryPatientCount(postpartumReportQuery.convertToQuery()));
  35 + query.start(postpartumReportQuery.getOffset()).end(postpartumReportQuery.getLimit());
  36 + }
  37 + List<PostpartumReportModel> results= postpartumReportModelDao.queryPatient(query);
  38 + return results;
  39 + }
  40 +}
platform-dal/src/main/java/com/lyms/platform/pojo/PostpartumReportModel.java View file @ 38f9f50
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.beans.SerialIdEnum;
  4 +import com.lyms.platform.common.result.BaseModel;
  5 +import org.springframework.data.mongodb.core.mapping.Document;
  6 +
  7 +import java.util.Date;
  8 +
  9 +@Document(collection = "lyms_postpartum_report_model")
  10 +public class PostpartumReportModel extends BaseModel {
  11 + private static final long serialVersionUID = SerialIdEnum.PostpartumReport.getCid();
  12 + private String id;
  13 + //医院ID
  14 + private String hospitalId;
  15 + private Integer yn;
  16 + //发送次数
  17 + private Integer num;
  18 + //分娩方式 1为顺产 2为剖腹产
  19 + private Integer deliveryModel;
  20 + //1营养膳食 2哺乳期需注意事项 3产后体重管理
  21 + private Integer type;
  22 + //内容
  23 + private String context;
  24 + private Date created;
  25 +
  26 + public String getId() {
  27 + return id;
  28 + }
  29 +
  30 + public void setId(String id) {
  31 + this.id = id;
  32 + }
  33 +
  34 + public String getHospitalId() {
  35 + return hospitalId;
  36 + }
  37 +
  38 + public void setHospitalId(String hospitalId) {
  39 + this.hospitalId = hospitalId;
  40 + }
  41 +
  42 + public Integer getYn() {
  43 + return yn;
  44 + }
  45 +
  46 + public void setYn(Integer yn) {
  47 + this.yn = yn;
  48 + }
  49 +
  50 + public Integer getNum() {
  51 + return num;
  52 + }
  53 +
  54 + public void setNum(Integer num) {
  55 + this.num = num;
  56 + }
  57 +
  58 + public Integer getDeliveryModel() {
  59 + return deliveryModel;
  60 + }
  61 +
  62 + public void setDeliveryModel(Integer deliveryModel) {
  63 + this.deliveryModel = deliveryModel;
  64 + }
  65 +
  66 + public Integer getType() {
  67 + return type;
  68 + }
  69 +
  70 + public void setType(Integer type) {
  71 + this.type = type;
  72 + }
  73 +
  74 + public String getContext() {
  75 + return context;
  76 + }
  77 +
  78 + public void setContext(String context) {
  79 + this.context = context;
  80 + }
  81 +
  82 + public Date getCreated() {
  83 + return created;
  84 + }
  85 +
  86 + public void setCreated(Date created) {
  87 + this.created = created;
  88 + }
  89 +}
platform-dal/src/main/java/com/lyms/platform/query/PostpartumReportQuery.java View file @ 38f9f50
... ... @@ -29,7 +29,17 @@
29 29 private String riskFactorNames;
30 30  
31 31 private String name;
  32 + //1营养膳食 2哺乳期需注意事项 3产后体重管理
  33 + private Integer type;
32 34  
  35 + public Integer getType() {
  36 + return type;
  37 + }
  38 +
  39 + public void setType(Integer type) {
  40 + this.type = type;
  41 + }
  42 +
33 43 public String getName() {
34 44 return name;
35 45 }
... ... @@ -122,6 +132,9 @@
122 132 }
123 133 if (-1 != yn) {
124 134 condition = condition.and("yn", yn, MongoOper.IS);
  135 + }
  136 + if (type!=null){
  137 + condition = condition.and("type", type, MongoOper.IS);
125 138 }
126 139 return condition.toMongoQuery();
127 140 }
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/ChanKangAmsMsgGenerateWorker.java View file @ 38f9f50
... ... @@ -90,7 +90,6 @@
90 90  
91 91 //查询符合条件的产妇
92 92 List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
93   - System.out.println("amsSmses--->"+patients);
94 93 if (CollectionUtils.isNotEmpty(patients)) {
95 94  
96 95 //发送短信集合
... ... @@ -102,8 +101,6 @@
102 101 }
103 102  
104 103 MaternalDeliverModel maternalDeliverModel = baseService.getModelByPid(pat.getId());
105   -
106   - System.out.println("maternalDeliverModel--->"+maternalDeliverModel);
107 104 //分娩类型
108 105 String deliveryMode = getDelivery(maternalDeliverModel);
109 106 //计算产后多少周 按分娩日期计算
110 107  
... ... @@ -136,11 +133,9 @@
136 133 if (highRisk.length() > 0) {
137 134 params.put("riskType", highRisk.substring(0, highRisk.length() - 1));
138 135 }
139   - System.out.println("params--->"+params);
140 136 // 查询模板短信 从ams平台配置的短信通过医院ID
141 137 net.sf.json.JSONObject amsSmses = AmsMessageService
142 138 .getArticleList(params);
143   - System.out.println("amsSmses--->"+amsSmses);
144 139 if (amsSmses == null || amsSmses.getInt("errorcode") != 0 ||
145 140 amsSmses.getJSONArray("list")==null || amsSmses.getJSONArray("list").size()==0) {
146 141 continue;
... ... @@ -163,7 +158,6 @@
163 158 }
164 159 if (CollectionUtils.isNotEmpty(messages)){
165 160 list.setMessages(messages);
166   - System.out.println("messages--->"+list);
167 161 HelperUtils.sendMsg(list);
168 162 }
169 163 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientServiceController.java View file @ 38f9f50
... ... @@ -157,7 +157,6 @@
157 157 if(CollectionUtils.isEmpty(patientsList)){
158 158 baseResponse.setErrorcode(ErrorCodeConstants.DATA_EXIST);
159 159 baseResponse.setErrormsg("档案信息不存在,请核实");
160   - System.out.println("档案信息不存在,请核实");
161 160 return baseResponse;
162 161 }
163 162 Patients patients = patientsList.get(0);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PostpartumReportController.java View file @ 38f9f50
... ... @@ -7,6 +7,7 @@
7 7 import com.lyms.platform.common.utils.StringUtils;
8 8 import com.lyms.platform.operate.web.facade.PostpartumReportFacade;
9 9 import com.lyms.platform.pojo.PostpartumReport;
  10 +import com.lyms.platform.pojo.PostpartumReportModel;
10 11 import com.lyms.platform.query.PostpartumReportQuery;
11 12 import org.springframework.beans.factory.annotation.Autowired;
12 13 import org.springframework.stereotype.Controller;
13 14  
14 15  
15 16  
... ... @@ -108,12 +109,76 @@
108 109 @ResponseBody
109 110 public BaseResponse getWxPatientInfo(@RequestParam String rFactor,
110 111 @RequestParam Integer deliveryModel,
111   - @RequestParam Integer num,HttpServletRequest request){
  112 + @RequestParam Integer num,@RequestParam String hospitalId){
112 113 PostpartumReportQuery postpartumReportQuery=new PostpartumReportQuery();
113 114 postpartumReportQuery.setDeliveryModel(deliveryModel);
114 115 postpartumReportQuery.setNum(num);
  116 + postpartumReportQuery.setHospitalId(hospitalId);
115 117 postpartumReportQuery.setrFactorList(StringUtils.covertToList(rFactor, String.class));
116   - return postpartumReportFacade.getPatientInfo(postpartumReportQuery,getUserId(request));
  118 + return postpartumReportFacade.getPatientInfo(postpartumReportQuery,null);
117 119 }
  120 +
  121 +
  122 + /**
  123 + * 模板字典列表
  124 + * @param request
  125 + * @return
  126 + */
  127 + @RequestMapping(method = RequestMethod.GET, value = "/model/getList")
  128 + @ResponseBody
  129 + @TokenRequired
  130 + public BaseResponse getPostpartumReportModelList(
  131 + @RequestParam(required = false) Integer deliveryModel,
  132 + @RequestParam(required = false) Integer num,
  133 + @RequestParam(required = false) Integer type,
  134 + @RequestParam("page") Integer page,
  135 + @RequestParam("limit") Integer limit,
  136 + HttpServletRequest request) {
  137 +
  138 + PostpartumReportQuery postpartumReportQuery=new PostpartumReportQuery();
  139 + postpartumReportQuery.setDeliveryModel(deliveryModel);
  140 + postpartumReportQuery.setNum(num);
  141 + postpartumReportQuery.setType(type);
  142 + postpartumReportQuery.setPage(page);
  143 + postpartumReportQuery.setLimit(limit);
  144 + return postpartumReportFacade.queryModelList(postpartumReportQuery,getUserId(request));
  145 + }
  146 + /**
  147 + * 新增字典模版
  148 + * @param postpartumReport
  149 + * @return
  150 + */
  151 + @RequestMapping(method = RequestMethod.POST, value = "/model/add")
  152 + @ResponseBody
  153 + @TokenRequired
  154 + public BaseResponse addPostpartumReportModel(@RequestBody PostpartumReportModel postpartumReport, HttpServletRequest request){
  155 + postpartumReportFacade.addModel(postpartumReport,getUserId(request));
  156 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  157 + }
  158 +
  159 + /**
  160 + * 获取报告详情
  161 + * @return
  162 + */
  163 + @RequestMapping(method = RequestMethod.GET, value = "/model/getInfo")
  164 + @ResponseBody
  165 + @TokenRequired
  166 + public BaseResponse getModelInfo(@RequestParam String id){
  167 + BaseResponse baseResponse= new BaseResponse();
  168 + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setObject(postpartumReportFacade.getModelInfo(id));
  169 + return baseResponse;
  170 + }
  171 +
  172 + @RequestMapping(method = RequestMethod.POST, value = "/model/update")
  173 + @ResponseBody
  174 + @TokenRequired
  175 + public BaseResponse updateModelById(@RequestBody PostpartumReportModel postpartumReport){
  176 + if (StringUtils.isEmpty(postpartumReport.getId())){
  177 + return new BaseResponse().setErrorcode(-1).setErrormsg("参数异常");
  178 + }
  179 + postpartumReportFacade.updateModelById(postpartumReport,postpartumReport.getId());
  180 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  181 + }
  182 +
118 183 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostpartumReportFacade.java View file @ 38f9f50
1 1 package com.lyms.platform.operate.web.facade;
2 2  
  3 +import com.lyms.platform.biz.service.PostpartumReportModelService;
3 4 import com.lyms.platform.biz.service.PostpartumReportService;
4 5 import com.lyms.platform.common.constants.ErrorCodeConstants;
  6 +import com.lyms.platform.common.result.BaseListResponse;
5 7 import com.lyms.platform.common.result.BaseResponse;
6 8 import com.lyms.platform.operate.web.utils.CollectionUtils;
7 9 import com.lyms.platform.pojo.PostpartumReport;
  10 +import com.lyms.platform.pojo.PostpartumReportModel;
8 11 import com.lyms.platform.query.PostpartumReportQuery;
9 12 import org.springframework.beans.factory.annotation.Autowired;
10 13 import org.springframework.stereotype.Component;
... ... @@ -18,6 +21,8 @@
18 21  
19 22 @Autowired
20 23 private AutoMatchFacade autoMatchFacade;
  24 + @Autowired
  25 + private PostpartumReportModelService postpartumReportModelService;
21 26  
22 27 public BaseResponse queryPatient(PostpartumReportQuery postpartumReportQuery, Integer userId) {
23 28 String hospitalId = autoMatchFacade.getHospitalId(userId);
... ... @@ -50,8 +55,11 @@
50 55 }
51 56  
52 57 public BaseResponse getPatientInfo(PostpartumReportQuery postpartumReportQuery, Integer userId) {
53   - String hospitalId = autoMatchFacade.getHospitalId(userId);
54   - postpartumReportQuery.setHospitalId(hospitalId);
  58 + //TODO 根据不同的type查询模版中公共的逻辑
  59 + if (userId!=null){
  60 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  61 + postpartumReportQuery.setHospitalId(hospitalId);
  62 + }
55 63 postpartumReportQuery.setYn(1);
56 64 List<PostpartumReport> list= postpartumReportService.queryPatientList(postpartumReportQuery);
57 65 BaseResponse baseResponse=new BaseResponse();
... ... @@ -59,6 +67,36 @@
59 67 baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
60 68 baseResponse.setErrormsg("成功");
61 69 return baseResponse;
  70 + }
  71 +
  72 + public PostpartumReportModel addModel(PostpartumReportModel postpartumReport, Integer userId){
  73 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  74 + postpartumReport.setHospitalId(hospitalId);
  75 + postpartumReport.setYn(1);
  76 +
  77 + return postpartumReportModelService.add(postpartumReport);
  78 + }
  79 +
  80 + public void updateModelById(PostpartumReportModel postpartumReport,String id){
  81 + postpartumReportModelService.updateById(postpartumReport,id);
  82 + }
  83 +
  84 + public PostpartumReportModel getModelInfo(String id){
  85 + return postpartumReportModelService.getInfo(id);
  86 + }
  87 +
  88 + public BaseResponse queryModelList(PostpartumReportQuery postpartumReportQuery, Integer userId) {
  89 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  90 + postpartumReportQuery.setHospitalId(hospitalId);
  91 + postpartumReportQuery.setYn(1);
  92 + postpartumReportQuery.setNeed("true");
  93 + List<PostpartumReportModel> mapList= postpartumReportModelService.queryList(postpartumReportQuery);
  94 + BaseListResponse objectResponse = new BaseListResponse();
  95 + objectResponse.setData(mapList);
  96 + objectResponse.setPageInfo(postpartumReportQuery.getPageInfo());
  97 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  98 + objectResponse.setErrormsg("成功");
  99 + return objectResponse;
62 100 }
63 101 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ 38f9f50
... ... @@ -909,7 +909,7 @@
909 909 }
910 910  
911 911 }else {
912   - params.put("riskFactorId",null);
  912 + params.put("riskFactorId",patients.getRiskFactorId());
913 913 }
914 914 }
915 915 }