소스 검색

代码修改

liubing 3 년 전
부모
커밋
0431a28060

+ 27 - 58
common/common-util/src/main/java/com/yihu/jw/util/healthIndex/HealthIndexUtil.java

@ -55,25 +55,14 @@ public class HealthIndexUtil {
            String value1 = values[0];
            String value1 = values[0];
            // 餐后
            // 餐后
            if (index % 2 == 0) {
            if (index % 2 == 0) {
                if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueAfter, minValueAfter)) {
                    tmp.put("value1",value1);
                    tmp.put("indexName","血糖");
                    tmp.put("error",true);
                }else {
                    tmp.put("value1",value1);
                    tmp.put("indexName","血糖");
                    tmp.put("error",false);
                }
                tmp.put("value1",value1);
                tmp.put("indexName","血糖");
                tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value1), maxValueAfter, minValueAfter));
            } else { //餐前
            } else { //餐前
                if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueBefore, minValueBefore)) {
                    tmp.put("value1",value1);
                    tmp.put("indexName","血糖");
                    tmp.put("error",true);
                }else {
                    tmp.put("value1",value1);
                    tmp.put("indexName","血糖");
                    tmp.put("error",false);
                }
                tmp.put("value1",value1);
                tmp.put("indexName","血糖");
                tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value1), maxValueBefore, minValueBefore));
            }
            }
            result.add(tmp);
            result.add(tmp);
        }
        }
@ -89,54 +78,30 @@ public class HealthIndexUtil {
            Double maxValueSZY = HEALTH_STANDARD_SZY_MAX;
            Double maxValueSZY = HEALTH_STANDARD_SZY_MAX;
            Double minValueSZY = HEALTH_STANDARD_SZY_MIN;
            Double minValueSZY = HEALTH_STANDARD_SZY_MIN;
            // 收缩压/舒张压校验
            // 收缩压/舒张压校验
            if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueSSY, minValueSSY) ) {
                tmp.put("value1",value1);
                tmp.put("indexName","收缩压");
                tmp.put("error",true);
            }else {
                tmp.put("value1",value1);
                tmp.put("indexName","收缩压");
                tmp.put("error",false);
            }
            tmp.put("value1",value1);
            tmp.put("indexName","收缩压");
            tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value1), maxValueSSY, minValueSSY));
            result.add(tmp);
            result.add(tmp);
            //舒张压校验
            //舒张压校验
            tmp = new JSONObject();
            tmp = new JSONObject();
            if (!checkHealthIndex(NumberUtils.toDouble(value2), maxValueSZY, minValueSZY)){
                tmp.put("value1",value1);
                tmp.put("indexName","舒张压");
                tmp.put("error",true);
            }else {
                tmp.put("value1",value1);
                tmp.put("indexName","舒张压");
                tmp.put("error",false);
            }
            tmp.put("value1",value1);
            tmp.put("indexName","舒张压");
            tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value2), maxValueSZY, minValueSZY));
            result.add(tmp);
            result.add(tmp);
            tmp = new JSONObject();
            tmp = new JSONObject();
            //脉搏检验
            //脉搏检验
            if (StringUtils.isNotBlank(value3)){
            if (StringUtils.isNotBlank(value3)){
                if (!checkHealthIndex(NumberUtils.toDouble(value3), HEALTH_STANDARD_HEART_RATE_MAX, HEALTH_STANDARD_HEART_RATE_MIN)){
                    tmp.put("value1",value1);
                    tmp.put("indexName","脉搏");
                    tmp.put("error",true);
                }else {
                    tmp.put("value1",value1);
                    tmp.put("indexName","脉搏");
                    tmp.put("error",false);
                }
                tmp.put("value1",value1);
                tmp.put("indexName","脉搏");
                tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value3), HEALTH_STANDARD_HEART_RATE_MAX, HEALTH_STANDARD_HEART_RATE_MIN));
                result.add(tmp);
                result.add(tmp);
            }
            }
        }
        }
        else if (type == 5) {//心率
        else if (type == 5) {//心率
            String value1 = values[0];//心率
            String value1 = values[0];//心率
            if (!checkHealthIndex(NumberUtils.toDouble(value1), HEALTH_STANDARD_HEART_RATE_MAX, HEALTH_STANDARD_HEART_RATE_MIN)){
                tmp.put("value1",value1);
                tmp.put("indexName","心率");
                tmp.put("error",true);
            }else {
                tmp.put("value1",value1);
                tmp.put("indexName","心率");
                tmp.put("error",false);
            }
            tmp.put("value1",value1);
            tmp.put("indexName","心率");
            tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value1), HEALTH_STANDARD_HEART_RATE_MAX, HEALTH_STANDARD_HEART_RATE_MIN));
            result.add(tmp);
            result.add(tmp);
        }
        }
        return result;
        return result;
@ -145,10 +110,14 @@ public class HealthIndexUtil {
    /**
    /**
     * 判断当前值是否在区间内
     * 判断当前值是否在区间内
     */
     */
    private boolean checkHealthIndex(Double current, Double max, Double min) {
        if (current > max || current < min || current < 0) {
            return false;
    private Integer checkHealthIndex(Double current, Double max, Double min) {
        if (current > max  ) {
            return 1;//指标过高
        }else if(current < min || current < 0) {
            return -1;//指标过低
        }
        else {//正常
            return 0;
        }
        }
        return true;
    }
    }
}
}

+ 2 - 2
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java

@ -393,7 +393,7 @@ public class DeviceService {
                    String content_notice = null;
                    String content_notice = null;
                    for (int i=0;i<errorIndex.size();i++){
                    for (int i=0;i<errorIndex.size();i++){
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        if (tmp.getBooleanValue("error")){
                        if (1 == tmp.getInteger("error")){
                            content_notice += tmp.getString("indexName"+"、");
                            content_notice += tmp.getString("indexName"+"、");
                        }
                        }
                    }
                    }
@ -477,7 +477,7 @@ public class DeviceService {
                    String content_notice = null;
                    String content_notice = null;
                    for (int i=0;i<errorIndex.size();i++){
                    for (int i=0;i<errorIndex.size();i++){
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        if (tmp.getBooleanValue("error")){
                        if (1 == tmp.getInteger("error")){
                            content_notice += tmp.getString("indexName"+"、");
                            content_notice += tmp.getString("indexName"+"、");
                        }
                        }
                    }
                    }

+ 1 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java

@ -160,7 +160,7 @@ public class DeviceUploadService {
                    String content_notice = null;
                    String content_notice = null;
                    for (int i=0;i<errorIndex.size();i++){
                    for (int i=0;i<errorIndex.size();i++){
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        if (tmp.getBooleanValue("error")){
                        if (1 == tmp.getInteger("error")){
                            content_notice += tmp.getString("indexName"+"、");
                            content_notice += tmp.getString("indexName"+"、");
                        }
                        }
                    }
                    }