,(CASE WHEN CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(BirthDate,'%m-%d')) >= DATE_FORMAT(now(),'%Y-%m-%d')
AND CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(BirthDate,'%m-%d')) <= DATE_FORMAT(date_add(now(),INTERVAL 6 DAY),'%Y-%m-%d')
THEN 1
ELSE 0 END) IsBirth
ELSE 0 END) IsBirth
FROM
(
SELECT A.*,IFNULL(B.MName,'') AS EmployeeName,B.MHead AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
,B.LeaveStatus,B.LeaveTime,B.MTel AS EmployeeTel
FROM rb_account AS A INNER JOIN rb_manager AS B ON A.AccountId=B.MId AND A.AccountType=1
FROM rb_manager AS B LEFT JOIN rb_account AS A ON A.AccountId=B.MId AND A.AccountType=1
WHERE 1=1 {0}
UNION ALL
SELECT A.*,IFNULL(B.TeacherName,'') AS EmployeeName,B.TeacherIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
,B.LeaveStatus,B.LeaveTime,B.TeacherTel AS EmployeeTel
FROM rb_account AS A INNER JOIN rb_teacher AS B ON A.AccountId=B.TId AND A.AccountType=2
FROM rb_teacher AS B LEFT JOIN rb_account AS A ON A.AccountId=B.TId AND A.AccountType=2
WHERE 1=1 {0}
UNION ALL
SELECT A.*,IFNULL(B.AssistName,'') AS EmployeeName,B.AssistIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
,B.LeaveStatus,B.LeaveTime,B.AssistTel AS EmployeeTel
FROM rb_account AS A INNER JOIN rb_assist AS B ON A.AccountId=B.AId AND A.AccountType=3
FROM rb_assist AS B LEFT JOIN rb_account AS A ON A.AccountId=B.AId AND A.AccountType=3
WHERE 1=1 {0}
) AS A LEFT JOIN rb_group AS g ON A.Group_Id=g.GId
LEFT JOIN rb_school AS s ON A.School_Id=s.SId
LEFT JOIN rb_department AS d ON A.Dept_Id=d.DeptId