RORX005 ;HCIOFO/BH,SG - INPATIENT UTILIZATION ;10/14/05 1:53pm
;;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
;
;;HU_DAYS(#,NAME,LAST4,AGE,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
;;HU_DAYS(#,NAME,LAST4,DOB,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
;;HU_DAYS(#,NAME,LAST4,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
;;HU_STAYS(#,NAME,LAST4,AGE,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
;;HU_STAYS(#,NAME,LAST4,DOB,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
;;HU_STAYS(#,NAME,LAST4,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
;;BEDSECTIONS(#,NAME,NP,NST,ND,MLOS,NSS)
;;NOBS(#,NAME,LAST4,AGE,DATE,PTF,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
;;NOBS(#,NAME,LAST4,DOB,DATE,PTF,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
;;NOBS(#,NAME,LAST4,DATE,PTF,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
;;STAYS(NP,NST)
;
N HEADER,RC
S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
Q:HEADER<0 HEADER
S RC=$$TBLDEF^RORXU002("HEADER^RORX005",HEADER)
Q $S(RC<0:RC,1:HEADER)
;
;
;***** COMPILES THE "INPATIENT UTILIZATION" REPORT
; REPORT CODE: 005
;
; .RORTSK Task number and task parameters
;
; The ^TMP("RORX005",$J) global node is used by this function.
;
; ^TMP("RORX005",$J,
;
; "IP", Number of inpatients
; DFN, Last 4 digits of SSN^National ICN^Patient care team PACT^Primary Care provider PCP^Age/DOB
; "D") Number of days
; "S") Number of overnight stays
; "V") Number of short stays
;
; "IPB",
;# BedSectID,
; "D") Number of days
; "P", Number of patients
; DFN)
; "S") Number of overnight stays
; "V") Number of short stays
; "B",
; BedSectName,
;% BedSectID)
;
; "IPD", Total number of days
; NumOfDays, Number of patients
; PatientName,
; DFN)
;
; "IPMLOS", Median Length Of Stay
;* BedSectID, Median Length Of Stay
; NumOfDays,
; Seq#)
;
; "IPNOBS",
; PatientName,
; Date,
; PTF#,
; DFN)
;
; "IPS", Total number of stays
; NumOfStays, Number of patients
; PatientName,
; DFN)
;
; "IPV") Total number of short stays
;
; Bed section IDs (BedSectID):
; -1 No bed section [#%*]
; 0 Whole patient's stays [ *]
; >0 Bed section ID (IEN;File#) [# *]
;
; Return Values:
; <0 Error code
; 0 Ok
;
IPUTL(RORTSK) ;
N ROREDT ; End date
N RORREG ; Registry IEN
N RORSDT ; Start date
;
N ECNT,RC,REPORT,SFLAGS,TMP
S (ECNT,RC)=0
K ^TMP("RORX005",$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^RORX005A(SFLAGS)
. I RC Q:RC<0 S ECNT=ECNT+RC
. ;--- Sort the data
. D TPPSETUP^RORTSK01(15)
. S RC=$$SORT^RORX005B()
. I RC Q:RC<0 S ECNT=ECNT+RC
. ;--- Store the results
. D TPPSETUP^RORTSK01(15)
. S RC=$$STORE^RORX005C(REPORT)
. I RC Q:RC<0 S ECNT=ECNT+RC
;
;--- Cleanup
K ^TMP("RORX005",$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[HRORX005 5417 printed Nov 22, 2024@16:54:33 Page 2
RORX005 ;HCIOFO/BH,SG - INPATIENT UTILIZATION ;10/14/05 1:53pm
+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 ;;HU_DAYS(#,NAME,LAST4,AGE,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
+2 ;;HU_DAYS(#,NAME,LAST4,DOB,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
+3 ;;HU_DAYS(#,NAME,LAST4,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
+4 ;;HU_STAYS(#,NAME,LAST4,AGE,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
+5 ;;HU_STAYS(#,NAME,LAST4,DOB,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
+6 ;;HU_STAYS(#,NAME,LAST4,NST,ND,NSS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
+7 ;;BEDSECTIONS(#,NAME,NP,NST,ND,MLOS,NSS)
+8 ;;NOBS(#,NAME,LAST4,AGE,DATE,PTF,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
+9 ;;NOBS(#,NAME,LAST4,DOB,DATE,PTF,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
+10 ;;NOBS(#,NAME,LAST4,DATE,PTF,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
+11 ;;STAYS(NP,NST)
+12 ;
+13 NEW HEADER,RC
+14 SET HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
+15 if HEADER<0
QUIT HEADER
+16 SET RC=$$TBLDEF^RORXU002("HEADER^RORX005",HEADER)
+17 QUIT $SELECT(RC<0:RC,1:HEADER)
+18 ;
+19 ;
+20 ;***** COMPILES THE "INPATIENT UTILIZATION" REPORT
+21 ; REPORT CODE: 005
+22 ;
+23 ; .RORTSK Task number and task parameters
+24 ;
+25 ; The ^TMP("RORX005",$J) global node is used by this function.
+26 ;
+27 ; ^TMP("RORX005",$J,
+28 ;
+29 ; "IP", Number of inpatients
+30 ; DFN, Last 4 digits of SSN^National ICN^Patient care team PACT^Primary Care provider PCP^Age/DOB
+31 ; "D") Number of days
+32 ; "S") Number of overnight stays
+33 ; "V") Number of short stays
+34 ;
+35 ; "IPB",
+36 ;# BedSectID,
+37 ; "D") Number of days
+38 ; "P", Number of patients
+39 ; DFN)
+40 ; "S") Number of overnight stays
+41 ; "V") Number of short stays
+42 ; "B",
+43 ; BedSectName,
+44 ;% BedSectID)
+45 ;
+46 ; "IPD", Total number of days
+47 ; NumOfDays, Number of patients
+48 ; PatientName,
+49 ; DFN)
+50 ;
+51 ; "IPMLOS", Median Length Of Stay
+52 ;* BedSectID, Median Length Of Stay
+53 ; NumOfDays,
+54 ; Seq#)
+55 ;
+56 ; "IPNOBS",
+57 ; PatientName,
+58 ; Date,
+59 ; PTF#,
+60 ; DFN)
+61 ;
+62 ; "IPS", Total number of stays
+63 ; NumOfStays, Number of patients
+64 ; PatientName,
+65 ; DFN)
+66 ;
+67 ; "IPV") Total number of short stays
+68 ;
+69 ; Bed section IDs (BedSectID):
+70 ; -1 No bed section [#%*]
+71 ; 0 Whole patient's stays [ *]
+72 ; >0 Bed section ID (IEN;File#) [# *]
+73 ;
+74 ; Return Values:
+75 ; <0 Error code
+76 ; 0 Ok
+77 ;
IPUTL(RORTSK) ;
+1 ; End date
NEW ROREDT
+2 ; Registry IEN
NEW RORREG
+3 ; Start date
NEW RORSDT
+4 ;
+5 NEW ECNT,RC,REPORT,SFLAGS,TMP
+6 SET (ECNT,RC)=0
+7 KILL ^TMP("RORX005",$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^RORX005A(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^RORX005B()
+27 IF RC
if RC<0
QUIT
SET ECNT=ECNT+RC
+28 ;--- Store the results
+29 DO TPPSETUP^RORTSK01(15)
+30 SET RC=$$STORE^RORX005C(REPORT)
+31 IF RC
if RC<0
QUIT
SET ECNT=ECNT+RC
End DoDot:1
+32 ;
+33 ;--- Cleanup
+34 KILL ^TMP("RORX005",$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