|  | @ -69,17 +69,44 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |         SaveModel saveModel = null;
 |  |         SaveModel saveModel = null;
 | 
												
													
														
															|  |         //开方量
 |  |         //开方量
 | 
												
													
														
															|  |         SaveModel saveModel1 = null;
 |  |         SaveModel saveModel1 = null;
 | 
												
													
														
															|  | 
 |  |         //收入
 | 
												
													
														
															|  | 
 |  |         SaveModel saveModel2 = null;
 | 
												
													
														
															|  | 
 |  |         //昨天收入;
 | 
												
													
														
															|  | 
 |  |         SaveModel saveModel3 = null;
 | 
												
													
														
															|  | 
 |  |         //上周今天收入;
 | 
												
													
														
															|  | 
 |  |         SaveModel saveModel4 = null;
 | 
												
													
														
															|  |         String[] indexes = index.split(",");
 |  |         String[] indexes = index.split(",");
 | 
												
													
														
															|  |         if (StringUtils.isNotEmpty(level2_type)) {
 |  |         if (StringUtils.isNotEmpty(level2_type)) {
 | 
												
													
														
															|  |             saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, indexes[0], SaveModel.timeLevel_DDL, level2_type);
 |  |             saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, indexes[0], SaveModel.timeLevel_DDL, level2_type);
 | 
												
													
														
															|  |             saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, indexes[1], SaveModel.timeLevel_DDL, level2_type);
 |  |             saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, indexes[1], SaveModel.timeLevel_DDL, level2_type);
 | 
												
													
														
															|  | 
 |  |             saveModel2 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, indexes[2], SaveModel.timeLevel_DDL,level2_type);
 | 
												
													
														
															|  |         } else {
 |  |         } else {
 | 
												
													
														
															|  |             saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, indexes[0], SaveModel.timeLevel_DDL);
 |  |             saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, indexes[0], SaveModel.timeLevel_DDL);
 | 
												
													
														
															|  |             saveModel1 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, indexes[1], SaveModel.timeLevel_DDL);
 |  |             saveModel1 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, indexes[1], SaveModel.timeLevel_DDL);
 | 
												
													
														
															|  | 
 |  |             saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, indexes[2], SaveModel.timeLevel_DDL);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         JSONObject object = new JSONObject();
 |  |         JSONObject object = new JSONObject();
 | 
												
													
														
															|  | 
 |  |         String yesterday = DateUtil.getNextDay(endDate, -1);//昨天
 | 
												
													
														
															|  | 
 |  |         String lastDay = DateUtil.getNextDay(endDate, -7);//上周的今天
 | 
												
													
														
															|  | 
 |  |         String weekFirstDay = DateUtil.getMondayOfThisWeek();//周一
 | 
												
													
														
															|  | 
 |  |         String weekLastDay = DateUtil.getSundayOfThisWeek();//周日
 | 
												
													
														
															|  | 
 |  |         JSONArray array = dateTotalStatistics2(weekFirstDay,weekLastDay,area,level,indexes[2],null,SaveModel.timeLevel_ZL,null);//本周量
 | 
												
													
														
															|  | 
 |  |         Double prices = 0.0;
 | 
												
													
														
															|  | 
 |  |         for (int i=0;i<array.size();i++){
 | 
												
													
														
															|  | 
 |  |             JSONObject jsonObject = array.getJSONObject(i);
 | 
												
													
														
															|  | 
 |  |             prices +=jsonObject.getDouble("num");
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         Double num = prices/array.size();
 | 
												
													
														
															|  | 
 |  |         DecimalFormat df = new DecimalFormat("0.00");
 | 
												
													
														
															|  | 
 |  |         String str = df.format(num);
 | 
												
													
														
															|  | 
 |  |         object.put("dayPrice",str);//日均收入
 | 
												
													
														
															|  | 
 |  |         saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(yesterday, yesterday, area, level, indexes[2], SaveModel.timeLevel_DDL);
 | 
												
													
														
															|  | 
 |  |         saveModel4 = elasticsearchUtil.findOneDateQuotaLevel0(lastDay, lastDay, area, level, indexes[2], SaveModel.timeLevel_DDL);
 | 
												
													
														
															|  |         object.put("outPatientCount",saveModel.getResult2().longValue());//问诊量
 |  |         object.put("outPatientCount",saveModel.getResult2().longValue());//问诊量
 | 
												
													
														
															|  |         object.put("prescriptionCount",saveModel1.getResult2().longValue());//开方量
 |  |         object.put("prescriptionCount",saveModel1.getResult2().longValue());//开方量
 | 
												
													
														
															|  | 
 |  |         object.put("priceTotal",saveModel2.getResult1().longValue());//总收入
 | 
												
													
														
															|  | 
 |  |         object.put("priceDayRate",baseEvaluateScoreService.judgeScore(saveModel2.getResult1().doubleValue(),saveModel3.getResult1().doubleValue()));
 | 
												
													
														
															|  | 
 |  |         object.put("priceWeekRate",baseEvaluateScoreService.judgeScore(saveModel2.getResult1().doubleValue(),saveModel4.getResult1().doubleValue()));
 | 
												
													
														
															|  |         String prescriptionRate = baseEvaluateScoreService.getPercentage(saveModel1.getResult2().floatValue(), saveModel.getResult2().floatValue());
 |  |         String prescriptionRate = baseEvaluateScoreService.getPercentage(saveModel1.getResult2().floatValue(), saveModel.getResult2().floatValue());
 | 
												
													
														
															|  |         object.put("prescriptionRate",prescriptionRate);//开方率
 |  |         object.put("prescriptionRate",prescriptionRate);//开方率
 | 
												
													
														
															|  |         String startTime = DateUtil.getStringDateShort()+" 00:00:00";
 |  |         String startTime = DateUtil.getStringDateShort()+" 00:00:00";
 | 
												
											
												
													
														
															|  | @ -102,6 +129,7 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |         object.put("totalAvgScore",scoreAndPercentage.get("totalAvgScore"));//服务总评分
 |  |         object.put("totalAvgScore",scoreAndPercentage.get("totalAvgScore"));//服务总评分
 | 
												
													
														
															|  |         object.put("weekJudge",scoreAndPercentage.get("weekJudge"));//周同比
 |  |         object.put("weekJudge",scoreAndPercentage.get("weekJudge"));//周同比
 | 
												
													
														
															|  |         object.put("dayJudge",scoreAndPercentage.get("dayJudge"));//日环比
 |  |         object.put("dayJudge",scoreAndPercentage.get("dayJudge"));//日环比
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         return object;
 |  |         return object;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -133,18 +161,20 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |             object.put("data",array);
 |  |             object.put("data",array);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(level2_type)){
 |  |         if (StringUtils.isNoneBlank(level2_type)){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             //问诊量表格
 |  |             //问诊量表格
 | 
												
													
														
															|  |             //专家咨询数量
 |  |             //专家咨询数量
 | 
												
													
														
															|  |             List<SaveModel> specialistSaveModels = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, "4", SaveModel.timeLevel_ZL,null,level2_type);
 |  |             List<SaveModel> specialistSaveModels = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, "4", SaveModel.timeLevel_ZL,null,level2_type);
 | 
												
													
														
															|  |             //协同门诊
 |  |             //协同门诊
 | 
												
													
														
															|  |             List<SaveModel> syngySaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, "1", SaveModel.timeLevel_ZL,"2",null,level2_type);
 |  | 
 | 
												
													
														
															|  | 
 |  |             List<SaveModel> syngySaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"2",null,level2_type);
 | 
												
													
														
															|  |             //图文复诊
 |  |             //图文复诊
 | 
												
													
														
															|  |             List<SaveModel> topicSaveModels = elasticsearchUtil.findDateQuotaLevel2(startDate, endDate, area, level, "1", SaveModel.timeLevel_ZL,"1","1",null,level2_type);
 |  | 
 | 
												
													
														
															|  | 
 |  |             List<SaveModel> topicSaveModels = elasticsearchUtil.findDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"1","1",null,level2_type);
 | 
												
													
														
															|  |             ///视频复诊
 |  |             ///视频复诊
 | 
												
													
														
															|  |             List<SaveModel> vedioSaveModels = elasticsearchUtil.findDateQuotaLevel2(startDate, endDate, area, level, "1", SaveModel.timeLevel_ZL,"1","2",null,level2_type);
 |  | 
 | 
												
													
														
															|  | 
 |  |             List<SaveModel> vedioSaveModels = elasticsearchUtil.findDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"1","2",null,level2_type);
 | 
												
													
														
															|  |             JSONArray array = new JSONArray();
 |  |             JSONArray array = new JSONArray();
 | 
												
													
														
															|  |             List<String> list = new ArrayList<>();
 |  |             List<String> list = new ArrayList<>();
 | 
												
													
														
															|  |             for (SaveModel saveModel:specialistSaveModels){
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             for (SaveModel saveModel:syngySaveModels){
 | 
												
													
														
															|  |                 if (level2_type.equals(SaveModel.deptLevel)){
 |  |                 if (level2_type.equals(SaveModel.deptLevel)){
 | 
												
													
														
															|  |                     list.add(saveModel.getDept());
 |  |                     list.add(saveModel.getDept());
 | 
												
													
														
															|  |                 }else if (level2_type.equals(SaveModel.doctorLevel)){
 |  |                 }else if (level2_type.equals(SaveModel.doctorLevel)){
 | 
												
											
												
													
														
															|  | @ -158,31 +188,46 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |                 Double topic = 0.0;
 |  |                 Double topic = 0.0;
 | 
												
													
														
															|  |                 Double vedio =0.0;
 |  |                 Double vedio =0.0;
 | 
												
													
														
															|  |                 Double synegy =0.0;
 |  |                 Double synegy =0.0;
 | 
												
													
														
															|  | 
 |  |                 if (index.equalsIgnoreCase("3")){
 | 
												
													
														
															|  | 
 |  |                     specialist = 0.0;
 | 
												
													
														
															|  | 
 |  |                 }else if (index.equalsIgnoreCase("1")){
 | 
												
													
														
															|  | 
 |  |                     for (SaveModel saveModel:specialistSaveModels){
 | 
												
													
														
															|  | 
 |  |                         if (level2_type.equals(SaveModel.deptLevel)){
 | 
												
													
														
															|  | 
 |  |                             if (code.equalsIgnoreCase(saveModel.getDept())){
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("code",code);
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("name",saveModel.getDeptName());
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("specialist",saveModel.getResult1());
 | 
												
													
														
															|  | 
 |  |                                 specialist = saveModel.getResult1();
 | 
												
													
														
															|  | 
 |  |                                 break;
 | 
												
													
														
															|  | 
 |  |                             }
 | 
												
													
														
															|  | 
 |  |                         }else if (level2_type.equals(SaveModel.doctorLevel)){
 | 
												
													
														
															|  | 
 |  |                             if (code.equalsIgnoreCase(saveModel.getDoctor())){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |                                 if (level==6){
 | 
												
													
														
															|  | 
 |  |                                     List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(area);
 | 
												
													
														
															|  | 
 |  |                                     if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
 | 
												
													
														
															|  | 
 |  |                                         BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
 | 
												
													
														
															|  | 
 |  |                                         jsonObject.put("code",doctorHospitalDO.getDeptCode());
 | 
												
													
														
															|  | 
 |  |                                         jsonObject.put("name",doctorHospitalDO.getDeptName());
 | 
												
													
														
															|  | 
 |  |                                     }
 | 
												
													
														
															|  | 
 |  |                                 }else {
 | 
												
													
														
															|  | 
 |  |                                     DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 | 
												
													
														
															|  | 
 |  |                                     jsonObject.put("code",area);
 | 
												
													
														
															|  | 
 |  |                                     jsonObject.put("name",dictHospitalDeptDO.getName());
 | 
												
													
														
															|  | 
 |  |                                 }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 for (SaveModel saveModel:specialistSaveModels){
 |  | 
 | 
												
													
														
															|  |                     if (level2_type.equals(SaveModel.deptLevel)){
 |  | 
 | 
												
													
														
															|  |                         if (code.equalsIgnoreCase(saveModel.getDept())){
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("code",code);
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("name",saveModel.getDeptName());
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("specialist",saveModel.getResult1());
 |  | 
 | 
												
													
														
															|  |                             specialist = saveModel.getResult1();
 |  | 
 | 
												
													
														
															|  |                             break;
 |  | 
 | 
												
													
														
															|  |                         }
 |  | 
 | 
												
													
														
															|  |                     }else if (level2_type.equals(SaveModel.doctorLevel)){
 |  | 
 | 
												
													
														
															|  |                         if (code.equalsIgnoreCase(saveModel.getDoctor())){
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("code",area);
 |  | 
 | 
												
													
														
															|  |                             DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("name",dictHospitalDeptDO.getName());
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("doctorCode",code);
 |  | 
 | 
												
													
														
															|  |                             BaseDoctorDO doctorDO = doctorDao.findById(code);
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("doctorJob",doctorDO.getJobTitleName());
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("doctorName",saveModel.getDoctorName());
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("specialist",saveModel.getResult1());
 |  | 
 | 
												
													
														
															|  |                             specialist = saveModel.getResult1();
 |  | 
 | 
												
													
														
															|  |                             break;
 |  | 
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("doctorCode",code);
 | 
												
													
														
															|  | 
 |  |                                 BaseDoctorDO doctorDO = doctorDao.findById(code);
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("doctorJob",doctorDO.getJobTitleName());
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("doctorName",saveModel.getDoctorName());
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("specialist",saveModel.getResult1());
 | 
												
													
														
															|  | 
 |  |                                 specialist = saveModel.getResult1();
 | 
												
													
														
															|  | 
 |  |                                 break;
 | 
												
													
														
															|  | 
 |  |                             }
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 for (SaveModel saveModel:syngySaveModels){
 |  |                 for (SaveModel saveModel:syngySaveModels){
 | 
												
													
														
															|  |                     if (level2_type.equals(SaveModel.deptLevel)){
 |  |                     if (level2_type.equals(SaveModel.deptLevel)){
 | 
												
													
														
															|  |                         if (code.equalsIgnoreCase(saveModel.getDept())){
 |  |                         if (code.equalsIgnoreCase(saveModel.getDept())){
 | 
												
											
												
													
														
															|  | @ -194,9 +239,18 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                     }else if (level2_type.equals(SaveModel.doctorLevel)){
 |  |                     }else if (level2_type.equals(SaveModel.doctorLevel)){
 | 
												
													
														
															|  |                         if (code.equalsIgnoreCase(saveModel.getDoctor())){
 |  |                         if (code.equalsIgnoreCase(saveModel.getDoctor())){
 | 
												
													
														
															|  |                             jsonObject.put("code",area);
 |  | 
 | 
												
													
														
															|  |                             DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("name",dictHospitalDeptDO.getName());
 |  | 
 | 
												
													
														
															|  | 
 |  |                             if (level==6){
 | 
												
													
														
															|  | 
 |  |                                 List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(area);
 | 
												
													
														
															|  | 
 |  |                                 if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
 | 
												
													
														
															|  | 
 |  |                                     BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
 | 
												
													
														
															|  | 
 |  |                                     jsonObject.put("code",doctorHospitalDO.getDeptCode());
 | 
												
													
														
															|  | 
 |  |                                     jsonObject.put("name",doctorHospitalDO.getDeptName());
 | 
												
													
														
															|  | 
 |  |                                 }
 | 
												
													
														
															|  | 
 |  |                             }else {
 | 
												
													
														
															|  | 
 |  |                                 DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("code",area);
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("name",dictHospitalDeptDO.getName());
 | 
												
													
														
															|  | 
 |  |                             }
 | 
												
													
														
															|  |                             BaseDoctorDO doctorDO = doctorDao.findById(code);
 |  |                             BaseDoctorDO doctorDO = doctorDao.findById(code);
 | 
												
													
														
															|  |                             jsonObject.put("doctorJob",doctorDO.getJobTitleName());
 |  |                             jsonObject.put("doctorJob",doctorDO.getJobTitleName());
 | 
												
													
														
															|  |                             jsonObject.put("doctorCode",code);
 |  |                             jsonObject.put("doctorCode",code);
 | 
												
											
												
													
														
															|  | @ -218,9 +272,18 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                     }else if (level2_type.equals(SaveModel.doctorLevel)){
 |  |                     }else if (level2_type.equals(SaveModel.doctorLevel)){
 | 
												
													
														
															|  |                         if (code.equalsIgnoreCase(saveModel.getDoctor())){
 |  |                         if (code.equalsIgnoreCase(saveModel.getDoctor())){
 | 
												
													
														
															|  |                             jsonObject.put("code",area);
 |  | 
 | 
												
													
														
															|  |                             DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("name",dictHospitalDeptDO.getName());
 |  | 
 | 
												
													
														
															|  | 
 |  |                             if (level==6){
 | 
												
													
														
															|  | 
 |  |                                 List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(area);
 | 
												
													
														
															|  | 
 |  |                                 if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
 | 
												
													
														
															|  | 
 |  |                                     BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
 | 
												
													
														
															|  | 
 |  |                                     jsonObject.put("code",doctorHospitalDO.getDeptCode());
 | 
												
													
														
															|  | 
 |  |                                     jsonObject.put("name",doctorHospitalDO.getDeptName());
 | 
												
													
														
															|  | 
 |  |                                 }
 | 
												
													
														
															|  | 
 |  |                             }else {
 | 
												
													
														
															|  | 
 |  |                                 DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("code",area);
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("name",dictHospitalDeptDO.getName());
 | 
												
													
														
															|  | 
 |  |                             }
 | 
												
													
														
															|  |                             BaseDoctorDO doctorDO = doctorDao.findById(code);
 |  |                             BaseDoctorDO doctorDO = doctorDao.findById(code);
 | 
												
													
														
															|  |                             jsonObject.put("doctorJob",doctorDO.getJobTitleName());
 |  |                             jsonObject.put("doctorJob",doctorDO.getJobTitleName());
 | 
												
													
														
															|  |                             jsonObject.put("doctorCode",code);
 |  |                             jsonObject.put("doctorCode",code);
 | 
												
											
												
													
														
															|  | @ -242,9 +305,18 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                     }else if (level2_type.equals(SaveModel.doctorLevel)){
 |  |                     }else if (level2_type.equals(SaveModel.doctorLevel)){
 | 
												
													
														
															|  |                         if (code.equalsIgnoreCase(saveModel.getDoctor())){
 |  |                         if (code.equalsIgnoreCase(saveModel.getDoctor())){
 | 
												
													
														
															|  |                             jsonObject.put("code",area);
 |  | 
 | 
												
													
														
															|  |                             DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 |  | 
 | 
												
													
														
															|  |                             jsonObject.put("name",dictHospitalDeptDO.getName());
 |  | 
 | 
												
													
														
															|  | 
 |  |                             if (level==6){
 | 
												
													
														
															|  | 
 |  |                                 List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(area);
 | 
												
													
														
															|  | 
 |  |                                 if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
 | 
												
													
														
															|  | 
 |  |                                     BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
 | 
												
													
														
															|  | 
 |  |                                     jsonObject.put("code",doctorHospitalDO.getDeptCode());
 | 
												
													
														
															|  | 
 |  |                                     jsonObject.put("name",doctorHospitalDO.getDeptName());
 | 
												
													
														
															|  | 
 |  |                                 }
 | 
												
													
														
															|  | 
 |  |                             }else {
 | 
												
													
														
															|  | 
 |  |                                 DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("code",area);
 | 
												
													
														
															|  | 
 |  |                                 jsonObject.put("name",dictHospitalDeptDO.getName());
 | 
												
													
														
															|  | 
 |  |                             }
 | 
												
													
														
															|  |                             jsonObject.put("doctorCode",code);
 |  |                             jsonObject.put("doctorCode",code);
 | 
												
													
														
															|  |                             BaseDoctorDO doctorDO = doctorDao.findById(code);
 |  |                             BaseDoctorDO doctorDO = doctorDao.findById(code);
 | 
												
													
														
															|  |                             jsonObject.put("doctorJob",doctorDO.getJobTitleName());
 |  |                             jsonObject.put("doctorJob",doctorDO.getJobTitleName());
 | 
												
											
												
													
														
															|  | @ -305,13 +377,6 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |     public JSONObject getOutPatientCircular(String startDate, String endDate, String area, int level, String index, String level2_type) throws Exception {
 |  |     public JSONObject getOutPatientCircular(String startDate, String endDate, String area, int level, String index, String level2_type) throws Exception {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         JSONObject object = new JSONObject();
 |  |         JSONObject object = new JSONObject();
 | 
												
													
														
															|  |         //专家咨询数量
 |  | 
 | 
												
													
														
															|  |         SaveModel saveModel = null;
 |  | 
 | 
												
													
														
															|  |         if (StringUtils.isNotEmpty(level2_type)) {
 |  | 
 | 
												
													
														
															|  |             saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, "4", SaveModel.timeLevel_DDL, level2_type);
 |  | 
 | 
												
													
														
															|  |         } else {
 |  | 
 | 
												
													
														
															|  |             saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "4", SaveModel.timeLevel_DDL);
 |  | 
 | 
												
													
														
															|  |         }
 |  | 
 | 
												
													
														
															|  |         //协同门诊
 |  |         //协同门诊
 | 
												
													
														
															|  |         SaveModel saveModel1 = null;
 |  |         SaveModel saveModel1 = null;
 | 
												
													
														
															|  |         saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "2");
 |  |         saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "2");
 | 
												
											
												
													
														
															|  | @ -321,20 +386,33 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |         //视频复诊
 |  |         //视频复诊
 | 
												
													
														
															|  |         SaveModel saveModel3 = null;
 |  |         SaveModel saveModel3 = null;
 | 
												
													
														
															|  |         saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","2");
 |  |         saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","2");
 | 
												
													
														
															|  | 
 |  |         Double specialistCount =0.0;
 | 
												
													
														
															|  | 
 |  |         if(index.equalsIgnoreCase("1")){
 | 
												
													
														
															|  | 
 |  |             //专家咨询数量
 | 
												
													
														
															|  | 
 |  |             SaveModel saveModel = null;
 | 
												
													
														
															|  | 
 |  |             if (StringUtils.isNotEmpty(level2_type)) {
 | 
												
													
														
															|  | 
 |  |                 saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, "4", SaveModel.timeLevel_DDL, level2_type);
 | 
												
													
														
															|  | 
 |  |             } else {
 | 
												
													
														
															|  | 
 |  |                 saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "4", SaveModel.timeLevel_DDL);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             specialistCount = saveModel.getResult1();//专家咨询数量
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }else if (index.equalsIgnoreCase("3")){
 | 
												
													
														
															|  | 
 |  |             specialistCount = 0.0;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         int specialistCount = saveModel.getResult2().intValue();//专家咨询数量
 |  | 
 | 
												
													
														
															|  |         int synergyCount = saveModel1.getResult2().intValue();//协同门诊数量
 |  | 
 | 
												
													
														
															|  |         int topicCount = saveModel2.getResult2().intValue();//图文复诊数量
 |  | 
 | 
												
													
														
															|  |         int videoCount = saveModel3.getResult2().intValue();//视频复诊数量
 |  | 
 | 
												
													
														
															|  |         int total = specialistCount+synergyCount+topicCount+videoCount;//总量
 |  | 
 | 
												
													
														
															|  | 
 |  |         Double synergyCount = saveModel1.getResult1();//协同门诊数量
 | 
												
													
														
															|  | 
 |  |         Double topicCount = saveModel2.getResult1();//图文复诊数量
 | 
												
													
														
															|  | 
 |  |         Double videoCount = saveModel3.getResult1();//视频复诊数量
 | 
												
													
														
															|  | 
 |  |         Double total = specialistCount+synergyCount+topicCount+videoCount;//总量
 | 
												
													
														
															|  |         object.put("specialistCount",specialistCount);//专家咨询数
 |  |         object.put("specialistCount",specialistCount);//专家咨询数
 | 
												
													
														
															|  |         object.put("specialistRate",getRange(specialistCount,total,0));
 |  | 
 | 
												
													
														
															|  | 
 |  |         object.put("specialistRate",getRange(specialistCount.intValue(),total.intValue(),0));
 | 
												
													
														
															|  |         object.put("synergyCount",synergyCount);//专家咨询数
 |  |         object.put("synergyCount",synergyCount);//专家咨询数
 | 
												
													
														
															|  |         object.put("synergyRate",getRange(synergyCount,total,0));
 |  | 
 | 
												
													
														
															|  | 
 |  |         object.put("synergyRate",getRange(synergyCount.intValue(),total.intValue(),0));
 | 
												
													
														
															|  |         object.put("topicCount",topicCount);//图文复诊数量
 |  |         object.put("topicCount",topicCount);//图文复诊数量
 | 
												
													
														
															|  |         object.put("topicRate",getRange(topicCount,total,0));
 |  | 
 | 
												
													
														
															|  | 
 |  |         object.put("topicRate",getRange(topicCount.intValue(),total.intValue(),0));
 | 
												
													
														
															|  |         object.put("videoCount",videoCount);//视频复诊数量
 |  |         object.put("videoCount",videoCount);//视频复诊数量
 | 
												
													
														
															|  |         object.put("videoRate",getRange(videoCount,total,0));
 |  | 
 | 
												
													
														
															|  | 
 |  |         object.put("videoRate",getRange(videoCount.intValue(),total.intValue(),0));
 | 
												
													
														
															|  |         object.put("total",total);
 |  |         object.put("total",total);
 | 
												
													
														
															|  |         return object;
 |  |         return object;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
											
												
													
														
															|  | @ -903,6 +981,7 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |             JSONObject json = new JSONObject();
 |  |             JSONObject json = new JSONObject();
 | 
												
													
														
															|  |             json.put("range", one.get("date"));
 |  |             json.put("range", one.get("date"));
 | 
												
													
														
															|  |             json.put("amount", 0);
 |  |             json.put("amount", 0);
 | 
												
													
														
															|  | 
 |  |             json.put("num",0.0);
 | 
												
													
														
															|  |             result.add(json);
 |  |             result.add(json);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | //        }
 |  | //        }
 | 
												
											
												
													
														
															|  | @ -915,10 +994,12 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |                 if (saveModel.getQuotaDate() != null) {
 |  |                 if (saveModel.getQuotaDate() != null) {
 | 
												
													
														
															|  |                     range = df.format(saveModel.getQuotaDate());
 |  |                     range = df.format(saveModel.getQuotaDate());
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 double num = saveModel.getResult1();
 | 
												
													
														
															|  |                 long amount = saveModel.getResult2().longValue();
 |  |                 long amount = saveModel.getResult2().longValue();
 | 
												
													
														
															|  |                 for(JSONObject obj : result){
 |  |                 for(JSONObject obj : result){
 | 
												
													
														
															|  |                     if((obj.get("range")+"").equals(range)){
 |  |                     if((obj.get("range")+"").equals(range)){
 | 
												
													
														
															|  |                         obj.put("amount", amount);
 |  |                         obj.put("amount", amount);
 | 
												
													
														
															|  | 
 |  |                         obj.put("num",num);
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -1071,6 +1152,7 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |             JSONObject range = new JSONObject();
 |  |             JSONObject range = new JSONObject();
 | 
												
													
														
															|  |             range.put("range", endStr);
 |  |             range.put("range", endStr);
 | 
												
													
														
															|  |             range.put("amount", 0);
 |  |             range.put("amount", 0);
 | 
												
													
														
															|  | 
 |  |             range.put("num",0.0);
 | 
												
													
														
															|  |             countResult.put(endStr, range);
 |  |             countResult.put(endStr, range);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -1112,7 +1194,9 @@ public class StatisticsEsService {
 | 
												
													
														
															|  | //                }
 |  | //                }
 | 
												
													
														
															|  |                 if (json != null) {
 |  |                 if (json != null) {
 | 
												
													
														
															|  |                     long amount = saveModel.getResult2().longValue();
 |  |                     long amount = saveModel.getResult2().longValue();
 | 
												
													
														
															|  | 
 |  |                     double num = saveModel.getResult1();
 | 
												
													
														
															|  |                     json.put("amount", amount);
 |  |                     json.put("amount", amount);
 | 
												
													
														
															|  | 
 |  |                     json.put("num",num);
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -1179,7 +1263,7 @@ public class StatisticsEsService {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if (startDate.compareTo(endDate) == 0) {
 |  |         if (startDate.compareTo(endDate) == 0) {
 | 
												
													
														
															|  |             flag = false;
 |  |             flag = false;
 | 
												
													
														
															|  |             days.add(end);
 |  | 
 | 
												
													
														
															|  | 
 |  |        /*     days.add(end);*/
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         // 统计日期计算
 |  |         // 统计日期计算
 | 
												
											
												
													
														
															|  | @ -1197,7 +1281,7 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |             if (next.getTime().before(DateUtil.strToDate(endDate, "yyyy-MM-dd"))) {
 |  |             if (next.getTime().before(DateUtil.strToDate(endDate, "yyyy-MM-dd"))) {
 | 
												
													
														
															|  |                 days.add(next);
 |  |                 days.add(next);
 | 
												
													
														
															|  |             } else {
 |  |             } else {
 | 
												
													
														
															|  |                 days.add(end);
 |  | 
 | 
												
													
														
															|  | 
 |  |          /*       days.add(end);*/
 | 
												
													
														
															|  |                 flag = false;
 |  |                 flag = false;
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             k++;
 |  |             k++;
 | 
												
											
												
													
														
															|  | @ -1206,13 +1290,14 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |         // 统计结果
 |  |         // 统计结果
 | 
												
													
														
															|  |         Map<String, JSONObject> countResult = new HashMap<>();
 |  |         Map<String, JSONObject> countResult = new HashMap<>();
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         for (int i = 0; i < days.size() - 1; i++) {
 |  | 
 | 
												
													
														
															|  |             String endStr = df.format(days.get(i + 1).getTime());
 |  | 
 | 
												
													
														
															|  | 
 |  |         for (int i = 0; i < days.size(); i++) {
 | 
												
													
														
															|  | 
 |  |             String endStr = df.format(days.get(i).getTime());
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             JSONObject range = new JSONObject();
 |  |             JSONObject range = new JSONObject();
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             range.put("range", endStr);
 |  |             range.put("range", endStr);
 | 
												
													
														
															|  |             range.put("amount", 0);
 |  |             range.put("amount", 0);
 | 
												
													
														
															|  | 
 |  |             range.put("num",0.0);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             countResult.put(endStr, range);
 |  |             countResult.put(endStr, range);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -1220,7 +1305,6 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |         if (startDate.equals(df.format(new Date()))) {
 |  |         if (startDate.equals(df.format(new Date()))) {
 | 
												
													
														
															|  |             Calendar preDate = Calendar.getInstance();
 |  |             Calendar preDate = Calendar.getInstance();
 | 
												
													
														
															|  |             preDate.setTime(df.parse(endDate));
 |  |             preDate.setTime(df.parse(endDate));
 | 
												
													
														
															|  |             preDate.add(Calendar.DATE, -1);
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             startDate = df.format(preDate.getTime());
 |  |             startDate = df.format(preDate.getTime());
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -1240,12 +1324,14 @@ public class StatisticsEsService {
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 JSONObject json = countResult.get(range);
 |  |                 JSONObject json = countResult.get(range);
 | 
												
													
														
															|  |                 //因为上述时间集提前一天  但是前端是显示当前时间,所以这里给调整回去
 |  |                 //因为上述时间集提前一天  但是前端是显示当前时间,所以这里给调整回去
 | 
												
													
														
															|  |                 if (range.equals(df.format(temp.getTime()))) {
 |  | 
 | 
												
													
														
															|  | 
 |  |                 /*if (range.equals(df.format(temp.getTime()))) {
 | 
												
													
														
															|  |                     json.put("range", endDate);
 |  |                     json.put("range", endDate);
 | 
												
													
														
															|  |                 }
 |  | 
 | 
												
													
														
															|  | 
 |  |                 }*/
 | 
												
													
														
															|  |                 if (json != null) {
 |  |                 if (json != null) {
 | 
												
													
														
															|  |                     long amount = saveModel.getResult2().longValue();
 |  |                     long amount = saveModel.getResult2().longValue();
 | 
												
													
														
															|  | 
 |  |                     double num = saveModel.getResult1();
 | 
												
													
														
															|  |                     json.put("amount", amount);
 |  |                     json.put("amount", amount);
 | 
												
													
														
															|  | 
 |  |                     json.put("num",num);
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 |