package thyyxxk.webserver.dao.his.inpatient.casefrontsheet;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.ResultSetType;
import org.apache.ibatis.session.ResultHandler;
import thyyxxk.webserver.entity.casefrontsheet.CaseFrontsheetDisdiag;
import thyyxxk.webserver.entity.casefrontsheet.CaseFrontsheetMain;
import thyyxxk.webserver.entity.casefrontsheet.CaseFrontsheetSurgery;
import thyyxxk.webserver.entity.casefrontsheet.response.ExportDclResponse;
import thyyxxk.webserver.entity.casefrontsheet.response.HistorySheet;
import thyyxxk.webserver.entity.casefrontsheet.response.SheetForHqms;

import java.util.List;

@Mapper
public interface FrontSheetExportDao {

    @Select("select bah,admiss_times,pay_method,health_card_no,name,sex,birth_date,age,country,age_days,new_born_weight, " +
            "new_born_admiss_weight,birth_place,birth_place_name,native_place,native_place_name,nation,social_no, " +
            "occupation,marriage,live_place,phone,addr_zip_code,hk_place,hk_place_name,hk_zip_code,unit_name,unit_place, " +
            "unit_phone,unit_zip_code,contact_name,contact_relation,contact_addr,contact_addr_name,contact_phone, " +
            "zy_admiss_way,has_surgery,admiss_date,admiss_dept,admiss_ward,trans_dept,dismiss_date,dismiss_dept, " +
            "dismiss_ward,admiss_days,hurt_reason_name,hurt_reason_code,pathologic_diag_str,main_disdiag_status, " +
            "pathologic_diag_code,blh,allergy,allergic_medicine,autopsy,hbs_ag,hcv_ab,hiv_ab,tp_ab,blood_type,rh, " +
            "dept_leader,leader_doctor,main_doctor,admiss_doctor,duty_nurse,study_doctor,internship_doctor,coder, " +
            "dept_leader_name,leader_doctor_name,main_doctor_name,admiss_doctor_name,duty_nurse_name,study_doctor_name, " +
            "internship_doctor_name,coder_name,quality_control_level,quality_control_doctor,quality_control_nurse, " +
            "quality_control_doctor_name,quality_control_nurse_name,quality_control_date,zy_dismiss_way, " +
            "dismiss_destination,admiss_again_in_one_month,admiss_again_purpose,coma_days_before_admiss, " +
            "coma_hours_before_admiss,coma_minutes_before_admiss,coma_days_after_admiss,coma_hours_after_admiss, " +
            "coma_minutes_after_admiss,total_cost=cast(total_cost as decimal(16,2)), " +
            "self_pay=cast(self_pay as decimal(16,2)), " +
            "general_medical_service_fee=cast(general_medical_service_fee as decimal(16,2)), " +
            "general_treatment_operating_fee=cast(general_treatment_operating_fee as decimal(16,2)), " +
            "care_fee=cast(care_fee as decimal(16,2)),else_fee=cast(else_fee as decimal(16,2)), " +
            "pathologic_diag_fee=cast(pathologic_diag_fee as decimal(16,2)), " +
            "experiment_diag_fee=cast(experiment_diag_fee as decimal(16,2)), " +
            "ct_diag_fee=cast(ct_diag_fee as decimal(16,2)), " +
            "clinical_diag_fee=cast(clinical_diag_fee as decimal(16,2)), " +
            "not_surgical_fee=cast(not_surgical_fee as decimal(16,2)), " +
            "clinical_physical_fee=cast(clinical_physical_fee as decimal(16,2)), " +
            "surgical_fee=cast(surgical_fee as decimal(16,2)), " +
            "anesthetize_fee=cast(anesthetize_fee as decimal(16,2)), " +
            "surgery_fee=cast(surgery_fee as decimal(16,2)), " +
            "recover_fee=cast(recover_fee as decimal(16,2)), " +
            "tcm_treatment_fee=cast(tcm_treatment_fee as decimal(16,2)), " +
            "west_medicine_fee=cast(west_medicine_fee as decimal(16,2)), " +
            "chinese_patent_medicine_fee=cast(chinese_patent_medicine_fee as decimal(16,2)), " +
            "chinese_herbal_medicine_fee=cast(chinese_herbal_medicine_fee as decimal(16,2)), " +
            "blood_fee=cast(blood_fee as decimal(16,2)), " +
            "albumin_products_fee=cast(albumin_products_fee as decimal(16,2)), " +
            "globulin_products_fee=cast(globulin_products_fee as decimal(16,2)), " +
            "coagulation_factor_products_fee=cast(coagulation_factor_products_fee as decimal(16,2)), " +
            "cytokine_products_fee=cast(cytokine_products_fee as decimal(16,2)), " +
            "cost_of_disposable_medical_materials_for_examination=cast(cost_of_disposable_medical_materials_for_examination as decimal(16,2)), " +
            "cost_of_disposable_medical_materials_for_treatment=cast(cost_of_disposable_medical_materials_for_treatment as decimal(16,2)), " +
            "cost_of_disposable_medical_materials_for_operation=cast(cost_of_disposable_medical_materials_for_operation as decimal(16,2)), " +
            "other_fees=cast(other_fees as decimal(16,2)),diag_conform1,diag_conform2,diag_conform3, " +
            "diag_conform4,diag_conform5,rescue_times,rescue_success_times,case_classification,has_icu,icu_days, " +
            "icu_hours,monopathy_management,clinical_pathway_management,drgs_management,use_antibiotic,bacilliculture, " +
            "statutory_epidemic,tumor_level_t,tumor_level_n,tumor_level_m,tumor_level,xxe_apgar,responce_type, " +
            "responce_type_name,yb_type,yb_type_name,treat_type,treat_type_name,has_infant,med_type, " +
            "admiss_dept_code,admiss_ward_code,trans_dept_code,dismiss_dept_code,dismiss_ward_code,live_place_combo, " +
            "clinicDiagCode=(select top 1 rtrim(code) from zd_icd_code_new where yb_code=clinic_diag_code), " +
            "clinicDiagStr=(select top 1 rtrim(name) from zd_icd_code_new where yb_code=clinic_diag_code) " +
            "from t_case_frontsheet_main where dismiss_date>=#{begin} and dismiss_date<=#{end}")
    List<SheetForHqms> fetchSheets(@Param("begin") String begin, @Param("end") String end);

