Parcourir la source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

esb il y a 8 ans
Parent
commit
7e00e896af
16 fichiers modifiés avec 1736 ajouts et 117 suppressions
  1. 7 11
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/SystemDict.java
  2. 7 11
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/SystemDictList.java
  3. 9 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientFamilyMemberDao.java
  4. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  5. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  6. 16 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java
  7. 10 4
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/HealthDataService.java
  8. 17 46
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/OutpatientService.java
  9. 1556 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsAllService.java
  10. 23 10
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  11. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  12. 3 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/HealthDataController.java
  13. 59 9
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/OutpatientController.java
  14. 8 8
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java
  15. 5 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java
  16. 13 10
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

+ 7 - 11
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/SystemDict.java

@ -1,10 +1,7 @@
package com.yihu.wlyy.entity.dict;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;
/**
@ -21,7 +18,7 @@ public class SystemDict  implements java.io.Serializable {
	private String value;
	private String pyCode;
	private Integer sort;
	private String id;
	private Integer id;
	// Constructors
@ -36,15 +33,14 @@ public class SystemDict  implements java.io.Serializable {
		this.value = value;
	}
	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false, length = 50)
	public String getId() {
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return id;
	}
	public void setId(String id) {
	public void setId(Integer id) {
		this.id = id;
	}

+ 7 - 11
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/SystemDictList.java

@ -1,10 +1,7 @@
package com.yihu.wlyy.entity.dict;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;
/**
@ -25,7 +22,7 @@ public class SystemDictList   implements java.io.Serializable {
	private String relationColCode;
	private String relationColValue;
	private String relationColExtend;
	private String id;
	private Integer id;
	// Constructors
	/** default constructor */
