Commit fac50ac3db707ce6c31c5e5e761b2a568999e38d
1 parent
047344b7f9
Exists in
master
and in
6 other branches
根据档案id 终止妊娠
Showing 3 changed files with 237 additions and 0 deletions
- 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/StopPregnancyFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PatientIdStopPregRequest.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StopPregnancyController.java
View file @
fac50ac
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | import com.lyms.platform.common.result.BaseResponse; |
7 | 7 | import com.lyms.platform.common.utils.StringUtils; |
8 | 8 | import com.lyms.platform.operate.web.facade.StopPregnancyFacade; |
9 | +import com.lyms.platform.operate.web.request.PatientIdStopPregRequest; | |
9 | 10 | import com.lyms.platform.operate.web.request.StopPregRequest; |
10 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
11 | 12 | import org.springframework.stereotype.Controller; |
... | ... | @@ -42,6 +43,21 @@ |
42 | 43 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
43 | 44 | return stopPregnancyFacade.addStopPreg(params, loginState.getId()); |
44 | 45 | } |
46 | + | |
47 | + /** | |
48 | + * 根据档案id 终止妊娠 | |
49 | + * | |
50 | + * @param request | |
51 | + * @return | |
52 | + */ | |
53 | + @RequestMapping(method = RequestMethod.POST, value = "/patientIdStopPreg") | |
54 | + @ResponseBody | |
55 | + @TokenRequired | |
56 | + public BaseResponse patientIdStopPreg(@Valid @RequestBody PatientIdStopPregRequest params, HttpServletRequest request) { | |
57 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
58 | + return stopPregnancyFacade.patientIdStopPreg(params, loginState.getId()); | |
59 | + } | |
60 | + | |
45 | 61 | |
46 | 62 | /** |
47 | 63 | * 查询终止妊娠记录 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/StopPregnancyFacade.java
View file @
fac50ac
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | import com.lyms.platform.common.utils.DateUtil; |
9 | 9 | import com.lyms.platform.common.utils.JsonUtil; |
10 | 10 | import com.lyms.platform.common.utils.StringUtils; |
11 | +import com.lyms.platform.operate.web.request.PatientIdStopPregRequest; | |
11 | 12 | import com.lyms.platform.operate.web.request.StopPregRequest; |
12 | 13 | import com.lyms.platform.operate.web.result.AntexListResult; |
13 | 14 | import com.lyms.platform.operate.web.result.StopPregResult; |
... | ... | @@ -27,6 +28,7 @@ |
27 | 28 | import org.springframework.data.mongodb.core.query.Query; |
28 | 29 | import org.springframework.stereotype.Component; |
29 | 30 | |
31 | +import javax.rmi.CORBA.Util; | |
30 | 32 | import java.util.*; |
31 | 33 | |
32 | 34 | /** |
33 | 35 | |
... | ... | @@ -260,7 +262,107 @@ |
260 | 262 | objectResponse.setErrormsg("成功"); |
261 | 263 | return objectResponse; |
262 | 264 | } |
265 | + /** | |
266 | + * 根据档案id 终止妊娠 | |
267 | + * | |
268 | + * @param request | |
269 | + * @return | |
270 | + */ | |
271 | + public BaseResponse patientIdStopPreg(PatientIdStopPregRequest request, Integer userId) { | |
263 | 272 | |
273 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
274 | + //获取档案信息不区分产妇还是孕妇 | |
275 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
276 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
277 | + patientsQuery.setId(request.getPatientId()); | |
278 | + Patients pat = null; | |
279 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
280 | + if (CollectionUtils.isNotEmpty(patients)) { | |
281 | + | |
282 | + //判断是否为重复分娩/终止妊娠 | |
283 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
284 | + matDeliverQuery.setParentId(request.getPatientId()); | |
285 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
286 | + matDeliverQuery.setDueDate(request.getStopDate()); | |
287 | + List<MaternalDeliverModel> list2 = matDeliverService.query(matDeliverQuery); | |
288 | + StopPregQuery stopPregQuery = new StopPregQuery(); | |
289 | + stopPregQuery.setYn(YnEnums.YES.getId()); | |
290 | + stopPregQuery.setStopDateStart(DateUtil.parseYMD(request.getStopDate())); | |
291 | + stopPregQuery.setStopDateEnd(DateUtil.parseYMDEnd(request.getStopDate())); | |
292 | + stopPregQuery.setPatientId(request.getPatientId()); | |
293 | + List<StopPregModel> models = stopPregnancyService.queryStopPreg(stopPregQuery); | |
294 | + if (CollectionUtils.isNotEmpty(list2) || CollectionUtils.isNotEmpty(models)) { | |
295 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.DATA_EXIST).setErrormsg("同一天只能建一次分娩/终止妊娠"); | |
296 | + } | |
297 | + String groupId = groupsFacade.findByCurrentUserId(request.getHospitalId()); | |
298 | + List<String> hos = groupsFacade.findGroupHospital(userId, false); | |
299 | + | |
300 | + Patients patient = patients.get(0); | |
301 | + if (patient != null) { | |
302 | + //自动分娩档案不更新PersonModel,1孕妇修改 | |
303 | + if(patient.getType()!=null && patient.getType()==1){ | |
304 | + PersonModel pmodel = new PersonModel(); | |
305 | + pmodel.setType(3); | |
306 | + pmodel.setModified(new Date()); | |
307 | + personService.updatePerson(pmodel, request.getPid()); | |
308 | + } | |
309 | + | |
310 | + String hid = patient.getHospitalId(); | |
311 | + if (StringUtils.isNotEmpty(groupId) && CollectionUtils.isNotEmpty(hos) && hos.contains(hospital)) { | |
312 | + pat = patient; | |
313 | + } else if (StringUtils.isNotEmpty(hid) && hid.equals(request.getHospitalId())) { | |
314 | + pat = patient; | |
315 | + } | |
316 | + patient.setModified(new Date()); | |
317 | + //终止妊娠状态 | |
318 | + patient.setDueStatus(1); | |
319 | + if (patient.getServiceType() != null) { | |
320 | + //更新状态为过期 | |
321 | + //判断其为增值服务还是 标准服务 | |
322 | + if (patient.getServiceType() == ServiceTypeEnums.STANDARD_SERVICE.getId()) { | |
323 | + patient.setServiceStatus(ServiceStatusEnums.STANDARD_OVERDUE.getId()); | |
324 | + } else if (patient.getServiceType() == ServiceTypeEnums.ADD_SERVICE.getId()) { | |
325 | + patient.setServiceStatus(ServiceStatusEnums.ADD_OVERDUE.getId()); | |
326 | + } | |
327 | + } | |
328 | + patient.setFmDate(DateUtil.parseYMD(request.getStopDate())); | |
329 | + patient.setType(3); | |
330 | + sieveService.deleteSieve(pat.getId(), hospital, pat.getLastMenses()); | |
331 | + //分娩状态 0未终止妊娠 1终止妊娠 | |
332 | + yunBookbuildingService.updatePregnant(patient, patient.getId()); | |
333 | + //终止妊娠生成追访信息 | |
334 | + addTrackDownInfo(userId, patient); | |
335 | + } | |
336 | + } | |
337 | + | |
338 | + if (pat == null) { | |
339 | + BaseResponse objectResponse = new BaseResponse(); | |
340 | + objectResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
341 | + objectResponse.setErrormsg("数据异常"); | |
342 | + return objectResponse; | |
343 | + } | |
344 | + | |
345 | + StopPregModel model = getPatientIdStopPregModel(request); | |
346 | + model.setPatientId(pat.getId()); | |
347 | + model.setCreated(new Date()); | |
348 | + model.setModified(new Date()); | |
349 | + | |
350 | + stopPregnancyService.addStopPreg(model); | |
351 | + operateLogFacade.addAddOptLog(userId, Integer.parseInt(hospital), model, OptActionEnums.ADD.getId(), "添加终止妊娠"); | |
352 | + | |
353 | + /** 作废产检劵 */ | |
354 | + //"11=产筛券",其它地方作废优惠劵没有对产筛卷处理这里先使用一段时间(start20201029) | |
355 | + couponService.invalid(pat.getPid(), "2,4,11"); | |
356 | + | |
357 | + //作废产检劵 | |
358 | + patientCheckTicketService.cancelCheckTicket(hospital, pat.getId()); | |
359 | + | |
360 | + BaseResponse objectResponse = new BaseResponse(); | |
361 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
362 | + objectResponse.setErrormsg("成功"); | |
363 | + return objectResponse; | |
364 | + } | |
365 | + | |
264 | 366 | /** |
265 | 367 | * 初诊、复诊添加或更新追访信息 |
266 | 368 | * |
267 | 369 | |
... | ... | @@ -305,7 +407,18 @@ |
305 | 407 | |
306 | 408 | return model; |
307 | 409 | } |
410 | + private StopPregModel getPatientIdStopPregModel(PatientIdStopPregRequest request) { | |
411 | + StopPregModel model = new StopPregModel(); | |
412 | + model.setPid(request.getPid()); | |
413 | + model.setYn(YnEnums.YES.getId()); | |
414 | + model.setInPerson(request.getInPerson()); | |
415 | + model.setRemark(request.getRemark()); | |
416 | + model.setHospitalId(request.getHospitalId()); | |
417 | + model.setStopDate(DateUtil.parseYMD(request.getStopDate())); | |
418 | + model.setStopReason(JsonUtil.obj2JsonString(request.getStopReason())); | |
308 | 419 | |
420 | + return model; | |
421 | + } | |
309 | 422 | |
310 | 423 | /** |
311 | 424 | * 查询终止妊娠 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PatientIdStopPregRequest.java
View file @
fac50ac
1 | +package com.lyms.platform.operate.web.request; | |
2 | + | |
3 | +import com.lyms.platform.common.core.annotation.form.FormParam; | |
4 | +import org.hibernate.validator.constraints.NotEmpty; | |
5 | + | |
6 | +import java.util.Map; | |
7 | + | |
8 | +/** | |
9 | + * 自动分娩使用,终止妊娠对象 | |
10 | + * | |
11 | + * @Author: 武涛涛 | |
12 | + * @Date: 2020/10/29 15:29 | |
13 | + */ | |
14 | +public class PatientIdStopPregRequest { | |
15 | + private String id; | |
16 | + //孕妇建档基本信息ID | |
17 | + private String pid; | |
18 | + | |
19 | + //档案id | |
20 | + @FormParam | |
21 | + @NotEmpty(message = "patientId不能为空.") | |
22 | + private String patientId; | |
23 | + | |
24 | + | |
25 | + //终止原因 | |
26 | + private Map stopReason; | |
27 | + | |
28 | + //备注 | |
29 | + private String remark; | |
30 | + | |
31 | + //终止妊娠日期 | |
32 | + @FormParam | |
33 | + @NotEmpty(message = "终止妊娠日期不能为空.") | |
34 | + private String stopDate; | |
35 | + | |
36 | + //录入人 | |
37 | + @FormParam | |
38 | + @NotEmpty(message = "录入人不能为空.") | |
39 | + private String inPerson; | |
40 | + | |
41 | + //医院ID | |
42 | + @FormParam | |
43 | + private String hospitalId; | |
44 | + | |
45 | + public String getId() { | |
46 | + return id; | |
47 | + } | |
48 | + | |
49 | + public String getPatientId() { | |
50 | + return patientId; | |
51 | + } | |
52 | + | |
53 | + public void setPatientId(String patientId) { | |
54 | + this.patientId = patientId; | |
55 | + } | |
56 | + | |
57 | + public void setId(String id) { | |
58 | + this.id = id; | |
59 | + } | |
60 | + | |
61 | + public String getPid() { | |
62 | + return pid; | |
63 | + } | |
64 | + | |
65 | + public void setPid(String pid) { | |
66 | + this.pid = pid; | |
67 | + } | |
68 | + | |
69 | + public Map getStopReason() { | |
70 | + return stopReason; | |
71 | + } | |
72 | + | |
73 | + public void setStopReason(Map stopReason) { | |
74 | + this.stopReason = stopReason; | |
75 | + } | |
76 | + | |
77 | + public String getRemark() { | |
78 | + return remark; | |
79 | + } | |
80 | + | |
81 | + public void setRemark(String remark) { | |
82 | + this.remark = remark; | |
83 | + } | |
84 | + | |
85 | + public String getStopDate() { | |
86 | + return stopDate; | |
87 | + } | |
88 | + | |
89 | + public void setStopDate(String stopDate) { | |
90 | + this.stopDate = stopDate; | |
91 | + } | |
92 | + | |
93 | + public String getInPerson() { | |
94 | + return inPerson; | |
95 | + } | |
96 | + | |
97 | + public void setInPerson(String inPerson) { | |
98 | + this.inPerson = inPerson; | |
99 | + } | |
100 | + | |
101 | + public String getHospitalId() { | |
102 | + return hospitalId; | |
103 | + } | |
104 | + | |
105 | + public void setHospitalId(String hospitalId) { | |
106 | + this.hospitalId = hospitalId; | |
107 | + } | |
108 | +} |