    @Select("select " +
            "bah,admiss_times,pay_method=isnull(pay_method,'-'),health_card_no=isnull(health_card_no,'-'), " +
            "name,sex=isnull(sex,'-'),birth_date,quality_control_date,admiss_date,dismiss_date, " +
            "age=isnull(age,'-'),country=isnull(country,'-'),age_days=isnull(age_days,'-'), " +
            "new_born_weight=isnull(new_born_weight,'-'),new_born_admiss_weight=isnull(new_born_admiss_weight,'-'), " +
            "birth_place=isnull(birth_place,'-'),birth_place_name=isnull(birth_place_name,'-'), " +
            "native_place=isnull(native_place,'-'),native_place_name=isnull(native_place_name,'-'), " +
            "nation=isnull(nation,'-'),social_no=isnull(social_no,'-'), " +
            "occupation=isnull(occupation,'-'),marriage=isnull(marriage,'-'), " +
            "live_place=isnull(live_place,'-'),phone=isnull(phone,'-'), " +
            "addr_zip_code=isnull(addr_zip_code,'-'),hk_place=isnull(hk_place,'-'), " +
            "hk_place_name=isnull(hk_place_name,'-'),hk_zip_code=isnull(hk_zip_code,'-'), " +
            "unit_name=isnull(unit_name,'-'),unit_place=isnull(unit_place,'-'), " +
            "unit_phone=isnull(unit_phone,'-'),unit_zip_code=isnull(unit_zip_code,'-'), " +
            "contact_name=isnull(contact_name,'-'),contact_relation=isnull(contact_relation,'-'), " +
            "contact_addr=isnull(contact_addr,'-'),contact_addr_name=isnull(contact_addr_name,'-'), " +
            "contact_phone=isnull(contact_phone,'-'), " +
            "zy_admiss_way=isnull(zy_admiss_way,'-'),has_surgery=isnull(has_surgery,'-'), " +
            "admiss_dept=isnull(admiss_dept,'-'), " +
            "admiss_ward=isnull(admiss_ward,'-'),trans_dept=isnull(trans_dept,'-'), " +
            "dismiss_dept=isnull(dismiss_dept,'-'), " +
            "dismiss_ward=isnull(dismiss_ward,'-'),admiss_days=isnull(admiss_days,'-'), " +
            "hurt_reason_name=isnull(hurt_reason_name,'-'),hurt_reason_code=isnull(hurt_reason_code,'-'), " +
            "pathologic_diag_str=isnull(pathologic_diag_str,'-'),main_disdiag_status=isnull(main_disdiag_status,'-'), " +
            "pathologic_diag_code=isnull(pathologic_diag_code,'-'),blh=isnull(blh,'-'),allergy=isnull(allergy,'-'), " +
            "allergic_medicine=isnull(allergic_medicine,'-'),autopsy=isnull(autopsy,'-'),hbs_ag=isnull(hbs_ag,'-'), " +
            "hcv_ab=isnull(hcv_ab,'-'),hiv_ab=isnull(hiv_ab,'-'),tp_ab=isnull(tp_ab,'-'), " +
            "blood_type=isnull(blood_type,'-'),rh=isnull(rh,'-'), " +
            "dept_leader=isnull(dept_leader,'-'),leader_doctor=isnull(leader_doctor,'-'), " +
            "main_doctor=isnull(main_doctor,'-'),admiss_doctor=isnull(admiss_doctor,'-'), " +
            "duty_nurse=isnull(duty_nurse,'-'),study_doctor=isnull(study_doctor,'-'), " +
            "internship_doctor=isnull(internship_doctor,'-'),coder=isnull(coder,'-'), " +
            "dept_leader_name=isnull(dept_leader_name,'-'),leader_doctor_name=isnull(leader_doctor_name,'-'), " +
            "main_doctor_name=isnull(main_doctor_name,'-'),admiss_doctor_name=isnull(admiss_doctor_name,'-'), " +
            "duty_nurse_name=isnull(duty_nurse_name,'-'),study_doctor_name=isnull(study_doctor_name,'-'), " +
            "internship_doctor_name=isnull(internship_doctor_name,'-'),coder_name=isnull(coder_name,'-'), " +
            "quality_control_level=isnull(quality_control_level,'-'),quality_control_doctor=isnull(quality_control_doctor,'-'), " +
            "quality_control_nurse=isnull(quality_control_nurse,'-'), " +
            "quality_control_doctor_name=isnull(quality_control_doctor_name,'-'), " +
            "quality_control_nurse_name=isnull(quality_control_nurse_name,'-'), " +
            "zy_dismiss_way=isnull(zy_dismiss_way,'-'), " +
            "dismiss_destination=isnull(dismiss_destination,'-'), " +
            "admiss_again_in_one_month=isnull(admiss_again_in_one_month,'-'), " +
            "admiss_again_purpose=isnull(admiss_again_purpose,'-'), " +
            "coma_days_before_admiss=isnull(coma_days_before_admiss,'-'), " +
            "coma_hours_before_admiss=isnull(coma_hours_before_admiss,'-'), " +
            "coma_minutes_before_admiss=isnull(coma_minutes_before_admiss,'-'), " +
            "coma_days_after_admiss=isnull(coma_days_after_admiss,'-'), " +
            "coma_hours_after_admiss=isnull(coma_hours_after_admiss,'-'), " +
            "coma_minutes_after_admiss=isnull(coma_minutes_after_admiss,'-'), " +
            "total_cost=cast(isnull(total_cost,0) as decimal(16,2)), " +
            "self_pay=cast(isnull(self_pay,0) as decimal(16,2)), " +
            "general_medical_service_fee=cast(isnull(general_medical_service_fee,0) as decimal(16,2)), " +
            "general_treatment_operating_fee=cast(isnull(general_treatment_operating_fee,0) as decimal(16,2)), " +
            "care_fee=cast(isnull(care_fee,0) as decimal(16,2)),else_fee=cast(isnull(else_fee,0) as decimal(16,2)), " +
            "pathologic_diag_fee=cast(isnull(pathologic_diag_fee,0) as decimal(16,2)), " +
            "experiment_diag_fee=cast(isnull(experiment_diag_fee,0) as decimal(16,2)), " +
            "ct_diag_fee=cast(isnull(ct_diag_fee,0) as decimal(16,2)), " +
            "clinical_diag_fee=cast(isnull(clinical_diag_fee,0) as decimal(16,2)), " +
            "not_surgical_fee=cast(isnull(not_surgical_fee,0) as decimal(16,2)), " +
            "clinical_physical_fee=cast(isnull(clinical_physical_fee,0) as decimal(16,2)), " +
            "surgical_fee=cast(isnull(surgical_fee,0) as decimal(16,2)), " +
            "anesthetize_fee=cast(isnull(anesthetize_fee,0) as decimal(16,2)), " +
            "surgery_fee=cast(isnull(surgery_fee,0) as decimal(16,2)), " +
            "recover_fee=cast(isnull(recover_fee,0) as decimal(16,2)), " +
            "tcm_treatment_fee=cast(isnull(tcm_treatment_fee,0) as decimal(16,2)), " +
            "west_medicine_fee=cast(isnull(west_medicine_fee,0) as decimal(16,2)), " +
            "chinese_patent_medicine_fee=cast(isnull(chinese_patent_medicine_fee,0) as decimal(16,2)), " +
            "chinese_herbal_medicine_fee=cast(isnull(chinese_herbal_medicine_fee,0) as decimal(16,2)), " +
            "blood_fee=cast(isnull(blood_fee,0) as decimal(16,2)), " +
            "albumin_products_fee=cast(isnull(albumin_products_fee,0) as decimal(16,2)), " +
            "globulin_products_fee=cast(isnull(globulin_products_fee,0) as decimal(16,2)), " +
            "coagulation_factor_products_fee=cast(isnull(coagulation_factor_products_fee,0) as decimal(16,2)), " +
            "cytokine_products_fee=cast(isnull(cytokine_products_fee,0) as decimal(16,2)), " +
            "cost_of_disposable_medical_materials_for_examination=cast(isnull(cost_of_disposable_medical_materials_for_examination,0) as decimal(16,2)), " +
            "cost_of_disposable_medical_materials_for_treatment=cast(isnull(cost_of_disposable_medical_materials_for_treatment,0) as decimal(16,2)), " +
            "cost_of_disposable_medical_materials_for_operation=cast(isnull(cost_of_disposable_medical_materials_for_operation,0) as decimal(16,2)), " +
            "other_fees=cast(isnull(other_fees,0) as decimal(16,2)), " +
            "diag_conform1=isnull(diag_conform1,'-'),diag_conform2=isnull(diag_conform2,'-'),diag_conform3=isnull(diag_conform3,'-'), " +
            "diag_conform4=isnull(diag_conform4,'-'),diag_conform5=isnull(diag_conform5,'-'),rescue_times=isnull(rescue_times,'-'), " +
            "rescue_success_times=isnull(rescue_success_times,'-'),case_classification=isnull(case_classification,'-'), " +
            "has_icu=isnull(has_icu,'-'),icu_days=isnull(icu_days,'-'), " +
            "icu_hours=isnull(icu_hours,'-'),monopathy_management=isnull(monopathy_management,'-'), " +
            "clinical_pathway_management=isnull(clinical_pathway_management,'-'), " +
            "drgs_management=isnull(drgs_management,'-'),use_antibiotic=isnull(use_antibiotic,'-'), " +
            "bacilliculture=isnull(bacilliculture,'-'), " +
            "statutory_epidemic=isnull(statutory_epidemic,'-'),tumor_level_t=isnull(tumor_level_t,'-'), " +
            "tumor_level_n=isnull(tumor_level_n,'-'),tumor_level_m=isnull(tumor_level_m,'-'), " +
            "tumor_level=isnull(tumor_level,'-'),xxe_apgar=isnull(xxe_apgar,'-'),responce_type=isnull(responce_type,'-'), " +
            "responce_type_name=isnull(responce_type_name,'-'),yb_type=isnull(yb_type,'-'), " +
            "yb_type_name=isnull(yb_type_name,'-'),treat_type=isnull(treat_type,'-'),treat_type_name=isnull(treat_type_name,'-'), " +
            "has_infant=isnull(has_infant,'-'),med_type=isnull(med_type,'-'), " +
            "admiss_dept_code=isnull(admiss_dept_code,'-'),admiss_ward_code=isnull(admiss_ward_code,'-'), " +
            "trans_dept_code=isnull(trans_dept_code,'-'),dismiss_dept_code=isnull(dismiss_dept_code,'-'), " +
            "dismiss_ward_code=isnull(dismiss_ward_code,'-'),live_place_combo=isnull(live_place_combo,'-'), " +
            "clinicDiagCode=(select top 1 rtrim(isnull(code,'-')) from zd_icd_code_new where yb_code=clinic_diag_code), " +
            "clinicDiagStr=(select top 1 rtrim(isnull(name,'-')) from zd_icd_code_new where yb_code=clinic_diag_code) " +
            "from t_case_frontsheet_main where dismiss_date>=#{begin} and dismiss_date<=#{end} ")
    List<SheetForHqms> fetchSheets2(@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,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)," +
            "code=(select top 1 rtrim(d.code) from zd_icd9_cm3 d where d.yb_code=a.code order by code), " +
            "name=(select top 1 rtrim(d.name) from zd_icd9_cm3 d where d.yb_code=a.code order by code) " +
            "from t_case_frontsheet_surgery a where bah=#{bah} and times=#{times}")
    List<CaseFrontsheetSurgery> fetchSurgeries(@Param("bah") String bah, @Param("times") int times);

    @Select("select bah, times, duplicate_time as opTime,visit_staff, remark, " +
            "admissDate=(select d.admiss_date from t_case_frontsheet_main d where d.bah=a.bah and d.admiss_times=a.times), " +
            "disDate=(select d.dismiss_date from t_case_frontsheet_main d where d.bah=a.bah and d.admiss_times=a.times), " +
            "disDept=(select d.dismiss_dept from t_case_frontsheet_main d where d.bah=a.bah and d.admiss_times=a.times), " +
            "doctor=(select d.main_doctor_name from t_case_frontsheet_main d where d.bah=a.bah and d.admiss_times=a.times), " +
            "patName=(select rtrim(d.name) from a_patient_mi d where d.inpatient_no=a.bah), " +
            "opStaff=(select rtrim(d.name) from a_employee_mi d where d.code=a.duplicate_staff) " +
            "from t_case_frontsheet_duplicate a where a.duplicate_time>=#{begin} and a.duplicate_time<=#{end}")
    List<ExportDclResponse> getDuplicateSheets(String begin, String end);

    @Select("select bah, times, closedown_time as opTime,visit_staff, remark, " +
            "admissDate=(select d.admiss_date from t_case_frontsheet_main d where d.bah=a.bah and d.admiss_times=a.times), " +
            "disDate=(select d.dismiss_date from t_case_frontsheet_main d where d.bah=a.bah and d.admiss_times=a.times), " +
            "disDept=(select d.dismiss_dept from t_case_frontsheet_main d where d.bah=a.bah and d.admiss_times=a.times), " +
            "doctor=(select d.main_doctor_name from t_case_frontsheet_main d where d.bah=a.bah and d.admiss_times=a.times), " +
            "patName=(select rtrim(d.name) from a_patient_mi d where d.inpatient_no=a.bah), " +
            "opStaff=(select rtrim(d.name) from a_employee_mi d where d.code=a.closedown_staff) " +
            "from t_case_frontsheet_closedown a where a.closedown_time>=#{begin} and a.closedown_time<=#{end}")
    List<ExportDclResponse> getCloseDownSheets(String begin, String end);

    @Select("select bah, times, pat_name,lend_time as opTime,remark, " +
            "admissDate=(select d.admiss_date from t_case_frontsheet_main d where d.bah=a.bah and d.admiss_times=a.times), " +
            "dis_date, dis_dept, lend_staff as visitStaff, " +
            "doctor=(select d.main_doctor_name from t_case_frontsheet_main d where d.bah=a.bah and d.admiss_times=a.times), " +
            "opStaff=(select rtrim(d.name) from a_employee_mi d where d.code=a.op_staff), " +
            "state=case when state='RETURNED' then '已归还' else '未归还' end, " +
            "return_time, lend_staff_phone from t_case_frontsheet_lendout a " +
            " where a.lend_time>=#{begin} and a.lend_time<=#{end}")
    List<ExportDclResponse> getLendOutSheets(String begin, String end);

    @Select("select a.bah,a.admiss_times,a.name,a.sex,a.zy_admiss_way,a.admiss_dept, " +
            "birthDate=convert(varchar(10),a.birth_date,21),a.social_no,a.phone, " +
            "admissDate=convert(varchar(19),a.admiss_date,21),a.dismiss_dept, " +
            "dismissDate=convert(varchar(19),a.dismiss_date,21), " +
            "qualityControlDate=convert(varchar(19),a.quality_control_date,21)," +
            "a.admiss_days,a.clinic_diag_code,a.clinic_diag_str,a.hurt_reason_code, " +
            "a.hurt_reason_name,a.pathologic_diag_code,a.pathologic_diag_str,a.blh, " +
            "a.leader_doctor_name,a.main_doctor_name,a.admiss_doctor_name, " +
            "a.duty_nurse_name,a.quality_control_level,a.quality_control_doctor_name, " +
            "a.quality_control_nurse_name,a.zy_dismiss_way,a.coder,a.coder_name, " +
            "a.total_cost,a.tumor_level_t,a.tumor_level_n,a.tumor_level_m," +
            "a.monopathy_management,a.clinical_pathway_management,a.drgs_management, " +
            "a.use_antibiotic,a.bacilliculture,a.statutory_epidemic, " +
            "a.pay_method,a.age,a.country,a.birth_place_name,a.native_place_name,a.nation, " +
            "a.occupation,a.marriage,a.live_place_combo,a.addr_zip_code,a.hk_place_name, " +
            "a.hk_zip_code,a.unit_name,a.unit_place,a.unit_phone,a.unit_zip_code,a.contact_name, " +
            "a.contact_relation,a.contact_addr_name,a.contact_phone,a.has_surgery,a.trans_dept, " +
            "a.allergy,a.allergic_medicine,a.autopsy,a.hbs_ag,a.hcv_ab,a.hiv_ab,a.tp_ab,a.blood_type, " +
            "a.rh,a.dept_leader_name,a.coder_name,a.dismiss_destination,a.admiss_again_in_one_month, " +
            "a.admiss_again_purpose,a.coma_days_before_admiss,a.coma_hours_before_admiss, " +
            "a.coma_minutes_before_admiss,a.coma_days_after_admiss,a.coma_hours_after_admiss, " +
            "a.coma_minutes_after_admiss,a.self_pay,a.diag_conform1,a.diag_conform2,a.diag_conform3, " +
            "a.diag_conform4,a.diag_conform5,a.rescue_times,a.rescue_success_times,a.case_classification, " +
            "a.has_icu,a.icu_days,a.icu_hours,a.xxe_apgar, " +
            "disdiagCodeStr=STUFF((SELECT '^' + b.code FROM t_case_frontsheet_disdiag b " +
            "WHERE b.bah = a.bah and b.times=a.admiss_times order by no " +
            "FOR XML PATH('')), 1, 1, ''), " +
            "disdiagNameStr=STUFF((SELECT '^' + b.name FROM t_case_frontsheet_disdiag b " +
            "WHERE b.bah = a.bah and b.times=a.admiss_times order by no " +
            "FOR XML PATH('')), 1, 1, ''), " +
            "surgeryLevelStr=STUFF((SELECT '^' + isnull(cast(level as varchar),'none') FROM t_case_frontsheet_surgery b " +
            "WHERE b.bah = a.bah and b.times=a.admiss_times order by no " +
            "FOR XML PATH('')), 1, 1, ''), " +
            "surgeryCodeStr=STUFF((SELECT '^' + b.code FROM t_case_frontsheet_surgery b " +
            "WHERE b.bah = a.bah and b.times=a.admiss_times order by no " +
            "FOR XML PATH('')), 1, 1, ''), " +
            "surgeryNameStr=STUFF((SELECT '^' + b.name FROM t_case_frontsheet_surgery b " +
            "WHERE b.bah = a.bah and b.times=a.admiss_times order by no " +
            "FOR XML PATH('')), 1, 1, '') from t_case_frontsheet_main a " +
            "where a.dismiss_date>=#{begin} and a.dismiss_date<=#{end} ${statement} " )
    @Options(resultSetType = ResultSetType.FORWARD_ONLY)
    @ResultType(HistorySheet.class)
    void selectHistorySheet2(String begin, String end, String statement, ResultHandler<HistorySheet> handler);
}
