strSql=@"SELECT Record.AccidentPersonRecordId AS ID,Record.ProjectId,Project.ProjectCode,Project.ProjectName + ( select top 1 case when ProjectState2 is null then '' when ProjectState2 !=3 then '<span style=""color:red"" >'+ ConstText+'<span/>' else ''end from Sys_Const where GroupId ='ProjectState' and (ProjectState2 is null or ProjectState2=ConstValue )) ProjectName,
,Unit.UnitId,Unit.UnitName,Record.States, 1 AS PeopleNum
,(CASE WHEN Record.Injury =1 THEN '死亡' WHEN Record.Injury =2 THEN '重伤' ELSE '轻伤' END) AS Info
FROM Accident_AccidentPersonRecord AS Record
LEFT JOIN Base_AccidentType AS AccidentType ON AccidentType.AccidentTypeId = Record.AccidentTypeId
LEFT JOIN Base_Project AS Project ON Record.ProjectId = Project.ProjectId
LEFT JOIN SitePerson_Person AS Person ON Person.PersonId = Record.PersonId
LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = Person.UnitId
WHERE (Project.ProjectAttribute is null or Project.ProjectAttribute = 'GONGCHENG') and (isDelete is null or isDelete =0) ";
if(rbType.SelectedValue=="0")
{
strSql+=" AND Record.IsAttempt='1'";
}
}
else
{
strSql=@"SELECT Record.AccidentReportId AS ID,Record.ProjectId,Project.ProjectCode,Project.ProjectName + ( select top 1 case when ProjectState2 is null then '' when ProjectState2 !=3 then '<span style=""color:red"" >'+ ConstText+'<span/>' else ''end from Sys_Const where GroupId ='ProjectState' and (ProjectState2 is null or ProjectState2=ConstValue )) ProjectName,
Record.AccidentTypeId,ConstText AS AccidentTypeName,Record.AccidentDate