| 
					
				 | 
			
			
				@ -259,9 +259,12 @@ public class SignPatientLabelInfoService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param pagesize  页大小 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param isSlowDisease 是否是慢病管理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param diseaseCondition 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param  isFollowWeChat 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getPatientByLabel(String doctor, String labelCode, String labelType, Long teamCode, int page, int pagesize, boolean isSlowDisease, String diseaseCondition) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getPatientByLabel(String doctor, String labelCode, String labelType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                       Long teamCode, int page, int pagesize, boolean isSlowDisease, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                       String diseaseCondition,boolean isFollowWeChat) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Doctor doc = doctorDao.findByCode(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (doc == null) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -307,6 +310,9 @@ public class SignPatientLabelInfoService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                throw new Exception("label is not exist"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(isFollowWeChat){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += "  AND p.openid IS NOT NULL AND p.openid <>'' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            args = new Object[]{doctor, doctor, teamCode}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if("1".equals(labelType)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -325,6 +331,11 @@ public class SignPatientLabelInfoService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(diseaseCondition)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql = sql + " AND p.disease_condition ="+diseaseCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(isFollowWeChat){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += "  AND p.openid IS NOT NULL AND p.openid <>'' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = sql +" order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            args = new Object[]{doctor, doctor, teamCode}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if("3".equals(labelType) && isSlowDisease){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -345,7 +356,13 @@ public class SignPatientLabelInfoService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "    AND t1.patient = t2.patient " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "    AND (t1.doctor = ? or t1.doctor_health = ?)" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "    AND t1.status > 0 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "    AND t1.admin_team_code = ? order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "    AND t1.admin_team_code = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(isFollowWeChat){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += "  AND p.openid IS NOT NULL AND p.openid <>'' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = sql + " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(diseaseCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                args = new Object[]{labelCode, diseaseCondition, labelType, doctor, doctor, teamCode}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -365,7 +382,11 @@ public class SignPatientLabelInfoService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "    t2.patient is null " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "    AND (t1.doctor = ? or t1.doctor_health = ?) " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "    AND t1.status > 0 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "    AND t1.admin_team_code = ? order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "    AND t1.admin_team_code = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(isFollowWeChat){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql += "  AND p.openid IS NOT NULL AND p.openid <>'' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql  +=  "order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                args = new Object[]{labelType, doctor, doctor, teamCode}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -382,7 +403,11 @@ public class SignPatientLabelInfoService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "    AND t1.patient = t2.patient " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "    AND (t1.doctor = ? or t1.doctor_health = ?)" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "    AND t1.status > 0 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "    AND t1.admin_team_code = ? order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,p.openid DESC ,convert(t1.name using gbk)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "    AND t1.admin_team_code = ? " ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(isFollowWeChat){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql += "  AND p.openid IS NOT NULL AND p.openid <>'' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql +=  " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,p.openid DESC ,convert(t1.name using gbk)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                args = new Object[]{labelCode, labelType, doctor, doctor, teamCode}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2003,6 +2028,7 @@ public class SignPatientLabelInfoService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param filter 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param isFollowWeChat 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2010,7 +2036,8 @@ public class SignPatientLabelInfoService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        String labelCode, String labelType, long teamCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        String exLabelCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        String exLabelType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        int page, int pagesize) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        int page, int pagesize, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        boolean isFollowWeChat) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Doctor doc = doctorDao.findByCode(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (doc == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("doctor info can not find"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2037,8 +2064,12 @@ public class SignPatientLabelInfoService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                (StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : "") + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                (StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                (teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "") + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  AND (t1.name like ? or p.address like ? or p.idcard like ? ) " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ORDER BY  p.name DESC,p.address DESC, p.idcard DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  AND (t1.name like ? or p.address like ? or p.idcard like ? ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(isFollowWeChat){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += "   AND p.openid IS NOT NULL AND p.openid <>'' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql +=  " ORDER BY  p.name DESC,p.address DESC, p.idcard DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotEmpty(labelCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            args = new Object[]{doctor, doctor, labelCode, labelType, "%" + filter + "%", "%" + filter + "%", "%" + filter + "%"}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) { 
			 |