|  | @ -31,7 +31,7 @@ public class WechatService extends BaseService {
 | 
												
													
														
															|  | 	 * @param attention
 |  | 	 * @param attention
 | 
												
													
														
															|  | 	 * @return
 |  | 	 * @return
 | 
												
													
														
															|  | 	 */
 |  | 	 */
 | 
												
													
														
															|  | 	public List<WechatSignVO> geSignWechatDataList(String hospital,String attention) {
 |  | 
 | 
												
													
														
															|  | 
 |  | 	public List<WechatSignVO> geSignWechatDataList(String hospital,String attention, String signSource) {
 | 
												
													
														
															|  | 		Calendar a = Calendar.getInstance();
 |  | 		Calendar a = Calendar.getInstance();
 | 
												
													
														
															|  | 		int year = a.get(Calendar.YEAR)-1;
 |  | 		int year = a.get(Calendar.YEAR)-1;
 | 
												
													
														
															|  | 		int month = a.get(Calendar.MONTH)+1;
 |  | 		int month = a.get(Calendar.MONTH)+1;
 | 
												
											
												
													
														
															|  | @ -47,6 +47,7 @@ public class WechatService extends BaseService {
 | 
												
													
														
															|  | 					"t.NAME as patientname," +
 |  | 					"t.NAME as patientname," +
 | 
												
													
														
															|  | 					"a.mobile," +
 |  | 					"a.mobile," +
 | 
												
													
														
															|  | 					"t.openid_time," +
 |  | 					"t.openid_time," +
 | 
												
													
														
															|  | 
 |  | 					"t.medicare_number,"+
 | 
												
													
														
															|  | 					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
 |  | 					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
 | 
												
													
														
															|  | 					"a.doctor_name," +
 |  | 					"a.doctor_name," +
 | 
												
													
														
															|  | 					"a.doctor_health_name," +
 |  | 					"a.doctor_health_name," +
 | 
												
											
												
													
														
															|  | @ -54,15 +55,16 @@ public class WechatService extends BaseService {
 | 
												
													
														
															|  | 					"t.address," +
 |  | 					"t.address," +
 | 
												
													
														
															|  | 					"a.hospital_name,"+
 |  | 					"a.hospital_name,"+
 | 
												
													
														
															|  | 					"t.street_name FROM (" +
 |  | 					"t.street_name FROM (" +
 | 
												
													
														
															|  | 					"SELECT b.patient,b.mobile,b.idcard,b.doctor_name,b.doctor_health_name,b.hospital_name FROM wlyy_sign_family b WHERE b.hospital='"+hospital+"' AND b.sign_year=2017 AND b.STATUS=1 AND b.expenses_status=1) a,wlyy_patient t WHERE t.CODE=a.patient) m," +
 |  | 
 | 
												
													
														
															|  | 
 |  | 					"SELECT b.patient,b.mobile,b.idcard,b.doctor_name,b.doctor_health_name,b.hospital_name FROM wlyy_sign_family b WHERE b.hospital='"+hospital+"' AND b.sign_year='"+year+"' AND b.STATUS=1 AND b.expenses_status=1) a,wlyy_patient t WHERE t.CODE=a.patient) m," +
 | 
												
													
														
															|  | 					"(SELECT t.openid,count(t.openid) tcount FROM wlyy_patient t WHERE t.`code` IN (" +
 |  | 					"(SELECT t.openid,count(t.openid) tcount FROM wlyy_patient t WHERE t.`code` IN (" +
 | 
												
													
														
															|  | 					"SELECT patient FROM wlyy_sign_family s WHERE s.hospital='"+hospital+"' AND s.sign_year='"+year+"' AND s.expenses_status=1 AND s.STATUS=1) GROUP BY t.openid) n WHERE m.openid=n.openid";
 |  | 
 | 
												
													
														
															|  | 
 |  | 					"SELECT patient FROM wlyy_sign_family s WHERE s.hospital='"+hospital+"' AND s.sign_year='"+year+"' AND s.expenses_status=1 AND s.STATUS=1 AND s.sign_source = '"+signSource+"') GROUP BY t.openid) n WHERE m.openid=n.openid";
 | 
												
													
														
															|  | 		}else if("0".equals(attention)){
 |  | 		}else if("0".equals(attention)){
 | 
												
													
														
															|  | 			sql = "SELECT m.*FROM (" +
 |  | 
 | 
												
													
														
															|  | 
 |  | 			sql = "SELECT m.* FROM (" +
 | 
												
													
														
															|  | 					"SELECT a.mobile," +
 |  | 					"SELECT a.mobile," +
 | 
												
													
														
															|  | 					"a.code as patientcode ," +
 |  | 					"a.code as patientcode ," +
 | 
												
													
														
															|  | 					"a.NAME as patientname ," +
 |  | 					"a.NAME as patientname ," +
 | 
												
													
														
															|  | 					"a.openid_time," +
 |  | 					"a.openid_time," +
 | 
												
													
														
															|  | 
 |  | 					"a.medicare_number," +
 | 
												
													
														
															|  | 					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
 |  | 					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
 | 
												
													
														
															|  | 					"b.doctor_name," +
 |  | 					"b.doctor_name," +
 | 
												
													
														
															|  | 					"b.doctor_health_name," +
 |  | 					"b.doctor_health_name," +
 | 
												
											
												
													
														
															|  | @ -70,8 +72,8 @@ public class WechatService extends BaseService {
 | 
												
													
														
															|  | 					"a.address," +
 |  | 					"a.address," +
 | 
												
													
														
															|  | 					"a.sick_village_name," +
 |  | 					"a.sick_village_name," +
 | 
												
													
														
															|  | 					"a.street_name FROM (" +
 |  | 					"a.street_name FROM (" +
 | 
												
													
														
															|  | 					"SELECT t.CODE,t.NAME,t.address,t.sick_village_name,t.street_name,idcard,mobile,openid_time FROM wlyy_patient t WHERE t.`code` IN (" +
 |  | 
 | 
												
													
														
															|  | 					"SELECT patient FROM wlyy_sign_family s WHERE s.hospital='"+hospital+"' AND s.sign_year='"+year+"' AND s.expenses_status=1 AND s.STATUS=1 AND s.expenses_time IS NOT NULL) AND t.openid IS NULL) a,wlyy_sign_family b WHERE b.hospital='"+hospital+"' AND b.sign_year=2017 AND b.STATUS=1 AND b.expenses_status=1 AND a.CODE=b.patient AND b.expenses_time IS NOT NULL) m";
 |  | 
 | 
												
													
														
															|  | 
 |  | 					"SELECT t.CODE,t.NAME,t.address,t.sick_village_name,t.street_name,t.medicare_number,idcard,mobile,openid_time FROM wlyy_patient t WHERE t.`code` IN (" +
 | 
												
													
														
															|  | 
 |  | 					"SELECT patient FROM wlyy_sign_family s WHERE s.hospital='"+hospital+"' AND s.sign_year='"+year+"' AND s.expenses_status=1 AND s.STATUS=1 AND s.expenses_time IS NOT NULL) AND t.openid IS NULL) a,wlyy_sign_family b WHERE b.hospital='"+hospital+"' AND b.sign_year='"+year+"' AND b.STATUS=1 AND b.expenses_status=1 AND a.CODE=b.patient AND b.expenses_time IS NOT NULL AND b.sign_source ='"+signSource+"') m";
 | 
												
													
														
															|  | 		}
 |  | 		}
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 		
 |  | 		
 | 
												
											
												
													
														
															|  | @ -86,6 +88,12 @@ public class WechatService extends BaseService {
 | 
												
													
														
															|  | 	 */
 |  | 	 */
 | 
												
													
														
															|  | 	public List<WechatTotalVO> hosipitaTotalData() {
 |  | 	public List<WechatTotalVO> hosipitaTotalData() {
 | 
												
													
														
															|  | 		List<WechatTotalVO> list = new ArrayList<>();
 |  | 		List<WechatTotalVO> list = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  | 		Calendar a = Calendar.getInstance();
 | 
												
													
														
															|  | 
 |  | 		int year = a.get(Calendar.YEAR)-1;
 | 
												
													
														
															|  | 
 |  | 		int month = a.get(Calendar.MONTH)+1;
 | 
												
													
														
															|  | 
 |  | 		if(month >= 7){
 | 
												
													
														
															|  | 
 |  | 			year = a.get(Calendar.YEAR);
 | 
												
													
														
															|  | 
 |  | 		}
 | 
												
													
														
															|  | 		String sql  = "SELECT " +
 |  | 		String sql  = "SELECT " +
 | 
												
													
														
															|  | 				"a1.hospital_name as name," +
 |  | 				"a1.hospital_name as name," +
 | 
												
													
														
															|  | 				"(a1.count/a2.count) as attRate," +
 |  | 				"(a1.count/a2.count) as attRate," +
 | 
												
											
												
													
														
															|  | @ -95,10 +103,10 @@ public class WechatService extends BaseService {
 | 
												
													
														
															|  | 				"FROM wlyy_patient p,wlyy_sign_family sf WHERE p.idcard=sf.idcard AND sf.type=2 " +
 |  | 				"FROM wlyy_patient p,wlyy_sign_family sf WHERE p.idcard=sf.idcard AND sf.type=2 " +
 | 
												
													
														
															|  | 				"AND sf.STATUS> 0 AND LENGTH(sf.hospital)=10 " +
 |  | 				"AND sf.STATUS> 0 AND LENGTH(sf.hospital)=10 " +
 | 
												
													
														
															|  | 				"AND sf.admin_team_code IS NOT NULL AND p.openid IS NOT NULL " +
 |  | 				"AND sf.admin_team_code IS NOT NULL AND p.openid IS NOT NULL " +
 | 
												
													
														
															|  | 				"AND p.openid_time<= '"+ DateUtil.dateToStrShort(new Date())+"' AND sf.sign_year='2017' GROUP BY sf.hospital ORDER BY count desc) a1," +
 |  | 
 | 
												
													
														
															|  | 
 |  | 				"AND p.openid_time<= '"+ DateUtil.dateToStrShort(new Date())+"' AND sf.sign_year='"+year+"' GROUP BY sf.hospital ORDER BY count desc) a1," +
 | 
												
													
														
															|  | 				"(SELECT a.hospital hospital,count(a.id) count,a.hospital_name hospital_name " +
 |  | 				"(SELECT a.hospital hospital,count(a.id) count,a.hospital_name hospital_name " +
 | 
												
													
														
															|  | 				"FROM wlyy_sign_family a WHERE STATUS IN (1,2) AND a.type=2 AND expenses_status=1 " +
 |  | 				"FROM wlyy_sign_family a WHERE STATUS IN (1,2) AND a.type=2 AND expenses_status=1 " +
 | 
												
													
														
															|  | 				"AND a.expenses_time<= '"+ DateUtil.dateToStrShort(new Date())+"' AND a.sign_year='2017' GROUP BY a.hospital ORDER BY count desc) a2 WHERE a1.hospital=a2.hospital";
 |  | 
 | 
												
													
														
															|  | 
 |  | 				"AND a.expenses_time<= '"+ DateUtil.dateToStrShort(new Date())+"' AND a.sign_year='"+year+"' GROUP BY a.hospital ORDER BY count desc) a2 WHERE a1.hospital=a2.hospital";
 | 
												
													
														
															|  | 	
 |  | 	
 | 
												
													
														
															|  | 		list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WechatTotalVO.class));
 |  | 		list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WechatTotalVO.class));
 | 
												
													
														
															|  | 		return list ;
 |  | 		return list ;
 | 
												
											
												
													
														
															|  | @ -111,6 +119,12 @@ public class WechatService extends BaseService {
 | 
												
													
														
															|  | 	 */
 |  | 	 */
 | 
												
													
														
															|  | 	public List<WechatTotalVO> townTotalData() {
 |  | 	public List<WechatTotalVO> townTotalData() {
 | 
												
													
														
															|  | 		List<WechatTotalVO> list = new ArrayList<>();
 |  | 		List<WechatTotalVO> list = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  | 		Calendar a = Calendar.getInstance();
 | 
												
													
														
															|  | 
 |  | 		int year = a.get(Calendar.YEAR)-1;
 | 
												
													
														
															|  | 
 |  | 		int month = a.get(Calendar.MONTH)+1;
 | 
												
													
														
															|  | 
 |  | 		if(month >= 7){
 | 
												
													
														
															|  | 
 |  | 			year = a.get(Calendar.YEAR);
 | 
												
													
														
															|  | 
 |  | 		}
 | 
												
													
														
															|  | 		String sql  = "SELECT " +
 |  | 		String sql  = "SELECT " +
 | 
												
													
														
															|  | 				"a1.town_name as name," +
 |  | 				"a1.town_name as name," +
 | 
												
													
														
															|  | 				"(a1.count/a2.count) as attRate," +
 |  | 				"(a1.count/a2.count) as attRate," +
 | 
												
											
												
													
														
															|  | @ -121,10 +135,10 @@ public class WechatService extends BaseService {
 | 
												
													
														
															|  | 				"FROM wlyy_patient p,wlyy_sign_family sf,dm_hospital h WHERE p.idcard=sf.idcard " +
 |  | 				"FROM wlyy_patient p,wlyy_sign_family sf,dm_hospital h WHERE p.idcard=sf.idcard " +
 | 
												
													
														
															|  | 				"AND sf.type=2 AND sf.STATUS> 0 AND LENGTH(sf.hospital)=10 AND sf.hospital=h.CODE " +
 |  | 				"AND sf.type=2 AND sf.STATUS> 0 AND LENGTH(sf.hospital)=10 AND sf.hospital=h.CODE " +
 | 
												
													
														
															|  | 				"AND sf.admin_team_code IS NOT NULL AND p.openid IS NOT NULL " +
 |  | 				"AND sf.admin_team_code IS NOT NULL AND p.openid IS NOT NULL " +
 | 
												
													
														
															|  | 				"AND p.openid_time< '"+ DateUtil.dateToStrShort(new Date())+"' AND sf.sign_year='2017' GROUP BY h.town ORDER BY count desc) a1,(" +
 |  | 
 | 
												
													
														
															|  | 
 |  | 				"AND p.openid_time< '"+ DateUtil.dateToStrShort(new Date())+"' AND sf.sign_year='"+year+"' GROUP BY h.town ORDER BY count desc) a1,(" +
 | 
												
													
														
															|  | 				"SELECT count(a.id) count,h.town_name town_name,h.town town FROM wlyy_sign_family a,dm_hospital h" +
 |  | 				"SELECT count(a.id) count,h.town_name town_name,h.town town FROM wlyy_sign_family a,dm_hospital h" +
 | 
												
													
														
															|  | 				" WHERE STATUS IN (1,2) AND a.type=2 AND expenses_status=1 AND a.hospital=h.CODE " +
 |  | 				" WHERE STATUS IN (1,2) AND a.type=2 AND expenses_status=1 AND a.hospital=h.CODE " +
 | 
												
													
														
															|  | 				"AND a.expenses_time< '"+ DateUtil.dateToStrShort(new Date())+"' AND a.sign_year='2017' GROUP BY h.town) a2 WHERE a1.town=a2.town";
 |  | 
 | 
												
													
														
															|  | 
 |  | 				"AND a.expenses_time< '"+ DateUtil.dateToStrShort(new Date())+"' AND a.sign_year='"+year+"' GROUP BY h.town) a2 WHERE a1.town=a2.town";
 | 
												
													
														
															|  | 		
 |  | 		
 | 
												
													
														
															|  | 		list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WechatTotalVO.class));
 |  | 		list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WechatTotalVO.class));
 | 
												
													
														
															|  | 		return list ;
 |  | 		return list ;
 |