Commit 857f1f246f7903cc7d289004a7f27e7dff5a8bc6
1 parent
e068223bb0
Exists in
master
and in
8 other branches
修改删除的流程
Showing 17 changed files with 377 additions and 43 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IStopPregnancyDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IYunBookBuildingDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/StopPregnancyDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/YunBookbuildingDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MatDeliverService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/StopPregnancyService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/YunBookbuildingService.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/MatDeliverQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PostReviewQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/StopPregQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatDeliverController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/DeleteProcessHandler.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IStopPregnancyDao.java
View file @
857f1f2
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IYunBookBuildingDao.java
View file @
857f1f2
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/StopPregnancyDaoImpl.java
View file @
857f1f2
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/YunBookbuildingDaoImpl.java
View file @
857f1f2
... | ... | @@ -32,6 +32,10 @@ |
32 | 32 | return save(patient); |
33 | 33 | } |
34 | 34 | |
35 | + public Patients findOneById(String id){ | |
36 | + return findById(id); | |
37 | + } | |
38 | + | |
35 | 39 | @Override |
36 | 40 | public void updatePatient(Patients obj, String id) { |
37 | 41 | update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MatDeliverService.java
View file @
857f1f2
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | } |
38 | 38 | |
39 | 39 | public List<MaternalDeliverModel> query(MatDeliverQuery deliverQuery){ |
40 | - return iMatDeliverDao.queryWithList(deliverQuery.convertToQuery().addOrder(Sort.Direction.DESC,"created")); | |
40 | + return iMatDeliverDao.queryWithList(deliverQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); | |
41 | 41 | } |
42 | 42 | public void deleteOne(String id){ |
43 | 43 | iMatDeliverDao.deleteOne(id); |
... | ... | @@ -47,6 +47,9 @@ |
47 | 47 | iMatDeliverDao.updateOneById(deliverModel, id); |
48 | 48 | } |
49 | 49 | |
50 | + public int count(MatDeliverQuery matDeliverQuery){ | |
51 | + return iMatDeliverDao.queryCount(matDeliverQuery.convertToQuery()); | |
52 | + } | |
50 | 53 | public MaternalDeliverModel getOneMatDeliver(String id){ |
51 | 54 | return iMatDeliverDao.getById(id); |
52 | 55 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/StopPregnancyService.java
View file @
857f1f2
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/YunBookbuildingService.java
View file @
857f1f2
... | ... | @@ -45,8 +45,12 @@ |
45 | 45 | antExChuModel.setLastMenses(patient.getLastMenses()); |
46 | 46 | antExChuModel.setParentId(id); |
47 | 47 | |
48 | - antExChuDao.updateOneAntEx(antExChuQuery.convertToQuery(),antExChuModel); | |
48 | + antExChuDao.updateOneAntEx(antExChuQuery.convertToQuery(), antExChuModel); | |
49 | 49 | |
50 | + } | |
51 | + | |
52 | + public Patients findOneById(String id){ | |
53 | + return yunBookBuildingDao.findOneById(id); | |
50 | 54 | } |
51 | 55 | |
52 | 56 | public List<Patients> queryPregnantWithQuery(PatientsQuery patientsQuery) { |
platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java
View file @
857f1f2
... | ... | @@ -24,7 +24,26 @@ |
24 | 24 | |
25 | 25 | private Date end; |
26 | 26 | private String hospitalId; |
27 | + private boolean neStart; | |
27 | 28 | |
29 | + private boolean neEnd; | |
30 | + | |
31 | + public boolean isNeEnd() { | |
32 | + return neEnd; | |
33 | + } | |
34 | + | |
35 | + public void setNeEnd(boolean neEnd) { | |
36 | + this.neEnd = neEnd; | |
37 | + } | |
38 | + | |
39 | + public boolean isNeStart() { | |
40 | + return neStart; | |
41 | + } | |
42 | + | |
43 | + public void setNeStart(boolean neStart) { | |
44 | + this.neStart = neStart; | |
45 | + } | |
46 | + | |
28 | 47 | public String getHospitalId() { |
29 | 48 | return hospitalId; |
30 | 49 | } |
31 | 50 | |
32 | 51 | |
... | ... | @@ -80,15 +99,27 @@ |
80 | 99 | boolean isAddStart = Boolean.FALSE; |
81 | 100 | Criteria c = null; |
82 | 101 | if (null != start) { |
83 | - c = Criteria.where("checkDate").gte(start); | |
102 | + if(neStart){ | |
103 | + c = Criteria.where("checkDate").gt(start); | |
104 | + }else{ | |
105 | + c = Criteria.where("checkDate").gte(start); | |
106 | + } | |
84 | 107 | isAddStart = Boolean.TRUE; |
85 | 108 | } |
86 | 109 | |
87 | 110 | if (null != end) { |
88 | 111 | if (isAddStart) { |
89 | - c=c.lte(end); | |
112 | + if(neEnd){ | |
113 | + c=c.lt(end); | |
114 | + }else { | |
115 | + c=c.lte(end); | |
116 | + } | |
90 | 117 | } else { |
91 | - c = Criteria.where("checkDate").lte(end); | |
118 | + if(neEnd){ | |
119 | + c = Criteria.where("checkDate").lt(end); | |
120 | + }else{ | |
121 | + c = Criteria.where("checkDate").lte(end); | |
122 | + } | |
92 | 123 | } |
93 | 124 | isAddStart = Boolean.TRUE; |
94 | 125 | } |
platform-dal/src/main/java/com/lyms/platform/query/MatDeliverQuery.java
View file @
857f1f2
... | ... | @@ -23,7 +23,35 @@ |
23 | 23 | private Date createdStart; |
24 | 24 | private Date endStart; |
25 | 25 | private String dueDate; |
26 | + private String hospitalId; | |
27 | + private boolean neStart; | |
26 | 28 | |
29 | + private boolean neEnd; | |
30 | + | |
31 | + public boolean isNeEnd() { | |
32 | + return neEnd; | |
33 | + } | |
34 | + | |
35 | + public void setNeEnd(boolean neEnd) { | |
36 | + this.neEnd = neEnd; | |
37 | + } | |
38 | + | |
39 | + public boolean isNeStart() { | |
40 | + return neStart; | |
41 | + } | |
42 | + | |
43 | + public void setNeStart(boolean neStart) { | |
44 | + this.neStart = neStart; | |
45 | + } | |
46 | + | |
47 | + public String getHospitalId() { | |
48 | + return hospitalId; | |
49 | + } | |
50 | + | |
51 | + public void setHospitalId(String hospitalId) { | |
52 | + this.hospitalId = hospitalId; | |
53 | + } | |
54 | + | |
27 | 55 | public String getDueDate() { |
28 | 56 | return dueDate; |
29 | 57 | } |
30 | 58 | |
31 | 59 | |
32 | 60 | |
... | ... | @@ -87,19 +115,34 @@ |
87 | 115 | if (null != parentId) { |
88 | 116 | condition = condition.and("parentId", parentId, MongoOper.IS); |
89 | 117 | } |
118 | + if (null != hospitalId) { | |
119 | + condition = condition.and("hospitalId", hospitalId, MongoOper.IS); | |
120 | + } | |
90 | 121 | Criteria c = null; |
91 | 122 | |
92 | 123 | Boolean isAddStart = Boolean.FALSE; |
93 | 124 | |
94 | 125 | if (null != createdStart) { |
95 | - c = Criteria.where("dueDate1").gte(createdStart); | |
126 | + if(neStart){ | |
127 | + c = Criteria.where("dueDate1").gt(createdStart); | |
128 | + }else{ | |
129 | + c = Criteria.where("dueDate1").gte(createdStart); | |
130 | + } | |
96 | 131 | isAddStart = Boolean.TRUE; |
97 | 132 | } |
98 | 133 | if (null != endStart) { |
99 | 134 | if (isAddStart) { |
100 | - c = c.lte(endStart); | |
135 | + if(neEnd){ | |
136 | + c = c.lt(endStart); | |
137 | + }else{ | |
138 | + c = c.lte(endStart); | |
139 | + } | |
101 | 140 | } else { |
102 | - c = Criteria.where("dueDate1").lte(endStart); | |
141 | + if(neEnd){ | |
142 | + c = Criteria.where("dueDate1").lt(endStart); | |
143 | + }else { | |
144 | + c = Criteria.where("dueDate1").lte(endStart); | |
145 | + } | |
103 | 146 | } |
104 | 147 | isAddStart = Boolean.TRUE; |
105 | 148 | } |
platform-dal/src/main/java/com/lyms/platform/query/PostReviewQuery.java
View file @
857f1f2
... | ... | @@ -20,6 +20,11 @@ |
20 | 20 | private Date start; |
21 | 21 | |
22 | 22 | private Date end; |
23 | + | |
24 | + private boolean neStart; | |
25 | + | |
26 | + private boolean neEnd; | |
27 | + | |
23 | 28 | private String pid; |
24 | 29 | |
25 | 30 | private String hospitalId; |
... | ... | @@ -44,6 +49,22 @@ |
44 | 49 | return end; |
45 | 50 | } |
46 | 51 | |
52 | + public boolean getNeEnd() { | |
53 | + return neEnd; | |
54 | + } | |
55 | + | |
56 | + public void setNeEnd(boolean neEnd) { | |
57 | + this.neEnd = neEnd; | |
58 | + } | |
59 | + | |
60 | + public boolean getNeStart() { | |
61 | + return neStart; | |
62 | + } | |
63 | + | |
64 | + public void setNeStart(boolean neStart) { | |
65 | + this.neStart = neStart; | |
66 | + } | |
67 | + | |
47 | 68 | public void setEnd(Date end) { |
48 | 69 | this.end = end; |
49 | 70 | } |
50 | 71 | |
51 | 72 | |
... | ... | @@ -101,15 +122,27 @@ |
101 | 122 | boolean isAddStart = Boolean.FALSE; |
102 | 123 | Criteria c = null; |
103 | 124 | if (null != start) { |
104 | - c = Criteria.where("checkTime").gte(start); | |
125 | + if(neStart){ | |
126 | + c = Criteria.where("checkTime").gt(start); | |
127 | + }else{ | |
128 | + c = Criteria.where("checkTime").gte(start); | |
129 | + } | |
105 | 130 | isAddStart = Boolean.TRUE; |
106 | 131 | } |
107 | 132 | |
108 | 133 | if (null != end) { |
109 | 134 | if (isAddStart) { |
110 | - c=c.lte(end); | |
135 | + if(neEnd){ | |
136 | + c.lt(end); | |
137 | + }else { | |
138 | + c=c.lte(end); | |
139 | + } | |
111 | 140 | } else { |
112 | - c = Criteria.where("checkTime").lte(end); | |
141 | + if(neEnd){ | |
142 | + c = Criteria.where("checkTime").lt(end); | |
143 | + }else{ | |
144 | + c = Criteria.where("checkTime").lte(end); | |
145 | + } | |
113 | 146 | } |
114 | 147 | isAddStart = Boolean.TRUE; |
115 | 148 | } |
platform-dal/src/main/java/com/lyms/platform/query/StopPregQuery.java
View file @
857f1f2
... | ... | @@ -30,7 +30,10 @@ |
30 | 30 | |
31 | 31 | //终止妊娠日期 |
32 | 32 | private String stopDate; |
33 | + private boolean neStart; | |
33 | 34 | |
35 | + private boolean neEnd; | |
36 | + | |
34 | 37 | private Date stopDateStart; |
35 | 38 | private Date stopDateEnd; |
36 | 39 | //录入人 |
37 | 40 | |
... | ... | @@ -38,7 +41,32 @@ |
38 | 41 | |
39 | 42 | private Integer yn=-1; |
40 | 43 | private String pid; |
44 | + private String hospitalId; | |
41 | 45 | |
46 | + public String getHospitalId() { | |
47 | + return hospitalId; | |
48 | + } | |
49 | + | |
50 | + public boolean isNeEnd() { | |
51 | + return neEnd; | |
52 | + } | |
53 | + | |
54 | + public void setNeEnd(boolean neEnd) { | |
55 | + this.neEnd = neEnd; | |
56 | + } | |
57 | + | |
58 | + public boolean isNeStart() { | |
59 | + return neStart; | |
60 | + } | |
61 | + | |
62 | + public void setNeStart(boolean neStart) { | |
63 | + this.neStart = neStart; | |
64 | + } | |
65 | + | |
66 | + public void setHospitalId(String hospitalId) { | |
67 | + this.hospitalId = hospitalId; | |
68 | + } | |
69 | + | |
42 | 70 | public Date getStopDateEnd() { |
43 | 71 | return stopDateEnd; |
44 | 72 | } |
45 | 73 | |
46 | 74 | |
47 | 75 | |
... | ... | @@ -71,17 +99,33 @@ |
71 | 99 | if (null!= pid) { |
72 | 100 | condition = condition.and("pid", pid, MongoOper.IS); |
73 | 101 | } |
102 | + if (null!= hospitalId) { | |
103 | + condition = condition.and("hospitalId", hospitalId, MongoOper.IS); | |
104 | + } | |
74 | 105 | Criteria c=null; |
75 | 106 | Boolean isAddStart = Boolean.FALSE; |
76 | 107 | if (null != stopDateStart) { |
77 | - c = Criteria.where("stopDate").gte(stopDateStart); | |
108 | + if(neStart){ | |
109 | + c = Criteria.where("stopDate").gt(stopDateStart); | |
110 | + }else{ | |
111 | + c = Criteria.where("stopDate").gte(stopDateStart); | |
112 | + } | |
78 | 113 | isAddStart = Boolean.TRUE; |
79 | 114 | } |
80 | 115 | if (null != stopDateEnd) { |
81 | 116 | if (isAddStart) { |
82 | - c = c.lte(stopDateEnd); | |
117 | + if(neEnd){ | |
118 | + c = c.lt(stopDateEnd); | |
119 | + }else{ | |
120 | + c = c.lte(stopDateEnd); | |
121 | + } | |
83 | 122 | } else { |
84 | - c = Criteria.where("stopDate").lte(stopDateEnd); | |
123 | + if(neEnd) { | |
124 | + c = Criteria.where("stopDate").lt(stopDateEnd); | |
125 | + }else { | |
126 | + c = Criteria.where("stopDate").lte(stopDateEnd); | |
127 | + | |
128 | + } | |
85 | 129 | } |
86 | 130 | isAddStart = Boolean.TRUE; |
87 | 131 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java
View file @
857f1f2
... | ... | @@ -69,8 +69,10 @@ |
69 | 69 | */ |
70 | 70 | @RequestMapping(value = "/deletePregnant/{id}", method = RequestMethod.DELETE) |
71 | 71 | @ResponseBody |
72 | - public BaseResponse deletePregnantById(@PathVariable("id")String id){ | |
73 | - return bookbuildingFacade.deletePregnantById(id); | |
72 | + @TokenRequired | |
73 | + public BaseResponse deletePregnantById(@PathVariable("id")String id,HttpServletRequest httpServletRequest){ | |
74 | + LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext"); | |
75 | + return bookbuildingFacade.deletePregnantById(id,loginState.getId()); | |
74 | 76 | } |
75 | 77 | |
76 | 78 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatDeliverController.java
View file @
857f1f2
... | ... | @@ -67,11 +67,12 @@ |
67 | 67 | @RequestMapping(value = "/matdel",method = RequestMethod.DELETE) |
68 | 68 | @ResponseBody |
69 | 69 | @TokenRequired |
70 | - public BaseResponse delOneMatDeliver(@RequestParam("id") String id) { | |
70 | + public BaseResponse delOneMatDeliver(@RequestParam("id") String id,HttpServletRequest httpServletRequest) { | |
71 | 71 | if(StringUtils.isEmpty(id)){ |
72 | 72 | return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("id不能为空"); |
73 | 73 | } |
74 | - return matDeliverFacade.delOneMatDeliver(id); | |
74 | + LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext"); | |
75 | + return matDeliverFacade.delOneMatDeliver(id,loginState.getId()); | |
75 | 76 | } |
76 | 77 | |
77 | 78 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
857f1f2
... | ... | @@ -55,6 +55,8 @@ |
55 | 55 | private StopPregnancyService stopPregnancyService; |
56 | 56 | @Autowired |
57 | 57 | private UsersService usersService; |
58 | + @Autowired | |
59 | + private DeleteProcessHandler deleteProcessHandler; | |
58 | 60 | |
59 | 61 | |
60 | 62 | /** |
... | ... | @@ -462,7 +464,7 @@ |
462 | 464 | List<Patients> patientses = patientsService.queryPatient(patientsQuery); |
463 | 465 | if (CollectionUtils.isNotEmpty(patientses)) { |
464 | 466 | for (Patients patients : patientses) { |
465 | - if(null!=patients.getLastMenses()){ | |
467 | + if (null != patients.getLastMenses()) { | |
466 | 468 | listDate.add(new SortIn(patients, "1")); |
467 | 469 | } |
468 | 470 | } |
... | ... | @@ -1046,7 +1048,7 @@ |
1046 | 1048 | if (o1.getDate() != null && o1.getDate().after(o2.getDate())) { |
1047 | 1049 | return -1; |
1048 | 1050 | } |
1049 | - if (o1.getDate() != null && o1.getDate().before(o2.getDate())) { | |
1051 | + if (o1.getDate() != null && o1.getDate().before(o2.getDate())) { | |
1050 | 1052 | return 1; |
1051 | 1053 | } |
1052 | 1054 | return 0; |
... | ... | @@ -1252,7 +1254,11 @@ |
1252 | 1254 | antEx.setId(antExQueryRequest.getId()); |
1253 | 1255 | String hospital = autoMatchFacade.getHospitalId(userId); |
1254 | 1256 | |
1255 | - AntExQuery antExQuery = new AntExQuery(); | |
1257 | + AntenatalExaminationModel localAntModel = antenatalExaminationService.findOneById(antExQueryRequest.getId()); | |
1258 | + | |
1259 | + ; | |
1260 | + | |
1261 | + /*AntExQuery antExQuery = new AntExQuery(); | |
1256 | 1262 | antExQuery.setId(antExQueryRequest.getId()); |
1257 | 1263 | antExQuery.setYn(YnEnums.YES.getId()); |
1258 | 1264 | antExQuery.setHospitalId(hospital); |
1259 | 1265 | |
... | ... | @@ -1270,9 +1276,10 @@ |
1270 | 1276 | list.remove(i); |
1271 | 1277 | } |
1272 | 1278 | } |
1273 | - } | |
1279 | + }*/ | |
1274 | 1280 | |
1275 | - if (CollectionUtils.isEmpty(list)) { | |
1281 | +// if (CollectionUtils.isEmpty(list)) { | |
1282 | + if (deleteProcessHandler.deleteAntEx(localAntModel.getPid(), localAntModel.getCheckDate(), hospital, true)) { | |
1276 | 1283 | antenatalExaminationService.updateOneAnt(antEx, antExQueryRequest.getId()); |
1277 | 1284 | |
1278 | 1285 | |
... | ... | @@ -1290,7 +1297,12 @@ |
1290 | 1297 | String hospital = autoMatchFacade.getHospitalId(userId); |
1291 | 1298 | |
1292 | 1299 | |
1293 | - AntExChuQuery antExQuery = new AntExChuQuery(); | |
1300 | + AntExChuModel antExChuModel11 = antenatalExaminationService.findOne(antExQueryRequest.getId()); | |
1301 | + | |
1302 | + | |
1303 | + | |
1304 | + | |
1305 | + /*AntExChuQuery antExQuery = new AntExChuQuery(); | |
1294 | 1306 | antExQuery.setId(antExQueryRequest.getId()); |
1295 | 1307 | antExQuery.setYn(YnEnums.YES.getId()); |
1296 | 1308 | antExQuery.setHospitalId(hospital); |
1297 | 1309 | |
... | ... | @@ -1313,9 +1325,10 @@ |
1313 | 1325 | list.remove(i); |
1314 | 1326 | } |
1315 | 1327 | } |
1316 | - } | |
1328 | + }*/ | |
1317 | 1329 | |
1318 | - if (CollectionUtils.isEmpty(list)) { | |
1330 | +// if (CollectionUtils.isEmpty(list)) { | |
1331 | + if (deleteProcessHandler.deleteAntExChu(antExChuModel11.getPid(), antExChuModel11.getCheckTime(), hospital, true)) { | |
1319 | 1332 | antenatalExaminationService.updateAntExChu(antExChuModel, antExQueryRequest.getId()); |
1320 | 1333 | |
1321 | 1334 | AntExChuModel antExChuModel1 = antenatalExaminationService.findOne(antExQueryRequest.getId()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
857f1f2
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | private AntenatalExaminationService antenatalExaminationService; |
64 | 64 | |
65 | 65 | @Autowired |
66 | - private SmsConfigService smsConfigService; | |
66 | + private AutoMatchFacade autoMatchFacade; | |
67 | 67 | |
68 | 68 | @Autowired |
69 | 69 | private UsersService usersService; |
... | ... | @@ -85,6 +85,8 @@ |
85 | 85 | |
86 | 86 | @Autowired |
87 | 87 | private QingLongXianHisService qingLongXianHisService; |
88 | + @Autowired | |
89 | + private DeleteProcessHandler deleteProcessHandler; | |
88 | 90 | |
89 | 91 | /** |
90 | 92 | * 添加孕妇建档 |
91 | 93 | |
... | ... | @@ -922,13 +924,18 @@ |
922 | 924 | * @param id |
923 | 925 | * @return |
924 | 926 | */ |
925 | - public BaseResponse deletePregnantById(String id) { | |
927 | + public BaseResponse deletePregnantById(String id,Integer userId) { | |
926 | 928 | AntExChuQuery antExChuQuery = new AntExChuQuery(); |
927 | 929 | antExChuQuery.setParentId(id); |
928 | 930 | antExChuQuery.setYn(YnEnums.YES.getId()); |
929 | 931 | //获取初诊记录 |
930 | 932 | List<AntExChuModel> antExChulist = antenatalExaminationService.queryAntExChu(antExChuQuery); |
931 | - if (CollectionUtils.isNotEmpty(antExChulist)) | |
933 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
934 | + Patients patients = yunBookbuildingService.findOneById(id); | |
935 | + | |
936 | + ; | |
937 | +// if (CollectionUtils.isNotEmpty(antExChulist)) | |
938 | + if(deleteProcessHandler.deleteBookBuild(patients.getPid(),patients.getBookbuildingDate(),hospital)) | |
932 | 939 | { |
933 | 940 | return new BaseResponse().setErrorcode(ErrorCodeConstants.DONT_DELETE).setErrormsg("孕妇存在检查记录,不能删除建档"); |
934 | 941 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/DeleteProcessHandler.java
View file @
857f1f2
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.AntenatalExaminationService; | |
4 | +import com.lyms.platform.biz.service.MatDeliverService; | |
5 | +import com.lyms.platform.biz.service.PostReviewService; | |
6 | +import com.lyms.platform.biz.service.StopPregnancyService; | |
7 | +import com.lyms.platform.common.enums.YnEnums; | |
8 | +import com.lyms.platform.query.*; | |
9 | +import org.springframework.beans.factory.annotation.Autowired; | |
10 | +import org.springframework.stereotype.Component; | |
11 | + | |
12 | +import java.util.Date; | |
13 | + | |
14 | +/** | |
15 | + * 产后复查删除 | |
16 | + * <p> | |
17 | + * Created by Administrator on 2016/9/26 0026. | |
18 | + */ | |
19 | +@Component | |
20 | +public class DeleteProcessHandler { | |
21 | + | |
22 | + @Autowired | |
23 | + private PostReviewService postReviewService; | |
24 | + @Autowired | |
25 | + private StopPregnancyService stopPregnancyService; | |
26 | + @Autowired | |
27 | + private MatDeliverService matDeliverService; | |
28 | + @Autowired | |
29 | + private AntenatalExaminationService antenatalExaminationService; | |
30 | + | |
31 | + /** | |
32 | + * 删除产后复查记录,查询有没有大于检查时间的本院数据 | |
33 | + * | |
34 | + * @param lastMenses 末次月经 | |
35 | + * @param pid | |
36 | + * @param checkTime | |
37 | + * @param hospitalId | |
38 | + * @param qufenHospital 是否区分医院 | |
39 | + * @return | |
40 | + */ | |
41 | + public boolean doBiz(String pid, Date checkTime, String hospitalId,boolean qufenHospital) { | |
42 | + PostReviewQuery postReviewQuery = new PostReviewQuery(); | |
43 | + postReviewQuery.setPid(pid); | |
44 | + postReviewQuery.setStart(checkTime); | |
45 | + postReviewQuery.setNeStart(true); | |
46 | + postReviewQuery.setYn(YnEnums.YES.getId()); | |
47 | + if(qufenHospital){ | |
48 | + postReviewQuery.setHospitalId(hospitalId); | |
49 | + } | |
50 | + | |
51 | + return postReviewService.count(postReviewQuery) == 0; | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * 删除终止妊娠记录 | |
56 | + * | |
57 | + * @param pid | |
58 | + * @param checkTime | |
59 | + * @param hospitalId | |
60 | + * @return | |
61 | + */ | |
62 | + public boolean deleteStopPre( String pid, Date checkTime, String hospitalId) { | |
63 | + return doBiz( pid, checkTime, hospitalId,false); | |
64 | + } | |
65 | + | |
66 | + /** | |
67 | + * 删除分娩记录 | |
68 | + * | |
69 | + * @return | |
70 | + */ | |
71 | + | |
72 | + public boolean deleteMatdeil( String pid, Date checkTime, String hospitalId) { | |
73 | + return doBiz( pid, checkTime, hospitalId,false); | |
74 | + } | |
75 | + | |
76 | + /** | |
77 | + * 删除复诊记录 | |
78 | + * | |
79 | + * @param pid | |
80 | + * @param checkTime | |
81 | + * @param hospitalId | |
82 | + * @return | |
83 | + */ | |
84 | + public boolean deleteAntEx( String pid, Date checkTime, String hospitalId,boolean qufenHospital) { | |
85 | + //先判断是否有复查记录 | |
86 | + if (doBiz(pid, checkTime, hospitalId,false)) { | |
87 | + StopPregQuery stopPregQuery = new StopPregQuery(); | |
88 | + stopPregQuery.setPid(pid); | |
89 | + stopPregQuery.setYn(YnEnums.YES.getId()); | |
90 | + stopPregQuery.setStopDateStart(checkTime); | |
91 | + stopPregQuery.setNeStart(false); | |
92 | + | |
93 | + MatDeliverQuery matDeliverQuery=new MatDeliverQuery(); | |
94 | + matDeliverQuery.setPid(pid); | |
95 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
96 | + matDeliverQuery.setCreatedStart(checkTime); | |
97 | + matDeliverQuery.setNeStart(false); | |
98 | + if(stopPregnancyService.count(stopPregQuery) == 0 && matDeliverService.count(matDeliverQuery)==0) { | |
99 | + AntExQuery antExQuery=new AntExQuery(); | |
100 | + antExQuery.setPid(pid); | |
101 | + antExQuery.setYn(YnEnums.YES.getId()); | |
102 | + if(qufenHospital){ | |
103 | + antExQuery.setHospitalId(hospitalId); | |
104 | + } | |
105 | + antExQuery.setStart(checkTime); | |
106 | + antExQuery.setNeStart(true); | |
107 | + return antenatalExaminationService.queryAntenatalExaminationCount(antExQuery.convertToQuery())==0; | |
108 | + } | |
109 | + } | |
110 | + return false; | |
111 | + } | |
112 | + | |
113 | + public boolean deleteAntExChu( String pid, Date checkTime, String hospitalId,boolean qufenHospital) { | |
114 | + if (deleteAntEx(pid, checkTime, hospitalId, false)) { | |
115 | + AntExChuQuery antExChuQuery=new AntExChuQuery(); | |
116 | + antExChuQuery.setPid(pid); | |
117 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
118 | + antExChuQuery.setStart(checkTime); | |
119 | + if(qufenHospital){ | |
120 | + antExChuQuery.setHospitalId(hospitalId); | |
121 | + } | |
122 | + return antenatalExaminationService.queryAntExChuCount(antExChuQuery.convertToQuery()) ==0; | |
123 | + } | |
124 | + return false; | |
125 | + } | |
126 | + | |
127 | + public boolean deleteBookBuild(String pid, Date checkTime, String hospitalId){ | |
128 | + if(deleteAntExChu(pid,checkTime,hospitalId,false)){ | |
129 | + return true; | |
130 | + } | |
131 | + return false; | |
132 | + } | |
133 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
857f1f2
... | ... | @@ -57,7 +57,8 @@ |
57 | 57 | |
58 | 58 | @Autowired |
59 | 59 | private BabyBookbuildingFacade babyBookbuildingFacade; |
60 | - | |
60 | + @Autowired | |
61 | + private DeleteProcessHandler deleteProcessHandler; | |
61 | 62 | private static Map<Integer, String> ONE_ENUMS = new HashMap<>(); |
62 | 63 | |
63 | 64 | private static Map<String, List> babyMap = new HashMap<>(); |
... | ... | @@ -289,7 +290,7 @@ |
289 | 290 | List<Patients> patientsList = patientsService.queryPatient(patientsQuery); |
290 | 291 | for (Patients patients : patientsList) { |
291 | 292 | //判断分娩日期是否大于24孕周 |
292 | - if(null!=patients.getLastMenses()){ | |
293 | + if (null != patients.getLastMenses()) { | |
293 | 294 | if (fmDate.getTime() >= DateUtil.addDay(patients.getLastMenses(), 168).getTime()) { |
294 | 295 | patients.setFmDate(fmDate); |
295 | 296 | patients.setType(3); |
... | ... | @@ -300,7 +301,7 @@ |
300 | 301 | } |
301 | 302 | |
302 | 303 | |
303 | - private BabyModel fillBaby(Patients patients,MatDeliverAddRequest deliverAddRequest) { | |
304 | + private BabyModel fillBaby(Patients patients, MatDeliverAddRequest deliverAddRequest) { | |
304 | 305 | BabyModel babyModel = new BabyModel(); |
305 | 306 | if (null != patients) { |
306 | 307 | babyModel.setAreaId(patients.getAreaId()); |
... | ... | @@ -330,9 +331,9 @@ |
330 | 331 | babyModel.setBuildDoctor("a9e5507f-e7da-4ec6-b8db-9a1e4d1b7c29"); |
331 | 332 | babyModel.setServiceStatus(patients.getServiceStatus()); |
332 | 333 | babyModel.setServiceType(patients.getServiceType()); |
333 | - if(null!=deliverAddRequest.getDueDate()){ | |
334 | - int day=DateUtil.getDays(patients.getLastMenses(),DateUtil.parseYMD(deliverAddRequest.getDueDate())); | |
335 | - babyModel.setDueWeek(day/7); | |
334 | + if (null != deliverAddRequest.getDueDate()) { | |
335 | + int day = DateUtil.getDays(patients.getLastMenses(), DateUtil.parseYMD(deliverAddRequest.getDueDate())); | |
336 | + babyModel.setDueWeek(day / 7); | |
336 | 337 | } |
337 | 338 | } |
338 | 339 | // 产妇分娩建档 |
... | ... | @@ -430,7 +431,7 @@ |
430 | 431 | MaternalDeliverModel.Baby baby1 = baby.convertToDataModel(); |
431 | 432 | babyList.add(baby1); |
432 | 433 | //填充小孩基本信息 |
433 | - BabyModel babyModel = fillBaby(patients,deliverAddRequest); | |
434 | + BabyModel babyModel = fillBaby(patients, deliverAddRequest); | |
434 | 435 | babyModel.setDeliverOrg(hospital); |
435 | 436 | baby.setId(baby1.getId()); |
436 | 437 | babyModel.setBirth(DateUtil.parseYMD(deliverAddRequest.getDueDate())); |
... | ... | @@ -653,12 +654,17 @@ |
653 | 654 | * @param id |
654 | 655 | * @return |
655 | 656 | */ |
656 | - public BaseResponse delOneMatDeliver(String id) { | |
657 | - MaternalDeliverModel maternalDeliverModel = new MaternalDeliverModel(); | |
658 | - maternalDeliverModel.setYn(YnEnums.NO.getId()); | |
659 | - maternalDeliverModel.setId(id); | |
660 | - matDeliverService.updateOne(maternalDeliverModel, id); | |
661 | - return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
657 | + public BaseResponse delOneMatDeliver(String id, Integer userId) { | |
658 | + MaternalDeliverModel matModel = matDeliverService.getOneMatDeliver(id); | |
659 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
660 | + if (deleteProcessHandler.deleteMatdeil(matModel.getPid(), matModel.getDueDate1(), hospital)) { | |
661 | + MaternalDeliverModel maternalDeliverModel = new MaternalDeliverModel(); | |
662 | + maternalDeliverModel.setYn(YnEnums.NO.getId()); | |
663 | + maternalDeliverModel.setId(id); | |
664 | + matDeliverService.updateOne(maternalDeliverModel, id); | |
665 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
666 | + } | |
667 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("不能删除该条数据"); | |
662 | 668 | } |
663 | 669 | |
664 | 670 | /** |