Commit 3c2e7082d259513597ada8cc212b7dfbc073eb1e
1 parent
8fc352182c
Exists in
master
and in
1 other branch
增加设置parentid
Showing 1 changed file with 48 additions and 19 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ApplyOrderFacade.java
View file @
3c2e708
| ... | ... | @@ -15,14 +15,12 @@ |
| 15 | 15 | import com.lyms.platform.operate.web.request.SieveApplyOrderAddRequest; |
| 16 | 16 | import com.lyms.platform.operate.web.result.*; |
| 17 | 17 | import com.lyms.platform.permission.model.Organization; |
| 18 | +import com.lyms.platform.permission.model.OrganizationQuery; | |
| 18 | 19 | import com.lyms.platform.permission.model.Users; |
| 19 | 20 | import com.lyms.platform.permission.service.OrganizationService; |
| 20 | 21 | import com.lyms.platform.permission.service.UsersService; |
| 21 | 22 | import com.lyms.platform.pojo.*; |
| 22 | -import com.lyms.platform.query.PatientsQuery; | |
| 23 | -import com.lyms.platform.query.ReferralApplyOrderQuery; | |
| 24 | -import com.lyms.platform.query.SieveApplyOrderQuery; | |
| 25 | -import com.lyms.platform.query.SieveQuery; | |
| 23 | +import com.lyms.platform.query.*; | |
| 26 | 24 | import org.apache.commons.collections.CollectionUtils; |
| 27 | 25 | import org.apache.commons.lang.StringUtils; |
| 28 | 26 | import org.apache.commons.lang.math.NumberUtils; |
| ... | ... | @@ -81,6 +79,19 @@ |
| 81 | 79 | referralApplyOrderQuery.setParentId(referralApplyOrderModel.getParentId()); |
| 82 | 80 | String hospital = autoMatchFacade.getHospitalId(userId); |
| 83 | 81 | referralApplyOrderQuery.setOutHospitalId(hospital); |
| 82 | + //如果填写的汉字,并且改医院在我们系统存在则把他转成id | |
| 83 | + if (StringUtils.isNotEmpty(referralApplyOrderModel.getTransferredHospital()) && !NumberUtils.isNumber(referralApplyOrderModel.getTransferredHospital())) { | |
| 84 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
| 85 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
| 86 | + organizationQuery.setName(referralApplyOrderModel.getTransferredHospital()); | |
| 87 | + List<Organization> organization = organizationService.queryOrganization(organizationQuery); | |
| 88 | + if (CollectionUtils.isNotEmpty(organization)) { | |
| 89 | + referralApplyOrderModel.setTransferredHospital(organization | |
| 90 | + .get(0).getId() + ""); | |
| 91 | + } | |
| 92 | + } | |
| 93 | + | |
| 94 | + | |
| 84 | 95 | List<ReferralApplyOrderModel> list = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery); |
| 85 | 96 | if (CollectionUtils.isEmpty(list)) { |
| 86 | 97 | if (2 == type) { |
| 87 | 98 | |
| ... | ... | @@ -105,12 +116,21 @@ |
| 105 | 116 | |
| 106 | 117 | referralApplyOrderModel.setPid(patients.getPid()); |
| 107 | 118 | referralApplyOrderModel.setDueWeek(com.lyms.platform.common.utils.StringUtils.dueWeek(days)); |
| 119 | + if (StringUtils.isNotEmpty(referralApplyOrderModel.getTransferredHospital()) && NumberUtils.isNumber(referralApplyOrderModel.getTransferredHospital())) { | |
| 108 | 120 | |
| 109 | - patients.setId(null); | |
| 110 | - patients.setHospitalId(hospital); | |
| 111 | - patients.setBookbuildingDate(new Date()); | |
| 112 | - patients.setBookbuildingDoctor(null); | |
| 113 | - patientsService.addPatient(patients); | |
| 121 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
| 122 | + patientsQuery1.setId(patients.getId()); | |
| 123 | + patientsQuery1.setYn(YnEnums.YES.getId()); | |
| 124 | + | |
| 125 | + if (patientsService.queryPatientCount(patientsQuery1) == 0) { | |
| 126 | + //在转入的医院建档 | |
| 127 | + patients.setId(null); | |
| 128 | + patients.setHospitalId(referralApplyOrderModel.getTransferredHospital()); | |
| 129 | + patients.setBookbuildingDate(new Date()); | |
| 130 | + patients.setBookbuildingDoctor(null); | |
| 131 | + patientsService.addPatient(patients); | |
| 132 | + } | |
| 133 | + } | |
| 114 | 134 | } |
| 115 | 135 | } else { |
| 116 | 136 | BabyModel babyModel = babyService.getOneBabyById(referralApplyOrderModel.getParentId()); |
| ... | ... | @@ -132,12 +152,21 @@ |
| 132 | 152 | referralApplyOrderModel.setExpVip(babyModel.getExpVip()); |
| 133 | 153 | referralApplyOrderModel.setPid(babyModel.getPid()); |
| 134 | 154 | |
| 135 | - //新增儿童建档 | |
| 136 | - babyModel.setId(null); | |
| 137 | - babyModel.setHospitalId(hospital); | |
| 138 | - babyModel.setBuildDoctor(null); | |
| 139 | - babyModel.setBuildDate(new Date()); | |
| 140 | - babyService.addOneBaby(babyModel); | |
| 155 | + if (StringUtils.isNotEmpty(referralApplyOrderModel.getTransferredHospital()) && NumberUtils.isNumber(referralApplyOrderModel.getTransferredHospital())) { | |
| 156 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 157 | + babyModelQuery.setId(babyModel.getId()); | |
| 158 | + babyModelQuery.setHospitalId(referralApplyOrderModel.getTransferredHospital()); | |
| 159 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
| 160 | + //没有儿童档案的时候才建档 | |
| 161 | + if (babyService.queryBabyCount(babyModelQuery) == 0) { | |
| 162 | + ////在转入的医院新增儿童建档 | |
| 163 | + babyModel.setId(null); | |
| 164 | + babyModel.setHospitalId(referralApplyOrderModel.getTransferredHospital()); | |
| 165 | + babyModel.setBuildDoctor(null); | |
| 166 | + babyModel.setBuildDate(new Date()); | |
| 167 | + babyService.addOneBaby(babyModel); | |
| 168 | + } | |
| 169 | + } | |
| 141 | 170 | } |
| 142 | 171 | } |
| 143 | 172 | |
| ... | ... | @@ -145,6 +174,7 @@ |
| 145 | 174 | referralApplyOrderModel.setType(type); |
| 146 | 175 | referralApplyOrderModel.setOutHospitalId(hospital); |
| 147 | 176 | applyOrderService.addOneReferralApplyOrder(referralApplyOrderModel); |
| 177 | + | |
| 148 | 178 | referralApplyOrderModel.setId(null); |
| 149 | 179 | referralApplyOrderModel.setOutHospitalId(referralApplyOrderModel.getTransferredHospital()); |
| 150 | 180 | referralApplyOrderModel.setTransferredHospital(hospital); |
| ... | ... | @@ -156,7 +186,6 @@ |
| 156 | 186 | } |
| 157 | 187 | |
| 158 | 188 | /** |
| 159 | - * | |
| 160 | 189 | * 增加产前筛查 |
| 161 | 190 | * |
| 162 | 191 | * @param sieveApplyOrderAddRequest |
| 163 | 192 | |
| ... | ... | @@ -309,14 +338,14 @@ |
| 309 | 338 | for (ReferralApplyOrderModel applyOrderModel : orderModels) { |
| 310 | 339 | BabyApplyOrderResult babyApplyOrderResult = new BabyApplyOrderResult(); |
| 311 | 340 | String zhuanchu = applyOrderModel.getOutHospitalId(); |
| 312 | - String zhuanru= applyOrderModel.getTransferredHospital(); | |
| 313 | - if(NumberUtils.isNumber(zhuanchu)){ | |
| 341 | + String zhuanru = applyOrderModel.getTransferredHospital(); | |
| 342 | + if (NumberUtils.isNumber(zhuanchu)) { | |
| 314 | 343 | Organization zhuanc = organizationService.getOrganization(Integer.valueOf(zhuanchu)); |
| 315 | 344 | if (null != zhuanc) { |
| 316 | 345 | zhuanCName = zhuanc.getName(); |
| 317 | 346 | } |
| 318 | 347 | } |
| 319 | - if(NumberUtils.isNumber(zhuanru)){ | |
| 348 | + if (NumberUtils.isNumber(zhuanru)) { | |
| 320 | 349 | Organization zhuanc1 = organizationService.getOrganization(Integer.valueOf(zhuanru)); |
| 321 | 350 | if (null != zhuanc1) { |
| 322 | 351 | zhuanRname = zhuanc1.getName(); |