|  | @ -495,8 +495,8 @@ public class JMJkEduArticleService extends BaseService {
 | 
												
													
														
															|  |     public void initPatient(Set<String> patientSet, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode,String currentUserRole, String currentUserRoleLevel) {
 |  |     public void initPatient(Set<String> patientSet, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode,String currentUserRole, String currentUserRoleLevel) {
 | 
												
													
														
															|  |         //全选的时候前端传0,后台要去数据库再查询一次
 |  |         //全选的时候前端传0,后台要去数据库再查询一次
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String tableSql = " select p.code from wlyy_sign_family w left join dm_hospital h on w.hospital=h.code ";
 |  | 
 | 
												
													
														
															|  |         String whereSql = " where w.status>0  ";
 |  | 
 | 
												
													
														
															|  | 
 |  |         String tableSql = " select p.code from wlyy_sign_family w ,wlyy_admin_team t, dm_hospital h  ";
 | 
												
													
														
															|  | 
 |  |         String whereSql = " where w.status>0  and w.admin_team_code=t.id and t.org_code=h.code ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //通过登录的角色区域权限 限制所属患者条件
 |  |         //通过登录的角色区域权限 限制所属患者条件
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -517,35 +517,66 @@ public class JMJkEduArticleService extends BaseService {
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if (!StringUtils.isEmpty(labelServe)) {
 |  |         if (!StringUtils.isEmpty(labelServe)) {
 | 
												
													
														
															|  |             tableSql += " left join wlyy_sign_family_server s on w.code= s.sign_code ";
 |  | 
 | 
												
													
														
															|  |             whereSql += " and s.server_type in (" + labelServe + " ) ";
 |  | 
 | 
												
													
														
															|  |         }
 |  | 
 | 
												
													
														
															|  |         if (!StringUtils.isEmpty(labelHealth) || !StringUtils.isEmpty(labelDisease)) {
 |  | 
 | 
												
													
														
															|  |             tableSql += " left join wlyy_sign_patient_label_info l on w.patient=l.patient ";
 |  | 
 | 
												
													
														
															|  |             whereSql += " and l.status=1 ";
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             if (!StringUtils.isEmpty(labelHealth) && !StringUtils.isEmpty(labelDisease)) {
 |  | 
 | 
												
													
														
															|  |                 whereSql += " and ( (l.label_type = 2 AND l.label in (" + labelHealth + ") ) or (l.label_type = 3 AND l.label in (" + labelDisease + ") ))";
 |  | 
 | 
												
													
														
															|  |             }else {
 |  | 
 | 
												
													
														
															|  |                 if(!StringUtils.isEmpty(labelHealth)){
 |  | 
 | 
												
													
														
															|  |                     whereSql += " and (l.label_type = 2 AND l.label in (" + labelHealth + "))";
 |  | 
 | 
												
													
														
															|  |                 }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 if(!StringUtils.isEmpty(labelDisease)){
 |  | 
 | 
												
													
														
															|  |                     whereSql += " and (l.label_type = 3 AND l.label in (" + labelDisease + "))";
 |  | 
 | 
												
													
														
															|  |                 }
 |  | 
 | 
												
													
														
															|  |             }
 |  | 
 | 
												
													
														
															|  | 
 |  |             tableSql += " , wlyy_sign_family_server s   ";
 | 
												
													
														
															|  | 
 |  |             whereSql += " and s.server_type in (" + labelServe + " ) and w.code= s.sign_code";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | //        if (!StringUtils.isEmpty(labelHealth) || !StringUtils.isEmpty(labelDisease)) {
 | 
												
													
														
															|  | 
 |  | //            tableSql += " , wlyy_sign_patient_label_info l  ";
 | 
												
													
														
															|  | 
 |  | //            whereSql += " and l.status=1 and w.patient=l.patient ";
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //            if (!StringUtils.isEmpty(labelHealth) && !StringUtils.isEmpty(labelDisease)) {
 | 
												
													
														
															|  | 
 |  | //                whereSql += " and ( (l.label_type = 2 AND l.label in (" + labelHealth + ") ) or (l.label_type = 3 AND l.label in (" + labelDisease + ") ))";
 | 
												
													
														
															|  | 
 |  | //            }else {
 | 
												
													
														
															|  | 
 |  | //                if(!StringUtils.isEmpty(labelHealth)){
 | 
												
													
														
															|  | 
 |  | //                    whereSql += " and (l.label_type = 2 AND l.label in (" + labelHealth + "))";
 | 
												
													
														
															|  | 
 |  | //                }
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //                if(!StringUtils.isEmpty(labelDisease)){
 | 
												
													
														
															|  | 
 |  | //                    whereSql += " and (l.label_type = 3 AND l.label in (" + labelDisease + "))";
 | 
												
													
														
															|  | 
 |  | //                }
 | 
												
													
														
															|  | 
 |  | //            }
 | 
												
													
														
															|  | 
 |  | //        }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         tableSql += " left join wlyy_patient p on p.code=w.patient AND p.openid IS NOT NULL and p.openid <>''";
 |  | 
 | 
												
													
														
															|  | 
 |  |         tableSql += " , wlyy_patient p  ";
 | 
												
													
														
															|  | 
 |  |         whereSql += " and p.code=w.patient AND p.openid IS NOT NULL and p.openid <>'' ";
 | 
												
													
														
															|  |         if (!StringUtils.isEmpty(labelSex)) {
 |  |         if (!StringUtils.isEmpty(labelSex)) {
 | 
												
													
														
															|  |             whereSql += " and p.sex in (" + labelSex + ") ";
 |  |             whereSql += " and p.sex in (" + labelSex + ") ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | //        if (!StringUtils.isEmpty(labelUnit)) {
 |  | //        if (!StringUtils.isEmpty(labelUnit)) {
 | 
												
													
														
															|  | //            whereSql += " and w.hospital in (" + labelUnit + ") ";
 |  | //            whereSql += " and w.hospital in (" + labelUnit + ") ";
 | 
												
													
														
															|  | //        }
 |  | //        }
 | 
												
													
														
															|  |         List<String> groupPatient = jdbcTemplate.queryForList(tableSql + whereSql, String.class);
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<String> groupPatient = null;
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(labelHealth) || !StringUtils.isEmpty(labelDisease)) {
 | 
												
													
														
															|  | 
 |  |             String sql = "SELECT s.patient as code FROM ( SELECT t.patient," +
 | 
												
													
														
															|  | 
 |  |                     " GROUP_CONCAT(',',t.label_type,t.label,',') label FROM " +
 | 
												
													
														
															|  | 
 |  |                     " wlyy_sign_patient_label_info t WHERE t.patient IN ("+
 | 
												
													
														
															|  | 
 |  |                     tableSql + whereSql+") AND t. STATUS = 1 GROUP BY t.patient ) s where 1=1 ";
 | 
												
													
														
															|  | 
 |  | //            if (!StringUtils.isEmpty(labelHealth) && !StringUtils.isEmpty(labelDisease)) {
 | 
												
													
														
															|  | 
 |  | //                sql += " and ( (l.label_type = 2 AND l.label in (" + labelHealth + ") ) or (l.label_type = 3 AND l.label in (" + labelDisease + ") ))";
 | 
												
													
														
															|  | 
 |  | //                sql+= " where "
 | 
												
													
														
															|  | 
 |  | //            }
 | 
												
													
														
															|  | 
 |  |             if(!StringUtils.isEmpty(labelHealth)){
 | 
												
													
														
															|  | 
 |  |                 String[] aa=labelHealth.split(",");
 | 
												
													
														
															|  | 
 |  |                 String bb = "";
 | 
												
													
														
															|  | 
 |  |                 for (String a:aa) {
 | 
												
													
														
															|  | 
 |  |                     bb+=" OR s.label LIKE '%,2"+a+",%'";
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 sql+=" AND ( "+bb.substring(3)+" )";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if(!StringUtils.isEmpty(labelDisease)){
 | 
												
													
														
															|  | 
 |  |                 String[] aa=labelDisease.split(",");
 | 
												
													
														
															|  | 
 |  |                 String bb = "";
 | 
												
													
														
															|  | 
 |  |                 for (String a:aa) {
 | 
												
													
														
															|  | 
 |  |                     bb+=" OR s.label LIKE '%,3"+a+",%'";
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 sql+=" AND ( "+bb.substring(3)+" )";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             groupPatient = jdbcTemplate.queryForList(sql, String.class);
 | 
												
													
														
															|  | 
 |  |         }else{
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             groupPatient = jdbcTemplate.queryForList(tableSql + whereSql, String.class);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         patientSet.addAll(groupPatient);
 |  |         patientSet.addAll(groupPatient);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 |