Commit 12798af40de40423483f833bc92acf5b4e5ac40e

Authored by litao@lymsh.com
1 parent fe9164baf6

bbbbbb

Showing 1 changed file with 46 additions and 50 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 12798af
... ... @@ -545,7 +545,7 @@
545 545 if(p == null) {
546 546 return RespBuilder.buildSuccess();
547 547 }
548   - AntExChuModel antExChuModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(p.getPid()).and("yn").is(1).and("checkTime").gte(p.getLastMenses())).with(new Sort(Sort.Direction.DESC, "checkTime")), AntExChuModel.class);
  548 + List<AntExChuModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(p.getPid()).and("yn").is(1).and("checkTime").gte(p.getLastMenses())).with(new Sort(Sort.Direction.DESC, "checkTime")), AntExChuModel.class);
549 549 List<AntenatalExaminationModel> antexModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(p.getPid()).and("yn").is(1).and("checkDate").gte(p.getLastMenses())).with(new Sort(Sort.Direction.DESC, "checkDate")), AntenatalExaminationModel.class);
550 550  
551 551 Map<String, Object> xyMap = new HashMap<>();
... ... @@ -569,7 +569,7 @@
569 569  
570 570 Map<String, Object> tzMap = new HashMap<>();
571 571 Map<Integer, String> weights = new LinkedHashMap<>();
572   - boolean tzFlag = antExChuModel == null || StringUtils.isEmpty(antExChuModel.getYqWeight()) || StringUtils.isEmpty(antExChuModel.getHeight()) ? false : true;
  572 + boolean tzFlag = CollectionUtils.isEmpty(antExChuModels) || StringUtils.isEmpty(antExChuModels.get(antExChuModels.size() - 1).getYqWeight()) || StringUtils.isEmpty(antExChuModels.get(antExChuModels.size() - 1).getHeight()) ? false : true;
573 573  
574 574  
575 575 for (AntenatalExaminationModel antexModel : antexModels) {
... ... @@ -583,9 +583,6 @@
583 583 temp.put("abdominalCircumference", antexModel.getAbdominalCircumference());// 腹围
584 584  
585 585 List<Map> tireData = antexModel.getTireData();
586   - String fetalPosition = ""; // 胎位
587   - String heartRate = ""; // 胎心
588   - String fetalPresentation = ""; // 先露
589 586 StringBuffer fetalPosition2 = new StringBuffer(); // 胎位
590 587 StringBuffer heartRate2 = new StringBuffer(); // 胎心
591 588 StringBuffer fetalPresentation2 = new StringBuffer(); // 先露
592 589  
593 590  
594 591  
595 592  
596 593  
597 594  
598 595  
... ... @@ -619,61 +616,60 @@
619 616 restList.add(temp);
620 617 }
621 618  
622   - // 添加初诊list\
623   - if(antExChuModel != null) {
624   - Map<String, Object> temp = new HashMap<>();
625   - temp.put("checkTime", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime()));
626   - Integer week = DateUtil.getWeek2(p.getLastMenses(), antExChuModel.getCheckTime());
627   - temp.put("week", DateUtil.getWeekDesc(p.getLastMenses(), antExChuModel.getCheckTime()));
628   - temp.put("weight", antExChuModel.getWeight());
629   - temp.put("bp", parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), "--") + "/" + parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), "--"));
630   - temp.put("gonggao", antExChuModel.getGonggao());
631   - temp.put("abdominalCircumference", antExChuModel.getFuwei());// 腹围
  619 + // 添加初诊list
