Commit cd9d78e000883596bc59b994b64ae9f6e09035c3
1 parent
ca62b1eecb
Exists in
master
and in
1 other branch
增加设置parentid
Showing 1 changed file with 32 additions and 10 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
cd9d78e
| ... | ... | @@ -126,13 +126,8 @@ |
| 126 | 126 | userName = patients1.getUsername(); |
| 127 | 127 | if (null != deliverAddRequest.getDueDate()) { |
| 128 | 128 | Date fmDate = DateUtil.parseYMD(deliverAddRequest.getDueDate()); |
| 129 | - Patients patients2=new Patients(); | |
| 130 | - patients2.setFmDate(fmDate); | |
| 131 | - patients2.setType(3); | |
| 132 | - PatientsQuery patientsQuery1=new PatientsQuery(); | |
| 133 | - patientsQuery1.setPid(patients1.getPid()); | |
| 134 | - patientsQuery1.setYn(YnEnums.YES.getId()); | |
| 135 | - patientsService.findAndModify(patientsQuery1,patients2); | |
| 129 | + //修改分娩日期 | |
| 130 | + updatePatientFmDate(patients1.getPid(),fmDate); | |
| 136 | 131 | //修改person表状态为产妇 |
| 137 | 132 | if (StringUtils.isNotEmpty(patients1.getPid())) { |
| 138 | 133 | PersonModel personModel = new PersonModel(); |
| 139 | 134 | |
| 140 | 135 | |
| ... | ... | @@ -192,16 +187,21 @@ |
| 192 | 187 | Date fmDate = DateUtil.parseYMD(deliverAddRequest.getDueDate()); |
| 193 | 188 | PatientsQuery patientsQuery = new PatientsQuery(); |
| 194 | 189 | patientsQuery.setId(deliverAddRequest.getParentId()); |
| 195 | - List<Patients> patients = patientsService.queryPatient(patientsQuery); | |
| 196 | - if (CollectionUtils.isNotEmpty(patients)) { | |
| 190 | + Patients patients = patientsService.findOnePatientById(deliverAddRequest.getParentId()); | |
| 191 | + //修改分娩日期 | |
| 192 | + updatePatientFmDate(patients.getPid(),fmDate); | |
| 193 | + /* if (CollectionUtils.isNotEmpty(patients)) { | |
| 194 | + if(fmDate.after(DateUtil.addDay(patients.get(0).getLastMenses(),168))){ | |
| 197 | 195 | Patients patients2=new Patients(); |
| 198 | 196 | patients2.setFmDate(fmDate); |
| 199 | 197 | patients2.setType(3); |
| 200 | 198 | PatientsQuery patientsQuery1=new PatientsQuery(); |
| 201 | 199 | patientsQuery1.setPid(patients.get(0).getPid()); |
| 202 | 200 | patientsQuery1.setYn(YnEnums.YES.getId()); |
| 201 | + patientsQuery1.setLastMensesStart(); | |
| 203 | 202 | patientsService.findAndModify(patientsQuery1, patients2); |
| 204 | 203 | } |
| 204 | + }*/ | |
| 205 | 205 | } |
| 206 | 206 | } else { |
| 207 | 207 | return new BaseResponse().setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("parentId 为空,找不到产妇"); |
| ... | ... | @@ -209,6 +209,28 @@ |
| 209 | 209 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | + /** | |
| 213 | + * 修改建档记录的分娩时间和 | |
| 214 | + * @param pid | |
| 215 | + * @param fmDate | |
| 216 | + */ | |
| 217 | + private void updatePatientFmDate(String pid,Date fmDate){ | |
| 218 | + PatientsQuery patientsQuery=new PatientsQuery(); | |
| 219 | + patientsQuery.setPid(pid); | |
| 220 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 221 | + patientsQuery.setType(1); | |
| 222 | + List<Patients> patientsList = patientsService.queryPatient(patientsQuery); | |
| 223 | + for(Patients patients:patientsList){ | |
| 224 | + //判断分娩日期是否大于24孕周 | |
| 225 | + if(fmDate.after(DateUtil.addDay(patients.getLastMenses(), 168))){ | |
| 226 | + patients.setFmDate(fmDate); | |
| 227 | + patients.setType(3); | |
| 228 | + patientsService.updatePatient(patients); | |
| 229 | + } | |
| 230 | + } | |
| 231 | + } | |
| 232 | + | |
| 233 | + | |
| 212 | 234 | private BabyModel fillBaby(Patients patients) { |
| 213 | 235 | BabyModel babyModel = new BabyModel(); |
| 214 | 236 | if (null != patients) { |
| ... | ... | @@ -415,7 +437,7 @@ |
| 415 | 437 | return new BaseResponse().setErrormsg("该孕妇还未在本院建档不能进行分娩").setErrorcode(ErrorCodeConstants.NO_DATA); |
| 416 | 438 | } |
| 417 | 439 | int days = DateUtil.daysBetween(patients.getLastMenses(), new Date());; |
| 418 | - if(days<168){ | |
| 440 | + if(days<168 && patients.getFmDate()!=null){ | |
| 419 | 441 | return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR1).setErrormsg("该孕妇不能分娩."); |
| 420 | 442 | } |
| 421 | 443 |