package thyyxxk.webserver.dao.his.casefrontsheet;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import thyyxxk.webserver.entity.casefrontsheet.CaseFrontsheetDisdiag;
import thyyxxk.webserver.entity.casefrontsheet.CaseFrontsheetMain;
import thyyxxk.webserver.entity.casefrontsheet.CaseFrontsheetSurgery;

import java.util.List;

@Mapper
public interface FrontSheetExportDao {

    @Select("select * from t_case_frontsheet_main where dismiss_date>=#{begin} and dismiss_date<=#{end}")
    List<CaseFrontsheetMain> fetchSheets(@Param("begin") String begin, @Param("end") String end);

    @Select("select no,code,name,admiss_status,dismiss_status from t_case_frontsheet_disdiag where bah=#{bah} and times=#{times}")
    List<CaseFrontsheetDisdiag> fetchDiags(@Param("bah") String bah, @Param("times") int times);

    @Select("select no,code,name,date,level,operator,operator_name,assistant_one,assistant_one_name, " +
            "assistant_two,assistant_two_name,cut=isnull(cut,0),heal=isnull(heal,0),anaesthesiaor,anaesthesiaor_name, " +
            "anaesthesia=(select wjw_code from zd_anaesthesia where code=anaesthesia) " +
            "from t_case_frontsheet_surgery where bah=#{bah} and times=#{times}")
    List<CaseFrontsheetSurgery> fetchSurgeries(@Param("bah") String bah, @Param("times") int times);
}
