|  | @ -12,8 +12,10 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.org.BaseOrgDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.es.util.ElasticsearchUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.es.util.SaveModel;
 | 
	
		
			
				|  |  | import com.yihu.jw.org.dao.BaseOrgDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.base.BaseRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.evaluate.score.service.BaseEvaluateScoreService;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
	
		
			
				|  | @ -59,6 +61,8 @@ public class StatisticsEsService {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseDoctorDao doctorDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseOrgDao orgDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseEvaluateScoreService baseEvaluateScoreService;
 | 
	
		
			
				|  |  |     SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -442,7 +446,7 @@ public class StatisticsEsService {
 | 
	
		
			
				|  |  |         //问诊量
 | 
	
		
			
				|  |  |         JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |         if (interval==1){
 | 
	
		
			
				|  |  |             JSONArray array = dateTotalStatistics3(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null);
 | 
	
		
			
				|  |  |             JSONArray array = dateTotalStatistics3(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,level2_type);
 | 
	
		
			
				|  |  |             object.put("data",array);
 | 
	
		
			
				|  |  |             JSONArray array1 = dateTotalStatistics3(startDate,endDate,area,level,index,"3",SaveModel.timeLevel_ZL,null);
 | 
	
		
			
				|  |  |             object.put("specialistData",array1);
 | 
	
	
		
			
				|  | @ -546,6 +550,10 @@ public class StatisticsEsService {
 | 
	
		
			
				|  |  |                                         jsonObject.put("code",doctorHospitalDO.getDeptCode());
 | 
	
		
			
				|  |  |                                         jsonObject.put("name",doctorHospitalDO.getDeptName());
 | 
	
		
			
				|  |  |                                     }
 | 
	
		
			
				|  |  |                                 }else if (level==4){
 | 
	
		
			
				|  |  |                                     BaseOrgDO orgDO = orgDao.findByCode(area);
 | 
	
		
			
				|  |  |                                     jsonObject.put("code",area);
 | 
	
		
			
				|  |  |                                     jsonObject.put("name",orgDO.getName());
 | 
	
		
			
				|  |  |                                 }else {
 | 
	
		
			
				|  |  |                                     DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 | 
	
		
			
				|  |  |                                     jsonObject.put("code",area);
 | 
	
	
		
			
				|  | @ -594,6 +602,10 @@ public class StatisticsEsService {
 | 
	
		
			
				|  |  |                                     jsonObject.put("code",doctorHospitalDO.getDeptCode());
 | 
	
		
			
				|  |  |                                     jsonObject.put("name",doctorHospitalDO.getDeptName());
 | 
	
		
			
				|  |  |                                 }
 | 
	
		
			
				|  |  |                             }else if (level==4){
 | 
	
		
			
				|  |  |                                 BaseOrgDO orgDO = orgDao.findByCode(area);
 | 
	
		
			
				|  |  |                                 jsonObject.put("code",area);
 | 
	
		
			
				|  |  |                                 jsonObject.put("name",orgDO.getName());
 | 
	
		
			
				|  |  |                             }else {
 | 
	
		
			
				|  |  |                                 DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 | 
	
		
			
				|  |  |                                 jsonObject.put("code",area);
 | 
	
	
		
			
				|  | @ -640,6 +652,10 @@ public class StatisticsEsService {
 | 
	
		
			
				|  |  |                                     jsonObject.put("code",doctorHospitalDO.getDeptCode());
 | 
	
		
			
				|  |  |                                     jsonObject.put("name",doctorHospitalDO.getDeptName());
 | 
	
		
			
				|  |  |                                 }
 | 
	
		
			
				|  |  |                             }else if (level==4){
 | 
	
		
			
				|  |  |                                 BaseOrgDO orgDO = orgDao.findByCode(area);
 | 
	
		
			
				|  |  |                                 jsonObject.put("code",area);
 | 
	
		
			
				|  |  |                                 jsonObject.put("name",orgDO.getName());
 | 
	
		
			
				|  |  |                             }else {
 | 
	
		
			
				|  |  |                                 DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 | 
	
		
			
				|  |  |                                 jsonObject.put("code",area);
 | 
	
	
		
			
				|  | @ -685,6 +701,10 @@ public class StatisticsEsService {
 | 
	
		
			
				|  |  |                                     jsonObject.put("code",doctorHospitalDO.getDeptCode());
 | 
	
		
			
				|  |  |                                     jsonObject.put("name",doctorHospitalDO.getDeptName());
 | 
	
		
			
				|  |  |                                 }
 | 
	
		
			
				|  |  |                             }else if (level==4){
 | 
	
		
			
				|  |  |                                 BaseOrgDO orgDO = orgDao.findByCode(area);
 | 
	
		
			
				|  |  |                                 jsonObject.put("code",area);
 | 
	
		
			
				|  |  |                                 jsonObject.put("name",orgDO.getName());
 | 
	
		
			
				|  |  |                             }else {
 | 
	
		
			
				|  |  |                                 DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
 | 
	
		
			
				|  |  |                                 jsonObject.put("code",area);
 | 
	
	
		
			
				|  | @ -710,6 +730,7 @@ public class StatisticsEsService {
 | 
	
		
			
				|  |  |                 jsonObject.put("total",decimalFormat.format(total));//总和
 | 
	
		
			
				|  |  |                 array.add(jsonObject);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             object.put("excelData",array);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return object;
 | 
	
	
		
			
				|  | @ -4482,4 +4503,106 @@ public class StatisticsEsService {
 | 
	
		
			
				|  |  |         object.put("synergyTotal",synergyTotal.getResult1());
 | 
	
		
			
				|  |  |         return object;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public  JSONObject appPriceHead(String startDate, String endDate, String area,int level, String index) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |         DecimalFormat decimalFormat = new DecimalFormat("0.00");
 | 
	
		
			
				|  |  |         //图文复诊
 | 
	
		
			
				|  |  |         SaveModel topicTotal = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"1","1");
 | 
	
		
			
				|  |  |         object.put("topicTotal",decimalFormat.format(topicTotal.getResult1()));
 | 
	
		
			
				|  |  |         //视频复诊
 | 
	
		
			
				|  |  |         SaveModel videoTotal = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"1","2");
 | 
	
		
			
				|  |  |         object.put("videoTotal",decimalFormat.format(videoTotal.getResult1()));
 | 
	
		
			
				|  |  |         //专家咨询
 | 
	
		
			
				|  |  |         SaveModel specialistTotal = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"3");
 | 
	
		
			
				|  |  |         object.put("specialistTotal",decimalFormat.format(specialistTotal.getResult1()));
 | 
	
		
			
				|  |  |         //专科协同
 | 
	
		
			
				|  |  |         SaveModel synergyTotal = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"2");
 | 
	
		
			
				|  |  |         object.put("synergyTotal",decimalFormat.format(synergyTotal.getResult1()));
 | 
	
		
			
				|  |  |         //总收入
 | 
	
		
			
				|  |  |         SaveModel totalPrice = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_DDL);
 | 
	
		
			
				|  |  |         object.put("totalPrice",decimalFormat.format(totalPrice.getResult1()));
 | 
	
		
			
				|  |  |         return object;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public  JSONObject appPrescriptionHead(String startDate, String endDate, String area,int level, String index) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |         //图文复诊
 | 
	
		
			
				|  |  |         SaveModel topicTotal = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"1");
 | 
	
		
			
				|  |  |         object.put("topicTotal",topicTotal.getResult1());
 | 
	
		
			
				|  |  |         //视频复诊
 | 
	
		
			
				|  |  |         SaveModel videoTotal = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"2");
 | 
	
		
			
				|  |  |         object.put("videoTotal",videoTotal.getResult1());
 | 
	
		
			
				|  |  |         //总计
 | 
	
		
			
				|  |  |         SaveModel specialistTotal = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL);
 | 
	
		
			
				|  |  |         object.put("total",specialistTotal.getResult1());
 | 
	
		
			
				|  |  |         return object;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject appCenterCircular(String startDate, String endDate, String area, int level, String index) throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |         if (index.equalsIgnoreCase("3")||index.equalsIgnoreCase("3,21")||index.equalsIgnoreCase("21")){
 | 
	
		
			
				|  |  |             //协同门诊
 | 
	
		
			
				|  |  |             SaveModel saveModel1 = null;
 | 
	
		
			
				|  |  |             saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "2");
 | 
	
		
			
				|  |  |             //图文复诊
 | 
	
		
			
				|  |  |             SaveModel saveModel2 = null;
 | 
	
		
			
				|  |  |             //saveModel2 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","1");
 | 
	
		
			
				|  |  |             saveModel2 = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "1","1");
 | 
	
		
			
				|  |  |             //视频复诊
 | 
	
		
			
				|  |  |             SaveModel saveModel3 = null;
 | 
	
		
			
				|  |  | /*
 | 
	
		
			
				|  |  |     saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","2");
 | 
	
		
			
				|  |  | */
 | 
	
		
			
				|  |  |             saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "1","2");
 | 
	
		
			
				|  |  |             Double specialistCount =0.0;
 | 
	
		
			
				|  |  |             //专科咨询
 | 
	
		
			
				|  |  |             SaveModel saveModel4 = null;
 | 
	
		
			
				|  |  |             saveModel4 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "3");
 | 
	
		
			
				|  |  |             specialistCount = saveModel4.getResult1();//专家咨询数量
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //总量
 | 
	
		
			
				|  |  |             SaveModel saveModel5 = null;
 | 
	
		
			
				|  |  |             saveModel5 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             Double synergyCount = saveModel1.getResult1();//协同门诊数量
 | 
	
		
			
				|  |  |             Double topicCount = saveModel2.getResult1();//图文复诊数量
 | 
	
		
			
				|  |  |             Double videoCount = saveModel3.getResult1();//视频复诊数量
 | 
	
		
			
				|  |  |             Double total = saveModel5.getResult1();//总量
 | 
	
		
			
				|  |  |             DecimalFormat decimalFormat = new DecimalFormat("0.00");
 | 
	
		
			
				|  |  |             object.put("specialistCount",decimalFormat.format(specialistCount));//专家咨询数
 | 
	
		
			
				|  |  |             object.put("specialistRate",getRange(specialistCount.intValue(),total.intValue(),0));
 | 
	
		
			
				|  |  |             object.put("synergyCount",decimalFormat.format(synergyCount));//专家咨询数
 | 
	
		
			
				|  |  |             object.put("synergyRate",getRange(synergyCount.intValue(),total.intValue(),0));
 | 
	
		
			
				|  |  |             object.put("topicCount",decimalFormat.format(topicCount));//图文复诊数量
 | 
	
		
			
				|  |  |             object.put("topicRate",getRange(topicCount.intValue(),total.intValue(),0));
 | 
	
		
			
				|  |  |             object.put("videoCount",decimalFormat.format(videoCount));//视频复诊数量
 | 
	
		
			
				|  |  |             object.put("videoRate",getRange(videoCount.intValue(),total.intValue(),0));
 | 
	
		
			
				|  |  |             object.put("total",decimalFormat.format(total));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }else if (index.equalsIgnoreCase("20")){
 | 
	
		
			
				|  |  |             //图文复诊
 | 
	
		
			
				|  |  |             SaveModel saveModel2 = null;
 | 
	
		
			
				|  |  |             saveModel2 = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "1");
 | 
	
		
			
				|  |  |             //视频复诊
 | 
	
		
			
				|  |  |             SaveModel saveModel3 = null;
 | 
	
		
			
				|  |  |             saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(startDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "2");
 | 
	
		
			
				|  |  |             //总数
 | 
	
		
			
				|  |  |             SaveModel saveModel1 = null;
 | 
	
		
			
				|  |  |             saveModel1 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_DDL);
 | 
	
		
			
				|  |  |             Double topicCount = saveModel2.getResult1();//图文复诊数量
 | 
	
		
			
				|  |  |             Double videoCount = saveModel3.getResult1();//视频复诊数量
 | 
	
		
			
				|  |  |             Double total = saveModel1.getResult1();//总量
 | 
	
		
			
				|  |  |             object.put("topicCount",topicCount);//图文复诊数量
 | 
	
		
			
				|  |  |             object.put("topicRate",getRange(topicCount.intValue(),total.intValue(),0));
 | 
	
		
			
				|  |  |             object.put("videoCount",videoCount);//视频复诊数量
 | 
	
		
			
				|  |  |             object.put("videoRate",getRange(videoCount.intValue(),total.intValue(),0));
 | 
	
		
			
				|  |  |             object.put("total",total);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return object;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |