RORX016 ;HCIOFO/BH,SG - OUTPATIENT UTILIZATION ;10/14/05 2:06pm
;;1.5;CLINICAL CASE REGISTRIES;**21,31**;Feb 17, 2006;Build 62
;
Q
;******************************************************************************
; --- ROUTINE MODIFICATION LOG ---
;
;PKG/PATCH DATE DEVELOPER MODIFICATION
;----------- ---------- ----------- ----------------------------------------
;ROR*1.5*21 SEP 2013 T KOPP Added ICN as last report column if
; additional identifier option selected
;ROR*1.5*31 MAY 2017 M FERRARESE Adding PACT, PCP, and AGE/DOB as additional
; identifiers.
;******************************************************************************
;
;***** OUTPUTS THE REPORT HEADER
;
; PARTAG Reference (IEN) to the parent tag
;
; Return Values:
; <0 Error code
; >0 IEN of the HEADER element
;
;;CLINICS(#,STOP,NAME,NP,NV,NSC)
;;HU_STOPS(#,NAME,LAST4,AGE,NV,NSC,NDS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
;;HU_STOPS(#,NAME,LAST4,DOB,NV,NSC,NDS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
;;HU_STOPS(#,NAME,LAST4,NV,NSC,NDS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
;;STOPS(NP,NSC)
;
N HEADER,RC
S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
Q:HEADER<0 HEADER
S RC=$$TBLDEF^RORXU002("HEADER^RORX016",HEADER)
Q $S(RC<0:RC,1:HEADER)
;
;
;***** COMPILES THE "OUTPATIENT UTILIZATION" REPORT
; REPORT CODE: 016
;
; .RORTSK Task number and task parameters
;
; The ^TMP("RORX016",$J) global node is used by this function.
;
; ^TMP("RORX016",$J,
;
; "OP", Number of outpatients
; DFN, Patient's data
; ^01: Number of stops
; ^02: Number of different stops
; ^03: Last 4 digits of SSN
; ^04: Number of visits
; ^05: National ICN
; ^06: Patient Care Team
; ^07: Primary Care Provider
; ^08: Age/DOB
; Children of this node are KILL'ed by
; the $$TOTALS^RORX016B function.
; Date, Number of stops associated with the visit
; StopCode) Quantity
;
; "OPS", Totals
; ^01: Total number of stops
; ^02: Number of different stops
; StopCode, Name of the Clinic Stop Code
; "P") Number of patients
; "S") Quantity
; "V") Number of visits
;
; "OPS1",
; NumOfStops, Number of patients
; PatientName,
; DFN)
;
; "OPV") Total number of visits
;
; Return Values:
; <0 Error code
; 0 Ok
;
OPUTL(RORTSK) ;
N RORDIV ; List of division IEN's
N ROREDT ; End date
N RORREG ; Registry IEN
N RORSDT ; Start date
;
N ECNT,RC,REPORT,SFLAGS,TMP
S (ECNT,RC)=0 K ^TMP("RORX016",$J)
;--- Root node of the report
S REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
Q:REPORT<0 REPORT
;
;--- Get and prepare the report parameters
S RORREG=$$PARAM^RORTSK01("REGIEN")
S RC=$$PARAMS(REPORT,.RORSDT,.ROREDT,.SFLAGS) Q:RC<0 RC
;
;--- Report header
S RC=$$HEADER(REPORT) Q:RC<0 RC
;
D
. ;--- Query the registry
. D TPPSETUP^RORTSK01(70)
. S RC=$$QUERY^RORX016A(SFLAGS)
. I RC Q:RC<0 S ECNT=ECNT+RC
. ;--- Sort the data
. D TPPSETUP^RORTSK01(15)
. S RC=$$SORT^RORX016B()
. I RC Q:RC<0 S ECNT=ECNT+RC
. ;--- Store the results
. D TPPSETUP^RORTSK01(15)
. S RC=$$STORE^RORX016C(REPORT)
. I RC Q:RC<0 S ECNT=ECNT+RC
;
;--- Cleanup
K ^TMP("RORX016",$J)
Q $S(RC<0:RC,ECNT>0:-43,1:0)
;
;***** OUTPUTS THE 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
;--- Process the list of divisions
S TMP=$$DIVLST^RORXU006(.RORTSK,PARAMS)
Q:TMP<0 TMP
;--- Additional parameters
F NAME="MAXUTNUM" D
. S TMP=$$PARAM^RORTSK01(NAME)
. D:TMP'="" ADDVAL^RORTSK11(RORTSK,NAME,TMP,PARAMS)
;---
Q PARAMS
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRORX016 4795 printed Dec 13, 2024@01:44:45 Page 2
RORX016 ;HCIOFO/BH,SG - OUTPATIENT UTILIZATION ;10/14/05 2:06pm
+1 ;;1.5;CLINICAL CASE REGISTRIES;**21,31**;Feb 17, 2006;Build 62
+2 ;
+3 QUIT
+4 ;******************************************************************************
+5 ; --- ROUTINE MODIFICATION LOG ---
+6 ;
+7 ;PKG/PATCH DATE DEVELOPER MODIFICATION
+8 ;----------- ---------- ----------- ----------------------------------------
+9 ;ROR*1.5*21 SEP 2013 T KOPP Added ICN as last report column if
+10 ; additional identifier option selected
+11 ;ROR*1.5*31 MAY 2017 M FERRARESE Adding PACT, PCP, and AGE/DOB as additional
+12 ; identifiers.
+13 ;******************************************************************************
+14 ;
+15 ;***** OUTPUTS THE REPORT HEADER
+16 ;
+17 ; PARTAG Reference (IEN) to the parent tag
+18 ;
+19 ; Return Values:
+20 ; <0 Error code
+21 ; >0 IEN of the HEADER element
+22 ;
+1 ;;CLINICS(#,STOP,NAME,NP,NV,NSC)
+2 ;;HU_STOPS(#,NAME,LAST4,AGE,NV,NSC,NDS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
+3 ;;HU_STOPS(#,NAME,LAST4,DOB,NV,NSC,NDS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
+4 ;;HU_STOPS(#,NAME,LAST4,NV,NSC,NDS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
+5 ;;STOPS(NP,NSC)
+6 ;
+7 NEW HEADER,RC
+8 SET HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
+9 if HEADER<0
QUIT HEADER
+10 SET RC=$$TBLDEF^RORXU002("HEADER^RORX016",HEADER)
+11 QUIT $SELECT(RC<0:RC,1:HEADER)
+12 ;
+13 ;
+14 ;***** COMPILES THE "OUTPATIENT UTILIZATION" REPORT
+15 ; REPORT CODE: 016
+16 ;
+17 ; .RORTSK Task number and task parameters
+18 ;
+19 ; The ^TMP("RORX016",$J) global node is used by this function.
+20 ;
+21 ; ^TMP("RORX016",$J,
+22 ;
+23 ; "OP", Number of outpatients
+24 ; DFN, Patient's data
+25 ; ^01: Number of stops
+26 ; ^02: Number of different stops
+27 ; ^03: Last 4 digits of SSN
+28 ; ^04: Number of visits
+29 ; ^05: National ICN
+30 ; ^06: Patient Care Team
+31 ; ^07: Primary Care Provider
+32 ; ^08: Age/DOB
+33 ; Children of this node are KILL'ed by
+34 ; the $$TOTALS^RORX016B function.
+35 ; Date, Number of stops associated with the visit
+36 ; StopCode) Quantity
+37 ;
+38 ; "OPS", Totals
+39 ; ^01: Total number of stops
+40 ; ^02: Number of different stops
+41 ; StopCode, Name of the Clinic Stop Code
+42 ; "P") Number of patients
+43 ; "S") Quantity
+44 ; "V") Number of visits
+45 ;
+46 ; "OPS1",
+47 ; NumOfStops, Number of patients
+48 ; PatientName,
+49 ; DFN)
+50 ;
+51 ; "OPV") Total number of visits
+52 ;
+53 ; Return Values:
+54 ; <0 Error code
+55 ; 0 Ok
+56 ;
OPUTL(RORTSK) ;
+1 ; List of division IEN's
NEW RORDIV
+2 ; End date
NEW ROREDT
+3 ; Registry IEN
NEW RORREG
+4 ; Start date
NEW RORSDT
+5 ;
+6 NEW ECNT,RC,REPORT,SFLAGS,TMP
+7 SET (ECNT,RC)=0
KILL ^TMP("RORX016",$JOB)
+8 ;--- Root node of the report
+9 SET REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
+10 if REPORT<0
QUIT REPORT
+11 ;
+12 ;--- Get and prepare the report parameters
+13 SET RORREG=$$PARAM^RORTSK01("REGIEN")
+14 SET RC=$$PARAMS(REPORT,.RORSDT,.ROREDT,.SFLAGS)
if RC<0
QUIT RC
+15 ;
+16 ;--- Report header
+17 SET RC=$$HEADER(REPORT)
if RC<0
QUIT RC
+18 ;
+19 Begin DoDot:1
+20 ;--- Query the registry
+21 DO TPPSETUP^RORTSK01(70)
+22 SET RC=$$QUERY^RORX016A(SFLAGS)
+23 IF RC
if RC<0
QUIT
SET ECNT=ECNT+RC
+24 ;--- Sort the data
+25 DO TPPSETUP^RORTSK01(15)
+26 SET RC=$$SORT^RORX016B()
+27 IF RC
if RC<0
QUIT
SET ECNT=ECNT+RC
+28 ;--- Store the results
+29 DO TPPSETUP^RORTSK01(15)
+30 SET RC=$$STORE^RORX016C(REPORT)
+31 IF RC
if RC<0
QUIT
SET ECNT=ECNT+RC
End DoDot:1
+32 ;
+33 ;--- Cleanup
+34 KILL ^TMP("RORX016",$JOB)
+35 QUIT $SELECT(RC<0:RC,ECNT>0:-43,1:0)
+36 ;
+37 ;***** OUTPUTS THE PARAMETERS TO THE REPORT
+38 ;
+39 ; PARTAG Reference (IEN) to the parent tag
+40 ;
+41 ; [.STDT] Start and end dates of the report
+42 ; [.ENDT] are returned via these parameters
+43 ;
+44 ; [.FLAGS] Flags for the $$SKIP^RORXU005 are
+45 ; returned via this parameter
+46 ;
+47 ; Return Values:
+48 ; <0 Error code
+49 ; >0 IEN of the PARAMETERS element
+50 ;
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 ;--- Process the list of divisions
+5 SET TMP=$$DIVLST^RORXU006(.RORTSK,PARAMS)
+6 if TMP<0
QUIT TMP
+7 ;--- Additional parameters
+8 FOR NAME="MAXUTNUM"
Begin DoDot:1
+9 SET TMP=$$PARAM^RORTSK01(NAME)
+10 if TMP'=""
DO ADDVAL^RORTSK11(RORTSK,NAME,TMP,PARAMS)
End DoDot:1
+11 ;---
+12 QUIT PARAMS