chenweida 7 éve
szülő
commit
271d109ffd

+ 29 - 13
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DiseaseAndAgeConvert.java

@ -25,8 +25,10 @@ public class DiseaseAndAgeConvert implements Convert {
        List<DataModel> returnList = new ArrayList<>();
        Map<String, List<String>> healthLablesMap = new HashMap<>();//key是患者code value是患者标签 1高血压 2糖尿病 3 65岁以上
        //初始化标签Map
        initHealthLabesMap(jdbcTemplate, healthLablesMap,oneList);
        initHealthLabesMap(jdbcTemplate, healthLablesMap, oneList);
        //把标签Map设置到对应的维度里面
        for (DataModel dataModel : oneList) {
            List<String> labels = healthLablesMap.get(dataModel.getPatient());
            if (labels != null && labels.size() > 0) {
@ -41,6 +43,18 @@ public class DiseaseAndAgeConvert implements Convert {
                    }
                });
            }
            //判断患者是否是老年人是
            int age = IdCardUtil.getAgeForIdcard(dataModel.getIdcard());
            if (age >= 65) {
                try {
                    DataModel dataModelTemp = new DataModel();
                    BeanUtils.copyProperties(dataModel, dataModelTemp);
                    DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(dataModelTemp, "3");
                    returnList.add(dataModelTemp);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        return returnList;
    }
@ -65,17 +79,19 @@ public class DiseaseAndAgeConvert implements Convert {
            labels.add(one.getHealthLable());
            healthLablesMap.put(one.getPatient(), labels);
        });
        //-得到患者的老年人标签
        oneList.stream().forEach(one->{
            int age = IdCardUtil.getAgeForIdcard(one.getIdcard());
            if(age>=65){
                List<String> labels = healthLablesMap.get(one.getPatient());
                if (labels == null) {
                    labels = new ArrayList<String>();
                }
                labels.add(one.getHealthLable());
                healthLablesMap.put(one.getPatient(), labels);
            }
        });
//        //-得到患者的老年人标签
//        oneList.stream().forEach(one->{
//            int age = IdCardUtil.getAgeForIdcard(one.getIdcard());
//            if(age>=65){
//                num++;
//                List<String> labels = healthLablesMap.get(one.getPatient());
//                if (labels == null) {
//                    labels = new ArrayList<String>();
//                }
//                labels.add("3");
//                healthLablesMap.put(one.getPatient(), labels);
//            }
//        });
//        System.out.println("num:" + num);
    }
}

+ 1 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/IdCardUtil.java

@ -92,6 +92,7 @@ public class IdCardUtil {
        }
    }
    /**
     * 根据身份证的号码算出当前身份证持有者的年龄
     *

+ 21 - 21
patient-co/patient-co-statistics-es/src/main/resources/application-test.yml

@ -2,30 +2,30 @@ spring:
  profiles: test
  datasource:
#    primaryReadWrite:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    primaryRead:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    im: #im库
#      url: jdbc:mysql://172.17.110.160/im_new?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
    primaryReadWrite:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
    primaryRead:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
#    primaryReadWrite:
#      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: root
#      password: 123456
#    primaryRead:
#      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: root
#      password: 123456
#    im: #im库
#      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: root
#      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.