Reusable
type: Library
node role: treeRoot
id:
  v: Reusable
text:
  status:
    v: extensions
  div:
    v: Id: Reusable Version: 1.0.0 Url: Reusable Type: system: http://terminology.hl7.org/CodeSystem/library-type code: logic-library Date: 2025-10-30 08:19:00+0000 Content: text/cql library Reusable version '1.0.0' using FHIR version '4.0.1' include FHIRHelpers version '4.0.1' called FHIRHelpers include CRCCodeConcept version '1.0.0' called CodeConcept define "續用註記為1": exists ( [Claim] C where exists ( C.item I where exists ( I.modifier M where exists ( M.coding Cdg where Cdg.system = 'https://nhicore.nhi.gov.tw/pas/CodeSystem/nhi-continuation-status' and Cdg.code in CodeConcept."續用註記為1" ) ) ) ) //續用判斷 define "續用註記為2": exists ( [Claim] C where exists ( C.item I where exists ( I.modifier M where exists ( M.coding Cdg where Cdg.system = 'https://nhicore.nhi.gov.tw/pas/CodeSystem/nhi-continuation-status' and Cdg.code in CodeConcept."續用註記為2" ) ) ) ) // 醫令類別=1 (orderType = '1') define "醫令類別為1": exists ( [Claim] C where exists ( C.item I where exists ( I.productOrService.coding PSC where PSC.system = 'https://nhicore.nhi.gov.tw/pas/CodeSystem/nhi-order-type' and PSC.code in CodeConcept."醫令類別" ) ) ) // 檢查 MedicationRequest 是否有有效的時間資訊 define function "HasValidTiming"(MR MedicationRequest): MR.dosageInstruction is not null and Count(MR.dosageInstruction) > 0 and MR.dosageInstruction[0].timing is not null and MR.dosageInstruction[0].timing.repeat is not null and MR.dosageInstruction[0].timing.repeat.bounds is Period and (MR.dosageInstruction[0].timing.repeat.bounds as Period).start is not null and (MR.dosageInstruction[0].timing.repeat.bounds as Period).end is not null // 取得 MedicationRequest 的起始時間 define function "GetStartTime"(MR MedicationRequest): (MR.dosageInstruction[0].timing.repeat.bounds as Period).start // 取得 MedicationRequest 的結束時間 define function "GetEndTime"(MR MedicationRequest): (MR.dosageInstruction[0].timing.repeat.bounds as Period).end // 檢查 Plan 的時間範圍是否在 Order 的時間範圍內 define function "PlanTimeWithinOrderTime"(MRPlan MedicationRequest, MROrder MedicationRequest): "…
url:
  v: https://nhicore.nhi.gov.tw/cql/Library/Reusable
  l: Reusable
version:
  v: 1.0.0
name:
  v: Reusable
status:
  v: active
experimental:
  v: false
type:
  coding:
    system:
      v: http://terminology.hl7.org/CodeSystem/library-type
      l: library-type
    code:
      v: logic-library
date:
  v: 2025-10-30T08:19:00+00:00
content:
  content type:
    v: text/cql
content:
  content type:
    v: application/elm+xml
content:
  content type:
    v: application/elm+json