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.casefrontsheet.JieShouHuiZhenPojo;
import thyyxxk.webserver.entity.datamodify.GetDropdownBox;

import java.util.List;

/**
 * <p>
 * 描述： 会诊统计
 * </p>
 *
 * @author xc
 * @date 2021-07-30 10:04
 */
@Mapper
public interface HuiZhenTongJiDao {


    @Select("select code,name from zd_unit_code")
    List<GetDropdownBox> getDept();

    @Select("<script>" +
            "select inpatient_no,admiss_times,req_times,status_flag,  " +
            "(select rtrim(name) name from  zd_unit_code where code = dept_code) dept_code,  " +
            "(select rtrim(name) name from  zd_unit_code where code = req_dept1) req_dept1, " +
            "(select rtrim(name) name from a_employee_mi where code = input_id) input_name, " +
            "(select rtrim(name) name from a_employee_mi where code = isnull(hz_doctor1,hz_doctor2)) hz_doctor,  " +
            "req_date  " +
            "from  ysh_hz_record where req_date &gt; #{startTime} and req_date &lt;= #{endTime} " +
            "<if test=\"deptCode != null and deptCode != '' \"> " +
            "and req_dept1 = #{deptCode} " +
            "</if>" +
            "<if test=\"statusFlag != 0 and statusFlag != null \" >" +
            "and status_flag = #{statusFlag}" +
            "</if>" +
            "</script>")
    IPage<JieShouHuiZhenPojo> getHuiZhenTongJi(IPage<JieShouHuiZhenPojo> page,
                                               @Param("startTime") String startTime,
                                               @Param("endTime") String endTime,
                                               @Param("deptCode") String deptCode,
                                               @Param("statusFlag") Integer statusFlag);
}
