Commit 22ea269289046aceed98b029167570abb1ef052c
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 4 changed files
- platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyStatisticsManagerController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
View file @
22ea269
... | ... | @@ -1389,8 +1389,8 @@ |
1389 | 1389 | //短信前缀 |
1390 | 1390 | String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); |
1391 | 1391 | String messageContent = "【" + messagePrefix + "】" + template.getContent(); |
1392 | - //暂无需要替换的变量值 | |
1393 | - // messageContent = HelperUtils.replaceEL(pat.getUsername(), yuYueDate, messageContent); | |
1392 | + //替换的变量值 | |
1393 | + messageContent = HelperUtils.replaceEL(pat.getUsername(), yuYueDate, messageContent); | |
1394 | 1394 | |
1395 | 1395 | String checkTimeStr = DateUtils.getDateStr(yuYueDate, DateUtils.Y_M_D); |
1396 | 1396 | String checkName = "产前检查"; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyStatisticsManagerController.java
View file @
22ea269
... | ... | @@ -374,7 +374,7 @@ |
374 | 374 | // jdbc查oracle |
375 | 375 | // List<Map<String, Object>> list = JdbcUtil.getOracleListDataBySql("com.mysql.jdbc.Driver", "jdbc:oracle:thin:@127.0.0.1:1521:orcl", "LYMS_ODS", "Welcome1", sql); |
376 | 376 | ExceptionUtils.catchException("babyStatisticsManagerSelfConversionList: " + sql); |
377 | - List<Map<String, Object>> list = JdbcUtil.getOracleListDataBySql("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@"+area_count_url+":orcl", "LYMS_ODS", "Welcome1", sql); | |
377 | + List<Map<String, Object>> list = JdbcUtil.getOracleListDataBySql("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@" + area_count_url + ":orcl", "LYMS_ODS", "Welcome1", sql); | |
378 | 378 | // List<Map<String, Object>> list = new ArrayList<>(); |
379 | 379 | // Map<String, Object> m1 = new HashMap<>(); |
380 | 380 | // m1.put("1", "1"); |
... | ... | @@ -445,7 +445,7 @@ |
445 | 445 | // jdbc查oracle |
446 | 446 | // List<Map<String, Object>> list = JdbcUtil.getOracleListDataBySql("com.mysql.jdbc.Driver", "jdbc:oracle:thin:@127.0.0.1:1521:orcl", "LYMS_ODS", "Welcome1", sql); |
447 | 447 | ExceptionUtils.catchException("babyStatisticsManagerBuildSourceList: " + sql); |
448 | - List<Map<String, Object>> list = JdbcUtil.getOracleListDataBySql("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@"+area_count_url+":orcl", "LYMS_ODS", "Welcome1", sql); | |
448 | + List<Map<String, Object>> list = JdbcUtil.getOracleListDataBySql("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@" + area_count_url + ":orcl", "LYMS_ODS", "Welcome1", sql); | |
449 | 449 | // List<Map<String, Object>> list = new ArrayList<>(); |
450 | 450 | // Map<String, Object> m1 = new HashMap<>(); |
451 | 451 | // m1.put("1", "1"); |
... | ... | @@ -562,5 +562,16 @@ |
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
565 | + /** | |
566 | + * 儿保统计概率 | |
567 | + */ | |
568 | + @RequestMapping(value = "/babyStatisticalProbability", method = RequestMethod.GET) | |
569 | + @TokenRequired | |
570 | + @ResponseBody | |
571 | + public BaseObjectResponse babyStatisticalProbability(Integer babyMonthAge, HttpServletRequest request) { | |
572 | + | |
573 | + return babyStatisticsManagerFacade.babyStatisticalProbability(babyMonthAge, getUserId(request)); | |
574 | + | |
575 | + } | |
565 | 576 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java
View file @
22ea269
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
7 | 7 | import com.lyms.platform.common.enums.SexEnum; |
8 | 8 | import com.lyms.platform.common.enums.YnEnums; |
9 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
9 | 10 | import com.lyms.platform.common.utils.DateUtil; |
10 | 11 | import com.lyms.platform.common.utils.ExceptionUtils; |
11 | 12 | import com.lyms.platform.common.utils.JsonUtil; |
... | ... | @@ -639,7 +640,7 @@ |
639 | 640 | "END)"; |
640 | 641 | // jdbc查oracle |
641 | 642 | ExceptionUtils.catchException("babyStatisticsManagerBuildSourceList: " + sql); |
642 | - List<Map<String, Object>> list = JdbcUtil.getOracleListDataBySql("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@"+area_count_url+":orcl", "LYMS_ODS", "Welcome1", sql); | |
643 | + List<Map<String, Object>> list = JdbcUtil.getOracleListDataBySql("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@" + area_count_url + ":orcl", "LYMS_ODS", "Welcome1", sql); | |
643 | 644 | // List<Map<String, Object>> list = new ArrayList<>(); |
644 | 645 | // Map<String, Object> m1 = new HashMap<>(); |
645 | 646 | // m1.put("LB_NAME", "本院分娩"); |
... | ... | @@ -795,7 +796,7 @@ |
795 | 796 | |
796 | 797 | // jdbc查oracle |
797 | 798 | ExceptionUtils.catchException("babyStatisticsManagerSelfConversionList: " + sql); |
798 | - List<Map<String, Object>> list = JdbcUtil.getOracleListDataBySql("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@"+area_count_url+":orcl", "LYMS_ODS", "Welcome1", sql); | |
799 | + List<Map<String, Object>> list = JdbcUtil.getOracleListDataBySql("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@" + area_count_url + ":orcl", "LYMS_ODS", "Welcome1", sql); | |
799 | 800 | |
800 | 801 | Collections.sort(list, new Comparator<Map<String, Object>>() { |
801 | 802 | @Override |
802 | 803 | |
... | ... | @@ -828,14 +829,11 @@ |
828 | 829 | Integer total = 0; |
829 | 830 | List<Integer> temp = new LinkedList<>(); |
830 | 831 | for (Integer i = 0; i < 36; i++) { |
831 | - if (CollectionUtils.isNotEmpty(list)) | |
832 | - { | |
832 | + if (CollectionUtils.isNotEmpty(list)) { | |
833 | 833 | int tempCount = 0; |
834 | - for (int j = 0,len = list.size();j < len ;j++) | |
835 | - { | |
836 | - if (list.get(j).get("EXAMINE_MONTH") != null && Integer.valueOf(list.get(j).get("EXAMINE_MONTH").toString()) == i) | |
837 | - { | |
838 | - tempCount+=Integer.valueOf(list.get(j).get("CNT").toString()); | |
834 | + for (int j = 0, len = list.size(); j < len; j++) { | |
835 | + if (list.get(j).get("EXAMINE_MONTH") != null && Integer.valueOf(list.get(j).get("EXAMINE_MONTH").toString()) == i) { | |
836 | + tempCount += Integer.valueOf(list.get(j).get("CNT").toString()); | |
839 | 837 | break; |
840 | 838 | } |
841 | 839 | } |
842 | 840 | |
... | ... | @@ -844,14 +842,12 @@ |
844 | 842 | } |
845 | 843 | |
846 | 844 | |
847 | - for (int j = 0,len = list.size();j < len ;j++) | |
848 | - { | |
849 | - if (list.get(j).get("EXAMINE_MONTH") == null || Integer.valueOf(list.get(j).get("EXAMINE_MONTH").toString()) > 36) | |
850 | - { | |
851 | - nocheckCount+=Integer.valueOf(list.get(j).get("CNT").toString()); | |
845 | + for (int j = 0, len = list.size(); j < len; j++) { | |
846 | + if (list.get(j).get("EXAMINE_MONTH") == null || Integer.valueOf(list.get(j).get("EXAMINE_MONTH").toString()) > 36) { | |
847 | + nocheckCount += Integer.valueOf(list.get(j).get("CNT").toString()); | |
852 | 848 | } |
853 | 849 | |
854 | - total+=Integer.valueOf(list.get(j).get("CNT").toString()); | |
850 | + total += Integer.valueOf(list.get(j).get("CNT").toString()); | |
855 | 851 | } |
856 | 852 | |
857 | 853 | |
858 | 854 | |
859 | 855 | |
860 | 856 | |
861 | 857 | |
862 | 858 | |
863 | 859 | |
864 | 860 | |
865 | 861 | |
866 | 862 | |
867 | 863 | |
868 | 864 | |
869 | 865 | |
... | ... | @@ -867,66 +863,47 @@ |
867 | 863 | babyCount.add(total); |
868 | 864 | percent.add("100%"); |
869 | 865 | |
870 | - if (CollectionUtils.isNotEmpty(temp)) | |
871 | - { | |
866 | + if (CollectionUtils.isNotEmpty(temp)) { | |
872 | 867 | int count = 0; |
873 | - for(int i = 0; i < temp.size(); i++) | |
874 | - { | |
875 | - count+=temp.get(i); | |
876 | - if (i < 12) | |
877 | - { | |
878 | - resultOther.add(total-count); | |
868 | + for (int i = 0; i < temp.size(); i++) { | |
869 | + count += temp.get(i); | |
870 | + if (i < 12) { | |
871 | + resultOther.add(total - count); | |
879 | 872 | result.add(count); |
880 | - if (i == 0) | |
881 | - { | |
873 | + if (i == 0) { | |
882 | 874 | babyCount.add(count); |
883 | - percent.add(percent(count,total)); | |
884 | - } | |
885 | - else if (i == 2) | |
886 | - { | |
875 | + percent.add(percent(count, total)); | |
876 | + } else if (i == 2) { | |
887 | 877 | babyCount.add(count); |
888 | - percent.add(percent(count,total)); | |
889 | - } | |
890 | - else if (i == 5) | |
891 | - { | |
878 | + percent.add(percent(count, total)); | |
879 | + } else if (i == 5) { | |
892 | 880 | babyCount.add(count); |
893 | - percent.add(percent(count,total)); | |
894 | - } | |
895 | - else if (i == 11) | |
896 | - { | |
881 | + percent.add(percent(count, total)); | |
882 | + } else if (i == 11) { | |
897 | 883 | babyCount.add(count); |
898 | - percent.add(percent(count,total)); | |
884 | + percent.add(percent(count, total)); | |
899 | 885 | } |
900 | - } | |
901 | - else if (i == 17) | |
902 | - { | |
903 | - resultOther.add(total-count); | |
886 | + } else if (i == 17) { | |
887 | + resultOther.add(total - count); | |
904 | 888 | result.add(count); |
905 | - } | |
906 | - else if (i == 24) | |
907 | - { | |
908 | - resultOther.add(total-count); | |
889 | + } else if (i == 24) { | |
890 | + resultOther.add(total - count); | |
909 | 891 | result.add(count); |
910 | - } | |
911 | - else if (i == 29) | |
912 | - { | |
913 | - resultOther.add(total-count); | |
892 | + } else if (i == 29) { | |
893 | + resultOther.add(total - count); | |
914 | 894 | result.add(count); |
915 | - } | |
916 | - else if (i == 35) | |
917 | - { | |
918 | - resultOther.add(total-count); | |
895 | + } else if (i == 35) { | |
896 | + resultOther.add(total - count); | |
919 | 897 | result.add(count); |
920 | 898 | } |
921 | - if (i >= 12) | |
922 | - { | |
923 | - nocheckCount+=temp.get(i); | |
899 | + if (i >= 12) { | |
900 | + nocheckCount += temp.get(i); | |
924 | 901 | } |
925 | 902 | } |
926 | 903 | } |
927 | 904 | babyCount.add(nocheckCount); |
928 | 905 | |
929 | - percent.add(percent(nocheckCount,total)); | |
906 | + percent.add(percent(nocheckCount, total)); | |
930 | 907 | |
931 | 908 | babyStatisticsManagerSelfConversionListResult.setResult(result); |
932 | 909 | babyStatisticsManagerSelfConversionListResult.setResultOther(resultOther); |
933 | 910 | |
... | ... | @@ -938,13 +915,146 @@ |
938 | 915 | return babyStatisticsManagerSelfConversionListResult; |
939 | 916 | } |
940 | 917 | |
941 | - private String percent(Integer count,Integer total) | |
942 | - { | |
943 | - if (total != null && total == 0) | |
944 | - { | |
918 | + private String percent(Integer count, Integer total) { | |
919 | + if (total != null && total == 0) { | |
945 | 920 | return new BigDecimal(0) + "%"; |
946 | 921 | } |
947 | 922 | return new BigDecimal((double) count * 100 / (double) total).setScale(2, BigDecimal.ROUND_HALF_UP) + "%"; |
923 | + } | |
924 | + | |
925 | + public BaseObjectResponse babyStatisticalProbability(Integer babyMonthAge, Integer userId) { | |
926 | + String hospitaId = autoMatchFacade.getHospitalId(userId); | |
927 | + Map<String, Object> data = new HashMap<>(); | |
928 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
929 | + babyQuery.setHospitalId(hospitaId); | |
930 | + babyQuery.setYn(YnEnums.YES.getId()); | |
931 | + if (null != babyMonthAge) { | |
932 | + Date currentDate = DateUtil.formatDate(new Date()); | |
933 | + Date start = DateUtil.addMonth(currentDate, -babyMonthAge); | |
934 | + babyQuery.setBirthEnd(start); | |
935 | + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -babyMonthAge - 1), 1); | |
936 | + babyQuery.setBirthStart(end); | |
937 | + List<BabyModel> babyModels = babyService.queryBabyWithQuery(babyQuery); | |
938 | + BabyCheckModelQuery babyCheckModelQuery = new BabyCheckModelQuery(); | |
939 | + BabyCheckModelQuery babyCheckQuery = new BabyCheckModelQuery(); | |
940 | + //只查询1月龄做过检查的人数 | |
941 | + babyCheckQuery.setCheckMonth(1); | |
942 | + babyCheckQuery.setYn(YnEnums.YES.getId()); | |
943 | + babyCheckModelQuery.setYn(YnEnums.YES.getId()); | |
944 | + int probabilityCount = 0; | |
945 | + int managementRateChechkCount = 0; | |
946 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
947 | + for (BabyModel baby : babyModels) { | |
948 | + babyCheckModelQuery.setBuildId(baby.getId()); | |
949 | + int checkCount = babyCheckService.queryBabyCheckCount(babyCheckModelQuery); | |
950 | + //正常 | |
951 | + if (null == baby.getHighRisk() || baby.getHighRisk() != 1) { | |
952 | + if (babyMonthAge >= 1 && babyMonthAge <= 2 && checkCount >= 1) { | |
953 | + probabilityCount++; | |
954 | + } else if (babyMonthAge >= 3 && babyMonthAge <= 5 && checkCount >= 2) { | |
955 | + probabilityCount++; | |
956 | + } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 3) { | |
957 | + probabilityCount++; | |
958 | + } else if (babyMonthAge >= 8 && babyMonthAge <= 11 && checkCount >= 4) { | |
959 | + probabilityCount++; | |
960 | + } else if (babyMonthAge >= 12 && checkCount >= 5) { | |
961 | + } | |
962 | + //高儿计算规则 | |
963 | + } else { | |
964 | + if (babyMonthAge == 1 && checkCount >= 1) { | |
965 | + probabilityCount++; | |
966 | + } else if (babyMonthAge == 2 && checkCount >= 2) { | |
967 | + probabilityCount++; | |
968 | + } else if (babyMonthAge == 3 && checkCount >= 3) { | |
969 | + probabilityCount++; | |
970 | + } else if (babyMonthAge == 4 && checkCount >= 4) { | |
971 | + probabilityCount++; | |
972 | + } else if (babyMonthAge == 5 && checkCount >= 5) { | |
973 | + probabilityCount++; | |
974 | + } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 6) { | |
975 | + probabilityCount++; | |
976 | + } else if (babyMonthAge >= 8 && babyMonthAge <= 9 && checkCount >= 7) { | |
977 | + probabilityCount++; | |
978 | + } else if (babyMonthAge >= 10 && babyMonthAge <= 11 && checkCount >= 8) { | |
979 | + probabilityCount++; | |
980 | + } else if (babyMonthAge >= 12 && babyMonthAge <= 14 && checkCount >= 9) { | |
981 | + probabilityCount++; | |
982 | + } else if (babyMonthAge >= 15 && babyMonthAge <= 17 && checkCount >= 10) { | |
983 | + probabilityCount++; | |
984 | + } else if (babyMonthAge >= 18 && babyMonthAge <= 20 && checkCount >= 11) { | |
985 | + probabilityCount++; | |
986 | + } else if (babyMonthAge >= 21 && babyMonthAge <= 23 && checkCount >= 12) { | |
987 | + probabilityCount++; | |
988 | + } else if (babyMonthAge >= 24 && checkCount >= 13) { | |
989 | + probabilityCount++; | |
990 | + } | |
991 | + } | |
992 | + /**总管理率统计**/ | |
993 | + babyCheckQuery.setBuildId(baby.getId()); | |
994 | + int RateChechkCount = babyCheckService.queryBabyCheckCount(babyCheckQuery); | |
995 | + if (RateChechkCount != 0) { | |
996 | + managementRateChechkCount++; | |
997 | + } | |
998 | + } | |
999 | + } | |
1000 | + data.put("standardCheckCount", probabilityCount); | |
1001 | + data.put("standardTotalnumber", babyModels.size()); | |
1002 | + data.put("standardPercentage", percent(probabilityCount, babyModels.size())); | |
1003 | + data.put("managementRateChechkCount", managementRateChechkCount); | |
1004 | + data.put("managementRateCount", babyModels.size()); | |
1005 | + data.put("managementRatePercentage", percent(managementRateChechkCount, babyModels.size())); | |
1006 | + } | |
1007 | + return new BaseObjectResponse().setData(data); | |
1008 | + | |
1009 | + } | |
1010 | + | |
1011 | + /*** | |
1012 | + *type 0表示正常 1表示高危 | |
1013 | + */ | |
1014 | + public void calculationRules(int checkCount, Integer babyMonthAge, Integer type, int probabilityCount) { | |
1015 | + //正常儿童 | |
1016 | + if (type == 1) { | |
1017 | + if (babyMonthAge >= 1 && babyMonthAge <= 2 && checkCount >= 1) { | |
1018 | + probabilityCount++; | |
1019 | + } else if (babyMonthAge >= 3 && babyMonthAge <= 5 && checkCount >= 2) { | |
1020 | + probabilityCount++; | |
1021 | + } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 3) { | |
1022 | + probabilityCount++; | |
1023 | + } else if (babyMonthAge >= 8 && babyMonthAge <= 11 && checkCount >= 4) { | |
1024 | + probabilityCount++; | |
1025 | + } else if (babyMonthAge >= 12 && checkCount >= 5) { | |
1026 | + | |
1027 | + } | |
1028 | + //高危儿 | |
1029 | + } else if (type == 2) { | |
1030 | + if (babyMonthAge == 1 && checkCount >= 1) { | |
1031 | + probabilityCount++; | |
1032 | + } else if (babyMonthAge == 2 && checkCount >= 2) { | |
1033 | + probabilityCount++; | |
1034 | + } else if (babyMonthAge == 3 && checkCount >= 3) { | |
1035 | + probabilityCount++; | |
1036 | + } else if (babyMonthAge == 4 && checkCount >= 4) { | |
1037 | + probabilityCount++; | |
1038 | + } else if (babyMonthAge == 5 && checkCount >= 5) { | |
1039 | + probabilityCount++; | |
1040 | + } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 6) { | |
1041 | + probabilityCount++; | |
1042 | + } else if (babyMonthAge >= 8 && babyMonthAge <= 9 && checkCount >= 7) { | |
1043 | + probabilityCount++; | |
1044 | + } else if (babyMonthAge >= 10 && babyMonthAge <= 11 && checkCount >= 8) { | |
1045 | + probabilityCount++; | |
1046 | + } else if (babyMonthAge >= 12 && babyMonthAge <= 14 && checkCount >= 9) { | |
1047 | + probabilityCount++; | |
1048 | + } else if (babyMonthAge >= 15 && babyMonthAge <= 17 && checkCount >= 10) { | |
1049 | + probabilityCount++; | |
1050 | + } else if (babyMonthAge >= 18 && babyMonthAge <= 20 && checkCount >= 11) { | |
1051 | + probabilityCount++; | |
1052 | + } else if (babyMonthAge >= 21 && babyMonthAge <= 23 && checkCount >= 12) { | |
1053 | + probabilityCount++; | |
1054 | + } else if (babyMonthAge >= 24 && checkCount >= 13) { | |
1055 | + probabilityCount++; | |
1056 | + } | |
1057 | + } | |
948 | 1058 | } |
949 | 1059 | |
950 | 1060 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
22ea269
... | ... | @@ -1730,11 +1730,14 @@ |
1730 | 1730 | healthy.add("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");//健康id// |
1731 | 1731 | healthy.add("a427da89-594a-46c2-b9f7-1b0d355ce54c");//28>BMI>25 |
1732 | 1732 | healthy.add("5a40c6c5422b03d4ad2bf7bd");//BMI<18.5 |
1733 | - if (null == patients.getRiskFactorId() || healthy.containsAll(patients.getRiskFactorId())) { | |
1734 | - patientBaseResult.setFlag(false); | |
1735 | - } else { | |
1736 | - patientBaseResult.setFlag(true); | |
1733 | + if (patients != null) { | |
1734 | + if (patients.getRiskFactorId() == null || healthy.containsAll(patients.getRiskFactorId())) { | |
1735 | + patientBaseResult.setFlag(false); | |
1736 | + } else { | |
1737 | + patientBaseResult.setFlag(true); | |
1738 | + } | |
1737 | 1739 | } |
1740 | + | |
1738 | 1741 | if (null != pw.getPrintingTime()) { |
1739 | 1742 | int hasPrint = DateUtil.getDays(pw.getPrintingTime(), new Date()); |
1740 | 1743 | if (hasPrint > 21) { |