@ -56,15 +53,14 @@ public class SystemDictList   implements java.io.Serializable {
	}
	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false, length = 50)
	public String getId() {
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return id;
	}
	public void setId(String id) {
	public void setId(Integer id) {
		this.id = id;
	}

+ 9 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientFamilyMemberDao.java

@ -24,6 +24,15 @@ public interface PatientFamilyMemberDao extends PagingAndSortingRepository<Patie
     */
    PatientFamilyMember findByPatientAndFamilyMember(String patient,String member);
    /**
     * 查询居民的某个关系成员
     *
     * @param patient 居民
     * @param familyRelation 关系
     * @return
     */
    List<PatientFamilyMember> findByPatientAndFamilyRelation(String patient,Integer familyRelation);
    /**
     * 查找某个居民的家庭成员
     *

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -701,7 +701,7 @@ public class DoctorInfoService extends BaseService {
        Doctor docMobile = doctorDao.findByMobile(mobile);
        if (docMobile != null) {
        if (docMobile != null && !docMobile.getCode().equals(doctor)) {
            return -2;
        }

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java

@ -78,7 +78,7 @@ public class PatientInfoService extends BaseService {
		Patient pMobile = patientDao.findByMobile(mobile);
		if (pMobile == null) {
		if (pMobile != null && !pMobile.getCode().equals(patient)) {
			return -2;
		}

+ 16 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -83,9 +83,23 @@ public class FamilyMemberService extends BaseService {
        if (m == null) {
            return -2;
        }
        if(relation < 5) {
            List<PatientFamilyMember> familyMembers = memberDao.findByPatientAndFamilyRelation(patient, relation);
            if (familyMembers != null && familyMembers.size() > 0) {
                return -5;
            }
        }
        // 验证码验证
        if (StringUtils.isNotEmpty(captcha) && smsService.check(m.getMobile(), 10, captcha) != 1) {
            return -3;
        if (StringUtils.isNotEmpty(captcha)) {
            int checkStatus = smsService.check(m.getMobile(), 10, captcha);
            if(checkStatus == -2){
                return -6;  // 验证码过期
            } else if(checkStatus == -1){
                return -3; // 验证码错误
            }
        }
        if (StringUtils.isNotEmpty(password)) {
            String loginPassword = MD5.GetMD5Code(password + m.getSalt());

+ 10 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/HealthDataService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.app.record;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
@ -8,10 +9,13 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
@ -19,10 +23,13 @@ import java.util.List;
@Service
public class HealthDataService extends BaseService {
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * 获取健康档案信息
     */
    public JSONObject getHealthData(String strSSID, String strEvent, String strCatalog, String strSerial) throws Exception {
    public Map getHealthData(String strSSID, String strEvent, String strCatalog, String strSerial) throws Exception {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
        url = url + "/third/smjk/HealthData";
@ -33,8 +40,7 @@ public class HealthDataService extends BaseService {
        params.add(new BasicNameValuePair("strSerial", strSerial));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONObject result = new JSONObject();
        Map result = new HashMap<>();
        if (!StringUtils.isEmpty(response)){
            JSONObject jsonObject = new JSONObject(response);
            int status = jsonObject.getInt("status");
@ -42,7 +48,7 @@ public class HealthDataService extends BaseService {
                String xmlData = jsonObject.getString("data");
                if (!StringUtils.isEmpty(xmlData)){
                    String xmlJson = XMLUtil.xml2json(xmlData);
                    result = new JSONObject(xmlJson);
                    result = objectMapper.readValue(xmlJson, Map.class);
                }
            }
        }

Fichier diff supprimé car celui-ci est trop grand
+ 17 - 46
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/OutpatientService.java


+ 1556 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsAllService.java

@ -0,0 +1,1556 @@
package com.yihu.wlyy.service.app.statistics;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.statistics.PopulationBase;
import com.yihu.wlyy.repository.address.CityDao;
import com.yihu.wlyy.repository.address.TownDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.statistics.PopulationBaseDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * Created by lyr-pc on 2016/10/21.
 */
@Service
public class StatisticsAllService extends BaseService {
    @Autowired
    CityDao cityDao;
    @Autowired
    TownDao townDao;
    @Autowired
    DoctorDao doctorDao;
    @Autowired
    HospitalDao hospitalDao;
    @Autowired
    DoctorAdminTeamDao adminTeamDao;
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Autowired
    PopulationBaseDao peopleNumDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    /**
     * 获取时间戳
     *
     * @return
     */
    public String getQuotaTimeStamp() {
        return redisTemplate.opsForValue().get("quota:timeKey");
    }
    /**
     * 获取一级指标达到量
     *
     * @param endDate 截止日期
     * @param area    区域
     * @param index   指标
     * @param level   级别
     * @return
     */
    public long getIndexTotal(String endDate, String area, int level, String index) {
        long total = 0;
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        if (endDate.compareTo(dateFormat.format(new Date())) >= 0) {
            String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
            if (!StringUtils.isEmpty(val)) {
                JSONObject valJson = new JSONObject(val);
                if (valJson.has("num")) {
                    total = valJson.getInt("num");
                }
            }
        } else {
            // 查询语句
            String sql = " select " +
                    "     ifnull(result,'0') amount" +
                    " from  " +
                    "     wlyy_quota_result " +
                    " where " +
                    "     quato_code = ? " +
                    "   and level1_type = ? and del = '1'" +
                    "   and quota_date = ? ";
            if (level == 4) {
                // 市级别
                sql += " and city = ? ";
            } else if (level == 3) {
                // 区、城镇级别
                sql += " and town = ? ";
            } else if (level == 2) {
                // 机构级别
                sql += " and org_code = ? ";
            } else if (level == 1) {
                sql += " and qkdoctor_code = ?";
            }
            List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{index, level, endDate, area});
            if (result != null && result.size() > 0) {
                total = (result.get(0).get("amount") != null ? Long.valueOf(result.get(0).get("amount").toString()) : 0L);
            }
        }
        return total;
    }
    /**
     * 获取缴费
     *
     * @param endDate 截止日期
     * @param area    区域
     * @param level   级别
     * @return
     */
    public long getWeiJiaoFei(String endDate, String area, int level) {
        long total = 0;
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        if (endDate.compareTo(dateFormat.format(new Date())) >= 0) {
            String val = redisTemplate.opsForValue().get("quota:16:" + level + ":"+ area + ":0:" + getQuotaTimeStamp());
            if (!StringUtils.isEmpty(val)) {
                JSONObject valJson = new JSONObject(val);
                if (valJson.has("num")) {
                    total = valJson.getInt("num");
                }
            }
        } else {
            // 查询语句
            String sql = " select " +
                    "     ifnull(result,'0') amount" +
                    " from  " +
                    "     wlyy_quota_result " +
                    " where " +
                    "     quato_code = '16' " +
                    "   and level1_type = ? and del = '1'" +
                    "   and level2_type = '0' " +
                    "   and quota_date = ? ";
            if (level == 4) {
                // 市级别
                sql += " and city = ? ";
            } else if (level == 3) {
                // 区、城镇级别
                sql += " and town = ? ";
            } else if (level == 2) {
                // 机构级别
                sql += " and org_code = ? ";
            } else if (level == 1) {
                sql += " and qkdoctor_code = ?";
            }
            List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{level, endDate, area});
            if (result != null && result.size() > 0) {
                total = (result.get(0).get("amount") != null ? Long.valueOf(result.get(0).get("amount").toString()) : 0L);
            }
        }
        return total;
    }
    /**
     * 查询截止某个日期累计签约率
     *
     * @param endDate 截止日期
     * @param area    区域或机构代码
     * @param level   级别
     * @return
     */
    public JSONObject getSignRate(String endDate, String area, int level) throws Exception {
        JSONObject json = new JSONObject();
        long signAmount = getIndexTotal(endDate, area, level, "13");
        PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
        DecimalFormat df = new DecimalFormat("0.0000");
        if (peopleNum != null && peopleNum.getNum() > 0) {
            json.put("rate", df.format((signAmount * 1.0000) / peopleNum.getNum() * 100));
            json.put("sign", signAmount);
            json.put("people", peopleNum.getNum());
        } else {
            json.put("rate", "0.0000");
            json.put("sign", signAmount);
            json.put("people", 0);
        }
        return json;
    }
    /**
     * 查询截止某个日期签约完成率
     *
     * @param endDate 截止日期
     * @param area    区域或机构代码
     * @param level   级别
     * @return
     */
    public JSONObject getSignTaskRate(String endDate, String area, int level) throws Exception {
        JSONObject json = new JSONObject();
        long signAmount = getIndexTotal(endDate, area, level, "13");
        PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
        DecimalFormat df = new DecimalFormat("0.0000");
        if (peopleNum != null && peopleNum.getTaskNum() > 0) {
            json.put("rate", df.format((signAmount * 1.0000) / peopleNum.getTaskNum() * 100));
            json.put("sign", signAmount);
            json.put("people", peopleNum.getTaskNum());
        } else {
            json.put("rate", "0.0000");
            json.put("sign", signAmount);
            json.put("people", 0);
        }
        return json;
    }
    /**
     * 查询某个级别的某个指标到达量
     *
     * @param date
     * @param area
     * @param level
     * @param index
     * @param sort
     * @param lowLevel
     * @return
     * @throws Exception
     */
    public JSONArray getLowLevelTotal(String date, String area, int level, String index, int sort, String lowLevel) throws Exception {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();
        if (date.compareTo(dateFormat.format(new Date())) >= 0) {
            resultList = getTodayLowLevelTotal(date, area, level, index, lowLevel);
        } else {
            resultList = getTodayBeforeLowLevelTotal(date, area, level, index, sort, lowLevel);
        }
        // 结果为空时,自建结果集
        if (resultList == null || resultList.size() < 1) {
            resultList = getLowLevelMapKey(level, low_level, area);
        }
        if (resultList != null) {
            DecimalFormat df = new DecimalFormat("0.0000");
            for (Map<String, Object> map : resultList) {
                map.put("amount", map.get("amount") != null ? Long.valueOf(map.get("amount").toString()) : 0L);
                if (!low_level.equals("1")) {
                    String redisNum = redisTemplate.opsForValue().get("people:num:" + map.get("code").toString());
                    if (StringUtils.isEmpty(redisNum)) {
                        PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Calendar.getInstance().get(Calendar.YEAR));
                        if (peopleNum != null) {
                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getNum() * 100));
                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getTaskNum() * 100));
                            map.put("targetRate", df.format(peopleNum.getTaskNum() * 1.0000 / peopleNum.getNum() * 100));
                            map.put("num", peopleNum.getNum());
                            map.put("task", peopleNum.getTaskNum());
                        }
                    } else {
                        JSONObject peopleNum = new JSONObject(redisNum);
                        if (peopleNum != null) {
                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getInt("num") * 100));
                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getInt("taskNum") * 100));
                            map.put("targetRate", df.format(peopleNum.getInt("taskNum") * 1.0000 / peopleNum.getInt("num") * 100));
                            map.put("num", peopleNum.getInt("num"));
                            map.put("task", peopleNum.getInt("taskNum"));
                        }
                    }
                }
            }
            Collections.sort(resultList, new Comparator<Map<String, Object>>() {
                public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                    long map1value = (long) o1.get("amount");
                    long map2value = (long) o2.get("amount");
                    if (map1value - map2value > 0) {
                        return sort == 1 ? -1 : 1;
                    } else if (map1value - map2value < 0) {
                        return sort == 1 ? 1 : -1;
                    } else {
                        return 0;
                    }
                }
            });
            return new JSONArray(resultList);
        } else {
            return new JSONArray();
        }
    }
    /**
     * 获取过去某个日期某个区域一级指标的下级统计
     *
     * @param date
     * @param area
     * @param level
     * @param index
     * @param lowLevel
     * @return
     */
    public List<Map<String, Object>> getTodayBeforeLowLevelTotal(String date, String area, int level, String index, int sort, String lowLevel) throws Exception {
        List<Map<String, Object>> resultList = new ArrayList<>();
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        String areaField = "";
        String lowLevelField = "";
        String lowLevelName = "";
        if (level == 4) {
            // 市级别
            areaField = "city";
        } else if (level == 3) {
            // 区、城镇级别
            areaField = "town";
        } else if (level == 2) {
            // 机构级别
            areaField = "org_code";
        } else if (level == 1) {
            throw new Exception("param level error");
        }
        if (low_level.equals("3")) {
            lowLevelField = "town";
            lowLevelName = "town_name";
        } else if (low_level.equals("2")) {
            lowLevelField = "org_code";
            lowLevelName = "org_name";
        } else if (low_level.equals("1")) {
            lowLevelField = "qkdoctor_code";
            lowLevelName = "qkdoctor_name";
        } else {
            throw new Exception("param lowLevel error");
        }
        // 查询语句
        String sql = " select " +
                "     ifnull(" + lowLevelField + ",'') code " +
                "     ,ifnull(" + lowLevelName + ",'') 'name' " +
                "     ,ifnull(result,'0') amount" +
                " from  " +
                "     wlyy_quota_result " +
                " where " +
                "     quato_code = '" + index + "' " +
                "   and level1_type = ? and del = '1'" +
                "   and quota_date = ? " +
                "   and " + areaField + " = ? ";
        if (sort == 1) {
            sql += " order by amount desc";
        } else {
            sql += " order by amount asc ";
        }
        resultList = jdbcTemplate.queryForList(sql, new Object[]{low_level, date, area});
        return resultList;
    }
    /**
     * 获取今天某个区域一级指标的下级统计
     *
     * @param date
     * @param area
     * @param level
     * @param index
     * @param lowLevel
     * @return
     */
    public List<Map<String, Object>> getTodayLowLevelTotal(String date, String area, int level, String index, String lowLevel) {
        List<Map<String, Object>> resultList = new ArrayList<>();
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        String redisData = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + low_level + ":" + getQuotaTimeStamp());
        if (!StringUtils.isEmpty(redisData)) {
            JSONArray jsonArray = new JSONArray(redisData);
            for (int i = 0; i < jsonArray.length(); i++) {
                JSONObject json = jsonArray.getJSONObject(i);
                Map<String, Object> data = new HashMap<>();
                data.put("code", json.getString("code"));
                data.put("name", json.getString("name"));
                data.put("amount", Long.valueOf(String.valueOf(json.get("num"))));
                resultList.add(data);
            }
        }
        if (resultList.size() < 1) {
            resultList = getLowLevelMapKey(level, low_level, area);
        }
        return resultList;
    }
    /**
     * 获取下级统计key
     *
     * @param level
     * @param lowLevel
     * @param area
     * @return
     */
    public List<Map<String, Object>> getLowLevelMapKey(int level, String lowLevel, String area) {
        List<Map<String, Object>> resultList = new ArrayList<>();
        if (lowLevel.equals("3")) {
            List<Town> towns = townDao.findByCityCode(area);
            if (towns != null) {
                for (Town town : towns) {
                    Map<String, Object> obj = new HashMap<>();
                    obj.put("code", town.getCode());
                    obj.put("name", town.getName());
                    obj.put("amount", "0");
                    resultList.add(obj);
                }
            }
        } else if (lowLevel.equals("2")) {
            List<Town> towns = new ArrayList<>();
            if (level == 4) {
                towns = townDao.findByCityCode(area);
            } else if (level == 3) {
                Town town = townDao.findByCode(area);
                towns.add(town);
            }
            if (towns != null && towns.size() > 0) {
                for (Town town : towns) {
                    List<Hospital> hospitals = hospitalDao.findByTownCode(town.getCode());
                    for (Hospital hos : hospitals) {
                        if (hos.getCode().length() > 10) {
                            continue;
                        }
                        Map<String, Object> obj = new HashMap<>();
                        obj.put("code", hos.getCode());
                        obj.put("name", hos.getName());
                        obj.put("amount", "0");
                        resultList.add(obj);
                    }
                }
            }
        } else if (lowLevel.equals("1")) {
            List<Hospital> hospitals = new ArrayList<>();
            if (level == 4) {
                hospitals = hospitalDao.findByCity(area);
            } else if (level == 3) {
                hospitals = hospitalDao.findByTownCode(area);
            } else {
                Hospital hos = hospitalDao.findByCode(area);
                if (hos != null) {
                    hospitals.add(hos);
                }
            }
            if (hospitals != null && hospitals.size() > 0) {
                for (Hospital hos : hospitals) {
                    if (hos.getCode().length() > 10) {
                        continue;
                    }
                    List<AdminTeam> teams = adminTeamDao.findByOrgCode(hos.getCode());
                    for (AdminTeam team : teams) {
                        Map<String, Object> obj = new HashMap<>();
                        obj.put("code", String.valueOf(team.getId()));
                        obj.put("name", team.getName());
                        obj.put("amount", "0");
                        resultList.add(obj);
                    }
                }
            }
        }
        return resultList;
    }
    /**
     * 获取二级指标的到达量
     *
     * @param endDate
     * @param area
     * @param level
     * @param index
     * @return
     */
    public JSONArray getIndexLevelTwototal(String endDate, String area, int level, String index) {
        String areaField = "";
        SimpleDateFormat datef = new SimpleDateFormat("yyyy-MM-dd");
        List<Map<String, Object>> resultList = new ArrayList<>();
        if (endDate.compareTo(datef.format(new Date())) >= 0) {
            resultList = getTodayLevelTwoTotal(area, level, index);
        } else {
            resultList = getTodyBeforeLevelTwototal(endDate, area, level, index);
        }
        if (resultList != null) {
            long total = 0;
            for (Map<String, Object> map : resultList) {
                map.put("amount", map.get("amount") == null ? 0 : Math.round(Double.valueOf(map.get("amount").toString())));
                // 当天数据统计
                if (endDate.compareTo(new SimpleDateFormat("yyyy-MM-dd").format(new Date())) == 0) {
                    String code = map.get("code") != null ? String.valueOf(map.get("code")) : "";
                    String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + code + ":" + area + ":" + getQuotaTimeStamp());
                    if (!StringUtils.isEmpty(val)) {
                        JSONObject valJson = new JSONObject(val);
                        if (valJson.has("num")) {
                            map.put("amount", (long) map.get("amount") + valJson.getInt("num"));
                        }
                    }
                }
                if (index.equals("7")) {
                    // 分组指标总数算法
                    String code = map.get("code") != null ? String.valueOf(map.get("code")) : "";
                    if (code.equals("0") || code.equals("1") || code.equals("2") || code.equals("3") || code.equals("7")) {
                        total += (long) map.get("amount");
                    }
                } else if (index.equals("16")) {
                    String code = map.get("code") != null ? String.valueOf(map.get("code")) : "";
                    if (!code.equals("2")) {
                        total += (long) map.get("amount");
                    }
                } else {
                    total += (long) map.get("amount");
                }
            }
            if (!index.equals("8")) {
                DecimalFormat df = new DecimalFormat("0.0000");
                for (Map<String, Object> map : resultList) {
                    double rateG = (total > 0 ? ((long) map.get("amount")) * 1.0000 / total * 100 : 0);
                    map.put("rate", df.format(rateG));
                }
            }
            if (index.equals("6") && resultList.size() > 0) {
                int i = 0;
                boolean flag = false;
                for (; i < resultList.size(); i++) {
                    if (resultList.get(i).get("code") != null && String.valueOf(resultList.get(i).get("code")).equals("3")
                            && String.valueOf(resultList.get(i).get("amount")).equals("0")) {
                        flag = true;
                        break;
                    }
                }
                if (flag) {
                    resultList.remove(i);
                }
            }
            return new JSONArray(resultList);
        } else {
            return new JSONArray();
        }
    }
    /**
     * 获取二级指标的到达量
     *
     * @param endDate
     * @param area
     * @param level
     * @param index
     * @return
     */
    public List<Map<String, Object>> getTodyBeforeLevelTwototal(String endDate, String area, int level, String index) {
        String areaField = "";
        SimpleDateFormat datef = new SimpleDateFormat("yyyy-MM-dd");
        if (level == 4) {
            // 市级别
            areaField = "city";
        } else if (level == 3) {
            // 区、城镇级别
            areaField = "town";
        } else if (level == 2) {
            // 机构级别
            areaField = "org_code";
        } else if (level == 1) {
            // 团队
            areaField = "qkdoctor_code";
        }
        // 查询语句
        String sql = " select " +
                "     ifnull(level2_type,'') code " +
                "     ,ifnull(level2_type_name,'') 'name' " +
                "     ,ifnull(result,0.0) amount" +
                " from  " +
                "     wlyy_quota_result " +
                " where " +
                "     quato_code = '" + index + "' " +
                "   and level1_type = ? and del = '1'";
        sql += "   and quota_date = ? " +
                "   and " + areaField + " = ? " +
                " group by level2_type,level2_type_name";
        List<Map<String, Object>> resultList = new ArrayList<>();
        resultList = jdbcTemplate.queryForList(sql, new Object[]{level, endDate, area});
        if (resultList == null || resultList.size() < 1) {
            getLevelTwoMapKey(index);
        }
        return resultList;
    }
    /**
     * 查询某个指标的二级维度
     *
     * @param area
     * @param level
     * @param index
     * @return
     */
    public List<Map<String, Object>> getTodayLevelTwoTotal(String area, int level, String index) {
        List<Map<String, Object>> resultList = new ArrayList<>();
        String redisData = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
        if (!StringUtils.isEmpty(redisData)) {
            JSONArray jsonArray = new JSONArray(redisData);
            for (int i = 0; i < jsonArray.length(); i++) {
                JSONObject json = jsonArray.getJSONObject(i);
                Map<String, Object> data = new HashMap<>();
                data.put("code", json.getString("code"));
                data.put("name", json.getString("name"));
                data.put("amount", Long.valueOf(String.valueOf(json.get("num"))));
                resultList.add(data);
            }
        }
        if (resultList.size() < 1) {
            resultList = getLevelTwoMapKey(index);
        }
        return resultList;
    }
    /**
     * 获取某个二级指标的统计key
     *
     * @param index
     * @return
     */
    public List<Map<String, Object>> getLevelTwoMapKey(String index) {
        List<Map<String, Object>> resultList = new ArrayList<>();
        if (index.equals("6")) {
            Map<String, Object> women = new HashMap<>();
            women.put("code", "1");
            women.put("name", "女");
            women.put("amount", Double.valueOf("0.0"));
            resultList.add(women);
            Map<String, Object> man = new HashMap<>();
            man.put("code", "2");
            man.put("name", "男");
            man.put("amount", Double.valueOf("0.0"));
            resultList.add(man);
            Map<String, Object> unknown = new HashMap<>();
            unknown.put("code", "3");
            unknown.put("name", "未知");
            unknown.put("amount", Double.valueOf("0.0"));
            resultList.add(unknown);
        } else if (index.equals("7")) {
            Map<String, Object> nogroup = new HashMap<>();
            nogroup.put("code", "0");
            nogroup.put("name", "未分组");
            nogroup.put("amount", Double.valueOf("0.0"));
            resultList.add(nogroup);
            Map<String, Object> normal = new HashMap<>();
            normal.put("code", "1");
            normal.put("name", "普通人群");
            normal.put("amount", Double.valueOf("0.0"));
            resultList.add(normal);
            Map<String, Object> manbing = new HashMap<>();
            manbing.put("code", "2");
            manbing.put("name", "慢病人群65岁以下");
            manbing.put("amount", Double.valueOf("0.0"));
            resultList.add(manbing);
            Map<String, Object> upsixfive = new HashMap<>();
            upsixfive.put("code", "3");
            upsixfive.put("name", "65岁以上人群");
            upsixfive.put("amount", Double.valueOf("0.0"));
            resultList.add(upsixfive);
            Map<String, Object> gxy = new HashMap<>();
            gxy.put("code", "4");
            gxy.put("name", "高血压");
            gxy.put("amount", Double.valueOf("0.0"));
            resultList.add(gxy);
            Map<String, Object> tnb = new HashMap<>();
            tnb.put("code", "5");
            tnb.put("name", "糖尿病");
            tnb.put("amount", Double.valueOf("0.0"));
            resultList.add(tnb);
            Map<String, Object> tnbGxy = new HashMap<>();
            tnbGxy.put("code", "6");
            tnbGxy.put("name", "高血压和糖尿病");
            tnbGxy.put("amount", Double.valueOf("0.0"));
            resultList.add(tnb);
            Map<String, Object> mb65UpGxy = new HashMap<>();
            mb65UpGxy.put("code", "7");
            mb65UpGxy.put("name", "慢病人群65岁以上");
            mb65UpGxy.put("amount", Double.valueOf("0.0"));
            resultList.add(mb65UpGxy);
        } else if (index.equals("8")) {
            Map<String, Object> map1 = new HashMap<>();
            map1.put("code", "1");
            map1.put("name", "0~6");
            map1.put("amount", Double.valueOf("0.0"));
            resultList.add(map1);
            Map<String, Object> map2 = new HashMap<>();
            map2.put("code", "2");
            map2.put("name", "7~18");
            map2.put("amount", Double.valueOf("0.0"));
            resultList.add(map2);
            Map<String, Object> map3 = new HashMap<>();
            map3.put("code", "3");
            map3.put("name", "18~30");
            map3.put("amount", Double.valueOf("0.0"));
            resultList.add(map3);
            Map<String, Object> map4 = new HashMap<>();
            map4.put("code", "4");
            map4.put("name", "30~50");
            map4.put("amount", Double.valueOf("0.0"));
            resultList.add(map4);
            Map<String, Object> map5 = new HashMap<>();
            map5.put("code", "5");
            map5.put("name", "50~65");
            map5.put("amount", Double.valueOf("0.0"));
            resultList.add(map5);
            Map<String, Object> map6 = new HashMap<>();
            map6.put("code", "6");
            map6.put("name", "50~65");
            map6.put("amount", Double.valueOf("0.0"));
            resultList.add(map6);
        } else if (index.equals("16")) {
            Map<String, Object> map1 = new HashMap<>();
            map1.put("code", "0");
            map1.put("name", "未缴费人数");
            map1.put("amount", Double.valueOf("0.0"));
            resultList.add(map1);
            Map<String, Object> map2 = new HashMap<>();
            map2.put("code", "1");
            map2.put("name", "已缴费人数");
            map2.put("amount", Double.valueOf("0.0"));
            resultList.add(map2);
            Map<String, Object> map3 = new HashMap<>();
            map3.put("code", "2");
            map3.put("name", "已退费人数");
            map3.put("amount", Double.valueOf("0.0"));
            resultList.add(map3);
        } else if (index.equals("15")) {
            Map<String, Object> map1 = new HashMap<>();
            map1.put("code", "0");
            map1.put("name", "未标注");
            map1.put("amount", Double.valueOf("0.0"));
            resultList.add(map1);
            Map<String, Object> map2 = new HashMap<>();
            map2.put("code", "1");
            map2.put("name", "健康人群");
            map2.put("amount", Double.valueOf("0.0"));
            resultList.add(map2);
            Map<String, Object> map3 = new HashMap<>();
            map3.put("code", "2");
            map3.put("name", "患病人群");
            map3.put("amount", Double.valueOf("0.0"));
            resultList.add(map3);
            Map<String, Object> map4 = new HashMap<>();
            map4.put("code", "3");
            map4.put("name", "高危人群");
            map4.put("amount", Double.valueOf("0.0"));
            resultList.add(map4);
            Map<String, Object> map5 = new HashMap<>();
            map5.put("code", "4");
            map5.put("name", "恢复期人群");
            map5.put("amount", Double.valueOf("0.0"));
            resultList.add(map5);
        }
        return resultList;
    }
    /**
     * 统计65以上人群数据
     *
     * @param endDate
     * @param area
     * @param level
     * @return
     */
    public JSONArray getSixFiveStatistics(String endDate, String area, int level) {
        String areaField = "";
        SimpleDateFormat datef = new SimpleDateFormat("yyyy-MM-dd");
        List<Map<String, Object>> resultList = new ArrayList<>();
        if (endDate.compareTo(datef.format(new Date())) >= 0) {
            String redisData = redisTemplate.opsForValue().get("quota:12:" + level + ":" + area + ":6:" + getQuotaTimeStamp());
            if (!StringUtils.isEmpty(redisData)) {
                JSONArray jsonArray = new JSONArray(redisData);
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject json = jsonArray.getJSONObject(i);
                    Map<String, Object> data = new HashMap<>();
                    data.put("code", json.getString("code"));
                    data.put("name", json.getString("name"));
                    data.put("amount", Long.valueOf(String.valueOf(json.get("num"))));
                    resultList.add(data);
                }
            }
        } else {
            if (level == 4) {
                // 市级别
                areaField = "city";
            } else if (level == 3) {
                // 区、城镇级别
                areaField = "town";
            } else if (level == 2) {
                // 机构级别
                areaField = "org_code";
            } else if (level == 1) {
                // 团队
                areaField = "qkdoctor_code";
            }
            // 查询语句
            String sql = " select " +
                    "     ifnull(level3_type,'') code " +
                    "     ,ifnull(level3_type_name,'') 'name' " +
                    "     ,ifnull(result,0.0) amount" +
                    " from  " +
                    "     wlyy_quota_result " +
                    " where " +
                    "     quato_code = '12' " +
                    "   and level2_type = '6' " +
                    "   and level1_type = ? and del = '1'";
            sql += "   and quota_date = ? " +
                    "   and " + areaField + " = ? " +
                    " group by level3_type,level3_type_name";
            resultList = jdbcTemplate.queryForList(sql, new Object[]{level, endDate, area});
        }
        if (resultList == null || resultList.size() < 1) {
            resultList = new ArrayList<>();
            Map<String, Object> gxy = new HashMap<>();
            gxy.put("code", "1");
            gxy.put("name", "高血压");
            gxy.put("amount", Double.valueOf("0.0"));
            resultList.add(gxy);
            Map<String, Object> tnb = new HashMap<>();
            tnb.put("code", "2");
            tnb.put("name", "糖尿病");
            tnb.put("amount", Double.valueOf("0.0"));
            resultList.add(tnb);
            Map<String, Object> gxyTnb = new HashMap<>();
            gxyTnb.put("code", "3");
            gxyTnb.put("name", "高血压+糖尿病");
            gxyTnb.put("amount", Double.valueOf("0.0"));
            resultList.add(gxyTnb);
            Map<String, Object> jk = new HashMap<>();
            jk.put("code", "4");
            jk.put("name", "健康人群");
            jk.put("amount", Double.valueOf("0.0"));
            resultList.add(jk);
        }
        if (resultList != null) {
            for (Map<String, Object> map : resultList) {
                map.put("amount", map.get("amount") == null ? 0 : Math.round(Double.valueOf(map.get("amount").toString())));
            }
            // 65岁以上人群总数统计
            long sixFiveTotal = getSixFiveTotal(endDate, area, level);
            Map<String, Object> sixFive = new HashMap<>();
            sixFive.put("code", "0");
            sixFive.put("name", "总数");
            sixFive.put("amount", sixFiveTotal);
            resultList.add(sixFive);
            return new JSONArray(resultList);
        } else {
            return new JSONArray();
        }
    }
    /**
     * 获取65岁以上人群总数
     *
     * @param endDate
     * @param area
     * @param level
     * @return
     */
    public long getSixFiveTotal(String endDate, String area, int level) {
        String areaField = "";
        long total = 0;
        SimpleDateFormat datef = new SimpleDateFormat("yyyy-MM-dd");
        if (endDate.compareTo(datef.format(new Date())) >= 0) {
            String code = "6";
            String val = redisTemplate.opsForValue().get("quota:8:" + level + ":" + area + ":" + code + ":" + getQuotaTimeStamp());
            if (!StringUtils.isEmpty(val)) {
                JSONObject valJson = new JSONObject(val);
                if (valJson.has("num")) {
                    total = valJson.getInt("num");
                }
            }
        } else {
            if (level == 4) {
                // 市级别
                areaField = "city";
            } else if (level == 3) {
                // 区、城镇级别
                areaField = "town";
            } else if (level == 2) {
                // 机构级别
                areaField = "org_code";
            } else if (level == 1) {
                // 团队
                areaField = "qkdoctor_code";
            }
            // 查询语句
            String sql = " select " +
                    "     ifnull(result,0.0) amount" +
                    " from  " +
                    "     wlyy_quota_result " +
                    " where " +
                    "     quato_code = '8' " +
                    "   and level2_type = '6' " +
                    "   and level1_type = ? and del = '1'";
            sql += "   and quota_date = ? " +
                    "   and " + areaField + " = ? ";
            List<Map<String, Object>> result = null;
            result = jdbcTemplate.queryForList(sql, new Object[]{level, endDate, area});
            if (result != null && result.size() > 0) {
                total = (result.get(0).get("amount") == null ? 0 : Math.round(Double.valueOf(result.get(0).get("amount").toString())));
            }
        }
        return total;
    }
    /**
     * 查询某个日期范围内的某个指标每天到达量
     *
     * @param startDate
     * @param endDate
     * @param interval
     * @param area
     * @param level
     * @param index
     * @return
     */
    public JSONObject getDateTotal(String startDate, String endDate, int interval, String area, int level, String index) throws Exception {
        int taskNum = 0;
        JSONObject json = new JSONObject();
        if (level > 1) {
            String redisNum = redisTemplate.opsForValue().get("people:num:" + area);
            if (StringUtils.isEmpty(redisNum)) {
                PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
                if (peopleNum != null) {
                    taskNum = peopleNum.getTaskNum();
                }
            } else {
                JSONObject peopleNum = new JSONObject(redisNum);
                if (peopleNum != null) {
                    taskNum = peopleNum.getInt("taskNum");
                }
            }
        }
        json.put("taskNum", taskNum);
        if (interval == 1) {
            JSONArray jsonArray = dateTotalStatistics(startDate, endDate, area, level, index);
            json.put("data", jsonArray);
            return json;
        } else if (interval == 2) {
            JSONArray jsonArray = weekTotalStatistics(startDate, endDate, area, level, index);
            json.put("data", jsonArray);
            return json;
        } else if (interval == 3) {
            JSONArray jsonArray = monthTotalStatistics(startDate, endDate, area, level, index);
            json.put("data", jsonArray);
            return json;
        }
        return json;
    }
    /**
     * @param startDate
     * @param endDate
     * @param area
     * @param level
     * @param index
     * @return
     */
    public JSONArray dateTotalStatistics(String startDate, String endDate, String area, int level, String index) throws ParseException {
        String areaField = "";
        String sql = "";
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        String dateCon = endDate;
        if (endDate.compareTo(df.format(new Date())) == 0) {
            Calendar calendar = Calendar.getInstance();
            calendar.add(Calendar.DATE, -1);
            dateCon = df.format(calendar.getTime());
        }
        if (level == 4) {
            // 市级别
            areaField = "city";
        } else if (level == 3) {
            // 区、城镇级别
            areaField = "town";
        } else if (level == 2) {
            // 机构级别
            areaField = "org_code";
        } else if (level == 1) {
            // 机构级别
            areaField = "qkdoctor_code";
        }
        // 起始日期
        Calendar start = Calendar.getInstance();
        start.setTime(DateUtil.strToDate(startDate, DateUtil.YYYY_MM_DD));
        //结束日期
        Calendar end = Calendar.getInstance();
        end.setTime(DateUtil.strToDate(endDate, DateUtil.YYYY_MM_DD));
        // 日期集合
        List<Calendar> days = new ArrayList<>();
        days.add(start);
        boolean flag = true;
        if (startDate.compareTo(endDate) == 0) {
            flag = false;
        }
        // 计算统计日期
        while (flag) {
            Calendar next = Calendar.getInstance();
            next.setTime(days.get(days.size() - 1).getTime());
            next.add(Calendar.DATE, 1);
            if (df.format(next.getTime()).compareTo(endDate) < 0) {
                days.add(next);
            } else {
                days.add(end);
                flag = false;
            }
        }
        Map<String, JSONObject> countResult = new HashMap<>();
        // 统计预计构建
        for (int i = 0; i < days.size(); i++) {
            String startStr = "";
            long amount = 0;
            startStr = df.format(days.get(i).getTime());
            // 当前范围包含当天,则需添加当天的统计数据
            if (startStr.compareTo(df.format(new Date())) == 0) {
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
                if (!StringUtils.isEmpty(val)) {
                    JSONObject valJson = new JSONObject(val);
                    if (valJson.has("num")) {
                        amount = (long) valJson.getInt("num");
                    }
                }
            }
            JSONObject range = new JSONObject();
            range.put("range", startStr);
            range.put("amount", amount);
            countResult.put(startStr, range);
        }
        if (startDate.equals(df.format(new Date()))) {
            Calendar preDate = Calendar.getInstance();
            preDate.setTime(df.parse(endDate));
            preDate.add(Calendar.DATE, -1);
            startDate = df.format(preDate.getTime());
        }
        sql = " select " +
                "     ifnull(quota_date,'') as 'range' " +
                "     ,ifnull(result,'0') amount " +
                " from  " +
                "     wlyy_quota_result " +
                " where " +
                "     quato_code = '" + index + "' " +
                "   and level1_type = '" + level + "' and del = '1' " +
                "   and quota_date >= '" + startDate + "' " +
                "   and quota_date <= '" + dateCon + "' " +
                "   and " + areaField + " = '" + area + "' ";
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql);
        if (resultList != null) {
            for (Map<String, Object> map : resultList) {
                if (countResult.containsKey(map.get("range").toString())) {
                    JSONObject range = (JSONObject) countResult.get(map.get("range").toString());
                    long amount = range.getLong("amount");
                    long resultAmount = map.get("amount") != null ? Long.valueOf(map.get("amount").toString()) : 0L;
                    range.put("amount", amount + resultAmount);
                }
            }
            List<JSONObject> result = new ArrayList<>(countResult.values());
            result.sort(new Comparator<JSONObject>() {
                @Override
                public int compare(JSONObject o1, JSONObject o2) {
                    if (o1.getString("range").compareTo(o2.getString("range")) > 0) {
                        return 1;
                    } else if (o1.getString("range").compareTo(o2.getString("range")) < 0) {
                        return -1;
                    } else {
                        return 0;
                    }
                }
            });
            return new JSONArray(result);
        } else {
            return new JSONArray();
        }
    }
    /**
     * 按周统计
     *
     * @param startDate
     * @param endDate
     * @param area
     * @param level
     * @param index
     * @return
     */
    private JSONArray weekTotalStatistics(String startDate, String endDate, String area, int level, String index) throws Exception {
        String areaField = "";
        String sql = "";
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        String dateCon = endDate;
        if (endDate.compareTo(df.format(new Date())) == 0) {
            Calendar calendar = Calendar.getInstance();
            calendar.add(Calendar.DATE, -1);
            dateCon = df.format(calendar.getTime());
        }
        if (level == 4) {
            // 市级别
            areaField = "city";
        } else if (level == 3) {
            // 区、城镇级别
            areaField = "town";
        } else if (level == 2) {
            // 机构级别
            areaField = "org_code";
        } else if (level == 1) {
            // 机构级别
            areaField = "qkdoctor_code";
        }
        // 起始日期
        Calendar start = Calendar.getInstance();
        start.setTime(DateUtil.strToDate(startDate, DateUtil.YYYY_MM_DD));
        // 第一个统计周期结束日期
        String firstEnd = "";
        // 结束日期
        Calendar end = Calendar.getInstance();
        end.setTime(DateUtil.strToDate(endDate, DateUtil.YYYY_MM_DD));
        // 起始日期为周几
        int week = start.get(Calendar.DAY_OF_WEEK);
        int incre = 7 - week + 1;
        // 日期集合
        List<Calendar> days = new ArrayList<>();
        days.add(start);
        boolean flag = true;
        int i = 0;
        if (startDate.compareTo(endDate) == 0) {
            flag = false;
            days.add(end);
            firstEnd = df.format(end.getTime());
        }
        // 计算统计日期
        while (flag) {
            Calendar next = Calendar.getInstance();
            next.setTime(days.get(days.size() - 1).getTime());
            if (i == 0) {
                if (incre != 7) {
                    next.add(Calendar.DATE, incre);
                }
            } else {
                next.add(Calendar.DATE, 7);
            }
            if (df.format(next.getTime()).compareTo(df.format(end.getTime())) < 0) {
                days.add(next);
                if (i == 0) {
                    firstEnd = df.format(next.getTime());
                }
            } else {
                days.add(end);
                flag = false;
                if (i == 0) {
                    firstEnd = df.format(end.getTime());
                }
            }
            i++;
        }
        // 结果集
        Map<String, JSONObject> countResult = new HashMap<>();
        // 算出每个查询周期
        for (int j = 0; j < days.size() - 1; j++) {
            String startStr = "";
            String endStr = df.format(days.get(j + 1).getTime());
            long amount = 0;
            // 起始、截止日期
            if (j == 0) {
                startStr = df.format(days.get(j).getTime());
            } else {
                Calendar cal = Calendar.getInstance();
                cal.setTime(days.get(j).getTime());
                cal.add(Calendar.DATE, 1);
                startStr = df.format(cal.getTime());
            }
            // 当前范围包含当天,则需添加当天的统计数据
            if (startStr.compareTo(df.format(new Date())) <= 0 && endStr.compareTo(df.format(new Date())) >= 0) {
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
                if (!StringUtils.isEmpty(val)) {
                    JSONObject valJson = new JSONObject(val);
                    if (valJson.has("num")) {
                        amount = valJson.getInt("num");
                    }
                }
            }
            JSONObject range = new JSONObject();
            range.put("range", endStr);
            range.put("amount", amount);
            countResult.put(endStr, range);
        }
        if (startDate.equals(df.format(new Date()))) {
            Calendar preDate = Calendar.getInstance();
            preDate.setTime(df.parse(endDate));
            preDate.add(Calendar.DATE, -1);
            startDate = df.format(preDate.getTime());
        }
        // 查询时间范围内所有记录
        sql = " select " +
                "     ifnull(quota_date,'') as 'range' " +
                "     ,ifnull(result,'0') amount " +
                " from  " +
                "     wlyy_quota_result " +
                " where " +
                "     quato_code = '" + index + "' " +
                "   and level1_type = '" + level + "' and del = '1' " +
                "   and quota_date >= '" + startDate + "' " +
                "   and quota_date <= '" + dateCon + "' " +
                "   and " + areaField + " = '" + area + "' ";
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql);
        if (resultList != null) {
            // 计算结果
            for (Map<String, Object> map : resultList) {
                String range = map.get("range").toString();
                JSONObject json = countResult.get(range);
                if (json != null) {
                    long amount = map.get("amount") == null ? 0L : Long.valueOf(map.get("amount").toString());
                    json.put("amount", amount);
                }
            }
            List<JSONObject> result = new ArrayList<>(countResult.values());
            // 排序
            result.sort(new Comparator<JSONObject>() {
                @Override
                public int compare(JSONObject o1, JSONObject o2) {
                    if (o1.getString("range").compareTo(o2.getString("range")) > 0) {
                        return 1;
                    } else if (o1.getString("range").compareTo(o2.getString("range")) < 0) {
                        return -1;
                    } else {
                        return 0;
                    }
                }
            });
            return new JSONArray(result);
        } else {
            return new JSONArray();
        }
    }
    /**
     * 按月统计
     *
     * @param startDate
     * @param endDate
     * @param area
     * @param level
     * @param index
     * @return
     * @throws Exception
     */
    private JSONArray monthTotalStatistics(String startDate, String endDate, String area, int level, String index) throws Exception {
        String areaField = "";
        String sql = "";
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        String dateCon = endDate;
        if (endDate.compareTo(df.format(new Date())) == 0) {
            Calendar calendar = Calendar.getInstance();
            calendar.add(Calendar.DATE, -1);
            dateCon = df.format(calendar.getTime());
        }
        if (level == 4) {
            // 市级别
            areaField = "city";
        } else if (level == 3) {
            // 区、城镇级别
            areaField = "town";
        } else if (level == 2) {
            // 机构级别
            areaField = "org_code";
        } else if (level == 1) {
            // 机构级别
            areaField = "qkdoctor_code";
        }
        // 起始日期
        Calendar start = Calendar.getInstance();
        start.setTime(DateUtil.strToDate(startDate, DateUtil.YYYY_MM_DD));
        // 结束日期
        Calendar end = Calendar.getInstance();
        end.setTime(DateUtil.strToDate(endDate, DateUtil.YYYY_MM_DD));
        // 第一个结束日期
        String firstEnd = "";
        // 日期集合
        List<Calendar> days = new ArrayList<>();
        days.add(start);
        boolean flag = true;
        int k = 0;
        if (startDate.compareTo(endDate) == 0) {
            flag = false;
            days.add(end);
        }
        // 统计日期计算
        while (flag) {
            Calendar next = Calendar.getInstance();
            next.setTime(days.get(days.size() - 1).getTime());
            if (k == 0) {
                next.add(Calendar.MONTH, 1);
            } else {
                next.add(Calendar.MONTH, 2);
            }
            next.set(Calendar.DAY_OF_MONTH, 1);
            next.add(Calendar.DAY_OF_MONTH, -1);
            if (df.format(next.getTime()).compareTo(df.format(end.getTime())) < 0) {
                days.add(next);
            } else {
                days.add(end);
                flag = false;
            }
            k++;
        }
        // 统计结果
        Map<String, JSONObject> countResult = new HashMap<>();
        for (int i = 0; i < days.size() - 1; i++) {
            String startStr = "";
            String endStr = df.format(days.get(i + 1).getTime());
            int amount = 0;
            // 起始时间计算
            if (i == 0) {
                startStr = df.format(days.get(i).getTime());
            } else {
                Calendar cal = Calendar.getInstance();
                cal.setTime(days.get(i).getTime());
                cal.add(Calendar.DATE, 1);
                startStr = df.format(cal.getTime());
            }
            // 当天数据计算
            if (startStr.compareTo(df.format(new Date())) <= 0 && endStr.compareTo(df.format(new Date())) >= 0) {
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
                if (!StringUtils.isEmpty(val)) {
                    JSONObject valJson = new JSONObject(val);
                    if (valJson.has("num")) {
                        amount = valJson.getInt("num");
                    }
                }
            }
            JSONObject range = new JSONObject();
            range.put("range", endStr);
            range.put("amount", amount);
            countResult.put(endStr, range);
        }
        if (startDate.equals(df.format(new Date()))) {
            Calendar preDate = Calendar.getInstance();
            preDate.setTime(df.parse(endDate));
            preDate.add(Calendar.DATE, -1);
            startDate = df.format(preDate.getTime());
        }
        // 查询时间范围内所有记录
        sql = " select " +
                "     ifnull(quota_date,'') as 'range' " +
                "     ,ifnull(result,'0') amount " +
                " from  " +
                "     wlyy_quota_result " +
                " where " +
                "     quato_code = '" + index + "' " +
                "   and level1_type = '" + level + "' and del = '1' " +
                "   and quota_date >= '" + startDate + "' " +
                "   and quota_date <= '" + dateCon + "' " +
                "   and " + areaField + " = '" + area + "' ";
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql);
        if (resultList != null) {
            String pre = "";
            if (endDate.equals(df.format(new Date()))) {
                Calendar preDate = Calendar.getInstance();
                preDate.setTime(df.parse(endDate));
                preDate.add(Calendar.DATE, -1);
                pre = df.format(preDate.getTime());
            }
            // 计算结果
            for (Map<String, Object> map : resultList) {
                String range = map.get("range").toString();
                JSONObject json = countResult.get(range);
                if (json != null) {
                    long amount = map.get("amount") == null ? 0L : Long.valueOf(map.get("amount").toString());
                    json.put("amount", amount);
                }
            }
            List<JSONObject> result = new ArrayList<>(countResult.values());
            // 排序
            result.sort(new Comparator<JSONObject>() {
                @Override
                public int compare(JSONObject o1, JSONObject o2) {
                    if (o1.getString("range").compareTo(o2.getString("range")) > 0) {
                        return 1;
                    } else if (o1.getString("range").compareTo(o2.getString("range")) < 0) {
                        return -1;
                    } else {
                        return 0;
                    }
                }
            });
            return new JSONArray(result);
        } else {
            return new JSONArray();
        }
    }
}

