臺灣健保預檢規則實作指引
0.0.1 - CI Build

臺灣健保預檢規則實作指引, published by Example Publisher. This guide is not an authorized publication; it is the continuous build for version 0.0.1 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/TWNHIFHIR/cql/ and changes regularly. See the Directory of published versions

Library: Eribulin給付規定-Eribulin Rule1

Official URL: https://nhicore.nhi.gov.tw/cql/Library/BCEribulinRule1 Version: 1.0.0
Draft as of 2026-03-11 Computable Name: BCEribulinRule1

此 Library 為乳癌患者於申請使用 Eribulin 之給付檢核條件。

Metadata
Title Eribulin給付規定-Eribulin Rule1
Version 1.0.0
Status Draft
Description

此 Library 為乳癌患者於申請使用 Eribulin 之給付檢核條件。

Type logic-library from http://terminology.hl7.org/CodeSystem/library-type
Parameters
Parameter None
Library Content
CQL Content
//乳癌_Eribulin給付規定
library BCEribulinRule1 version '1.0.0'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1' called FHIRHelpers

include BCCodeConcept version '1.0.0' called CodeConcept

include BCReusable version '1.0.0' called Reusable

context Patient

//============================================
// 申請類型判斷
//============================================

define "初次申請":
  "申請類型" = '初次使用'

define "續用申請":
  "申請類型" = '續用'

define "申請類型未知":
  "申請類型" = '無法判斷申請類型'

define "申請類型":
  case
    when Reusable."續用註記為1" then '初次使用'
    when Reusable."續用註記為2" then '續用'
    else '無法判斷申請類型'
  end


//============================================
// 主要規定一:初次使用條件
//============================================

/*規則1*/

define "ICD代碼檢核_布林值": Reusable."ICD-10使用C50"

define "醫令類別為1_布林值":Reusable."醫令類別為1"

//條件1:治療轉移性乳癌患者
//條件1-1
define "規則1-1-1=6個月內影像報告":
  exists (
    [DiagnosticReport] O
    where exists (
      O.code.coding Cdg
      where (
        Cdg in CodeConcept.ICD10PCS2023Image
        or Cdg in CodeConcept.ICD10PCS2014Image
      )
      and Cdg.code in CodeConcept.ImageCodes
    )
    and O.effective is not null
    and FHIRHelpers.ToDateTime(O.effective) >= Today() - 180 days
    and FHIRHelpers.ToDateTime(O.effective) <= Today()
  )


//條件1-2
define "規則1-1-2=癌症分期分數或結果為M≠0":
  exists (
    [Observation] O
      where exists (
        O.code.coding Cdg
          where Cdg.code = '399390009'
            and Cdg in CodeConcept.SNOMED
      )
        and O.value is not null
        and O.value is FHIR.string
        and Matches((O.value as FHIR.string).value, '.*M[1-9].*')
  )


//條件1-3
define "規則1-1-3=Eribulin申請":
  exists (        
    [MedicationRequest] MRPlan
    where MRPlan.intent = 'plan'
      and exists (
        MRPlan.medication.coding Cdg
        where Cdg in CodeConcept.NHIMedication
          and Cdg.code in CodeConcept.L01XX41
      )
  )

define "規則1-1=治療轉移性乳癌患者":
"ICD代碼檢核_布林值" and "醫令類別為1_布林值"
or "規則1-1-1=6個月內影像報告"  
and "規則1-1-2=癌症分期分數或結果為M≠0"
and "規則1-1-3=Eribulin申請"


//條件2:先前曾接受過anthracycline和taxane兩種針對轉移性乳癌之化學治療輔助性治療
define "規則1-2=先前曾接受過anthracycline和taxane兩種針對轉移性乳癌之化學治療輔助性治療":
  exists (
    [MedicationRequest] MRPlan
    where MRPlan.intent = 'plan'
      and exists (
        MRPlan.medication.coding Cdg
        where Cdg in CodeConcept.NHIMedication
          and Cdg.code in CodeConcept.L01XX41
      )
      and Reusable."HasValidTiming"(MRPlan)

      // 先前使用過 anthracycline (L01DB01 或 L01DB03)
      and exists (
        [MedicationRequest] MROrder1
        where MROrder1.intent = 'order'
          and exists (
            MROrder1.medication.coding Cdg
            where Cdg in CodeConcept.NHIMedication
              and (Cdg.code in CodeConcept.L01DB01 
                   or Cdg.code in CodeConcept.L01DB03)
          )
          and Reusable."HasValidTiming"(MROrder1)
          and Reusable."GetEndTime"(MROrder1) < Reusable."GetStartTime"(MRPlan)
      )
      // 先前使用過 taxane (L01CD01 或 L01CD02)
      and exists (
        [MedicationRequest] MROrder2
        where MROrder2.intent = 'order'
          and exists (
            MROrder2.medication.coding Cdg
            where Cdg in CodeConcept.NHIMedication
              and (Cdg.code in CodeConcept.L01CD01 
                   or Cdg.code in CodeConcept.L01CD02)
          )
          and Reusable."HasValidTiming"(MROrder2)
          and Reusable."GetEndTime"(MROrder2) < Reusable."GetStartTime"(MRPlan)
      )
  )
  and Reusable."醫令類別為1"


