package thyyxxk.webserver.dao.his.zhuyuanyisheng;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import thyyxxk.webserver.entity.dictionary.CodeName;

import java.util.List;

@Mapper
public interface YiZhuPublicDao {

    @Select("select rtrim(code) code, rtrim(name) name, rtrim(py_code) pyCode " +
            "from zd_unit_code where code like '8%' order by code")
    List<CodeName> getAllWards();

    @Select("select name=(SELECT rtrim(name) FROM zd_unit_code WHERE code = b.dept), " +
            "       code = b.dept " +
            "from a_employee_mi a, " +
            "     zd_dept_all b " +
            "where code = #{code} " +
            "  and (a.dept_code = b.dept or a.dept_code = b.small_dept) " +
            "union " +
            "select name=(SELECT rtrim(name) FROM zd_unit_code WHERE code = b.dept), " +
            "       code =  b.dept " +
            "from zy_part_time_dept a, " +
            "     zd_dept_all b " +
            "where a.code = #{code} " +
            "  and (a.dept_code = b.dept or a.dept_code = b.small_dept)" +
            "  order by code")
    List<CodeName> getDoctorWards(String code);

}
