- RORRP035 ;HCIOFO/SG - RPC: GENERIC DRUG NAMES ; 10/18/05 12:10pm
- ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
- ;
- Q
- ;
- ;***** RETURNS THE LIST OF GENERIC DRUGS
- ; RPC: [ROR LIST GENERIC DRUGS]
- ;
- ; .RESULTS Reference to a local variable where the results
- ; are returned to.
- ;
- ; REGIEN Registry IEN
- ;
- ; [GROUP] Code of the Drug Group. If this parameter is
- ; defined and greater than zero then only the drugs
- ; associated with this group will be returned.
- ;
- ; The ^TMP("DILIST",$J) global node is used by the procedure.
- ;
- ; Return Values:
- ;
- ; A negative value of the first "^"-piece of the RESULTS(0)
- ; indicates an error (see the RPCSTK^RORERR procedure for more
- ; details).
- ;
- ; Otherwise, number of drugs is returned in the @RESULTS@(0) and
- ; the subsequent nodes of the global array contain the drugs.
- ;
- ; @RESULTS@(0) Number of Local Drugs
- ;
- ; @RESULTS@(i) Drug Descriptor
- ; ^01: IEN in the ROR GENERIC DRUG file
- ; ^02: Generic drug name
- ; ^03: IEN of the generic drug (file #50.6)
- ; ^04: Code of the Drug Group
- ;
- GDLIST(RESULTS,REGIEN,GROUP) ;
- N GROUPIEN,IENS,IR,PART,RC,RORERRDL,RORMSG,SCR,TMP
- D CLEAR^RORERR("GDLIST^RORRP032",1)
- K RESULTS S RESULTS=$NA(^TMP("DILIST",$J)) K @RESULTS
- ;
- ;--- Check the parameters
- S RC=0 D I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
- . ;--- Registry IEN
- . I $G(REGIEN)'>0 D Q
- . . S RC=$$ERROR^RORERR(-88,,,,"REGIEN",$G(REGIEN))
- . S REGIEN=+REGIEN
- . ;--- Code of the Drug Group
- . S GROUP=+$G(GROUP)
- . S GROUPIEN=$S(GROUP>0:$$ITEMIEN^RORUTL09(4,REGIEN,GROUP),1:0)
- . I GROUPIEN<0 D Q
- . . S RC=$$ERROR^RORERR(GROUPIEN)
- ;
- ;--- Compile the screen logic (be careful with naked references)
- S SCR=""
- S:GROUPIEN>0 SCR=SCR_"I $P($G(^(0)),U,3)="_GROUPIEN_" "
- ;--- Get the list of drugs
- S TMP="@;.04E;.04I;.03I",PART(1)=REGIEN_"#"
- D LIST^DIC(799.51,,TMP,"PU",,,.PART,"ARDG",SCR,,,"RORMSG")
- I $G(DIERR) D D RPCSTK^RORERR(.RESULTS,RC) Q
- . S RC=$$DBS^RORERR("RORMSG",-9,,,799.51)
- ;
- ;--- Replace the group IEN's with the group code(s)
- S (IR,RC)=0
- F S IR=$O(@RESULTS@(IR)) Q:IR'>0 D Q:RC<0
- . I GROUPIEN>0 S $P(@RESULTS@(IR,0),U,4)=GROUP Q
- . S TMP=+$P(@RESULTS@(IR,0),U,4)
- . I TMP'>0 S $P(@RESULTS@(IR,0),U,4)="" Q
- . S RC=$$ITEMCODE^RORUTL09(TMP)
- . S:RC>0 $P(@RESULTS@(IR,0),U,4)=RC
- I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
- ;--- Success
- S TMP=+$G(^TMP("DILIST",$J,0))
- K ^TMP("DILIST",$J,0) S @RESULTS@(0)=TMP
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRORRP035 2661 printed Apr 23, 2025@17:57:43 Page 2
- RORRP035 ;HCIOFO/SG - RPC: GENERIC DRUG NAMES ; 10/18/05 12:10pm
- +1 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
- +2 ;
- +3 QUIT
- +4 ;
- +5 ;***** RETURNS THE LIST OF GENERIC DRUGS
- +6 ; RPC: [ROR LIST GENERIC DRUGS]
- +7 ;
- +8 ; .RESULTS Reference to a local variable where the results
- +9 ; are returned to.
- +10 ;
- +11 ; REGIEN Registry IEN
- +12 ;
- +13 ; [GROUP] Code of the Drug Group. If this parameter is
- +14 ; defined and greater than zero then only the drugs
- +15 ; associated with this group will be returned.
- +16 ;
- +17 ; The ^TMP("DILIST",$J) global node is used by the procedure.
- +18 ;
- +19 ; Return Values:
- +20 ;
- +21 ; A negative value of the first "^"-piece of the RESULTS(0)
- +22 ; indicates an error (see the RPCSTK^RORERR procedure for more
- +23 ; details).
- +24 ;
- +25 ; Otherwise, number of drugs is returned in the @RESULTS@(0) and
- +26 ; the subsequent nodes of the global array contain the drugs.
- +27 ;
- +28 ; @RESULTS@(0) Number of Local Drugs
- +29 ;
- +30 ; @RESULTS@(i) Drug Descriptor
- +31 ; ^01: IEN in the ROR GENERIC DRUG file
- +32 ; ^02: Generic drug name
- +33 ; ^03: IEN of the generic drug (file #50.6)
- +34 ; ^04: Code of the Drug Group
- +35 ;
- GDLIST(RESULTS,REGIEN,GROUP) ;
- +1 NEW GROUPIEN,IENS,IR,PART,RC,RORERRDL,RORMSG,SCR,TMP
- +2 DO CLEAR^RORERR("GDLIST^RORRP032",1)
- +3 KILL RESULTS
- SET RESULTS=$NAME(^TMP("DILIST",$JOB))
- KILL @RESULTS
- +4 ;
- +5 ;--- Check the parameters
- +6 SET RC=0
- Begin DoDot:1
- +7 ;--- Registry IEN
- +8 IF $GET(REGIEN)'>0
- Begin DoDot:2
- +9 SET RC=$$ERROR^RORERR(-88,,,,"REGIEN",$GET(REGIEN))
- End DoDot:2
- QUIT
- +10 SET REGIEN=+REGIEN
- +11 ;--- Code of the Drug Group
- +12 SET GROUP=+$GET(GROUP)
- +13 SET GROUPIEN=$SELECT(GROUP>0:$$ITEMIEN^RORUTL09(4,REGIEN,GROUP),1:0)
- +14 IF GROUPIEN<0
- Begin DoDot:2
- +15 SET RC=$$ERROR^RORERR(GROUPIEN)
- End DoDot:2
- QUIT
- End DoDot:1
- IF RC<0
- DO RPCSTK^RORERR(.RESULTS,RC)
- QUIT
- +16 ;
- +17 ;--- Compile the screen logic (be careful with naked references)
- +18 SET SCR=""
- +19 if GROUPIEN>0
- SET SCR=SCR_"I $P($G(^(0)),U,3)="_GROUPIEN_" "
- +20 ;--- Get the list of drugs
- +21 SET TMP="@;.04E;.04I;.03I"
- SET PART(1)=REGIEN_"#"
- +22 DO LIST^DIC(799.51,,TMP,"PU",,,.PART,"ARDG",SCR,,,"RORMSG")
- +23 IF $GET(DIERR)
- Begin DoDot:1
- +24 SET RC=$$DBS^RORERR("RORMSG",-9,,,799.51)
- End DoDot:1
- DO RPCSTK^RORERR(.RESULTS,RC)
- QUIT
- +25 ;
- +26 ;--- Replace the group IEN's with the group code(s)
- +27 SET (IR,RC)=0
- +28 FOR
- SET IR=$ORDER(@RESULTS@(IR))
- if IR'>0
- QUIT
- Begin DoDot:1
- +29 IF GROUPIEN>0
- SET $PIECE(@RESULTS@(IR,0),U,4)=GROUP
- QUIT
- +30 SET TMP=+$PIECE(@RESULTS@(IR,0),U,4)
- +31 IF TMP'>0
- SET $PIECE(@RESULTS@(IR,0),U,4)=""
- QUIT
- +32 SET RC=$$ITEMCODE^RORUTL09(TMP)
- +33 if RC>0
- SET $PIECE(@RESULTS@(IR,0),U,4)=RC
- End DoDot:1
- if RC<0
- QUIT
- +34 IF RC<0
- DO RPCSTK^RORERR(.RESULTS,RC)
- QUIT
- +35 ;--- Success
- +36 SET TMP=+$GET(^TMP("DILIST",$JOB,0))
- +37 KILL ^TMP("DILIST",$JOB,0)
- SET @RESULTS@(0)=TMP
- +38 QUIT