|
@ -1816,7 +1816,7 @@ public class StatisticsService extends BaseService {
|
|
" GROUP BY left(f.apply_date,10)";
|
|
" GROUP BY left(f.apply_date,10)";
|
|
//按月
|
|
//按月
|
|
}else{
|
|
}else{
|
|
sql ="SELECT (DATE_FORMAT(f.apply_date,'%v')-DATE_FORMAT('2017-06-01','%v')+1) as weekOfMonth,count(1) as signCount " +
|
|
|
|
|
|
sql ="SELECT (DATE_FORMAT(f.apply_date,'%v')-DATE_FORMAT('"+DateUtil.getFristDayOfMonth()+"','%v')+1) as weekOfMonth,count(1) as signCount " +
|
|
" FROM wlyy_sign_family f " +
|
|
" FROM wlyy_sign_family f " +
|
|
" where f.apply_date >='"+startDate+" 00:00:00' " +
|
|
" where f.apply_date >='"+startDate+" 00:00:00' " +
|
|
" AND f.apply_date<='"+endDate+" 00:00:00' " +
|
|
" AND f.apply_date<='"+endDate+" 00:00:00' " +
|
|
@ -1894,14 +1894,21 @@ public class StatisticsService extends BaseService {
|
|
" AND q.quota_date ='"+startDate+"' " +
|
|
" AND q.quota_date ='"+startDate+"' " +
|
|
" AND q.qkdoctor_code ='"+id+"'";
|
|
" AND q.qkdoctor_code ='"+id+"'";
|
|
|
|
|
|
Map<String,Object> noRelyMap = jdbcTemplate.queryForMap(noRelysql);
|
|
|
|
Map<String,Object> totalMap = jdbcTemplate.queryForMap(noRelysql);
|
|
|
|
|
|
|
|
Long noRelystartCount = Long.parseLong((String)noRelyMap.get("result"));
|
|
|
|
Long totalstartCount = Long.parseLong((String)totalMap.get("result"));
|
|
|
|
|
|
List<Map<String,Object>> noRelyList = jdbcTemplate.queryForList(noRelysql);
|
|
|
|
Long noRelystartCount =0L;
|
|
|
|
Long totalstartCount = 0L;
|
|
|
|
if(noRelyList!=null&&noRelyList.size()>0){
|
|
|
|
Map<String,Object> noRelyMap =noRelyList.get(0);
|
|
|
|
noRelystartCount = Long.parseLong((String)noRelyMap.get("result"));
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalsql);
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
Map<String,Object> totalMap =totalList.get(0);
|
|
|
|
totalstartCount = Long.parseLong((String)totalMap.get("result"));
|
|
|
|
}
|
|
|
|
|
|
Long noRelyEndCount ;
|
|
|
|
Long totalEndCount ;
|
|
|
|
|
|
Long noRelyEndCount =0L;
|
|
|
|
Long totalEndCount =0L;
|
|
if("1".equals(isNow)){
|
|
if("1".equals(isNow)){
|
|
String timeKey = redisTemplate.opsForValue().get("quota:timeKey");
|
|
String timeKey = redisTemplate.opsForValue().get("quota:timeKey");
|
|
//当前时间获取未回复咨询总数
|
|
//当前时间获取未回复咨询总数
|
|
@ -1931,11 +1938,16 @@ public class StatisticsService extends BaseService {
|
|
" AND q.level1_type ='1' " +
|
|
" AND q.level1_type ='1' " +
|
|
" AND q.quota_date ='"+startDate+"' " +
|
|
" AND q.quota_date ='"+startDate+"' " +
|
|
" AND q.qkdoctor_code ='"+id+"'";
|
|
" AND q.qkdoctor_code ='"+id+"'";
|
|
Map<String,Object> noRelyEndMap = jdbcTemplate.queryForMap(noRelyEndsql);
|
|
|
|
Map<String,Object> totalEndMap = jdbcTemplate.queryForMap(totalEndsql);
|
|
|
|
|
|
|
|
noRelyEndCount = Long.parseLong((String)noRelyEndMap.get("result"));
|
|
|
|
totalEndCount = Long.parseLong((String)totalEndMap.get("result"));
|
|
|
|
|
|
List<Map<String,Object>> noRelyEndList = jdbcTemplate.queryForList(noRelyEndsql);
|
|
|
|
if(noRelyEndList!=null&&noRelyEndList.size()>0){
|
|
|
|
Map<String,Object> noRelyEndMap = noRelyEndList.get(0);
|
|
|
|
noRelyEndCount = Long.parseLong((String)noRelyEndMap.get("result"));
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> totalEndList = jdbcTemplate.queryForList(totalEndsql);
|
|
|
|
if(totalEndList!=null&&totalEndList.size()>0){
|
|
|
|
Map<String,Object> totalEndMap = totalEndList.get(0);
|
|
|
|
totalEndCount = Long.parseLong((String)totalEndMap.get("result"));
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
JSONObject rs = new JSONObject();
|
|
JSONObject rs = new JSONObject();
|
|
@ -2200,12 +2212,12 @@ public class StatisticsService extends BaseService {
|
|
return js;
|
|
return js;
|
|
}
|
|
}
|
|
|
|
|
|
public int checkDoctorIsTeamleader(String doctor){
|
|
|
|
|
|
public JSONObject checkDoctorIsTeamleader(String doctor){
|
|
AdminTeam team = adminTeamDao.findByLeaderCode(doctor);
|
|
AdminTeam team = adminTeamDao.findByLeaderCode(doctor);
|
|
if(team!=null){
|
|
if(team!=null){
|
|
return 1;
|
|
|
|
|
|
return new JSONObject(team);
|
|
}
|
|
}
|
|
return 0;
|
|
|
|
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -2503,7 +2515,7 @@ public class StatisticsService extends BaseService {
|
|
* @param sort 0降序 1升续
|
|
* @param sort 0降序 1升续
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONArray getMemberConsultList(String teamCode,String startDate,String endDate,String sort){
|
|
|
|
|
|
public JSONArray getMemberConsultList(String teamCode,String startDate,String endDate,String sort,String sortType){
|
|
String imDataBaseName = SystemConf.getInstance().getImDataBaseName();
|
|
String imDataBaseName = SystemConf.getInstance().getImDataBaseName();
|
|
startDate = startDate+" 00:00:00";
|
|
startDate = startDate+" 00:00:00";
|
|
endDate = endDate+" 23:59:59";
|
|
endDate = endDate+" 23:59:59";
|
|
@ -2597,6 +2609,11 @@ public class StatisticsService extends BaseService {
|
|
" t.doctor_code = d.`code` " +
|
|
" t.doctor_code = d.`code` " +
|
|
"AND t.available = 1 " +
|
|
"AND t.available = 1 " +
|
|
"AND t.team_id = "+teamCode ;
|
|
"AND t.team_id = "+teamCode ;
|
|
|
|
if("0".equals(sort)){
|
|
|
|
totalSql = totalSql+ " ORDER BY total DESC";
|
|
|
|
}else{
|
|
|
|
totalSql = totalSql+ " ORDER BY total ASC";
|
|
|
|
}
|
|
|
|
|
|
//结束咨询
|
|
//结束咨询
|
|
String endConsultSql ="SELECT " +
|
|
String endConsultSql ="SELECT " +
|
|
@ -2640,9 +2657,21 @@ public class StatisticsService extends BaseService {
|
|
" t.doctor_code = d.`code` " +
|
|
" t.doctor_code = d.`code` " +
|
|
" AND t.available = 1 " +
|
|
" AND t.available = 1 " +
|
|
" AND t.team_id = "+teamCode;
|
|
" AND t.team_id = "+teamCode;
|
|
|
|
if("0".equals(sort)){
|
|
|
|
endConsultSql = endConsultSql+ " ORDER BY endRey DESC";
|
|
|
|
}else{
|
|
|
|
endConsultSql = endConsultSql+ " ORDER BY endRey ASC";
|
|
|
|
}
|
|
|
|
|
|
List<Map<String,Object>> onReyList = jdbcTemplate.queryForList(onReySQL);
|
|
List<Map<String,Object>> onReyList = jdbcTemplate.queryForList(onReySQL);
|
|
|
|
|
|
|
|
Map<String,Object> onReyMap = new HashMap<>();
|
|
|
|
//将List转换为Map降低循环层级
|
|
|
|
if(onReyList!=null&&onReyList.size()>0){
|
|
|
|
for(Map<String,Object> list :onReyList){
|
|
|
|
String code = (String)list.get("doctorCode");
|
|
|
|
onReyMap.put(code,list);
|
|
|
|
}
|
|
|
|
}
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
|
|
|
|
|
|
Map<String,Object> totalMap = new HashMap<>();
|
|
Map<String,Object> totalMap = new HashMap<>();
|
|
@ -2664,23 +2693,58 @@ public class StatisticsService extends BaseService {
|
|
endConsultMap.put(code,list);
|
|
endConsultMap.put(code,list);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if("0".equals(sortType)){
|
|
|
|
//未回复数
|
|
|
|
//合并结果集
|
|
|
|
if(onReyList!=null&&onReyList.size()>0){
|
|
|
|
for(Map<String,Object> map :onReyList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
|
|
//合并结果集
|
|
|
|
if(onReyList!=null&&onReyList.size()>0){
|
|
|
|
for(Map<String,Object> map :onReyList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
|
|
Map<String,Object> t = ( Map<String,Object>)totalMap.get(code);
|
|
|
|
Long totalCout = (Long)t.get("total");
|
|
|
|
map.put("total",totalCout);
|
|
|
|
|
|
|
|
Map<String,Object> e =( Map<String,Object>)endConsultMap.get(code);
|
|
|
|
Long endCout = (Long)e.get("endRey");
|
|
|
|
map.put("endRey",endCout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new JSONArray(onReyList);
|
|
|
|
}else if("1".equals(sortType)){
|
|
|
|
//总数
|
|
|
|
//合并结果集
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
for(Map<String,Object> map :totalList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
|
|
|
|
Map<String,Object> t = ( Map<String,Object>)onReyMap.get(code);
|
|
|
|
Long noRely = (Long)t.get("noRely");
|
|
|
|
map.put("noRely",noRely);
|
|
|
|
|
|
Map<String,Object> t = ( Map<String,Object>)totalMap.get(code);
|
|
|
|
Long totalCout = (Long)t.get("total");
|
|
|
|
map.put("total",totalCout);
|
|
|
|
|
|
Map<String,Object> e =( Map<String,Object>)endConsultMap.get(code);
|
|
|
|
Long endCout = (Long)e.get("endRey");
|
|
|
|
map.put("endRey",endCout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new JSONArray(totalList);
|
|
|
|
}else{
|
|
|
|
//结束咨询数
|
|
|
|
//合并结果集
|
|
|
|
if(endConsultList!=null&&endConsultList.size()>0){
|
|
|
|
for(Map<String,Object> map :endConsultList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
|
|
Map<String,Object> e =( Map<String,Object>)endConsultMap.get(code);
|
|
|
|
Long endCout = (Long)e.get("endRey");
|
|
|
|
map.put("endRey",endCout);
|
|
|
|
|
|
Map<String,Object> t = ( Map<String,Object>)totalMap.get(code);
|
|
|
|
Long totalCout = (Long)t.get("total");
|
|
|
|
map.put("total",totalCout);
|
|
|
|
|
|
|
|
Map<String,Object> r = ( Map<String,Object>)onReyMap.get(code);
|
|
|
|
Long noRely = (Long)r.get("noRely");
|
|
|
|
map.put("noRely",noRely);
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
return new JSONArray(endConsultList);
|
|
}
|
|
}
|
|
|
|
|
|
return new JSONArray(onReyList);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public JSONObject getDoctorConsultTitle(String doctor,String teamCode,String startDate,String endDate){
|
|
public JSONObject getDoctorConsultTitle(String doctor,String teamCode,String startDate,String endDate){
|
|
@ -2870,7 +2934,7 @@ public class StatisticsService extends BaseService {
|
|
|
|
|
|
planSQL ="SELECT " +
|
|
planSQL ="SELECT " +
|
|
" ( " +
|
|
" ( " +
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('"+DateUtil.getFristDayOfMonth()+"', '%v') + 1 " +
|
|
" ) AS weekOfMonth,COUNT(1) AS planCount " +
|
|
" ) AS weekOfMonth,COUNT(1) AS planCount " +
|
|
"FROM " +
|
|
"FROM " +
|
|
" wlyy_followup w " +
|
|
" wlyy_followup w " +
|
|
@ -2886,7 +2950,7 @@ public class StatisticsService extends BaseService {
|
|
//按月
|
|
//按月
|
|
totalSQL ="SELECT " +
|
|
totalSQL ="SELECT " +
|
|
" ( " +
|
|
" ( " +
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('"+DateUtil.getFristDayOfMonth()+"', '%v') + 1 " +
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
" FROM " +
|
|
" FROM " +
|
|
" wlyy_followup w " +
|
|
" wlyy_followup w " +
|
|
@ -2899,7 +2963,7 @@ public class StatisticsService extends BaseService {
|
|
" GROUP BY weekOfMonth";
|
|
" GROUP BY weekOfMonth";
|
|
planSQL = "SELECT " +
|
|
planSQL = "SELECT " +
|
|
" ( " +
|
|
" ( " +
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('"+DateUtil.getFristDayOfMonth()+"', '%v') + 1 " +
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
" FROM " +
|
|
" FROM " +
|
|
" wlyy_followup w " +
|
|
" wlyy_followup w " +
|
|
@ -2940,7 +3004,7 @@ public class StatisticsService extends BaseService {
|
|
|
|
|
|
planSQL ="SELECT " +
|
|
planSQL ="SELECT " +
|
|
" ( " +
|
|
" ( " +
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('"+DateUtil.getFristDayOfMonth()+"', '%v') + 1 " +
|
|
" ) AS weekOfMonth,COUNT(1) AS planCount " +
|
|
" ) AS weekOfMonth,COUNT(1) AS planCount " +
|
|
"FROM " +
|
|
"FROM " +
|
|
" wlyy_followup w " +
|
|
" wlyy_followup w " +
|
|
@ -2955,7 +3019,7 @@ public class StatisticsService extends BaseService {
|
|
//按月
|
|
//按月
|
|
totalSQL ="SELECT " +
|
|
totalSQL ="SELECT " +
|
|
" ( " +
|
|
" ( " +
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('"+DateUtil.getFristDayOfMonth()+"', '%v') + 1 " +
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
" FROM " +
|
|
" FROM " +
|
|
" wlyy_followup w " +
|
|
" wlyy_followup w " +
|
|
@ -2967,7 +3031,7 @@ public class StatisticsService extends BaseService {
|
|
" GROUP BY weekOfMonth";
|
|
" GROUP BY weekOfMonth";
|
|
planSQL = "SELECT " +
|
|
planSQL = "SELECT " +
|
|
" ( " +
|
|
" ( " +
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('"+DateUtil.getFristDayOfMonth()+"', '%v') + 1 " +
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
" FROM " +
|
|
" FROM " +
|
|
" wlyy_followup w " +
|
|
" wlyy_followup w " +
|
|
@ -3005,7 +3069,6 @@ public class StatisticsService extends BaseService {
|
|
" wlyy_followup w " +
|
|
" wlyy_followup w " +
|
|
" WHERE " +
|
|
" WHERE " +
|
|
" w.admin_team_code =" +teamCode+
|
|
" w.admin_team_code =" +teamCode+
|
|
" AND w.create_time >= '"+startDate+"' " +
|
|
|
|
" AND w.create_time <= '"+endDate+"' " +
|
|
" AND w.create_time <= '"+endDate+"' " +
|
|
" AND w.followup_class IS NOT NULL " +
|
|
" AND w.followup_class IS NOT NULL " +
|
|
" GROUP BY " +
|
|
" GROUP BY " +
|
|
@ -3021,6 +3084,918 @@ public class StatisticsService extends BaseService {
|
|
}else{
|
|
}else{
|
|
totalSQL =totalSQL+" ORDER BY followupCount ASC";
|
|
totalSQL =totalSQL+" ORDER BY followupCount ASC";
|
|
}
|
|
}
|
|
return null;
|
|
|
|
|
|
|
|
|
|
String addSQL = "SELECT " +
|
|
|
|
" IFNULL(c.followupCount,0) AS addCount, " +
|
|
|
|
" d.`code` AS doctorCode, " +
|
|
|
|
" d.`name` AS name " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_admin_team_member m " +
|
|
|
|
" LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" w.doctor_code, " +
|
|
|
|
" w.doctor_name, " +
|
|
|
|
" COUNT(1) AS followupCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_followup w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
|
" AND w.create_time >= '"+startDate+"' " +
|
|
|
|
" AND w.create_time <= '"+endDate+"' " +
|
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
|
" GROUP BY " +
|
|
|
|
" w.doctor_code " +
|
|
|
|
" ) c ON c.doctor_code =m.doctor_code, " +
|
|
|
|
" wlyy_doctor d " +
|
|
|
|
" WHERE " +
|
|
|
|
" d.`code` = m.doctor_code " +
|
|
|
|
" AND m.available = 1 " +
|
|
|
|
" AND m.team_id =" +teamCode ;
|
|
|
|
if("0".equals(sort)){
|
|
|
|
addSQL =addSQL+" ORDER BY addCount DESC";
|
|
|
|
}else{
|
|
|
|
addSQL =addSQL+" ORDER BY addCount ASC";
|
|
|
|
}
|
|
|
|
|
|
|
|
String planSQL = "SELECT " +
|
|
|
|
" IFNULL(c.followupCount,0) AS planCount, " +
|
|
|
|
" d.`code` AS doctorCode, " +
|
|
|
|
" d.`name` AS name " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_admin_team_member m " +
|
|
|
|
" LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" w.doctor_code, " +
|
|
|
|
" w.doctor_name, " +
|
|
|
|
" COUNT(1) AS followupCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_followup w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
|
" AND w.create_time >= '"+startDate+"' " +
|
|
|
|
" AND w.create_time <= '"+endDate+"' " +
|
|
|
|
" AND w.status ='2'"+
|
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
|
" GROUP BY " +
|
|
|
|
" w.doctor_code " +
|
|
|
|
" ) c ON c.doctor_code =m.doctor_code, " +
|
|
|
|
" wlyy_doctor d " +
|
|
|
|
" WHERE " +
|
|
|
|
" d.`code` = m.doctor_code " +
|
|
|
|
" AND m.available = 1 " +
|
|
|
|
" AND m.team_id =" +teamCode ;
|
|
|
|
if("0".equals(sort)){
|
|
|
|
planSQL =planSQL+" ORDER BY planCount DESC";
|
|
|
|
}else{
|
|
|
|
planSQL =planSQL+" ORDER BY planCount ASC";
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSQL);
|
|
|
|
//降低循环层级
|
|
|
|
Map<String,Object> totalMap = new HashMap<>();
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
for(Map<String,Object> map:totalList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
totalMap.put(code,map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> addList= jdbcTemplate.queryForList(addSQL);
|
|
|
|
//降低循环层级
|
|
|
|
Map<String,Object> addMap = new HashMap<>();
|
|
|
|
if(addList!=null&&addList.size()>0){
|
|
|
|
for(Map<String,Object> map:addList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
addMap.put(code,map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Map<String,Object>> planList = jdbcTemplate.queryForList(planSQL);
|
|
|
|
//降低循环层级
|
|
|
|
Map<String,Object> planMap = new HashMap<>();
|
|
|
|
if(planList!=null&&planList.size()>0){
|
|
|
|
for(Map<String,Object> map:planList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
planMap.put(code,map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if("0".equals(sortType)){
|
|
|
|
//按总数排序
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
//以总数为基准,合并结果集
|
|
|
|
for(Map<String ,Object> map : totalList){
|
|
|
|
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
|
|
|
|
Map<String,Object> m =(Map<String,Object>)addMap.get(code);
|
|
|
|
if(m!=null){
|
|
|
|
Long addCount = (Long)m.get("addCount");
|
|
|
|
map.put("addCount",addCount==null?0L:addCount);
|
|
|
|
}else{
|
|
|
|
map.put("addCount",0L);
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,Object> m2 =(Map<String,Object>)planMap.get(code);
|
|
|
|
if(m2!=null){
|
|
|
|
Long planCount = (Long)m2.get("planCount");
|
|
|
|
map.put("planCount",planCount);
|
|
|
|
}else{
|
|
|
|
map.put("planCount",0L);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new JSONArray(totalList);
|
|
|
|
}else if("1".equals(sortType)){
|
|
|
|
//按增量排序
|
|
|
|
if(addList!=null&&addList.size()>0){
|
|
|
|
//以增量为基准,合并结果集
|
|
|
|
for(Map<String ,Object> map : totalList){
|
|
|
|
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
|
|
|
|
Map<String,Object> m =(Map<String,Object>)planMap.get(code);
|
|
|
|
if(m!=null){
|
|
|
|
Long planCount = (Long)m.get("planCount");
|
|
|
|
map.put("planCount",planCount);
|
|
|
|
}else{
|
|
|
|
map.put("planCount",0L);
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,Object> m2 =(Map<String,Object>)planMap.get(code);
|
|
|
|
if(m2!=null){
|
|
|
|
Long followupCount = (Long)m2.get("followupCount");
|
|
|
|
map.put("followupCount",followupCount);
|
|
|
|
}else{
|
|
|
|
map.put("followupCount",0L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new JSONArray(addList);
|
|
|
|
}else{
|
|
|
|
//按计划量排序
|
|
|
|
if(planList!=null&&planList.size()>0){
|
|
|
|
//以增量为基准,合并结果集
|
|
|
|
for(Map<String ,Object> map : planList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> m =(Map<String,Object>)planMap.get(code);
|
|
|
|
if(m!=null){
|
|
|
|
Long followupCount = (Long)m.get("followupCount");
|
|
|
|
map.put("followupCount",followupCount);
|
|
|
|
}else{
|
|
|
|
map.put("followupCount",0L);
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,Object> m2 =(Map<String,Object>)addMap.get(code);
|
|
|
|
if(m2!=null){
|
|
|
|
Long addCount = (Long)m2.get("addCount");
|
|
|
|
map.put("addCount",addCount==null?0L:addCount);
|
|
|
|
}else{
|
|
|
|
map.put("addCount",0L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new JSONArray(planList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONObject getTeamDoctorFolTitle(String teamCode,String doctor,String startDate,String endDate){
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String totalSql = "SELECT " +
|
|
|
|
" COUNT(1) AS followupCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_followup w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode +
|
|
|
|
" AND w.doctor_code ='"+doctor+"' " +
|
|
|
|
" AND w.create_time <= '"+endDate+"' " +
|
|
|
|
" AND w.followup_class IS NOT NULL";
|
|
|
|
String addSql = "SELECT " +
|
|
|
|
" COUNT(1) AS addCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_followup w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode +
|
|
|
|
" AND w.doctor_code ='"+doctor+"' " +
|
|
|
|
" AND w.create_time >= '"+startDate+"' " +
|
|
|
|
" AND w.create_time <= '"+endDate+"' " +
|
|
|
|
" AND w.followup_class IS NOT NULL";
|
|
|
|
String planSql = "SELECT " +
|
|
|
|
" COUNT(1) AS planCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_followup w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode +
|
|
|
|
" AND w.doctor_code ='"+doctor+"' " +
|
|
|
|
" AND w.create_time >= '"+startDate+"' " +
|
|
|
|
" AND w.create_time <= '"+endDate+"' " +
|
|
|
|
" AND w.status ='2'"+
|
|
|
|
" AND w.followup_class IS NOT NULL";
|
|
|
|
|
|
|
|
JSONObject rs = new JSONObject();
|
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
Map<String,Object> map = totalList.get(0);
|
|
|
|
Long followupCount = (Long)map.get("followupCount");
|
|
|
|
rs.put("followupCount",followupCount!=null?followupCount:0L);
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> addList = jdbcTemplate.queryForList(addSql);
|
|
|
|
if(addList!=null&&addList.size()>0){
|
|
|
|
Map<String,Object> map = addList.get(0);
|
|
|
|
Long addCount = (Long)map.get("addCount");
|
|
|
|
rs.put("addCount",addCount!=null?addCount:0L);
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> planList = jdbcTemplate.queryForList(planSql);
|
|
|
|
if(planList!=null&&planList.size()>0){
|
|
|
|
Map<String,Object> map = planList.get(0);
|
|
|
|
Long planCount = (Long)map.get("planCount");
|
|
|
|
rs.put("planCount",planCount!=null?planCount:0L);
|
|
|
|
}
|
|
|
|
return rs;
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONArray getTeamResLine(String teamCode,String startDate,String endDate,String type){
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String totalSql ;
|
|
|
|
if("0".equals(type)){
|
|
|
|
//查周
|
|
|
|
totalSql = "SELECT " +
|
|
|
|
" left(w.czrq,10) AS dateNo,COUNT(1) AS reservationCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_reservation w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode +
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY dateNo";
|
|
|
|
}else{
|
|
|
|
//查月
|
|
|
|
//查周
|
|
|
|
totalSql = "SELECT " +
|
|
|
|
" ( " +
|
|
|
|
" DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('"+DateUtil.getFristDayOfMonth()+"', '%v') + 1 " +
|
|
|
|
" ) AS weekOfMonth,COUNT(1) AS reservationCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_reservation w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode +
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY weekOfMonth";
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(totalSql);
|
|
|
|
return new JSONArray(list);
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONArray getTeamDoctorResLine(String teamCode,String startDate,String endDate,String type,String doctor){
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String totalSql ;
|
|
|
|
if("0".equals(type)){
|
|
|
|
//查周
|
|
|
|
totalSql = "SELECT " +
|
|
|
|
" left(w.czrq,10) AS dateNo,COUNT(1) AS reservationCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_reservation w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode +
|
|
|
|
" AND w.doctor_code = '"+doctor+"'"+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY dateNo";
|
|
|
|
}else{
|
|
|
|
//查月
|
|
|
|
totalSql = "SELECT " +
|
|
|
|
" ( " +
|
|
|
|
" DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('"+DateUtil.getFristDayOfMonth()+"', '%v') + 1 " +
|
|
|
|
" ) AS weekOfMonth,COUNT(1) AS reservationCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_reservation w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode +
|
|
|
|
" AND w.doctor_code = '"+doctor+"'"+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY weekOfMonth";
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(totalSql);
|
|
|
|
return new JSONArray(list);
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONArray getTeamDoctorResList(String teamCode,String startDate,String endDate,String sort,String sortType){
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String totalSql = "SELECT " +
|
|
|
|
" IFNULL(c.reservationCount,0) AS reservationCount, " +
|
|
|
|
" d.`code` AS doctorCode, " +
|
|
|
|
" d.`name` AS name " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_admin_team_member m " +
|
|
|
|
" LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" COUNT(1) AS reservationCount, " +
|
|
|
|
" w.doctor_code AS doctorCode, " +
|
|
|
|
" w.doctor AS name " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_reservation w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" GROUP BY doctorCode " +
|
|
|
|
" ) c ON c.doctorCode =m.doctor_code, " +
|
|
|
|
" wlyy_doctor d " +
|
|
|
|
" WHERE " +
|
|
|
|
" d.`code` = m.doctor_code " +
|
|
|
|
" AND m.available = 1 " +
|
|
|
|
" AND m.team_id = " +teamCode ;
|
|
|
|
if("0".equals(sort)){
|
|
|
|
totalSql = totalSql+ " ORDER BY reservationCount DESC";
|
|
|
|
}else{
|
|
|
|
totalSql = totalSql+ " ORDER BY reservationCount ASC";
|
|
|
|
}
|
|
|
|
String addSql = "SELECT " +
|
|
|
|
" IFNULL(c.reservationCount,0) AS addCount, " +
|
|
|
|
" d.`code` AS doctorCode, " +
|
|
|
|
" d.`name` AS name " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_admin_team_member m " +
|
|
|
|
" LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" COUNT(1) AS reservationCount, " +
|
|
|
|
" w.doctor_code AS doctorCode, " +
|
|
|
|
" w.doctor AS name " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_reservation w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY doctorCode " +
|
|
|
|
" ) c ON c.doctorCode =m.doctor_code, " +
|
|
|
|
" wlyy_doctor d " +
|
|
|
|
" WHERE " +
|
|
|
|
" d.`code` = m.doctor_code " +
|
|
|
|
" AND m.available = 1 " +
|
|
|
|
" AND m.team_id = " +teamCode ;
|
|
|
|
if("0".equals(sort)){
|
|
|
|
addSql = addSql+ " ORDER BY addCount DESC";
|
|
|
|
}else{
|
|
|
|
addSql = addSql+ " ORDER BY addCount ASC";
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Map<String,Object>> totalList =jdbcTemplate.queryForList(totalSql);
|
|
|
|
Map<String,Object> totalMap = new HashMap<>();
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
for(Map<String,Object> map :totalList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
totalMap.put(code,map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> addList = jdbcTemplate.queryForList(addSql);
|
|
|
|
Map<String,Object> addMap = new HashMap<>();
|
|
|
|
if(addList!=null&&addList.size()>0){
|
|
|
|
for(Map<String,Object> map :addList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
addMap.put(code,map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if("0".equals(sortType)){
|
|
|
|
//按总数排序
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
for(Map<String,Object> map:totalList) {
|
|
|
|
String code = (String) map.get("doctorCode");
|
|
|
|
Map<String, Object> m = (Map<String, Object>) addMap.get(code);
|
|
|
|
if (m != null) {
|
|
|
|
Long addCount = (Long) m.get("addCount");
|
|
|
|
map.put("addCount", addCount != null ? addCount : 0L);
|
|
|
|
} else {
|
|
|
|
map.put("addCount", 0L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new JSONArray(totalList);
|
|
|
|
}else{
|
|
|
|
//按增量排序
|
|
|
|
if(addList!=null&&addList.size()>0){
|
|
|
|
for(Map<String,Object> map:addList) {
|
|
|
|
String code = (String) map.get("doctorCode");
|
|
|
|
Map<String, Object> m = (Map<String, Object>) totalMap.get(code);
|
|
|
|
if (m != null) {
|
|
|
|
Long reservationCount = (Long) m.get("reservationCount");
|
|
|
|
map.put("reservationCount", reservationCount != null ? reservationCount : 0L);
|
|
|
|
} else {
|
|
|
|
map.put("reservationCount", 0L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new JSONArray(addList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONObject getTeamDoctorResTitle(String teamCode,String doctor,String startDate,String endDate){
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String totalSQL ="SELECT " +
|
|
|
|
" COUNT(1) AS reservationCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_reservation w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode+
|
|
|
|
" AND w.doctor_code ='"+doctor+"' " +
|
|
|
|
" AND w.czrq <= '"+endDate+"' ";
|
|
|
|
|
|
|
|
String addSQL ="SELECT " +
|
|
|
|
" COUNT(1) AS addCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_reservation w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode+
|
|
|
|
" AND w.doctor_code ='"+doctor+"' " +
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"'";
|
|
|
|
JSONObject rs = new JSONObject();
|
|
|
|
Long reservationCount =0L;
|
|
|
|
Long addCount = 0L;
|
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSQL);
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
Map<String,Object> map =totalList.get(0);
|
|
|
|
reservationCount = (Long)map.get("reservationCount");
|
|
|
|
}
|
|
|
|
rs.put("reservationCount",reservationCount);
|
|
|
|
|
|
|
|
List<Map<String,Object>> addList = jdbcTemplate.queryForList(addSQL);
|
|
|
|
if(addList!=null&&addList.size()>0){
|
|
|
|
Map<String,Object> map =addList.get(0);
|
|
|
|
addCount = (Long)map.get("addCount");
|
|
|
|
}
|
|
|
|
rs.put("addCount",addCount);
|
|
|
|
|
|
|
|
return rs;
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONArray getTeamGuidLine(String teamCode,String startDate,String endDate,String type){
|
|
|
|
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String SQL ;
|
|
|
|
if("0".equals(type)){
|
|
|
|
//按周统计
|
|
|
|
SQL ="SELECT " +
|
|
|
|
" left(w.create_time,10) AS dateNo, " +
|
|
|
|
" COUNT(1) AS guidanceCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_health_guidance w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode+
|
|
|
|
" AND w.czrq <= '"+startDate+"' " +
|
|
|
|
" AND w.czrq >= '"+endDate+"' " +
|
|
|
|
" GROUP BY dateNo";
|
|
|
|
}else{
|
|
|
|
//按月统计
|
|
|
|
SQL ="SELECT " +
|
|
|
|
" ( " +
|
|
|
|
" DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('"+startDate+"', '%v') + 1 " +
|
|
|
|
" ) AS weekOfMonth, " +
|
|
|
|
" COUNT(1) AS guidanceCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_health_guidance w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY weekOfMonth";
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(SQL);
|
|
|
|
return new JSONArray(totalList);
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONArray getTeamDoctorGuidLine(String teamCode,String startDate,String endDate,String type,String doctor){
|
|
|
|
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String SQL ;
|
|
|
|
if("0".equals(type)){
|
|
|
|
//按周统计
|
|
|
|
SQL ="SELECT " +
|
|
|
|
" left(w.create_time,10) AS dateNo, " +
|
|
|
|
" COUNT(1) AS guidanceCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_health_guidance w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode+
|
|
|
|
" AND w.doctor ='"+doctor+"'"+
|
|
|
|
" AND w.czrq <= '"+startDate+"' " +
|
|
|
|
" AND w.czrq >= '"+endDate+"' " +
|
|
|
|
" GROUP BY dateNo";
|
|
|
|
}else{
|
|
|
|
//按月统计
|
|
|
|
SQL ="SELECT " +
|
|
|
|
" ( " +
|
|
|
|
" DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('"+startDate+"', '%v') + 1 " +
|
|
|
|
" ) AS weekOfMonth, " +
|
|
|
|
" COUNT(1) AS guidanceCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_health_guidance w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
|
" AND w.doctor ='"+doctor+"'"+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY weekOfMonth";
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(SQL);
|
|
|
|
return new JSONArray(totalList);
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONArray getTeamGuidList(String teamCode,String startDate,String endDate,String sort,String sortType){
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String totalSql ="SELECT " +
|
|
|
|
" IFNULL(c.guidanceCount,0) AS guidanceCount, " +
|
|
|
|
" d.`code` AS doctorCode, " +
|
|
|
|
" d.`name` AS name " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_admin_team_member m " +
|
|
|
|
" LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" w.doctor, " +
|
|
|
|
" COUNT(1) AS guidanceCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_health_guidance w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY w.doctor " +
|
|
|
|
" ) c ON c.doctor = m.doctor_code, " +
|
|
|
|
" wlyy_doctor d " +
|
|
|
|
" WHERE " +
|
|
|
|
" d.`code` = m.doctor_code " +
|
|
|
|
" AND m.available = 1 " +
|
|
|
|
" AND m.team_id = " +teamCode ;
|
|
|
|
if("0".equals(sort)){
|
|
|
|
totalSql = totalSql+ " ORDER BY guidanceCount DESC";
|
|
|
|
}else{
|
|
|
|
totalSql = totalSql+ " ORDER BY guidanceCount ASC";
|
|
|
|
}
|
|
|
|
|
|
|
|
String addSql ="SELECT " +
|
|
|
|
" IFNULL(c.guidanceCount,0) AS addCount, " +
|
|
|
|
" d.`code` AS doctorCode, " +
|
|
|
|
" d.`name` AS name " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_admin_team_member m " +
|
|
|
|
" LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" w.doctor, " +
|
|
|
|
" COUNT(1) AS guidanceCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_health_guidance w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY w.doctor " +
|
|
|
|
" ) c ON c.doctor = m.doctor_code, " +
|
|
|
|
" wlyy_doctor d " +
|
|
|
|
" WHERE " +
|
|
|
|
" d.`code` = m.doctor_code " +
|
|
|
|
" AND m.available = 1 " +
|
|
|
|
" AND m.team_id = " +teamCode ;
|
|
|
|
if("0".equals(sort)){
|
|
|
|
addSql = addSql+ " ORDER BY addCount DESC";
|
|
|
|
}else{
|
|
|
|
addSql = addSql+ " ORDER BY addCount ASC";
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Map<String,Object>> totalList =jdbcTemplate.queryForList(totalSql);
|
|
|
|
Map<String,Object> totalMap = new HashMap<>();
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
for(Map<String,Object> map :totalList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
totalMap.put(code,map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> addList = jdbcTemplate.queryForList(addSql);
|
|
|
|
Map<String,Object> addMap = new HashMap<>();
|
|
|
|
if(addList!=null&&addList.size()>0){
|
|
|
|
for(Map<String,Object> map :addList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
addMap.put(code,map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if("0".equals(sortType)){
|
|
|
|
//按总数排序
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
for(Map<String,Object> map:totalList) {
|
|
|
|
String code = (String) map.get("doctorCode");
|
|
|
|
Map<String, Object> m = (Map<String, Object>) addMap.get(code);
|
|
|
|
if (m != null) {
|
|
|
|
Long addCount = (Long) m.get("addCount");
|
|
|
|
map.put("addCount", addCount != null ? addCount : 0L);
|
|
|
|
} else {
|
|
|
|
map.put("addCount", 0L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new JSONArray(totalList);
|
|
|
|
}else{
|
|
|
|
//按增量排序
|
|
|
|
if(addList!=null&&addList.size()>0){
|
|
|
|
for(Map<String,Object> map:addList) {
|
|
|
|
String code = (String) map.get("doctorCode");
|
|
|
|
Map<String, Object> m = (Map<String, Object>) totalMap.get(code);
|
|
|
|
if (m != null) {
|
|
|
|
Long guidanceCount = (Long) m.get("guidanceCount");
|
|
|
|
map.put("guidanceCount", guidanceCount != null ? guidanceCount : 0L);
|
|
|
|
} else {
|
|
|
|
map.put("guidanceCount", 0L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new JSONArray(addList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONObject getTeamDoctorGuiTitle(String teamCode,String doctor,String startDate,String endDate){
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String totalSQL ="SELECT " +
|
|
|
|
" COUNT(1) AS guidanceCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_health_guidance w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode+
|
|
|
|
" AND w.doctor ='"+doctor+"'" +
|
|
|
|
" AND w.czrq >= '"+endDate+"'";
|
|
|
|
|
|
|
|
String addSQL ="SELECT " +
|
|
|
|
" COUNT(1) AS addCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_patient_health_guidance w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code = " +teamCode+
|
|
|
|
" AND w.doctor ='"+doctor+"'" +
|
|
|
|
" AND w.czrq <= '"+startDate+"' " +
|
|
|
|
" AND w.czrq >= '"+endDate+"'";
|
|
|
|
JSONObject rs = new JSONObject();
|
|
|
|
Long guidanceCount =0L;
|
|
|
|
Long addCount = 0L;
|
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSQL);
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
Map<String,Object> map =totalList.get(0);
|
|
|
|
guidanceCount = (Long)map.get("guidanceCount");
|
|
|
|
}
|
|
|
|
rs.put("guidanceCount",guidanceCount);
|
|
|
|
|
|
|
|
List<Map<String,Object>> addList = jdbcTemplate.queryForList(addSQL);
|
|
|
|
if(addList!=null&&addList.size()>0){
|
|
|
|
Map<String,Object> map =addList.get(0);
|
|
|
|
addCount = (Long)map.get("addCount");
|
|
|
|
}
|
|
|
|
rs.put("addCount",addCount);
|
|
|
|
|
|
|
|
return rs;
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONArray getTeamEduLine(String teamCode,String startDate,String endDate,String type){
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String sql;
|
|
|
|
|
|
|
|
if("0".equals(type)){
|
|
|
|
//按周统计
|
|
|
|
sql = "SELECT " +
|
|
|
|
" left(w.czrq,10) AS dateNo,COUNT(1) AS articleCount,count(DISTINCT w.batch_no) batchCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_health_edu_article_patient w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY dateNo";
|
|
|
|
}else{
|
|
|
|
sql ="SELECT " +
|
|
|
|
" ( " +
|
|
|
|
" DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('"+startDate+"', '%v') + 1 " +
|
|
|
|
" ) AS weekOfMonth,COUNT(1) AS articleCount,count(DISTINCT w.batch_no) batchno " +
|
|
|
|
"FROM " +
|
|
|
|
" wlyy_health_edu_article_patient w " +
|
|
|
|
"WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
"GROUP BY weekOfMonth";
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
return new JSONArray(list);
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONArray getTeamDoctorEduLine(String teamCode,String startDate,String endDate,String type,String doctor){
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String sql;
|
|
|
|
|
|
|
|
if("0".equals(type)){
|
|
|
|
//按周统计
|
|
|
|
sql = "SELECT " +
|
|
|
|
" left(w.czrq,10) AS dateNo,COUNT(1) AS articleCount,count(DISTINCT w.batch_no) batchCount " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_health_edu_article_patient w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
|
" AND w.doctor ='"+doctor+"'"+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY dateNo";
|
|
|
|
}else{
|
|
|
|
sql ="SELECT " +
|
|
|
|
" ( " +
|
|
|
|
" DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('"+startDate+"', '%v') + 1 " +
|
|
|
|
" ) AS weekOfMonth,COUNT(1) AS articleCount,count(DISTINCT w.batch_no) batchno " +
|
|
|
|
"FROM " +
|
|
|
|
" wlyy_health_edu_article_patient w " +
|
|
|
|
"WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
|
" AND w.doctor ='"+doctor+"'"+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
"GROUP BY weekOfMonth";
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
return new JSONArray(list);
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONArray getTeamEduList(String teamCode,String startDate,String endDate,String sort,String sortType){
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String totalSql ="SELECT " +
|
|
|
|
" IFNULL(c.articleCount,0) AS articleCount, " +
|
|
|
|
" IFNULL(c.batchno,0) AS batchno, " +
|
|
|
|
" d.`code` AS doctorCode, " +
|
|
|
|
" d.`name` AS name " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_admin_team_member m " +
|
|
|
|
" LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" COUNT(1) AS articleCount, " +
|
|
|
|
" COUNT(DISTINCT w.batch_no) batchno, " +
|
|
|
|
" w.doctor AS doctorCode " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_health_edu_article_patient w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" GROUP BY doctorCode " +
|
|
|
|
" ) c ON c.doctorCode =m.doctor_code, " +
|
|
|
|
" wlyy_doctor d " +
|
|
|
|
" WHERE " +
|
|
|
|
" d.`code` = m.doctor_code " +
|
|
|
|
" AND m.available = 1 " +
|
|
|
|
" AND m.team_id = " +teamCode;
|
|
|
|
if("0".equals(sort)){
|
|
|
|
//降序
|
|
|
|
if("0".equals(sortType)){
|
|
|
|
//总人次
|
|
|
|
totalSql = totalSql+ " ORDER BY articleCount DESC";
|
|
|
|
}else if("2".equals(sortType)){
|
|
|
|
//总批次
|
|
|
|
totalSql = totalSql+ " ORDER BY batchno DESC";
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if("0".equals(sortType)){
|
|
|
|
totalSql = totalSql+ " ORDER BY articleCount ASC";
|
|
|
|
}else if("2".equals(sortType)){
|
|
|
|
totalSql = totalSql+ " ORDER BY batchno ASC";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String addSql ="SELECT " +
|
|
|
|
" IFNULL(c.articleCount,0) AS addCount, " +
|
|
|
|
" IFNULL(c.batchno,0) AS addBatchno, " +
|
|
|
|
" d.`code` AS doctorCode, " +
|
|
|
|
" d.`name` AS name " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_admin_team_member m " +
|
|
|
|
" LEFT JOIN ( " +
|
|
|
|
" SELECT " +
|
|
|
|
" COUNT(1) AS articleCount, " +
|
|
|
|
" COUNT(DISTINCT w.batch_no) batchno, " +
|
|
|
|
" w.doctor AS doctorCode " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_health_edu_article_patient w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"' " +
|
|
|
|
" GROUP BY doctorCode " +
|
|
|
|
" ) c ON c.doctorCode =m.doctor_code, " +
|
|
|
|
" wlyy_doctor d " +
|
|
|
|
" WHERE " +
|
|
|
|
" d.`code` = m.doctor_code " +
|
|
|
|
" AND m.available = 1 " +
|
|
|
|
" AND m.team_id = " +teamCode;
|
|
|
|
if("0".equals(sort)){
|
|
|
|
if("1".equals(sortType)){
|
|
|
|
addSql = addSql+ " ORDER BY addCount DESC";
|
|
|
|
}else if("3".equals(sortType)){
|
|
|
|
addSql = addSql+ " ORDER BY addBatchno DESC";
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if("1".equals(sortType)){
|
|
|
|
addSql = addSql+ " ORDER BY addCount ASC";
|
|
|
|
}else if("3".equals(sortType)){
|
|
|
|
addSql = addSql+ " ORDER BY addBatchno ASC";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Map<String,Object>> totalList =jdbcTemplate.queryForList(totalSql);
|
|
|
|
Map<String,Object> totalMap = new HashMap<>();
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
for(Map<String,Object> map :totalList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
totalMap.put(code,map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> addList = jdbcTemplate.queryForList(addSql);
|
|
|
|
Map<String,Object> addMap = new HashMap<>();
|
|
|
|
if(addList!=null&&addList.size()>0){
|
|
|
|
for(Map<String,Object> map :addList){
|
|
|
|
String code = (String)map.get("doctorCode");
|
|
|
|
addMap.put(code,map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if("0".equals(sortType)||"2".equals(sortType)){
|
|
|
|
//按总数排序
|
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
|
for(Map<String,Object> map:totalList) {
|
|
|
|
String code = (String) map.get("doctorCode");
|
|
|
|
Map<String, Object> m = (Map<String, Object>) addMap.get(code);
|
|
|
|
if (m != null) {
|
|
|
|
Long addCount = (Long) m.get("addCount");
|
|
|
|
Long addBatchno = (Long) m.get("addBatchno");
|
|
|
|
map.put("addCount", addCount != null ? addCount : 0L);
|
|
|
|
map.put("addBatchno", addBatchno != null ? addBatchno : 0L);
|
|
|
|
} else {
|
|
|
|
map.put("addCount", 0L);
|
|
|
|
map.put("addBatchno", 0L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new JSONArray(totalList);
|
|
|
|
}else{
|
|
|
|
//按增量排序
|
|
|
|
if(addList!=null&&addList.size()>0){
|
|
|
|
for(Map<String,Object> map:addList) {
|
|
|
|
String code = (String) map.get("doctorCode");
|
|
|
|
Map<String, Object> m = (Map<String, Object>) totalMap.get(code);
|
|
|
|
if (m != null) {
|
|
|
|
Long articleCount = (Long) m.get("articleCount");
|
|
|
|
map.put("articleCount", articleCount != null ? articleCount : 0L);
|
|
|
|
Long batchno = (Long) m.get("batchno");
|
|
|
|
map.put("batchno", batchno != null ? batchno : 0L);
|
|
|
|
} else {
|
|
|
|
map.put("articleCount", 0L);
|
|
|
|
map.put("batchno", 0L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new JSONArray(addList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONObject getTeamDoctorEduTitle(String teamCode,String startDate,String endDate,String doctor){
|
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
|
String totalSql ="SELECT " +
|
|
|
|
" COUNT(1) AS articleCount, " +
|
|
|
|
" COUNT(DISTINCT w.batch_no) batchno " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_health_edu_article_patient w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode +
|
|
|
|
" AND w.doctor ='"+doctor+"'" +
|
|
|
|
" AND w.czrq <= '"+endDate+"' ";
|
|
|
|
String addSql ="SELECT " +
|
|
|
|
" COUNT(1) AS addCount, " +
|
|
|
|
" COUNT(DISTINCT w.batch_no) addBatchno " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_health_edu_article_patient w " +
|
|
|
|
" WHERE " +
|
|
|
|
" w.admin_team_code =" +teamCode +
|
|
|
|
" AND w.doctor ='"+doctor+"'" +
|
|
|
|
" AND w.czrq <= '"+endDate+"' " +
|
|
|
|
" AND w.czrq >= '"+startDate+"'";
|
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
|
|
|
|
List<Map<String,Object>> addList =jdbcTemplate.queryForList(addSql);
|
|
|
|
JSONObject rs = new JSONObject();
|
|
|
|
rs.put("totalList",totalList);
|
|
|
|
rs.put("addList",addList);
|
|
|
|
return rs;
|
|
}
|
|
}
|
|
}
|
|
}
|