alter table [dbo].[SitePerson_Person] add IdcardType nvarchar(50) null GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'证件类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SitePerson_Person', @level2type=N'COLUMN',@level2name=N'IdcardType' GO alter table [dbo].[SitePerson_Person] add IdcardStartDate datetime null GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'证件开始时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SitePerson_Person', @level2type=N'COLUMN',@level2name=N'IdcardStartDate' GO alter table [dbo].[SitePerson_Person] add IdcardEndDate datetime null GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'证件结束时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SitePerson_Person', @level2type=N'COLUMN',@level2name=N'IdcardEndDate' GO alter table [dbo].[SitePerson_Person] add IdcardForever char(1) null GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'证件是否永久有效' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SitePerson_Person', @level2type=N'COLUMN',@level2name=N'IdcardForever' GO alter table [dbo].[SitePerson_Person] add PoliticsStatus nvarchar(50) null GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'政治面貌' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SitePerson_Person', @level2type=N'COLUMN',@level2name=N'PoliticsStatus' GO alter table [dbo].[SitePerson_Person] add IdcardAddress nvarchar(50) null GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'发证机关' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SitePerson_Person', @level2type=N'COLUMN',@level2name=N'IdcardAddress' GO alter table [dbo].[SitePerson_Person] add Nation nvarchar(50) null GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'民族' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SitePerson_Person', @level2type=N'COLUMN',@level2name=N'Nation' GO alter table [dbo].[SitePerson_Person] add CountryCode nvarchar(50) null GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'国家' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SitePerson_Person', @level2type=N'COLUMN',@level2name=N'CountryCode' GO alter table [dbo].[SitePerson_Person] add ProvinceCode nvarchar(50) null GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'省份' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SitePerson_Person', @level2type=N'COLUMN',@level2name=N'ProvinceCode' GO alter table [dbo].[SitePerson_Person] add HeadImage image null GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'照片base64' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SitePerson_Person', @level2type=N'COLUMN',@level2name=N'HeadImage' GO ALTER TABLE AttachFile ADD ImageByte IMAGE NULL GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'图片base64' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'AttachFile', @level2type=N'COLUMN',@level2name=N'ImageByte' GO ALTER TABLE Base_Unit ADD RealNamePushTime DATETIME NULL GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'与实名制系统推送时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_Unit', @level2type=N'COLUMN',@level2name=N'RealNamePushTime' GO ALTER VIEW [dbo].[View_SitePerson_Person] AS SELECT Person.PersonId, Person.CardNo, Person.PersonName, Person.Sex, (Case Person.Sex WHEN '1' THEN '男' WHEN '2' THEN '女' ELSE '' END) AS SexName, Person.IdentityCard, Person.Address, Person.ProjectId, Person.UnitId, Person.Birthday, Person.TeamGroupId, Person.WorkAreaId, Person.WorkPostId, Person.InTime, Person.OutTime, Person.OutResult, Person.Telephone, Person.PositionId, Person.PostTitleId, Person.PhotoUrl, Person.IsUsed, (CASE Person.IsUsed WHEN 'TRUE' THEN '是' ELSE '否' END) AS IsUsedName, Person.IsCardUsed, (CASE Person.IsCardUsed WHEN 'TRUE' THEN '是' ELSE '否' END) AS IsCardUsedName, Person.PersonIndex, Project.ProjectCode, Project.ProjectName, Unit.UnitCode, Unit.UnitName, TeamGroup.TeamGroupName, --WorkArea.UnitWorkCode AS WorkAreaCode, WorkAreaCode= STUFF((SELECT ',' + UnitWorkCode FROM dbo.WBS_UnitWork where PATINDEX('%,' + RTRIM(UnitWorkId) + ',%',',' +Person.WorkAreaId + ',')>0 FOR XML PATH('')), 1, 1,''), --WorkArea.UnitWorkName AS WorkAreaName WorkAreaName= STUFF((SELECT ',' + UnitWorkName FROM dbo.WBS_UnitWork where PATINDEX('%,' + RTRIM(UnitWorkId) + ',%',',' +Person.WorkAreaId + ',')>0 FOR XML PATH('')), 1, 1,''), Post.WorkPostName, Position.PositionName, Title.PostTitleName, Depart.DepartName, Post.PostType, Post.IsHsse, (SELECT COUNT(*) FROM EduTrain_TrainRecordDetail T WHERE T.PersonId=Person.PersonId) AS TrainCount, Person.AuditorId, sysUser.UserName AS AuditorName, Person.AuditorDate, Person.IDCardUrl, Person.IsForeign, case when Person.IsForeign=1 then '是' else '否' end as IsForeignStr, Person.IdcardType, BasicData1.dictName as IdcardTypeName, Person.IdcardStartDate, Person.IdcardEndDate, Person.IdcardForever, case when Person.IdcardForever='Y' then '是' else '否' end as IdcardForeverStr, Person.PoliticsStatus, BasicData2.dictName as PoliticsStatusName, Person.IdcardAddress, Person.Nation, BasicData3.dictName as NationName, Person.EduLevel, BasicData4.dictName as EduLevelName, Person.MaritalStatus, BasicData5.dictName as MaritalStatusName, Person.CountryCode, Country.cname as CountryName, Person.ProvinceCode, City.cname as ProvinceName, Person.MainCNProfessionalId, CNProfessional.ProfessionalName as MainCNProfessionalName, Person.ViceCNProfessionalId, '' as ViceCNProfessionalName, Person.IsOutside, case when Person.IsOutside=1 then '是' else '否' end as IsOutsideStr FROM SitePerson_Person AS Person LEFT JOIN Base_Project AS Project ON Project.ProjectId=Person.ProjectId LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = Person.UnitId LEFT JOIN ProjectData_TeamGroup AS TeamGroup ON TeamGroup.TeamGroupId=Person.TeamGroupId --LEFT JOIN WBS_UnitWork AS WorkArea ON WorkArea.UnitWorkId = Person.WorkAreaId LEFT JOIN Base_WorkPost AS Post ON Post.WorkPostId = Person.WorkPostId LEFT JOIN Base_Position AS Position ON Position.PositionId = Person.PositionId Left JOIN Base_PostTitle AS Title ON Title.PostTitleId = Person.PostTitleId Left JOIN Base_Depart AS Depart ON Depart.DepartId = Person.DepartId Left JOIN Sys_User AS sysUser ON sysUser.UserId = Person.AuditorId Left JOIN RealName_BasicData AS BasicData1 ON BasicData1.dictCode = Person.IdcardType Left JOIN RealName_BasicData AS BasicData2 ON BasicData2.dictCode = Person.PoliticsStatus Left JOIN RealName_BasicData AS BasicData3 ON BasicData3.dictCode = Person.Nation Left JOIN RealName_BasicData AS BasicData4 ON BasicData4.dictCode = Person.EduLevel Left JOIN RealName_BasicData AS BasicData5 ON BasicData5.dictCode = Person.MaritalStatus Left JOIN RealName_Country AS Country ON Country.CountryId = Person.CountryCode Left JOIN RealName_City AS City ON City.provinceCode = Person.ProvinceCode Left JOIN Base_CNProfessional AS CNProfessional ON CNProfessional.CNProfessionalId = Person.MainCNProfessionalId GO