package thyyxxk.webserver.dao.his.singlepage;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import thyyxxk.webserver.entity.singlepage.todayclinicresource.ClinicResource;

import java.util.List;

@Mapper
public interface TodayClinicResourceDao {

    @Select("select deptName=ltrim(rtrim(c.name))," +
            "doctorName=(select ltrim(rtrim(name)) from a_employee_mi where code=a.doctor_code)," +
            "reqType=ltrim(rtrim(b.name))," +
            "reqTime=(select case a.ampm when 'd' then N'全天' when 'a' then N'上午' when 'p' then N'下午' end)," +
            "reqFee=(b.req_fee+b.telreq_fee+b.clinic_fee+oth_fee)," +
            "reqAddress=isnull(ltrim(rtrim(c.office_pos)),'') " +
            "from mzy_request_new a, mzy_zd_charge_type b,zd_unit_code c where " +
            "a.request_day>=#{start} and a.request_day<#{end} and a.charge_type!='16' " +
            "and b.code not in ('10','39') and a.doctor_code!='' " +
            "and a.charge_type=b.code and a.unit_code=c.code and a.left_num>0 " +
            "order by c.n_code desc,c.mz_class,c.sort_code")
    List<ClinicResource> selectTodayClinicResource(String start, String end);
}
