Commit 3062a89c55ab4141ff4f2e2a2608164443cca179
1 parent
9612a50ddf
Exists in
master
and in
1 other branch
修改新电子病历
Showing 1 changed file with 59 additions and 52 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
3062a89
... | ... | @@ -136,16 +136,21 @@ |
136 | 136 | |
137 | 137 | |
138 | 138 | } else { |
139 | - List list1 = autoMatchFacade.matchOrgId(userId); | |
140 | - Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId()); | |
141 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
142 | - patientsQuery.setPid(patients.getPid()); | |
143 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
144 | - if (CollectionUtils.isNotEmpty(list1)) { | |
145 | - antExChuModel.setHospitalId(list1.get(0) + ""); | |
139 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
140 | + AntExChuQuery antExChuQuery1 = new AntExChuQuery(); | |
141 | + antExChuQuery1.setParentId(excAddRequest.getParentId()); | |
142 | + List<AntExChuModel> data1 = antenatalExaminationService.queryAntExChu(antExChuQuery1); | |
143 | + //初诊只能建一次 | |
144 | + if(CollectionUtils.isEmpty(data1)){ | |
145 | + Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId()); | |
146 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
147 | + patientsQuery.setPid(patients.getPid()); | |
148 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
149 | + | |
150 | + antExChuModel.setHospitalId(hospitalId); | |
146 | 151 | AntExChuQuery antExChuQuery = new AntExChuQuery(); |
147 | 152 | antExChuQuery.setYn(YnEnums.YES.getId()); |
148 | - antExChuQuery.setHospitalId(list1.get(0) + ""); | |
153 | + antExChuQuery.setHospitalId(hospitalId); | |
149 | 154 | |
150 | 155 | List<Patients> list = patientsService.queryPatient(patientsQuery); |
151 | 156 | antExChuQuery.setStart(list.get(0).getCreated()); |
152 | 157 | |
153 | 158 | |
154 | 159 | |
... | ... | @@ -154,35 +159,38 @@ |
154 | 159 | if (CollectionUtils.isNotEmpty(data)) { |
155 | 160 | return new BaseResponse().setErrorcode(ErrorCodeConstants.DATA_EXIST).setErrormsg("您本次妊娠中已在本医院建档"); |
156 | 161 | } |
157 | - } | |
158 | - antExChuModel.setPid(patients.getPid()); | |
159 | - antExChuModel.setYn(YnEnums.YES.getId()); | |
160 | - antenatalExaminationService.addOneAntEx(antExChuModel); | |
161 | - //修改患者风险等级 | |
162 | - patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor()); | |
163 | - updatePatientRiskLevel(antExChuModel, patients); | |
164 | 162 | |
165 | - if (null != patients.getBuildType() && patients.getBuildType() == 3) { | |
166 | - ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery(); | |
167 | - referralApplyOrderQuery.setParentId(patients.getId()); | |
168 | - String hospital = autoMatchFacade.getHospitalId(userId); | |
169 | - referralApplyOrderQuery.setHospitalId(hospital); | |
170 | - List<ReferralApplyOrderModel> orderModelList = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery); | |
171 | - if (CollectionUtils.isNotEmpty(orderModelList)) { | |
172 | - String outHospitalId = orderModelList.get(0).getOutHospitalId(); | |
173 | - ReferralApplyOrderQuery referralApplyOrderQuery1 = new ReferralApplyOrderQuery(); | |
174 | - referralApplyOrderQuery1.setOutHospitalId(outHospitalId); | |
175 | - referralApplyOrderQuery1.setTransferredHospital(hospital); | |
176 | - referralApplyOrderQuery1.setPid(patients.getPid()); | |
163 | + antExChuModel.setPid(patients.getPid()); | |
164 | + antExChuModel.setYn(YnEnums.YES.getId()); | |
165 | + antenatalExaminationService.addOneAntEx(antExChuModel); | |
166 | + //修改患者风险等级 | |
167 | + patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor()); | |
168 | + updatePatientRiskLevel(antExChuModel, patients); | |
177 | 169 | |
178 | - ReferralApplyOrderModel model = new ReferralApplyOrderModel(); | |
179 | - //设置接收时间 | |
180 | - model.setReceived(new Date()); | |
181 | - model.setRecDoctor(userId + ""); | |
182 | - model.setModified(new Date()); | |
183 | - model.setStatus(2); | |
184 | - applyOrderService.updateByParentId(referralApplyOrderQuery1, model); | |
170 | + if (null != patients.getBuildType() && patients.getBuildType() == 3) { | |
171 | + ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery(); | |
172 | + referralApplyOrderQuery.setParentId(patients.getId()); | |
173 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
174 | + referralApplyOrderQuery.setHospitalId(hospital); | |
175 | + List<ReferralApplyOrderModel> orderModelList = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery); | |
176 | + if (CollectionUtils.isNotEmpty(orderModelList)) { | |
177 | + String outHospitalId = orderModelList.get(0).getOutHospitalId(); | |
178 | + ReferralApplyOrderQuery referralApplyOrderQuery1 = new ReferralApplyOrderQuery(); | |
179 | + referralApplyOrderQuery1.setOutHospitalId(outHospitalId); | |
180 | + referralApplyOrderQuery1.setTransferredHospital(hospital); | |
181 | + referralApplyOrderQuery1.setPid(patients.getPid()); | |
182 | + | |
183 | + ReferralApplyOrderModel model = new ReferralApplyOrderModel(); | |
184 | + //设置接收时间 | |
185 | + model.setReceived(new Date()); | |
186 | + model.setRecDoctor(userId + ""); | |
187 | + model.setModified(new Date()); | |
188 | + model.setStatus(2); | |
189 | + applyOrderService.updateByParentId(referralApplyOrderQuery1, model); | |
190 | + } | |
185 | 191 | } |
192 | + }else{ | |
193 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("您已经做过初诊"); | |
186 | 194 | } |
187 | 195 | } |
188 | 196 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
... | ... | @@ -1072,7 +1080,7 @@ |
1072 | 1080 | * @return |
1073 | 1081 | */ |
1074 | 1082 | public BaseResponse queryAntenatalExamination(AntenatalExaminationQueryRequest queryRequest, Integer userId) { |
1075 | - String hospitalId = autoMatchFacade.getHospitalId(userId); | |
1083 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
1076 | 1084 | Patients patients = null; |
1077 | 1085 | if (!StringUtils.isEmpty(queryRequest.getPatientId())) { |
1078 | 1086 | PatientsQuery patientsQuery = new PatientsQuery(); |
... | ... | @@ -1093,7 +1101,7 @@ |
1093 | 1101 | //查询是否还有其他记录 |
1094 | 1102 | patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospitalId, 3, false, null); |
1095 | 1103 | |
1096 | - if(null!=patients){ | |
1104 | + if (null != patients) { | |
1097 | 1105 | return new BaseResponse().setErrorcode(ErrorCodeConstants.DEPT_NOT_EXISTS).setErrormsg("该孕妇在系统中已分娩/已终止妊娠不能再进行产检,请重新建档"); |
1098 | 1106 | } |
1099 | 1107 | |
1100 | 1108 | |
1101 | 1109 | |
1102 | 1110 | |
1103 | 1111 | |
1104 | 1112 | |
1105 | 1113 | |
1106 | 1114 | |
... | ... | @@ -1158,34 +1166,34 @@ |
1158 | 1166 | antexListResult.setRiskScore(highScoreResult.getScoreStr()); |
1159 | 1167 | |
1160 | 1168 | //获取最后一次检查的记录 |
1161 | - AntExQuery antExQuery1=new AntExQuery(); | |
1169 | + AntExQuery antExQuery1 = new AntExQuery(); | |
1162 | 1170 | antExQuery1.setHospitalId(hospitalId); |
1163 | 1171 | antExQuery1.setPid(patients.getPid()); |
1164 | 1172 | antExQuery1.setYn(YnEnums.YES.getId()); |
1165 | - List<AntenatalExaminationModel> examinationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery1.convertToQuery().addOrder(Sort.Direction.DESC, "created")); | |
1173 | + List<AntenatalExaminationModel> examinationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery1.convertToQuery().addOrder(Sort.Direction.DESC, "created")); | |
1166 | 1174 | |
1167 | - String lastTime =""; | |
1175 | + String lastTime = ""; | |
1168 | 1176 | |
1169 | - if(CollectionUtils.isNotEmpty(examinationModelList)){ | |
1170 | - lastTime= DateUtil.getyyyy_MM_dd(examinationModelList.get(0).getCheckDate()); | |
1171 | - }else{ | |
1172 | - AntExChuQuery antExChuQuery1=new AntExChuQuery(); | |
1177 | + if (CollectionUtils.isNotEmpty(examinationModelList)) { | |
1178 | + lastTime = DateUtil.getyyyy_MM_dd(examinationModelList.get(0).getCheckDate()); | |
1179 | + } else { | |
1180 | + AntExChuQuery antExChuQuery1 = new AntExChuQuery(); | |
1173 | 1181 | antExChuQuery1.setPid(patients.getPid()); |
1174 | 1182 | antExChuQuery1.setHospitalId(hospitalId); |
1175 | 1183 | antExChuQuery1.setYn(YnEnums.YES.getId()); |
1176 | 1184 | |
1177 | - List<AntExChuModel> antExChuModels= antenatalExaminationService.queryAntExChu(antExChuQuery1); | |
1185 | + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery1); | |
1178 | 1186 | |
1179 | - if(CollectionUtils.isNotEmpty(antExChuModels)){ | |
1180 | - lastTime =DateUtil.getyyyy_MM_dd(antExChuModels.get(0).getCheckTime()); | |
1181 | - }else{ | |
1182 | - PatientsQuery patientsQuery1=new PatientsQuery(); | |
1187 | + if (CollectionUtils.isNotEmpty(antExChuModels)) { | |
1188 | + lastTime = DateUtil.getyyyy_MM_dd(antExChuModels.get(0).getCheckTime()); | |
1189 | + } else { | |
1190 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
1183 | 1191 | patientsQuery1.setYn(YnEnums.YES.getId()); |
1184 | 1192 | patientsQuery1.setPid(patients.getPid()); |
1185 | 1193 | patientsQuery1.setHospitalId(hospitalId); |
1186 | - List<Patients> patientses = patientsService.queryPatient(patientsQuery1); | |
1194 | + List<Patients> patientses = patientsService.queryPatient(patientsQuery1); | |
1187 | 1195 | |
1188 | - if(CollectionUtils.isNotEmpty(patientses)){ | |
1196 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
1189 | 1197 | lastTime = DateUtil.getyyyy_MM_dd(patientses.get(0).getBookbuildingDate()); |
1190 | 1198 | } |
1191 | 1199 | } |
... | ... | @@ -1342,7 +1350,6 @@ |
1342 | 1350 | |
1343 | 1351 | return new BaseObjectResponse().setData(object).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
1344 | 1352 | } |
1345 | - | |
1346 | 1353 | |
1347 | 1354 | |
1348 | 1355 | public HighScoreResult queryRisk(List<String> id, boolean n) { |