私は病院の患者の毎日のレポートを作成しています。Mypatient_ref_master
には古い患者と新しい患者の両方が含まれています。私は2列を新旧として取りました。患者が古い場合、患者IDが古い列の下に来るようにレポートを取得したいと思います。それ以外の場合、患者IDは新しい列の下に来るはずです。ストアド プロシージャの結果をレポートにバインドしています。SP の結果を、C# コードでデータブルを使用して操作するグリッドにバインドすると、正常に動作します。しかし、.RDLC レポートを使用しようとすると、古い列と新しい列にもすべての患者 ID が表示されます。ストアド プロシージャ自体で switch case を使用して除外できますか。以下は私のストアドプロシージャです。
ALTER PROCEDURE [dbo].[Daily_Report] '2013/08/02'
-- Add the parameters for the stored procedure here
-- Add the parameters for the stored procedure here
(
@date varchar(20)
)
AS
BEGIN
SET NOCOUNT ON;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT
convert(varchar,Patient_Ref_master.creation_Date,105) as 'creation_Date',
Patient_Ref_master.Sr_No as 'sr_No',
old_new_patient.old_new as 'old_new',
Patient_Ref_master.Pat_ID as 'Pat_ID',
Patient_Master.Pat_FName +' '+Patient_Master.Pat_SName as 'NAME',
Dept_ID as 'Dept_ID',
Dept_Master.Dept_Name as 'Dept_Name',
Doc_Master.Doc_ID as 'Doc_Master',
Doc_Master.Doc_FName+' '+Doc_Master.Doc_SName as 'Doc_Name',
Patient_Master.Pat_Addr as 'addr',
Gender_master.Name1 as 'Pat_Sex',
Patient_Master.Age as 'age'
FROM Patient_Ref_master
left join dbo.old_new_patient on dbo.old_new_patient.code=Patient_Ref_master.old_new
left join dbo.Dept_Master on Dept_Master.Dept_code = Patient_Ref_master.Dept_ID
left join Patient_Master on Patient_Master.Pat_Code=Patient_Ref_master.Pat_ID
left join Doc_Master on Doc_Master.Doc_ID=Patient_Ref_master.Doc_ID
left join Gender_master on Gender_master.Code=Patient_Master.Pat_Sex
where
Patient_Ref_master.creation_Date=@date
--MONTH(Patient_Ref_master.creation_Date)=@month and Dept_ID=@dept
order by Patient_Ref_master.Sr_No asc
I want something like the following. where 1st row has the patient for 2nd aug under Patient_ID_New column because he is new and 2nd line because he is old. I want a blank space like 1st row in Patient_Id_Old coumn
Date No Patient_ID_New Patient ID Old
02-08-2013 11 11
02-08-2013 13 1