Commit 70c2379addcc5c28adf4640964973c736e6be8b2
1 parent
c3ad7d3ebd
Exists in
master
and in
6 other branches
威海体重
Showing 4 changed files with 109 additions and 51 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientWeightDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientWeightDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientWeightService2.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientWeightDao.java
View file @
70c2379
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientWeightDaoImpl.java
View file @
70c2379
| ... | ... | @@ -26,6 +26,11 @@ |
| 26 | 26 | update(query, patientWeight); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | + @Override | |
| 30 | + public void updatePatientOnline(Query query, PatientWeight patientWeight) { | |
| 31 | + update(query, patientWeight); | |
| 32 | + } | |
| 33 | + | |
| 29 | 34 | |
| 30 | 35 | @Override |
| 31 | 36 | public List<PatientWeight> queryPatientWeight(Query query) { |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientWeightService2.java
View file @
70c2379
| ... | ... | @@ -23,6 +23,10 @@ |
| 23 | 23 | patientWeightDao.updatePatient(query, patientWeight); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | + public void updateOnline(Query query, PatientWeight patientWeight) { | |
| 27 | + patientWeightDao.updatePatientOnline(query, patientWeight); | |
| 28 | + } | |
| 29 | + | |
| 26 | 30 | |
| 27 | 31 | public List<PatientWeight> queryPatientWeight(Query query) { |
| 28 | 32 | return patientWeightDao.queryPatientWeight(query); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
70c2379
| ... | ... | @@ -1045,21 +1045,51 @@ |
| 1045 | 1045 | return level; |
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | + private int handleWeightExcLevel(Double bmiD,String bregmatic,String beforeWeight,String weight,int week) | |
| 1049 | + { | |
| 1050 | + String lbmiStr = ""; | |
| 1051 | + int level = 0; | |
| 1052 | + //空和1表示单胎 | |
| 1053 | + if (!StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) | |
| 1054 | + { | |
| 1055 | + | |
| 1056 | + if (bmiD < 18.5) { | |
| 1057 | + lbmiStr = "BMI<18.5"; | |
| 1058 | + level = getLevel( lbmiStr, week, beforeWeight, weight,1,1.2); | |
| 1059 | + } else if (bmiD >= 18.5 && bmiD <= 24.9) { | |
| 1060 | + lbmiStr = "BMI=18.5-24.9"; | |
| 1061 | + level = getLevel( lbmiStr, week, beforeWeight, weight,1,1.2); | |
| 1062 | + } else if (bmiD > 24.9 && bmiD < 30) { | |
| 1063 | + lbmiStr = "BMI=25-29.9"; | |
| 1064 | + level = getLevel( lbmiStr, week, beforeWeight, weight,1,1.25); | |
| 1065 | + } else if (bmiD >= 30) { | |
| 1066 | + lbmiStr = "BMI≥30"; | |
| 1067 | + level = getLevel( lbmiStr, week, beforeWeight, weight,1,1.25); | |
| 1068 | + } | |
| 1069 | + } | |
| 1070 | + else | |
| 1071 | + { | |
| 1072 | + if (bmiD <= 24.9) { | |
| 1073 | + lbmiStr = "BMI≤24.9"; | |
| 1074 | + level = getDLevel(lbmiStr, week, beforeWeight, weight, 1, 1.15); | |
| 1075 | + } else if (bmiD >= 25 && bmiD <= 29.9) { | |
| 1076 | + lbmiStr = "BMI=25-29.9"; | |
| 1077 | + level = getDLevel(lbmiStr, week, beforeWeight, weight,1,1.2); | |
| 1078 | + } else if (bmiD >= 30) { | |
| 1079 | + lbmiStr = "BMI≥30"; | |
| 1080 | + level = getDLevel(lbmiStr, week, beforeWeight, weight,1,1.2); | |
| 1081 | + } | |
| 1082 | + } | |
| 1083 | + return level; | |
| 1084 | + } | |
| 1085 | + | |
| 1048 | 1086 | /** |
| 1087 | + *增重评定规则:单胎:BMI﹤ 18.5 、BMI=18.5-24.9,高于上限20%且大于等于1kg;BMI=25-29.9 、BMI≥30,高于上限25%且大于等于1kg, | |
| 1088 | + * 则判断为异常需警示的情况;双胎:BMI≤24.9 ,高于上限15%且大于等于1kg;BMI=25-29.9、BMI≥30, 高于上限20%且大于等于1kg,则判断为异常需警示的情况 | |
| 1089 | + *减重评定规则:单胎:BMI﹤ 18.5 、BMI=18.5-24.9,低于下限20%且大于等于1kg;BMI=25-29.9 、BMI≥30,低于下限25%且大于等于1kg, | |
| 1090 | + *则判断为异常需警示的情况;双胎:BMI≤24.9 ,低于下限15%且大于等于1kg;BMI=25-29.9、BMI≥30, 低于下限20%且大于等于1kg,则判断为异常需警示的情况。 | |
| 1091 | + * | |
| 1049 | 1092 | * BMI指数: |
| 1050 | - * 低体重(<18.5) 0-13周 13-40周 | |
| 1051 | - * 最低 0-1.2 1.2-11.9 | |
| 1052 | - * 最高 0-3.8 3.8-18.1 | |
| 1053 | - * 标准 (18.5-24.9) 0-13周 13-40周 | |
| 1054 | - * 最低 0-1.4 1.4-11.9 | |
| 1055 | - * 最高 0-3.2 3.2-15.9 | |
| 1056 | - * <p> | |
| 1057 | - * 超重(25.0-29.9) 0-13周 13-40周 | |
| 1058 | - * 最低 0-1.1 1.1-7.1 | |
| 1059 | - * 最高 0-3.1 3.2-11.6 | |
| 1060 | - * 肥胖 (>=30.0) 0-13周 13-40周 | |
| 1061 | - * 最低 0-0.8 0.9-4.9 | |
| 1062 | - * 最高 0-2.1 2.1-8.9 | |
| 1063 | 1093 | */ |
| 1064 | 1094 | public void setAppReport(Date lastMenses,PatientWeight patientWeight,Map<String, Object> restMap, Map<Integer, String> weights) { |
| 1065 | 1095 | |
| 1066 | 1096 | |
| 1067 | 1097 | |
| ... | ... | @@ -1079,42 +1109,11 @@ |
| 1079 | 1109 | |
| 1080 | 1110 | if (MapUtils.isNotEmpty(dayWeights)) { |
| 1081 | 1111 | for (String key : dayWeights.keySet()) { |
| 1082 | - int level = 0; //-1过低 0正常 1过高 | |
| 1083 | - String lbmiStr = ""; | |
| 1084 | 1112 | int week = DateUtil.getWeek2(lastMenses, DateUtil.parseYMD(key)); |
| 1085 | 1113 | Map<String, Object> temp = new LinkedHashMap<>(); |
| 1086 | - //空和1表示单胎 | |
| 1087 | - if (!StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) | |
| 1088 | - { | |
| 1114 | + //-1过低 0正常 1过高 | |
| 1115 | + int level = handleWeightExcLevel(bmiD, bregmatic,beforeWeight,dayWeights.get(key), week); | |
| 1089 | 1116 | |
| 1090 | - if (bmiD < 18.5) { | |
| 1091 | - lbmiStr = "BMI<18.5"; | |
| 1092 | - level = getLevel( lbmiStr, week, beforeWeight, dayWeights.get(key),1,1.2); | |
| 1093 | - } else if (bmiD >= 18.5 && bmiD <= 24.9) { | |
| 1094 | - lbmiStr = "BMI=18.5-24.9"; | |
| 1095 | - level = getLevel( lbmiStr, week, beforeWeight, dayWeights.get(key),1,1.2); | |
| 1096 | - } else if (bmiD > 24.9 && bmiD < 30) { | |
| 1097 | - lbmiStr = "BMI=25-29.9"; | |
| 1098 | - level = getLevel( lbmiStr, week, beforeWeight, dayWeights.get(key),1,1.25); | |
| 1099 | - } else if (bmiD >= 30) { | |
| 1100 | - lbmiStr = "BMI≥30"; | |
| 1101 | - level = getLevel( lbmiStr, week, beforeWeight, dayWeights.get(key),1,1.25); | |
| 1102 | - } | |
| 1103 | - } | |
| 1104 | - else | |
| 1105 | - { | |
| 1106 | - if (bmiD <= 24.9) { | |
| 1107 | - lbmiStr = "BMI≤24.9"; | |
| 1108 | - level = getDLevel(lbmiStr, week, beforeWeight, dayWeights.get(key), 1, 1.15); | |
| 1109 | - } else if (bmiD >= 25 && bmiD <= 29.9) { | |
| 1110 | - lbmiStr = "BMI=25-29.9"; | |
| 1111 | - level = getDLevel(lbmiStr, week, beforeWeight, dayWeights.get(key),1,1.2); | |
| 1112 | - } else if (bmiD >= 30) { | |
| 1113 | - lbmiStr = "BMI≥30"; | |
| 1114 | - level = getDLevel(lbmiStr, week, beforeWeight, dayWeights.get(key),1,1.2); | |
| 1115 | - } | |
| 1116 | - } | |
| 1117 | - | |
| 1118 | 1117 | temp.put("nowWeight", dayWeights.get(key)); |
| 1119 | 1118 | temp.put("recordTime", key); |
| 1120 | 1119 | temp.put("level", level); |
| 1121 | 1120 | |
| ... | ... | @@ -1799,13 +1798,13 @@ |
| 1799 | 1798 | { |
| 1800 | 1799 | patientWeight.setSevenSend(1); |
| 1801 | 1800 | content = "亲爱的准妈妈您好,我是您的私人体重管理医生,您目前已经很久没有记录您的体重值了,为了您和您孩子的健康,请您务必每天记录一下自己的体重,好让我们能随时关注到您和宝宝的健康状况,谢谢!"; |
| 1802 | - patientWeightService2.update(Query.query(Criteria.where("id").is(patientWeight.getId())), patientWeight); | |
| 1801 | + patientWeightService2.updateOnline(Query.query(Criteria.where("id").is(patientWeight.getId())), patientWeight); | |
| 1803 | 1802 | } |
| 1804 | 1803 | else if (type == 3) |
| 1805 | 1804 | { |
| 1806 | 1805 | patientWeight.setExceptionSend(1); |
| 1807 | 1806 | content = "亲爱的准妈妈您好,我是您的私人体重管理医生,您目前的体重数据十分不理想,请您迅速与我联系或来院进行复查身体情况。"; |
| 1808 | - patientWeightService2.update(Query.query(Criteria.where("id").is(patientWeight.getId())), patientWeight); | |
| 1807 | + patientWeightService2.updateOnline(Query.query(Criteria.where("id").is(patientWeight.getId())), patientWeight); | |
| 1809 | 1808 | } |
| 1810 | 1809 | mr.setFirst("【" + messagePrefix + "】" + content); |
| 1811 | 1810 | mr.setObjType(ServiceObjEnums.YUNOBJ.getId()); |
| ... | ... | @@ -1870,7 +1869,11 @@ |
| 1870 | 1869 | { |
| 1871 | 1870 | for (PatientService ps : list) |
| 1872 | 1871 | { |
| 1873 | - patientIds.add(ps.getParentid()); | |
| 1872 | + Patients pat = patientsService.findOnePatientById(ps.getParentid()); | |
| 1873 | + if (pat != null && pat.getType() == 1) | |
| 1874 | + { | |
| 1875 | + patientIds.add(ps.getParentid()); | |
| 1876 | + } | |
| 1874 | 1877 | } |
| 1875 | 1878 | } |
| 1876 | 1879 | |
| 1877 | 1880 | |
| 1878 | 1881 | |
| ... | ... | @@ -1885,14 +1888,22 @@ |
| 1885 | 1888 | { |
| 1886 | 1889 | cr.and("sevenSend").is(status); |
| 1887 | 1890 | } |
| 1891 | + else if (status != null && status == 0) | |
| 1892 | + { | |
| 1893 | + cr.orOperator(Criteria.where("sevenSend").is(0), Criteria.where("sevenSend").exists(false)); | |
| 1894 | + } | |
| 1888 | 1895 | } |
| 1889 | 1896 | else if (type == 3) |
| 1890 | 1897 | { |
| 1891 | - cr.and("exceptionCount").gte(2); | |
| 1898 | + //cr.and("exceptionCount").gte(2); | |
| 1892 | 1899 | if (status != null && status == 1) |
| 1893 | 1900 | { |
| 1894 | 1901 | cr.and("exceptionSend").is(status); |
| 1895 | 1902 | } |
| 1903 | + else if (status != null && status == 0) | |
| 1904 | + { | |
| 1905 | + cr.orOperator(Criteria.where("exceptionSend").is(0), Criteria.where("exceptionSend").exists(false)); | |
| 1906 | + } | |
| 1896 | 1907 | } |
| 1897 | 1908 | |
| 1898 | 1909 | List<PatientWeight> weights = mongoTemplate.find(Query.query(cr), PatientWeight.class); |
| 1899 | 1910 | |
| ... | ... | @@ -1900,8 +1911,45 @@ |
| 1900 | 1911 | { |
| 1901 | 1912 | for (PatientWeight weight : weights) |
| 1902 | 1913 | { |
| 1903 | - Map map = new HashMap(); | |
| 1904 | 1914 | Patients patients = patientsService.findOnePatientById(weight.getPatientId()); |
| 1915 | + if (type == 3) | |
| 1916 | + { | |
| 1917 | + Double bmiD = 20D; | |
| 1918 | + if (StringUtils.isNotEmpty(weight.getBmi())) { | |
| 1919 | + bmiD = Double.parseDouble(weight.getBmi()); | |
| 1920 | + } | |
| 1921 | + Map<String, String> dayWeights = weight.getDayWeights(); | |
| 1922 | + dayWeights = sortMapByKey(dayWeights); | |
| 1923 | + if (MapUtils.isNotEmpty(dayWeights) && dayWeights.size() > 1) { | |
| 1924 | + int index = 0; | |
| 1925 | + int count = 0; | |
| 1926 | + for (String key : weight.getDayWeights().keySet()) { | |
| 1927 | + int week = DateUtil.getWeek2(patients.getLastMenses(), DateUtil.parseYMD(key)); | |
| 1928 | + //-1过低 0正常 1过高 | |
| 1929 | + int level = handleWeightExcLevel(bmiD, weight.getBregmatic(),weight.getBeforeWeight(),dayWeights.get(key), week); | |
| 1930 | + if (level != 0) | |
| 1931 | + { | |
| 1932 | + count++; | |
| 1933 | + } | |
| 1934 | + index++; | |
| 1935 | + if (index == 2) | |
| 1936 | + { | |
| 1937 | + break; | |
| 1938 | + } | |
| 1939 | + } | |
| 1940 | + if (count != 2) | |
| 1941 | + { | |
| 1942 | + continue; | |
| 1943 | + } | |
| 1944 | + } | |
| 1945 | + else | |
| 1946 | + { | |
| 1947 | + continue; | |
| 1948 | + } | |
| 1949 | + } | |
| 1950 | + Map map = new HashMap(); | |
| 1951 | + | |
| 1952 | + map.put("patientId",patients != null ? patients.getId() : ""); | |
| 1905 | 1953 | map.put("name",patients != null ? patients.getUsername() : ""); |
| 1906 | 1954 | map.put("age",patients != null ? DateUtil.getAge(patients.getBirth(), weight.getModified()): ""); |
| 1907 | 1955 | map.put("week",patients != null ? DateUtil.getWeekDesc(patients.getLastMenses(), weight.getModified()): ""); |