Commit f56d87617b3f3197cc93087cac5ca5bfb10453f5
1 parent
de3ae7109e
Exists in
master
and in
6 other branches
改逻辑
Showing 1 changed file with 107 additions and 46 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
f56d876
... | ... | @@ -750,69 +750,42 @@ |
750 | 750 | if(StringUtils.isNotEmpty(bmi)) { |
751 | 751 | bmiD = Double.parseDouble(bmi); |
752 | 752 | } |
753 | - double low = 0D; | |
754 | - double low2 = 0D; | |
755 | - double high = 0D; | |
756 | - double high2 = 0D; | |
753 | + List<Double> highData = new ArrayList<>(); | |
754 | + List<Double> normalData = new ArrayList<>(); | |
755 | + List<Double> lowData = new ArrayList<>(); | |
757 | 756 | String color = ""; |
758 | 757 | if(bmiD <= 18.5) { |
759 | - low = 1.2; | |
760 | - low2 = 11.9; | |
761 | - high = 3.8; | |
762 | - high2 = 18.1; | |
758 | + highData = getDoubleList(Arrays.asList("0.0,0.3,0.6,0.9,1.2,1.5,1.8,2.0,2.3,2.6,2.9,3.2,3.5,3.8,4.3,4.9,5.4,5.9,6.4,7.0,7.5,8.0,8.6,9.1,9.6,10.2,10.7,11.2,11.7,12.3,12.8,13.3,13.9,14.4,14.9,15.5,16.0,16.5,17.0,17.6,18.1".split(","))); | |
759 | + normalData = getDoubleList(Arrays.asList("0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.3,1.5,1.7,1.9,2.1,2.3,2.5,3.0,3.4,3.9,4.4,4.8,5.3,5.7,6.2,6.7,7.1,7.6,8.1,8.5,9.0,9.4,9.9,10.4,10.8,11.3,11.8,12.2,12.7,13.1,13.6,14.1,14.5,15.0".split(","))); | |
760 | + lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.6,2.0,2.4,2.8,3.2,3.6,4.0,4.4,4.8,5.2,5.6,6.0,6.4,6.7,7.1,7.5,7.9,8.3,8.7,9.1,9.5,9.9,10.3,10.7,11.1,11.5,11.9".split(","))); | |
763 | 761 | color = "#00CD00"; |
764 | 762 | } else if(bmiD > 18.5 && bmiD <= 24.9){ |
765 | - low = 1.4; | |
766 | - low2 = 11.9; | |
767 | - high = 3.2; | |
768 | - high2 = 15.9; | |
763 | + highData = getDoubleList(Arrays.asList("0.0,0.2,0.5,0.7,1.0,1.2,1.5,1.7,2.0,2.2,2.5,2.7,3.0,3.2,3.7,4.1,4.6,5.1,5.6,6.0,6.5,7.0,7.4,7.9,8.4,8.8,9.3,9.8,10.3,10.7,11.2,11.7,12.1,12.6,13.1,13.5,14.0,14.5,15.0,15.4,15.9".split(","))); | |
764 | + normalData = getDoubleList(Arrays.asList("0.0,0.2,0.4,0.5,0.7,0.9,1.1,1.2,1.4,1.6,1.8,1.9,2.1,2.3,2.7,3.2,3.6,4.0,4.4,4.9,5.3,5.7,6.2,6.6,7.0,7.5,7.9,8.3,8.7,9.2,9.6,10.0,10.5,10.9,11.3,11.8,12.2,12.6,13.0,13.5,13.9".split(","))); | |
765 | + lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.8,2.2,2.6,3.0,3.3,3.7,4.1,4.5,4.9,5.3,5.7,6.1,6.5,6.8,7.2,7.6,8.0,8.4,8.8,9.2,9.6,10.0,10.3,10.7,11.1,11.5,11.9".split(","))); | |
769 | 766 | color = "#7EC0EE"; |
770 | 767 | } else if(bmiD > 24.9 && bmiD < 30){ |
771 | - low = 1.1 ; | |
772 | - low2 = 7.1; | |
773 | - high = 3.1; | |
774 | - high2 = 11.6; | |
768 | + highData = getDoubleList(Arrays.asList("0.0,0.2,0.5,0.7,1.0,1.2,1.4,1.7,1.9,2.1,2.4,2.6,2.9,3.1,3.4,3.7,4.0,4.4,4.7,5.0,5.3,5.6,5.9,6.2,6.6,6.9,7.2,7.5,7.8,8.1,8.5,8.8,9.1,9.4,9.7,10.0,10.3,10.7,11.0,11.3,11.6".split(","))); | |
769 | + normalData = getDoubleList(Arrays.asList("0.0,0.2,0.3,0.5,0.6,0.8,1.0,1.1,1.3,1.5,1.6,1.8,1.9,2.1,2.4,2.6,2.9,3.2,3.4,3.7,4.0,4.2,4.5,4.8,5.1,5.3,5.6,5.9,6.1,6.4,6.7,6.9,7.2,7.5,7.7,8.0,8.3,8.5,8.8,9.1,9.3".split(","))); | |
770 | + lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.3,0.4,0.5,0.6,0.7,0.8,0.8,0.9,1.0,1.1,1.3,1.5,1.8,2.0,2.2,2.4,2.7,2.9,3.1,3.3,3.5,3.8,4.0,4.2,4.4,4.7,4.9,5.1,5.3,5.5,5.8,6.0,6.2,6.4,6.7,6.9,7.1".split(","))); | |
775 | 771 | color = "#CD3333"; |
776 | 772 | } else if(bmiD >= 30){ |
777 | - low = 0.8 ; | |
778 | - low2 = 4.9; | |
779 | - high = 2.1; | |
780 | - high2 = 8.9; | |
773 | + highData = getDoubleList(Arrays.asList("0.0,0.2,0.3,0.5,0.6,0.8,1.0,1.1,1.3,1.5,1.6,1.8,1.9,2.1,2.4,2.6,2.9,3.1,3.4,3.6,3.9,4.1,4.4,4.6,4.9,5.1,5.4,5.6,5.9,6.1,6.4,6.6,6.9,7.1,7.4,7.6,7.9,8.1,8.4,8.6,8.9".split(","))); | |
774 | + normalData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.5,1.7,1.9,2.1,2.3,2.5,2.7,2.9,3.1,3.3,3.5,3.7,3.9,4.1,4.3,4.5,4.7,4.9,5.1,5.3,5.5,5.7,5.9,6.1,6.3,6.5,6.7,6.9".split(","))); | |
775 | + lowData = getDoubleList(Arrays.asList("0.0,0.1,0.1,0.2,0.2,0.3,0.4,0.4,0.5,0.6,0.6,0.7,0.7,0.8,1.0,1.1,1.3,1.4,1.6,1.7,1.9,2.0,2.2,2.3,2.5,2.6,2.8,2.9,3.1,3.2,3.4,3.5,3.7,3.8,4.0,4.1,4.3,4.4,4.6,4.7,4.9".split(","))); | |
781 | 776 | color = "#CD00CD"; |
782 | 777 | } |
783 | 778 | |
784 | - Map<Integer, Double> highMap = new HashMap<>(); | |
785 | - Map<Integer, Double> normalMap = new HashMap<>(); | |
786 | - Map<Integer, Double> lowMap = new HashMap<>(); | |
787 | 779 | List<Integer> xAxis = new ArrayList<>(); |
788 | - double avg = low / 13; | |
789 | - for (int i = 0; i <= 13; i++) { | |
790 | - lowMap.put(i, i * avg); | |
791 | - } | |
792 | - double avg2 = (low2 - low) / 27; | |
793 | - for (int i = 1; i <= 27; i++) { | |
794 | - lowMap.put(13 + i, low + i * avg2); | |
795 | - } | |
796 | - double highAvg = high / 13; | |
797 | - for (int i = 0; i <= 13; i++) { | |
798 | - highMap.put(i, i * highAvg); | |
799 | - } | |
800 | - double highAvg2 = (high2 - high) / 27; | |
801 | - for (int i = 1; i <= 27; i++) { | |
802 | - highMap.put(13 + i, high + i * highAvg2); | |
803 | - } | |
804 | - for (int i = 0; i <= 40; i++) { | |
805 | - normalMap.put(i, (highMap.get(i) + lowMap.get(i)) / 2); | |
806 | - } | |
807 | 780 | |
808 | 781 | Map<String, Object> reportModel = new HashMap<>(); |
809 | 782 | Map<String, Object> series = new HashMap<>(); |
810 | 783 | // series.put("lowData", MathUtil.doubleFormat2(CollectionUtils.getValList(lowMap))); |
811 | 784 | // series.put("highData", MathUtil.doubleFormat2(CollectionUtils.getValList(highMap))); |
812 | 785 | // series.put("normalData", MathUtil.doubleFormat2(CollectionUtils.getValList(normalMap))); |
813 | - series.put("lowData", delOtherPort(CollectionUtils.getValList(lowMap))); | |
814 | - series.put("highData", delOtherPort(CollectionUtils.getValList(highMap))); | |
815 | - series.put("normalData", delOtherPort(CollectionUtils.getValList(normalMap))); | |
786 | + series.put("lowData", lowData); | |
787 | + series.put("highData", highData); | |
788 | + series.put("normalData", normalData); | |
816 | 789 | |
817 | 790 | series.put("dayWeights", restList); |
818 | 791 | |
819 | 792 | |
... | ... | @@ -867,7 +840,95 @@ |
867 | 840 | return restList; |
868 | 841 | } |
869 | 842 | |
843 | + public List<Double> getDoubleList(List<String> list) { | |
844 | + List<Double> rest = new ArrayList<>(); | |
845 | + for (String s : list) { | |
846 | + rest.add(Double.parseDouble(s)); | |
847 | + } | |
848 | + return rest; | |
849 | + } | |
850 | + | |
870 | 851 | public void setReport(Map<String, Object> restMap, Map<Integer, String> weights, String beforeWeight, String bmi, Map<String, String> dayWeights) { |
852 | + List<Map<String, Object>> restList = new ArrayList<>(); | |
853 | + if(MapUtils.isNotEmpty(dayWeights)) { | |
854 | + for (String key : dayWeights.keySet()) { | |
855 | + Map<String, Object> temp = new HashMap<>(); | |
856 | + temp.put("nowWeight", dayWeights.get(key)); | |
857 | + temp.put("recordTime", key); | |
858 | + restList.add(temp); | |
859 | + } | |
860 | + } | |
861 | + | |
862 | + List<Double> highData = new ArrayList<>(); | |
863 | + List<Double> normalData = new ArrayList<>(); | |
864 | + List<Double> lowData = new ArrayList<>(); | |
865 | + // 小程序和app可能没有bmi 默认返回标准 | |
866 | + Double bmiD = 20D; | |
867 | + if(StringUtils.isNotEmpty(bmi)) { | |
868 | + bmiD = Double.parseDouble(bmi); | |
869 | + } | |
870 | + String title = ""; | |
871 | + String color = ""; | |
872 | + if(bmiD <= 18.5) { | |
873 | + title = "低体重推荐增重均值"; | |
874 | + highData = getDoubleList(Arrays.asList("0.0,0.3,0.6,0.9,1.2,1.5,1.8,2.0,2.3,2.6,2.9,3.2,3.5,3.8,4.3,4.9,5.4,5.9,6.4,7.0,7.5,8.0,8.6,9.1,9.6,10.2,10.7,11.2,11.7,12.3,12.8,13.3,13.9,14.4,14.9,15.5,16.0,16.5,17.0,17.6,18.1".split(","))); | |
875 | + normalData = getDoubleList(Arrays.asList("0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.3,1.5,1.7,1.9,2.1,2.3,2.5,3.0,3.4,3.9,4.4,4.8,5.3,5.7,6.2,6.7,7.1,7.6,8.1,8.5,9.0,9.4,9.9,10.4,10.8,11.3,11.8,12.2,12.7,13.1,13.6,14.1,14.5,15.0".split(","))); | |
876 | + lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.6,2.0,2.4,2.8,3.2,3.6,4.0,4.4,4.8,5.2,5.6,6.0,6.4,6.7,7.1,7.5,7.9,8.3,8.7,9.1,9.5,9.9,10.3,10.7,11.1,11.5,11.9".split(","))); | |
877 | + color = "#00CD00"; | |
878 | + } else if(bmiD > 18.5 && bmiD <= 24.9){ | |
879 | + title = "标准体重推荐增重均值"; | |
880 | + highData = getDoubleList(Arrays.asList("0.0,0.2,0.5,0.7,1.0,1.2,1.5,1.7,2.0,2.2,2.5,2.7,3.0,3.2,3.7,4.1,4.6,5.1,5.6,6.0,6.5,7.0,7.4,7.9,8.4,8.8,9.3,9.8,10.3,10.7,11.2,11.7,12.1,12.6,13.1,13.5,14.0,14.5,15.0,15.4,15.9".split(","))); | |
881 | + normalData = getDoubleList(Arrays.asList("0.0,0.2,0.4,0.5,0.7,0.9,1.1,1.2,1.4,1.6,1.8,1.9,2.1,2.3,2.7,3.2,3.6,4.0,4.4,4.9,5.3,5.7,6.2,6.6,7.0,7.5,7.9,8.3,8.7,9.2,9.6,10.0,10.5,10.9,11.3,11.8,12.2,12.6,13.0,13.5,13.9".split(","))); | |
882 | + lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.8,2.2,2.6,3.0,3.3,3.7,4.1,4.5,4.9,5.3,5.7,6.1,6.5,6.8,7.2,7.6,8.0,8.4,8.8,9.2,9.6,10.0,10.3,10.7,11.1,11.5,11.9".split(","))); | |
883 | + color = "#7EC0EE"; | |
884 | + } else if(bmiD > 24.9 && bmiD < 30){ | |
885 | + title = "超重体重推荐增重均值"; | |
886 | + highData = getDoubleList(Arrays.asList("0.0,0.2,0.5,0.7,1.0,1.2,1.4,1.7,1.9,2.1,2.4,2.6,2.9,3.1,3.4,3.7,4.0,4.4,4.7,5.0,5.3,5.6,5.9,6.2,6.6,6.9,7.2,7.5,7.8,8.1,8.5,8.8,9.1,9.4,9.7,10.0,10.3,10.7,11.0,11.3,11.6".split(","))); | |
887 | + normalData = getDoubleList(Arrays.asList("0.0,0.2,0.3,0.5,0.6,0.8,1.0,1.1,1.3,1.5,1.6,1.8,1.9,2.1,2.4,2.6,2.9,3.2,3.4,3.7,4.0,4.2,4.5,4.8,5.1,5.3,5.6,5.9,6.1,6.4,6.7,6.9,7.2,7.5,7.7,8.0,8.3,8.5,8.8,9.1,9.3".split(","))); | |
888 | + lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.3,0.4,0.5,0.6,0.7,0.8,0.8,0.9,1.0,1.1,1.3,1.5,1.8,2.0,2.2,2.4,2.7,2.9,3.1,3.3,3.5,3.8,4.0,4.2,4.4,4.7,4.9,5.1,5.3,5.5,5.8,6.0,6.2,6.4,6.7,6.9,7.1".split(","))); | |
889 | + color = "#CD3333"; | |
890 | + } else if(bmiD >= 30){ | |
891 | + title = "肥胖体重推荐增重均值"; | |
892 | + highData = getDoubleList(Arrays.asList("0.0,0.2,0.3,0.5,0.6,0.8,1.0,1.1,1.3,1.5,1.6,1.8,1.9,2.1,2.4,2.6,2.9,3.1,3.4,3.6,3.9,4.1,4.4,4.6,4.9,5.1,5.4,5.6,5.9,6.1,6.4,6.6,6.9,7.1,7.4,7.6,7.9,8.1,8.4,8.6,8.9".split(","))); | |
893 | + normalData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.5,1.7,1.9,2.1,2.3,2.5,2.7,2.9,3.1,3.3,3.5,3.7,3.9,4.1,4.3,4.5,4.7,4.9,5.1,5.3,5.5,5.7,5.9,6.1,6.3,6.5,6.7,6.9".split(","))); | |
894 | + lowData = getDoubleList(Arrays.asList("0.0,0.1,0.1,0.2,0.2,0.3,0.4,0.4,0.5,0.6,0.6,0.7,0.7,0.8,1.0,1.1,1.3,1.4,1.6,1.7,1.9,2.0,2.2,2.3,2.5,2.6,2.8,2.9,3.1,3.2,3.4,3.5,3.7,3.8,4.0,4.1,4.3,4.4,4.6,4.7,4.9".split(","))); | |
895 | + color = "#CD00CD"; | |
896 | + } | |
897 | + | |
898 | + List<Integer> xAxis = new ArrayList<>(); | |
899 | + | |
900 | + Map<String, Object> reportModel = new HashMap<>(); | |
901 | + Map<String, Object> series = new HashMap<>(); | |
902 | + series.put("lowData", lowData); | |
903 | + series.put("highData", highData); | |
904 | + series.put("normalData", normalData); | |
905 | + | |
906 | + series.put("dayWeights", restList); | |
907 | + | |
908 | + reportModel.put("series", series); | |
909 | + | |
910 | + reportModel.put("title", title); | |
911 | + reportModel.put("color", color); | |
912 | + | |
913 | + for (int i = 0; i <= 40; i++) { | |
914 | + xAxis.add(i); | |
915 | + } | |
916 | + reportModel.put("xAxis", xAxis); | |
917 | + | |
918 | + List<Object> list = new ArrayList<>(); | |
919 | + if(MapUtils.isNotEmpty(weights)) { | |
920 | + Iterator<Map.Entry<Integer, String>> iterator = weights.entrySet().iterator(); | |
921 | + while (iterator.hasNext()) { | |
922 | + Map.Entry<Integer, String> next = iterator.next(); | |
923 | + list.add(Arrays.asList(next.getKey(), getDiff(beforeWeight, next.getValue()))); | |
924 | + } | |
925 | + } | |
926 | + series.put("portData", list); | |
927 | + series.put("portData", list); | |
928 | + restMap.put("reportModel", reportModel); | |
929 | + } | |
930 | + | |
931 | + /*public void setReport(Map<String, Object> restMap, Map<Integer, String> weights, String beforeWeight, String bmi, Map<String, String> dayWeights) { | |
871 | 932 | logger.info("restMap>> " + restMap); |
872 | 933 | logger.info("weights>> " + weights); |
873 | 934 | logger.info("beforeWeight>> " + beforeWeight); |
... | ... | @@ -977,7 +1038,7 @@ |
977 | 1038 | series.put("portData", list); |
978 | 1039 | series.put("portData", list); |
979 | 1040 | restMap.put("reportModel", reportModel); |
980 | - } | |
1041 | + }*/ | |
981 | 1042 | |
982 | 1043 | /** |
983 | 1044 | * 获取两个体重之间相差的数值 |