|
@ -587,33 +587,205 @@ public class PatientService extends TokenService {
|
|
|
return adminTeam.getName();
|
|
|
}
|
|
|
|
|
|
public JSONArray getSignByTeamCodeGpbyServer(String teamCode){
|
|
|
/**
|
|
|
* 获取团队分组签约数据
|
|
|
* @param teamCode
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getSignByTeamCodeGpbyServer(Long teamCode){
|
|
|
|
|
|
// 获取总分组数量
|
|
|
String totalGSql = "SELECT count(1) AS Amount,f.server_type,f.server_type_name FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' GROUP BY f.server_type ";
|
|
|
String totalGSql = "SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' GROUP BY f.server_type ORDER BY f.server_type DESC";
|
|
|
List<Map<String,Object>> totalG = jdbcTemplate.queryForList(totalGSql);
|
|
|
|
|
|
//获取关注量分组数量
|
|
|
String fousGSql ="SELECT count(1) As focusAmount,f.server_type,f.server_type_name FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.openid IS NOT NULL GROUP BY f.server_type ";
|
|
|
String fousGSql ="SELECT count(1) As focusAmount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.openid IS NOT NULL GROUP BY f.server_type ";
|
|
|
List<Map<String,Object>> fousG = jdbcTemplate.queryForList(fousGSql);
|
|
|
|
|
|
//获取二级节点分组总数
|
|
|
String sesTotalSql ="SELECT count(1) AS Amount,f.server_type,f.server_type_name,f.special_population,f.special_population_name FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL GROUP BY f.special_population ";
|
|
|
String sesTotalSql ="SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name As serverTypeName ,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL GROUP BY f.special_population ORDER BY f.special_population DESC ";
|
|
|
List<Map<String,Object>> sesTotal = jdbcTemplate.queryForList(sesTotalSql);
|
|
|
|
|
|
//获取二级节点分组数量
|
|
|
String sesFousGSql ="SELECT count(1) AS Amount,f.server_type,f.server_type_name,f.special_population,f.special_population_name FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL AND f.openid IS NOT NULL GROUP BY f.special_population ";
|
|
|
String sesFousGSql ="SELECT count(1) AS focusAmount,f.server_type AS serverType,f.server_type_name As serverTypeName,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL AND f.openid IS NOT NULL GROUP BY f.special_population ";
|
|
|
List<Map<String,Object>> sesFousG =jdbcTemplate.queryForList(sesFousGSql);
|
|
|
|
|
|
List<ServerLabelTree> listTree = new ArrayList<>();
|
|
|
|
|
|
if(totalG!=null&&totalG.size()>0){
|
|
|
//得到微信关注量总数层级
|
|
|
Map<String,Object> fousGMap = new HashMap<>();
|
|
|
if(fousG!=null&&fousG.size()>0){
|
|
|
//将List转换为Map 降低循环层级
|
|
|
for(Map<String,Object> fg: fousG){
|
|
|
String serverType = (String)fg.get("serverType");
|
|
|
fousGMap.put(serverType,fg);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//得到二级总数层级
|
|
|
// Map<String,Object> sesTotalMap = new HashMap<>();
|
|
|
// if(sesTotal!=null&&sesTotal.size()>0){
|
|
|
// //将List转换为Map 降低循环层级
|
|
|
// for(Map<String,Object> st: sesTotal){
|
|
|
// String serverType = (String)st.get("serverType");
|
|
|
// sesTotalMap.put(serverType,st);
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
//得到二级关注度总数层数
|
|
|
Map<String,Object> sesFousGMap = new HashMap<>();
|
|
|
if(sesFousG!=null&&sesFousG.size()>0){
|
|
|
//将List转换为Map 降低循环层级
|
|
|
for(Map<String,Object> sf: sesFousG){
|
|
|
String specialPopulation = (String)sf.get("specialPopulation");
|
|
|
sesFousGMap.put(specialPopulation,sf);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//遍历第一层级总数
|
|
|
for(Map<String,Object> ttg : totalG){
|
|
|
//添加第一层级数节点
|
|
|
ServerLabelTree tree = new ServerLabelTree();
|
|
|
tree.setAmount((Long)ttg.get("Amount"));
|
|
|
|
|
|
//设置关注数
|
|
|
String sevtype = (String)ttg.get("serverType");
|
|
|
Map<String,Object> st = (Map<String,Object>)fousGMap.get(sevtype);
|
|
|
if(st!=null){
|
|
|
tree.setFocusAmount((Long)st.get("focusAmount"));
|
|
|
}else{
|
|
|
tree.setFocusAmount(0L);
|
|
|
}
|
|
|
tree.setLabelCode((String)ttg.get("serverType"));
|
|
|
tree.setLabelName((String)ttg.get("serverTypeName"));
|
|
|
List<ServerLabelTree> ch = new ArrayList<>();
|
|
|
//遍历节点总数
|
|
|
if(sesTotal!=null&&sesTotal.size()>0){
|
|
|
for(Map<String,Object> sesT:sesTotal){
|
|
|
String serType = (String)sesT.get("serverType");
|
|
|
if(tree.getLabelCode().equals(serType)){
|
|
|
ServerLabelTree chTree = new ServerLabelTree();
|
|
|
String specialPopulation = (String)sesT.get("specialPopulation");
|
|
|
chTree.setLabelCode(tree.getLabelCode()+"-"+specialPopulation);
|
|
|
chTree.setLabelName((String)sesT.get("specialPopulationName"));
|
|
|
chTree.setAmount((Long)sesT.get("Amount"));
|
|
|
|
|
|
Map<String,Object> sFousG = (Map<String,Object>)sesFousGMap.get(specialPopulation);
|
|
|
if(sFousG!=null){
|
|
|
chTree.setFocusAmount((Long)sFousG.get("focusAmount"));
|
|
|
}else{
|
|
|
chTree.setFocusAmount(0L);
|
|
|
}
|
|
|
ch.add(chTree);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
tree.setCh(ch);
|
|
|
listTree.add(tree);
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
return new JSONArray(listTree);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取团队分组签约数据
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getSignByDoctorCodeGpbyServer(String doctor){
|
|
|
|
|
|
// 获取总分组数量
|
|
|
String totalGSql = "SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"' AND f.`status`>0 AND f.expenses_status ='1' GROUP BY f.server_type ORDER BY f.server_type DESC";
|
|
|
List<Map<String,Object>> totalG = jdbcTemplate.queryForList(totalGSql);
|
|
|
|
|
|
//获取关注量分组数量
|
|
|
String fousGSql ="SELECT count(1) As focusAmount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"' AND f.`status`>0 AND f.expenses_status ='1' AND f.openid IS NOT NULL GROUP BY f.server_type ";
|
|
|
List<Map<String,Object>> fousG = jdbcTemplate.queryForList(fousGSql);
|
|
|
|
|
|
//获取二级节点分组总数
|
|
|
String sesTotalSql ="SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name As serverTypeName ,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"' AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL GROUP BY f.special_population ORDER BY f.special_population DESC ";
|
|
|
List<Map<String,Object>> sesTotal = jdbcTemplate.queryForList(sesTotalSql);
|
|
|
|
|
|
//获取二级节点分组数量
|
|
|
String sesFousGSql ="SELECT count(1) AS focusAmount,f.server_type AS serverType,f.server_type_name As serverTypeName,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"' AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL AND f.openid IS NOT NULL GROUP BY f.special_population ";
|
|
|
List<Map<String,Object>> sesFousG =jdbcTemplate.queryForList(sesFousGSql);
|
|
|
|
|
|
List<ServerLabelTree> listTree = new ArrayList<>();
|
|
|
|
|
|
if(totalG!=null&&totalG.size()>0){
|
|
|
//得到微信关注量总数层级
|
|
|
Map<String,Object> fousGMap = new HashMap<>();
|
|
|
if(fousG!=null&&fousG.size()>0){
|
|
|
//将List转换为Map 降低循环层级
|
|
|
for(Map<String,Object> fg: fousG){
|
|
|
String serverType = (String)fg.get("serverType");
|
|
|
fousGMap.put(serverType,fg);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//得到二级总数层级
|
|
|
// Map<String,Object> sesTotalMap = new HashMap<>();
|
|
|
// if(sesTotal!=null&&sesTotal.size()>0){
|
|
|
// //将List转换为Map 降低循环层级
|
|
|
// for(Map<String,Object> st: sesTotal){
|
|
|
// String serverType = (String)st.get("serverType");
|
|
|
// sesTotalMap.put(serverType,st);
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
//得到二级关注度总数层数
|
|
|
Map<String,Object> sesFousGMap = new HashMap<>();
|
|
|
if(sesFousG!=null&&sesFousG.size()>0){
|
|
|
//将List转换为Map 降低循环层级
|
|
|
for(Map<String,Object> sf: sesFousG){
|
|
|
String specialPopulation = (String)sf.get("specialPopulation");
|
|
|
sesFousGMap.put(specialPopulation,sf);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//遍历第一层级总数
|
|
|
for(Map<String,Object> ttg : totalG){
|
|
|
//添加第一层级数节点
|
|
|
ServerLabelTree tree = new ServerLabelTree();
|
|
|
tree.setAmount((Long)ttg.get("Amount"));
|
|
|
|
|
|
//设置关注数
|
|
|
String sevtype = (String)ttg.get("serverType");
|
|
|
Map<String,Object> st = (Map<String,Object>)fousGMap.get(sevtype);
|
|
|
if(st!=null){
|
|
|
tree.setFocusAmount((Long)st.get("focusAmount"));
|
|
|
}else{
|
|
|
tree.setFocusAmount(0L);
|
|
|
}
|
|
|
tree.setLabelCode((String)ttg.get("serverType"));
|
|
|
tree.setLabelName((String)ttg.get("serverTypeName"));
|
|
|
List<ServerLabelTree> ch = new ArrayList<>();
|
|
|
//遍历节点总数
|
|
|
if(sesTotal!=null&&sesTotal.size()>0){
|
|
|
for(Map<String,Object> sesT:sesTotal){
|
|
|
String serType = (String)sesT.get("serverType");
|
|
|
if(tree.getLabelCode().equals(serType)){
|
|
|
ServerLabelTree chTree = new ServerLabelTree();
|
|
|
String specialPopulation = (String)sesT.get("specialPopulation");
|
|
|
chTree.setLabelCode(tree.getLabelCode()+"-"+specialPopulation);
|
|
|
chTree.setLabelName((String)sesT.get("specialPopulationName"));
|
|
|
chTree.setAmount((Long)sesT.get("Amount"));
|
|
|
|
|
|
Map<String,Object> sFousG = (Map<String,Object>)sesFousGMap.get(specialPopulation);
|
|
|
if(sFousG!=null){
|
|
|
chTree.setFocusAmount((Long)sFousG.get("focusAmount"));
|
|
|
}else{
|
|
|
chTree.setFocusAmount(0L);
|
|
|
}
|
|
|
ch.add(chTree);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
tree.setCh(ch);
|
|
|
listTree.add(tree);
|
|
|
}
|
|
|
}
|
|
|
return new JSONArray(listTree);
|
|
|
}
|
|
|
|
|
|
}
|