refactor(emergency): searchExpert改为两表合集查询,同时搜索QH_EME_PROFESS_USER和qh_con_doctor

原来只查QH_EME_PROFESS_USER再补充qh_con_doctor字段,导致只在qh_con_doctor
中的专家搜不到。改为:
1. 分别查询两表(各自过滤name/排除已入群)
2. LinkedHashMap按userId去重合并
3. sys_user兜底填充realname/avatar/phone/deptName
4. 对profUsers单独补qh_con_doctor专家字段
5. 内存分页返回

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-08-04 11:42:47 +08:00
co-authored by Claude
parent 3b7f260103
commit 468314df64
@@ -35,4 +35,31 @@ public interface ConDoctorMapper {
"<foreach collection='doctorIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>" +
"</script>")
List<EmergencyProfessionUser> selectDoctorByIds(@Param("doctorIds") List<String> doctorIds);
/**
* 搜索专家(从 qh_con_doctor 表),排除已在应急专业人员表或已在群中的用户
*
* @param name 医生姓名,模糊匹配
* @param excludeIds 需要排除的用户ID集合(已从 QH_EME_PROFESS_USER 查到 + 已在群中的)
* @return 以 EmergencyProfessionUser 承载结果,基础字段由 SQL 别名映射
*/
@Select("<script>" +
"SELECT id AS userId, doctor_name AS realname, photo AS avatar, " +
"doctor_name AS doctorName, doctor_no AS doctorNo, " +
"resource_name AS resourceName, department_id AS departmentId, department_name AS departmentName, " +
"doctor_title AS doctorTitle, doctor_job AS doctorJob, doctor_status AS doctorStatus, " +
"is_accept AS isAccept, type AS doctorType, audio_status AS audioStatus, tf_jump_holiday AS tfJumpHoliday, " +
"experience, good_at AS goodAt, school, e_q AS edu, sort, " +
"tf_recommend AS tfRecommend, introduction " +
"FROM qh_con_doctor " +
"WHERE del_flag = '0' AND status = '1' " +
"<if test='name != null and name != \"\"'>" +
"AND doctor_name LIKE CONCAT('%', CONCAT(#{name}, '%')) " +
"</if>" +
"<if test='excludeIds != null and excludeIds.size() > 0'>" +
"AND id NOT IN " +
"<foreach collection='excludeIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>" +
"</if>" +
"</script>")
List<EmergencyProfessionUser> searchDoctorByName(@Param("name") String name, @Param("excludeIds") List<String> excludeIds);
}