package thyyxxk.webserver.dao.his.search;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import thyyxxk.webserver.entity.dictionary.CodeName;


@Mapper
public interface SearchDao {
    @Select("select rtrim(code) as code,rtrim(name) as name,rtrim(yb_code) as ybCode, " +
            "deptName=(select rtrim(d.name) from zd_unit_code d where d.code=dept_code) " +
            "from a_employee_mi where isnull(del_flag,0)!=1 and ${method} like #{content}")
    IPage<CodeName> searchPhysician(IPage<CodeName> iPage, @Param("method") String method, @Param("content") String content);

    @Select("select distinct rtrim(yb_code) as code, rtrim(yb_name) as name from zd_icd_code_new where ${method} like #{content} and del_flag=0")
    IPage<CodeName> searchSiDiagnose(IPage<CodeName> iPage, @Param("method") String method, @Param("content") String content);

    @Select("select rtrim(yb_code) as code, rtrim(yb_name) as name from zd_icd9_cm3 where ${method} like #{content} and del_flag=0")
    IPage<CodeName> searchSurgeries(IPage<CodeName> iPage, @Param("method") String method, @Param("content") String content);

    @Select("select distinct rtrim(code) as code, rtrim(name) as name from zd_icd_code_new where ${method} like #{content} and del_flag=0")
    IPage<CodeName> searchIcd10Diagnose(IPage<CodeName> iPage, @Param("method") String method, @Param("content") String content);

    @Select("select distinct new_code as code,new_name as name from ${tableName} where new_name like #{content}")
    IPage<CodeName> selectSlwSpcDiag(IPage<CodeName> iPage, @Param("content") String content, @Param("tableName") String tableName);

    @Select("select distinct code,name from t_zd_injury_icd where ${method} like #{content}")
    IPage<CodeName> searchInjurydiag(IPage<CodeName> iPage, @Param("method") String method, @Param("content") String content);

}
