Commit 4d520188d6f6a6fd50325b142cfbee884a3d2455

Authored by gengxiaokai
1 parent a5a4da596d

威海产后观察

Showing 9 changed files with 177 additions and 11 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IRecordsDao.java View file @ 4d52018
... ... @@ -16,5 +16,7 @@
16 16  
17 17 public void updateRecordsById(Records obj,String id);
18 18  
  19 + public void savaRecords(Records obj);
  20 +
19 21 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/RecordsDaoImpl.java View file @ 4d52018
... ... @@ -29,5 +29,9 @@
29 29 update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj);
30 30 }
31 31  
  32 + public void savaRecords(Records obj){
  33 + save(obj);
  34 + }
  35 +
32 36 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PostpartumRecordsService.java View file @ 4d52018
... ... @@ -20,13 +20,21 @@
20 20 @Autowired
21 21 private IPostpartumRecordsDao postpartumRecordsDao;
22 22  
23   - public List<PostpartumRecords> getBabySieveQuery(PostpartumRecordsQuery postpartumRecordsQuery){
  23 + public List<PostpartumRecords> getPostpartumRecordsQuery(PostpartumRecordsQuery postpartumRecordsQuery){
24 24 MongoQuery query = postpartumRecordsQuery.convertToQuery();
25 25 if (StringUtils.isNotEmpty(postpartumRecordsQuery.getNeed())) {
26 26 postpartumRecordsQuery.mysqlBuild(postpartumRecordsDao.queryPostpartumRecordsCount(query));
27 27 query.start(postpartumRecordsQuery.getOffset()).end(postpartumRecordsQuery.getLimit());
28 28 }
29 29 return postpartumRecordsDao.queryPostpartumRecords(query.addOrder(Sort.Direction.DESC, "created"));
  30 + }
  31 +
  32 + public void savePostpartumRecords(PostpartumRecords postpartumRecords){
  33 + postpartumRecordsDao.addPostpartumRecords(postpartumRecords);
  34 + }
  35 +
  36 + public void updatePostpartumRecords(PostpartumRecords obj,String id){
  37 + postpartumRecordsDao.updatePostpartumRecordsById(obj,id);
30 38 }
31 39  
32 40 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/RecordsService.java View file @ 4d52018
... ... @@ -30,7 +30,11 @@
30 30 }
31 31  
32 32 public void updateRecordsById(Records obj,String id){
33   - recordsDao.updateRecordsById(obj,id);
  33 + recordsDao.updateRecordsById(obj, id);
  34 + }
  35 +
  36 + public void saveRecords(Records r){
  37 + recordsDao.savaRecords(r);
34 38 }
35 39  
36 40 }
platform-dal/src/main/java/com/lyms/platform/pojo/Records.java View file @ 4d52018
... ... @@ -25,6 +25,8 @@
25 25 private String fz;//附注
26 26 private String qm;//签名
27 27 private String isDelete;//是否有效(0:无效;1:有效)
  28 + private String created;//创建时间
  29 + private String modified;//修改时间
28 30  
29 31 public String getPostId() {
30 32 return postId;
... ... @@ -144,6 +146,22 @@
144 146  
145 147 public void setIsDelete(String isDelete) {
146 148 this.isDelete = isDelete;
  149 + }
  150 +
  151 + public String getCreated() {
  152 + return created;
  153 + }
  154 +
  155 + public void setCreated(String created) {
  156 + this.created = created;
  157 + }
  158 +
  159 + public String getModified() {
  160 + return modified;
  161 + }
  162 +
  163 + public void setModified(String modified) {
  164 + this.modified = modified;
147 165 }
148 166 }
platform-dal/src/main/java/com/lyms/platform/query/PostpartumRecordsQuery.java View file @ 4d52018
... ... @@ -14,6 +14,7 @@
14 14 */
15 15 public class PostpartumRecordsQuery extends BaseQuery implements IConvertToNativeQuery {
16 16  
  17 + private String id;//主键ID
17 18 private String parentId;//孕妇ID
18 19 private String hospitalId;//医院ID
19 20 private List<String> idList;//孕妇ID集合
... ... @@ -37,6 +38,9 @@
37 38 if(null != isDelete){
38 39 condition = condition.and("isDelete", isDelete, MongoOper.IS);
39 40 }
  41 + if(null != id){
  42 + condition = condition.and("id", id, MongoOper.IS);
  43 + }
40 44 return condition.toMongoQuery();
41 45 }
42 46  
... ... @@ -78,6 +82,14 @@
78 82  
79 83 public void setIsDelete(String isDelete) {
80 84 this.isDelete = isDelete;
  85 + }
  86 +
  87 + public String getId() {
  88 + return id;
  89 + }
  90 +
  91 + public void setId(String id) {
  92 + this.id = id;
81 93 }
82 94 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PostpartumRecordsController.java View file @ 4d52018
... ... @@ -5,9 +5,11 @@
5 5 import com.lyms.platform.common.base.LoginContext;
6 6 import com.lyms.platform.common.result.BaseResponse;
7 7 import com.lyms.platform.operate.web.facade.PostpartumRecordsFacade;
  8 +import com.lyms.platform.operate.web.request.PostpartumRecordsAddRequest;
