Commit 4f26cdd2f29ab9625f4707980ee0bc915e5c684b
1 parent
7904d92bd2
Exists in
master
and in
2 other branches
分娩作废产检劵
Showing 1 changed file with 84 additions and 52 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostReviewFacade.java
View file @
4f26cdd
| ... | ... | @@ -89,31 +89,12 @@ |
| 89 | 89 | postReviewRequest.setParentId(parentId); |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | - | |
| 93 | - //获取数据 | |
| 92 | + postReviewModel.setOperator(userId); | |
| 94 | 93 | Patients patients1 = patientsService.findOnePatientById(postReviewRequest.getParentId()); |
| 95 | 94 | |
| 96 | - postReviewModel.setOperator(userId); | |
| 97 | - //判断是否是同一个医院 | |
| 98 | - if (!patients1.getHospitalId().equals(hospital)) { | |
| 95 | + autoCreatedPatient(postReviewRequest,hospital,groupId); | |
| 99 | 96 | |
| 100 | - if(StringUtils.isNotEmpty(groupId)){ | |
| 101 | - patients1.setEnable("2"); | |
| 102 | - } | |
| 103 | - patients1.setId(null); | |
| 104 | - patients1.setHospitalId(hospital); | |
| 105 | - patients1.setBuildType(0); | |
| 106 | - patients1.setBookbuildingDoctor(postReviewModel.getProdDoctor()); | |
| 107 | - patients1.setBookbuildingDate(DateUtil.parseYMD(postReviewRequest.getCheckTime())); | |
| 108 | - patients1.setVcCardNo(null); | |
| 109 | - patients1.setMremark(null); | |
| 110 | - patients1.setFileCode(null); | |
| 111 | - patients1.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId()); | |
| 112 | - patients1.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId()); | |
| 113 | - patientsService.addPatient(patients1); | |
| 114 | - } | |
| 115 | 97 | if (StringUtils.isEmpty(postReviewRequest.getId())) { |
| 116 | - | |
| 117 | 98 | postReviewModel.setYn(YnEnums.YES.getId()); |
| 118 | 99 | postReviewModel.setHospitalId(hospital); |
| 119 | 100 | Patients patients = patientsService.findOnePatientById(postReviewRequest.getParentId()); |
| ... | ... | @@ -122,8 +103,6 @@ |
| 122 | 103 | if (StringUtils.isNotEmpty(postReviewRequest.getDueDate())) { |
| 123 | 104 | patients.setFmDate(DateUtil.parseYMD(postReviewRequest.getDueDate())); |
| 124 | 105 | patients.setType(3); |
| 125 | -// patients.setEnable("1"); | |
| 126 | - | |
| 127 | 106 | patients.setBuildType(0); |
| 128 | 107 | patientsService.updatePatient(patients); |
| 129 | 108 | } |
| 130 | 109 | |
| 131 | 110 | |
| ... | ... | @@ -142,38 +121,11 @@ |
| 142 | 121 | patients2.setId(patients1.getId()); |
| 143 | 122 | patientsService.updatePatient(patients2); |
| 144 | 123 | } |
| 145 | - | |
| 124 | + syncMaster(patients.getId()); | |
| 146 | 125 | patientsService.updateNextCheckTime(patients.getId(), postReviewRequest.getNextCheckTime()); |
| 147 | 126 | |
| 148 | - if (null != patients.getBuildType() && patients.getBuildType() == 3) { | |
| 149 | - ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery(); | |
| 150 | - referralApplyOrderQuery.setParentId(patients.getId()); | |
| 151 | - referralApplyOrderQuery.setHospitalId(hospital); | |
| 152 | - referralApplyOrderQuery.setStatus(1); | |
| 153 | - List<ReferralApplyOrderModel> orderModelList = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery); | |
| 154 | - if (CollectionUtils.isNotEmpty(orderModelList)) { | |
| 155 | - String outHospitalId = orderModelList.get(0).getOutHospitalId(); | |
| 156 | - ReferralApplyOrderQuery referralApplyOrderQuery1 = new ReferralApplyOrderQuery(); | |
| 157 | - referralApplyOrderQuery1.setOutHospitalId(outHospitalId); | |
| 158 | - referralApplyOrderQuery1.setTransferredHospital(hospital); | |
| 159 | - referralApplyOrderQuery1.setPid(patients.getPid()); | |
| 127 | + handlApplyOrder(patients,hospital,postReviewRequest); | |
| 160 | 128 | |
| 161 | - ReferralApplyOrderModel model = new ReferralApplyOrderModel(); | |
| 162 | - //设置接收时间 | |
| 163 | - model.setReceived(DateUtil.parseYMD(postReviewRequest.getCheckTime())); | |
| 164 | - model.setRecDoctor(postReviewRequest.getProdDoctor()); | |
| 165 | - model.setModified(new Date()); | |
| 166 | - model.setStatus(2); | |
| 167 | - applyOrderService.updateByParentId(referralApplyOrderQuery1, model); | |
| 168 | - | |
| 169 | - ReferralApplyOrderQuery referralApplyOrderQuery2 = new ReferralApplyOrderQuery(); | |
| 170 | - referralApplyOrderQuery2.setOutHospitalId(hospital); | |
| 171 | - referralApplyOrderQuery2.setTransferredHospital(outHospitalId); | |
| 172 | - referralApplyOrderQuery2.setPid(patients.getPid()); | |
| 173 | - applyOrderService.updateByParentId(referralApplyOrderQuery2, model); | |
| 174 | - } | |
| 175 | - } | |
| 176 | - | |
| 177 | 129 | } else { |
| 178 | 130 | Patients patients = patientsService.findOnePatientById(postReviewRequest.getParentId()); |
| 179 | 131 | if (StringUtils.isNotEmpty(postReviewRequest.getDueDate())) { |
| ... | ... | @@ -185,6 +137,86 @@ |
| 185 | 137 | } |
| 186 | 138 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
| 187 | 139 | } |
| 140 | + | |
| 141 | + private void autoCreatedPatient(PostReviewRequest postReviewRequest,String hospital,String groupId){ | |
| 142 | + //获取数据 | |
| 143 | + Patients patients1 = patientsService.findOnePatientById(postReviewRequest.getParentId()); | |
| 144 | + | |
| 145 | + //判断是否是同一个医院 | |
| 146 | + if (!patients1.getHospitalId().equals(hospital)) { | |
| 147 | + | |
| 148 | + if(StringUtils.isNotEmpty(groupId)){ | |
| 149 | + patients1.setEnable("2"); | |
| 150 | + } | |
| 151 | + patients1.setId(null); | |
| 152 | + patients1.setHospitalId(hospital); | |
| 153 | + patients1.setBuildType(0); | |
| 154 | + patients1.setBookbuildingDoctor(postReviewRequest.getProdDoctor()); | |
| 155 | + patients1.setBookbuildingDate(DateUtil.parseYMD(postReviewRequest.getCheckTime())); | |
| 156 | + patients1.setVcCardNo(null); | |
| 157 | + patients1.setMremark(null); | |
| 158 | + patients1.setFileCode(null); | |
| 159 | + patients1.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId()); | |
| 160 | + patients1.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId()); | |
| 161 | + patientsService.addPatient(patients1); | |
| 162 | + } | |
| 163 | + } | |
| 164 | + | |
| 165 | + | |
| 166 | + /** | |
| 167 | + * 修改转诊申请 | |
| 168 | + * | |
| 169 | + * @param patients | |
| 170 | + * @param hospital | |
| 171 | + * @param postReviewRequest | |
| 172 | + */ | |
| 173 | + private void handlApplyOrder(Patients patients,String hospital,PostReviewRequest postReviewRequest){ | |
| 174 | + if (null != patients.getBuildType() && patients.getBuildType() == 3) { | |
| 175 | + ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery(); | |
| 176 | + referralApplyOrderQuery.setParentId(patients.getId()); | |
| 177 | + referralApplyOrderQuery.setHospitalId(hospital); | |
| 178 | + referralApplyOrderQuery.setStatus(1); | |
| 179 | + List<ReferralApplyOrderModel> orderModelList = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery); | |
| 180 | + if (CollectionUtils.isNotEmpty(orderModelList)) { | |
| 181 | + String outHospitalId = orderModelList.get(0).getOutHospitalId(); | |
| 182 | + ReferralApplyOrderQuery referralApplyOrderQuery1 = new ReferralApplyOrderQuery(); | |
| 183 | + referralApplyOrderQuery1.setOutHospitalId(outHospitalId); | |
| 184 | + referralApplyOrderQuery1.setTransferredHospital(hospital); | |
| 185 | + referralApplyOrderQuery1.setPid(patients.getPid()); | |
| 186 | + | |
| 187 | + ReferralApplyOrderModel model = new ReferralApplyOrderModel(); | |
| 188 | + //设置接收时间 | |
| 189 | + model.setReceived(DateUtil.parseYMD(postReviewRequest.getCheckTime())); | |
| 190 | + model.setRecDoctor(postReviewRequest.getProdDoctor()); | |
| 191 | + model.setModified(new Date()); | |
| 192 | + model.setStatus(2); | |
| 193 | + applyOrderService.updateByParentId(referralApplyOrderQuery1, model); | |
| 194 | + | |
| 195 | + ReferralApplyOrderQuery referralApplyOrderQuery2 = new ReferralApplyOrderQuery(); | |
| 196 | + referralApplyOrderQuery2.setOutHospitalId(hospital); | |
| 197 | + referralApplyOrderQuery2.setTransferredHospital(outHospitalId); | |
| 198 | + referralApplyOrderQuery2.setPid(patients.getPid()); | |
| 199 | + applyOrderService.updateByParentId(referralApplyOrderQuery2, model); | |
| 200 | + } | |
| 201 | + } | |
| 202 | + } | |
| 203 | + | |
| 204 | + //当非建档医院修改初诊信息时,需要同步给建档医院 | |
| 205 | + private void syncMaster(String parentId) { | |
| 206 | + | |
| 207 | + //当前非建档医院最新的状态 | |
| 208 | + Patients patients = patientsService.findOnePatientById(parentId); | |
| 209 | + | |
| 210 | + if (StringUtils.isNotEmpty(patients.getSource())) { | |
| 211 | + Patients masterPatients = patientsService.findOnePatientById(patients.getSource()); | |
| 212 | + | |
| 213 | + masterPatients.setNextCheckTime(patients.getNextCheckTime()); | |
| 214 | + masterPatients.setFmDate(patients.getFmDate()); | |
| 215 | + masterPatients.setLastCheckEmployeeId(patients.getLastCheckEmployeeId()); | |
| 216 | + patientsService.updatePatient(masterPatients); | |
| 217 | + } | |
| 218 | + } | |
| 219 | + | |
| 188 | 220 | |
| 189 | 221 | /** |
| 190 | 222 | * 1、当前孕妇在系统中的本次妊娠期处于未分娩/已终止妊娠或在结束上次妊娠期后再次新增了建档,不管该孕妇在本院是否建档,点击查询时提示当前用户未分娩,不能进行复查 |