You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.3 KiB
32 lines
1.3 KiB
|
|
update peisdb.[dbo].[Exam_Result] set TextResult=tt.TextResult
|
|
from
|
|
(
|
|
select t.id,t2.TextResult from peisdb.dbo.Exam_Result t
|
|
left join
|
|
(
|
|
SELECT
|
|
Z.Id AS PID
|
|
,Y.DepartmentId AS [DID]
|
|
,X.DepartmentName AS [DeptName]
|
|
,X.[FeeItemId] AS [FID]
|
|
,X.Name AS FeeItemName
|
|
,Y.[ExamItemId] AS [RID]
|
|
,Y.[Name] AS [RptItemName]
|
|
,Y.[TextValue] AS [TextResult]
|
|
,Y.[ValueUnit] AS [Unit]
|
|
,X.ItemType AS [ItemClass]
|
|
FROM PEIS.DBO.[EnrollmentFeeItem] X (NOLOCK)
|
|
JOIN PEIS.DBO.[EnrollmentExamItem] Y (NOLOCK) ON X.Id = Y.EnrollmentFeeItemId
|
|
JOIN PEIS.DBO.[ExamDepartment] Z(NOLOCK) ON Y.DepartmentId = Z.DepartmentId
|
|
AND Y.EnrollmentId = Z.EnrollmentId AND X.EnrollmentId = Z.EnrollmentId
|
|
WHERE X.SendOperDate IS NOT NULL AND X.RemoveOperDate IS NULL
|
|
AND Y.RemoveOperDate IS NULL AND Z.RemoveOperDate IS NULL
|
|
AND X.GiveUpOperDate IS NULL AND Y.GiveUpOperDate IS NULL
|
|
) as t2 on t2.pid=t.pid and t2. RptItemName =t.RptItemName and t2.FeeItemName=t.FeeItemName
|
|
where (t.TextResult is null or t.TextResult='')and (t2.TextResult <>'')
|
|
) tt
|
|
where Exam_Result.id=tt.id
|
|
--
|
|
|
|
UPDATE [Exam_Result] SET [UnusualFlag] = NULL WHERE [UnusualFlag] = '阴性' or [UnusualFlag] = '正常' |