8 9 import com.lyms.platform.operate.web.request.PostpartumRecordsQueryRequest;
9 10 import org.springframework.beans.factory.annotation.Autowired;
10 11 import org.springframework.stereotype.Controller;
  12 +import org.springframework.web.bind.annotation.RequestBody;
11 13 import org.springframework.web.bind.annotation.RequestMapping;
12 14 import org.springframework.web.bind.annotation.RequestMethod;
13 15 import org.springframework.web.bind.annotation.ResponseBody;
14 16  
15 17  
... ... @@ -26,13 +28,51 @@
26 28 private PostpartumRecordsFacade postpartumRecordsFacade;
27 29  
28 30  
29   - @RequestMapping(value = "/postpartumRecords",method = RequestMethod.GET)
  31 + /**
  32 + * 产后观察申请
  33 + * @param PostpartumRecordsQueryRequest
  34 + * @param request
  35 + * @return
  36 + */
  37 + @RequestMapping(value = "/getOneRecords",method = RequestMethod.GET)
30 38 @ResponseBody
31 39 @TokenRequired
32   - public BaseResponse getPostpartumRecords(@Valid PostpartumRecordsQueryRequest PostpartumRecordsQueryRequest,
  40 + public BaseResponse getOneRecords(@Valid PostpartumRecordsQueryRequest PostpartumRecordsQueryRequest,
33 41 HttpServletRequest request){
34 42 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
35 43 return postpartumRecordsFacade.queryPostpartumRecords(PostpartumRecordsQueryRequest,loginState.getId());
  44 + }
  45 +
  46 +
  47 + /**
  48 + * 产后观察管理
  49 + * @param postpartumRecordsAddRequest
  50 + * @param request
  51 + * @return
  52 + */
  53 + @RequestMapping(value = "/postpartumRecords",method = RequestMethod.POST)
  54 + @ResponseBody
  55 + @TokenRequired
  56 + public BaseResponse getPostpartumRecords(@Valid PostpartumRecordsAddRequest postpartumRecordsAddRequest,
  57 + HttpServletRequest request){
  58 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  59 + return postpartumRecordsFacade.getRecordsList(postpartumRecordsAddRequest, loginState.getId());
  60 + }
  61 +
  62 +
  63 + /**
  64 + * 新增或修改记录
  65 + * @param postpartumRecordsAddRequest
  66 + * @param request
  67 + * @return
  68 + */
  69 + @RequestMapping(value = "/addorUpdateRecords",method = RequestMethod.POST)
  70 + @ResponseBody
  71 + @TokenRequired
  72 + public BaseResponse addorUpdateRecords(@Valid @RequestBody PostpartumRecordsAddRequest postpartumRecordsAddRequest,
  73 + HttpServletRequest request){
  74 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  75 + return postpartumRecordsFacade.addOrUpdatePostpartumRecords(postpartumRecordsAddRequest,loginState.getId());
36 76 }
37 77  
38 78 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostpartumRecordsFacade.java View file @ 4d52018
... ... @@ -3,6 +3,7 @@
3 3 import com.lyms.platform.biz.service.*;
4 4 import com.lyms.platform.common.base.PageInfo;
5 5 import com.lyms.platform.common.constants.ErrorCodeConstants;
  6 +import com.lyms.platform.common.enums.OptActionEnums;
6 7 import com.lyms.platform.common.enums.YnEnums;
7 8 import com.lyms.platform.common.result.BaseListResponse;
8 9 import com.lyms.platform.common.result.BaseObjectResponse;
... ... @@ -60,6 +61,8 @@
60 61 private OrganizationService organizationService;
61 62 @Autowired
62 63 private UsersService usersService;
  64 + @Autowired
  65 + private OperateLogFacade operateLogFacade;
63 66  
64 67  
65 68 /**
... ... @@ -97,7 +100,7 @@
97 100 MaternalDeliverModel maternalDeliverModel = mdList.get(0);
98 101 prQuery.setParentId(parentId);
99 102 prQuery.setHospitalId(hospital);
100   - List<PostpartumRecords> prList = postpartumRecordsService.getBabySieveQuery(prQuery);
  103 + List<PostpartumRecords> prList = postpartumRecordsService.getPostpartumRecordsQuery(prQuery);
101 104 PostpartumRecords postpartumRecords = new PostpartumRecords();
102 105 if(CollectionUtils.isNotEmpty(prList)){
103 106 postpartumRecords = prList.get(0);
... ... @@ -278,7 +281,7 @@
278 281 prQuery.setPage(prAddRequest.getPage());
279 282 prQuery.setIsDelete("1");
280 283 prQuery.setNeed("need");
281   - List<PostpartumRecords> postList = postpartumRecordsService.getBabySieveQuery(prQuery);
  284 + List<PostpartumRecords> postList = postpartumRecordsService.getPostpartumRecordsQuery(prQuery);
282 285 if(CollectionUtils.isNotEmpty(postList)){
283 286 int batchSize = 3;
284 287 int end = 0;
... ... @@ -321,6 +324,68 @@
321 324 return baseListResponse.setData(resultList).setPageInfo(new PageInfo()).setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS);
322 325 }
323 326 return baseListResponse;
  327 + }
  328 +
  329 +
  330 + public BaseResponse addOrUpdatePostpartumRecords(PostpartumRecordsAddRequest postpartumRecordsAddRequest,Integer userId){
  331 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  332 + PostpartumRecords pRecords = new PostpartumRecords();
  333 + pRecords.setParentId(postpartumRecordsAddRequest.getParentId());
  334 + pRecords.setMaternalDeliverId(postpartumRecordsAddRequest.getMaternalDeliverId());
  335 + pRecords.setHospitalId(hospitalId);
  336 + pRecords.setTwoCxl(postpartumRecordsAddRequest.getOneCxl());
  337 + pRecords.setTwoCxl(postpartumRecordsAddRequest.getTwoCxl());
  338 + pRecords.setDoctor(String.valueOf(userId));
  339 + pRecords.setGcStatus("0");//正在观察
  340 + pRecords.setIsDelete("1");//有效数据
  341 + pRecords.setModified(DateUtil.getyyyy_MM_dd_hms(new Date()));
  342 +
  343 + BaseResponse baseResponse = new BaseResponse();
  344 + if (StringUtils.isNotEmpty(postpartumRecordsAddRequest.getId())){
  345 + //更新数据
  346 + pRecords.setId(postpartumRecordsAddRequest.getId());
  347 + PostpartumRecordsQuery ptRecordsQuery = new PostpartumRecordsQuery();
  348 + ptRecordsQuery.setId(postpartumRecordsAddRequest.getId());
  349 + ptRecordsQuery.setIsDelete("1");
  350 + List<PostpartumRecords> pOldRecords = postpartumRecordsService.getPostpartumRecordsQuery(ptRecordsQuery);
  351 + postpartumRecordsService.updatePostpartumRecords(pRecords,pRecords.getId());
  352 + if(CollectionUtils.isNotEmpty(pOldRecords)){
  353 + operateLogFacade.addModifyOptLog(userId, Integer.parseInt(hospitalId), pRecords, pOldRecords.get(0), OptActionEnums.UPDATE.getId(), "修改产后观察");
  354 + }
  355 + if(CollectionUtils.isNotEmpty(postpartumRecordsAddRequest.getRecords())){
  356 + List<PostpartumRecordsAddRequest.Records> rdsList = postpartumRecordsAddRequest.getRecords();
  357 + for(PostpartumRecordsAddRequest.Records rd : rdsList){
  358 + Records records = null;
  359 + if(StringUtils.isNotEmpty(rd.getId())){
  360 + //更新详情数据
  361 + records = rd.convertToDataModel();
  362 + records.setIsDelete("1");
  363 + RecordsQuery recordsQuery = new RecordsQuery();
  364 + recordsQuery.setId(rd.getId());
  365 + recordsQuery.setIsDelete("1");
  366 + List<Records> oldRecordsList = recordsService.getRecordsListQuery(recordsQuery);
  367 + recordsService.updateRecordsById(records,records.getId());
  368 + if(CollectionUtils.isNotEmpty(oldRecordsList)){
  369 + operateLogFacade.addModifyOptLog(userId, Integer.parseInt(hospitalId), records, oldRecordsList.get(0), OptActionEnums.UPDATE.getId(), "修改产后观察记录详情");
  370 + }
  371 + }else{
  372 + //新增详情数据
  373 + records = rd.convertToDataModel();
  374 + records.setIsDelete("1");
  375 + records.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date()));
  376 + records.setModified(DateUtil.getyyyy_MM_dd_hms(new Date()));
  377 + recordsService.saveRecords(records);
  378 + }
  379 + }
  380 + }
  381 + }else{
  382 + //新增数据
  383 + pRecords.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date()));
  384 + postpartumRecordsService.savePostpartumRecords(pRecords);
  385 + }
  386 + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  387 + baseResponse.setObject(pRecords);
  388 + return baseResponse;
324 389 }
325 390  
326 391 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PostpartumRecordsAddRequest.java View file @ 4d52018
... ... @@ -59,6 +59,7 @@
59 59  
60 60 private String id;
61 61 private String parentId;//孕妇ID
  62 + private String MaternalDeliverId;//分娩ID
62 63 private String oneCxl;
63 64 private String twoCxl;
64 65 private List<Records> records;
... ... @@ -68,6 +69,14 @@
68 69 private String fmfs;//分娩方式
69 70 private String queryNo;//查询号
70 71  
  72 + public String getMaternalDeliverId() {
  73 + return MaternalDeliverId;
  74 + }
  75 +
  76 + public void setMaternalDeliverId(String maternalDeliverId) {
  77 + MaternalDeliverId = maternalDeliverId;
  78 + }
  79 +
71 80 public String getGcStatus() {
72 81 return gcStatus;
73 82 }
74 83  
... ... @@ -142,13 +151,15 @@
142 151 @Override
143 152 public PostpartumRecords convertToDataModel(){
144 153 PostpartumRecords postpartumRecords = new PostpartumRecords();
145   -
  154 + postpartumRecords.setParentId(parentId);
  155 + postpartumRecords.setOneCxl(oneCxl);
  156 + postpartumRecords.setTwoCxl(twoCxl);
146 157 return postpartumRecords;
147 158 }
148 159  
149 160  
150 161  
151   - /*public class Records implements IBasicRequestConvert<PostpartumRecords.Records> {
  162 + public class Records implements IBasicRequestConvert<com.lyms.platform.pojo.Records> {
152 163  
153 164 private String id;
154 165 private String date;//时间
... ... @@ -169,8 +180,8 @@
169 180 }
170 181  
171 182 @Override
172   - public PostpartumRecords.Records convertToDataModel() {
173   - PostpartumRecords.Records record= new PostpartumRecords.Records();
  183 + public com.lyms.platform.pojo.Records convertToDataModel() {
  184 + com.lyms.platform.pojo.Records record= new com.lyms.platform.pojo.Records();
174 185 record.setId(id);
175 186 record.setDate(date);
176 187 record.setTw(tw);
... ... @@ -291,6 +302,8 @@
291 302 public void setQm(String qm) {
292 303 this.qm = qm;
293 304 }
294   - }*/
  305 + }
  306 +
  307 +
295 308 }