臺灣健保預檢規則實作指引
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: Everolimus給付規定-Everolimus Rule1

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

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

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

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

Type logic-library from http://terminology.hl7.org/CodeSystem/library-type
Parameters
Parameter None
Library Content
CQL Content
//乳癌_Everolimus給付規定
library BCEverolimusRule1 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=3個月內影像報告":
  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() - 90 days
    and FHIRHelpers.ToDateTime(O.effective) <= Today()
  ) 



//條件1-3
define "規則1-1-3=癌症分期分數或結果為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-4(檢查報告)
define "規則1-1-4=3個月內有檢查報告":
  exists (
    [DiagnosticReport] O2
    where exists (
      O2.code.coding Cdg
      where Cdg in CodeConcept.LOINC
      and Cdg.code in CodeConcept.MolecularReport
    )
    and O2.effective is not null
    and FHIRHelpers.ToDateTime(O2.effective) >= Today() - 90 days
    and FHIRHelpers.ToDateTime(O2.effective) <= Today()
  ) 

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

define "規則1-1=轉移性乳癌":
"ICD代碼檢核_布林值" and "醫令類別為1_布林值"
and "規則1-1-1=3個月內影像報告" 
and "規則1-1-3=癌症分期分數或結果為M≠0"
and "規則1-1-4=3個月內有檢查報告"
and "規則1-1-5=Everolimus申請"


//條件2:先前已使用過非類固醇類之芳香環酶抑制劑治療無效
define "規則1-2=先前已使用過非類固醇類之芳香環酶抑制劑治療無效":
  exists (
    [MedicationRequest] MRPlan
    where MRPlan.intent = 'plan'
      and exists (
        MRPlan.medication.coding Cdg
        where Cdg in CodeConcept.NHIMedication
          and Cdg.code in CodeConcept.Everolimus
      )
      and Reusable."HasValidTiming"(MRPlan)
      
      // 至少先前使用過其中一種
      and exists (
        [MedicationRequest] MROrder
        where MROrder.intent = 'order'
          and exists (
            MROrder.medication.coding Cdg
            where Cdg in CodeConcept.NHIMedication
              and (Cdg.code in CodeConcept.L02BG03 
                   or Cdg.code in CodeConcept.L02BG04)
          )
          and Reusable."HasValidTiming"(MROrder)
          // 須在申請之前使用
          and Reusable."GetEndTime"(MROrder) < Reusable."GetStartTime"(MRPlan)
      )
  )
  and Reusable."醫令類別為1"


//條件3:未曾使用exemestane (申請期間不能使用,但過去可以用過)
define "規則1-3=沒有使用exemestane":
  exists (
    [MedicationRequest] MRPlan
    where MRPlan.intent = 'plan'
      and exists (
        MRPlan.medication.coding Cdg
        where Cdg in CodeConcept.NHIMedication
          and Cdg.code in CodeConcept.Everolimus
      )
      and Reusable."HasValidTiming"(MRPlan)
      
      // 申請期間不能與 exemestane 時間重疊
      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.L02BG06
          )
          and Reusable."HasValidTiming"(MROrder)
          // 檢查時間是否重疊
          and Reusable."GetStartTime"(MRPlan) <= Reusable."GetEndTime"(MROrder)
          and Reusable."GetEndTime"(MRPlan) >= Reusable."GetStartTime"(MROrder)
      )
  )

//條件4:荷爾蒙接受體陽性、HER2受體陰性

//條件4-1
define "規則1-4-1=荷爾蒙接受體陽性(ER)":
  exists (
    [Observation] OBs
      where exists (
        OBs.category C
          where exists (
            C.coding Cdg
              where Cdg in CodeConcept.NHIPASSupportingInfoType
                and Cdg.code = 'tests'
          )
      )
      and exists (
        OBs.code.coding Cdg
          where Cdg in CodeConcept.LOINC
            and Cdg.code in CodeConcept.MolecularER
      )
      and exists (
        OBs.interpretation.coding INT
          where INT in CodeConcept.InterpretationCodes
            and INT.code in {'POS'}
      )
      and OBs.value is string
      and Matches(OBs.value as string, '(?i).*(\\+|陽性|positive).*')
  )

