| 
					
				 | 
			
			
				@ -4906,6 +4906,17 @@ public class StatisticsService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND p.`status` = ? " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND p.create_time <= ? " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND p.create_time >= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String cancelSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " count(1) count" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_prescription p " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.admin_team_id = ? " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND p.`status` <= ? " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND p.create_time <= ? " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND p.create_time >= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> total = jdbcTemplate.queryForList(totalSql,new Object[]{adminTeamId,endDate,startDate}); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4943,7 +4954,7 @@ public class StatisticsService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("noReviewedCount",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //其他原因取消 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(stateSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue(),endDate,startDate}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(cancelSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue(),endDate,startDate}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(total!=null&&total.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("payOuttimeCount",payOuttimeCount.get(0).get("count")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4980,7 +4991,7 @@ public class StatisticsService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        processingSql += " AND  p.`status` < " + PrescriptionLog.PrescriptionLogStatus.finish.getValue() + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND p.`status`>= " + PrescriptionLog.PrescriptionLogStatus.revieweding.getValue() ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //已完成,已经取消,审核不通过,其他原因取消 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //已完成,已经取消,审核不通过 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String stateSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " count(1) count" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4992,6 +5003,18 @@ public class StatisticsService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        stateSql += " AND p.`status` = ? " ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //其他原因取消 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String cancelSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " count(1) count" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_prescription p "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(disease)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            cancelSql += " JOIN wlyy_prescription_diagnosis d ON  d.prescription_code = p.code WHERE d.health_problem ='"+disease+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            cancelSql +=" WHERE 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        cancelSql += " AND p.`status` <= ? " ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //市区 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("4".equals(level)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //市区无过滤 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5000,11 +5023,13 @@ public class StatisticsService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND LEFT(p.hospital, 6) = '"+area+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            processingSql += " AND LEFT(p.hospital, 6) = '"+area+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            stateSql += " AND LEFT(p.hospital, 6) = '"+area+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            cancelSql += " AND LEFT(p.hospital, 6) = '"+area+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if("2".equals(level)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND p.hospital = '"+area+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            processingSql += " AND p.hospital = '"+area+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            stateSql += " AND p.hospital = '"+area+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            cancelSql += " AND LEFT(p.hospital, 6) = '"+area+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> rs = new HashedMap(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5044,7 +5069,7 @@ public class StatisticsService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("noReviewedCount",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //其他原因取消 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(stateSql,new Object[]{PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(cancelSql,new Object[]{PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(total!=null&&total.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("payOuttimeCount",payOuttimeCount.get(0).get("count")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5109,7 +5134,7 @@ public class StatisticsService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" AND p.`status` <'"+PrescriptionLog.PrescriptionLogStatus.finish.getValue()+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  " AND p.`status`>='"+PrescriptionLog.PrescriptionLogStatus.revieweding+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if("6".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" AND p.`status` ='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" AND p.`status` <='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " AND p.create_time >='"+DateUtil.dateToStr(dd.getTime(),"YYYY-MM-dd HH:mm:ss")+"' AND p.create_time <='"+ DateUtil.dateToStr(new Date(),"YYYY-MM-dd HH:mm:ss")+"'  GROUP BY LEFT(p.create_time,7) "; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5301,7 +5326,7 @@ public class StatisticsService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" AND p.`status` <'"+PrescriptionLog.PrescriptionLogStatus.finish.getValue()+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND p.`status`>='"+PrescriptionLog.PrescriptionLogStatus.revieweding+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if("6".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" AND p.`status` ='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" AND p.`status` <='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return sql; 
			 |