Commit bf494fd2957a926f823d86035a65f2ca942a237f
1 parent
3487798848
Exists in
master
and in
1 other branch
儿童建档
Showing 5 changed files with 93 additions and 88 deletions
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StopPregnancyController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/StopPregnancyFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/StopPregRequest.java
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
bf494fd
... | ... | @@ -651,8 +651,11 @@ |
651 | 651 | // String st = md.format(new Date()); |
652 | 652 | // System.out.print(st); |
653 | 653 | |
654 | - String s = getBabyMonthAge(parseYMD("2014-07-9"), new Date()); | |
655 | - System.out.println(s); | |
654 | +// String s = getBabyMonthAge(parseYMD("2014-07-9"), new Date()); | |
655 | +// System.out.println(s); | |
656 | + | |
657 | + Date s = addDay(parseYMD("2016-02-26"), 168); | |
658 | + System.out.println(getyyyy_MM_dd(s)); | |
656 | 659 | } catch (Exception e) |
657 | 660 | { |
658 | 661 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StopPregnancyController.java
View file @
bf494fd
... | ... | @@ -32,12 +32,15 @@ |
32 | 32 | */ |
33 | 33 | @RequestMapping(method = RequestMethod.POST, value = "/addOrUpStopPreg") |
34 | 34 | @ResponseBody |
35 | - public BaseResponse addOrUpStopPreg(@Valid @RequestBody StopPregRequest request) { | |
36 | - if (!StringUtils.isEmpty(request.getId())) | |
35 | + @TokenRequired | |
36 | + public BaseResponse addOrUpStopPreg(@Valid @RequestBody StopPregRequest params,HttpServletRequest request) { | |
37 | + if (!StringUtils.isEmpty(params.getId())) | |
37 | 38 | { |
38 | - return stopPregnancyFacade.updateStopPreg(request); | |
39 | + return stopPregnancyFacade.updateStopPreg(params); | |
39 | 40 | } |
40 | - return stopPregnancyFacade.addStopPreg(request); | |
41 | + | |
42 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
43 | + return stopPregnancyFacade.addStopPreg(params,loginState.getId()); | |
41 | 44 | } |
42 | 45 | |
43 | 46 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
bf494fd
... | ... | @@ -165,10 +165,8 @@ |
165 | 165 | * @return |
166 | 166 | */ |
167 | 167 | public BaseObjectResponse addBabyBookbuilding(BabyBookbuildingAddRequest request) { |
168 | + BaseObjectResponse br = new BaseObjectResponse(); | |
168 | 169 | |
169 | - | |
170 | -// Patients ppatients = patientsService.findLastBuildRecord("579b15d1231a17fcf5579bec",YnEnums.YES.getId()); | |
171 | -// return null; | |
172 | 170 | //判断儿童是否建档在该医院 |
173 | 171 | if (StringUtils.isNotEmpty(request.getMommyPhone()) || StringUtils.isNotEmpty(request.getMommyCertificateNum())) |
174 | 172 | { |
... | ... | @@ -185,7 +183,6 @@ |
185 | 183 | List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); |
186 | 184 | if (CollectionUtils.isNotEmpty(models)) |
187 | 185 | { |
188 | - BaseObjectResponse br = new BaseObjectResponse(); | |
189 | 186 | br.setErrorcode(ErrorCodeConstants.DATA_EXIST); |
190 | 187 | br.setErrormsg("儿童在医院已经建档"); |
191 | 188 | return br; |
... | ... | @@ -217,42 +214,6 @@ |
217 | 214 | } |
218 | 215 | |
219 | 216 | |
220 | -// Patients patients = null; | |
221 | -// PersonModel resperson = null; | |
222 | -// if (request.getMommyPhone() != null || request.getMommyCertificateNum() != null) | |
223 | -// { | |
224 | -// //查询儿童基本信息 | |
225 | -// PersonModelQuery personModelQuery = new PersonModelQuery(); | |
226 | -//// personModelQuery.setPhone(request.getMommyPhone()); | |
227 | -// personModelQuery.setYn(YnEnums.YES.getId()); | |
228 | -// personModelQuery.setName(request.getBabyName()); | |
229 | -// personModelQuery.setType(2); | |
230 | -// personModelQuery.setCardNo(request.getMommyCertificateNum()); | |
231 | -// List<PersonModel> personModels = personService.queryPersons(personModelQuery); | |
232 | -// | |
233 | -// //更新儿童基本信息的内容 | |
234 | -// PersonModel pmodel = new PersonModel(); | |
235 | -// pmodel.setName(request.getBabyName()); | |
236 | -// pmodel.setBirth(DateUtil.parseYMD(request.getBabyBirthday())); | |
237 | -// pmodel.setPhone(request.getMommyPhone()); | |
238 | -// pmodel.setCardNo(request.getMommyCertificateNum()); | |
239 | -// pmodel.setType(2); | |
240 | -// pmodel.setYn(YnEnums.YES.getId()); | |
241 | -// pmodel.setModified(new Date()); | |
242 | -// if (CollectionUtils.isNotEmpty(personModels) && personModels.get(0) != null) | |
243 | -// { | |
244 | -// resperson = personModels.get(0); | |
245 | -// personService.updatePerson(pmodel,personModels.get(0).getId()); | |
246 | -// } | |
247 | -// else | |
248 | -// { | |
249 | -// pmodel.setYn(YnEnums.YES.getId()); | |
250 | -// pmodel.setCreated(new Date()); | |
251 | -// resperson = personService.addPerson(pmodel); | |
252 | -// } | |
253 | -// } | |
254 | - | |
255 | - | |
256 | 217 | //查询孕妇或者产妇建档的基本信息 |
257 | 218 | PersonModelQuery personYunModelQuery = new PersonModelQuery(); |
258 | 219 | // personYunModelQuery.setPhone(request.getMommyPhone()); |
259 | 220 | |
260 | 221 | |
... | ... | @@ -272,17 +233,26 @@ |
272 | 233 | List<Patients> pats = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); |
273 | 234 | if (CollectionUtils.isNotEmpty(pats)) |
274 | 235 | { |
275 | - patients = pats.get(0); | |
276 | - } | |
277 | - //当前状态为 孕妇状态 | |
278 | - if (pm.getType() != null && pm.getType() == 1) | |
279 | - { | |
280 | - boolean isUpdatePatStatus = false; | |
281 | - for(Patients pat : pats) | |
236 | + | |
237 | + //当前状态为 孕妇状态 | |
238 | + if (pm.getType() != null && pm.getType() == 1) | |
282 | 239 | { |
283 | - if (pat != null) { | |
284 | - if (pat.getType() == 1) { | |
240 | + boolean isUpdatePatStatus = false; | |
241 | + for(Patients pat : pats) | |
242 | + { | |
243 | + if (pat == null) | |
244 | + { | |
245 | + continue; | |
246 | + } | |
285 | 247 | |
248 | + //找到当前医院的孕妇建档 | |
249 | + if (pat.getHospitalId() != null && pat.getHospitalId().equals(request.getHospitalId())) | |
250 | + { | |
251 | + patients = pat; | |
252 | + } | |
253 | + | |
254 | + if (pat.getType() != null && pat.getType() == 1) { | |
255 | + | |
286 | 256 | //判断在儿童建档的时候,是否设置到这个儿童对应的孕妇 设置成产妇 |
287 | 257 | //计算规则 儿童生日 >= 孕妇末次月经 + 24周 设置成分娩 (高帆 2016-08-09 16:47定 ) |
288 | 258 | Date lastMenses = pat.getLastMenses(); |
... | ... | @@ -294,6 +264,7 @@ |
294 | 264 | Patients patientUpdate = new Patients(); |
295 | 265 | patientUpdate.setYn(YnEnums.YES.getId()); |
296 | 266 | patientUpdate.setType(3); |
267 | + patientUpdate.setFmDate(StringUtils.isEmpty(request.getDueDate()) ? DateUtil.parseYMD(request.getBabyBirthday()) : DateUtil.parseYMD(request.getDueDate())); | |
297 | 268 | patientsService.updatePatientByPid(patientUpdate, pm.getId()); |
298 | 269 | if (!isUpdatePatStatus) |
299 | 270 | { |
300 | 271 | |
301 | 272 | |
... | ... | @@ -304,14 +275,15 @@ |
304 | 275 | } |
305 | 276 | } |
306 | 277 | } |
307 | - } | |
308 | 278 | |
309 | - if (isUpdatePatStatus) | |
310 | - { | |
311 | - pm.setType(3);//基本信息更新成产妇 | |
312 | - personService.updatePerson(pm,pm.getId()); | |
279 | + if (isUpdatePatStatus) | |
280 | + { | |
281 | + pm.setType(3);//基本信息更新成产妇 | |
282 | + personService.updatePerson(pm,pm.getId()); | |
283 | + } | |
313 | 284 | } |
314 | 285 | } |
286 | + | |
315 | 287 | } |
316 | 288 | } |
317 | 289 | //没有孕妇基本信息就新建产妇建档 和基本信息 |
... | ... | @@ -338,6 +310,13 @@ |
338 | 310 | } |
339 | 311 | |
340 | 312 | |
313 | + if (patients == null) | |
314 | + { | |
315 | + br.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); | |
316 | + br.setErrormsg("失败"); | |
317 | + return br; | |
318 | + } | |
319 | + | |
341 | 320 | BabyModel model = getBabyModel(request); |
342 | 321 | model.setPid(babyPersonId); |
343 | 322 | |
... | ... | @@ -361,7 +340,7 @@ |
361 | 340 | model.setCreated(new Date()); |
362 | 341 | model.setModified(new Date()); |
363 | 342 | model = babyBookbuildingService.addBabyBookbuilding(model); |
364 | - BaseObjectResponse br = new BaseObjectResponse(); | |
343 | + | |
365 | 344 | if (model == null || model.getId() == null) { |
366 | 345 | br.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); |
367 | 346 | br.setErrormsg("失败"); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/StopPregnancyFacade.java
View file @
bf494fd
... | ... | @@ -14,12 +14,10 @@ |
14 | 14 | import com.lyms.platform.permission.model.Users; |
15 | 15 | import com.lyms.platform.permission.model.UsersQuery; |
16 | 16 | import com.lyms.platform.permission.service.UsersService; |
17 | -import com.lyms.platform.pojo.AntExChuModel; | |
18 | -import com.lyms.platform.pojo.BasicConfig; | |
19 | -import com.lyms.platform.pojo.Patients; | |
20 | -import com.lyms.platform.pojo.StopPregModel; | |
17 | +import com.lyms.platform.pojo.*; | |
21 | 18 | import com.lyms.platform.query.AntExChuQuery; |
22 | 19 | import com.lyms.platform.query.PatientsQuery; |
20 | +import com.lyms.platform.query.PersonModelQuery; | |
23 | 21 | import com.lyms.platform.query.StopPregQuery; |
24 | 22 | import org.apache.commons.collections.CollectionUtils; |
25 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
26 | 24 | |
... | ... | @@ -50,7 +48,10 @@ |
50 | 48 | @Autowired |
51 | 49 | private YunBookbuildingService yunBookbuildingService; |
52 | 50 | |
51 | + @Autowired | |
52 | + private PersonService personService; | |
53 | 53 | |
54 | + | |
54 | 55 | /** |
55 | 56 | * 更新终止妊娠 |
56 | 57 | * @param request |
57 | 58 | |
58 | 59 | |
59 | 60 | |
60 | 61 | |
61 | 62 | |
62 | 63 | |
63 | 64 | |
64 | 65 | |
... | ... | @@ -72,41 +73,60 @@ |
72 | 73 | * @param request |
73 | 74 | * @return |
74 | 75 | */ |
75 | - public BaseResponse addStopPreg(StopPregRequest request) { | |
76 | + public BaseResponse addStopPreg(StopPregRequest request,Integer userId) { | |
76 | 77 | |
78 | +// String hospitalId = ""; | |
79 | +// //得到当前登录的医院id | |
80 | +// if (userId != null) | |
81 | +// { | |
82 | +// Users dbuser = usersService.getUsers(userId); | |
83 | +// if (dbuser != null) { | |
84 | +// hospitalId = String.valueOf(dbuser.getOrgId()); | |
85 | +// } | |
86 | +// } | |
77 | 87 | |
88 | + | |
78 | 89 | PatientsQuery patientsQuery = new PatientsQuery(); |
79 | 90 | patientsQuery.setYn(YnEnums.YES.getId()); |
80 | 91 | patientsQuery.setType(1); |
81 | - patientsQuery.setId(request.getId()); | |
82 | - patientsQuery.setHospitalId(request.getHospitalId()); | |
92 | + patientsQuery.setPid(request.getPid()); | |
83 | 93 | |
84 | 94 | List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); |
85 | 95 | if (CollectionUtils.isNotEmpty(patients)) |
86 | 96 | { |
87 | - Patients patient = patients.get(0); | |
88 | - if (patient != null) | |
89 | - { | |
90 | - patient.setModified(new Date()); | |
91 | - patient.setDueStatus(1); | |
92 | 97 | |
93 | - //更新状态为过期 | |
94 | - //判断其为增值服务还是 标准服务 | |
95 | - if (patient.getServiceType() == ServiceTypeEnums.STANDARD_SERVICE.getId()) | |
98 | + for (Patients patient : patients) | |
99 | + { | |
100 | + if (patient != null) | |
96 | 101 | { |
97 | - patient.setServiceStatus(ServiceStatusEnums.STANDARD_OVERDUE.getId()); | |
98 | - } | |
99 | - else if (patient.getServiceType() == ServiceTypeEnums.ADD_SERVICE.getId()) | |
100 | - { | |
101 | - patient.setServiceStatus(ServiceStatusEnums.ADD_OVERDUE.getId()); | |
102 | - } | |
103 | - patient.setDueDate(new Date()); | |
104 | - patient.setType(3); | |
102 | + patient.setModified(new Date()); | |
103 | + //终止妊娠状态 | |
104 | + patient.setDueStatus(1); | |
105 | 105 | |
106 | - //分娩状态 0未终止妊娠 1终止妊娠 | |
107 | - yunBookbuildingService.updatePregnant(patient, request.getPid()); | |
106 | + //更新状态为过期 | |
107 | + //判断其为增值服务还是 标准服务 | |
108 | + if (patient.getServiceType() == ServiceTypeEnums.STANDARD_SERVICE.getId()) | |
109 | + { | |
110 | + patient.setServiceStatus(ServiceStatusEnums.STANDARD_OVERDUE.getId()); | |
111 | + } | |
112 | + else if (patient.getServiceType() == ServiceTypeEnums.ADD_SERVICE.getId()) | |
113 | + { | |
114 | + patient.setServiceStatus(ServiceStatusEnums.ADD_OVERDUE.getId()); | |
115 | + } | |
116 | + patient.setDueDate(new Date()); | |
117 | + patient.setType(3); | |
118 | + | |
119 | + //分娩状态 0未终止妊娠 1终止妊娠 | |
120 | + yunBookbuildingService.updatePregnant(patient,patient.getId()); | |
121 | + } | |
108 | 122 | } |
109 | 123 | |
124 | + //更新孕妇基本信息为产妇 | |
125 | + PersonModel pmodel = new PersonModel(); | |
126 | + pmodel.setType(3); | |
127 | + pmodel.setModified(new Date()); | |
128 | + | |
129 | + personService.updatePerson(pmodel, request.getPid()); | |
110 | 130 | } |
111 | 131 | |
112 | 132 | StopPregModel model = getStopPregModel(request); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/StopPregRequest.java
View file @
bf494fd