0

特定の値を表示できる式を見つけようとしています。

例:

アスピリンとワーファリン、および (次の 3 つの値の 1 つまたは複数) クロピドグレルまたはプラスグレルまたはチカグレロールを見たい.

患者 1 は次の薬を服用します。

アスピリン ワルファリン クロピドグレル

患者 2 の服用: アスピリン ワルファリン

現在、私は患者 1 と患者 2 の両方を診察していますが、患者 1 のような 3 つの異なる薬を服用している患者だけを診察したいと考えています。

どうぞよろしくお願いいたします。Crystal Reports 2008 を使用しています。

4

1 に答える 1

1

次のような行を SQL select 句に追加することをお勧めします。

count(distinct case when medication in ('Aspirin', 'Warfarin') 
                    then medication end) 
     over (partition by patient) as mandatory_meds,
count(distinct case when medication in ('Clopidogrel', 'Prasugrel', 'Ticagrelor')
                    then medication end) 
     over (partition by patient) optional_meds,

- 次に、次の条件を SQL where 句に追加します。

and mandatory_meds = 2 and optional_meds >= 1


または、次の方法で Crystal で同様の結果を得ることができます。

  • レポートを患者ごとにグループ化する
  • 次のような式で、mandatory_meds と呼ばれる結晶式を作成します。
    if {myTable.medication} = "Aspirin" or {myTable.medication} = "Warfarin"
    then {myTable.medication}
  • 次のような式で、optional_meds と呼ばれる結晶式を作成します。
    if {myTable.medication} = "Clopidogrel" or {myTable.medication} = "Prasugrel"
    or {myTable.medication} = "Ticagrelor" then {myTable.medication}
  • 次のようなグループ選択式に条件を追加します。
    DistinctCount({@mandatory_meds})=2 and DistinctCount({@optional_meds})>=1
于 2013-03-20T13:33:43.310 に答える