| 
															
																@ -5,11 +5,9 @@ package com.yihu.jw.service;/** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.alibaba.fastjson.JSON; 
															 | 
															
															 | 
															
																import com.alibaba.fastjson.JSON; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.alibaba.fastjson.JSONArray; 
															 | 
															
															 | 
															
																import com.alibaba.fastjson.JSONArray; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.alibaba.fastjson.JSONObject; 
															 | 
															
															 | 
															
																import com.alibaba.fastjson.JSONObject; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.fasterxml.jackson.databind.ObjectMapper; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.google.common.base.Joiner; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.netflix.discovery.util.StringUtil; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.dao.*; 
															 | 
															
															 | 
															
																import com.yihu.jw.dao.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.health.bank.*; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.health.bank.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.util.AesEncryptUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.restmodel.web.MixEnvelop; 
															 | 
															
															 | 
															
																import com.yihu.jw.restmodel.web.MixEnvelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.rm.health.bank.HealthBankMapping; 
															 | 
															
															 | 
															
																import com.yihu.jw.rm.health.bank.HealthBankMapping; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.util.DateUtils; 
															 | 
															
															 | 
															
																import com.yihu.jw.util.DateUtils; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -22,7 +20,6 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.jdbc.core.JdbcTemplate; 
															 | 
															
															 | 
															
																import org.springframework.jdbc.core.JdbcTemplate; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.stereotype.Service; 
															 | 
															
															 | 
															
																import org.springframework.stereotype.Service; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import javax.transaction.RollbackException; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import javax.transaction.Transactional; 
															 | 
															
															 | 
															
																import javax.transaction.Transactional; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import java.text.ParseException; 
															 | 
															
															 | 
															
																import java.text.ParseException; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import java.text.SimpleDateFormat; 
															 | 
															
															 | 
															
																import java.text.SimpleDateFormat; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -276,8 +273,11 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            activityDO1.setTotal(count); 
															 | 
															
															 | 
															
																            activityDO1.setTotal(count); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            String taskSql1 = "select * from wlyy_health_bank_task_patient_detail btpd where activity_id = '"+activityDO1.getId() 
															 | 
															
															 | 
															
																            String taskSql1 = "select * from wlyy_health_bank_task_patient_detail btpd where activity_id = '"+activityDO1.getId() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    +"' and (patient_idcard = '"+activityDO.getPatientIdcard()+"' OR union_id = '"+activityDO.getUnionId()+"')"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    +"' and (patient_idcard = '"+ AesEncryptUtils.encrypt(activityDO.getPatientIdcard())+"' OR union_id = '"+activityDO.getUnionId()+"')"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(taskSql1,new BeanPropertyRowMapper(TaskPatientDetailDO.class)); 
															 | 
															
															 | 
															
																            List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(taskSql1,new BeanPropertyRowMapper(TaskPatientDetailDO.class)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            for (TaskPatientDetailDO taskPatientDetailDO : taskPatientDetailDOS){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                taskPatientDetailDO.setPatientIdcard(AesEncryptUtils.decrypt(taskPatientDetailDO.getPatientIdcard())); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            activityDO1.setTaskPatientDetailDOS(taskPatientDetailDOS); 
															 | 
															
															 | 
															
																            activityDO1.setTaskPatientDetailDOS(taskPatientDetailDOS); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            String tasksql = "select * from wlyy_health_bank_task where transaction_id = '"+activityDO1.getId()+"'"; 
															 | 
															
															 | 
															
																            String tasksql = "select * from wlyy_health_bank_task where transaction_id = '"+activityDO1.getId()+"'"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            List<TaskDO> taskDOList = jdbcTemplate.query(tasksql,new BeanPropertyRowMapper(TaskDO.class)); 
															 | 
															
															 | 
															
																            List<TaskDO> taskDOList = jdbcTemplate.query(tasksql,new BeanPropertyRowMapper(TaskDO.class)); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -407,7 +407,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " SELECT task_id FROM " + 
															 | 
															
															 | 
															
																                " SELECT task_id FROM " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "wlyy_health_bank_task_patient_detail" + 
															 | 
															
															 | 
															
																                "wlyy_health_bank_task_patient_detail" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " WHERE " + 
															 | 
															
															 | 
															
																                " WHERE " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " patient_idcard = '"+activityDO.getPatientIdcard()+"' "+ condition+")" + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                " patient_idcard = '"+ AesEncryptUtils.encrypt(activityDO.getPatientIdcard()) +"' "+ condition+")" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " ) AND del_flag =1 " +condition1+" order by create_time DESC "+ 
															 | 
															
															 | 
															
																                " ) AND del_flag =1 " +condition1+" order by create_time DESC "+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " LIMIT "+(page-1)*size +","+size; 
															 | 
															
															 | 
															
																                " LIMIT "+(page-1)*size +","+size; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<ActivityDO> activityDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class)); 
															 | 
															
															 | 
															
																        List<ActivityDO> activityDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class)); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -423,7 +423,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    " wlyy_health_bank_task_patient_detail " + 
															 | 
															
															 | 
															
																                    " wlyy_health_bank_task_patient_detail " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    "GROUP BY patient_openid,patient_idcard,union_id)btpd1 " + 
															 | 
															
															 | 
															
																                    "GROUP BY patient_openid,patient_idcard,union_id)btpd1 " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    "WHERE " + 
															 | 
															
															 | 
															
																                    "WHERE " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    " btpd1.activity_id = '"+activityDO1.getId() +"' AND patient_openid = '"+activityDO.getOpenId()+ "' AND patient_idcard = '"+activityDO.getPatientIdcard()+"' "+condition; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    " btpd1.activity_id = '"+activityDO1.getId() +"' AND patient_openid = '"+activityDO.getOpenId()+ "' AND patient_idcard = '"+AesEncryptUtils.encrypt(activityDO.getPatientIdcard())+"' "+condition; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(activitySql); 
															 | 
															
															 | 
															
																            List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(activitySql); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            Long count = 0L; 
															 | 
															
															 | 
															
																            Long count = 0L; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            if(rstotal!=null&&rstotal.size()>0){ 
															 | 
															
															 | 
															
																            if(rstotal!=null&&rstotal.size()>0){ 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -478,7 +478,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " SELECT task_id FROM " + 
															 | 
															
															 | 
															
																                " SELECT task_id FROM " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "wlyy_health_bank_task_patient_detail" + 
															 | 
															
															 | 
															
																                "wlyy_health_bank_task_patient_detail" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " WHERE " + 
															 | 
															
															 | 
															
																                " WHERE " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " patient_openid = '"+activityDO.getOpenId()+ "' AND patient_idcard = '"+activityDO.getPatientIdcard()+"'"+condition+ ")" + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                " patient_openid = '"+activityDO.getOpenId()+ "' AND patient_idcard = '"+AesEncryptUtils.encrypt(activityDO.getPatientIdcard())+"'"+condition+ ")" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " ) "+condition1; 
															 | 
															
															 | 
															
																                " ) "+condition1; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount); 
															 | 
															
															 | 
															
																        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Long count = 0L; 
															 | 
															
															 | 
															
																        Long count = 0L; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -801,28 +801,6 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            total1 = Integer.parseInt( rstotal10.get(0).get("total").toString()); 
															 | 
															
															 | 
															
																            total1 = Integer.parseInt( rstotal10.get(0).get("total").toString()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //总活动劵的排名 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        /*String rankingSql2 = "SELECT count(1)+1 AS total FROM (SELECT " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " SUM(coupon_total) AS sum , " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " patient_id, " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " activity_id," + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " create_time " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " wlyy_health_bank_task_patient_detail htpd WHERE htpd.activity_id ='"+activityId+"' AND htpd.patient_id !='"+patient+ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "' GROUP BY patient_id )btpd1 " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "WHERE " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "   btpd1.sum >= (SELECT SUM(s.coupon_total) as couponTotal " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM  wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND  s.activity_id='"+activityId+"')"+ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " AND btpd1.create_time >=(SELECT s.create_time " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM  wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND  s.activity_id='"+activityId+"')"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String,Object>> rstotal2 = jdbcTemplate.queryForList(rankingSql2); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Long count2 = 0L; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(rstotal2!=null&&rstotal2.size()>0){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            count2 = (Long) rstotal2.get(0).get("total"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        }*/ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Long countTotal1 = 0L; 
															 | 
															
															 | 
															
																        Long countTotal1 = 0L; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if ((count2-2)>=0){ 
															 | 
															
															 | 
															
																        if ((count2-2)>=0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            countTotal1=(count2-2); 
															 | 
															
															 | 
															
																            countTotal1=(count2-2); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -991,85 +969,6 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            count11 =  new Double((Double) maps1.get(0).get("rank")).longValue(); 
															 | 
															
															 | 
															
																            count11 =  new Double((Double) maps1.get(0).get("rank")).longValue(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //街道排名 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       /* String rankingSql3 = "SELECT count(1)+1 AS total FROM (SELECT " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " SUM(btpd.coupon_total) AS sum , " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " btpd.patient_id, " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " btpd.activity_id," + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " create_time " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " wlyy_health_bank_task_patient_detail btpd WHERE btpd.activity_id ='"+activityId+"' AND btpd.patient_id !='"+patient+ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "' GROUP BY patient_id )btpd1 " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "WHERE  btpd1.patient_id IN(SELECT p.code FROM wlyy.wlyy_patient p WHERE p.street = '"+street+"') AND btpd1.sum >= (SELECT SUM(s.coupon_total) as couponTotal " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM  wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND  s.activity_id='"+activityId+"')"+ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " AND btpd1.create_time >=(SELECT s.create_time " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM  wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND  s.activity_id='"+activityId+"')" ; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String,Object>> rstotal3 = jdbcTemplate.queryForList(rankingSql3); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Long count3 = 0L; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(rstotal3!=null&&rstotal3.size()>0){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            count3 = (Long) rstotal3.get(0).get("total"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        }*/ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //区排名 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       /* String rankingSql4 = "SELECT count(1)+1 AS total FROM (SELECT " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " SUM(btpd.coupon_total) AS sum , " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " btpd.patient_id, " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " btpd.activity_id," + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " create_time  " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " wlyy_health_bank_task_patient_detail btpd WHERE btpd.activity_id ='"+activityId+"' AND btpd.patient_id !='"+patient+ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "' GROUP BY patient_id )btpd1 " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "WHERE  btpd1.patient_id IN(SELECT p.code FROM wlyy.wlyy_patient p WHERE p.town = '"+town+"') AND btpd1.sum >= (SELECT SUM(s.coupon_total) as couponTotal " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM  wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND  s.activity_id='"+activityId+"')"+ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " AND btpd1.create_time >=(SELECT s.create_time " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM  wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND  s.activity_id='"+activityId+"')" ; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String,Object>> rstotal4 = jdbcTemplate.queryForList(rankingSql4); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Long count4 = 0L; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(rstotal4!=null&&rstotal4.size()>0){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            count4= (Long) rstotal4.get(0).get("total"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        }*/ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //积分 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //街道排名 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        /*String rankingSql5 = "SELECT count(1)+1 AS total FROM (SELECT " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " SUM(btpd.total) AS sum , " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " btpd.patient_id, " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " btpd.activity_id," + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " create_time  " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " wlyy_health_bank_task_patient_detail btpd WHERE btpd.activity_id ='"+activityId+"' AND btpd.patient_id !='"+patient+ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "' GROUP BY patient_id )btpd1 " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "WHERE  btpd1.patient_id IN(SELECT p.code FROM wlyy.wlyy_patient p WHERE p.street = '"+street+"') AND btpd1.sum >= (SELECT SUM(s.coupon_total) as couponTotal " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM  wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND  s.activity_id='"+activityId+"')"+ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " AND btpd1.create_time >=(SELECT s.create_time " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM  wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND  s.activity_id='"+activityId+"')" ; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String,Object>> rstotal5 = jdbcTemplate.queryForList(rankingSql5); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Long count5 = 0L; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(rstotal5!=null&&rstotal5.size()>0){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            count5 = (Long) rstotal5.get(0).get("total"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //区排名 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String rankingSql6 = "SELECT count(1)+1 AS total FROM (SELECT " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " SUM(btpd.total) AS sum , " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " btpd.patient_id, " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " btpd.activity_id," + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " create_time " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " wlyy_health_bank_task_patient_detail btpd WHERE btpd.activity_id ='"+activityId+"' AND btpd.patient_id !='"+patient+ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "' GROUP BY patient_id )btpd1 " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "WHERE " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " btpd1.activity_id = '"+activityDO.getId()+"' and  btpd1.patient_id IN(SELECT p.code FROM wlyy.wlyy_patient p WHERE p.town = '"+town+"') AND btpd1.sum >= (SELECT SUM(s.coupon_total) as couponTotal " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM  wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND  s.activity_id='"+activityId+"')" 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                + " AND btpd1.create_time >=(SELECT s.create_time " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "FROM  wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND  s.activity_id='"+activityId+"')" ; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String,Object>> rstotal6 = jdbcTemplate.queryForList(rankingSql6); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Long count6 = 0L; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(rstotal6!=null&&rstotal6.size()>0){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            count6= (Long) rstotal6.get(0).get("total"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																*/ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //活动劵团队排名 
															 | 
															
															 | 
															
																        //活动劵团队排名 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String rankingSql7 = "SELECT count(1)+1 AS total FROM (SELECT " + 
															 | 
															
															 | 
															
																        String rankingSql7 = "SELECT count(1)+1 AS total FROM (SELECT " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " SUM(btpd.coupon_total) AS sum , " + 
															 | 
															
															 | 
															
																                " SUM(btpd.coupon_total) AS sum , " + 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1292,7 +1191,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public MixEnvelop<ActivityDO,ActivityDO> selectByUnionId(String unionId,String patient,String idCard,Integer page,Integer size){ 
															 | 
															
															 | 
															
																    public MixEnvelop<ActivityDO,ActivityDO> selectByUnionId(String unionId,String patient,String idCard,Integer page,Integer size){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String sql ="select hba.* from wlyy_health_bank_activity hba right join wlyy_health_bank_task_patient_detail htpd on htpd.activity_id=hba.id " + 
															 | 
															
															 | 
															
																        String sql ="select hba.* from wlyy_health_bank_activity hba right join wlyy_health_bank_task_patient_detail htpd on htpd.activity_id=hba.id " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "AND htpd.union_id='"+unionId+"' AND  htpd.patient_id ='"+patient+"' and htpd.patient_idcard ='"+idCard+"' " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "AND htpd.union_id='"+unionId+"' AND  htpd.patient_id ='"+patient+"' and htpd.patient_idcard ='"+ AesEncryptUtils.encrypt(idCard)+"' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "where hba.del_flag=1 and hba.type='竞走' order by hba.create_time desc LIMIT " + (page-1)*size+","+size; 
															 | 
															
															 | 
															
																                "where hba.del_flag=1 and hba.type='竞走' order by hba.create_time desc LIMIT " + (page-1)*size+","+size; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<ActivityDO> activityDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class)); 
															 | 
															
															 | 
															
																        List<ActivityDO> activityDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        for (ActivityDO activityDO:activityDOList){ 
															 | 
															
															 | 
															
																        for (ActivityDO activityDO:activityDOList){ 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1361,7 +1260,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public List<ActivityDO> selectNowByUnionId(String unionId,String patient,String idCard){ 
															 | 
															
															 | 
															
																    public List<ActivityDO> selectNowByUnionId(String unionId,String patient,String idCard){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String sql ="select hba.* from wlyy_health_bank_activity hba right join wlyy_health_bank_task_patient_detail htpd on htpd.activity_id=hba.id " + 
															 | 
															
															 | 
															
																        String sql ="select hba.* from wlyy_health_bank_activity hba right join wlyy_health_bank_task_patient_detail htpd on htpd.activity_id=hba.id " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "AND htpd.union_id='"+unionId+"' AND  htpd.patient_id ='"+patient+"' and htpd.patient_idcard ='"+idCard+"' " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "AND htpd.union_id='"+unionId+"' AND  htpd.patient_id ='"+patient+"' and htpd.patient_idcard ='"+AesEncryptUtils.encrypt(idCard) +"' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "where hba.del_flag=1 and hba.type='竞走' order by hba.create_time desc " ; 
															 | 
															
															 | 
															
																                "where hba.del_flag=1 and hba.type='竞走' order by hba.create_time desc " ; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<ActivityDO> activityDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class)); 
															 | 
															
															 | 
															
																        List<ActivityDO> activityDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<ActivityDO> activityDOS = new ArrayList<>(); 
															 | 
															
															 | 
															
																        List<ActivityDO> activityDOS = new ArrayList<>(); 
															 |