// 主要規定一
define "主要規定一":
"規則1-1=治療轉移性乳癌患者" 
and "規則1-2=先前曾接受過anthracycline和taxane兩種針對轉移性乳癌之化學治療輔助性治療"


//============================================
// 主要規定二:續用條件-治療持續給付
//============================================

//條件1:每3個療程需進行療效評估

// 前次申請紀錄(最近一次在今天之前開始的申請)
define "前次申請紀錄":
  Last(
    [MedicationRequest] MR
      where MR.intent = 'plan'
        and exists (
          MR.medication.coding Cdg
          where Cdg in CodeConcept.NHIMedication
            and Cdg.code in CodeConcept.L01XX41
        )
        and MR.dosageInstruction[0].timing.repeat.bounds is Period
        and FHIRHelpers.ToDateTime((MR.dosageInstruction[0].timing.repeat.bounds as Period).start) < Today()
      sort by FHIRHelpers.ToDateTime((dosageInstruction[0].timing.repeat.bounds as Period).start)
  )

// 本次申請紀錄(今天過後之新申請)
define "本次申請紀錄":
  First(
    [MedicationRequest] MR
      where MR.intent = 'plan'
        and exists (
          MR.medication.coding Cdg
          where Cdg in CodeConcept.NHIMedication
            and Cdg.code in CodeConcept.L01XX41
        )
        and MR.dosageInstruction[0].timing.repeat.bounds is Period
        and FHIRHelpers.ToDateTime((MR.dosageInstruction[0].timing.repeat.bounds as Period).start) >= Today()
      sort by FHIRHelpers.ToDateTime((dosageInstruction[0].timing.repeat.bounds as Period).start)
  )

// 每3個療程間隔的邏輯
define "規則1-1=每3個療程需進行療效評估":
  Reusable."醫令類別為1" 
  and Reusable."續用註記為2"
  and "前次申請紀錄" is not null
  and "本次申請紀錄" is not null
  and (
    // 計算前次申請結束日期到本次申請開始日期的天數差異
    difference in days between
      FHIRHelpers.ToDateTime(("前次申請紀錄".dosageInstruction[0].timing.repeat.bounds as Period).end)
      and FHIRHelpers.ToDateTime(("本次申請紀錄".dosageInstruction[0].timing.repeat.bounds as Period).start)
  ) <= 63


//條件2:疾病有惡化情形須停止使用

// 取得前次治療紀錄(最近一次已完成的治療)
define "前次治療紀錄":
  Last(
    [MedicationRequest] MR
      where MR.intent = 'order'
        and MR.status = 'completed'
        and exists (
          MR.medication.coding Cdg
            where Cdg in CodeConcept.NHIMedication
              and Cdg.code in CodeConcept.L01XX41
        )
        and (MR.dosageInstruction[0].timing.repeat.bounds as Period).start < Today()
      sort by (dosageInstruction[0].timing.repeat.bounds as Period).start
  )

// 前次用藥開始日期
define "前次用藥開始日期":
  ("前次治療紀錄".dosageInstruction[0].timing.repeat.bounds as Period).start

// 規則1-2: 疾病有惡化情形須停止使用(續用須檢附前次治療後影像學報告)
define "規則1-2=疾病有惡化情形須停止使用":
  exists (
    [DiagnosticReport] O
    where exists (
      O.code.coding Cdg
      where (
        Cdg in CodeConcept.ICD10PCS2023Image
        or Cdg in CodeConcept.ICD10PCS2014Image
      )
      and Cdg.code in CodeConcept.ImageCodes
    )
    and O.effective is not null
    and FHIRHelpers.ToDateTime(O.effective) >= "前次用藥開始日期"
    and FHIRHelpers.ToDateTime(O.effective) < Today()
  )