//條件4-2
define "規則1-4-2=荷爾蒙接受體陽性(PR)":
  exists (
    [Observation] OBs
      where exists (
        OBs.category C
          where exists (
            C.coding Cdg
              where Cdg in CodeConcept.NHIPASSupportingInfoType
                and Cdg.code = 'tests'
          )
      )
      and exists (
        OBs.code.coding Cdg
          where Cdg in CodeConcept.LOINC
            and Cdg.code in CodeConcept.MolecularPR
      )
      and exists (
        OBs.interpretation.coding INT
          where INT in CodeConcept.InterpretationCodes
            and INT.code in {'POS'}
      )
      and OBs.value is string
      and Matches(OBs.value as string, '(?i).*(\\+|陽性|positive).*')
  )


//條件4-3
define "規則1-4-3=HER2受體陰性":
  exists (
    [Observation] OBs
      where exists (
        OBs.category C
          where exists (
            C.coding Cdg
              where Cdg in CodeConcept.NHIPASSupportingInfoType
                and Cdg.code = 'tests'
          )
      )
      and exists (
        OBs.code.coding Cdg
          where Cdg in CodeConcept.LOINC
            and Cdg.code in CodeConcept.HER2
      )
      and exists (
        OBs.interpretation.coding INT
          where INT in CodeConcept.InterpretationCodes
            and INT.code in {'NEG'}
      )
      and OBs.value is string
      and Matches(OBs.value as string, '(?i).*([-−]|0|陰性|negative).*')
  )

define "規則1-4":
"規則1-4-1=荷爾蒙接受體陽性(ER)"
and "規則1-4-2=荷爾蒙接受體陽性(PR)"
and "規則1-4-3=HER2受體陰性"

//條件5:尚未出現器官轉移危急症狀 (visceral crisis)
define "規則1-5=尚未出現器官轉移危急症狀 (visceral crisis)":
  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()
    and O.conclusion is not null
    and Matches(O.conclusion, '(?i).*(no visceral crisis|\\+).*')
  ) 

/*規則2*/
//同 規則1-1-4=3個月內有檢查報告 及 規則1-1-1=3個月內影像報告

//主要規定一
define "主要規定一":
"規則1-1=轉移性乳癌"
and "規則1-2=先前已使用過非類固醇類之芳香環酶抑制劑治療無效"
and "規則1-3=沒有使用exemestane"
and "規則1-4"
and "規則1-5=尚未出現器官轉移危急症狀 (visceral crisis)"


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

//影像證據顯示病情有無惡化
// 取得前次治療紀錄(最近一次已完成的治療)
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.Everolimus
        )
        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:影像證據顯示病情有無惡化
define "規則1=影像證據顯示病情有無惡化":
  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個月為限
define "規則1=每次申請之療程以3個月為限":
  exists [MedicationRequest] MRPlan
  where MRPlan.intent = 'plan'
  and exists (
  MRPlan.medication.coding Cdg
  where Cdg in CodeConcept.NHIMedication
  and Cdg.code in CodeConcept.Everolimus
   )
  and days between
  start of (MRPlan.dosageInstruction[0].timing.repeat.bounds as Period)
  and
  end of (MRPlan.dosageInstruction[0].timing.repeat.bounds as Period)
  <= 84

//規則2:限每日最大劑量為10mg
define "規則2=每日最大劑量為10mg":
  exists (
    [MedicationRequest] MR
    where MR.intent = 'plan'
    and exists (
      MR.dosageInstruction DI
      where exists (
        DI.timing.code.coding C
        where C.code = 'QD'
      )
      and exists (
        DI.doseAndRate DR
        where (DR.dose as FHIR.SimpleQuantity) is not null
        and (DR.dose as FHIR.SimpleQuantity).value <= 10
        and (DR.dose as FHIR.SimpleQuantity).code = '{mg}'
        and (DR.dose as FHIR.SimpleQuantity).unit = 'mg'
      )
    )
  )

