|
@ -5,6 +5,7 @@ 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.entity.statistics.WlyyQuotaResult;
|
|
|
import com.yihu.wlyy.job.Constant;
|
|
|
import com.yihu.wlyy.repository.address.CityDao;
|
|
|
import com.yihu.wlyy.repository.address.TownDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
|
|
@ -273,7 +274,7 @@ public class StatisticsAllService extends BaseService {
|
|
|
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));
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Integer.valueOf(Constant.getNowYear()));
|
|
|
DecimalFormat df = new DecimalFormat("0.0000");
|
|
|
|
|
|
if (peopleNum != null && peopleNum.getNum() > 0) {
|
|
@ -302,7 +303,7 @@ public class StatisticsAllService extends BaseService {
|
|
|
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));
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area,Integer.valueOf( Constant.getNowYear()));
|
|
|
DecimalFormat df = new DecimalFormat("0.0000");
|
|
|
|
|
|
if (peopleNum != null && peopleNum.getTaskNum() > 0) {
|
|
@ -330,7 +331,7 @@ public class StatisticsAllService extends BaseService {
|
|
|
* @param level
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject getGroupInfo(String endDate, String lowCode, String area, int level) {
|
|
|
public JSONObject getGroupInfo(String endDate, String lowCode, String area, int level) throws ParseException {
|
|
|
JSONObject json = new JSONObject();
|
|
|
long total = 0;
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
@ -399,7 +400,7 @@ public class StatisticsAllService extends BaseService {
|
|
|
redisNum = "";
|
|
|
}
|
|
|
if (StringUtils.isEmpty(redisNum)) {
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area,Integer.valueOf( Constant.getNowYear()));
|
|
|
if (peopleNum != null) {
|
|
|
if (lowCode.equals("3")) {
|
|
|
num = peopleNum.getSixFiveNum();
|
|
@ -490,7 +491,7 @@ public class StatisticsAllService extends BaseService {
|
|
|
redisNum = "";
|
|
|
}
|
|
|
if (StringUtils.isEmpty(redisNum)) {
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Calendar.getInstance().get(Calendar.YEAR));
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Integer.valueOf( Constant.getNowYear()));
|
|
|
if (peopleNum != null) {
|
|
|
int num = 0;
|
|
|
int taskNum = 0;
|
|
@ -609,7 +610,7 @@ public class StatisticsAllService extends BaseService {
|
|
|
redisNum = "";
|
|
|
}
|
|
|
if (StringUtils.isEmpty(redisNum)) {
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Calendar.getInstance().get(Calendar.YEAR));
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(),Integer.valueOf( Constant.getNowYear()));
|
|
|
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));
|
|
@ -703,7 +704,7 @@ public class StatisticsAllService extends BaseService {
|
|
|
redisNum = "";
|
|
|
}
|
|
|
if (StringUtils.isEmpty(redisNum)) {
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Calendar.getInstance().get(Calendar.YEAR));
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(),Integer.valueOf( Constant.getNowYear()));
|
|
|
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));
|
|
@ -1878,7 +1879,7 @@ public class StatisticsAllService extends BaseService {
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isEmpty(redisNum)) {
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area,Integer.valueOf( Constant.getNowYear()));
|
|
|
if (peopleNum != null) {
|
|
|
taskNum = peopleNum.getTaskNum();
|
|
|
}
|
|
@ -1897,7 +1898,7 @@ public class StatisticsAllService extends BaseService {
|
|
|
redisNum = "";
|
|
|
}
|
|
|
if (StringUtils.isEmpty(redisNum)) {
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Integer.valueOf( Constant.getNowYear()));
|
|
|
if (peopleNum != null) {
|
|
|
if (lowCode.equals("3")) {
|
|
|
taskNum = peopleNum.getSixFiveTaskNum();
|
|
@ -2514,7 +2515,7 @@ public class StatisticsAllService extends BaseService {
|
|
|
redisNum = "";
|
|
|
}
|
|
|
if (StringUtils.isEmpty(redisNum)) {
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Calendar.getInstance().get(Calendar.YEAR));
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Integer.valueOf( Constant.getNowYear()));
|
|
|
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));
|
|
@ -2774,7 +2775,7 @@ public class StatisticsAllService extends BaseService {
|
|
|
redisNum = "";
|
|
|
}
|
|
|
if (StringUtils.isEmpty(redisNum)) {
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Calendar.getInstance().get(Calendar.YEAR));
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Integer.valueOf( Constant.getNowYear()));
|
|
|
if (peopleNum != null) {
|
|
|
int num = 0;
|
|
|
int taskNum = 0;
|
|
@ -2850,11 +2851,12 @@ public class StatisticsAllService extends BaseService {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public String getRange(int first, int second, int i) {
|
|
|
if(second==0&&first>0){
|
|
|
if (second == 0 && first > 0) {
|
|
|
//如果分母为0 分子不为0 返回100%
|
|
|
return "100%";
|
|
|
}else if(second==0&&first==0){
|
|
|
} else if (second == 0 && first == 0) {
|
|
|
//如果分母为0 分子为0 返回0%
|
|
|
return "0%";
|
|
|
}
|
|
@ -2870,16 +2872,25 @@ public class StatisticsAllService extends BaseService {
|
|
|
String lastDate = year + "-06-30";
|
|
|
|
|
|
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 = getLevelTwoTodayLowLevelTotal(area, level, index, sort, lowLevel, lowCode);
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();//续签量
|
|
|
List<Map<String, Object>> resultListSignIn = new ArrayList<>();//签入量
|
|
|
resultList = getLevelTwoTodayLowLevelTotal(area, level, index, sort, lowLevel, lowCode);
|
|
|
String indexTemp = "";
|
|
|
if ("1".equals(lowLevel)) {
|
|
|
indexTemp = "34";//团队的签入指标
|
|
|
} else if ("2".equals(lowLevel)) {
|
|
|
indexTemp = "38";//机构的签入指标
|
|
|
} else {
|
|
|
// 查询当天以前的数据
|
|
|
resultList = getLevelTwoTodayBeforeLowLevelTotal(date, area, level, index, sort, lowLevel, lowCode);
|
|
|
indexTemp = "40";//区的签入指标
|
|
|
}
|
|
|
//根据等级得到签入量
|
|
|
resultListSignIn = getLevelTwoTodayLowLevelTotal(area, level, indexTemp, sort, lowLevel, lowCode);
|
|
|
Map<String, Integer> signInMap = new HashMap<>();
|
|
|
if (resultListSignIn != null && resultListSignIn.size() > 0) {
|
|
|
resultListSignIn.stream().forEach(one -> {
|
|
|
signInMap.put(one.get("code").toString(), Integer.valueOf(one.get("amount").toString()));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 结果为空时,自建结果集
|
|
|
if (resultList == null || resultList.size() < 1) {
|
|
|
resultList = getLowLevelMapKey(level, low_level, area);
|
|
@ -2892,14 +2903,13 @@ public class StatisticsAllService extends BaseService {
|
|
|
|
|
|
//获取去年签约的人数 默认是上个年度的最后一天
|
|
|
WlyyQuotaResult redisNum = findOneQuotaResult(lastDate, Integer.valueOf(low_level), "1", map.get("code").toString());
|
|
|
|
|
|
Integer signId = signInMap.get(map.get("code").toString()) == null ? 0 : signInMap.get(map.get("code").toString());
|
|
|
if (redisNum == null) {
|
|
|
int signNum = 0;
|
|
|
int renewNum = 0;
|
|
|
|
|
|
signNum = Integer.valueOf(0);
|
|
|
renewNum = Integer.valueOf(map.get("amount").toString());
|
|
|
map.put("rate", getRange(renewNum,signNum,2));
|
|
|
renewNum = Integer.valueOf(map.get("amount").toString()) - signId; //续签量等于 续签量-签入量
|
|
|
map.put("rate", getRange(renewNum, signNum, 2));
|
|
|
map.put("signNum", 0);
|
|
|
map.put("renewNum", renewNum);
|
|
|
} else {
|
|
@ -2909,8 +2919,8 @@ public class StatisticsAllService extends BaseService {
|
|
|
int renewNum = 0;
|
|
|
|
|
|
signNum = Integer.valueOf(redisNum.getResult());
|
|
|
renewNum = Integer.valueOf(map.get("amount").toString());
|
|
|
map.put("rate",getRange(renewNum,signNum,2));
|
|
|
renewNum = Integer.valueOf(map.get("amount").toString()) - signId; //续签量等于 续签量-签入量
|
|
|
map.put("rate", getRange(renewNum, signNum, 2));
|
|
|
map.put("signNum", signNum);
|
|
|
map.put("renewNum", renewNum);
|
|
|
}
|