|
@ -26,6 +26,65 @@ public class StatisticsService {
|
|
|
@Autowired
|
|
|
private WlyyHttpService wlyyHttpService;
|
|
|
|
|
|
//医共体分析-康复下转量
|
|
|
//type 类型1日 2周 3月
|
|
|
public JSONObject medicalCommunityPlan(String startDate,String endDate,String type){
|
|
|
JSONObject json = new JSONObject();
|
|
|
String date = "";
|
|
|
if("1".equals(type)){
|
|
|
date = ",date_format(s.create_time,'%Y-%m-%d') date";
|
|
|
}else if("2".equals(type)){
|
|
|
date = ",date_format(s.create_time,'%Y-%u') date";
|
|
|
}else if("3".equals(type)){
|
|
|
date = ",date_format(s.create_time,'%Y-%m') date";
|
|
|
}
|
|
|
String sql = "select count(s.id) planNum"+date+" from wlyy_patient_rehabilitation_plan s where 1=1";
|
|
|
if(StringUtils.isNotBlank(startDate)){
|
|
|
sql += " and s.create_time>'"+startDate+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)){
|
|
|
sql += " and s.create_time<='"+endDate+" 23:59:59' ";
|
|
|
}
|
|
|
sql += " GROUP BY date";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
json.put("planList",list);
|
|
|
json.put("otherList",new ArrayList<>());
|
|
|
try {
|
|
|
String param = "?startDate="+startDate+"&endDate="+endDate;
|
|
|
JSONObject re = wlyyHttpService.sendWlyyMesGet("commonGet", "medicalCommunityTop" + param);
|
|
|
if(re!=null&&re.getInteger("status")==200){
|
|
|
json.put("otherList",re.getJSONArray("data"));
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
//医共体分析-在线问诊量
|
|
|
//type 类型1日 2周 3月
|
|
|
public List<Map<String,Object>> medicalCommunityOutpatient(String startDate,String endDate,String type){
|
|
|
String date = "";
|
|
|
if("1".equals(type)){
|
|
|
date = ",date_format(s.create_time,'%Y-%m-%d') date";
|
|
|
}else if("2".equals(type)){
|
|
|
date = ",date_format(s.create_time,'%Y-%u') date";
|
|
|
}else if("3".equals(type)){
|
|
|
date = ",date_format(s.create_time,'%Y-%m') date";
|
|
|
}
|
|
|
String sql = "select (count(s.id)-count(if(o.id is not null,1,null))) unSignNum,count(if(o.id is not null,1,null)) signNum" +date+
|
|
|
" from wlyy_outpatient s left join wlyy_sign o on o.patient=s.patient and o.status>0 where 1=1 ";
|
|
|
if(StringUtils.isNotBlank(startDate)){
|
|
|
sql += " and s.create_time>'"+startDate+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)){
|
|
|
sql += " and s.create_time<='"+endDate+" 23:59:59' ";
|
|
|
}
|
|
|
sql += " GROUP BY date";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 医共体分析-头部
|
|
|
* 1、【新签约人数】= 查询时间范围内,同安区新签约、续签的家签患者人数; i健康
|
|
@ -45,9 +104,9 @@ public class StatisticsService {
|
|
|
JSONObject json = new JSONObject();
|
|
|
String sql3 = "SELECT COUNT(DISTINCT s.id) from base_team_relation r,wlyy_sign s WHERE r.admin_team_id=s.admin_team_id and s.status>0 ";
|
|
|
String sql3_1 = "SELECT COUNT(DISTINCT s.id) from wlyy_outpatient r,wlyy_sign s WHERE r.patient=s.patient and s.status>0 ";
|
|
|
String sql8 = "select count(s.id) from wlyy_patient_rehabilitation_plan s ";
|
|
|
String sql8 = "select count(s.id) from wlyy_patient_rehabilitation_plan s where 1=1 ";
|
|
|
|
|
|
String sql10 = "select count(s.id) from wlyy_outpatient s";
|
|
|
String sql10 = "select count(s.id) from wlyy_outpatient s where 1=1";
|
|
|
if(StringUtils.isNotBlank(startDate)){
|
|
|
sql3 += " and r.create_time>'"+startDate+"' ";
|
|
|
sql3_1 += " and r.create_time>'"+startDate+"' ";
|
|
@ -93,7 +152,7 @@ public class StatisticsService {
|
|
|
}
|
|
|
int coMum = teamSignNum +num3+signOutpatientNum;
|
|
|
if(coMum>signNum){
|
|
|
signNum = coMum;
|
|
|
coMum = signNum;
|
|
|
}
|
|
|
|
|
|
json.put("signAdd",signAdd);//新签约人数
|
|
@ -102,16 +161,22 @@ public class StatisticsService {
|
|
|
json.put("coRate",getRange(coMum,signNum));//共同管率
|
|
|
json.put("bookNum",bookNum);//家签门诊数
|
|
|
json.put("bookThird",bookThird);//本院门诊数
|
|
|
json.put("bookThirdRate",getRange(bookThird,bookNum));//本院门诊占比
|
|
|
json.put("bootOther",bootOther);//外院门诊数
|
|
|
json.put("bootOtherRate",getRange(bootOther,bookNum));//外院门诊占比
|
|
|
|
|
|
int rehabilitationNum = rehabilitationOtherNum + rehabilitationThirdNum;
|
|
|
json.put("rehabilitationNum",rehabilitationNum);//康复下转数
|
|
|
json.put("rehabilitationThirdNum",rehabilitationThirdNum);//本院管理数
|
|
|
json.put("rehabilitationThirdRate",getRange(rehabilitationThirdNum,rehabilitationNum));//本院管理占比
|
|
|
json.put("rehabilitationOtherNum",rehabilitationOtherNum);//社区管理数
|
|
|
json.put("rehabilitationOtherRate",getRange(rehabilitationOtherNum,rehabilitationNum));//社区管理占比
|
|
|
json.put("outpatientNum",outpatientNum);//在线问诊数
|
|
|
json.put("signOutpatientNum",signOutpatientNum);//家签问诊数
|
|
|
int otherOutpatientNum = outpatientNum = signOutpatientNum;
|
|
|
json.put("signOutpatientRate",getRange(signOutpatientNum,outpatientNum));//家签问诊占比
|
|
|
int otherOutpatientNum = outpatientNum - signOutpatientNum;
|
|
|
json.put("otherOutpatientNum",otherOutpatientNum);//普患问诊数
|
|
|
json.put("otherOutpatientRate",getRange(otherOutpatientNum,outpatientNum));//普患问诊占比
|
|
|
return json;
|
|
|
}
|
|
|
|