chenweida 7 سال پیش
والد
کامیت
b58666b5a5

+ 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();
            }