// 主要規定二
define "主要規定二:續用條件":
Reusable."續用註記為2"
and "規則1-1=每3個療程需進行療效評估"
and "規則1-2=疾病有惡化情形須停止使用"


//============================================
// 主要規定三:藥品使用規則
//============================================

//條件1:沒有使用ixabepilone (申請期間不能使用,但過去可以用過)
define "主要規定三:沒有使用ixabepilone":
  exists (
    [MedicationRequest] MRPlan
    where MRPlan.intent = 'plan'
      and exists (
        MRPlan.medication.coding Cdg
        where Cdg in CodeConcept.NHIMedication
          and Cdg.code in CodeConcept.L01XX41 
      )
      and Reusable."HasValidTiming"(MRPlan)
      
      // 申請期間不能與 ixabepilone 時間重疊
      and not exists (
        [MedicationRequest] MROrder
        where MROrder.intent = 'order'
          and exists (
            MROrder.medication.coding Cdg
            where Cdg in CodeConcept.NHIMedication
              and Cdg.code in CodeConcept.L01DC04
          )
          and Reusable."HasValidTiming"(MROrder)
          // 檢查時間是否重疊
          and Reusable."GetStartTime"(MRPlan) <= Reusable."GetEndTime"(MROrder)
          and Reusable."GetEndTime"(MRPlan) >= Reusable."GetStartTime"(MROrder)
      )
  )


//============================================
// 列出「符合」項目判斷式
//============================================

define function "符合項目"():
  // 主要規定一:初次使用條件
  (if "初次申請" and (
    "ICD代碼檢核_布林值" or 
    "醫令類別為1_布林值" or 
    "規則1-1-1=6個月內影像報告" or 
    "規則1-1-2=癌症分期分數或結果為M≠0" or 
    "規則1-1-3=Eribulin申請" or 
    "規則1-2=先前曾接受過anthracycline和taxane兩種針對轉移性乳癌之化學治療輔助性治療"
  )
    then '<主要規定一:初次使用條件>\n' +
         (if "ICD代碼檢核_布林值" 
           then '● ICD代碼檢核:主要疾病之ICD代碼使用C50\n' else '') +
         (if "醫令類別為1_布林值" 
           then '● 醫令類別檢核:醫令類別為1(癌症治療)\n' else '') +
         (if "規則1-1-1=6個月內影像報告" 
           then '● 規則1-1-1:6個月內影像報告\n' else '') +
         (if "規則1-1-2=癌症分期分數或結果為M≠0" 
           then '● 規則1-1-2:癌症分期分數或結果為M≠0(轉移性)\n' else '') +
         (if "規則1-1-3=Eribulin申請" 
           then '● 規則1-1-3:Eribulin申請\n' else '') +
         (if "規則1-2=先前曾接受過anthracycline和taxane兩種針對轉移性乳癌之化學治療輔助性治療" 
           then '● 規則1-2:已接受anthracycline和taxane化學治療\n' else '') +
         '\n'
    else '') +
  
  // 主要規定二:續用條件
  (if "續用申請" and (
    "規則1-1=每3個療程需進行療效評估" or 
    "規則1-2=疾病有惡化情形須停止使用"
  )
    then '<主要規定二:續用條件-治療持續給付>\n' +
         (if "規則1-1=每3個療程需進行療效評估" 
           then '● 續用規則1-1:於3個療程(63天)內再次申請並檢附療效評估資料\n' else '') +
         (if "規則1-2=疾病有惡化情形須停止使用" 
           then '● 續用規則1-2:已檢附前次治療後影像學報告,確認無惡化\n' else '') +
         '\n'
    else '') +
  
  // 主要規定三:藥品使用規則
  (if "主要規定三:沒有使用ixabepilone"
    then '<主要規定三:藥品使用規則>\n' +
         '● 規則3-1:未併用ixabepilone\n'
    else '')

//============================================
// 列出「不符合」項目判斷式 - 代碼或條件不符
//============================================

define function "不符合項目_代碼或條件不符"():
  // 主要規定一:初次使用條件 - 代碼條件不符
  (if "初次申請" and (
    not "ICD代碼檢核_布林值" or 
    not "醫令類別為1_布林值"
  )
    then '<主要規定一:初次使用條件>\n' +
         (if not "ICD代碼檢核_布林值" 
           then '▲ ICD代碼檢核:主要疾病之ICD代碼未使用C50\n' else '') +
         (if not "醫令類別為1_布林值" 
           then '▲ 醫令類別檢核:醫令類別非1\n' else '') +
         '\n'
    else '') +
  
  // 主要規定三:藥品使用規則 - 代碼條件不符
  (if not "主要規定三:沒有使用ixabepilone"
    then '<主要規定三:藥品使用規則>\n' +
         '▲ 規則3-1:申請期間併用ixabepilone(不可併用)\n'
    else '')