+ 23 - 10
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -70,6 +70,11 @@ public class StatisticsService extends BaseService {
    private StringRedisTemplate redisTemplate;
    /**
     * 获取上次统计时间
     *
     * @return
     */
    public String getStatisticsTime() {
        String date = redisTemplate.opsForValue().get("quota:date");
@ -77,6 +82,15 @@ public class StatisticsService extends BaseService {
    }
    /**
     * 获取时间戳
     *
     * @return
     */
    public String getQuotaTimeStamp() {
        return redisTemplate.opsForValue().get("quota:timeKey");
    }
    /**
     * 缓存人口数据到redis
     *
@ -130,7 +144,7 @@ public class StatisticsService extends BaseService {
        // 截止日期包含当天,则从redis查询当天统计数据
        if (endDate.compareTo(new SimpleDateFormat("yyyy-MM-dd").format(new Date())) >= 0) {
            String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area);
            String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
            if (!StringUtils.isEmpty(val)) {
                JSONObject valJson = new JSONObject(val);
                if (valJson.has("num")) {
@ -192,7 +206,7 @@ public class StatisticsService extends BaseService {
        // 截止日期包含当天,则从redis查询当天统计数据
        if (endDate.compareTo(new SimpleDateFormat("yyyy-MM-dd").format(new Date())) >= 0) {
            String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area);
            String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
            if (!StringUtils.isEmpty(val)) {
                JSONObject valJson = new JSONObject(val);
                if (valJson.has("num")) {
@ -256,7 +270,7 @@ public class StatisticsService extends BaseService {
        // 截止日期包含当天,则从redis查询当天统计数据
        if (endDate.compareTo(new SimpleDateFormat("yyyy-MM-dd").format(new Date())) >= 0) {
            String val = redisTemplate.opsForValue().get("quota:16:" + level + ":0:" + area);
            String val = redisTemplate.opsForValue().get("quota:16:" + level + ":" + area + ":0:" + getQuotaTimeStamp());
            if (!StringUtils.isEmpty(val)) {
                JSONObject valJson = new JSONObject(val);
                if (valJson.has("num")) {
@ -368,7 +382,7 @@ public class StatisticsService extends BaseService {
        // 截止日期包含当天,则从redis查询当天统计数据
        if (endDate.compareTo(new SimpleDateFormat("yyyy-MM-dd").format(new Date())) >= 0) {
            String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area);
            String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
            if (!StringUtils.isEmpty(val)) {
                JSONObject valJson = new JSONObject(val);
                if (valJson.has("num")) {
@ -528,7 +542,7 @@ public class StatisticsService extends BaseService {
                // 截止日期包含当天,则从redis查询当天统计数据
                if (endDate.compareTo(new SimpleDateFormat("yyyy-MM-dd").format(new Date())) >= 0) {
                    String code = map.get("code") != null ? String.valueOf(map.get("code")) : "";
                    String val = redisTemplate.opsForValue().get("quota:" + index + ":" + low_level + ":" + code);
                    String val = redisTemplate.opsForValue().get("quota:" + index + ":" + low_level + ":" + code + ":" + getQuotaTimeStamp());
                    if (!StringUtils.isEmpty(val)) {
                        JSONObject valJson = new JSONObject(val);
                        if (valJson.has("num")) {
@ -721,7 +735,7 @@ public class StatisticsService extends BaseService {
                // 截止日期包含当天,则从redis查询当天统计数据
                if (endDate.compareTo(new SimpleDateFormat("yyyy-MM-dd").format(new Date())) >= 0) {
                    String code = map.get("code") != null ? String.valueOf(map.get("code")) : "";
                    String val = redisTemplate.opsForValue().get("quota:" + index + ":" + low_level + ":" + code);
                    String val = redisTemplate.opsForValue().get("quota:" + index + ":" + low_level + ":" + code + ":" + getQuotaTimeStamp());
                    if (!StringUtils.isEmpty(val)) {
                        JSONObject valJson = new JSONObject(val);
                        if (valJson.has("num")) {
@ -844,7 +858,7 @@ public class StatisticsService extends BaseService {
            // 当前范围包含当天,则需添加当天的统计数据
            if (startStr.compareTo(today) == 0) {
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area);
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
                if (!StringUtils.isEmpty(val)) {
                    JSONObject valJson = new JSONObject(val);
                    if (valJson.has("num")) {
@ -1008,7 +1022,7 @@ public class StatisticsService extends BaseService {
            // 当前范围包含当天,则需添加当天的统计数据
            if (startStr.compareTo(today) <= 0 && endStr.compareTo(today) >= 0) {
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area);
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
                if (!StringUtils.isEmpty(val)) {
                    JSONObject valJson = new JSONObject(val);
                    if (valJson.has("num")) {
@ -1204,7 +1218,7 @@ public class StatisticsService extends BaseService {
            // 当天数据计算
            if (startStr.compareTo(today) <= 0 && endStr.compareTo(today) >= 0) {
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area);
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
                if (!StringUtils.isEmpty(val)) {
                    JSONObject valJson = new JSONObject(val);
                    if (valJson.has("num")) {
@ -2796,7 +2810,6 @@ public class StatisticsService extends BaseService {
                        }
                    }
                }
                if (index.equals(GROUP)) {
                    // 分组指标总数算法
                    String code = map.get("code") != null ? String.valueOf(map.get("code")) : "";

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -139,7 +139,7 @@ public class PatientService extends TokenService {
				json.put("token", token.getToken());
				json.put("name", temp.getName());
				json.put("photo", temp.getPhoto());
				new Thread(new SignSsGetTask(patient.getIdcard())).start();
				//new Thread(new SignSsGetTask(patient.getIdcard())).start();
				return json;
			}
		}

+ 3 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/HealthDataController.java

@ -5,7 +5,6 @@ import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
@ -14,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@ -42,7 +43,7 @@ public class HealthDataController extends BaseController {
                                @ApiParam(name="strSerial",value="该类别顺序号,默认填1",defaultValue = "1")
                                @RequestParam(value="strSerial",required = true) String strSerial) {
        try {
            JSONObject data = healthDataService.getHealthData(strSSID, strEvent, strCatalog, strSerial);
            Map data = healthDataService.getHealthData(strSSID, strEvent, strCatalog, strSerial);
            return write(200, "获取健康档案信息成功!", "data", data);
        } catch (Exception e) {

+ 59 - 9
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/OutpatientController.java

@ -5,14 +5,12 @@ import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
@ -49,12 +47,40 @@ public class OutpatientController extends BaseController {
    @ApiOperation("XML转JSOn")
    @RequestMapping(value = "/xmlToJson", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @RequestMapping(value = "/xmlToJson", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    public String xmlToJson(
            @ApiParam(name="xml",value="xml")
            @RequestBody String xml) {
        try {
            Map result = outpatientService.xmlToJson(xml);
            return write(200, "获取XML转JSOn数据成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取XML转JSOn数据成功!");
        }
    }
    @ApiOperation("get0102")
    @RequestMapping(value = "/get0102", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String get0102() {
        try {
            Map result = outpatientService.getOutpatientCost();
            return write(200, "获取JSOn数据成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取JSOn数据成功!");
        }
    }
    @ApiOperation("get0121")
    @RequestMapping(value = "/get0121", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String xmlToJson(@ApiParam(name="strSSID",value="xml",defaultValue = "B09036263193")
                                      @RequestParam(value="xml",required = true) String xml) {
    public String get0121() {
        try {
            JSONObject result = outpatientService.xmlToJson(xml);
            Map result = outpatientService.getOutpatientLabReport();
            return write(200, "获取JSOn数据成功!", "data", result);
        } catch (Exception e) {
            error(e);
@ -62,6 +88,30 @@ public class OutpatientController extends BaseController {
        }
    }
    @ApiOperation("get0131")
    @RequestMapping(value = "/get0131", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String get0131() {
        try {
            Map result = outpatientService.getOutpatientExamReport();
            return write(200, "获取JSOn数据成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取JSOn数据成功!");
        }
    }
    @ApiOperation("get0141")
    @RequestMapping(value = "/get0141", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String get0141() {
        try {
            Map result = outpatientService.getOutpatientDrugs();
            return write(200, "获取JSOn数据成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取JSOn数据成功!");
        }
    }
}

+ 8 - 8
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -515,14 +515,14 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                        }
                    }
                }
                String resultStr = HttpUtil.sendPost(checkUrl + "/third/sign/LoadSanshiSignFamily?idcard=" + idCard, "");
                if (!StringUtils.isEmpty(resultStr)) {
                    JSONObject checkJson = new JSONObject(resultStr);
                    if (checkJson.getInt("status") != 200) {
                        throw new Exception("sanshi sign get from jw failed");
                    }
                }
//                String resultStr = HttpUtil.sendPost(checkUrl + "/third/sign/LoadSanshiSignFamily?idcard=" + idCard, "");
//
//                if (!StringUtils.isEmpty(resultStr)) {
//                    JSONObject checkJson = new JSONObject(resultStr);
//                    if (checkJson.getInt("status") != 200) {
//                        throw new Exception("sanshi sign get from jw failed");
//                    }
//                }
            } catch (Exception e) {
                e.printStackTrace();
            }

+ 5 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java

@ -59,9 +59,13 @@ public class FamilyMemberController extends BaseController {
            } else if (result == -2) {
                return error(-1, "该成员未注册");
            } else if (result == -3) {
                return error(-1, StringUtils.isNotEmpty(captcha) ? "验证码错误" : "密码错误");
                return error(-1, StringUtils.isNotEmpty(captcha) ? "请输入正确的验证码" : "密码错误");
            } else if (result == -4) {
                return error(-1, "该家庭成员已存在");
            } else if (result == -5) {
                return error(-1, "该家庭关系已存在成员");
            } else if (result == -6) {
                return error(-1, "验证码已过期,请重新获取验证码");
            } else if (result == 0) {
                return error(-1, "不能添加自己");
            } else {

+ 13 - 10
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.statistic;
import com.yihu.wlyy.entity.statistics.PopulationBase;
import com.yihu.wlyy.service.app.statistics.StatisticsAllService;
import com.yihu.wlyy.service.app.statistics.StatisticsService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -24,6 +25,8 @@ public class StatisticsController extends BaseController {
    @Autowired
    StatisticsService statisticsService;
    @Autowired
    StatisticsAllService statisticsAllService;
    /**
     * 获取统计时间
@ -201,7 +204,7 @@ public class StatisticsController extends BaseController {
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
                result.put("index_" + idx, statisticsService.getIndexLevelTwototal(endDate, area, level, idx));
                result.put("index_" + idx, statisticsAllService.getIndexLevelTwototal(endDate, area, level, idx));
            }
            return write(200, "查询成功", "data", result);
@ -226,10 +229,10 @@ public class StatisticsController extends BaseController {
        try {
            JSONObject result = new JSONObject();
            long sign = statisticsService.getIndexTotal(endDate, area, level, "13");
            long weiJf = statisticsService.getWeiJiaoFei(endDate, area, level);
            JSONObject signRate = statisticsService.getSignRate(endDate, area, level);
            JSONObject signTaskRate = statisticsService.getSignTaskRate(endDate, area, level);
            long sign = statisticsAllService.getIndexTotal(endDate, area, level, "13");
            long weiJf = statisticsAllService.getWeiJiaoFei(endDate, area, level);
            JSONObject signRate = statisticsAllService.getSignRate(endDate, area, level);
            JSONObject signTaskRate = statisticsAllService.getSignTaskRate(endDate, area, level);
            result.put("sign", sign);
            result.put("expenses", weiJf);
@ -256,7 +259,7 @@ public class StatisticsController extends BaseController {
    @ResponseBody
    public String getSixFiveStatistics(String startDate, String endDate, String area, int level) {
        try {
            JSONArray result = statisticsService.getSixFiveStatistics(endDate, area, level);
            JSONArray result = statisticsAllService.getSixFiveStatistics(endDate, area, level);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
@ -285,7 +288,7 @@ public class StatisticsController extends BaseController {
            if (index != null) {
                for (String idx : indexes) {
                    result.put("index_" + idx, statisticsService.getDateTotal(startDate, endDate, interval, area, level, idx));
                    result.put("index_" + idx, statisticsAllService.getDateTotal(startDate, endDate, interval, area, level, idx));
                }
            }
@ -313,7 +316,7 @@ public class StatisticsController extends BaseController {
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
                result.put("index_" + idx, statisticsService.getLowLevelTotal(date, area, level, idx, sort, lowLevel));
                result.put("index_" + idx, statisticsAllService.getLowLevelTotal(date, area, level, idx, sort, lowLevel));
            }
            return write(200, "查询成功", "data", result);
@ -340,7 +343,7 @@ public class StatisticsController extends BaseController {
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
                result.put("index_" + idx, statisticsService.getIndexLevelTwototal(date, area, level, idx));
                result.put("index_" + idx, statisticsAllService.getIndexLevelTwototal(date, area, level, idx));
            }
            return write(200, "查询成功", "data", result);
@ -367,7 +370,7 @@ public class StatisticsController extends BaseController {
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
                result.put("index_" + idx, statisticsService.getIndexTotal(endDate, area, level, idx));
                result.put("index_" + idx, statisticsAllService.getIndexTotal(endDate, area, level, idx));
            }
            return write(200, "查询成功", "data", result);