632 620  
633   - List<Map> tireData = antExChuModel.getPlacentas();
634   - String fetalPosition = "";
635   - String heartRate = "";
636   - String fetalPresentation = "";
637   - StringBuffer fetalPosition2 = new StringBuffer(); // 胎位
638   - StringBuffer heartRate2 = new StringBuffer(); // 胎心
639   - StringBuffer fetalPresentation2 = new StringBuffer(); // 先露
640   - try { // 有些数据前端传的有问题 存的class
641   - if(CollectionUtils.isNotEmpty(tireData)) {
642   - for (Map tireDatum : tireData) {
643   - if(fetalPosition2.length() > 0) fetalPosition2.append("/");
644   - if(heartRate2.length() > 0) heartRate2.append("/");
645   - if(fetalPresentation2.length() > 0) fetalPresentation2.append("/");
646   - fetalPosition2.append(tireDatum.containsKey("fetalPosition") ? FetalPositionEnums.getTitle2((String) tireDatum.get("fetalPosition")) : "--");
647   - heartRate2.append(tireDatum.containsKey("heartRate") ? tireDatum.get("heartRate").toString().replaceAll("\\.0", "") : "--");
648   - fetalPresentation2.append(tireDatum.containsKey("fetalPresentation") ? FetalEnums.getTitle2((String) tireDatum.get("fetalPresentation")) : "--");
649   - }
650   - } else {
  621 + for (AntExChuModel antExChuModel : antExChuModels) {
  622 + Map<String, Object> temp = new HashMap<>();
  623 + temp.put("checkTime", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime()));
  624 + Integer week = DateUtil.getWeek2(p.getLastMenses(), antExChuModel.getCheckTime());
  625 + temp.put("week", DateUtil.getWeekDesc(p.getLastMenses(), antExChuModel.getCheckTime()));
  626 + temp.put("weight", antExChuModel.getWeight());
  627 + temp.put("bp", parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), "--") + "/" + parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), "--"));
  628 + temp.put("gonggao", antExChuModel.getGonggao());
  629 + temp.put("abdominalCircumference", antExChuModel.getFuwei());// 腹围
  630 +
  631 + List<Map> tireData = antExChuModel.getPlacentas();
  632 + StringBuffer fetalPosition2 = new StringBuffer(); // 胎位
  633 + StringBuffer heartRate2 = new StringBuffer(); // 胎心
  634 + StringBuffer fetalPresentation2 = new StringBuffer(); // 先露
  635 + try { // 有些数据前端传的有问题 存的class
  636 + if(CollectionUtils.isNotEmpty(tireData)) {
  637 + for (Map tireDatum : tireData) {
  638 + if(fetalPosition2.length() > 0) fetalPosition2.append("/");
  639 + if(heartRate2.length() > 0) heartRate2.append("/");
  640 + if(fetalPresentation2.length() > 0) fetalPresentation2.append("/");
  641 + fetalPosition2.append(tireDatum.containsKey("fetalPosition") ? FetalPositionEnums.getTitle2((String) tireDatum.get("fetalPosition")) : "--");
  642 + heartRate2.append(tireDatum.containsKey("heartRate") ? tireDatum.get("heartRate").toString().replaceAll("\\.0", "") : "--");
  643 + fetalPresentation2.append(tireDatum.containsKey("fetalPresentation") ? FetalEnums.getTitle2((String) tireDatum.get("fetalPresentation")) : "--");
  644 + }
  645 + } else {
  646 + fetalPosition2.append("--");
  647 + heartRate2.append("--");
  648 + fetalPresentation2.append("--");
  649 + }
  650 + } catch (Exception e) {
651 651 fetalPosition2.append("--");
652 652 heartRate2.append("--");
653 653 fetalPresentation2.append("--");
654 654 }
655   - } catch (Exception e) {
656   - fetalPosition2.append("--");
657   - heartRate2.append("--");
658   - fetalPresentation2.append("--");
659   - }
660 655  
661   - temp.put("fetalPosition", fetalPosition2.toString()); // 胎位
662   - temp.put("heartRate", heartRate2.toString()); // 胎心
663   - temp.put("fetalPresentation", fetalPresentation2.toString()); // 先露
664   - temp.put("edema",FuZhongEnums.getName(antExChuModel.getEdema())); // 水肿
665   - temp.put("urineProtein", antExChuModel.getNdb()); // 尿蛋白
666   - temp.put("hemoglobin", antExChuModel.getXhdb()); // 血红素
  656 + temp.put("fetalPosition", fetalPosition2.toString()); // 胎位
  657 + temp.put("heartRate", heartRate2.toString()); // 胎心
  658 + temp.put("fetalPresentation", fetalPresentation2.toString()); // 先露
  659 + temp.put("edema",FuZhongEnums.getName(antExChuModel.getEdema())); // 水肿
  660 + temp.put("urineProtein", antExChuModel.getNdb()); // 尿蛋白
  661 + temp.put("hemoglobin", antExChuModel.getXhdb()); // 血红素
667 662  
668   - ssy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), 0));
669   - szy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), 0));
  663 + ssy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), 0));
  664 + szy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), 0));
670 665  
671   - restList.add(temp);
672   - }
  666 + restList.add(temp);
673 667  
  668 + }
674 669  
675 670  
676 671  
  672 +
677 673 /*if (MapUtils.isNotEmpty(dayWeights)) {
678 674 Set<Map.Entry<String, String>> entries = dayWeights.entrySet();
679 675 for (Map.Entry<String, String> entry : entries) {
... ... @@ -681,7 +677,7 @@
681 677 }
682 678 }*/
683 679 if(tzFlag) {
684   - setReport(tzMap, weights, antExChuModel.getYqWeight(), PatientWeightServiceImpl.getBmi(antExChuModel.getYqWeight(), antExChuModel.getHeight()));
  680 + setReport(tzMap, weights, antExChuModels.get(antExChuModels.size() - 1).getYqWeight(), PatientWeightServiceImpl.getBmi(antExChuModels.get(antExChuModels.size() - 1).getYqWeight(), antExChuModels.get(antExChuModels.size() - 1).getHeight()));
685 681 }
686 682  
687 683 return RespBuilder.buildSuccess("tabList", restList, "xyMap", xyMap, "tzMap", tzMap);