source: WorldVistAEHR/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORRP035.m@ 972

Last change on this file since 972 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.5 KB
RevLine 
[613]1RORRP035 ;HCIOFO/SG - RPC: GENERIC DRUG NAMES ; 10/18/05 12:10pm
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 Q
5 ;
6 ;***** RETURNS THE LIST OF GENERIC DRUGS
7 ; RPC: [ROR LIST GENERIC DRUGS]
8 ;
9 ; .RESULTS Reference to a local variable where the results
10 ; are returned to.
11 ;
12 ; REGIEN Registry IEN
13 ;
14 ; [GROUP] Code of the Drug Group. If this parameter is
15 ; defined and greater than zero then only the drugs
16 ; associated with this group will be returned.
17 ;
18 ; The ^TMP("DILIST",$J) global node is used by the procedure.
19 ;
20 ; Return Values:
21 ;
22 ; A negative value of the first "^"-piece of the RESULTS(0)
23 ; indicates an error (see the RPCSTK^RORERR procedure for more
24 ; details).
25 ;
26 ; Otherwise, number of drugs is returned in the @RESULTS@(0) and
27 ; the subsequent nodes of the global array contain the drugs.
28 ;
29 ; @RESULTS@(0) Number of Local Drugs
30 ;
31 ; @RESULTS@(i) Drug Descriptor
32 ; ^01: IEN in the ROR GENERIC DRUG file
33 ; ^02: Generic drug name
34 ; ^03: IEN of the generic drug (file #50.6)
35 ; ^04: Code of the Drug Group
36 ;
37GDLIST(RESULTS,REGIEN,GROUP) ;
38 N GROUPIEN,IENS,IR,PART,RC,RORERRDL,RORMSG,SCR,TMP
39 D CLEAR^RORERR("GDLIST^RORRP032",1)
40 K RESULTS S RESULTS=$NA(^TMP("DILIST",$J)) K @RESULTS
41 ;
42 ;--- Check the parameters
43 S RC=0 D I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
44 . ;--- Registry IEN
45 . I $G(REGIEN)'>0 D Q
46 . . S RC=$$ERROR^RORERR(-88,,,,"REGIEN",$G(REGIEN))
47 . S REGIEN=+REGIEN
48 . ;--- Code of the Drug Group
49 . S GROUP=+$G(GROUP)
50 . S GROUPIEN=$S(GROUP>0:$$ITEMIEN^RORUTL09(4,REGIEN,GROUP),1:0)
51 . I GROUPIEN<0 D Q
52 . . S RC=$$ERROR^RORERR(GROUPIEN)
53 ;
54 ;--- Compile the screen logic (be careful with naked references)
55 S SCR=""
56 S:GROUPIEN>0 SCR=SCR_"I $P($G(^(0)),U,3)="_GROUPIEN_" "
57 ;--- Get the list of drugs
58 S TMP="@;.04E;.04I;.03I",PART(1)=REGIEN_"#"
59 D LIST^DIC(799.51,,TMP,"PU",,,.PART,"ARDG",SCR,,,"RORMSG")
60 I $G(DIERR) D D RPCSTK^RORERR(.RESULTS,RC) Q
61 . S RC=$$DBS^RORERR("RORMSG",-9,,,799.51)
62 ;
63 ;--- Replace the group IEN's with the group code(s)
64 S (IR,RC)=0
65 F S IR=$O(@RESULTS@(IR)) Q:IR'>0 D Q:RC<0
66 . I GROUPIEN>0 S $P(@RESULTS@(IR,0),U,4)=GROUP Q
67 . S TMP=+$P(@RESULTS@(IR,0),U,4)
68 . I TMP'>0 S $P(@RESULTS@(IR,0),U,4)="" Q
69 . S RC=$$ITEMCODE^RORUTL09(TMP)
70 . S:RC>0 $P(@RESULTS@(IR,0),U,4)=RC
71 I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
72 ;--- Success
73 S TMP=+$G(^TMP("DILIST",$J,0))
74 K ^TMP("DILIST",$J,0) S @RESULTS@(0)=TMP
75 Q
Note: See TracBrowser for help on using the repository browser.