|
@ -211,7 +211,8 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
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();
|
|
|
if (StringUtils.isNotBlank(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 " +
|
|
|
" 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 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)){
|
|
|
sql += " and doc.name like '%"+name+"%' ";
|
|
|
sqlCondition += " and doc.name like '%"+name+"%' ";
|
|
|
}
|
|
|
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);
|
|
|
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){
|
|
@ -322,7 +332,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
"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 " +
|
|
|
" 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 " +
|
|
|
" 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 " +
|
|
|
" 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 " +
|
|
|
" 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 " +
|
|
|
" 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));
|