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

RORRP035.m

Go to the documentation of this file.
  1. RORRP035 ;HCIOFO/SG - RPC: GENERIC DRUG NAMES ; 10/18/05 12:10pm
  1. ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
  1. ;
  1. Q
  1. ;
  1. ;***** RETURNS THE LIST OF GENERIC DRUGS
  1. ; RPC: [ROR LIST GENERIC DRUGS]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; REGIEN Registry IEN
  1. ;
  1. ; [GROUP] Code of the Drug Group. If this parameter is
  1. ; defined and greater than zero then only the drugs
  1. ; associated with this group will be returned.
  1. ;
  1. ; The ^TMP("DILIST",$J) global node is used by the procedure.
  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 drugs is returned in the @RESULTS@(0) and
  1. ; the subsequent nodes of the global array contain the drugs.
  1. ;
  1. ; @RESULTS@(0) Number of Local Drugs
  1. ;
  1. ; @RESULTS@(i) Drug Descriptor
  1. ; ^01: IEN in the ROR GENERIC DRUG file
  1. ; ^02: Generic drug name
  1. ; ^03: IEN of the generic drug (file #50.6)
  1. ; ^04: Code of the Drug Group
  1. ;
  1. GDLIST(RESULTS,REGIEN,GROUP) ;
  1. N GROUPIEN,IENS,IR,PART,RC,RORERRDL,RORMSG,SCR,TMP
  1. D CLEAR^RORERR("GDLIST^RORRP032",1)
  1. K RESULTS S RESULTS=$NA(^TMP("DILIST",$J)) K @RESULTS
  1. ;
  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. . ;--- Code of the Drug Group
  1. . S GROUP=+$G(GROUP)
  1. . S GROUPIEN=$S(GROUP>0:$$ITEMIEN^RORUTL09(4,REGIEN,GROUP),1:0)
  1. . I GROUPIEN<0 D Q
  1. . . S RC=$$ERROR^RORERR(GROUPIEN)
  1. ;
  1. ;--- Compile the screen logic (be careful with naked references)
  1. S SCR=""
  1. S:GROUPIEN>0 SCR=SCR_"I $P($G(^(0)),U,3)="_GROUPIEN_" "
  1. ;--- Get the list of drugs
  1. S TMP="@;.04E;.04I;.03I",PART(1)=REGIEN_"#"
  1. D LIST^DIC(799.51,,TMP,"PU",,,.PART,"ARDG",SCR,,,"RORMSG")
  1. I $G(DIERR) D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$DBS^RORERR("RORMSG",-9,,,799.51)
  1. ;
  1. ;--- Replace the group IEN's with the group code(s)
  1. S (IR,RC)=0
  1. F S IR=$O(@RESULTS@(IR)) Q:IR'>0 D Q:RC<0
  1. . I GROUPIEN>0 S $P(@RESULTS@(IR,0),U,4)=GROUP Q
  1. . S TMP=+$P(@RESULTS@(IR,0),U,4)
  1. . I TMP'>0 S $P(@RESULTS@(IR,0),U,4)="" Q
  1. . S RC=$$ITEMCODE^RORUTL09(TMP)
  1. . S:RC>0 $P(@RESULTS@(IR,0),U,4)=RC
  1. I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
  1. ;--- Success
  1. S TMP=+$G(^TMP("DILIST",$J,0))
  1. K ^TMP("DILIST",$J,0) S @RESULTS@(0)=TMP
  1. Q