|
@ -572,10 +572,11 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
" patient_id, " +
|
|
|
" activity_id " +
|
|
|
"FROM " +
|
|
|
" wlyy_health_bank_task_patient_detail " +
|
|
|
"GROUP BY patient_id )btpd1 " +
|
|
|
" wlyy_health_bank_task_patient_detail htpd " +
|
|
|
" where htpd.activity_id ='"+activityId+"' AND htpd.patient_id ='"+patient+
|
|
|
"' GROUP BY patient_id )btpd1 " +
|
|
|
"WHERE " +
|
|
|
" btpd1.activity_id = '"+activityDO.getId()+"' AND btpd1.sum >= (SELECT SUM(s.total) as total " +
|
|
|
" btpd1.sum >= (SELECT SUM(s.total) as total " +
|
|
|
"FROM wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND s.activity_id='"+activityId+"')" ;
|
|
|
List<Map<String,Object>> rstotal1 = jdbcTemplate.queryForList(rankingSql1);
|
|
|
Long count = 0L;
|
|
@ -593,8 +594,8 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
" patient_id, " +
|
|
|
" activity_id " +
|
|
|
"FROM " +
|
|
|
" wlyy_health_bank_task_patient_detail " +
|
|
|
"GROUP BY patient_id )btpd1 " +
|
|
|
" 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.sum >= (SELECT SUM(s.total) as total " +
|
|
|
"FROM wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND s.activity_id='"+activityId+"') limit "+countTotal+",1" ;
|
|
@ -619,10 +620,10 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
" patient_id, " +
|
|
|
" activity_id " +
|
|
|
"FROM " +
|
|
|
" wlyy_health_bank_task_patient_detail " +
|
|
|
"GROUP BY patient_id )btpd1 " +
|
|
|
" wlyy_health_bank_task_patient_detail htpd WHERE htpd.activity_id ='"+activityId+"' AND htpd.patient_id !='"+patient+
|
|
|
"' GROUP BY patient_id )btpd1 " +
|
|
|
"WHERE " +
|
|
|
" btpd1.activity_id = '"+activityDO.getId()+"' AND btpd1.sum >= (SELECT SUM(s.coupon_total) as couponTotal " +
|
|
|
" 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+"')" ;
|
|
|
List<Map<String,Object>> rstotal2 = jdbcTemplate.queryForList(rankingSql2);
|
|
|
Long count2 = 0L;
|
|
@ -640,10 +641,10 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
" patient_id, " +
|
|
|
" activity_id " +
|
|
|
"FROM " +
|
|
|
" wlyy_health_bank_task_patient_detail " +
|
|
|
"GROUP BY patient_id )btpd1 " +
|
|
|
" 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.sum >= (SELECT SUM(s.total) as total " +
|
|
|
" btpd1.sum >= (SELECT SUM(s.total) as total " +
|
|
|
"FROM wlyy_health_bank_task_patient_detail s WHERE s.patient_id ='"+patient+"' AND s.activity_id='"+activityId+"') limit "+countTotal1+",1" ;
|
|
|
List<Map<String,Object>> totalSql10 = jdbcTemplate.queryForList(rankingSql10);
|
|
|
Integer total2 = 0;
|
|
@ -664,10 +665,9 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
" btpd.patient_id, " +
|
|
|
" btpd.activity_id " +
|
|
|
"FROM " +
|
|
|
" wlyy_health_bank_task_patient_detail btpd " +
|
|
|
"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.street = '"+street+"') AND btpd1.sum >= (SELECT SUM(s.coupon_total) as couponTotal " +
|
|
|
" 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+"')" ;
|
|
|
List<Map<String,Object>> rstotal3 = jdbcTemplate.queryForList(rankingSql3);
|
|
|
Long count3 = 0L;
|
|
@ -680,10 +680,9 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
" btpd.patient_id, " +
|
|
|
" btpd.activity_id " +
|
|
|
"FROM " +
|
|
|
" wlyy_health_bank_task_patient_detail btpd " +
|
|
|
"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 " +
|
|
|
" 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+"')" ;
|
|
|
List<Map<String,Object>> rstotal4 = jdbcTemplate.queryForList(rankingSql4);
|
|
|
Long count4 = 0L;
|
|
@ -698,10 +697,9 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
" btpd.patient_id, " +
|
|
|
" btpd.activity_id " +
|
|
|
"FROM " +
|
|
|
" wlyy_health_bank_task_patient_detail btpd " +
|
|
|
"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.street = '"+street+"') AND btpd1.sum >= (SELECT SUM(s.coupon_total) as couponTotal " +
|
|
|
" 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+"')" ;
|
|
|
List<Map<String,Object>> rstotal5 = jdbcTemplate.queryForList(rankingSql5);
|
|
|
Long count5 = 0L;
|
|
@ -714,8 +712,8 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
" btpd.patient_id, " +
|
|
|
" btpd.activity_id " +
|
|
|
"FROM " +
|
|
|
" wlyy_health_bank_task_patient_detail btpd " +
|
|
|
"GROUP BY patient_id )btpd1 " +
|
|
|
" 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+"')" ;
|
|
@ -733,10 +731,9 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
" btpd.patient_id, " +
|
|
|
" btpd.activity_id " +
|
|
|
"FROM " +
|
|
|
" wlyy_health_bank_task_patient_detail btpd " +
|
|
|
"GROUP BY patient_id )btpd1 " +
|
|
|
"WHERE " +
|
|
|
" btpd1.activity_id = '"+activityDO.getId()+"' and btpd1.patient_id IN(SELECT sf.patient FROM wlyy.wlyy_sign_family sf WHERE sf.status=1 " +
|
|
|
" 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 sf.patient FROM wlyy.wlyy_sign_family sf WHERE sf.status=1 " +
|
|
|
"AND sf.admin_team_code=(SELECT sf.admin_team_code FROM wlyy.wlyy_sign_family sf WHERE sf.status=1 AND sf.patient='"+patient+"') ) 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+"')" ;
|
|
|
List<Map<String,Object>> rstotal7 = jdbcTemplate.queryForList(rankingSql7);
|
|
@ -751,10 +748,9 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
" btpd.patient_id, " +
|
|
|
" btpd.activity_id " +
|
|
|
"FROM " +
|
|
|
" wlyy_health_bank_task_patient_detail btpd " +
|
|
|
"GROUP BY patient_id )btpd1 " +
|
|
|
"WHERE " +
|
|
|
" btpd1.activity_id = '"+activityDO.getId()+"' and btpd1.patient_id IN(SELECT sf.patient FROM wlyy.wlyy_sign_family sf WHERE sf.status=1 " +
|
|
|
" 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 sf.patient FROM wlyy.wlyy_sign_family sf WHERE sf.status=1 " +
|
|
|
"AND sf.admin_team_code=(SELECT sf.admin_team_code FROM wlyy.wlyy_sign_family sf WHERE sf.status=1 AND sf.patient='"+patient+"') ) 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+"')" ;
|
|
|
List<Map<String,Object>> rstotal8 = jdbcTemplate.queryForList(rankingSql8);
|
|
@ -824,7 +820,11 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
jsonObject.put("couponTotal",taskPatientDetailDO1.getCouponTotal());//本人活动劵总数
|
|
|
jsonObject.put("couponRanking",patientDetailDOS1);//活动劵人数排名
|
|
|
jsonObject.put("signCouponRanking",count7);//活动劵团队排名
|
|
|
jsonObject.put("differTotal",total2-total3);//相距前一个差多少活动劵
|
|
|
if (count2 ==1){
|
|
|
jsonObject.put("differTotal",0);
|
|
|
}else {
|
|
|
jsonObject.put("differTotal",total2-total3);//相距前一个差多少活动劵
|
|
|
}
|
|
|
}else if (type ==1){
|
|
|
jsonObject.put("IntegrateRanking",patientDetailDOS);
|
|
|
jsonObject.put("activityStreetIntegrateRanking",count5);//积分街道排名
|
|
@ -832,7 +832,11 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
|
|
|
jsonObject.put("activityTownIntegrateRanking",count6);//积分全区排名
|
|
|
jsonObject.put("activityRanking",count);//积分排名
|
|
|
jsonObject.put("signRanking",count8);//积分团队排名
|
|
|
jsonObject.put("differTotal",total-total1);//相距前一个差多少积分
|
|
|
if (count==1){
|
|
|
jsonObject.put("differTotal",0);//相距前一个差多少积分
|
|
|
}else {
|
|
|
jsonObject.put("differTotal",total-total1);//相距前一个差多少积分
|
|
|
}
|
|
|
}
|
|
|
jsonObject.put("type",type);//积分还是活动劵
|
|
|
envelop.setObj(jsonObject);
|