//主要規定三
define "主要規定三":
"規則1=每次申請之療程以3個月為限" and "規則2=每日最大劑量為10mg"


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

define function "符合項目"():
  // 主要規定一:初次使用條件
  (if "初次申請" and (
    "ICD代碼檢核_布林值" or 
    "醫令類別為1_布林值" or 
    "規則1-1-1=3個月內影像報告" or 
    "規則1-1-3=癌症分期分數或結果為M≠0" or 
    "規則1-1-4=3個月內有檢查報告" or 
    "規則1-1-5=Everolimus申請" or 
    "規則1-2=先前已使用過非類固醇類之芳香環酶抑制劑治療無效" or 
    "規則1-3=沒有使用exemestane" or 
    "規則1-4" or 
    "規則1-5=尚未出現器官轉移危急症狀 (visceral crisis)"
  )
    then '<主要規定一:初次使用條件>\n' +
         (if "ICD代碼檢核_布林值" 
           then '● ICD代碼檢核:主要疾病之ICD代碼使用C50\n' else '') +
         (if "醫令類別為1_布林值" 
           then '● 醫令類別檢核:醫令類別為1(癌症治療)\n' else '') +
         (if "規則1-1-1=3個月內影像報告" 
           then '● 規則1-1-1:3個月內影像報告\n' else '') +
         (if "規則1-1-3=癌症分期分數或結果為M≠0" 
           then '● 規則1-1-3:癌症分期分數或結果為M≠0(轉移性)\n' else '') +
         (if "規則1-1-4=3個月內有檢查報告" 
           then '● 規則1-1-4:3個月內有檢查報告\n' else '') +
         (if "規則1-1-5=Everolimus申請" 
           then '● 規則1-1-5:Everolimus申請\n' else '') +
         (if "規則1-2=先前已使用過非類固醇類之芳香環酶抑制劑治療無效" 
           then '● 規則1-2:先前已使用過非類固醇類之芳香環酶抑制劑治療\n' else '') +
         (if "規則1-3=沒有使用exemestane" 
           then '● 規則1-3:申請期間未併用exemestane\n' else '') +
         (if "規則1-4-1=荷爾蒙接受體陽性(ER)" 
           then '● 規則1-4-1:荷爾蒙接受體陽性(ER)\n' else '') +
         (if "規則1-4-2=荷爾蒙接受體陽性(PR)" 
           then '● 規則1-4-2:荷爾蒙接受體陽性(PR)\n' else '') +
         (if "規則1-4-3=HER2受體陰性" 
           then '● 規則1-4-3:HER2受體陰性\n' else '') +
         (if "規則1-5=尚未出現器官轉移危急症狀 (visceral crisis)" 
           then '● 規則1-5:尚未出現器官轉移危急症狀(visceral crisis)\n' else '') +
         '\n'
    else '') +
  
  // 主要規定二:續用條件
  (if "續用申請" and "規則1=影像證據顯示病情有無惡化"
    then '<主要規定二:續用條件-治療持續給付>\n' +
         '● 續用規則1:已檢附影像證據顯示病情狀態,確認無惡化\n' +
         '\n'
    else '') +
  
  // 主要規定三:藥品使用規則
  (if "規則1=每次申請之療程以3個月為限" or 
      "規則2=每日最大劑量為10mg"
    then '<主要規定三:藥品使用規則>\n' +
         (if "規則1=每次申請之療程以3個月為限" 
           then '● 規則3-1:申請療程≤3個月(84天)\n' else '') +
         (if "規則2=每日最大劑量為10mg" 
           then '● 規則3-2:每日劑量≤10mg\n' else '')
    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 "規則1=每次申請之療程以3個月為限" or 
      not "規則2=每日最大劑量為10mg"
    then '<主要規定三:藥品使用規則>\n' +
         (if not "規則1=每次申請之療程以3個月為限" 
           then '▲ 規則3-1:申請療程超過3個月(84天)\n' else '') +
         (if not "規則2=每日最大劑量為10mg" 
           then '▲ 規則3-2:每日劑量超過10mg\n' else '')
    else '')

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

