|
@ -648,6 +648,102 @@ public class StatisticsAllService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 13.17两个指标团队显示团队长
|
|
|
* 查询某个级别的某个指标到达量
|
|
|
*
|
|
|
* @param date
|
|
|
* @param area
|
|
|
* @param level
|
|
|
* @param index
|
|
|
* @param sort
|
|
|
* @param lowLevel
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getLowLevelTotalTeamLeader(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(area, level, index, sort, 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 = "";
|
|
|
try {
|
|
|
redisNum = redisTemplate.opsForValue().get("people:num:" + map.get("code").toString());
|
|
|
} catch (Exception e) {
|
|
|
redisNum = "";
|
|
|
}
|
|
|
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("rateString", map.get("amount") +"/"+ peopleNum.getNum());
|
|
|
map.put("taskRateString", map.get("amount")+"/"+ peopleNum.getTaskNum());
|
|
|
map.put("targetRateString",peopleNum.getTaskNum()+"/"+ peopleNum.getNum());
|
|
|
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("rateString", map.get("amount") +"/"+ peopleNum.getInt("num") );
|
|
|
map.put("taskRateString",map.get("amount") +"/"+peopleNum.getInt("taskNum") );
|
|
|
map.put("targetRateString",peopleNum.getInt("taskNum") +"/"+ peopleNum.getInt("num"));
|
|
|
map.put("num", peopleNum.getInt("num"));
|
|
|
map.put("task", peopleNum.getInt("taskNum"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if((level==4&&"1".equals(lowLevel))||(level==2)){
|
|
|
translateTeamLeaderName(resultList);
|
|
|
}
|
|
|
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询三师转签率、高危人群签约率
|
|
@ -2518,5 +2614,47 @@ public class StatisticsAllService extends BaseService {
|
|
|
return 0L;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取所有团队长信息
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> getAllTeamLeaders(){
|
|
|
String sql = " select t.leader_code,t.id,d.name " +
|
|
|
" from wlyy_admin_team t " +
|
|
|
" LEFT JOIN wlyy_doctor d " +
|
|
|
" on t.leader_code = d.code ";
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取团队长队长名字
|
|
|
* @param leaders
|
|
|
* @param teamCode
|
|
|
* @return
|
|
|
*/
|
|
|
public String getTeamLeaderNameByTeamCode(List<Map<String,Object>> leaders ,int teamCode){
|
|
|
if(leaders!=null&&leaders.size()>0&&teamCode!=0){
|
|
|
for(Map<String,Object> leader: leaders){
|
|
|
int id = (Integer)leader.get("id");
|
|
|
if(teamCode==id){
|
|
|
return (String)leader.get("name");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> translateTeamLeaderName(List<Map<String,Object>> rs){
|
|
|
List<Map<String,Object>> leaders = getAllTeamLeaders();
|
|
|
if(rs!=null&&rs.size()>0){
|
|
|
for(Map<String,Object> r :rs){
|
|
|
String id = (String)r.get("code");
|
|
|
String name = getTeamLeaderNameByTeamCode(leaders,Integer.parseInt(id));
|
|
|
r.put("name",name);
|
|
|
}
|
|
|
}
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
}
|