|
@ -2947,12 +2947,21 @@ public class StatisticsESService {
|
|
|
String startTime = DateUtil.dateToStr(dd.getTime(),"YYYY-MM-dd HH:mm:ss");
|
|
|
String endTime = DateUtil.dateToStr(new Date(),"YYYY-MM-dd HH:mm:ss");
|
|
|
List<SaveModel> resultList = new ArrayList<>();
|
|
|
//类型0.总量,1.进行中,2.已完成,3.居民取消,4.审核不通过,5.其他原因取消
|
|
|
if("1".equals(type)){
|
|
|
//总数
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(null,null,area,level,index,"2","3",disease);
|
|
|
if (StringUtils.isNotBlank(disease)){
|
|
|
//类型0.总量,1.进行中,2.已完成,3.居民取消,4.审核不通过,5.其他原因取消
|
|
|
if("0".equals(type)){
|
|
|
//总数
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime,endTime,area,level,index,"2","3",disease);
|
|
|
}else{
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime,endTime,area,level,index,"2","3",disease,type);
|
|
|
}
|
|
|
}else{
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(null,null,area,level,index,"2","3",disease,type);
|
|
|
if("0".equals(type)){
|
|
|
//总数
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel0(startTime,endTime,area,level,index,"2","3");
|
|
|
}else{
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime,endTime,area,level,index,"2","3",type);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for(Map<String,Object> m:rs){
|
|
@ -2960,9 +2969,14 @@ public class StatisticsESService {
|
|
|
while (iterator.hasNext()){
|
|
|
SaveModel saveModel = (SaveModel)iterator.next();
|
|
|
String monthKey = (String)m.get("month");
|
|
|
String monthKeyEs = DateUtil.changeQuotaDate(saveModel.getQuotaDate());
|
|
|
if(monthKey.equals(monthKeyEs)){
|
|
|
String monthKeyEs="";
|
|
|
if(saveModel.getQuotaDate()!=null){
|
|
|
monthKeyEs = DateUtil.changeQuotaDate(saveModel.getQuotaDate());
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(monthKeyEs) && monthKey.equals(monthKeyEs)){
|
|
|
m.put("count",saveModel.getResult2());
|
|
|
}else{
|
|
|
m.put("count",0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -2984,16 +2998,16 @@ public class StatisticsESService {
|
|
|
List<SaveModel> saveModels = new ArrayList<>();
|
|
|
List<Map<String, Object>> rs = new ArrayList<>();
|
|
|
//一级维度
|
|
|
if (StringUtils.isNotBlank(disease)){
|
|
|
if (StringUtils.isEmpty(disease)){
|
|
|
//类型 0.总量,1.已完成,2.居民取消,3.审核不通过,4.进行中,5.其他原因取消
|
|
|
if("1".equals(type)){
|
|
|
if("0".equals(type)){
|
|
|
saveModels = elasticsearchUtil.findListDateQuotaLevel0(quotaDate,area,level,index,"2",lowlevel);
|
|
|
}else {
|
|
|
saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate,area,level,index,"2",lowlevel,type);
|
|
|
}
|
|
|
}else{
|
|
|
//类型0.总量,1.进行中,2.已完成,3.居民取消,4.审核不通过,5.其他原因取消
|
|
|
if("1".equals(type)){
|
|
|
if("0".equals(type)){
|
|
|
saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate,area,level,index,"2",lowlevel,disease);
|
|
|
}else {
|
|
|
saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate,area,level,index,"2",lowlevel,disease,type);
|
|
@ -3035,7 +3049,7 @@ public class StatisticsESService {
|
|
|
adminTeams = findAllTeam();
|
|
|
}else if(SaveModel.townLevel.equals(level)){
|
|
|
hospitalList = hospitalDao.findByTownCode(area);
|
|
|
adminTeams = findAllTeam();
|
|
|
//adminTeams = adminTeamDao.findByTownCode(area);
|
|
|
}else if(SaveModel.OrgLevel.equals(level)){
|
|
|
adminTeams = adminTeamDao.findByOrgCode(area);
|
|
|
}
|
|
@ -3124,21 +3138,21 @@ public class StatisticsESService {
|
|
|
List<SaveModel> seltList = null;//自取集合
|
|
|
List<SaveModel> deliveryList = null;//物流配送集合
|
|
|
List<SaveModel> healthDoctorList = null;//健管师配送集合
|
|
|
|
|
|
String quotaTime = elasticsearchUtil.getQuotaTime();
|
|
|
if(StringUtils.isNotBlank(disease)){
|
|
|
//自取
|
|
|
seltList = elasticsearchUtil.findListDateQuotaLevel2("",area,level,"62","2","","1",disease);
|
|
|
seltList = elasticsearchUtil.findListDateQuotaLevel2(quotaTime,area,level,"62","2","","1",disease);
|
|
|
//物流配送
|
|
|
deliveryList = elasticsearchUtil.findListDateQuotaLevel2("",area,level,"62","2","","2",disease);
|
|
|
deliveryList = elasticsearchUtil.findListDateQuotaLevel2(quotaTime,area,level,"62","2","","2",disease);
|
|
|
//健管师配送
|
|
|
healthDoctorList = elasticsearchUtil.findListDateQuotaLevel2("",area,level,"62","2","","2",disease);
|
|
|
healthDoctorList = elasticsearchUtil.findListDateQuotaLevel2(quotaTime,area,level,"62","2","","2",disease);
|
|
|
}else{
|
|
|
//自取
|
|
|
seltList = elasticsearchUtil.findListDateQuotaLevel1("",area,level,"62","2","","1");
|
|
|
seltList = elasticsearchUtil.findListDateQuotaLevel1(quotaTime,area,level,"62","2","","1");
|
|
|
//物流配送
|
|
|
deliveryList = elasticsearchUtil.findListDateQuotaLevel1("",area,level,"62","2","","2");
|
|
|
deliveryList = elasticsearchUtil.findListDateQuotaLevel1(quotaTime,area,level,"62","2","","2");
|
|
|
//健管师配送
|
|
|
healthDoctorList = elasticsearchUtil.findListDateQuotaLevel1("",area,level,"62","2","","2");
|
|
|
healthDoctorList = elasticsearchUtil.findListDateQuotaLevel1(quotaTime,area,level,"62","2","","2");
|
|
|
}
|
|
|
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
@ -3165,6 +3179,139 @@ public class StatisticsESService {
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @param level
|
|
|
* @param area
|
|
|
* @param disease
|
|
|
* @param type 1.自取,2.快递配送,3.健管师配送
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> getPrescriptionDispatchingHistogram(int level,String area,String disease,String type)throws Exception{
|
|
|
|
|
|
List<Map<String,Object>> rs =new ArrayList<>();
|
|
|
Calendar dd = Calendar.getInstance();//定义日期实例
|
|
|
Date endDate = new Date();
|
|
|
dd.setTime(endDate);
|
|
|
|
|
|
for(int i=1;i<7;i++){
|
|
|
Map<String,Object> mc = new HashedMap();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
String date = sdf.format(dd.getTime());
|
|
|
mc.put("month",date);
|
|
|
mc.put("count",0);
|
|
|
dd.add(Calendar.MONTH,-1);
|
|
|
rs.add(mc);
|
|
|
}
|
|
|
|
|
|
String startTime = DateUtil.dateToStr(dd.getTime(),"YYYY-MM-dd HH:mm:ss");
|
|
|
String endTime = DateUtil.dateToStr(new Date(),"YYYY-MM-dd HH:mm:ss");
|
|
|
|
|
|
List<SaveModel> resultList = new ArrayList<>();
|
|
|
if (StringUtils.isNotBlank(disease)){
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime,endTime,area,level,"62","2","3",type,disease);
|
|
|
}else{
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime,endTime,area,level,"62","2","3",type);
|
|
|
}
|
|
|
|
|
|
for(Map<String,Object> m:rs){
|
|
|
Iterator iterator = resultList.iterator();
|
|
|
while (iterator.hasNext()){
|
|
|
SaveModel saveModel = (SaveModel)iterator.next();
|
|
|
String monthKey = (String)m.get("month");
|
|
|
String monthKeyEs = DateUtil.changeQuotaDate(saveModel.getQuotaDate());
|
|
|
if(monthKey.equals(monthKeyEs)){
|
|
|
m.put("count",saveModel.getResult2());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param level
|
|
|
* @param lowlevel
|
|
|
* @param area
|
|
|
* @param disease
|
|
|
* @param type 1.自取,2.快递配送,3.健管师配送..
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> getPrescriptionDispatchingLowLevel(int level,String lowlevel,String area,String disease,String type)throws Exception{
|
|
|
|
|
|
String index = "62";
|
|
|
String quotaDate = elasticsearchUtil.getQuotaTime();
|
|
|
List<SaveModel> saveModels = new ArrayList<>();
|
|
|
List<Map<String, Object>> rs = new ArrayList<>();
|
|
|
if (StringUtils.isNotBlank(disease)){
|
|
|
//类型 1.自取,2.快递配送,3.健管师配送
|
|
|
saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate,area,level,index,"2",lowlevel,type,disease);
|
|
|
}else{
|
|
|
saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate,area,level,index,"2",lowlevel,type);
|
|
|
}
|
|
|
if ("5".equals(lowlevel)){
|
|
|
translateTeamLeaderName2(saveModels);
|
|
|
}
|
|
|
Map<String, Object> map = null;
|
|
|
if(saveModels.size()>0){
|
|
|
for(SaveModel one:saveModels){
|
|
|
map = new HashMap<>();
|
|
|
if(Integer.parseInt(lowlevel)>=level){
|
|
|
lowlevel = String.valueOf(level+1);
|
|
|
}
|
|
|
if(SaveModel.townLevel.equals(lowlevel)){
|
|
|
map.put("code",one.getTown());
|
|
|
map.put("name",one.getTownName());
|
|
|
}else if(SaveModel.OrgLevel.equals(lowlevel)){
|
|
|
map.put("code",one.getHospital());
|
|
|
map.put("name",one.getHospitalName());
|
|
|
}else if(SaveModel.teamLevel.equals(lowlevel)){
|
|
|
map.put("code",one.getTeam());
|
|
|
map.put("name",one.getTeamName());
|
|
|
}
|
|
|
map.put("val",one.getResult2().longValue());
|
|
|
}
|
|
|
}else{
|
|
|
|
|
|
//统计数据为空时,自建结果集
|
|
|
// List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
// resultList = getLowLevelMapKey(level, lowlevel, area);
|
|
|
List<Town> townList = null;
|
|
|
List<Hospital> hospitalList = null;
|
|
|
List<AdminTeam> adminTeams = null;
|
|
|
if(SaveModel.cityLevel.equals(level)){
|
|
|
townList = townDao.findByCityCode(area);
|
|
|
hospitalList = hospitalDao.findByCity(area);
|
|
|
adminTeams = findAllTeam();
|
|
|
}else if(SaveModel.townLevel.equals(level)){
|
|
|
hospitalList = hospitalDao.findByTownCode(area);
|
|
|
//adminTeams = adminTeamDao.findByTownCode(area);
|
|
|
}else if(SaveModel.OrgLevel.equals(level)){
|
|
|
adminTeams = adminTeamDao.findByOrgCode(area);
|
|
|
}
|
|
|
if(SaveModel.townLevel.equals(lowlevel)){
|
|
|
for(Town one : townList){
|
|
|
map.put("code",one.getCode());
|
|
|
map.put("name",one.getName());
|
|
|
map.put("val",0);
|
|
|
}
|
|
|
}else if(SaveModel.OrgLevel.equals(lowlevel)){
|
|
|
for(Hospital one : hospitalList){
|
|
|
map.put("code",one.getCode());
|
|
|
map.put("name",one.getName());
|
|
|
map.put("val",0);
|
|
|
}
|
|
|
}else if(SaveModel.teamLevel.equals(lowlevel)){
|
|
|
for(AdminTeam one : adminTeams){
|
|
|
map.put("code",one.getLeaderCode());
|
|
|
map.put("name",one.getName());
|
|
|
map.put("val",0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
rs.add(map);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取下部部费用平均值或总数
|