소스 검색

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

chenweida 7 년 전
부모
커밋
f3363613f4

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

@ -5,7 +5,9 @@ import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
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.List;
@ -19,12 +21,34 @@ public class ConsultTimeConvert implements Convert {
     * @param slaveLevel 从1开始
     * @return
     */
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List oneList, String slaveLevel, WlyyDimensionQuota temp ) {
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List oneList, String slaveLevel, WlyyDimensionQuota temp) {
        oneList.stream().forEach(one -> {
            try {
                Object value = DataModel.class.getMethod("get" + temp.getKey()).invoke(one);
                String sex= IdCardUtil.getSexForIdcard(String.valueOf(value));
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, sex);
                String valueStr = "1";
                if (StringUtils.isEmpty(value)) {
                    try {
                        Integer valueInt = Integer.parseInt(value.toString());
                        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";
                        }
                    } catch (Exception e) {
                    }
                }
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, valueStr);
            } catch (Exception e) {
                e.printStackTrace();
            }

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

@ -49,8 +49,8 @@ public class IdCardUtil {
//        }
//        return age;
//    }
    public static void main(String[] args) throws Exception{
        System.out.println(getSexForIdcard("350206199109092048"));
    public static void main(String[] args) throws Exception {
        System.out.println(getSexForIdcard("350206199109092018"));
    }
    /**
@ -62,30 +62,34 @@ public class IdCardUtil {
     */
    public static String getSexForIdcard(String CardCode)
            throws Exception {
        String sex = "3";
        if (CardCode.length() == 18) {
            if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
                // modifid by lyr 2016-09-29
                // sex =  Constant.level_sex_2;
                sex = "2";
                // modifid by lyr 2016-09-29
            } else {
                // modifid by lyr 2016-09-29
                // sex =  Constant.level_sex_1;
                sex = "1";
                // modifid by lyr 2016-09-29
            }
        } else if (CardCode.length() == 15) {
            String usex = CardCode.substring(14, 15);// 用户的性别
            if (Integer.parseInt(usex) % 2 == 0) {
                // sex =  Constant.level_sex_2;
                sex = "2";
            } else {
                // sex =  Constant.level_sex_1;
                sex = "1";
        try {
            String sex = "1";
            if (CardCode.length() == 18) {
                if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
                    // modifid by lyr 2016-09-29
                    // sex =  Constant.level_sex_2;
                    sex = "2";
                    // modifid by lyr 2016-09-29
                } else {
                    // modifid by lyr 2016-09-29
                    // sex =  Constant.level_sex_1;
                    sex = "1";
                    // modifid by lyr 2016-09-29
                }
            } else if (CardCode.length() == 15) {
                String usex = CardCode.substring(14, 15);// 用户的性别
                if (Integer.parseInt(usex) % 2 == 0) {
                    // sex =  Constant.level_sex_2;
                    sex = "2";
                } else {
                    // sex =  Constant.level_sex_1;
                    sex = "1";
                }
            }
            return sex;
        } catch (Exception e) {
            return "1";
        }
        return sex;
    }
    /**