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

RORX016.m

Go to the documentation of this file.
  1. RORX016 ;HCIOFO/BH,SG - OUTPATIENT UTILIZATION ;10/14/05 2:06pm
  1. ;;1.5;CLINICAL CASE REGISTRIES;**21,31**;Feb 17, 2006;Build 62
  1. ;
  1. Q
  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. ;***** 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. ;;CLINICS(#,STOP,NAME,NP,NV,NSC)
  1. ;;HU_STOPS(#,NAME,LAST4,AGE,NV,NSC,NDS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
  1. ;;HU_STOPS(#,NAME,LAST4,DOB,NV,NSC,NDS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
  1. ;;HU_STOPS(#,NAME,LAST4,NV,NSC,NDS,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
  1. ;;STOPS(NP,NSC)
  1. ;
  1. N HEADER,RC
  1. S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
  1. Q:HEADER<0 HEADER
  1. S RC=$$TBLDEF^RORXU002("HEADER^RORX016",HEADER)
  1. Q $S(RC<0:RC,1:HEADER)
  1. ;
  1. ;
  1. ;***** COMPILES THE "OUTPATIENT UTILIZATION" REPORT
  1. ; REPORT CODE: 016
  1. ;
  1. ; .RORTSK Task number and task parameters
  1. ;
  1. ; The ^TMP("RORX016",$J) global node is used by this function.
  1. ;
  1. ; ^TMP("RORX016",$J,
  1. ;
  1. ; "OP", Number of outpatients
  1. ; DFN, Patient's data
  1. ; ^01: Number of stops
  1. ; ^02: Number of different stops
  1. ; ^03: Last 4 digits of SSN
  1. ; ^04: Number of visits
  1. ; ^05: National ICN
  1. ; ^06: Patient Care Team
  1. ; ^07: Primary Care Provider
  1. ; ^08: Age/DOB
  1. ; Children of this node are KILL'ed by
  1. ; the $$TOTALS^RORX016B function.
  1. ; Date, Number of stops associated with the visit
  1. ; StopCode) Quantity
  1. ;
  1. ; "OPS", Totals
  1. ; ^01: Total number of stops
  1. ; ^02: Number of different stops
  1. ; StopCode, Name of the Clinic Stop Code
  1. ; "P") Number of patients
  1. ; "S") Quantity
  1. ; "V") Number of visits
  1. ;
  1. ; "OPS1",
  1. ; NumOfStops, Number of patients
  1. ; PatientName,
  1. ; DFN)
  1. ;
  1. ; "OPV") Total number of visits
  1. ;
  1. ; Return Values:
  1. ; <0 Error code
  1. ; 0 Ok
  1. ;
  1. OPUTL(RORTSK) ;
  1. N RORDIV ; List of division IEN's
  1. N ROREDT ; End date
  1. N RORREG ; Registry IEN
  1. N RORSDT ; Start date
  1. ;
  1. N ECNT,RC,REPORT,SFLAGS,TMP
  1. S (ECNT,RC)=0 K ^TMP("RORX016",$J)
  1. ;--- Root node of the report
  1. S REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
  1. Q:REPORT<0 REPORT
  1. ;
  1. ;--- Get and prepare the report parameters
  1. S RORREG=$$PARAM^RORTSK01("REGIEN")
  1. S RC=$$PARAMS(REPORT,.RORSDT,.ROREDT,.SFLAGS) Q:RC<0 RC
  1. ;
  1. ;--- Report header
  1. S RC=$$HEADER(REPORT) Q:RC<0 RC
  1. ;
  1. D
  1. . ;--- Query the registry
  1. . D TPPSETUP^RORTSK01(70)
  1. . S RC=$$QUERY^RORX016A(SFLAGS)
  1. . I RC Q:RC<0 S ECNT=ECNT+RC
  1. . ;--- Sort the data
  1. . D TPPSETUP^RORTSK01(15)
  1. . S RC=$$SORT^RORX016B()
  1. . I RC Q:RC<0 S ECNT=ECNT+RC
  1. . ;--- Store the results
  1. . D TPPSETUP^RORTSK01(15)
  1. . S RC=$$STORE^RORX016C(REPORT)
  1. . I RC Q:RC<0 S ECNT=ECNT+RC
  1. ;
  1. ;--- Cleanup
  1. K ^TMP("RORX016",$J)
  1. Q $S(RC<0:RC,ECNT>0:-43,1:0)
  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 list of divisions
  1. S TMP=$$DIVLST^RORXU006(.RORTSK,PARAMS)
  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