define function "不符合項目_必要資料未填寫"():
  // 主要規定一:初次使用條件 - 必要資料未填寫
  (if "初次申請" and (
    not "規則1-1-1=3個月內影像報告" or 
    not "規則1-1-3=癌症分期分數或結果為M≠0" or 
    not "規則1-1-4=3個月內有檢查報告" or 
    not "規則1-1-5=Everolimus申請" or 
    not "規則1-2=先前已使用過非類固醇類之芳香環酶抑制劑治療無效" or 
    not "規則1-3=沒有使用exemestane" or 
    not "規則1-4" or 
    not "規則1-5=尚未出現器官轉移危急症狀 (visceral crisis)"
  )
    then '<主要規定一:初次使用條件>\n' +
         (if not "規則1-1-1=3個月內影像報告" 
           then '▲ 規則1-1-1:未提供3個月內影像報告\n' else '') +
         (if not "規則1-1-3=癌症分期分數或結果為M≠0" 
           then '▲ 規則1-1-3:未提供癌症分期資料或非轉移性(M=0)\n' else '') +
         (if not "規則1-1-4=3個月內有檢查報告" 
           then '▲ 規則1-1-4:未提供3個月內檢查報告\n' else '') +
         (if not "規則1-1-5=Everolimus申請" 
           then '▲ 規則1-1-5:未提供Everolimus申請資料\n' else '') +
         (if not "規則1-2=先前已使用過非類固醇類之芳香環酶抑制劑治療無效" 
           then '▲ 規則1-2:未提供非類固醇類之芳香環酶抑制劑治療紀錄\n' else '') +
         (if not "規則1-3=沒有使用exemestane" 
           then '▲ 規則1-3:申請期間併用exemestane(禁止併用)\n' else '') +
         (if not "規則1-4-1=荷爾蒙接受體陽性(ER)" 
           then '▲ 規則1-4-1:未提供ER檢測資料或ER非陽性\n' else '') +
         (if not "規則1-4-2=荷爾蒙接受體陽性(PR)" 
           then '▲ 規則1-4-2:未提供PR檢測資料或PR非陽性\n' else '') +
         (if not "規則1-4-3=HER2受體陰性" 
           then '▲ 規則1-4-3:未提供HER2檢測資料或HER2非陰性\n' else '') +
         (if not "規則1-5=尚未出現器官轉移危急症狀 (visceral crisis)" 
           then '▲ 規則1-5:未提供影像資料或已出現器官轉移危急症狀(visceral crisis)\n' else '') +
         '\n'
    else '') +
  
  // 主要規定二:續用條件 - 必要資料未填寫
  (if "續用申請" and not "規則1=影像證據顯示病情有無惡化"
    then '<主要規定二:續用條件-治療持續給付>\n' +
         '▲ 續用規則1:未提供影像證據或顯示疾病惡化\n' +
         '\n'
    else '')

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

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

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

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

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

define "報告總結":
  '\n=== 乳癌之Everolimus申請審核報告 ===\n' +
  '\n【申請類型】' + "申請類型" + '\n' +
  '\n【●符合項目】\n' +
  (if "符合項目"() = '' then '無\n' else "符合項目"()) +
  '\n【▲不符合項目 - 代碼或條件不符】\n' +
  (if "不符合項目_代碼或條件不符"() = '' then '無\n' else "不符合項目_代碼或條件不符"()) +
  '\n【▲不符合項目 - 必要資料未填寫】\n' +
  (if "不符合項目_必要資料未填寫"() = '' then '無\n' else "不符合項目_必要資料未填寫"()) +
  '\n【申請結果】\n' +
  "乳癌Everolimus申請之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