USE [peisdb]
GO

/****** Object:  StoredProcedure [dbo].[sp_GetJyLisResult]    Script Date: 06/04/2024 09:50:41 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

 CREATE PROCEDURE [dbo].[sp_GetJyLisResult] 
	@EID varchar(20) 
AS
BEGIN 
		select 
		CAST(   A.req_id AS bigint) AS FID, 
		C.FeeItemName ,
		F_SingleItemName  AS RptItemName,
		'' AS RptItemCode,
		F_Result AS TextResult,
		F_Unit AS Unit,
		F_Hint AS UnusualFlag,
		F_Reference  AS RANGE,
		F_CheckerName AS Checker,
		F_CheckTime  AS CheckTime,
		ItemClass = '检验',
		F_AuthorizeName  AS Reporter,
		F_AuthorizeTime  AS ReportTime 
		
		 from 
		lis.rmcloudlis7.dbo.vw_checked_labresult A
left join  jylis.kingmed.dbo.V_KM_LIS_Result b on a.pat_no=b.F_PatientNumber  AND A.barcode =B.F_HospSampleID
LEFT JOIN Enrollment_FeeItem C ON A.req_id = C.ID OR A.req_id = C.OldId
where pat_no =  @EID and pat_typecode=4 AND C.DeptCode='3002'
END
GO


