| 
					
				 | 
			
			
				@ -528,15 +528,16 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        TaskPatientDetailDO taskPatientDetailDO1 = taskPatientDetailDao.selectByActivityIdAndPatientId(activityId,patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //积分排行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql  ="SELECT btpd1.patientId, btpd1.total, btpd1.create_time AS updateTime FROM (SELECT btpd.patient_id AS patientId,btpd.total,btpd.create_time AS create_time FROM ( SELECT sum(btpd.total) AS total, btpd.patient_id,btpd.create_time " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql  ="SELECT btpd.patient_id AS patientId,btpd.total,btpd.create_time AS updateTime FROM ( SELECT sum(btpd.total) AS total, btpd.patient_id,btpd.create_time " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM wlyy_health_bank_task_patient_detail btpd " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE btpd.activity_id = '"+activityId + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "' GROUP BY  btpd.patient_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ) btpd " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "ORDER BY " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " btpd.total DESC)btpd1 ORDER BY btpd1.create_time LIMIT " + (page-1)*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " btpd.total DESC,btpd.create_time ASC LIMIT " + (page-1)*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<TaskPatientDetailDO> patientDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(TaskPatientDetailDO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        long count=0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int j =0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (TaskPatientDetailDO taskPatientDetailDO:patientDetailDOS){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String timeSeparated = DateUtils.getDatePoor(new Date(),taskPatientDetailDO.getUpdateTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String goodsSql = "select * from wlyy_health_bank_exchange_goods where patient_id ='"+taskPatientDetailDO.getPatientId()+"' " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -548,20 +549,22 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            taskPatientDetailDO.setExchangeGoodsDO(exchangeGoodsDOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            taskPatientDetailDO.setTimeSeparated(timeSeparated); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!taskPatientDetailDO.getPatientId().equals(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                count+=1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            j++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (taskPatientDetailDO.getPatientId().equals(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                count = j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //活动劵排行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCoupon  ="SELECT btpd1.patientId, btpd1.couponTotal, btpd1.create_time AS updateTime FROM (SELECT btpd.patient_id AS patientId,btpd.couponTotal,btpd.create_time AS create_time  FROM ( SELECT sum(btpd.coupon_total) AS couponTotal, btpd.patient_id,btpd.create_time " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCoupon  ="SELECT btpd.patient_id AS patientId,btpd.couponTotal,btpd.create_time AS updateTime  FROM ( SELECT sum(btpd.coupon_total) AS couponTotal, btpd.patient_id,btpd.create_time " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM wlyy_health_bank_task_patient_detail btpd " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE btpd.activity_id = '"+activityId + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "' GROUP BY  btpd.patient_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ) btpd " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "ORDER BY " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " btpd.couponTotal DESC )btpd1 ORDER BY btpd1.create_time DESC LIMIT " + (page-1)*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " btpd.couponTotal DESC,btpd.create_time ASC LIMIT " + (page-1)*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<TaskPatientDetailDO> patientDetailDOS1 = jdbcTemplate.query(sqlCoupon,new BeanPropertyRowMapper<>(TaskPatientDetailDO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        long count2 = 0l; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int i=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (TaskPatientDetailDO taskPatientDetailDO:patientDetailDOS1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String timeSeparated = DateUtils.getDatePoor(new Date(),taskPatientDetailDO.getUpdateTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String goodsSql = "select * from wlyy_health_bank_exchange_goods where patient_id ='"+taskPatientDetailDO.getPatientId()+"' " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -571,8 +574,9 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                TaskGoodsDO taskGoodsDO = taskGoodsDao.selectById(exchangeGoodsDO.getActivityGoodsId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                exchangeGoodsDO.setTaskGoodsDO(taskGoodsDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (taskPatientDetailDO.getPatientId().equals(taskPatientDetailDO.getPatientId())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                count2+=1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            i++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (taskPatientDetailDO.getPatientId().equals(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                count2=i; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            taskPatientDetailDO.setExchangeGoodsDO(exchangeGoodsDOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            taskPatientDetailDO.setTimeSeparated(timeSeparated); 
			 |