package thyyxxk.webserver.dao.his.highreport;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import thyyxxk.webserver.entity.highreport.DeptReportResult;
import thyyxxk.webserver.entity.highreport.ReportBaseInfo;

import java.util.List;
import java.util.Map;

@Mapper
public interface DeptBusinessDao {

    @Select(" select report_type as reportType, report_label as reportLabel, report_code as reportCode, ybb_flag as layoutFlag from zd_report_type where flag = #{flag} order by sort ")
    List<Map<String, Object>> selectReportTypeList(@Param("flag") String flag);

    @Select(" select * from report_base_info where flag = 'Y' and report_id like '%${str}' and report_type in (select report_type from zd_report_type where flag = #{flag}) order by sort ")
    List<ReportBaseInfo> selectReportList(@Param("flag") String flag, @Param("str") String str);

    @Select("<script> ${sql} </script>")
    List<DeptReportResult> selectDeptBusinessReportData(@Param("sql")String sql);

    @Select(" select * from report_base_info where flag = 'Y' and report_type in (select report_type from zd_report_type where flag = #{flag} and report_type in (${codes})) order by sort ")
    List<ReportBaseInfo> selectReportListByCodes(@Param("flag") String flag, @Param("codes") String codes);

    @Select(" select report_type as reportType, report_label as reportLabel, report_code as reportCode, ybb_flag as layoutFlag from zd_report_type where flag = #{flag} and report_type in (${codes}) order by sort ")
    List<Map<String, Object>> selectReportTypeListByCodes(@Param("flag") String flag, @Param("codes") String codes);

}
