Commit 961fca25d448bc324e9e7dead2b45bbeb136e297
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 3 changed files
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyCheckController.java
View file @
961fca2
| ... | ... | @@ -2,7 +2,9 @@ |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | import com.lyms.platform.biz.service.BabyCheckService; |
| 5 | +import com.lyms.platform.common.annotation.TokenRequired; | |
| 5 | 6 | import com.lyms.platform.common.base.BaseController; |
| 7 | +import com.lyms.platform.common.base.LoginContext; | |
| 6 | 8 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 7 | 9 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 8 | 10 | import com.lyms.platform.common.result.BaseResponse; |
| ... | ... | @@ -13,6 +15,7 @@ |
| 13 | 15 | import org.springframework.stereotype.Controller; |
| 14 | 16 | import org.springframework.web.bind.annotation.*; |
| 15 | 17 | |
| 18 | +import javax.servlet.http.HttpServletRequest; | |
| 16 | 19 | import javax.validation.Valid; |
| 17 | 20 | |
| 18 | 21 | |
| ... | ... | @@ -87,8 +90,10 @@ |
| 87 | 90 | */ |
| 88 | 91 | @RequestMapping(value = "/queryChooseBabys", method = RequestMethod.GET) |
| 89 | 92 | @ResponseBody |
| 90 | - public BaseObjectResponse queryChooseBabys(@RequestParam(required = false)String vcCardNo,@RequestParam(required = false)String cardNo){ | |
| 91 | - return babyCheckFacade.queryChooseBabys(vcCardNo, cardNo); | |
| 93 | + @TokenRequired | |
| 94 | + public BaseObjectResponse queryChooseBabys(HttpServletRequest request,@RequestParam(required = false)String vcCardNo,@RequestParam(required = false)String cardNo){ | |
| 95 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 96 | + return babyCheckFacade.queryChooseBabys(vcCardNo, cardNo,loginState.getId()); | |
| 92 | 97 | } |
| 93 | 98 | |
| 94 | 99 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
961fca2
| ... | ... | @@ -14,6 +14,8 @@ |
| 14 | 14 | import com.lyms.platform.operate.web.result.BabyCheckResult; |
| 15 | 15 | import com.lyms.platform.operate.web.result.BabyChooseResult; |
| 16 | 16 | import com.lyms.platform.operate.web.result.BasicConfigResult; |
| 17 | +import com.lyms.platform.permission.model.Users; | |
| 18 | +import com.lyms.platform.permission.service.UsersService; | |
| 17 | 19 | import com.lyms.platform.pojo.*; |
| 18 | 20 | import com.lyms.platform.query.*; |
| 19 | 21 | import org.apache.commons.collections.CollectionUtils; |
| ... | ... | @@ -45,6 +47,9 @@ |
| 45 | 47 | @Autowired |
| 46 | 48 | private AntenatalExaminationFacade antenatalExaminationFacade; |
| 47 | 49 | |
| 50 | + | |
| 51 | + @Autowired | |
| 52 | + private UsersService usersService; | |
| 48 | 53 | /** |
| 49 | 54 | * 更新检查 |
| 50 | 55 | * |
| 51 | 56 | |
| 52 | 57 | |
| ... | ... | @@ -363,10 +368,24 @@ |
| 363 | 368 | * @param cardNo |
| 364 | 369 | * @return |
| 365 | 370 | */ |
| 366 | - public BaseObjectResponse queryChooseBabys(String vcCardNo, String cardNo) { | |
| 371 | + public BaseObjectResponse queryChooseBabys(String vcCardNo, String cardNo,Integer userId) { | |
| 367 | 372 | |
| 368 | - BaseObjectResponse br = new BaseObjectResponse(); | |
| 369 | 373 | |
| 374 | + Map map = new HashMap(); | |
| 375 | + | |
| 376 | + String hospitalId = ""; | |
| 377 | + | |
| 378 | + //得到当前登录的医院id | |
| 379 | + if (userId != null) | |
| 380 | + { | |
| 381 | + Users dbuser = usersService.getUsers(userId); | |
| 382 | + if (dbuser != null) { | |
| 383 | + hospitalId = String.valueOf(dbuser.getOrgId()); | |
| 384 | + } | |
| 385 | + } | |
| 386 | + | |
| 387 | + BaseObjectResponse br = new BaseObjectResponse(); | |
| 388 | + boolean isBuild = false; | |
| 370 | 389 | List<BabyChooseResult> results = new ArrayList<>(); |
| 371 | 390 | |
| 372 | 391 | if (!StringUtils.isEmpty(vcCardNo) || !StringUtils.isEmpty(cardNo)) { |
| ... | ... | @@ -377,7 +396,10 @@ |
| 377 | 396 | |
| 378 | 397 | List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); |
| 379 | 398 | for (BabyModel model : models) { |
| 380 | - | |
| 399 | + if (model != null && model.getHospitalId() != null && model.getHospitalId().equals(hospitalId)) | |
| 400 | + { | |
| 401 | + isBuild = true; | |
| 402 | + } | |
| 381 | 403 | BabyChooseResult result = new BabyChooseResult(); |
| 382 | 404 | result.setId(model.getId()); |
| 383 | 405 | result.setMonthAge(DateUtil.getBabyMonthAge(model.getBirth(), new Date())); |
| 384 | 406 | |
| ... | ... | @@ -386,10 +408,10 @@ |
| 386 | 408 | result.setBirth(DateUtil.getyyyy_MM_dd(model.getBirth())); |
| 387 | 409 | results.add(result); |
| 388 | 410 | } |
| 389 | - | |
| 390 | 411 | } |
| 391 | - | |
| 392 | - br.setData(results); | |
| 412 | + map.put("isBuild",isBuild); | |
| 413 | + map.put("boies",results); | |
| 414 | + br.setData(map); | |
| 393 | 415 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 394 | 416 | br.setErrormsg("成功"); |
| 395 | 417 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
961fca2
| ... | ... | @@ -97,6 +97,18 @@ |
| 97 | 97 | return br; |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | + | |
| 101 | + Integer type = 1; //1孕妇 2儿童 3产妇 | |
| 102 | + if (yunRequest.getLastMenstrualPeriod() != null) | |
| 103 | + { | |
| 104 | + Date date = DateUtil.addWeek(DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()),42); | |
| 105 | + Date currentDate = DateUtil.formatDate(new Date()); | |
| 106 | + if (date.getTime() >= currentDate.getTime()) | |
| 107 | + { | |
| 108 | + type = 3; | |
| 109 | + } | |
| 110 | + } | |
| 111 | + | |
| 100 | 112 | PersonModel resperson = null; |
| 101 | 113 | if (yunRequest.getPregnantPhone() != null || yunRequest.getPregnantCertificateNum() != null) |
| 102 | 114 | { |
| ... | ... | @@ -120,7 +132,7 @@ |
| 120 | 132 | pmodel.setBirth(DateUtil.parseYMD(yunRequest.getBirthday())); |
| 121 | 133 | pmodel.setPhone(yunRequest.getPregnantPhone()); |
| 122 | 134 | pmodel.setCardNo(yunRequest.getPregnantCertificateNum()); |
| 123 | - pmodel.setType(1); | |
| 135 | + pmodel.setType(type); | |
| 124 | 136 | pmodel.setModified(new Date()); |
| 125 | 137 | if (CollectionUtils.isNotEmpty(personModels) && personModels.get(0) != null) |
| 126 | 138 | { |
| ... | ... | @@ -137,6 +149,7 @@ |
| 137 | 149 | } |
| 138 | 150 | |
| 139 | 151 | Patients patient = getPatientsData(yunRequest); |
| 152 | + patient.setType(type); | |
| 140 | 153 | if (resperson != null) |
| 141 | 154 | { |
| 142 | 155 | patient.setPid(resperson.getId()); |