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

RORX006.m

Go to the documentation of this file.
  1. RORX006 ;HCIOFO/BH,SG - LAB UTILIZATION ;11/8/05 8:53am
  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 Add ICN column if Additional Identifier
  1. ; requested.
  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. ;;LABTESTS(#,NAME,NP,NR,MAXNRPP,MAXNP)
  1. ;;PATIENTS(#,NAME,LAST4,AGE,DOD,NO,NR,NDT,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="AGE"
  1. ;;PATIENTS(#,NAME,LAST4,DOB,DOD,NO,NR,NDT,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="DOB"
  1. ;;PATIENTS(#,NAME,LAST4,DOD,NO,NR,NDT,ICN,PACT,PCP)^I $$PARAM^RORTSK01("AGE_RANGE","TYPE")="ALL"
  1. ;;RESULTS(NP,NR)
  1. ;
  1. N HEADER,RC
  1. S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
  1. Q:HEADER<0 HEADER
  1. S RC=$$TBLDEF^RORXU002("HEADER^RORX006",HEADER)
  1. Q $S(RC<0:RC,1:HEADER)
  1. ;
  1. ;
  1. ;***** COMPILES THE "LAB UTILIZATION" REPORT
  1. ; REPORT CODE: 006
  1. ;
  1. ; .RORTSK Task number and task parameters
  1. ;
  1. ; The ^TMP("RORX006",$J) global node is used by this function.
  1. ;
  1. ; ^TMP("RORX006",$J,
  1. ;
  1. ; "ORD", Total number of orders
  1. ; NumOfOrd, Number of patients
  1. ; PatientName,
  1. ; DFN)
  1. ;
  1. ; "PAT", Total number of patients
  1. ; DFN, Patient descriptor
  1. ; 01: Last 4 digits of SSN
  1. ; 02: Date of death
  1. ; "O") Number of orders
  1. ; "R", Results
  1. ; ^01: Number of results
  1. ; ^02: Number of different tests
  1. ; TestIEN) Number of results
  1. ;
  1. ; "RES", Totals
  1. ; ^01: Total number of results
  1. ; ^02: Number of different tests
  1. ; TestIEN,
  1. ; "M") Maximum
  1. ; ^01: Maximum number of results
  1. ; ^02: Number of patients
  1. ; "P") Number of patients
  1. ; "R") Number of results
  1. ; "B",
  1. ; NumOfRes,
  1. ; TestName,
  1. ; TestIEN)
  1. ;
  1. ; "RES1",
  1. ; NumOfResults, Number of patients
  1. ; PatientName,
  1. ; DFN)
  1. ;
  1. ; Return Values:
  1. ; <0 Error code
  1. ; 0 Ok
  1. ;
  1. LABUTL(RORTSK) ;
  1. N ROREDT ; End date
  1. N ROREDT1 ; End date + 1 day
  1. N RORLTST ; Closed root of the list of lab tests
  1. N RORREG ; Registry IEN
  1. N RORSDT ; Start date
  1. ;
  1. N ECNT,RC,REPORT,SFLAGS,TMP
  1. K ^TMP("RORX006",$J)
  1. S RORLTST="",(ECNT,RC)=0
  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. . S ROREDT1=$$FMADD^XLFDT(ROREDT\1,1)
  1. . ;--- Report header
  1. . S RC=$$HEADER(REPORT) Q:RC<0
  1. . ;--- Query the registry
  1. . D TPPSETUP^RORTSK01(70)
  1. . S RC=$$QUERY^RORX006A(SFLAGS)
  1. . I RC Q:RC<0 S ECNT=ECNT+RC
  1. . ;--- Sort the data
  1. . D TPPSETUP^RORTSK01(15)
  1. . S RC=$$SORT^RORX006A()
  1. . I RC Q:RC<0 S ECNT=ECNT+RC
  1. . ;--- Store the results
  1. . D TPPSETUP^RORTSK01(15)
  1. . S RC=$$STORE^RORX006C(REPORT)
  1. . I RC Q:RC<0 S ECNT=ECNT+RC
  1. ;
  1. ;--- Cleanup
  1. D FREE^RORTMP(RORLTST)
  1. K ^TMP("RORX006",$J)
  1. Q $S(RC<0:RC,ECNT>0:-43,1:0)
  1. ;
  1. ;***** OUTPUTS 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. ;--- Additional parameters
  1. F NAME="MAXUTNUM","MINRPNUM" D
  1. . S TMP=$$PARAM^RORTSK01(NAME)
  1. . D:TMP'="" ADDVAL^RORTSK11(RORTSK,NAME,TMP,PARAMS)
  1. ;--- Process the list of Lab tests
  1. S TMP=$$LTLST^RORXU006(.RORTSK,PARAMS,.RORLTST) Q:TMP<0 TMP
  1. ;---
  1. Q PARAMS