|  | @ -211,7 +211,8 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
 | 
												
													
														
															|  |         return tmpList;
 |  |         return tmpList;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public JSONObject getOrgDoctorByName(String doctor,String orgType,String name){
 |  | 
 | 
												
													
														
															|  | 
 |  |     public PageEnvelop getOrgDoctorByName(String doctor,String orgType,String name,Integer page ,Integer size){
 | 
												
													
														
															|  | 
 |  |         page = page>0?page-1:0;
 | 
												
													
														
															|  |         JSONObject result = new JSONObject();
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  |         if (StringUtils.isNotBlank(doctor)){
 |  |         if (StringUtils.isNotBlank(doctor)){
 | 
												
													
														
															|  |             BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
 |  |             BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
 | 
												
											
												
													
														
															|  | @ -254,18 +255,27 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
 | 
												
													
														
															|  |                     " from base_doctor_hospital dh INNER JOIN base_org org on org.`code` = dh.org_code and org.del=1 INNER JOIN base_doctor doc on dh.doctor_code = doc.id  " +
 |  |                     " from base_doctor_hospital dh INNER JOIN base_org org on org.`code` = dh.org_code and org.del=1 INNER JOIN base_doctor doc on dh.doctor_code = doc.id  " +
 | 
												
													
														
															|  |                     " and dh.del=1 LEFT JOIN " +
 |  |                     " and dh.del=1 LEFT JOIN " +
 | 
												
													
														
															|  |                     " dict_hospital_dept dict on dh.dept_code = dict.`code` and dh.org_code = dict.org_code where org.type in ("+orgType+") ";
 |  |                     " dict_hospital_dept dict on dh.dept_code = dict.`code` and dh.org_code = dict.org_code where org.type in ("+orgType+") ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |            String countSql = "select count(doc.id)\n" +
 | 
												
													
														
															|  | 
 |  |                     " from base_doctor_hospital dh INNER JOIN base_org org on org.`code` = dh.org_code and org.del=1 INNER JOIN base_doctor doc on dh.doctor_code = doc.id  " +
 | 
												
													
														
															|  | 
 |  |                     " and dh.del=1 LEFT JOIN " +
 | 
												
													
														
															|  | 
 |  |                     " dict_hospital_dept dict on dh.dept_code = dict.`code` and dh.org_code = dict.org_code where org.type in ("+orgType+") ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             String sqlCondition = "";
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(name)){
 |  |             if (StringUtils.isNotBlank(name)){
 | 
												
													
														
															|  |                 sql += " and doc.name like '%"+name+"%' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 sqlCondition += " and doc.name like '%"+name+"%' ";
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             if (isSearchDoctorOrgType&&doctorOrg.size()>0){//查询通讯录机构与医生身份相同,只查询医生机构下的医生
 |  |             if (isSearchDoctorOrgType&&doctorOrg.size()>0){//查询通讯录机构与医生身份相同,只查询医生机构下的医生
 | 
												
													
														
															|  |                 sql += " and dh.org_code= '"+doctorOrg.get(0)+"' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 sqlCondition += " and dh.org_code= '"+doctorOrg.get(0)+"' ";
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  |             Long count = jdbcTemplate.queryForObject(countSql+sqlCondition,Long.class);
 | 
												
													
														
															|  | 
 |  |             sqlCondition +=" limit "+page*size+","+size;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             List<Map<String,Object>> tmpList = jdbcTemplate.queryForList(sql);
 |  | 
 | 
												
													
														
															|  | 
 |  |             List<Map<String,Object>> tmpList = jdbcTemplate.queryForList(sql+sqlCondition);
 | 
												
													
														
															|  |             result.put("doctorList",tmpList);
 |  |             result.put("doctorList",tmpList);
 | 
												
													
														
															|  |             return result;
 |  | 
 | 
												
													
														
															|  | 
 |  |             return PageEnvelop.getSuccessListWithPage("查询成功",tmpList,page,size,0L);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         return result;
 |  | 
 | 
												
													
														
															|  | 
 |  |        return PageEnvelop.getSuccessListWithPage("查询成功",new ArrayList(),page,size,0L);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public JSONObject getOrgDoctor(String orgCode,String deptCode,int page,int size){
 |  |     public JSONObject getOrgDoctor(String orgCode,String deptCode,int page,int size){
 | 
												
											
												
													
														
															|  | @ -322,7 +332,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
 | 
												
													
														
															|  |                 "and rsr.del<>0  and rsr.`status` = 2   ";
 |  |                 "and rsr.del<>0  and rsr.`status` = 2   ";
 | 
												
													
														
															|  |         String sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp " +
 |  |         String sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp " +
 | 
												
													
														
															|  |                 " Inner JOIN base_patient p on tmp.patient  = p.id " +
 |  |                 " Inner JOIN base_patient p on tmp.patient  = p.id " +
 | 
												
													
														
															|  |                 " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 GROUP BY p.id ";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 GROUP BY p.id limit "+page*size+","+size;
 | 
												
													
														
															|  |         String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
 |  |         String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
 | 
												
													
														
															|  |                 " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";
 |  |                 " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -331,7 +341,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
 | 
												
													
														
															|  |              sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp " +
 |  |              sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp " +
 | 
												
													
														
															|  |                      " Inner JOIN base_patient p on tmp.patient  = p.id and p.name like '%"+name+"%' " +
 |  |                      " Inner JOIN base_patient p on tmp.patient  = p.id and p.name like '%"+name+"%' " +
 | 
												
													
														
															|  |                      " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 " +
 |  |                      " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 " +
 | 
												
													
														
															|  |                      " GROUP BY p.id ";
 |  | 
 | 
												
													
														
															|  | 
 |  |                      " GROUP BY p.id limit "+page*size+","+size;
 | 
												
													
														
															|  |              sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
 |  |              sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
 | 
												
													
														
															|  |                     " and p.name like '%"+name+"%' LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";
 |  |                     " and p.name like '%"+name+"%' LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";
 | 
												
													
														
															|  |             list = jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql0));
 |  |             list = jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql0));
 |