소스 검색

bug提交

chenweida 7 년 전
부모
커밋
8e576ec49d

+ 18 - 2
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/SignDataFilter.java

@ -38,7 +38,7 @@ public class SignDataFilter {
    public static String level2Health = "5";//健康服务分布
    public static String level2Age2 = "6";//年龄
    public static String level2AgeDisease = "7";//年龄疾病
    public static String level2ServerType= "8";//年龄疾病
    public static String level2ServerType = "8";//年龄疾病
    public static String level3Disease = "1";//疾病分组
@ -347,7 +347,7 @@ public class SignDataFilter {
                    return returnLevel2Key;
                }
                case "8": {
                    return signFamily.getServerType();
                    return getServerType(signFamily);
                }
            }
@ -355,6 +355,22 @@ public class SignDataFilter {
        return returnLevel2Key;
    }
    private String getServerType(SignFamily signFamily) {
        //获取服务类型
        List<String> serverType = CachePool.getServerType(signFamily.getCode());
        //返回服务类型
        if (serverType != null && serverType.size() > 0) {
            StringBuffer str = new StringBuffer();
            for (int i = 0; i < serverType.size(); i++) {
                str.append(serverType.get(i));
                if (serverType.size() != (i + 1)) {
                    str.append(",");
                }
            }
        }
        return "";
    }
    private String getAgeDisease(SignFamily signFamily) {
        //得到患者年龄
        StringBuffer returnLevel2KeyBuffer = new StringBuffer("0");

+ 110 - 62
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/mycache/CachePool.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.statistics.etl.model.CacheModel;
import com.yihu.wlyy.statistics.job.business.Constant;
import com.yihu.wlyy.statistics.model.label.SignPatientLabelInfo;
import com.yihu.wlyy.statistics.model.signfamily.SignFamily;
import com.yihu.wlyy.statistics.model.signfamily.SignFamilyServer;
import com.yihu.wlyy.statistics.util.SpringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -21,87 +22,95 @@ import java.util.Map;
 */
@Component
public class CachePool {
    private static List<String> keys=new ArrayList<>();
    private static List<String> keys = new ArrayList<>();
    /**
     * 到达量的缓存  key 是时间yyyy-MM-dd
     */
    private static Map<String,CacheModel> arriveSignFamilyExpenseStatus1Map=new HashMap<String,CacheModel>();
    private static Map<String, CacheModel> arriveSignFamilyExpenseStatus1Map = new HashMap<String, CacheModel>();
    /**
     * 分组标签的缓存 key 是患者code
     */
    private static Map<String,String> patientGroup=new HashMap<String,String>();
    private static Map<String, String> patientGroup = new HashMap<String, String>();
    /**
     * 签约服务分组
     */
    private static Map<String, List<String>> serverGroup = new HashMap<String, List<String>>();
    /**
     * 健康标签的缓存 key 是患者code
     */
    private static Map<String,String> healthGroup=new HashMap<String,String>();
    private static Map<String, String> healthGroup = new HashMap<String, String>();
    /**
     * 疾病标签的缓存 key 是患者code
     */
    private static Map<String,List<String>> diseaseGroup=new HashMap<String,List<String>>();
    private static Map<String, List<String>> diseaseGroup = new HashMap<String, List<String>>();
    /**
     * 某天的签约的已扣费的到达量
     *
     * @param date
     * @return
     * @throws Exception
     */
    public synchronized CacheModel getSignFamilysWithExpenseStatus1ByDate(String date) throws Exception{
        CacheModel model= arriveSignFamilyExpenseStatus1Map.get(date);
        if(model==null){
            model=new CacheModel();
            String sql=" select id,code,idcard,hospital,admin_team_code,expenses_status,patient,server_type from wlyy_sign_family a " +
    public synchronized CacheModel getSignFamilysWithExpenseStatus1ByDate(String date) throws Exception {
        CacheModel model = arriveSignFamilyExpenseStatus1Map.get(date);
        if (model == null) {
            model = new CacheModel();
            String sql = " select id,code,idcard,hospital,admin_team_code,expenses_status,patient,server_type from wlyy_sign_family a " +
                    " where " +
                    " status in(1,2) " +
                    " and a.type =2  " +
                    " and expenses_status=1 " +
                    " and a.expenses_time< '"+date+ Constant.quota_date_last+"' " +
                    " and a.sign_year ='"+Constant.getNowYearByDateYeaterday(date)+"'  " ;
            String sqlCount="select count(id) from wlyy_sign_family a " +
                    " and a.expenses_time< '" + date + Constant.quota_date_last + "' " +
                    " and a.sign_year ='" + Constant.getNowYearByDateYeaterday(date) + "'  ";
            String sqlCount = "select count(id) from wlyy_sign_family a " +
                    " where  " +
                    " status in(1,2) " +
                    " and a.type =2 " +
                    " and expenses_status=1 " +
                    " and a.expenses_time< '"+date+ Constant.quota_date_last+"'  " +
                    " and a.sign_year ='"+Constant.getNowYearByDateYeaterday(date)+"'  " ;
                    " and a.expenses_time< '" + date + Constant.quota_date_last + "'  " +
                    " and a.sign_year ='" + Constant.getNowYearByDateYeaterday(date) + "'  ";
            //抽取數據 分页抽取
            List<SignFamily> signFamiliesTemp= SpringUtil.getBean(DBExtract.class).extractByPage(SignFamily.class,sql,sqlCount,true);
            List<SignFamily> signFamiliesTemp = SpringUtil.getBean(DBExtract.class).extractByPage(SignFamily.class, sql, sqlCount, true);
            model.setSql(sql);
            model.setSignFamilies(signFamiliesTemp);
            arriveSignFamilyExpenseStatus1Map.put(date,model);
            arriveSignFamilyExpenseStatus1Map.put(date, model);
            return model;
        }else{
        } else {
            return model;
        }
    }
    /**
     * 查询某人的分组标签
     *
     * @param patientCode
     * @return
     * @throws Exception
     */
    public String getPatientGroup(String patientCode){
        String code=null;
        try{
            if(patientGroup.size()==0){
    public String getPatientGroup(String patientCode) {
        String code = null;
        try {
            if (patientGroup.size() == 0) {
                initPatientGroup();
            }
            code= patientGroup.get(patientCode);
            if(StringUtils.isEmpty(code)){
                code="0";
            code = patientGroup.get(patientCode);
            if (StringUtils.isEmpty(code)) {
                code = "0";
            }
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
            return code;
        }
        return code;
    }
    private synchronized void initPatientGroup() throws  Exception{
        if(patientGroup.size()==0) {
            String sql="select patient,label from wlyy_sign_patient_label_info where label_type='1' and status=1";
            String countSql="select count(id) from wlyy_sign_patient_label_info where label_type='1' and status=1";
            List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class,sql,countSql,true);
    private synchronized void initPatientGroup() throws Exception {
        if (patientGroup.size() == 0) {
            String sql = "select patient,label from wlyy_sign_patient_label_info where label_type='1' and status=1";
            String countSql = "select count(id) from wlyy_sign_patient_label_info where label_type='1' and status=1";
            List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class, sql, countSql, true);
            for (SignPatientLabelInfo signPatientLabelInfo : signPatientLabelInfoList) {
                patientGroup.put(signPatientLabelInfo.getPatient(), signPatientLabelInfo.getLabel());
            }
@ -110,70 +119,72 @@ public class CachePool {
    /**
     * 查询某人的健康标签
     *
     * @param patientCode
     * @return
     * @throws Exception
     */
    public  String getHealthGroup(String patientCode){
    public String getHealthGroup(String patientCode) {
        String code;
        try{
            if(healthGroup.size()==0){
        try {
            if (healthGroup.size() == 0) {
                initHealthGroup();
            }
             code= healthGroup.get(patientCode);
        }catch (Exception e){
            code = healthGroup.get(patientCode);
        } catch (Exception e) {
            e.printStackTrace();
            return "0";
        }
        if(StringUtils.isEmpty(code)){
            code="0";
        if (StringUtils.isEmpty(code)) {
            code = "0";
        }
        return code;
    }
    private synchronized void initHealthGroup()  throws  Exception{
        if(healthGroup.size()==0){
            String sql="select patient,label from wlyy_sign_patient_label_info where label_type='2' and status=1";
            String countSql="select count(id) from wlyy_sign_patient_label_info where label_type='2' and status=1";
            List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class,sql,countSql,true);
            for(SignPatientLabelInfo signPatientLabelInfo:signPatientLabelInfoList){
                healthGroup.put(signPatientLabelInfo.getPatient(),signPatientLabelInfo.getLabel());
    private synchronized void initHealthGroup() throws Exception {
        if (healthGroup.size() == 0) {
            String sql = "select patient,label from wlyy_sign_patient_label_info where label_type='2' and status=1";
            String countSql = "select count(id) from wlyy_sign_patient_label_info where label_type='2' and status=1";
            List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class, sql, countSql, true);
            for (SignPatientLabelInfo signPatientLabelInfo : signPatientLabelInfoList) {
                healthGroup.put(signPatientLabelInfo.getPatient(), signPatientLabelInfo.getLabel());
            }
        }
    }
    /**
     * 查询某人的疾病标签
     *
     * @param patientCode
     * @return
     * @throws Exception
     */
    public  List<String> getDiseaseGroup(String patientCode) {
        try{
            if(diseaseGroup.size()==0){
    public List<String> getDiseaseGroup(String patientCode) {
        try {
            if (diseaseGroup.size() == 0) {
                initDiseaseGroup();
            }
            List<String> code= diseaseGroup.get(patientCode);
            List<String> code = diseaseGroup.get(patientCode);
            return code;
        }catch (Exception e){
        } catch (Exception e) {
            return null;
        }
    }
    private synchronized void initDiseaseGroup()  throws  Exception{
        if(diseaseGroup.size()==0){
            String sql="select patient,label from wlyy_sign_patient_label_info where label_type='3' and status=1";
            String countSql="select count(id) from wlyy_sign_patient_label_info where label_type='3' and status=1";
            List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class,sql,countSql,true);
            for(SignPatientLabelInfo signPatientLabelInfo:signPatientLabelInfoList){
                if(diseaseGroup.containsKey(signPatientLabelInfo.getPatient())){
                    List<String> code= diseaseGroup.get(signPatientLabelInfo.getPatient());
    private synchronized void initDiseaseGroup() throws Exception {
        if (diseaseGroup.size() == 0) {
            String sql = "select patient,label from wlyy_sign_patient_label_info where label_type='3' and status=1";
            String countSql = "select count(id) from wlyy_sign_patient_label_info where label_type='3' and status=1";
            List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class, sql, countSql, true);
            for (SignPatientLabelInfo signPatientLabelInfo : signPatientLabelInfoList) {
                if (diseaseGroup.containsKey(signPatientLabelInfo.getPatient())) {
                    List<String> code = diseaseGroup.get(signPatientLabelInfo.getPatient());
                    code.add(signPatientLabelInfo.getLabel());
                    diseaseGroup.put(signPatientLabelInfo.getPatient(),code);
                }else{
                    List<String> code=new ArrayList<>();
                    diseaseGroup.put(signPatientLabelInfo.getPatient(), code);
                } else {
                    List<String> code = new ArrayList<>();
                    code.add(signPatientLabelInfo.getLabel());
                    diseaseGroup.put(signPatientLabelInfo.getPatient(),code);
                    diseaseGroup.put(signPatientLabelInfo.getPatient(), code);
                }
            }
        }
@ -184,6 +195,7 @@ public class CachePool {
        patientGroup.clear();
        diseaseGroup.clear();
        healthGroup.clear();
        serverGroup.clear();
    }
    public static Map<String, CacheModel> getArriveSignFamilyExpenseStatus1Map() {
@ -194,9 +206,11 @@ public class CachePool {
        keys.clear();
        keys.addAll(keyTemp);
    }
    public static List<String> getKeys() {
        return keys;
    }
    public static Map<String, String> getPatientGroup() {
        return patientGroup;
    }
@ -208,4 +222,38 @@ public class CachePool {
    public static Map<String, List<String>> getDiseaseGroup() {
        return diseaseGroup;
    }
    public static List<String> getServerType(String signCode) {
        try {
            if (serverGroup.size() == 0) {
                initServerGroup();
            }
            List<String> code = serverGroup.get(signCode);
            return code;
        } catch (Exception e) {
            return null;
        }
    }
    private static void initServerGroup() {
        try {
            String sql = "select sign_code,server_type from wlyy_sign_family_server ";
            String countSql = "select count(id) from wlyy_sign_family_server ";
            List<SignFamilyServer> signPatientLabelInfoList = null;
            signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignFamilyServer.class, sql, countSql, true);
            for (SignFamilyServer signFamilyServer : signPatientLabelInfoList) {
                if (diseaseGroup.containsKey(signFamilyServer.getSignCode())) {
                    List<String> code = diseaseGroup.get(signFamilyServer.getSignCode());
                    code.add(signFamilyServer.getServerType());
                } else {
                    List<String> code = new ArrayList<>();
                    code.add(signFamilyServer.getServerType());
                    diseaseGroup.put(signFamilyServer.getServerType(), code);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

+ 11 - 13
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/Constant.java

@ -452,41 +452,39 @@ public class Constant {
                return "普通服务";
            }
            case "2": {
                return "老年人服务";
                return "未知2";
            }
            case "3": {
                return "慢性病服务";
                return "老年人";
            }
            case "4": {
                return "未知4";
                return "高血压";
            }
            case "5": {
                return "未知5";
                return "糖尿病";
            }
            case "6": {
                return "孕产妇";
            }
            case "7": {
                return "未知7";
                return "0-6岁儿童";
            }
            case "8": {
                return "儿童(0-6岁)";
                return "贫困人口";
            }
            case "9": {
                return "高血压";
                return "计生特殊人群";
            }
            case "10": {
                return "糖尿病";
                return "重性精神疾病";
            }
            case "11": {
                return "贫困人口";
                return "残疾人";
            }
            case "12": {
                return "计生特殊家庭";
            }
            case "13": {
                return "特殊人群";
                return "结核病";
            }
        }
        return "0";
    }

+ 62 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/model/signfamily/SignFamilyServer.java

@ -0,0 +1,62 @@
package com.yihu.wlyy.statistics.model.signfamily;
import com.yihu.wlyy.statistics.model.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2017/7/14.
 */
@Entity
@Table(name = "wlyy_sign_family_server")
public class SignFamilyServer extends IdEntity {
    private String signCode; //签约code
    private String serverType; //服务类型
    private String serverTypeName; //服务类型名称
    private Date czrq; //修改时间
    private Date createTime; //创建时间
    public String getSignCode() {
        return signCode;
    }
    public void setSignCode(String signCode) {
        this.signCode = signCode;
    }
    public String getServerType() {
        return serverType;
    }
    public void setServerType(String serverType) {
        this.serverType = serverType;
    }
    public String getServerTypeName() {
        return serverTypeName;
    }
    public void setServerTypeName(String serverTypeName) {
        this.serverTypeName = serverTypeName;
    }
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}