//============================================
// 列出「不符合」項目判斷式 - 必要資料未填寫
//============================================

define function "不符合項目_必要資料未填寫"():
  // 主要規定一:初次使用條件 - 必要資料未填寫
  (if "初次申請" and (
    not "規則1-1-1=6個月內影像報告" or 
    not "規則1-1-2=癌症分期分數或結果為M≠0" or 
    not "規則1-1-3=Eribulin申請" or 
    not "規則1-2=先前曾接受過anthracycline和taxane兩種針對轉移性乳癌之化學治療輔助性治療"
  )
    then '<主要規定一:初次使用條件>\n' +
         (if not "規則1-1-1=6個月內影像報告" 
           then '▲ 規則1-1-1:未提供6個月內影像報告\n' else '') +
         (if not "規則1-1-2=癌症分期分數或結果為M≠0" 
           then '▲ 規則1-1-2:未提供癌症分期資料或非轉移性(M=0)\n' else '') +
         (if not "規則1-1-3=Eribulin申請" 
           then '▲ 規則1-1-3:未提供Eribulin申請資料\n' else '') +
         (if not "規則1-2=先前曾接受過anthracycline和taxane兩種針對轉移性乳癌之化學治療輔助性治療" 
           then '▲ 規則1-2:未提供anthracycline和taxane化學治療紀錄\n' else '') +
         '\n'
    else '') +
  
  // 主要規定二:續用條件 - 必要資料未填寫
  (if "續用申請" and (
    not "規則1-1=每3個療程需進行療效評估" or 
    not "規則1-2=疾病有惡化情形須停止使用"
  )
    then '<主要規定二:續用條件-治療持續給付>\n' +
         (if not "規則1-1=每3個療程需進行療效評估" 
           then '▲ 續用規則1-1:超過3個療程(63天)未再次申請或未檢附療效評估資料\n' else '') +
         (if not "規則1-2=疾病有惡化情形須停止使用" 
           then '▲ 續用規則1-2:未提供前次治療後影像學報告或顯示疾病惡化\n' else '') +
         '\n'
    else '')

//============================================
// 審核結果
//============================================

define "乳癌Eribulin申請結果_布林":
  case
    when "初次申請" then (
      "主要規定一" and
      "主要規定三:沒有使用ixabepilone"
    )
    when "續用申請" then (
      "主要規定二:續用條件" and
      "主要規定三:沒有使用ixabepilone"
    )
    else false
  end

define "乳癌Eribulin申請之CQL檢核結果":
  if (
    "初次申請" and 
    "主要規定一" and
    "主要規定三:沒有使用ixabepilone"
  )
  then '✓通過:初次使用-乳癌Eribulin用藥申請'

  else if (
    "續用申請" and
    "主要規定二:續用條件" and
    "主要規定三:沒有使用ixabepilone"
  )
  then '✓通過:續用-乳癌 Eribulin 用藥申請'
  else if "初次申請"
  then '✖不通過:初次使用-乳癌 Eribulin 用藥申請'
  else if "續用申請"
  then '✖不通過:續用-乳癌 Eribulin 用藥申請'
  else '✖不通過:無法判定申請類型-乳癌 Eribulin 用藥申請'

//============================================
// 報告總結
//============================================

define "報告總結":
  '\n=== 乳癌之Eribulin申請審核報告 ===\n' +
  '\n【申請類型】' + "申請類型" + '\n' +
  '\n【●符合項目】\n' +
  (if "符合項目"() = '' then '無\n' else "符合項目"()) +
  '\n【▲不符合項目 - 代碼或條件不符】\n' +
  (if "不符合項目_代碼或條件不符"() = '' then '無\n' else "不符合項目_代碼或條件不符"()) +
  '\n【▲不符合項目 - 必要資料未填寫】\n' +
  (if "不符合項目_必要資料未填寫"() = '' then '無\n' else "不符合項目_必要資料未填寫"()) +
  '\n【申請結果】\n' +
  "乳癌Eribulin申請之CQL檢核結果" +
  '\n===============================================\n'
ELM XML Content
Encoded data 
ELM JSON Content
Encoded data 
Generated using version 0.5.3-cibuild of the sample-content-ig Liquid templates