| 
					
				 | 
			
			
				@ -725,14 +725,14 @@ public class StatisticsEsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level2_type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *//* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getPrescriptionLine(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //开方量增量曲线 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray array = dateTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("prescriptionLine",array); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3445,8 +3445,136 @@ public class StatisticsEsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 按日期柱状图统计处方量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param area 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level 2科室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param index 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level2_type 4 医院 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getPrescriptionLine(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("service index:"+index+" and level2_type:"+level2_type+" and level:"+level); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String[] indexes = index.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray array = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray resultArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //问诊量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (interval==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             array = dateTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("data",array); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (interval==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             array = weekTotalStatistics(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("data",array); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (interval==3){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             array = monthTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("data",array); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(level2_type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //问诊量表格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> specialistSaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[0], SaveModel.timeLevel_ZL,"",String.valueOf(interval),level2_type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //开具处方数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> prescriptionSaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"",String.valueOf(interval),"4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //每个医生根据传入时间查询开具处方数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> doctorSaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"",String.valueOf(interval),"6"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i=0;i<prescriptionSaveModels.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Double specialist = 0.0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Double totalOutpatient = 0.0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = prescriptionSaveModels.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("hospitalCode",saveModel.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("hospitalName",saveModel.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("deptNo",saveModel.getDept()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("deptName",saveModel.getDeptName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("name",saveModel.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("specialist",saveModel.getResult1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("doctorName",saveModel.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("doctorcode",saveModel.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                specialist = saveModel.getResult1(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("specialist",specialist); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalOutpatient = specialistSaveModels.get(i).getResult1(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String prescriptionRate = getRange(specialist.intValue(),totalOutpatient.intValue(),0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("prescriptionRate",prescriptionRate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                resultArray.add(jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("excelData",resultArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("detailList",prescriptionSaveModels); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 按日期柱状图 取药方式统计处方量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param area 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level 2科室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param index 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level2_type 4 医院 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getPrescriptionLineByType(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("service index:"+index+" and level2_type:"+level2_type+" and level:"+level); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String[] indexes = index.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray array = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray resultArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //问诊量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (interval==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            array = dateTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("data",array); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (interval==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            array = weekTotalStatistics(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("data",array); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (interval==3){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            array = monthTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("data",array); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(level2_type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //问诊量表格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> specialistSaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[0], SaveModel.timeLevel_ZL,"",String.valueOf(interval),level2_type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //开具处方数量中自取的处方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> oneselfTake = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"1",String.valueOf(interval),level2_type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //开具处方数量中快递的处方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<SaveModel> mailPost = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"0",String.valueOf(interval),level2_type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(SaveModel saveModel:oneselfTake) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            /*for (int i=0;i<prescriptionSaveModels.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Double specialist = 0.0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Double totalOutpatient = 0.0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SaveModel saveModel = prescriptionSaveModels.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("hospitalCode",saveModel.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("hospitalName",saveModel.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("deptNo",saveModel.getDept()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("deptName",saveModel.getDeptName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("name",saveModel.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("specialist",saveModel.getResult1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                specialist = saveModel.getResult1(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalOutpatient = specialistSaveModels.get(i).getResult1(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String prescriptionRate = getRange(specialist.intValue(),totalOutpatient.intValue(),0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("prescriptionRate",prescriptionRate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                resultArray.add(jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("excelData",resultArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |