Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: RORX009

RORX009.m

Go to the documentation of this file.
  1. RORX009 ;HCIOFO/SG - PHARMACY PRESCRIPTION UTILIZATION ;11/16/05 10:49am
  1. ;;1.5;CLINICAL CASE REGISTRIES;**21,31**;Feb 17, 2006;Build 62
  1. ;
  1. ;******************************************************************************
  1. ; --- ROUTINE MODIFICATION LOG ---
  1. ;
  1. ;PKG/PATCH DATE DEVELOPER MODIFICATION
  1. ;----------- ---------- ----------- ----------------------------------------
  1. ;ROR*1.5*21 SEP 2013 T KOPP Added ICN as last report column if
  1. ; additional identifier option selected
  1. ;ROR*1.5*31 MAY 2017 M FERRARESE Adding PACT, PCP, and AGE/DOB as additional
  1. ; identifiers.
  1. ;******************************************************************************
  1. ;
  1. Q
  1. ;
  1. ;***** OUTPUTS THE REPORT HEADER
  1. ;
  1. ; PARTAG Reference (IEN) to the parent tag
  1. ;
  1. ; Return Values:
  1. ; <0 Error code
  1. ; >0 IEN of the HEADER element
  1. ;
  1. ;;DOSES(NP,IPNRX)^I $$PARAM^RORTSK01("PATIENTS","INPATIENT")
  1. ;;DRUGS_DOSES(#,NAME,NP,IPNRX,MAXNRPP,MAXNP)
  1. ;;DRUGS_FILLS(#,NAME,NP,OPNRX,MAXNRPP,MAXNP)
  1. ;;FILLS(NP,OPNRX)^I $$PARAM^RORTSK01("PATIENTS","OUTPATIENT")
  1. ;;HU_DOSES(#,NAME,LAST4,DOD,IPNRX,ND,ICN,PACT,PCP)^I $$PARAM^RORTSK01("PATIENTS","INPATIENT"),$$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
  1. ;;HU_DOSES(#,NAME,LAST4,AGE,DOD,IPNRX,ND,ICN,PACT,PCP)^I $$PARAM^RORTSK01("PATIENTS","INPATIENT"),$$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
  1. ;;HU_DOSES(#,NAME,LAST4,DOB,DOD,IPNRX,ND,ICN,PACT,PCP)^I $$PARAM^RORTSK01("PATIENTS","INPATIENT"),$$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
  1. ;;HU_FILLS(#,NAME,LAST4,DOD,OPNRX,ND,ICN,PACT,PCP)^I $$PARAM^RORTSK01("PATIENTS","OUTPATIENT"),$$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
  1. ;;HU_FILLS(#,NAME,LAST4,AGE,DOD,OPNRX,ND,ICN,PACT,PCP)^I $$PARAM^RORTSK01("PATIENTS","OUTPATIENT"),$$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
  1. ;;HU_FILLS(#,NAME,LAST4,DOB,DOD,OPNRX,ND,ICN,PACT,PCP)^I $$PARAM^RORTSK01("PATIENTS","OUTPATIENT"),$$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
  1. ;;HU_NRX(#,NAME,LAST4,DOD,OPNRX,IPNRX,ND,ICN,PACT,PCP)^I $$PARAM^RORTSK01("PATIENTS","OUTPATIENT"),$$PARAM^RORTSK01("PATIENTS","INPATIENT"),$$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
  1. ;;HU_NRX(#,NAME,LAST4,AGE,DOD,OPNRX,IPNRX,ND,ICN,PACT,PCP)^I $$PARAM^RORTSK01("PATIENTS","OUTPATIENT"),$$PARAM^RORTSK01("PATIENTS","INPATIENT"),$$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
  1. ;;HU_NRX(#,NAME,LAST4,DOB,DOD,OPNRX,IPNRX,ND,ICN,PACT,PCP)^I $$PARAM^RORTSK01("PATIENTS","OUTPATIENT"),$$PARAM^RORTSK01("PATIENTS","INPATIENT"),$$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
  1. ;
  1. N HEADER,RC
  1. S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
  1. Q:HEADER<0 HEADER
  1. S RC=$$TBLDEF^RORXU002("HEADER^RORX009",HEADER)
  1. Q $S(RC<0:RC,1:HEADER)
  1. ;
  1. ;***** OUTPUTS THE PARAMETERS TO THE REPORT
  1. ;
  1. ; PARTAG Reference (IEN) to the parent tag
  1. ;
  1. ; [.STDT] Start and end dates of the report
  1. ; [.ENDT] are returned via these parameters
  1. ;
  1. ; [.FLAGS] Flags for the $$SKIP^RORXU005 are
  1. ; returned via this parameter
  1. ;
  1. ; Return Values:
  1. ; <0 Error code
  1. ; >0 IEN of the PARAMETERS element
  1. ;
  1. PARAMS(PARTAG,STDT,ENDT,FLAGS) ;
  1. N NAME,PARAMS,TMP
  1. S PARAMS=$$PARAMS^RORXU002(.RORTSK,PARTAG,.STDT,.ENDT,.FLAGS)
  1. Q:PARAMS<0 PARAMS
  1. ;--- Process the drug list and options
  1. S TMP=$$DRUGLST^RORXU007(.RORTSK,PARAMS,.RORXL,.RORXGRP)
  1. Q:TMP<0 TMP
  1. ;--- Additional parameters
  1. F NAME="MAXUTNUM" D
  1. . S TMP=$$PARAM^RORTSK01(NAME)
  1. . D:TMP'="" ADDVAL^RORTSK11(RORTSK,NAME,TMP,PARAMS)
  1. ;---
  1. Q PARAMS
  1. ;
  1. ;***** COMPILES THE "PHARMACY PRESCRIPTION UTILIZATION" REPORT
  1. ; REPORT CODE: 009
  1. ;
  1. ; .RORTSK Task number and task parameters
  1. ;
  1. ; The ^TMP("RORX009",$J) global node is used by this function.
  1. ;
  1. ; ^TMP("RORX009",$J,
  1. ;
  1. ; "IP", Number of inpatients
  1. ; DFN, Patient's data
  1. ; ^01: Last 4 digits of SSN
  1. ; ^02: Name
  1. ; ^03: Date of Death
  1. ; ^04: Total number of doses
  1. ; ^05: Number of different drugs
  1. ; ^06: National ICN
  1. ; ^07: PACT Patient care team
  1. ; ^08: PCP Primary care physician
  1. ; ^09: AGE/DOB
  1. ; "D",
  1. ; DrugIEN) Quantity
  1. ;
  1. ; "IPD", Number of different drugs
  1. ; DrugIEN, Drug Name
  1. ; "D") Number of doses
  1. ; "M") Maximum
  1. ; ^01: Maximum number of doses
  1. ; ^02: Number of patients
  1. ; "P") Number of patients
  1. ; "B",
  1. ; NumOfDoses,
  1. ; DrugName,
  1. ; DrugIEN) ""
  1. ;
  1. ; "IPRX", Total number of doses
  1. ; NumOfDoses, Number of patients
  1. ; PatientName,
  1. ; DFN) ""
  1. ;
  1. ; "OP", Number of outpatients
  1. ; DFN, Patient's data
  1. ; ^01: Last 4 digits of SSN
  1. ; ^02: Name
  1. ; ^03: Date of Death
  1. ; ^04: Total number of fills
  1. ; ^05: Number of different drugs
  1. ; ^06: National ICN
  1. ; ^07: PACT Patient care team
  1. ; ^08: PCP Primary care physician
  1. ; ^09: AGE/DOB
  1. ; "D",
  1. ; DrugIEN) Quantity
  1. ;
  1. ; "OPD", Number of different drugs
  1. ; DrugIEN, Drug Name
  1. ; "D") Number of fills
  1. ; "M") Maximum
  1. ; ^01: Maximum number of fills
  1. ; ^02: Number of patients
  1. ; "P") Number of patients
  1. ; "B",
  1. ; NumOfFills,
  1. ; DrugName,
  1. ; DrugIEN) ""
  1. ;
  1. ; "OPRX", Total number of fills
  1. ; NumOfFills, Number of patients
  1. ; PatientName,
  1. ; DFN) ""
  1. ;
  1. ; "SUMRX",
  1. ; NumberOfRX, Number of patients
  1. ; PatientName,
  1. ; DFN, Number of different drugs
  1. ; "IP")
  1. ; "OP")
  1. ;
  1. ; Return Values:
  1. ; <0 Error code
  1. ; 0 Ok
  1. ;
  1. RXUTIL(RORTSK) ;
  1. N ROREDT ; End date
  1. N RORREG ; Registry IEN
  1. N RORSDT ; Start date
  1. N RORXGRP ; List of drug groups
  1. N RORXL ; List of drugs for the pharmacy search API
  1. ;
  1. N ECNT,RC,REPORT,SFLAGS,TMP
  1. S RORXL="",(ECNT,RC)=0
  1. K ^TMP("RORX009",$J)
  1. ;--- Root node of the report
  1. S REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
  1. Q:REPORT<0 REPORT
  1. ;
  1. D
  1. . ;--- Get and prepare the report parameters
  1. . S RORREG=$$PARAM^RORTSK01("REGIEN")
  1. . S RC=$$PARAMS(REPORT,.RORSDT,.ROREDT,.SFLAGS) Q:RC<0
  1. . ;--- Report header
  1. . S RC=$$HEADER(REPORT) Q:RC<0
  1. . ;--- Query the registry
  1. . D TPPSETUP^RORTSK01(80)
  1. . S RC=$$QUERY^RORX009A(SFLAGS)
  1. . I RC Q:RC<0 S ECNT=ECNT+RC
  1. . ;--- Sort the data
  1. . D TPPSETUP^RORTSK01(10)
  1. . S RC=$$SORT^RORX009A()
  1. . I RC Q:RC<0 S ECNT=ECNT+RC
  1. . ;--- Store the results
  1. . D TPPSETUP^RORTSK01(10)
  1. . S RC=$$STORE^RORX009C(REPORT)
  1. . I RC Q:RC<0 S ECNT=ECNT+RC
  1. ;
  1. ;--- Cleanup
  1. K ^TMP("RORX009",$J)
  1. D FREE^RORTMP(RORXL)
  1. Q $S(RC<0:RC,ECNT>0:-43,1:0)