Browse Source

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

sand 8 years ago
parent
commit
f95e4e6a85

+ 8 - 0
src/main/java/com/yihu/wlyy/entity/WlyyQuota.java

@ -22,6 +22,7 @@ public class WlyyQuota implements java.io.Serializable {
	private String name;//指标名称
	private String level1;//指标维度(1:机构维度)
	private String level2;//2级维度 (1:患者性别 2:患者分组 3:患者年龄)
	private String level3;//3级维度 (1:患者疾病)
	private String cycle;//统计周期( 1:天 )
	private String type;//尺度(1 新增 2是累计)
	private Date createTime;//创建时间
@ -122,5 +123,12 @@ public class WlyyQuota implements java.io.Serializable {
		this.del = del;
	}
	@Column(name = "level_3", length = 2)
	public String getLevel3() {
		return level3;
	}
	public void setLevel3(String level3) {
		this.level3 = level3;
	}
}

+ 20 - 0
src/main/java/com/yihu/wlyy/entity/WlyyQuotaResult.java

@ -27,6 +27,8 @@ public class WlyyQuotaResult implements java.io.Serializable {
    private String level1Type;//等级 1:团队 2社区机构 3区级 4市级
    private String level2Type;//如果有二级维度那么这个存的是二级维度的code 例如二级维度是性别 那么这个存 1
    private String level2TypeName;//如果有二级维度那么这个存的是二级维度的code 例如二级维度是性别 那么这个存 男
    private String level3Type;//如果有三级维度那么这个存的是三级维度的code 例如三级维度是疾病 那么这个存 1
    private String level3TypeName;//如果有三级维度那么这个存的是三级维度的code 例如三级维度是疾病 那么这个存 高血压
    private String city;//市
    private String cityName;//市级名称
    private String town;//区级
@ -222,4 +224,22 @@ public class WlyyQuotaResult implements java.io.Serializable {
    public void setLevel2TypeName(String level2TypeName) {
        this.level2TypeName = level2TypeName;
    }
    @Column(name = "level3_type", length = 50)
    public String getLevel3Type() {
        return level3Type;
    }
    public void setLevel3Type(String level3Type) {
        this.level3Type = level3Type;
    }
    @Column(name = "level3_type_name", length = 50)
    public String getLevel3TypeName() {
        return level3TypeName;
    }
    public void setLevel3TypeName(String level3TypeName) {
        this.level3TypeName = level3TypeName;
    }
}

+ 48 - 0
src/main/java/com/yihu/wlyy/job/Constant.java

@ -43,4 +43,52 @@ public class Constant {
    public static String level_group_4_name="高血压";
    public static String level_group_5_name="糖尿病";
    public static String level_group_100_name="糖尿病和高血压";
    //三级维度的疾病
    public static String level_disease_1="1";
    public static String level_disease_2="2";
    public static String level_disease_3="3";
    public static String level_disease_1_name="高血压";
    public static String level_disease_2_name="糖尿病";
    public static String level_disease_3_name="糖尿病和高血压";
    public static String getLevelAgeName(String key){
        switch (key){
            case "1":{
                return level_age_1_name;
            }
            case "2":{
                return level_age_2_name;
            }
            case "3":{
                return level_age_3_name;
            }
            case "4":{
                return level_age_4_name;
            }
            case "5":{
                return level_age_5_name;
            }
            case "6":{
                return level_age_6_name;
            }
        }
        return "";
    }
    public static String getLevelDiseaseName(String key){
        switch (key){
            case "1":{
                return level_disease_1_name;
            }
            case "2":{
                return level_disease_2_name;
            }
            case "100":{
                return level_disease_3_name;
            }
        }
        return "";
    }
}

+ 189 - 0
src/main/java/com/yihu/wlyy/job/CurrentDayAllQuotaJob.java

@ -120,13 +120,202 @@ public class CurrentDayAllQuotaJob implements Job {
        computequota_8();//统计今天的签约患者年龄
        computequota_9();//统计今天的待签约
        computequota_10();//统计今天的改签
        computequota_12();//统计今天的签约下按年龄分组后再按疾病统计
        wlyyJobLog.setJobContent("开始实时统计查询");
        wlyyJobLog.setJobName("实时统计");
        wlyyJobLog.setJobId("11");
        wlyyJobLog.setJobType("1");
        wlyyJobLog.setJobEndTime(new Date());
        wlyyJobLogDao.save(wlyyJobLog);
    }
    private void computequota_12() throws Exception{
        String now = getDayString(0);
        String tomorrow = getDayString(1);
        //找出今天的签约信息 yesterday,now
        //查找出系统全部的机构
        List<Hospital> hospitals = hospitalDao.findHospital2();
        Map<String, Hospital> hospitalsMap = new HashMap<String, Hospital>();
        for (Hospital hospital : hospitals) {
            hospitalsMap.put(hospital.getCode(), hospital);
        }
        //查找出厦门市全部的区
        List<Town> towns = townDao.findByCityCode(Constant.city);
        Map<String, Town> townsMap = new HashMap<String, Town>();
        for (Town town : towns) {
            townsMap.put(town.getCode(), town);
        }
        //找出今天的签约信息
        List<SignFamily> signFamilys = signFamilyDao.findByJiatingSignYesterday(now, tomorrow);
        //数组里面第一个是健康人群 第二个是慢病人群 第三个是65岁以上人群
        Map<String, Map<String, Map>> cityAgeMap = new HashMap<String, Map<String, Map>>();//key是市行政代码 目前只有厦门市
        Map<String,Map> temp =new HashMap<String,Map>();
        cityAgeMap.put(Constant.city, temp);
        Map<String, Map<String, Map>> townAgeMap = new HashMap<String, Map<String, Map>>();//key是区行政代码
        Map<String, Map<String, Map>> orgAgeMap = new HashMap<String, Map<String, Map>>();//key是机构代码
        //统计有签约的
        for (SignFamily signFamily : signFamilys) {
            Hospital hospital = hospitalsMap.get(signFamily.getHospital());//得到患者签约的机构
            String town = hospital.getTown();
            int age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard());//根据card解析年龄
            String ageCode = getAgeCode(age);//得到年龄的code
            boolean hasGXY = false;//有高血压
            boolean hasTNB = false;//有糖尿病
            //如果是慢病的 统计高血压的 糖尿病  1高血压,2糖尿病  糖尿病和高血压是100
            String diseaseType="";
            String jsonString = redisTemplate.opsForValue().get("disease:" + signFamily.getPatient());
            if (StringUtils.isEmpty(jsonString)) {
                continue;
            }
            //排除数据 只留下高血压和糖尿病
            List<JSONObject> jsonObjects = new ArrayList<JSONObject>();
            JSONArray redisValues = new JSONArray(jsonString);
            for (Object obj : redisValues) {
                JSONObject redisValue = new JSONObject(obj);
                //排除掉三师签约
                if ("1".equals(redisValue.get("signType").toString())) {
                    continue;
                }
                String disease = redisValue.get("disease").toString();
                if (Integer.valueOf(disease).equals("1")) {
                    jsonObjects.add(redisValue);
                    hasGXY = true;//设置有高血压
                    diseaseType="1";
                }
                if (Integer.valueOf(disease).equals("2")) {
                    jsonObjects.add(redisValue);
                    hasTNB = true;//设置有糖尿病
                    diseaseType="2";
                }
            }
            if(hasGXY&&hasTNB){
                diseaseType="100";
            }
            //统计市
            compute(cityAgeMap, Constant.city, ageCode, diseaseType);
            //统计区
            compute(townAgeMap, town, ageCode, diseaseType);
            //统计机构
            //统计站
            if (!"00".equals(hospital.getCode().substring(8))) {
                String orgCodeTemp = hospital.getCode().substring(0, 8) + "00";
                //统计机构
                compute(orgAgeMap, orgCodeTemp, ageCode, diseaseType);
            } else {
                compute(orgAgeMap, hospital.getCode(), ageCode, diseaseType);
            }
        }
        //保存市级数据
        for (Map.Entry<String, Map<String, Map>> entry : cityAgeMap.entrySet()) {
            Map<String, Map> oneAgeMap = entry.getValue();
            for(int i=1;i<7;i++){
                for(int j=1;j<4;j++){
                    String key_2=i+"";
                    String key_3=j+"";
                    String name=Constant.cityName;
                    JSONObject jsonObject=new JSONObject();
                    if (oneAgeMap != null && oneAgeMap.containsKey(key_2)) {
                        Map<String,Long> key3Map=oneAgeMap.get(key_2);
                        if(key3Map!=null&&key3Map.containsKey(key_3)){
                            jsonObject.put("num",entry.getValue().get((key3Map.get(key_3) + "")));
                        }else{
                            jsonObject.put("num",0);
                        }
                    } else {
                        jsonObject.put("num",0);
                    }
                    jsonObject.put("name",name);
                    jsonObject.put("date", DateUtil.dateToStrLong(new Date()));
                    redisTemplate.opsForValue().set(new StringBuffer("quota:12:4:"+i+":"+j+":"+entry.getKey()).toString(),jsonObject.toString());
                }
            }
        }
        //保存区级
        for (Map.Entry<String, Town> entry : townsMap.entrySet()) {
            //判断该区是否有统计数据
            Map<String, Map> oneAgeMap = townAgeMap.get(entry.getKey());//得到当个区的统计数据
            Town townObj = entry.getValue();//得到区级信息
            for(int i=1;i<7;i++){
                for(int j=1;j<4;j++){
                    String key_2=i+"";
                    String key_3=j+"";
                    String name=townObj.getName();
                    JSONObject jsonObject=new JSONObject();
                    if (oneAgeMap != null && oneAgeMap.containsKey(key_2)) {
                        Map<String,Long> key3Map=oneAgeMap.get(key_2);
                        if(key3Map!=null&&key3Map.containsKey(key_3)){
                            jsonObject.put("num",(key3Map.get(key_3) + ""));
                        }else{
                            jsonObject.put("num",0);
                        }
                    } else {
                        jsonObject.put("num",0);
                    }
                    jsonObject.put("name",townObj.getName());
                    jsonObject.put("date", DateUtil.dateToStrLong(new Date()));
                    redisTemplate.opsForValue().set(new StringBuffer("quota:12:3:"+i+":"+j+":"+entry.getKey()).toString(),jsonObject.toString());
                }
            }
        }
        //保存机构级
        for (Map.Entry<String, Hospital> entry : hospitalsMap.entrySet()) {
            //判断该机构是否有统计数据
            Map<String, Map> oneAgeMap = orgAgeMap.get(entry.getKey());//得到当个机构的统计数据
            Hospital hospital = entry.getValue();//得到机构信息
            for(int i=1;i<7;i++){
                for(int j=1;j<4;j++){
                    String key_2=i+"";
                    String key_3=j+"";
                    String name=hospital.getName();
                    JSONObject jsonObject=new JSONObject();
                    if (oneAgeMap != null && oneAgeMap.containsKey(key_2)) {
                        Map<String,Long> key3Map=oneAgeMap.get(key_2);
                        if(key3Map!=null&&key3Map.containsKey(key_3)){
                            jsonObject.put("num",(key3Map.get(key_3) + ""));
                        }else{
                            jsonObject.put("num",0);
                        }
                    } else {
                        jsonObject.put("num",0);
                    }
                    jsonObject.put("name",name);
                    jsonObject.put("date", DateUtil.dateToStrLong(new Date()));
                    redisTemplate.opsForValue().set(new StringBuffer("quota:12:2:"+i+":"+j+":"+entry.getKey()).toString(),jsonObject.toString());
                }
            }
        }
    }
    private void compute(Map<String, Map<String, Map>> rootMap, String rootKey, String ageCode, String diseaseType) {
        if (rootMap.containsKey(rootKey)) {
            //得到市下面的所有的年龄map
            Map<String, Map> groupMapTemp = rootMap.get(rootKey);
            if(groupMapTemp.containsKey(ageCode)){
                //得到这个年龄下的患者map
                Map<String,Long> mape= groupMapTemp.get(ageCode);
                if(mape.containsKey(diseaseType)){
                    mape.put(diseaseType,mape.get(diseaseType)+1L);
                }else{
                    mape.put(diseaseType,1L);
                }
            }else{
                //新增疾病的统计map
                Map<String, Long> groupMapTemp1 = new HashMap<String, Long>();
                groupMapTemp1.put(diseaseType, 1L);
                groupMapTemp.put(ageCode,groupMapTemp1);
            }
        } else {
            //没有就新建统计数据  新增疾病的统计map
            Map<String, Long> groupMapTemp = new HashMap<String, Long>();
            groupMapTemp.put(diseaseType, 1L);
            //把统计疾病的map放入对应的年龄组map中
            Map<String, Map> groupMapTemp2 = new HashMap<String, Map>();
            groupMapTemp2.put(ageCode,groupMapTemp);
            //把年龄组map放入市的map里面
            rootMap.put(rootKey, groupMapTemp2);
        }
    }
    private void computequota_1() {
        //签约需要的统计map
        Map<String, JSONObject> tjCityMap = new HashMap<>();//区级的统计map key 是区行政区划350200

+ 330 - 0
src/main/java/com/yihu/wlyy/job/SignAgeGroupDiseaseJob.java

@ -0,0 +1,330 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.entity.SignFamily;
import com.yihu.wlyy.entity.WlyyJobLog;
import com.yihu.wlyy.entity.WlyyQuotaResult;
import com.yihu.wlyy.entity.address.Hospital;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.web.quota.WlyyJobConfigVO;
import com.yihu.wlyy.web.quota.WlyyQuotaVO;
import org.json.JSONArray;
import org.json.JSONObject;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * 签约下按年龄分组后再按疾病统计
 */
@Component
public class SignAgeGroupDiseaseJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象
    @Autowired
    private WlyyQuotaResultDao wlyyQuotaResultDao;//指标结果Dao
    @Autowired
    private WlyyJobLogDao wlyyJobLogDao;//执行日志Dao
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private HospitalDao hospitalDao;
    @Autowired
    private TownDao townDao;
    @Autowired
    private DoctorPatientGroupInfoDao doctorPatientGroupInfoDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private StringRedisTemplate redisTemplate;
    String yesterday;
    String now;
    @Override
    public void execute(JobExecutionContext context)
            throws JobExecutionException {
        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
        //初始化参数
        JobDataMap map = context.getJobDetail().getJobDataMap();
        wlyyQuota = (WlyyQuotaVO) map.get("quota");
        wlyyJobConfig = (WlyyJobConfigVO) map.get("jobConfig");
        now = StringUtils.isEmpty(map.get("now")) ? SignAgeGroupDiseaseJob.getDayString(0) : map.get("now").toString();
        yesterday = StringUtils.isEmpty(map.get("yesterday")) ? SignAgeGroupDiseaseJob.getDayString(-1) : map.get("yesterday").toString();
        computequotaByPatientAge();
    }
    /**
     * 机构维度患者年龄维度计算指标
     */
    @Transactional
    private void computequotaByPatientAge() {
        try {
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+12+"'");
            //新建任务日志对象
            WlyyJobLog wlyyJobLog = new WlyyJobLog();
            wlyyJobLog.setJobStartTime(new Date());
            wlyyJobLog.setJobId(wlyyJobConfig.getId());
            wlyyJobLog.setJobName(wlyyJobConfig.getJobName());
            //查找出系统全部的机构
            List<Hospital> hospitals = hospitalDao.findHospital2();
            Map<String, Hospital> hospitalsMap = new HashMap<String, Hospital>();
            for (Hospital hospital : hospitals) {
                hospitalsMap.put(hospital.getCode(), hospital);
            }
            //查找出厦门市全部的区
            List<Town> towns = townDao.findByCityCode(Constant.city);
            Map<String, Town> townsMap = new HashMap<String, Town>();
            for (Town town : towns) {
                townsMap.put(town.getCode(), town);
            }
            //找出今天的签约信息
            List<SignFamily> signFamilys = signFamilyDao.findByJiatingSignYesterday(yesterday, now);
            //数组里面第一个是健康人群 第二个是慢病人群 第三个是65岁以上人群
            Map<String, Map<String, Map>> cityAgeMap = new HashMap<String, Map<String, Map>>();//key是市行政代码 目前只有厦门市
            Map<String,Map> temp =new HashMap<String,Map>();
            cityAgeMap.put(Constant.city, temp);
            Map<String, Map<String, Map>> townAgeMap = new HashMap<String, Map<String, Map>>();//key是区行政代码
            Map<String, Map<String, Map>> orgAgeMap = new HashMap<String, Map<String, Map>>();//key是机构代码
            //统计有签约的
            for (SignFamily signFamily : signFamilys) {
                Hospital hospital = hospitalsMap.get(signFamily.getHospital());//得到患者签约的机构
                String town = hospital.getTown();
                int age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard());//根据card解析年龄
                String ageCode = getAgeCode(age);//得到年龄的code
                boolean hasGXY = false;//有高血压
                boolean hasTNB = false;//有糖尿病
                //如果是慢病的 统计高血压的 糖尿病  1高血压,2糖尿病  糖尿病和高血压是100
                String diseaseType="";
                String jsonString = redisTemplate.opsForValue().get("disease:" + signFamily.getPatient());
                if (StringUtils.isEmpty(jsonString)) {
                    continue;
                }
                //排除数据 只留下高血压和糖尿病
                List<JSONObject> jsonObjects = new ArrayList<JSONObject>();
                JSONArray redisValues = new JSONArray(jsonString);
                for (Object obj : redisValues) {
                    JSONObject redisValue = new JSONObject(obj);
                    //排除掉三师签约
                    if ("1".equals(redisValue.get("signType").toString())) {
                        continue;
                    }
                    String disease = redisValue.get("disease").toString();
                    if (Integer.valueOf(disease).equals("1")) {
                        jsonObjects.add(redisValue);
                        hasGXY = true;//设置有高血压
                        diseaseType="1";
                    }
                    if (Integer.valueOf(disease).equals("2")) {
                        jsonObjects.add(redisValue);
                        hasTNB = true;//设置有糖尿病
                        diseaseType="2";
                    }
                }
                if(hasGXY&&hasTNB){
                    diseaseType="100";
                }
                //统计市
                compute(cityAgeMap, Constant.city, ageCode, diseaseType);
                //统计区
                compute(townAgeMap, town, ageCode, diseaseType);
                //统计机构
                //统计站
                if (!"00".equals(hospital.getCode().substring(8))) {
                    String orgCodeTemp = hospital.getCode().substring(0, 8) + "00";
                    //统计机构
                    compute(orgAgeMap, orgCodeTemp, ageCode, diseaseType);
                } else {
                    compute(orgAgeMap, hospital.getCode(), ageCode, diseaseType);
                }
            }
            //保存统计数据
            // 保存市的统计数据
            for (Map.Entry<String, Map<String, Map>> entry : cityAgeMap.entrySet()) {
               Map<String, Map> oneAgeMap = entry.getValue();
               for(int i=1;i<7;i++){
                   for(int j=1;j<4;j++){
                       String key_2=i+"";
                       String key_3=j+"";
                       String city=Constant.city;
                       String cityName=Constant.cityName;
                       String town="";
                       String townName="";
                       String org="";
                       String orgName="";
                       save(oneAgeMap, key_2, key_3, city, cityName, town, townName, org, orgName,"4");
                   }
               }
            }
            //保存区级
            for (Map.Entry<String, Town> entry : townsMap.entrySet()) {
                //判断该区是否有统计数据
                Map<String, Map> oneAgeMap = townAgeMap.get(entry.getKey());//得到当个区的统计数据
                Town townObj = entry.getValue();//得到区级信息
                for(int i=1;i<7;i++){
                    for(int j=1;j<4;j++){
                        String key_2=i+"";
                        String key_3=j+"";
                        String city=Constant.city;
                        String cityName=Constant.cityName;
                        String town=townObj.getCode();
                        String townName=townObj.getName();
                        String org="";
                        String orgName="";
                        save(oneAgeMap, key_2, key_3, city, cityName, town, townName, org, orgName,"3");
                    }
                }
            }
            for (Map.Entry<String, Hospital> entry : hospitalsMap.entrySet()) {
                //判断该机构是否有统计数据
                Map<String, Map> oneAgeMap = orgAgeMap.get(entry.getKey());//得到当个机构的统计数据
                Hospital hospital = entry.getValue();//得到机构信息
                for(int i=1;i<7;i++){
                    for(int j=1;j<4;j++){
                        String key_2=i+"";
                        String key_3=j+"";
                        String city=Constant.city;
                        String cityName=Constant.cityName;
                        String town=hospital.getTown();
                        String townName=hospital.getTownName();
                        String org=hospital.getCode();
                        String orgName=hospital.getName();
                        save(oneAgeMap, key_2, key_3, city, cityName, town, townName, org, orgName,"2");
                    }
                }
            }
            wlyyJobLog.setJobEndTime(new Date());
            wlyyJobLog.setJobContent("统计" + getYesterday() + " 的签约患者年龄数据完成 ");
            wlyyJobLog.setJobType("1");
            wlyyJobLogDao.save(wlyyJobLog);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    private void save(Map<String, Map> oneAgeMap, String key_2, String key_3, String city, String cityName, String town, String townName, String org, String orgName,String level) {
        WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
        wlyyQuotaResult.setDel("1");
        wlyyQuotaResult.setCity(city);
        wlyyQuotaResult.setCityName(cityName);
        wlyyQuotaResult.setTown(town);
        wlyyQuotaResult.setTownName(townName);
        wlyyQuotaResult.setOrgCode(org);
        wlyyQuotaResult.setOrgName(orgName);
        wlyyQuotaResult.setQuatoCode(wlyyQuota.getId());
        wlyyQuotaResult.setQuatoName(wlyyQuota.getName());
        wlyyQuotaResult.setQuotaDate(getYesterday());
        wlyyQuotaResult.setCreateTime(new Date());
        wlyyQuotaResult.setLevel1Type(level);//等级
        wlyyQuotaResult.setLevel2Type(key_2);
        wlyyQuotaResult.setLevel2TypeName(Constant.getLevelAgeName(key_2));
        wlyyQuotaResult.setLevel3Type(key_3);
        wlyyQuotaResult.setLevel3TypeName(Constant.getLevelDiseaseName(key_3));
        if (oneAgeMap != null && oneAgeMap.containsKey(key_2)) {
            Map<String,Long> key3Map=oneAgeMap.get(key_2);
            if(key3Map!=null&&key3Map.containsKey(key_3)){
                wlyyQuotaResult.setResult(key3Map.get(key_3) + "");
            }else{
                wlyyQuotaResult.setResult("0");
            }
        } else {
            wlyyQuotaResult.setResult("0");
        }
        wlyyQuotaResultDao.save(wlyyQuotaResult);
    }
    private void compute(Map<String, Map<String, Map>> rootMap, String rootKey, String ageCode, String diseaseType) {
        if (rootMap.containsKey(rootKey)) {
            //得到市下面的所有的年龄map
            Map<String, Map> groupMapTemp = rootMap.get(rootKey);
            if(groupMapTemp.containsKey(ageCode)){
                //得到这个年龄下的患者map
                Map<String,Long> mape= groupMapTemp.get(ageCode);
                if(mape.containsKey(diseaseType)){
                    mape.put(diseaseType,mape.get(diseaseType)+1L);
                }else{
                    mape.put(diseaseType,1L);
                }
            }else{
                //新增疾病的统计map
                Map<String, Long> groupMapTemp1 = new HashMap<String, Long>();
                groupMapTemp1.put(diseaseType, 1L);
                groupMapTemp.put(ageCode,groupMapTemp1);
            }
        } else {
            //没有就新建统计数据  新增疾病的统计map
            Map<String, Long> groupMapTemp = new HashMap<String, Long>();
            groupMapTemp.put(diseaseType, 1L);
            //把统计疾病的map放入对应的年龄组map中
            Map<String, Map> groupMapTemp2 = new HashMap<String, Map>();
            groupMapTemp2.put(ageCode,groupMapTemp);
            //把年龄组map放入市的map里面
            rootMap.put(rootKey, groupMapTemp2);
        }
    }
    /*
    得到昨天的日期字符串  yyyy-MM-dd
     */
    public String getYesterday() {
        return yesterday;
    }
    /**
     * 根据年龄得到对应的code
     *
     * @param age
     * @return
     */
    public String getAgeCode(int age) {
        if (age < 7) {
            return Constant.level_age_1;
        } else if (age >= 7 && age < 18) {
            return Constant.level_age_2;
        } else if (age >= 18 && age < 30) {
            return Constant.level_age_3;
        } else if (age >= 30 && age < 50) {
            return Constant.level_age_4;
        } else if (age >= 50 && age < 65) {
            return Constant.level_age_5;
        } else {
            return Constant.level_age_6;
        }
    }
    public static String getDayString(Integer size) {
        Date date = new Date();//取时间
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        calendar.add(calendar.DATE, size);//把日期往后增加一天.整数往后推,负数往前移动
        date = calendar.getTime(); //这个时间就是日期往后推一天的结果
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        String dateString = formatter.format(date);
        return dateString;
    }
    public static void main(String[] args) {
        getDayString(0);
    }
}