|  | @ -93,15 +93,15 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 startDate.add(Calendar.DATE, -week);
 | 
	
		
			
				|  |  |                 sql += " and apply_date >= '" + (df.format(startDate.getTime()) + " 00:00:00")
 | 
	
		
			
				|  |  |                         + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59");
 | 
	
		
			
				|  |  |                         + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59'");
 | 
	
		
			
				|  |  |             } else if (labelCode.equals("2")) {
 | 
	
		
			
				|  |  |                 startDate.set(Calendar.DATE, 1);
 | 
	
		
			
				|  |  |                 sql += " and apply_date >= '" + (df.format(startDate.getTime()) + " 00:00:00")
 | 
	
		
			
				|  |  |                         + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59");
 | 
	
		
			
				|  |  |                         + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59'");
 | 
	
		
			
				|  |  |             } else if (labelCode.equals("3")) {
 | 
	
		
			
				|  |  |                 startDate.add(Calendar.DATE, 29);
 | 
	
		
			
				|  |  |                 sql += " and apply_date >= '" + (df.format(today.getTime()) + " 00:00:00")
 | 
	
		
			
				|  |  |                         + "' and apply_date <= '" + (df.format(startDate.getTime()) + " 23:59:59");
 | 
	
		
			
				|  |  |                         + "' and apply_date <= '" + (df.format(startDate.getTime()) + " 23:59:59'");
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 throw new Exception("label is not exist");
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -195,14 +195,16 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         SignPatientLabel labelNo = new SignPatientLabel();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         labelNo.setLabelCode("0");
 | 
	
		
			
				|  |  |         labelNo.setLabelName("未分组");
 | 
	
		
			
				|  |  |         labelNo.setStatus(1);
 | 
	
		
			
				|  |  |         labelNo.setIsSystem(1);
 | 
	
		
			
				|  |  |         labelNo.setLabelType(labelType);
 | 
	
		
			
				|  |  |         labelNo.setSort(999999999);
 | 
	
		
			
				|  |  |         if(!labelType.equals("5")) {
 | 
	
		
			
				|  |  |             labelNo.setLabelCode("0");
 | 
	
		
			
				|  |  |             labelNo.setLabelName("未分组");
 | 
	
		
			
				|  |  |             labelNo.setStatus(1);
 | 
	
		
			
				|  |  |             labelNo.setIsSystem(1);
 | 
	
		
			
				|  |  |             labelNo.setLabelType(labelType);
 | 
	
		
			
				|  |  |             labelNo.setSort(999999999);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         labels.add(labelNo);
 | 
	
		
			
				|  |  |             labels.add(labelNo);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (labels != null) {
 | 
	
		
			
				|  |  |             for (SignPatientLabel label : labels) {
 | 
	
	
		
			
				|  | @ -220,28 +222,28 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
	
		
			
				|  |  |                     Calendar today = Calendar.getInstance();
 | 
	
		
			
				|  |  |                     Calendar startDate = Calendar.getInstance();
 | 
	
		
			
				|  |  |                     SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
		
			
				|  |  |                     sql = "select count(DISTINCT patient) " +
 | 
	
		
			
				|  |  |                     sql = "select count(DISTINCT patient) count" +
 | 
	
		
			
				|  |  |                             " from " +
 | 
	
		
			
				|  |  |                             "     wlyy_sign_family " +
 | 
	
		
			
				|  |  |                             " where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
 | 
	
		
			
				|  |  |                             (teamCode > 0 ? " and admin_team_code = ? " : "");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     if (label.getLabelCode().equals("1")) {
 | 
	
		
			
				|  |  |                         int week = today.get(Calendar.DAY_OF_WEEK) - 1;
 | 
	
		
			
				|  |  |                         if (week == 0) {
 | 
	
		
			
				|  |  |                         int week = today.get(Calendar.DAY_OF_WEEK) - 2;
 | 
	
		
			
				|  |  |                         if (week == -1) {
 | 
	
		
			
				|  |  |                             week = 6;
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         startDate.add(Calendar.DATE, -week);
 | 
	
		
			
				|  |  |                         sql += " and apply_date >= '" + (df.format(startDate.getTime()) + " 00:00:00")
 | 
	
		
			
				|  |  |                                 + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59");
 | 
	
		
			
				|  |  |                                 + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59'");
 | 
	
		
			
				|  |  |                     } else if (label.getLabelCode().equals("2")) {
 | 
	
		
			
				|  |  |                         startDate.set(Calendar.DATE, 1);
 | 
	
		
			
				|  |  |                         sql += " and apply_date >= '" + (df.format(startDate.getTime()) + " 00:00:00")
 | 
	
		
			
				|  |  |                                 + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59");
 | 
	
		
			
				|  |  |                                 + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59'");
 | 
	
		
			
				|  |  |                     } else if (label.getLabelCode().equals("3")) {
 | 
	
		
			
				|  |  |                         startDate.add(Calendar.DATE, 29);
 | 
	
		
			
				|  |  |                         sql += " and apply_date >= '" + (df.format(today.getTime()) + " 00:00:00")
 | 
	
		
			
				|  |  |                                 + "' and apply_date <= '" + (df.format(startDate.getTime()) + " 23:59:59");
 | 
	
		
			
				|  |  |                                 + "' and apply_date <= '" + (df.format(startDate.getTime()) + " 23:59:59'");
 | 
	
		
			
				|  |  |                     } else {
 | 
	
		
			
				|  |  |                         throw new Exception("label is not exist");
 | 
	
		
			
				|  |  |                     }
 | 
	
	
		
			
				|  | @ -280,10 +282,10 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 Map<String, Object> count = jdbcTemplate.queryForMap(sql, args);
 | 
	
		
			
				|  |  |                 List<Map<String,Object>> count = jdbcTemplate.queryForList(sql, args);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 if (count != null && count.containsKey("count")) {
 | 
	
		
			
				|  |  |                     amount = Integer.valueOf(String.valueOf(count.get("count")));
 | 
	
		
			
				|  |  |                 if (count != null && count.size() > 0 && count.get(0).containsKey("count")) {
 | 
	
		
			
				|  |  |                     amount = Integer.valueOf(String.valueOf(count.get(0).get("count")));
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 json.put("amount", amount);
 |