source: FOIAVistA/trunk/r/NATIONAL_DRUG_FILE-PSN/PSN56.m@ 1806

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

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1PSN56 ;BIR/LDT - API FOR INFORMATION FROM FILE 56; 5 Sep 03
2 ;;4.0; NATIONAL DRUG FILE;**80**; 30 Oct 98
3 ;
4ALL(PSNIEN,PSNFT,LIST) ;
5 ;PSNIEN - IEN of entry in DRUG INTERACTION file (#56).
6 ;PSNFT - Free Text name in DRUG INTERACTION file (#56).
7 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
8 ; Field Number of the data piece being returned.
9 ;Returns NAME field (#.01), INGREDIENT field (#1), INGREDIENT2 field (#2), SEVERITY field (#3),
10 ;NATIONALLY ENTERED field (#4), TOTAL INDEXES field (#5), LOACLLY EDITED field (#6), and
11 ;INACTIVATION DATE field (#7) of DRUG INTERACTION file (#56).
12 N DIERR,ZZERR,PSNP56,PSN
13 I $G(LIST)']"" Q
14 K ^TMP($J,LIST)
15 I $G(PSNIEN)']"",($G(PSNFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
16 I $G(PSNIEN)]"",(+$G(PSNIEN)'>0) S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
17 I $G(PSNIEN)]"" N PSNIEN2 S PSNIEN2=$$FIND1^DIC(56,"","A","`"_PSNIEN,,,"") D
18 .I +PSNIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
19 .S ^TMP($J,LIST,0)=1
20 .D GETS^DIQ(56,+PSNIEN2,".01;1;2;3;4;5;6;7","IE","PSNP56") S PSN(1)=0
21 .F S PSN(1)=$O(PSNP56(56,PSN(1))) Q:'PSN(1) D SETALL
22 I $G(PSNIEN)="",$G(PSNFT)]"" D
23 .I PSNFT["??" D LOOP Q
24 .D FIND^DIC(56,,"@;.01;","QP",PSNFT,,"B",,,"")
25 .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
26 .S ^TMP($J,LIST,0)=+^TMP("DILIST",$J,0)
27 .I +^TMP("DILIST",$J,0)>0 N PSNXX S PSNXX=0 F S PSNXX=$O(^TMP("DILIST",$J,PSNXX)) Q:'PSNXX D
28 ..S PSNIEN=+^TMP("DILIST",$J,PSNXX,0) K PSNP56 D GETS^DIQ(56,+PSNIEN,".01;1;2;3;4;5;6;7","IE","PSNP56") S PSN(1)=0
29 ..F S PSN(1)=$O(PSNP56(56,PSN(1))) Q:'PSN(1) D SETALL
30 K ^TMP("DILIST",$J)
31 Q
32 ;
33SETALL ;
34 S ^TMP($J,LIST,+PSN(1),.01)=$G(PSNP56(56,PSN(1),.01,"I"))
35 S ^TMP($J,LIST,"B",$G(PSNP56(56,PSN(1),.01,"I")),+PSN(1))=""
36 S ^TMP($J,LIST,+PSN(1),1)=$S($G(PSNP56(56,PSN(1),1,"I"))="":"",1:PSNP56(56,PSN(1),1,"I")_"^"_PSNP56(56,PSN(1),1,"E"))
37 S ^TMP($J,LIST,+PSN(1),2)=$S($G(PSNP56(56,PSN(1),2,"I"))="":"",1:PSNP56(56,PSN(1),2,"I")_"^"_PSNP56(56,PSN(1),2,"E"))
38 S ^TMP($J,LIST,+PSN(1),3)=$S($G(PSNP56(56,PSN(1),3,"I"))="":"",1:PSNP56(56,PSN(1),3,"I")_"^"_PSNP56(56,PSN(1),3,"E"))
39 S ^TMP($J,LIST,+PSN(1),4)=$S($G(PSNP56(56,PSN(1),4,"I"))="":"",1:PSNP56(56,PSN(1),4,"I")_"^"_PSNP56(56,PSN(1),4,"E"))
40 S ^TMP($J,LIST,+PSN(1),5)=$G(PSNP56(56,PSN(1),5,"I"))
41 S ^TMP($J,LIST,+PSN(1),7)=$S($G(PSNP56(56,PSN(1),7,"I"))="":"",1:PSNP56(56,PSN(1),7,"I")_"^"_PSNP56(56,PSN(1),7,"E"))
42 S ^TMP($J,LIST,+PSN(1),6)=$S($G(PSNP56(56,PSN(1),6,"I"))="":"",1:PSNP56(56,PSN(1),6,"I")_"^"_PSNP56(56,PSN(1),6,"E"))
43 Q
44 ;
45SETING ;
46 S ^TMP($J,LIST,+PSN(1),.01)=$G(PSNP56(56,PSN(1),.01,"I"))
47 S ^TMP($J,LIST,"APD",$G(PSNP56(56,PSN(1),.01,"I")),+PSN(1))=""
48 S ^TMP($J,LIST,+PSN(1),1)=$S($G(PSNP56(56,PSN(1),1,"I"))="":"",1:PSNP56(56,PSN(1),1,"I")_"^"_PSNP56(56,PSN(1),1,"E"))
49 S ^TMP($J,LIST,+PSN(1),2)=$S($G(PSNP56(56,PSN(1),2,"I"))="":"",1:PSNP56(56,PSN(1),2,"I")_"^"_PSNP56(56,PSN(1),2,"E"))
50 S ^TMP($J,LIST,+PSN(1),3)=$S($G(PSNP56(56,PSN(1),3,"I"))="":"",1:PSNP56(56,PSN(1),3,"I")_"^"_PSNP56(56,PSN(1),3,"E"))
51 S ^TMP($J,LIST,+PSN(1),7)=$S($G(PSNP56(56,PSN(1),7,"I"))="":"",1:PSNP56(56,PSN(1),7,"I")_"^"_PSNP56(56,PSN(1),7,"E"))
52 Q
53 ;
54LOOP ;
55 S PSNIEN=0,^TMP($J,LIST,0)=0 F S PSNIEN=$O(^PS(56,PSNIEN)) Q:'PSNIEN D
56 .K PSNP56 D GETS^DIQ(56,+PSNIEN,".01;1;2;3;4;5;6;7","IE","PSNP56") S ^TMP($J,LIST,0)=^TMP($J,LIST,0)+1,PSN(1)=0 D
57 ..F S PSN(1)=$O(PSNP56(56,PSN(1))) Q:'PSN(1) D SETALL
58 Q
59 ;
60IEN(PSNING1,PSNING2,PSNFL,LIST) ;
61 ;PSNING1 - Drug Identifier for Ingredient 1.
62 ;PSNING2 - Drug Identifier for Ingredient 2.
63 ;PSNFL - Inactive flag - "" - All entries
64 ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
65 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
66 ; Field Number of the data piece being returned.
67 ;Returns NAME field (#.01), INGREDIENT field (#1), INGREDIENT2 field (#2), and INACTIVATION DATE field (#7)
68 ;of DRUG INTERACTION file (#56).
69 N PSNNXX,PSNXTOT,PSNXNODE,PSNP56,PSN
70 I $G(LIST)']"" Q
71 K ^TMP($J,LIST)
72 I $G(PSNING1)']""!($G(PSNING2)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
73 S PSNXTOT=0
74 F PSNNXX=0:0 S PSNNXX=$O(^PS(56,"APD",PSNING1,PSNING2,PSNNXX)) Q:'PSNNXX D
75 .I '$D(^PS(56,PSNNXX,0)) Q
76 .S PSNXNODE=$G(^PS(56,PSNNXX,0)) I $P(PSNXNODE,"^")="" Q
77 .I $G(PSNFL),$P(PSNXNODE,"^",7),$P(PSNXNODE,"^",7)'>PSNFL Q
78 .K PSNP56 D GETS^DIQ(56,+PSNNXX,".01;1;2;3;7","IE","PSNP56") S PSN(1)=0 D
79 ..F S PSN(1)=$O(PSNP56(56,PSN(1))) Q:'PSN(1) D SETING S PSNXTOT=PSNXTOT+1
80 S ^TMP($J,LIST,0)=$S(+$G(PSNXTOT)>0:PSNXTOT,1:-1_"^"_"NO DATA FOUND")
81 Q
Note: See TracBrowser for help on using the repository browser.