From 95b1d95a78b1068ec7d9b72f196e72eb7ded9ac0 Mon Sep 17 00:00:00 2001 From: liquanyu Date: Tue, 23 Aug 2016 16:59:11 +0800 Subject: [PATCH] code update --- .../web/controller/BookbuildingController.java | 4 +- .../operate/web/facade/BookbuildingFacade.java | 61 +++++++++++++++++++++- 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java index b653bf3..d28410f 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java @@ -52,8 +52,8 @@ public class BookbuildingController extends BaseController{ public BaseResponse addOrUpdateYunBuild(@RequestBody YunBookbuildingAddRequest yunBookbuildingAddRequest) { if (yunBookbuildingAddRequest != null && !StringUtils.isEmpty(yunBookbuildingAddRequest.getId()) ) { - bookbuildingFacade.updatePregnantById(yunBookbuildingAddRequest.getId(), yunBookbuildingAddRequest); - return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); + return bookbuildingFacade.updatePregnantById(yunBookbuildingAddRequest.getId(), yunBookbuildingAddRequest); + } BaseObjectResponse p = bookbuildingFacade.addPregnantBookbuilding(yunBookbuildingAddRequest); return p; diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java index 9682a83..5127e51 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java @@ -116,6 +116,10 @@ public class BookbuildingFacade { //就诊卡号判断 if (StringUtils.isNotEmpty(yunRequest.getVcCardNo())) { + patientsQuery.setCardNo(null); + patientsQuery.setBuildTypeEq(null); + patientsQuery.setDueStatus(null); + patientsQuery.setPhone(null); patientsQuery.setVcCardNo(yunRequest.getVcCardNo()); patientsQuery.setHospitalId(yunRequest.getHospitalId()); List patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); @@ -345,7 +349,60 @@ public class BookbuildingFacade { * @param id * @param yunRequest */ - public void updatePregnantById(String id, YunBookbuildingAddRequest yunRequest) { + public BaseResponse updatePregnantById(String id, YunBookbuildingAddRequest yunRequest) { + + + BaseResponse br = new BaseResponse(); + PatientsQuery patientsQuery = new PatientsQuery(); + patientsQuery.setYn(YnEnums.YES.getId()); + patientsQuery.setType(1); + patientsQuery.setHospitalId(yunRequest.getHospitalId()); + patientsQuery.setBuildTypeEq(0); + patientsQuery.setDueStatus(0); + + if (yunRequest.getPregnantCertificateNum() != null) + { + patientsQuery.setCardNo(yunRequest.getPregnantCertificateNum()); + //判断该身份证号码是否有孕妇建档 在该医院 + List patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); + if (CollectionUtils.isNotEmpty(patients)) + { + br.setErrorcode(ErrorCodeConstants.DATA_EXIST); + br.setErrormsg("该身份证在医院已经建档"); + return br; + } + } + if (yunRequest.getPregnantPhone() != null) + { + patientsQuery.setCardNo(null); + patientsQuery.setPhone(yunRequest.getPregnantPhone()); + //判断该手机号码在 孕期内有没有建档 + List patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); + if (CollectionUtils.isNotEmpty(patients)) + { + br.setErrorcode(ErrorCodeConstants.DATA_EXIST); + br.setErrormsg("该手机号码已经建档"); + return br; + } + } + + //就诊卡号判断 + if (StringUtils.isNotEmpty(yunRequest.getVcCardNo())) + { + patientsQuery.setCardNo(null); + patientsQuery.setBuildTypeEq(null); + patientsQuery.setDueStatus(null); + patientsQuery.setPhone(null); + patientsQuery.setVcCardNo(yunRequest.getVcCardNo()); + patientsQuery.setHospitalId(yunRequest.getHospitalId()); + List patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); + if (CollectionUtils.isNotEmpty(patients)) + { + br.setErrorcode(ErrorCodeConstants.DATA_EXIST); + br.setErrormsg("该就诊卡号在该医院已经建档"); + return br; + } + } Patients patient = getPatientsData(yunRequest); patient.setModified(new Date()); @@ -365,6 +422,8 @@ public class BookbuildingFacade { //加入产筛 patientsService.validata(patient); yunBookbuildingService.updatePregnant(patient, id); + + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); } /** -- 1.8.3.1