Commit 40405fa5423ecef0f0c64cfc3c9da0b831f01586
1 parent
0ce7b4d8c3
Exists in
master
and in
1 other branch
孕妇分娩后 变成产妇
Showing 1 changed file with 31 additions and 26 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
40405fa
| ... | ... | @@ -6,7 +6,6 @@ |
| 6 | 6 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 7 | 7 | import com.lyms.platform.common.result.BaseResponse; |
| 8 | 8 | import com.lyms.platform.common.utils.DateUtil; |
| 9 | -import com.lyms.platform.common.utils.JsonUtil; | |
| 10 | 9 | import com.lyms.platform.operate.web.request.MatDeliverAddRequest; |
| 11 | 10 | import com.lyms.platform.operate.web.request.MatDeliverQueryRequest; |
| 12 | 11 | import com.lyms.platform.operate.web.result.HighScoreResult; |
| ... | ... | @@ -15,10 +14,7 @@ |
| 15 | 14 | import com.lyms.platform.permission.model.Organization; |
| 16 | 15 | import com.lyms.platform.permission.service.OrganizationService; |
| 17 | 16 | import com.lyms.platform.pojo.*; |
| 18 | -import com.lyms.platform.query.AntExChuQuery; | |
| 19 | -import com.lyms.platform.query.AntExQuery; | |
| 20 | -import com.lyms.platform.query.MatDeliverQuery; | |
| 21 | -import com.lyms.platform.query.PatientsQuery; | |
| 17 | +import com.lyms.platform.query.*; | |
| 22 | 18 | import org.apache.commons.collections.CollectionUtils; |
| 23 | 19 | import org.apache.commons.lang.StringUtils; |
| 24 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | 21 | |
| ... | ... | @@ -62,11 +58,11 @@ |
| 62 | 58 | List<MaternalDeliverModel.Baby> babyList = new ArrayList<>(); |
| 63 | 59 | //增加 |
| 64 | 60 | if (StringUtils.isEmpty(deliverAddRequest.getId()) && StringUtils.isNotEmpty(deliverAddRequest.getParentId())) { |
| 65 | - MatDeliverQuery matDeliverQuery=new MatDeliverQuery(); | |
| 61 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
| 66 | 62 | matDeliverQuery.setParentId(deliverAddRequest.getParentId()); |
| 67 | 63 | matDeliverQuery.setYn(YnEnums.YES.getId()); |
| 68 | - List<MaternalDeliverModel> list2= matDeliverService.query(matDeliverQuery); | |
| 69 | - if(CollectionUtils.isNotEmpty(list2)){ | |
| 64 | + List<MaternalDeliverModel> list2 = matDeliverService.query(matDeliverQuery); | |
| 65 | + if (CollectionUtils.isNotEmpty(list2)) { | |
| 70 | 66 | return new BaseResponse().setErrormsg("您已分娩").setErrorcode(ErrorCodeConstants.DATA_EXIST); |
| 71 | 67 | } |
| 72 | 68 | MaternalDeliverModel maternalDeliverModel = deliverAddRequest.convertToDataModel(); |
| ... | ... | @@ -78,7 +74,7 @@ |
| 78 | 74 | patientsQuery.setId(parentId); |
| 79 | 75 | List<Patients> patients = patientsService.queryPatient(patientsQuery); |
| 80 | 76 | Patients patients1 = null; |
| 81 | - if (CollectionUtils.isNotEmpty(patients)){ | |
| 77 | + if (CollectionUtils.isNotEmpty(patients)) { | |
| 82 | 78 | maternalDeliverModel.setPid(patients.get(0).getPid()); |
| 83 | 79 | } |
| 84 | 80 | if (CollectionUtils.isNotEmpty(list)) { |
| ... | ... | @@ -101,8 +97,17 @@ |
| 101 | 97 | } |
| 102 | 98 | } |
| 103 | 99 | } |
| 104 | - | |
| 105 | - handBaby(deliverAddRequest, babyList, maternalDeliverModel, list, babyIds, parentId, userName,patients1); | |
| 100 | + //先查询这个产妇分娩的小孩是否已建档 | |
| 101 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 102 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
| 103 | + babyModelQuery.setMcertNo(patients1.getCardNo()); | |
| 104 | + babyModelQuery.setParentId(patients1.getId()); | |
| 105 | + babyModelQuery.setBirthEnd(patients1.getFmDate()); | |
| 106 | + List<BabyModel> babyModels = babyService.queryBabyWithQuery(babyModelQuery); | |
| 107 | + if (CollectionUtils.isEmpty(babyModels)) { | |
| 108 | + handBaby(deliverAddRequest, babyList, maternalDeliverModel, list, babyIds, parentId, userName, patients1); | |
| 109 | + } | |
| 110 | +// maternalDeliverModel.setBaby(babyModels); | |
| 106 | 111 | } |
| 107 | 112 | List list1 = autoMatchFacade.matchOrgId(userId); |
| 108 | 113 | if (CollectionUtils.isNotEmpty(list1)) { |
| ... | ... | @@ -144,9 +149,9 @@ |
| 144 | 149 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
| 145 | 150 | } |
| 146 | 151 | |
| 147 | - private BabyModel fillBaby(Patients patients){ | |
| 148 | - BabyModel babyModel=new BabyModel(); | |
| 149 | - if(null!=patients){ | |
| 152 | + private BabyModel fillBaby(Patients patients) { | |
| 153 | + BabyModel babyModel = new BabyModel(); | |
| 154 | + if (null != patients) { | |
| 150 | 155 | babyModel.setAreaId(patients.getAreaId()); |
| 151 | 156 | babyModel.setProvinceId(patients.getProvinceId()); |
| 152 | 157 | babyModel.setCityId(patients.getCityId()); |
| ... | ... | @@ -178,6 +183,7 @@ |
| 178 | 183 | // babyModel.setFbirth(patients.geth); |
| 179 | 184 | return babyModel; |
| 180 | 185 | } |
| 186 | + | |
| 181 | 187 | /** |
| 182 | 188 | * 处理儿童 |
| 183 | 189 | * |
| ... | ... | @@ -189,7 +195,7 @@ |
| 189 | 195 | * @param parentId |
| 190 | 196 | * @param userName |
| 191 | 197 | */ |
| 192 | - private void handBaby(MatDeliverAddRequest deliverAddRequest, List<MaternalDeliverModel.Baby> babyList, MaternalDeliverModel maternalDeliverModel, List<MatDeliverAddRequest.Baby> list, List<String> babyIds, String parentId, String userName,Patients patients) { | |
| 198 | + private void handBaby(MatDeliverAddRequest deliverAddRequest, List<MaternalDeliverModel.Baby> babyList, MaternalDeliverModel maternalDeliverModel, List<MatDeliverAddRequest.Baby> list, List<String> babyIds, String parentId, String userName, Patients patients) { | |
| 193 | 199 | for (MatDeliverAddRequest.Baby baby : list) { |
| 194 | 200 | MaternalDeliverModel.Baby baby1 = baby.convertToDataModel(); |
| 195 | 201 | babyList.add(baby1); |
| ... | ... | @@ -201,7 +207,7 @@ |
| 201 | 207 | babyModel.setYn(YnEnums.YES.getId()); |
| 202 | 208 | babyModel.setVisitstatus(VisitStatusEnums.UNVISIT.getId()); |
| 203 | 209 | babyModel.setAsphyxiaM(baby1.getAsphyxiaM()); |
| 204 | - babyModel.setFetusCount(deliverAddRequest.getTireNumber()+""); | |
| 210 | + babyModel.setFetusCount(deliverAddRequest.getTireNumber() + ""); | |
| 205 | 211 | if (null != baby1.getBabyGender()) { |
| 206 | 212 | babyModel.setSex(Integer.valueOf(baby1.getBabyGender())); |
| 207 | 213 | } |
| ... | ... | @@ -226,8 +232,7 @@ |
| 226 | 232 | DateUtil.getYmd(DateUtil.parseYMD(deliverAddRequest.getDueDate())); |
| 227 | 233 | babyModel.setCardId(cardId + babyModel.getName()); |
| 228 | 234 | } |
| 229 | - if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(babyModel.getMphone())) | |
| 230 | - { | |
| 235 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(babyModel.getMphone())) { | |
| 231 | 236 | String phoneId = babyModel.getMphone() + |
| 232 | 237 | DateUtil.getYmd(DateUtil.parseYMD(deliverAddRequest.getDueDate())); |
| 233 | 238 | babyModel.setPhoneId(phoneId + babyModel.getName()); |
| 234 | 239 | |
| ... | ... | @@ -257,14 +262,14 @@ |
| 257 | 262 | * @param deliverQueryRequest |
| 258 | 263 | * @return |
| 259 | 264 | */ |
| 260 | - public BaseResponse queryMatDeliver(MatDeliverQueryRequest deliverQueryRequest,Integer userId) { | |
| 261 | - List<Integer> list1 =autoMatchFacade.matchOrgId(userId); | |
| 262 | - String hospital =null; | |
| 263 | - if(CollectionUtils.isNotEmpty(list1)){ | |
| 264 | - hospital= list1.get(0) + ""; | |
| 265 | + public BaseResponse queryMatDeliver(MatDeliverQueryRequest deliverQueryRequest, Integer userId) { | |
| 266 | + List<Integer> list1 = autoMatchFacade.matchOrgId(userId); | |
| 267 | + String hospital = null; | |
| 268 | + if (CollectionUtils.isNotEmpty(list1)) { | |
| 269 | + hospital = list1.get(0) + ""; | |
| 265 | 270 | } |
| 266 | 271 | //获取 |
| 267 | - Patients patients = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null,hospital,null); | |
| 272 | + Patients patients = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, hospital, -1); | |
| 268 | 273 | if (null == patients) { |
| 269 | 274 | return new BaseResponse().setErrormsg("没有相关的产妇记录").setErrorcode(ErrorCodeConstants.BUSINESS_ERROR); |
| 270 | 275 | } |
| ... | ... | @@ -278,7 +283,7 @@ |
| 278 | 283 | antExQuery.setParentId(patients.getId()); |
| 279 | 284 | antExQuery.setYn(YnEnums.YES.getId()); |
| 280 | 285 | List<AntenatalExaminationModel> examinationModel = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); |
| 281 | - HighScoreResult highScoreResult = antenatalExaminationFacade.findLastRisk(patients.getId()); | |
| 286 | + HighScoreResult highScoreResult = antenatalExaminationFacade.findLastRisk(patients.getId()); | |
| 282 | 287 | try { |
| 283 | 288 | String tTireNumber = ""; |
| 284 | 289 | List data = new ArrayList(); |
| ... | ... | @@ -301,7 +306,7 @@ |
| 301 | 306 | } |
| 302 | 307 | |
| 303 | 308 | matDeliverListResult.setRiskFactor(highScoreResult.getHighRisk()); |
| 304 | - matDeliverListResult.setRiskScore(highScoreResult.getScore()+""); | |
| 309 | + matDeliverListResult.setRiskScore(highScoreResult.getScore() + ""); | |
| 305 | 310 | matDeliverListResult.setTireNumber1(tTireNumber); |
| 306 | 311 | } catch (Exception e) { |
| 307 | 312 | } |