Commit b525560ced57c286847c8684b0b5acf06ae38731
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 3 changed files
- 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 @
b525560
| ... | ... | @@ -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,24 @@ |
| 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 | + if (!StringUtils.isEmpty(params.getId())) { | |
| 58 | + return stopPregnancyFacade.patientIdupdateStopPreg(params); | |
| 59 | + } | |
| 60 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 61 | + return stopPregnancyFacade.patientIdStopPreg(params, loginState.getId()); | |
| 62 | + } | |
| 63 | + | |
| 45 | 64 | |
| 46 | 65 | /** |
| 47 | 66 | * 查询终止妊娠记录 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/StopPregnancyFacade.java
View file @
b525560
| ... | ... | @@ -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 | |
| ... | ... | @@ -142,7 +144,63 @@ |
| 142 | 144 | objectResponse.setErrormsg("成功"); |
| 143 | 145 | return objectResponse; |
| 144 | 146 | } |
| 147 | + public BaseResponse patientIdupdateStopPreg(PatientIdStopPregRequest request) { | |
| 148 | + StopPregModel model = getPatientIdStopPregModel(request); | |
| 149 | + model.setModified(new Date()); | |
| 145 | 150 | |
| 151 | + | |
| 152 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 153 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 154 | +// patientsQuery.setType(3); | |
| 155 | +// patientsQuery.setPid(request.getPid()); | |
| 156 | + patientsQuery.setId(request.getPatientId()); | |
| 157 | + patientsQuery.setDueStatus(1); | |
| 158 | + | |
| 159 | + | |
| 160 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
| 161 | + | |
| 162 | +// matDeliverQuery.setPid(request.getPid()); | |
| 163 | + matDeliverQuery.setParentId(request.getPatientId()); | |
| 164 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
| 165 | + matDeliverQuery.setDueDate(request.getStopDate()); | |
| 166 | + List<MaternalDeliverModel> list2 = matDeliverService.query(matDeliverQuery); | |
| 167 | + | |
| 168 | + StopPregQuery stopPregQuery = new StopPregQuery(); | |
| 169 | + stopPregQuery.setYn(YnEnums.YES.getId()); | |
| 170 | + stopPregQuery.setStopDate(request.getStopDate()); | |
| 171 | +// stopPregQuery.setPid(request.getPid()); | |
| 172 | + stopPregQuery.setPatientId(request.getPatientId()); | |
| 173 | + stopPregQuery.setStopDateStart(DateUtil.parseYMD(request.getStopDate())); | |
| 174 | + stopPregQuery.setStopDateEnd(DateUtil.parseYMDEnd(request.getStopDate())); | |
| 175 | + List<StopPregModel> models = stopPregnancyService.queryStopPreg(stopPregQuery); | |
| 176 | + | |
| 177 | + if (CollectionUtils.isNotEmpty(list2) || CollectionUtils.isNotEmpty(models)) { | |
| 178 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.DATA_EXIST).setErrormsg("同一天只能建一次分娩/终止妊娠"); | |
| 179 | + } | |
| 180 | + | |
| 181 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 182 | + if (CollectionUtils.isNotEmpty(patients)) { | |
| 183 | + Patients patient = patients.get(0); | |
| 184 | + if (patient != null) { | |
| 185 | + patient.setFmDate(DateUtil.parseYMD(request.getStopDate())); | |
| 186 | + yunBookbuildingService.updatePregnant(patient, patient.getId()); | |
| 187 | + //终止妊娠生成追访信息 | |
| 188 | + addTrackDownInfo(patient.getOperator(), patient); | |
| 189 | + } | |
| 190 | + | |
| 191 | + } | |
| 192 | + | |
| 193 | + stopPregnancyService.updateStopPreg(model, request.getId()); | |
| 194 | + | |
| 195 | + /** 终止妊娠后 【未使用的产检券和分娩券】要自动作废 */ | |
| 196 | + couponService.invalid(model.getPid(), "2,4,11"); | |
| 197 | + | |
| 198 | + BaseResponse objectResponse = new BaseResponse(); | |
| 199 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 200 | + objectResponse.setErrormsg("成功"); | |
| 201 | + return objectResponse; | |
| 202 | + } | |
| 203 | + | |
| 146 | 204 | /** |
| 147 | 205 | * 添加终止妊娠 |
| 148 | 206 | * |
| 149 | 207 | |
| ... | ... | @@ -260,7 +318,107 @@ |
| 260 | 318 | objectResponse.setErrormsg("成功"); |
| 261 | 319 | return objectResponse; |
| 262 | 320 | } |
| 321 | + /** | |
| 322 | + * 根据档案id 终止妊娠 | |
| 323 | + * | |
| 324 | + * @param request | |
| 325 | + * @return | |
| 326 | + */ | |
| 327 | + public BaseResponse patientIdStopPreg(PatientIdStopPregRequest request, Integer userId) { | |
| 263 | 328 | |
| 329 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
| 330 | + //获取档案信息不区分产妇还是孕妇 | |
| 331 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 332 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 333 | + patientsQuery.setId(request.getPatientId()); | |
| 334 | + Patients pat = null; | |
| 335 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 336 | + if (CollectionUtils.isNotEmpty(patients)) { | |
| 337 | + | |
| 338 | + //判断是否为重复分娩/终止妊娠 | |
| 339 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
| 340 | + matDeliverQuery.setParentId(request.getPatientId()); | |
| 341 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
| 342 | + matDeliverQuery.setDueDate(request.getStopDate()); | |
| 343 | + List<MaternalDeliverModel> list2 = matDeliverService.query(matDeliverQuery); | |
| 344 | + StopPregQuery stopPregQuery = new StopPregQuery(); | |
| 345 | + stopPregQuery.setYn(YnEnums.YES.getId()); | |
| 346 | + stopPregQuery.setStopDateStart(DateUtil.parseYMD(request.getStopDate())); | |
| 347 | + stopPregQuery.setStopDateEnd(DateUtil.parseYMDEnd(request.getStopDate())); | |
| 348 | + stopPregQuery.setPatientId(request.getPatientId()); | |
| 349 | + List<StopPregModel> models = stopPregnancyService.queryStopPreg(stopPregQuery); | |
| 350 | + if (CollectionUtils.isNotEmpty(list2) || CollectionUtils.isNotEmpty(models)) { | |
| 351 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.DATA_EXIST).setErrormsg("同一天只能建一次分娩/终止妊娠"); | |
| 352 | + } | |
| 353 | + String groupId = groupsFacade.findByCurrentUserId(request.getHospitalId()); | |
| 354 | + List<String> hos = groupsFacade.findGroupHospital(userId, false); | |
| 355 | + | |
| 356 | + Patients patient = patients.get(0); | |
| 357 | + if (patient != null) { | |
| 358 | + //自动分娩档案不更新PersonModel,1孕妇修改 | |
| 359 | + if(patient.getType()!=null && patient.getType()==1){ | |
| 360 | + PersonModel pmodel = new PersonModel(); | |
| 361 | + pmodel.setType(3); | |
| 362 | + pmodel.setModified(new Date()); | |
| 363 | + personService.updatePerson(pmodel, request.getPid()); | |
| 364 | + } | |
| 365 | + | |
| 366 | + String hid = patient.getHospitalId(); | |
| 367 | + if (StringUtils.isNotEmpty(groupId) && CollectionUtils.isNotEmpty(hos) && hos.contains(hospital)) { | |
| 368 | + pat = patient; | |
| 369 | + } else if (StringUtils.isNotEmpty(hid) && hid.equals(request.getHospitalId())) { | |
| 370 | + pat = patient; | |
| 371 | + } | |
| 372 | + patient.setModified(new Date()); | |
| 373 | + //终止妊娠状态 | |
| 374 | + patient.setDueStatus(1); | |
| 375 | + if (patient.getServiceType() != null) { | |
| 376 | + //更新状态为过期 | |
| 377 | + //判断其为增值服务还是 标准服务 | |
| 378 | + if (patient.getServiceType() == ServiceTypeEnums.STANDARD_SERVICE.getId()) { | |
| 379 | + patient.setServiceStatus(ServiceStatusEnums.STANDARD_OVERDUE.getId()); | |
| 380 | + } else if (patient.getServiceType() == ServiceTypeEnums.ADD_SERVICE.getId()) { | |
| 381 | + patient.setServiceStatus(ServiceStatusEnums.ADD_OVERDUE.getId()); | |
| 382 | + } | |
| 383 | + } | |
| 384 | + patient.setFmDate(DateUtil.parseYMD(request.getStopDate())); | |
| 385 | + patient.setType(3); | |
| 386 | + sieveService.deleteSieve(pat.getId(), hospital, pat.getLastMenses()); | |
| 387 | + //分娩状态 0未终止妊娠 1终止妊娠 | |
| 388 | + yunBookbuildingService.updatePregnant(patient, patient.getId()); | |
| 389 | + //终止妊娠生成追访信息 | |
| 390 | + addTrackDownInfo(userId, patient); | |
| 391 | + } | |
| 392 | + } | |
| 393 | + | |
| 394 | + if (pat == null) { | |
| 395 | + BaseResponse objectResponse = new BaseResponse(); | |
| 396 | + objectResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
| 397 | + objectResponse.setErrormsg("数据异常"); | |
| 398 | + return objectResponse; | |
| 399 | + } | |
| 400 | + | |
| 401 | + StopPregModel model = getPatientIdStopPregModel(request); | |
| 402 | + model.setPatientId(pat.getId()); | |
| 403 | + model.setCreated(new Date()); | |
| 404 | + model.setModified(new Date()); | |
| 405 | + | |
| 406 | + stopPregnancyService.addStopPreg(model); | |
| 407 | + operateLogFacade.addAddOptLog(userId, Integer.parseInt(hospital), model, OptActionEnums.ADD.getId(), "添加终止妊娠"); | |
| 408 | + | |
| 409 | + /** 作废产检劵 */ | |
| 410 | + //"11=产筛券",其它地方作废优惠劵没有对产筛卷处理这里先使用一段时间(start20201029) | |
| 411 | + couponService.invalid(pat.getPid(), "2,4,11"); | |
| 412 | + | |
| 413 | + //作废产检劵 | |
| 414 | + patientCheckTicketService.cancelCheckTicket(hospital, pat.getId()); | |
| 415 | + | |
| 416 | + BaseResponse objectResponse = new BaseResponse(); | |
| 417 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 418 | + objectResponse.setErrormsg("成功"); | |
| 419 | + return objectResponse; | |
| 420 | + } | |
| 421 | + | |
| 264 | 422 | /** |
| 265 | 423 | * 初诊、复诊添加或更新追访信息 |
| 266 | 424 | * |
| 267 | 425 | |
| ... | ... | @@ -305,7 +463,18 @@ |
| 305 | 463 | |
| 306 | 464 | return model; |
| 307 | 465 | } |
| 466 | + private StopPregModel getPatientIdStopPregModel(PatientIdStopPregRequest request) { | |
| 467 | + StopPregModel model = new StopPregModel(); | |
| 468 | + model.setPid(request.getPid()); | |
| 469 | + model.setYn(YnEnums.YES.getId()); | |
| 470 | + model.setInPerson(request.getInPerson()); | |
| 471 | + model.setRemark(request.getRemark()); | |
| 472 | + model.setHospitalId(request.getHospitalId()); | |
| 473 | + model.setStopDate(DateUtil.parseYMD(request.getStopDate())); | |
| 474 | + model.setStopReason(JsonUtil.obj2JsonString(request.getStopReason())); | |
| 308 | 475 | |
| 476 | + return model; | |
| 477 | + } | |
| 309 | 478 | |
| 310 | 479 | /** |
| 311 | 480 | * 查询终止妊娠 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PatientIdStopPregRequest.java
View file @
b525560
| 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 | +} |