Commit b78bca25077aecce48074cdc9e77941e48d3d054

Authored by jiangjiazhi
1 parent 0442c0d9b1

增加设置parentid

Showing 1 changed file with 65 additions and 58 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ b78bca2
... ... @@ -66,7 +66,7 @@
66 66 //修改申请单状态
67 67 updateApplyOrder(antenatalExamination, antExAddRequest.getParentId());
68 68 //修改孕妇高危等级
69   - Patients patients =patientsService.findOnePatientById(antExAddRequest.getParentId());
  69 + Patients patients = patientsService.findOnePatientById(antExAddRequest.getParentId());
70 70 patients.setLastCheckEmployeeId(antExAddRequest.getCheckDoctor());
71 71 updatePatientRiskLevel(antenatalExamination, patients);
72 72 } else {
73 73  
... ... @@ -157,16 +157,17 @@
157 157 }
158 158 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
159 159 }
  160 +
160 161 //修改患者风险等级
161 162 private void updatePatientRiskLevel(AntExChuModel antExChuModel, Patients patients) {
162 163 List<String> list = new ArrayList<>();
163 164 try {
164 165 if (StringUtils.isNotEmpty(antExChuModel.getHighrisk()) && !"[]".equals(antExChuModel.getHighrisk())) {
165   - List l = JsonUtil.toList(antExChuModel.getHighrisk(), List.class);
166   - for(int i=0;i< l.size();i++){
167   - BasicConfig basicConfig= basicConfigService.getOneBasicConfigById(l.get(i).toString());
168   - basicConfig= basicConfigService.getOneBasicConfigById(basicConfig.getParentId());
169   - if(null!=basicConfig&&!list.contains(basicConfig.getId())){
  166 + List l = JsonUtil.toList(antExChuModel.getHighrisk(), List.class);
  167 + for (int i = 0; i < l.size(); i++) {
  168 + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(l.get(i).toString());
  169 + basicConfig = basicConfigService.getOneBasicConfigById(basicConfig.getParentId());
  170 + if (null != basicConfig && !list.contains(basicConfig.getId())) {
170 171 list.add(basicConfig.getId());
171 172 }
172 173 }
... ... @@ -177,7 +178,7 @@
177 178 if (StringUtils.isNotEmpty(antExChuModel.getOtherHighRisk()) && !"{}".equals(antExChuModel.getOtherHighRisk())) {
178 179 Map map = JsonUtil.str2Obj(antExChuModel.getOtherHighRisk(), Map.class);
179 180 String m = (String) map.get("fyyse");
180   - if(!list.contains(m)){
  181 + if (!list.contains(m)) {
181 182 list.add(m);
182 183 }
183 184 }
184 185  
... ... @@ -188,16 +189,17 @@
188 189 }
189 190 patientsService.updatePatient(patients);
190 191 }
  192 +
191 193 //修改患者风险等级
192 194 private void updatePatientRiskLevel(AntenatalExaminationModel antExChuModel, Patients patients) {
193 195 List<String> list = new ArrayList<>();
194 196 try {
195 197 if (StringUtils.isNotEmpty(antExChuModel.getRiskFactor()) && !"[]".equals(antExChuModel.getRiskFactor())) {
196   - List l = JsonUtil.toList(antExChuModel.getRiskFactor(), List.class);
197   - for(int i=0;i< l.size();i++){
198   - BasicConfig basicConfig= basicConfigService.getOneBasicConfigById(l.get(i).toString());
199   - basicConfig= basicConfigService.getOneBasicConfigById(basicConfig.getParentId());
200   - if(null!=basicConfig&&!list.contains(basicConfig.getId())){
  198 + List l = JsonUtil.toList(antExChuModel.getRiskFactor(), List.class);
  199 + for (int i = 0; i < l.size(); i++) {
  200 + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(l.get(i).toString());
  201 + basicConfig = basicConfigService.getOneBasicConfigById(basicConfig.getParentId());
  202 + if (null != basicConfig && !list.contains(basicConfig.getId())) {
201 203 list.add(basicConfig.getId());
202 204 }
203 205 }
... ... @@ -208,7 +210,7 @@
208 210 if (StringUtils.isNotEmpty(antExChuModel.getOtherRisk()) && !"{}".equals(antExChuModel.getOtherRisk())) {
209 211 Map map = JsonUtil.str2Obj(antExChuModel.getOtherRisk(), Map.class);
210 212 String m = (String) map.get("fyyse");
211   - if(!list.contains(m)){
  213 + if (!list.contains(m)) {
212 214 list.add(m);
213 215 }
214 216 }
... ... @@ -219,6 +221,7 @@
219 221 }
220 222 patientsService.updatePatient(patients);
221 223 }
  224 +
222 225 /**
223 226 * 获取最后一次高危产检的高危信息
224 227 * <p>
225 228  
226 229  
227 230  
... ... @@ -226,20 +229,20 @@
226 229 *
227 230 * @return
228 231 */
229   - public HighScoreResult findLastRisk(String parentId,boolean needLevel) {
  232 + public HighScoreResult findLastRisk(String parentId, boolean needLevel) {
230 233 List<AntenatalExaminationModel> list = antenatalExaminationService.findAllByParentId(parentId);
231 234 HighScoreResult highScoreResult = new HighScoreResult();
232   - boolean next=true;
  235 + boolean next = true;
233 236 if (CollectionUtils.isNotEmpty(list)) {
234   - for(AntenatalExaminationModel model:list){
235   - if(!next){
  237 + for (AntenatalExaminationModel model : list) {
  238 + if (!next) {
236 239 break;
237 240 }
238 241 //复诊
239 242 if (null != model && StringUtils.isNotEmpty(model.getRiskFactor()) && !"[]".equals(model.getRiskFactor())) {
240 243 List list1 = JsonUtil.toList(model.getRiskFactor(), List.class);
241 244 highScoreResult = queryRisk(list1, needLevel);
242   - next=false;
  245 + next = false;
243 246 }
244 247 if (null != model && !"{}".equals(model.getOtherRisk())) {
245 248 Map map = JsonUtil.str2Obj(model.getOtherRisk(), Map.class);
246 249  
247 250  
248 251  
249 252  
250 253  
... ... @@ -248,24 +251,24 @@
248 251 Map map1 = new HashMap();
249 252 map1.put("id", "");
250 253 Object obj = map.get("fxysu");
251   - if(null!=obj&&!"null".equals(obj.toString())&&!"".equals(obj.toString())){
  254 + if (null != obj && !"null".equals(obj.toString()) && !"".equals(obj.toString())) {
252 255 map1.put("name", map.get("fxysu"));
253 256 highScoreResult.getHighRisk().add(map1);
254   - }else {
  257 + } else {
255 258 continue;
256 259 }
257 260  
258 261 //风险评分
259 262 Object idObj = map.get("fxpf");
260   - if (null!=idObj&&!"null".equals(idObj.toString())&&!"".equals(idObj.toString())) {
  263 + if (null != idObj && !"null".equals(idObj.toString()) && !"".equals(idObj.toString())) {
261 264 BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj.toString());
262 265 highScoreResult.setScore(highScoreResult.getScore() + NumberUtils.toInt(basicConfig.getName(), 0));
263 266 }
264   - if(needLevel){
  267 + if (needLevel) {
265 268 Object idObj1 = map.get("fyyse");
266   - if (null!=idObj1&&!"null".equals(idObj1.toString())&&!"".equals(idObj1.toString())) {
  269 + if (null != idObj1 && !"null".equals(idObj1.toString()) && !"".equals(idObj1.toString())) {
267 270 BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj1.toString());
268   - if(null!=basicConfig){
  271 + if (null != basicConfig) {
269 272 Map<String, Object> map2 = new HashMap<>();
270 273 map2.put("id", basicConfig.getId());
271 274 map2.put("name", basicConfig.getName());
272 275  
273 276  
274 277  
... ... @@ -273,28 +276,28 @@
273 276 }
274 277 }
275 278 }
276   - next=false;
  279 + next = false;
277 280 }
278 281 }
279 282 }
280 283  
281 284 try {
282 285  
283   - if(next){
  286 + if (next) {
284 287 //初诊
285 288 AntExChuQuery antExChuQuery = new AntExChuQuery();
286 289 antExChuQuery.setParentId(parentId);
287 290 antExChuQuery.setYn(YnEnums.YES.getId());
288 291 List<AntExChuModel> list1 = antenatalExaminationService.queryAntExChu(antExChuQuery);
289 292 if (CollectionUtils.isNotEmpty(list1)) {
290   - for(AntExChuModel antExChuModel:list1){
291   - if(!next){
  293 + for (AntExChuModel antExChuModel : list1) {
  294 + if (!next) {
292 295 break;
293 296 }
294 297 if (null != antExChuModel && StringUtils.isNotEmpty(antExChuModel.getHighrisk()) && !"[]".equals(antExChuModel.getHighrisk())) {
295 298 List list2 = JsonUtil.toList(antExChuModel.getHighrisk(), List.class);
296   - highScoreResult = queryRisk(list2,true);
297   - next=false;
  299 + highScoreResult = queryRisk(list2, true);
  300 + next = false;
298 301 }
299 302 if (null != antExChuModel && !"{}".equals(antExChuModel.getOtherHighRisk())) {
300 303 Map map = JsonUtil.str2Obj(antExChuModel.getOtherHighRisk(), Map.class);
301 304  
302 305  
303 306  
304 307  
305 308  
... ... @@ -302,23 +305,23 @@
302 305 Map map1 = new HashMap();
303 306 map1.put("id", "");
304 307 Object obj = map.get("fxysu");
305   - if(null!=obj&&!"null".equals(obj.toString())&&!"".equals(obj.toString())){
  308 + if (null != obj && !"null".equals(obj.toString()) && !"".equals(obj.toString())) {
306 309 map1.put("name", map.get("fxysu"));
307 310 highScoreResult.getHighRisk().add(map1);
308   - }else {
  311 + } else {
309 312 continue;
310 313 }
311 314 //风险评分
312 315 Object idObj = map.get("fxpf");
313   - if (null!=idObj&&!"null".equals(idObj.toString())&&!"".equals(idObj.toString())) {
  316 + if (null != idObj && !"null".equals(idObj.toString()) && !"".equals(idObj.toString())) {
314 317 BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj.toString());
315 318 highScoreResult.setScore(highScoreResult.getScore() + NumberUtils.toInt(basicConfig.getName(), 0));
316 319 }
317   - if(needLevel){
  320 + if (needLevel) {
318 321 Object idObj1 = map.get("fyyse");
319   - if (null!=idObj1&&!"null".equals(idObj1.toString())&&!"".equals(idObj1.toString())) {
  322 + if (null != idObj1 && !"null".equals(idObj1.toString()) && !"".equals(idObj1.toString())) {
320 323 BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj1.toString());
321   - if(null!=basicConfig){
  324 + if (null != basicConfig) {
322 325 Map<String, Object> map2 = new HashMap<>();
323 326 map2.put("id", basicConfig.getId());
324 327 map2.put("name", basicConfig.getName());
... ... @@ -326,7 +329,7 @@
326 329 }
327 330 }
328 331 }
329   - next=false;
  332 + next = false;
330 333 }
331 334 }
332 335 }
333 336  
334 337  
... ... @@ -356,13 +359,12 @@
356 359 List listDate = new ArrayList();
357 360 int i = 0;
358 361 if (CollectionUtils.isNotEmpty(list)) {
359   -
360 362 antexListResult.convertToResult(null, list.get(0), null);
361 363 for (Patients patients : list) {
362   - HighScoreResult highScoreResult = findLastRisk(patients.getId(),false);
  364 + HighScoreResult highScoreResult = findLastRisk(patients.getId(), false);
363 365 antexListResult.setRiskFactor(highScoreResult.getHighRisk());
364 366 antexListResult.setRiskScore(highScoreResult.getScore() + "");
365   - List<StopPregModel> stopPregs = null;
  367 +
366 368 List<AntData> data = new ArrayList<>();
367 369 MatDeliverQuery matDeliverQuery = new MatDeliverQuery();
368 370 matDeliverQuery.setYn(YnEnums.YES.getId());
... ... @@ -376,7 +378,10 @@
376 378 //分娩记录
377 379 List<MaternalDeliverModel> modelList = matDeliverService.query(matDeliverQuery);
378 380 String dueDate = DateUtil.getyyyy_MM_dd(new Date());
379   - if (CollectionUtils.isNotEmpty(modelList)) {
  381 + if (null != patients.getFmDate()) {
  382 + dueDate = DateUtil.getyyyy_MM_dd(patients.getFmDate());
  383 + }
  384 + /*if (null!=patients.getFmDate()) {
380 385 MaternalDeliverModel model = modelList.get(0);
381 386 dueDate = model.getDueDate();
382 387 } else {
... ... @@ -396,9 +401,7 @@
396 401 dueDate = DateUtil.getyyyy_MM_dd(stopPregs.get(0).getStopDate());
397 402 }
398 403 }
399   -
400   -
401   - }
  404 + }*/
402 405 PostReviewQuery postReviewQuery = new PostReviewQuery();
403 406  
404 407 postReviewQuery.setYn(YnEnums.YES.getId());
... ... @@ -447,6 +450,10 @@
447 450 postReviewQuery.setParentId(patients.getId());
448 451 i++;
449 452 //分娩记录
  453 + StopPregQuery query = new StopPregQuery();
  454 + query.setYn(YnEnums.YES.getId());
  455 + query.setPatientId(patients.getId());
  456 + List<StopPregModel> stopPregs = stopPregnancyService.queryStopPreg(query);
450 457 if (CollectionUtils.isNotEmpty(modelList)) {
451 458 organization = organizationService.getOrganization(Integer.valueOf(modelList.get(0).getHospitalId()));
452 459 data.add(new AntData(modelList.get(0), patients.getLastMenses(), null != organization ? organization.getName() : ""));
... ... @@ -596,7 +603,7 @@
596 603 //获取初诊记录
597 604 List<AntExChuModel> antExChulist = antenatalExaminationService.queryAntExChu(antExChuQuery);
598 605  
599   - HighScoreResult highScoreResult = findLastRisk(patients.getId(),false);
  606 + HighScoreResult highScoreResult = findLastRisk(patients.getId(), false);
600 607 AntExQuery antExQuery = new AntExQuery();
601 608 antExQuery.setYn(YnEnums.YES.getId());
602 609 antExQuery.setParentId(patients.getId());
603 610  
604 611  
... ... @@ -608,12 +615,12 @@
608 615 antexListResult.setIsSieve(cap(patients.getLastMenses(), patients.getId()));
609 616 antexListResult.setRiskFactor(highScoreResult.getHighRisk());
610 617 antexListResult.setRiskScore(highScoreResult.getScore() + "");
611   - int days= DateUtil.getDays(patients.getLastMenses(),new Date());
  618 + int days = DateUtil.getDays(patients.getLastMenses(), new Date());
612 619 // 28孕周(28+1—28+6)
613   - if((days>=197)&&days<=202){
  620 + if ((days >= 197) && days <= 202) {
614 621 antexListResult.setIsH("1");
615 622 }
616   - if((days>=253)&&days<=258){
  623 + if ((days >= 253) && days <= 258) {
617 624 antexListResult.setIsH("1");
618 625 }
619 626 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(antexListResult);
... ... @@ -670,7 +677,7 @@
670 677 try {
671 678 if (StringUtils.isNotEmpty(examinationModel.getRiskFactor())) {
672 679 List list1 = JsonUtil.toList(examinationModel.getRiskFactor(), List.class);
673   - HighScoreResult highScoreResult = queryRisk(list1,false);
  680 + HighScoreResult highScoreResult = queryRisk(list1, false);
674 681 antenatalExaminationResult.setRiskFactor(highScoreResult.getHighRisk());
675 682 }
676 683 } catch (Exception e) {
... ... @@ -678,7 +685,7 @@
678 685 try {
679 686 if (StringUtils.isNotEmpty(examinationModel.getDiagnosis())) {
680 687 List list = JsonUtil.toList(examinationModel.getDiagnosis(), List.class);
681   - antenatalExaminationResult.setDiagnosis(queryRisk(list,false).getHighRisk());
  688 + antenatalExaminationResult.setDiagnosis(queryRisk(list, false).getHighRisk());
682 689 }
683 690 } catch (Exception e) {
684 691 }
685 692  
... ... @@ -712,14 +719,14 @@
712 719 try {
713 720 if (StringUtils.isNotEmpty(antExChuModel.getDiagnosis())) {
714 721 List list = JsonUtil.toList(antExChuModel.getDiagnosis(), List.class);
715   - antexChuResult.setDiagnosis(queryRisk(list,false).getHighRisk());
  722 + antexChuResult.setDiagnosis(queryRisk(list, false).getHighRisk());
716 723 }
717 724 } catch (Exception e) {
718 725 }
719 726 try {
720 727 if (StringUtils.isNotEmpty(antExChuModel.getHighrisk())) {
721 728 List list1 = JsonUtil.toList(antExChuModel.getHighrisk(), List.class);
722   - antexChuResult.setHighrisk(queryRisk(list1,false).getHighRisk());
  729 + antexChuResult.setHighrisk(queryRisk(list1, false).getHighRisk());
723 730 }
724 731 } catch (Exception e) {
725 732 }
... ... @@ -738,7 +745,7 @@
738 745 return new BaseObjectResponse().setData(object).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
739 746 }
740 747  
741   - public HighScoreResult queryRisk(List<String> id,boolean n) {
  748 + public HighScoreResult queryRisk(List<String> id, boolean n) {
742 749 HighScoreResult highScoreResult = new HighScoreResult();
743 750 BasicConfigQuery
744 751 basicConfigQuery = new BasicConfigQuery();
745 752  
... ... @@ -759,14 +766,14 @@
759 766 if (StringUtils.isNotEmpty(basicConfig.getCode())) {
760 767 score += NumberUtils.toInt(basicConfig.getCode(), 0);
761 768 }
762   - if(n){
763   - BasicConfig basicConfig1= basicConfigService.getOneBasicConfigById(basicConfig.getParentId());
764   - if(null!=basicConfig1){
  769 + if (n) {
  770 + BasicConfig basicConfig1 = basicConfigService.getOneBasicConfigById(basicConfig.getParentId());
  771 + if (null != basicConfig1) {
765 772 Map<String, Object> map1 = new HashMap<>();
766 773 map1.put("id", basicConfig1.getId());
767 774 String name = basicConfig1.getName();
768   - if(name.indexOf("预警")>-1){
769   - name= name.replace("预警","");
  775 + if (name.indexOf("预警") > -1) {
  776 + name = name.replace("预警", "");
770 777 }
771 778 map1.put("name", name);
772 779 dat1a.add(map1);