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

RORRP022.m

Go to the documentation of this file.
  1. RORRP022 ;HCIOFO/SG - RPC: SELECTION RULES ; 8/2/05 11:15am
  1. ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
  1. ;
  1. Q
  1. ;
  1. ;***** LOADS THE SELECTION RULES FROM THE REGISTRY RECORD
  1. ; RPC: [ROR PATIENT SELECTION RULES]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; REGIEN Registry IEN
  1. ;
  1. ; PATIEN IEN of the registry patient (DFN)
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RESULTS(0)
  1. ; indicates an error (see the RPCSTK^RORERR procedure for more
  1. ; details).
  1. ;
  1. ; Otherwise, number of selection rules is returned in the RESULTS(0)
  1. ; and the subsequent nodes of the array contain the rules.
  1. ;
  1. ; RESULTS(0) Number of selection rules
  1. ;
  1. ; RESULTS(i) Selection Rule
  1. ; ^01: IEN in the SELECTION RULE multiple
  1. ; of the ROR REGISTRY RECORD file
  1. ; ^02: IEN of the Rule (in the
  1. ; ROR SELECTION RULE file)
  1. ; ^03: Name of the Rule
  1. ; ^04: Date (FileMan)
  1. ; ^05: Location IEN (Institution IEN)
  1. ; ^06: Location Name (Institution Name)
  1. ; ^07: Short Description
  1. ;
  1. PTRULES(RESULTS,REGIEN,PATIEN) ;
  1. N BUF,CNT,I,IEN,IENS,RC,RORBUF,RORMSG,TMP
  1. D CLEAR^RORERR("PTRULES^RORRP022",1)
  1. K RESULTS S RESULTS(0)=0
  1. ;--- Check the parameters
  1. S RC=0 D I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . ;--- Registry IEN
  1. . I $G(REGIEN)'>0 D Q
  1. . . S RC=$$ERROR^RORERR(-88,,,,"REGIEN",$G(REGIEN))
  1. . S REGIEN=+REGIEN
  1. . ;--- Patient IEN
  1. . I $G(PATIEN)'>0 D Q
  1. . . S RC=$$ERROR^RORERR(-88,,,,"PATIEN",$G(PATIEN))
  1. . S PATIEN=+PATIEN
  1. ;--- Get the IEN of the registry record
  1. S IEN=$$PRRIEN^RORUTL01(PATIEN,REGIEN) Q:IEN'>0
  1. ;--- Load the selection rules
  1. S IENS=","_IEN_",",TMP="@;.01I;.01E;1I;2I;2E"
  1. D LIST^DIC(798.01,IENS,TMP,"P",,,,"AD",,,"RORBUF","RORMSG")
  1. I $G(DIERR) D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$DBS^RORERR("RORMSG",-9,,,798.01,IENS)
  1. ;--- Populate the output array
  1. S (CNT,I)=0
  1. F S I=$O(RORBUF("DILIST",I)) Q:I'>0 D
  1. . S BUF=RORBUF("DILIST",I,0),IEN=+$P(BUF,U,2) Q:IEN'>0
  1. . S CNT=CNT+1,RESULTS(CNT)=BUF
  1. . S TMP=$$GET1^DIQ(798.2,IEN_",",4,,,"RORMSG")
  1. . S $P(RESULTS(CNT),U,7)=$S(TMP'="":TMP,1:$P(BUF,U,3))
  1. S RESULTS(0)=CNT
  1. Q