Pārlūkot izejas kodu

Merge branch 'dev' of chenweida/patient-co-management into dev

chenweida 7 gadi atpakaļ
vecāks
revīzija
db66009753

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

@ -3,12 +3,16 @@ package com.yihu.wlyy.statistics.etl.convert.wlyy;
import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
import com.yihu.wlyy.statistics.util.DateUtil;
import com.yihu.wlyy.statistics.util.IdCardUtil;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.StringUtils;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
/**
@ -24,26 +28,13 @@ public class ConsultTimeConvert implements Convert {
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List<DataModel> oneList, String slaveLevel, WlyyDimensionQuota temp) {
        oneList.stream().forEach(one -> {
            try {
                String value =one.getSlaveKey1();
                String valueStr = "1";
                if (!StringUtils.isEmpty(value)) {
                    try {
                        Integer valueInt = Integer.parseInt(value);
                        if (valueInt <= 28800) {
                            valueStr = "1";
                        }
                        if (valueInt > 28800 && valueInt <= 43200) {
                            valueStr = "2";
                        }
                        if (valueInt > 43200 && valueInt <= 46800) {
                            valueStr = "3";
                        }
                        if (valueInt > 46800 && valueInt <= 64800) {
                            valueStr = "4";
                        }
                        if (valueInt > 64800 && valueInt <= 86400) {
                            valueStr = "5";
                        }
                        Date time= DateUtil.strToDate(one.getSlaveKey1(),"yyyy-MM-dd HH:mm:ss");
                        valueStr= paserReplyTime(time);
                    } catch (Exception e) {
                    }
@ -55,5 +46,26 @@ public class ConsultTimeConvert implements Convert {
        });
        return oneList;
    }
    public String paserReplyTime(Date date){
        if(date!=null){
            Calendar calendar  =  new GregorianCalendar();
            calendar.setTime(date);
            //获取小时
            int hour = calendar.get(calendar.HOUR_OF_DAY);
            if(hour>=0&&hour<8){
                return "1";
            }else if(hour>=8&&hour<12){
                return "2";
            }else if(hour>=12&&hour<13){
                return "3";
            }else if(hour>=13&&hour<18){
                return "4";
            }else if(hour>=18&&hour<24){
                return"5";
            }else{
                return "";
            }
        }
        return "";
    }
}

+ 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 {
        }
    }
    /**
     * 根据身份证的号码算出当前身份证持有者的年龄
     *

+ 61 - 0
patient-co/patient-co-statistics-es/src/main/resources/application-devtest.yml

@ -0,0 +1,61 @@
spring:
  profiles: test
  datasource:
    primaryReadWrite:
      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.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
    im: #im库
      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.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.17.110.160/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: ssgg
    password: ssgg
systemConfig:
  msg_push_server: http://127.0.0.1:3000
es:
  index: wlyy_quota_test
  type: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_cwd

+ 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.