| 
					
				 | 
			
			
				@ -1176,7 +1176,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (taskDOS!=null&&taskDOS.size()!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                activityDO.setTaskDOS(taskDOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sqlCount1 = "select sum(integrate) as total  from wlyy_health_bank_credits_detail where transaction_id='"+taskDOS.get(0).getId()+"' and patient_id = '"+patient+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "and create_time >= '"+DateUtils.getDayBegin()+"' and create_time <='"+DateUtils.getDayEnd()+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "and create_time >= '"+DateUtils.getDayBegin()+"' and create_time <='"+DateUtils.getDayEnd()+"' AND  description IS NULL "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<Map<String,Object>> rstotal1 = jdbcTemplate.queryForList(sqlCount1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Long count1 = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(rstotal1!=null&&rstotal1.size()>0){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1243,33 +1243,36 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 小程序活动排名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patients 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param taskId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject selectAppletsRanking(JSONArray patients,String taskId,Integer size,String patient){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject selectAppletsRanking(Integer flag,String flagName,String taskId,Integer size,String patient){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        StringBuffer buffer = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patients!= null&&patients.size()!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            buffer.append("and bcd.patient_id IN("); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i=0;i<patients.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                buffer.append("'"+patients.getString(i)+"',"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            buffer.deleteCharAt(buffer.length()-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            buffer.append(") "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (flag == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            buffer.append(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (flag == 2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            buffer.append(" and hbtd.town='"+flagName+"' "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (flag==3){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            buffer.append(" and hbtd.hospital = '"+flagName+"'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT @rownum :=@rownum + 1 AS rank, r.sum, r.patient_id AS patient FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT @rownum :=@rownum + 1 AS rank, IFNULL(r.sum,0) as sum , r.patient_id AS patient FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "(SELECT@rowNum := 0) b," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " (SELECT count(bcd.integrate) AS sum, bcd.patient_id, bcd.create_time FROM wlyy_health_bank_credits_detail bcd " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE bcd.transaction_id = '"+taskId+"' " +buffer+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "GROUP BY bcd.patient_id) r ORDER BY r.sum DESC,r.create_time DESC LIMIT 0,"+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " (SELECT  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " sum(bcd.integrate) AS sum, hbtd.patient_id, hbtd.create_time FROM wlyy_health_bank_task_patient_detail hbtd " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " LEFT JOIN wlyy_health_bank_credits_detail bcd ON hbtd.patient_id=bcd.patient_id AND bcd.transaction_id= '"+taskId + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "' WHERE hbtd.task_id = '"+taskId+"' " +buffer+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "GROUP BY hbtd.patient_id) r ORDER BY r.sum DESC,r.create_time DESC LIMIT 0,"+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql1= "select s.rank,s.sum,s.patient_id from (SELECT @rownum :=@rownum + 1 AS rank, r.sum, r.patient_id FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql1= "select s.rank,IFNULL(s.sum,0) as sum,s.patient_id from (SELECT @rownum :=@rownum + 1 AS rank, r.sum, r.patient_id FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "(SELECT@rowNum := 0) b," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " (SELECT count(bcd.integrate) AS sum, bcd.patient_id, bcd.create_time FROM wlyy_health_bank_credits_detail bcd\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE bcd.transaction_id = '"+taskId+"' " +buffer+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "GROUP BY bcd.patient_id) r ORDER BY r.sum DESC,r.create_time DESC)s where s.patient_id ='"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " (SELECT sum(bcd.integrate) AS sum, hbtd.patient_id, hbtd.create_time FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "wlyy_health_bank_task_patient_detail hbtd " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  LEFT  JOIN wlyy_health_bank_credits_detail bcd ON hbtd.patient_id=bcd.patient_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND bcd.transaction_id='"+taskId+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE hbtd.task_id = '"+taskId+"' " +buffer+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "GROUP BY hbtd.patient_id) r ORDER BY r.sum DESC,r.create_time DESC)s where s.patient_id ='"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("list",list); 
			 |