RORX006 ;HCIOFO/BH,SG - LAB UTILIZATION ;11/8/05 8:53am
;;1.5;CLINICAL CASE REGISTRIES;**21,31**;Feb 17, 2006;Build 62
;
;******************************************************************************
; --- ROUTINE MODIFICATION LOG ---
;
;PKG/PATCH DATE DEVELOPER MODIFICATION
;----------- ---------- ----------- ----------------------------------------
;ROR*1.5*21 SEP 2013 T KOPP Add ICN column if Additional Identifier
; requested.
;ROR*1.5*31 MAY 2017 M FERRARESE Adding PACT ,PCP, and AGE/DOB as additional
; identifiers.
;******************************************************************************
;
Q
;
;***** OUTPUTS THE REPORT HEADER
;
; PARTAG Reference (IEN) to the parent tag
;
; Return Values:
; <0 Error code
; >0 IEN of the HEADER element
;
;;LABTESTS(#,NAME,NP,NR,MAXNRPP,MAXNP)
;;PATIENTS(#,NAME,LAST4,AGE,DOD,NO,NR,NDT,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
;;PATIENTS(#,NAME,LAST4,DOB,DOD,NO,NR,NDT,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
;;PATIENTS(#,NAME,LAST4,DOD,NO,NR,NDT,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
;;RESULTS(NP,NR)
;
N HEADER,RC
S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
Q:HEADER<0 HEADER
S RC=$$TBLDEF^RORXU002("HEADER^RORX006",HEADER)
Q $S(RC<0:RC,1:HEADER)
;
;
;***** COMPILES THE "LAB UTILIZATION" REPORT
; REPORT CODE: 006
;
; .RORTSK Task number and task parameters
;
; The ^TMP("RORX006",$J) global node is used by this function.
;
; ^TMP("RORX006",$J,
;
; "ORD", Total number of orders
; NumOfOrd, Number of patients
; PatientName,
; DFN)
;
; "PAT", Total number of patients
; DFN, Patient descriptor
; 01: Last 4 digits of SSN
; 02: Date of death
; "O") Number of orders
; "R", Results
; ^01: Number of results
; ^02: Number of different tests
; TestIEN) Number of results
;
; "RES", Totals
; ^01: Total number of results
; ^02: Number of different tests
; TestIEN,
; "M") Maximum
; ^01: Maximum number of results
; ^02: Number of patients
; "P") Number of patients
; "R") Number of results
; "B",
; NumOfRes,
; TestName,
; TestIEN)
;
; "RES1",
; NumOfResults, Number of patients
; PatientName,
; DFN)
;
; Return Values:
; <0 Error code
; 0 Ok
;
LABUTL(RORTSK) ;
N ROREDT ; End date
N ROREDT1 ; End date + 1 day
N RORLTST ; Closed root of the list of lab tests
N RORREG ; Registry IEN
N RORSDT ; Start date
;
N ECNT,RC,REPORT,SFLAGS,TMP
K ^TMP("RORX006",$J)
S RORLTST="",(ECNT,RC)=0
;--- Root node of the report
S REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
Q:REPORT<0 REPORT
;
D
. ;--- Get and prepare the report parameters
. S RORREG=$$PARAM^RORTSK01("REGIEN")
. S RC=$$PARAMS(REPORT,.RORSDT,.ROREDT,.SFLAGS) Q:RC<0
. S ROREDT1=$$FMADD^XLFDT(ROREDT\1,1)
. ;--- Report header
. S RC=$$HEADER(REPORT) Q:RC<0
. ;--- Query the registry
. D TPPSETUP^RORTSK01(70)
. S RC=$$QUERY^RORX006A(SFLAGS)
. I RC Q:RC<0 S ECNT=ECNT+RC
. ;--- Sort the data
. D TPPSETUP^RORTSK01(15)
. S RC=$$SORT^RORX006A()
. I RC Q:RC<0 S ECNT=ECNT+RC
. ;--- Store the results
. D TPPSETUP^RORTSK01(15)
. S RC=$$STORE^RORX006C(REPORT)
. I RC Q:RC<0 S ECNT=ECNT+RC
;
;--- Cleanup
D FREE^RORTMP(RORLTST)
K ^TMP("RORX006",$J)
Q $S(RC<0:RC,ECNT>0:-43,1:0)
;
;***** OUTPUTS PARAMETERS TO THE REPORT
;
; PARTAG Reference (IEN) to the parent tag
;
; [.STDT] Start and end dates of the report
; [.ENDT] are returned via these parameters
;
; [.FLAGS] Flags for the $$SKIP^RORXU005 are
; returned via this parameter
;
; Return Values:
; <0 Error code
; >0 IEN of the PARAMETERS element
;
PARAMS(PARTAG,STDT,ENDT,FLAGS) ;
N NAME,PARAMS,TMP
S PARAMS=$$PARAMS^RORXU002(.RORTSK,PARTAG,.STDT,.ENDT,.FLAGS)
Q:PARAMS<0 PARAMS
;--- Additional parameters
F NAME="MAXUTNUM","MINRPNUM" D
. S TMP=$$PARAM^RORTSK01(NAME)
. D:TMP'="" ADDVAL^RORTSK11(RORTSK,NAME,TMP,PARAMS)
;--- Process the list of Lab tests
S TMP=$$LTLST^RORXU006(.RORTSK,PARAMS,.RORLTST) Q:TMP<0 TMP
;---
Q PARAMS
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRORX006 4878 printed Oct 16, 2024@17:45:15 Page 2
RORX006 ;HCIOFO/BH,SG - LAB UTILIZATION ;11/8/05 8:53am
+1 ;;1.5;CLINICAL CASE REGISTRIES;**21,31**;Feb 17, 2006;Build 62
+2 ;
+3 ;******************************************************************************
+4 ; --- ROUTINE MODIFICATION LOG ---
+5 ;
+6 ;PKG/PATCH DATE DEVELOPER MODIFICATION
+7 ;----------- ---------- ----------- ----------------------------------------
+8 ;ROR*1.5*21 SEP 2013 T KOPP Add ICN column if Additional Identifier
+9 ; requested.
+10 ;ROR*1.5*31 MAY 2017 M FERRARESE Adding PACT ,PCP, and AGE/DOB as additional
+11 ; identifiers.
+12 ;******************************************************************************
+13 ;
+14 QUIT
+15 ;
+16 ;***** OUTPUTS THE REPORT HEADER
+17 ;
+18 ; PARTAG Reference (IEN) to the parent tag
+19 ;
+20 ; Return Values:
+21 ; <0 Error code
+22 ; >0 IEN of the HEADER element
+23 ;
+1 ;;LABTESTS(#,NAME,NP,NR,MAXNRPP,MAXNP)
+2 ;;PATIENTS(#,NAME,LAST4,AGE,DOD,NO,NR,NDT,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
+3 ;;PATIENTS(#,NAME,LAST4,DOB,DOD,NO,NR,NDT,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
+4 ;;PATIENTS(#,NAME,LAST4,DOD,NO,NR,NDT,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
+5 ;;RESULTS(NP,NR)
+6 ;
+7 NEW HEADER,RC
+8 SET HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
+9 if HEADER<0
QUIT HEADER
+10 SET RC=$$TBLDEF^RORXU002("HEADER^RORX006",HEADER)
+11 QUIT $SELECT(RC<0:RC,1:HEADER)
+12 ;
+13 ;
+14 ;***** COMPILES THE "LAB UTILIZATION" REPORT
+15 ; REPORT CODE: 006
+16 ;
+17 ; .RORTSK Task number and task parameters
+18 ;
+19 ; The ^TMP("RORX006",$J) global node is used by this function.
+20 ;
+21 ; ^TMP("RORX006",$J,
+22 ;
+23 ; "ORD", Total number of orders
+24 ; NumOfOrd, Number of patients
+25 ; PatientName,
+26 ; DFN)
+27 ;
+28 ; "PAT", Total number of patients
+29 ; DFN, Patient descriptor
+30 ; 01: Last 4 digits of SSN
+31 ; 02: Date of death
+32 ; "O") Number of orders
+33 ; "R", Results
+34 ; ^01: Number of results
+35 ; ^02: Number of different tests
+36 ; TestIEN) Number of results
+37 ;
+38 ; "RES", Totals
+39 ; ^01: Total number of results
+40 ; ^02: Number of different tests
+41 ; TestIEN,
+42 ; "M") Maximum
+43 ; ^01: Maximum number of results
+44 ; ^02: Number of patients
+45 ; "P") Number of patients
+46 ; "R") Number of results
+47 ; "B",
+48 ; NumOfRes,
+49 ; TestName,
+50 ; TestIEN)
+51 ;
+52 ; "RES1",
+53 ; NumOfResults, Number of patients
+54 ; PatientName,
+55 ; DFN)
+56 ;
+57 ; Return Values:
+58 ; <0 Error code
+59 ; 0 Ok
+60 ;
LABUTL(RORTSK) ;
+1 ; End date
NEW ROREDT
+2 ; End date + 1 day
NEW ROREDT1
+3 ; Closed root of the list of lab tests
NEW RORLTST
+4 ; Registry IEN
NEW RORREG
+5 ; Start date
NEW RORSDT
+6 ;
+7 NEW ECNT,RC,REPORT,SFLAGS,TMP
+8 KILL ^TMP("RORX006",$JOB)
+9 SET RORLTST=""
SET (ECNT,RC)=0
+10 ;--- Root node of the report
+11 SET REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
+12 if REPORT<0
QUIT REPORT
+13 ;
+14 Begin DoDot:1
+15 ;--- Get and prepare the report parameters
+16 SET RORREG=$$PARAM^RORTSK01("REGIEN")
+17 SET RC=$$PARAMS(REPORT,.RORSDT,.ROREDT,.SFLAGS)
if RC<0
QUIT
+18 SET ROREDT1=$$FMADD^XLFDT(ROREDT\1,1)
+19 ;--- Report header
+20 SET RC=$$HEADER(REPORT)
if RC<0
QUIT
+21 ;--- Query the registry
+22 DO TPPSETUP^RORTSK01(70)
+23 SET RC=$$QUERY^RORX006A(SFLAGS)
+24 IF RC
if RC<0
QUIT
SET ECNT=ECNT+RC
+25 ;--- Sort the data
+26 DO TPPSETUP^RORTSK01(15)
+27 SET RC=$$SORT^RORX006A()
+28 IF RC
if RC<0
QUIT
SET ECNT=ECNT+RC
+29 ;--- Store the results
+30 DO TPPSETUP^RORTSK01(15)
+31 SET RC=$$STORE^RORX006C(REPORT)
+32 IF RC
if RC<0
QUIT
SET ECNT=ECNT+RC
End DoDot:1
+33 ;
+34 ;--- Cleanup
+35 DO FREE^RORTMP(RORLTST)
+36 KILL ^TMP("RORX006",$JOB)
+37 QUIT $SELECT(RC<0:RC,ECNT>0:-43,1:0)
+38 ;
+39 ;***** OUTPUTS PARAMETERS TO THE REPORT
+40 ;
+41 ; PARTAG Reference (IEN) to the parent tag
+42 ;
+43 ; [.STDT] Start and end dates of the report
+44 ; [.ENDT] are returned via these parameters
+45 ;
+46 ; [.FLAGS] Flags for the $$SKIP^RORXU005 are
+47 ; returned via this parameter
+48 ;
+49 ; Return Values:
+50 ; <0 Error code
+51 ; >0 IEN of the PARAMETERS element
+52 ;
PARAMS(PARTAG,STDT,ENDT,FLAGS) ;
+1 NEW NAME,PARAMS,TMP
+2 SET PARAMS=$$PARAMS^RORXU002(.RORTSK,PARTAG,.STDT,.ENDT,.FLAGS)
+3 if PARAMS<0
QUIT PARAMS
+4 ;--- Additional parameters
+5 FOR NAME="MAXUTNUM","MINRPNUM"
Begin DoDot:1
+6 SET TMP=$$PARAM^RORTSK01(NAME)
+7 if TMP'=""
DO ADDVAL^RORTSK11(RORTSK,NAME,TMP,PARAMS)
End DoDot:1
+8 ;--- Process the list of Lab tests
+9 SET TMP=$$LTLST^RORXU006(.RORTSK,PARAMS,.RORLTST)
if TMP<0
QUIT TMP
+10 ;---
+11 QUIT PARAMS