package thyyxxk.webserver.dao.his.reports;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import thyyxxk.webserver.entity.querydata.InquiryOfConsultationFee;


/**
 * @author 肖
 * @description: 查询会诊费用
 */
@Mapper
public interface InquiryOfConsultationFeeDao {

    /**
     * 查询会诊费用 根据日期区间 进行查询
     *
     * @param page      分页的条件
     * @param endDate   开始时间
     * @param startDate 结束时间
     * @return 返回一个 IPage对象里包含了 总条数 以及符合条件的数据
     */
    @Select("<script>" +
            "select a.inpatient_no,a.admiss_times, " +
            "(select name from zd_unit_code where code=a.req_dept1) dept, " +
            "(select name from a_employee_mi where code=a.hz_id) doctor,b.charge_fee, " +
            "(select name from zd_charge_item where code=b.charge_code_mx) position,a.input_date " +
            "from ysh_hz_record a,zy_detail_charge b " +
            "where input_date &gt;= #{startDate} and input_date &lt;= #{endDate} " +
            "<if test=\"deptCode != null and deptCode != '' \">" +
            "and b.exec_unit = #{deptCode} " +
            "</if>" +
            "and a.act_order_no=b.order_no " +
            "order by a.inpatient_no,a.admiss_times,a.input_date" +
            "</script>")
    IPage<InquiryOfConsultationFee> inquiryOfConsultationFee(IPage<InquiryOfConsultationFee> page,
                                                             @Param("startDate") String startDate,
                                                             @Param("endDate") String endDate,
                                                             @Param("deptCode") String deptCode);
}
