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

RORTSK12.m

Go to the documentation of this file.
  1. RORTSK12 ;HCIOFO/SG - REPORT STATS UTILITIES ; 7/15/05 12:00pm
  1. ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
  1. ;
  1. Q
  1. ;
  1. ;***** CLEARS THE STATISTICS
  1. ;
  1. ; REGIEN Registry IEN
  1. ;
  1. ; [RPTCODE] Report Code. By default ($G(RPTCODE)'>0),
  1. ; all statistic data is deleted.
  1. ;
  1. CLEAR(REGIEN,RPTCODE) ;
  1. N DA,DIK,IENS,NODE,RPIEN
  1. S DA(1)=+REGIEN,IENS=","_DA(1)_","
  1. S DIK=$$ROOT^DILFD(798.12,IENS)
  1. S NODE=$$CREF^DILF(DIK)
  1. ;
  1. ;--- Clear the report stats
  1. I $G(RPTCODE)>0 D Q
  1. . S RPIEN=$$RPIEN^RORUTL08(RPTCODE) Q:RPIEN'>0
  1. . L +@NODE@(RPTCODE):5
  1. . S DA=$$FIND1^DIC(798.12,IENS,"QX",RPIEN,"B",,"RORMSG")
  1. . D:DA>0 ^DIK
  1. . L -@NODE@(RPTCODE)
  1. ;
  1. ;--- Clear all stats
  1. L +@NODE:5
  1. S DA=0 F S DA=$O(@NODE@(DA)) Q:DA'>0 D ^DIK
  1. L -@NODE
  1. Q
  1. ;
  1. ;***** INCREMENT THE NUMBER OF REPORT RUNS
  1. ;
  1. ; REGIEN Registry IEN
  1. ;
  1. ; RPTCODE Report Code
  1. ;
  1. ; [VAL] Increment value. By default ($G(VAL)'>0),
  1. ; the counter is incremented by 1.
  1. ;
  1. INC(REGIEN,RPTCODE,VAL) ;
  1. N IEN,IENS,NODE,RORBUF,RORFDA,RORMSG,RPIEN,TMP
  1. S:$G(VAL)'>0 VAL=1
  1. ;
  1. ;--- Get IEN of the report parameters
  1. S RPIEN=$$RPIEN^RORUTL08(RPTCODE) Q:RPIEN'>0
  1. ;
  1. ;--- Lock the report stats
  1. S IENS=","_(+REGIEN)_","
  1. S NODE=$$ROOT^DILFD(798.12,IENS,1)
  1. L +@NODE@(RPTCODE):5
  1. D
  1. . ;--- Find and load the report stats
  1. . S TMP="@;.02"
  1. . D FIND^DIC(798.12,IENS,TMP,"QX",RPIEN,2,"B",,,"RORBUF","RORMSG")
  1. . D:$G(DIERR) DBS^RORERR("RORMSG",-9,,,798.12,IENS)
  1. . Q:$G(RORBUF("DILIST",0))>1
  1. . S IEN=+$G(RORBUF("DILIST",2,1))
  1. . ;--- Increment the counter
  1. . S IENS=$S(IEN>0:IEN,1:"?+1")_","_(+REGIEN)_","
  1. . S RORFDA(798.12,IENS,.01)=RPIEN
  1. . S RORFDA(798.12,IENS,.02)=$G(RORBUF("DILIST","ID",1,.02))+VAL
  1. . D UPDATE^DIE(,"RORFDA",,"RORMSG")
  1. . D:$G(DIERR) DBS^RORERR("RORMSG",-9,,,798.12,IENS)
  1. ;
  1. ;--- Unlock the report stats
  1. L -@NODE@(RPTCODE)
  1. Q
  1. ;
  1. ;***** RETURNS THE REPORT RUN STATISTICS
  1. ;
  1. ; REGIEN Registry IEN
  1. ;
  1. ; .STATS Reference to a local array where the statistics
  1. ; (collected since the last successful data
  1. ; transmission) will be returned to.
  1. ;
  1. ; STATS( Report Statistics Summary
  1. ; ^01: Total number of report runs
  1. ; RptCode) Report run statistics
  1. ; ^01: Number of report runs
  1. ;
  1. ; Return Values:
  1. ; <0 Error code
  1. ; 0 Ok
  1. ;
  1. STATS(REGIEN,STATS) ;
  1. N IR,RORBUF,RORMSG,RPTCODE,TMP
  1. K STATS S STATS="0"
  1. ;--- Load the statistics
  1. S TMP=","_(+REGIEN)_","
  1. D LIST^DIC(798.12,TMP,".01I;.02","Q",,,,"B",,,"RORBUF","RORMSG")
  1. Q:$G(DIERR) $$DBS^RORERR("RORMSG",-9,,,798.12,TMP)
  1. ;--- Process the statistics
  1. S IR=0
  1. F S IR=$O(RORBUF("DILIST","ID",IR)) Q:IR'>0 D
  1. . ;--- Get the IEN of the report parameters
  1. . S TMP=+$G(RORBUF("DILIST","ID",IR,.01)) Q:TMP'>0
  1. . ;--- Get the report code
  1. . S RPTCODE=$$RPCODE^RORUTL08(TMP) Q:RPTCODE'>0
  1. . ;--- Get the report statistics
  1. . S TMP=+$G(RORBUF("DILIST","ID",IR,.02))
  1. . S $P(STATS(RPTCODE),U)=TMP
  1. . S $P(STATS,U)=$P(STATS,U)+TMP
  1. ;---
  1. Q 0