package thyyxxk.webserver.dao.his.chronicDisease;

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

import java.util.List;

@Mapper
public interface ChronicDiseaseDao {

    @Select("select rtrim(code) as code, rtrim(name) as name from crm_zd_visit_type with(nolock)")
    List<CodeName> getCrmClass();

    @Select("select rtrim(code) as code, rtrim(name) as name from t_region with(nolock) where level = '1' ")
    List<CodeName> getProvince();

    @Select("<script> " +
            " select rtrim(code) as code, rtrim(name) as name from t_region with(nolock) where level = '2' " +
            "<if test=\"parentCode != null and parentCode != '' \">" +
            " and parent_code = #{parentCode}  " +
            "</if>" +
            "</script> ")
    List<CodeName> getCity(@Param("parentCode") String parentCode);

    @Select("<script> " +
            " select rtrim(code) as code, rtrim(name) as name from t_region with(nolock) where level = '3' " +
            "<if test=\"parentCode != null and parentCode != '' \">" +
            " and parent_code = #{parentCode}  " +
            "</if>" +
            "</script> ")
    List<CodeName> getArea(@Param("parentCode") String parentCode);

    @Select("select code,name from t_zd_psn_cert_type ")
    List<CodeName> getPsnCertType();

    @Select("select rtrim(code) as code, rtrim(name) as name from crm_zd_admiss_way ")
    List<CodeName> getAdmissWay();

}
