Commit 97c65b80fd3edae09b676a78f4711392e7e5e6ac
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 4 changed files
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TempFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TempFacade.java
View file @
97c65b8
| ... | ... | @@ -245,7 +245,10 @@ |
| 245 | 245 | if (patients != null) { |
| 246 | 246 | tempModel.setPid(patients.getPid()); |
| 247 | 247 | } |
| 248 | - tempService.addOneTemp(tempModel); | |
| 248 | + tempModel.setCreated(new Date()); | |
| 249 | + tempModel.setModified(new Date()); | |
| 250 | + mongoTemplate.save(tempModel); | |
| 251 | +// tempService.addOneTemp(tempModel); | |
| 249 | 252 | } |
| 250 | 253 | return RespBuilder.buildSuccess(); |
| 251 | 254 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java
View file @
97c65b8
| ... | ... | @@ -218,7 +218,8 @@ |
| 218 | 218 | Map<String, Map<String, Object>> infos = new LinkedHashMap<>(); |
| 219 | 219 | infos.put(DateUtil.getyyyy_MM_dd(new Date()), temp); |
| 220 | 220 | bloodPressure.setInfos(infos); |
| 221 | - bloodPressureService.add(bloodPressure); | |
| 221 | +// bloodPressureService.add(bloodPressure); | |
| 222 | + mongoTemplate.save(bloodPressure); | |
| 222 | 223 | } else { |
| 223 | 224 | Map<String, Map<String, Object>> infos = bp.getInfos(); |
| 224 | 225 | infos.put(DateUtil.getyyyy_MM_dd(new Date()), temp); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
97c65b8
| ... | ... | @@ -219,7 +219,8 @@ |
| 219 | 219 | one.setYn(YnEnums.YES.getId()); |
| 220 | 220 | one.setModified(new Date()); |
| 221 | 221 | one.setCreatYmdDate(DateUtil.getyyyy_MM_dd(new Date())); |
| 222 | - bloodSugarService.add(one); | |
| 222 | +// bloodSugarService.add(one); | |
| 223 | + mongoTemplate.save(one); | |
| 223 | 224 | return RespBuilder.buildSuccess(one.getId()); |
| 224 | 225 | } |
| 225 | 226 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
97c65b8
| ... | ... | @@ -600,12 +600,36 @@ |
| 600 | 600 | AntExChuModel antExChuModel = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(parentId).and("yn").is(1).and("hospitalId").is(hospitalId)).with(new Sort(Sort.Direction.DESC, "checkTime")), AntExChuModel.class); |
| 601 | 601 | List<AntenatalExaminationModel> antexModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(parentId).and("yn").is(1).and("hospitalId").is(hospitalId)).with(new Sort(Sort.Direction.DESC, "checkTime")), AntenatalExaminationModel.class); |
| 602 | 602 | |
| 603 | + Map<String, Object> xyMap = new HashMap<>(); | |
| 604 | + List<Integer> szyMin = new ArrayList<>(); | |
| 605 | + List<Integer> ssyMax = new ArrayList<>(); | |
| 606 | + List<Integer> xAxis = new ArrayList<>(); | |
| 607 | + List<Object> ssy = new ArrayList<>(); | |
| 608 | + List<Object> szy = new ArrayList<>(); | |
| 609 | + xyMap.put("szyMin", szyMin); | |
| 610 | + xyMap.put("ssyMax", ssyMax); | |
| 611 | + xyMap.put("xAxis", xAxis); | |
| 612 | + xyMap.put("ssy", ssy); | |
| 613 | + xyMap.put("szy", szy); | |
| 614 | + for (int i = 0; i <= 40; i++) { | |
| 615 | + ssyMax.add(140); | |
| 616 | + szyMin.add(60); | |
| 617 | + ssy.add(0); | |
| 618 | + szy.add(0); | |
| 619 | + xAxis.add(i); | |
| 620 | + } | |
| 621 | + | |
| 622 | + Map<String, Object> tzMap = new HashMap<>(); | |
| 623 | + Map<Integer, String> weights = new LinkedHashMap<>(); | |
| 624 | + boolean tzFlag = antExChuModel == null || StringUtils.isEmpty(antExChuModel.getYqWeight()) || StringUtils.isEmpty(antExChuModel.getHeight()) ? false : true; | |
| 625 | + | |
| 603 | 626 | for (AntenatalExaminationModel antexModel : antexModels) { |
| 604 | 627 | Map<String, Object> temp = new HashMap<>(); |
| 628 | + Integer week = DateUtil.getWeek(p.getLastMenses(), antexModel.getCheckDate()); | |
| 605 | 629 | temp.put("checkTime", DateUtil.getyyyy_MM_dd(antexModel.getCheckDate())); |
| 606 | - temp.put("week", DateUtil.getWeek(p.getLastMenses(), antexModel.getCheckDate())); | |
| 630 | + temp.put("week", week); | |
| 607 | 631 | temp.put("weight", antexModel.getWeight()); |
| 608 | - temp.put("bp", JSONObject.parseObject(antexModel.getBp()).getString("ssy") + "/" + JSONObject.parseObject(antexModel.getBp()).getString("szy")); | |
| 632 | + temp.put("bp", parseNull(JSONObject.parseObject(antexModel.getBp()).getString("ssy"), "--") + "/" + parseNull(JSONObject.parseObject(antexModel.getBp()).getString("szy"), "--")); | |
| 609 | 633 | temp.put("gonggao", antexModel.getGongGao()); |
| 610 | 634 | temp.put("abdominalCircumference", antexModel.getAbdominalCircumference());// ่ นๅด |
| 611 | 635 | |
| 612 | 636 | |
| 613 | 637 | |
| 614 | 638 | |
| 615 | 639 | |
| 616 | 640 | |
| 617 | 641 | |
| 618 | 642 | |
| 619 | 643 | |
| ... | ... | @@ -630,48 +654,181 @@ |
| 630 | 654 | temp.put("edema",FuZhongEnums.getName(antexModel.getEdema())); // ๆฐด่ฟ |
| 631 | 655 | temp.put("urineProtein", antexModel.getUrineProtein()); // ๅฐฟ่็ฝ |
| 632 | 656 | temp.put("hemoglobin", antexModel.getHemoglobin()); // ่ก็บข็ด |
| 657 | + | |
| 658 | + ssy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), 0)); | |
| 659 | + szy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), 0)); | |
| 660 | + if(tzFlag && antexModel.getWeight() != null) { | |
| 661 | + weights.put(DateUtil.getWeek2(p.getLastMenses(), antexModel.getCheckDate()), antexModel.getWeight() + ""); | |
| 662 | + } | |
| 663 | + | |
| 633 | 664 | restList.add(temp); |
| 634 | 665 | } |
| 635 | 666 | |
| 636 | 667 | // ๆทปๅ ๅ่ฏlist |
| 637 | - Map<String, Object> temp = new HashMap<>(); | |
| 638 | - temp.put("checkTime", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime())); | |
| 639 | - temp.put("week", DateUtil.getWeek(p.getLastMenses(), antExChuModel.getCheckTime())); | |
| 640 | - temp.put("weight", antExChuModel.getWeight()); | |
| 641 | - temp.put("bp", JSONObject.parseObject(antExChuModel.getBp()).getString("ssy") + "/" + JSONObject.parseObject(antExChuModel.getBp()).getString("szy")); | |
| 642 | - temp.put("gonggao", antExChuModel.getGonggao()); | |
| 643 | - temp.put("abdominalCircumference", antExChuModel.getFuwei());// ่ นๅด | |
| 668 | + if(antExChuModel != null) { | |
| 669 | + Map<String, Object> temp = new HashMap<>(); | |
| 670 | + temp.put("checkTime", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime())); | |
| 671 | + Integer week = DateUtil.getWeek(p.getLastMenses(), antExChuModel.getCheckTime()); | |
| 672 | + temp.put("week", week); | |
| 673 | + temp.put("weight", antExChuModel.getWeight()); | |
| 674 | + temp.put("bp", parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), "--") + "/" + parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), "--")); | |
| 675 | + temp.put("gonggao", antExChuModel.getGonggao()); | |
| 676 | + temp.put("abdominalCircumference", antExChuModel.getFuwei());// ่ นๅด | |
| 644 | 677 | |
| 645 | - List<Map> tireData = antExChuModel.getPlacentas(); | |
| 646 | - String fetalPosition = ""; | |
| 647 | - String heartRate = ""; | |
| 648 | - String fetalPresentation = ""; | |
| 649 | - if(CollectionUtils.isNotEmpty(tireData)) { | |
| 650 | - for (Map tireDatum : tireData) { | |
| 651 | - fetalPosition = fetalPosition.length() > 0 ? "/" + tireDatum.get("fetalPosition") : tireDatum.get("fetalPosition") + ""; | |
| 652 | - heartRate = heartRate.length() > 0 ? "/" + tireDatum.get("heartRate") : tireDatum.get("heartRate") + ""; | |
| 653 | - fetalPresentation = fetalPresentation.length() > 0 ? "/" + FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")) : FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")); | |
| 678 | + List<Map> tireData = antExChuModel.getPlacentas(); | |
| 679 | + String fetalPosition = ""; | |
| 680 | + String heartRate = ""; | |
| 681 | + String fetalPresentation = ""; | |
| 682 | + if(CollectionUtils.isNotEmpty(tireData)) { | |
| 683 | + for (Map tireDatum : tireData) { | |
| 684 | + fetalPosition = fetalPosition.length() > 0 ? "/" + tireDatum.get("fetalPosition") : tireDatum.get("fetalPosition") + ""; | |
| 685 | + heartRate = heartRate.length() > 0 ? "/" + tireDatum.get("heartRate") : tireDatum.get("heartRate") + ""; | |
| 686 | + fetalPresentation = fetalPresentation.length() > 0 ? "/" + FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")) : FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")); | |
| 687 | + } | |
| 688 | + } else { | |
| 689 | + fetalPosition = "--"; | |
| 690 | + heartRate = "--"; | |
| 691 | + fetalPresentation = "--"; | |
| 654 | 692 | } |
| 655 | - } else { | |
| 656 | - fetalPosition = "--"; | |
| 657 | - heartRate = "--"; | |
| 658 | - fetalPresentation = "--"; | |
| 693 | + | |
| 694 | + temp.put("fetalPosition", fetalPosition); // ่ไฝ | |
| 695 | + temp.put("heartRate", heartRate); // ่ๅฟ | |
| 696 | + temp.put("fetalPresentation", fetalPresentation); // ๅ ้ฒ | |
| 697 | + temp.put("edema",FuZhongEnums.getName(antExChuModel.getEdema())); // ๆฐด่ฟ | |
| 698 | + temp.put("urineProtein", antExChuModel.getNdb()); // ๅฐฟ่็ฝ | |
| 699 | + temp.put("hemoglobin", antExChuModel.getXhdb()); // ่ก็บข็ด | |
| 700 | + | |
| 701 | + ssy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), 0)); | |
| 702 | + szy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), 0)); | |
| 703 | + | |
| 704 | + restList.add(temp); | |
| 659 | 705 | } |
| 660 | 706 | |
| 661 | - temp.put("fetalPosition", fetalPosition); // ่ไฝ | |
| 662 | - temp.put("heartRate", heartRate); // ่ๅฟ | |
| 663 | - temp.put("fetalPresentation", fetalPresentation); // ๅ ้ฒ | |
| 664 | - temp.put("edema",FuZhongEnums.getName(antExChuModel.getEdema())); // ๆฐด่ฟ | |
| 665 | - temp.put("urineProtein", antExChuModel.getNdb()); // ๅฐฟ่็ฝ | |
| 666 | - temp.put("hemoglobin", antExChuModel.getXhdb()); // ่ก็บข็ด | |
| 667 | - restList.add(temp); | |
| 707 | + /*if (MapUtils.isNotEmpty(dayWeights)) { | |
| 708 | + Set<Map.Entry<String, String>> entries = dayWeights.entrySet(); | |
| 709 | + for (Map.Entry<String, String> entry : entries) { | |
| 710 | + weights.put(DateUtil.getWeek2(patients.getLastMenses(), DateUtil.parseYMD(entry.getKey())), entry.getValue()); | |
| 711 | + } | |
| 712 | + }*/ | |
| 713 | + if(tzFlag) { | |
| 714 | + setReport(tzMap, weights, antExChuModel.getYqWeight(), PatientWeightServiceImpl.getBmi(antExChuModel.getYqWeight(), antExChuModel.getHeight())); | |
| 715 | + } | |
| 668 | 716 | |
| 669 | - Map<String, Object> xtMap = new HashMap<>(); | |
| 670 | - Map<String, Object> tzMap = new HashMap<>(); | |
| 717 | + return RespBuilder.buildSuccess("tabList", restList, "xyMap", xyMap, "tzMap", tzMap); | |
| 718 | + } | |
| 671 | 719 | |
| 720 | + public void setReport(Map<String, Object> restMap, Map<Integer, String> weights, String beforeWeight, String bmi) { | |
| 721 | + List<Map<String, Object>> restList = new ArrayList<>(); | |
| 722 | + // ๅฐ็จๅบๅappๅฏ่ฝๆฒกๆbmi ้ป่ฎค่ฟๅๆ ๅ | |
| 723 | + Double bmiD = 20D; | |
| 724 | + if(StringUtils.isNotEmpty(bmi)) { | |
| 725 | + bmiD = Double.parseDouble(bmi); | |
| 726 | + } | |
| 727 | + String title = ""; | |
| 728 | + String color = ""; | |
| 729 | + double low = 0D; | |
| 730 | + double low2 = 0D; | |
| 731 | + double high = 0D; | |
| 732 | + double high2 = 0D; | |
| 733 | + if(bmiD <= 18.5) { | |
| 734 | + title = "ไฝไฝ้ๆจ่ๅข้ๅๅผ"; | |
| 735 | + low = 1.2; | |
| 736 | + low2 = 11.9; | |
| 737 | + high = 3.8; | |
| 738 | + high2 = 18.1; | |
| 739 | + color = "#00CD00"; | |
| 740 | + } else if(bmiD > 18.5 && bmiD <= 24.9){ | |
| 741 | + title = "ๆ ๅไฝ้ๆจ่ๅข้ๅๅผ"; | |
| 742 | + low = 1.4; | |
| 743 | + low2 = 11.9; | |
| 744 | + high = 3.2; | |
| 745 | + high2 = 15.9; | |
| 746 | + color = "#7EC0EE"; | |
| 747 | + } else if(bmiD > 24.9 && bmiD < 30){ | |
| 748 | + title = "่ถ ้ไฝ้ๆจ่ๅข้ๅๅผ"; | |
| 749 | + low = 1.1 ; | |
| 750 | + low2 = 7.1; | |
| 751 | + high = 3.1; | |
| 752 | + high2 = 11.6; | |
| 753 | + color = "#CD3333"; | |
| 754 | + } else if(bmiD >= 30){ | |
| 755 | + title = "่ฅ่ไฝ้ๆจ่ๅข้ๅๅผ"; | |
| 756 | + low = 0.8 ; | |
| 757 | + low2 = 4.9; | |
| 758 | + high = 2.1; | |
| 759 | + high2 = 8.9; | |
| 760 | + color = "#CD00CD"; | |
| 761 | + } | |
| 672 | 762 | |
| 763 | + Map<Integer, Double> highMap = new LinkedHashMap<>(); | |
| 764 | + Map<Integer, Double> normalMap = new LinkedHashMap<>(); | |
| 765 | + Map<Integer, Double> lowMap = new LinkedHashMap<>(); | |
| 766 | + List<Integer> xAxis = new ArrayList<>(); | |
| 767 | + double avg = low / 13; | |
| 768 | + for (int i = 0; i <= 13; i++) { | |
| 769 | + lowMap.put(i, i * avg); | |
| 770 | + } | |
| 771 | + double avg2 = (low2 - low) / 27; | |
| 772 | + for (int i = 1; i <= 27; i++) { | |
| 773 | + lowMap.put(13 + i, low + i * avg2); | |
| 774 | + } | |
| 775 | + double highAvg = high / 13; | |
| 776 | + for (int i = 0; i <= 13; i++) { | |
| 777 | + highMap.put(i, i * highAvg); | |
| 778 | + } | |
| 779 | + double highAvg2 = (high2 - high) / 27; | |
| 780 | + for (int i = 1; i <= 27; i++) { | |
| 781 | + highMap.put(13 + i, high + i * highAvg2); | |
| 782 | + } | |
| 783 | + for (int i = 0; i <= 40; i++) { | |
| 784 | + normalMap.put(i, (highMap.get(i) + lowMap.get(i)) / 2); | |
| 785 | + } | |
| 673 | 786 | |
| 674 | - return RespBuilder.buildSuccess(restList); | |
| 787 | + Map<String, Object> reportModel = new LinkedHashMap<>(); | |
| 788 | + Map<String, Object> series = new LinkedHashMap<>(); | |
| 789 | + series.put("lowData", MathUtil.doubleFormat2(CollectionUtils.getValList(lowMap))); | |
| 790 | + series.put("highData", MathUtil.doubleFormat2(CollectionUtils.getValList(highMap))); | |
| 791 | + series.put("normalData", MathUtil.doubleFormat2(CollectionUtils.getValList(normalMap))); | |
| 792 | + | |
| 793 | + series.put("dayWeights", restList); | |
| 794 | + | |
| 795 | + reportModel.put("series", series); | |
| 796 | + | |
| 797 | + reportModel.put("title", title); | |
| 798 | + reportModel.put("color", color); | |
| 799 | + | |
| 800 | + for (int i = 0; i <= 40; i++) { | |
| 801 | + xAxis.add(i); | |
| 802 | + } | |
| 803 | + reportModel.put("xAxis", xAxis); | |
| 804 | + | |
| 805 | + List<Object> list = new ArrayList<>(); | |
| 806 | + if(MapUtils.isNotEmpty(weights)) { | |
| 807 | + Iterator<Map.Entry<Integer, String>> iterator = weights.entrySet().iterator(); | |
| 808 | + while (iterator.hasNext()) { | |
| 809 | + Map.Entry<Integer, String> next = iterator.next(); | |
| 810 | + list.add(Arrays.asList(next.getKey(), getDiff(beforeWeight, next.getValue()))); | |
| 811 | + } | |
| 812 | + } | |
| 813 | + series.put("portData", list); | |
| 814 | + series.put("portData", list); | |
| 815 | + restMap.put("reportModel", reportModel); | |
| 816 | + } | |
| 817 | + | |
| 818 | + private Double getDiff(String before, String now) { | |
| 819 | + if(StringUtils.isEmpty(before) || StringUtils.isEmpty(now)) { | |
| 820 | + return 0D; | |
| 821 | + } | |
| 822 | + Double b = Double.parseDouble(before); | |
| 823 | + Double n = Double.parseDouble(now); | |
| 824 | + return MathUtil.doubleFormat2(n - b); | |
| 825 | + } | |
| 826 | + | |
| 827 | + private Object parseNull(String s, Object defaultVal) { | |
| 828 | + if(StringUtils.isEmpty(s)) { | |
| 829 | + return defaultVal; | |
| 830 | + } | |
| 831 | + return s; | |
| 675 | 832 | } |
| 676 | 833 | |
| 677 | 834 | private List<Patients> getPatients(String provinceId, String cityId, String aredId, String streetId, |