source: WorldVistAEHR/trunk/r/NATIONAL_DRUG_FILE-PSN/PSN5067.m@ 1361

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

initial load of WorldVistAEHR

File size: 4.7 KB
RevLine 
[613]1PSN5067 ;BIR/LDT - API FOR INFORMATION FROM FILE 50.67; 5 Sep 03
2 ;;4.0; NATIONAL DRUG FILE;**109**; 30 Oct 98
3 ;
4ALL(PSNIEN,PSNFT,PSNFL,LIST) ;
5 ;PSNIEN - IEN of entry in NDC/UPN file (#50.67).
6 ;PSNFT - Free Text TRADE NAME in NDC/UPN file (#50.67).
7 ;PSNFL - Inactive flag - "" - All entries.
8 ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
9 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where
10 ; Field Number is the Field Number of the data piece being returned.
11 ;Returns SEQUENCE NUMBER field (#.01), NDC field (#1), UPN field (#2), MANUFACTURER field (#3), TRADE NAME field (#4),
12 ;VA PRODUCT NAME field (#5), INACTIVATION DATE field (#7), PACKAGE SIZE field (#8), PACKAGE TYPE field (#9), and
13 ;OTX/RX INDICATOR field (#10) of the NDC/UPN file (#50.67).
14 N DIERR,ZZERR,PSN5067,PSN,SCR
15 I $G(LIST)']"" Q
16 K ^TMP($J,LIST)
17 I $G(PSNIEN)']"",($G(PSNFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
18 I $G(PSNIEN)]"",(+$G(PSNIEN)'>0) S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
19 S SCR("S")=""
20 I +$G(PSNFL)>0 N ND D SETSCRN
21 I $G(PSNIEN)]"" N PSNIEN2 S PSNIEN2=$$FIND1^DIC(50.67,"","B","`"_PSNIEN,,SCR("S"),"") D
22 .I +PSNIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
23 .S ^TMP($J,LIST,0)=1
24 .D GETS^DIQ(50.67,+PSNIEN2,".01:10","IE","PSN5067") S PSN(1)=0
25 .F S PSN(1)=$O(PSN5067(50.67,PSN(1))) Q:'PSN(1) D SETZRO
26 I $G(PSNIEN)="",$G(PSNFT)]"" D
27 .I PSNFT["??" D LOOP Q
28 .D FIND^DIC(50.67,,"@;.01;1","QP",PSNFT,,"T",SCR("S"),,"")
29 .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
30 .I +^TMP("DILIST",$J,0)>0 S ^TMP($J,LIST,0)=+^TMP("DILIST",$J,0) N PSNXX S PSNXX=0 F S PSNXX=$O(^TMP("DILIST",$J,PSNXX)) Q:'PSNXX D
31 ..S PSNIEN=+^TMP("DILIST",$J,PSNXX,0) K PSN5067 D GETS^DIQ(50.67,+PSNIEN,".01:10","IE","PSN5067") S PSN(1)=0
32 ..F S PSN(1)=$O(PSN5067(50.67,PSN(1))) Q:'PSN(1) D SETZRO
33 K ^TMP("DILIST",$J)
34 Q
35 ;
36SETZRO ;
37 S ^TMP($J,LIST,+PSN(1),.01)=$G(PSN5067(50.67,PSN(1),.01,"I"))
38 S ^TMP($J,LIST,+PSN(1),1)=$G(PSN5067(50.67,PSN(1),1,"I"))
39 S ^TMP($J,LIST,+PSN(1),2)=$G(PSN5067(50.67,PSN(1),2,"I"))
40 S ^TMP($J,LIST,+PSN(1),3)=$S($G(PSN5067(50.67,PSN(1),3,"I"))="":"",1:PSN5067(50.67,PSN(1),3,"I")_"^"_PSN5067(50.67,PSN(1),3,"E"))
41 S ^TMP($J,LIST,+PSN(1),4)=$G(PSN5067(50.67,PSN(1),4,"I"))
42 I $G(PSN5067(50.67,PSN(1),4,"I"))'="" S ^TMP($J,LIST,"B",$G(PSN5067(50.67,PSN(1),4,"I")),+PSN(1))=""
43 S ^TMP($J,LIST,+PSN(1),5)=$S($G(PSN5067(50.67,PSN(1),5,"I"))="":"",1:PSN5067(50.67,PSN(1),5,"I")_"^"_PSN5067(50.67,PSN(1),5,"E"))
44 S ^TMP($J,LIST,+PSN(1),7)=$S($G(PSN5067(50.67,PSN(1),7,"I"))="":"",1:PSN5067(50.67,PSN(1),7,"I")_"^"_PSN5067(50.67,PSN(1),7,"E"))
45 S ^TMP($J,LIST,+PSN(1),8)=$S($G(PSN5067(50.67,PSN(1),8,"I"))="":"",1:PSN5067(50.67,PSN(1),8,"I")_"^"_PSN5067(50.67,PSN(1),8,"E"))
46 S ^TMP($J,LIST,+PSN(1),9)=$S($G(PSN5067(50.67,PSN(1),9,"I"))="":"",1:PSN5067(50.67,PSN(1),9,"I")_"^"_PSN5067(50.67,PSN(1),9,"E"))
47 S ^TMP($J,LIST,+PSN(1),10)=$S($G(PSN5067(50.67,PSN(1),10,"I"))="":"",1:PSN5067(50.67,PSN(1),10,"I")_"^"_PSN5067(50.67,PSN(1),10,"E"))
48 Q
49 ;
50LOOP ;
51 N PSN567D,PSN567E,PSN567RX,PSN567ND,PSNVAL
52 D FIELD^DID(50.67,10,"Z","POINTER","PSN567D","PSN567E") S PSN567RX=$G(PSN567D("POINTER"))
53 N PSNENCT
54 S PSNENCT=0
55 S PSNVAL=0 F S PSNVAL=$O(^PSNDF(50.67,PSNVAL)) Q:'PSNVAL D
56 .I $P($G(^PSNDF(50.67,PSNVAL,0)),"^")="" Q
57 .I $G(PSNFL),$P($G(^PSNDF(50.67,PSNVAL,0)),"^",7),$P($G(^(0)),"^",7)'>PSNFL Q
58 .S PSN567ND=$G(^PSNDF(50.67,PSNVAL,0))
59 .S ^TMP($J,LIST,+PSNVAL,.01)=$P(PSN567ND,"^")
60 .I $P(PSN567ND,"^",5)'="" S ^TMP($J,LIST,"B",$P(PSN567ND,"^",5),+PSNVAL)=""
61 .S ^TMP($J,LIST,+PSNVAL,1)=$P(PSN567ND,"^",2)
62 .S ^TMP($J,LIST,+PSNVAL,2)=$P(PSN567ND,"^",3)
63 .S ^TMP($J,LIST,+PSNVAL,3)=$S($P(PSN567ND,"^",4):$P(PSN567ND,"^",4)_"^"_$P($G(^PS(55.95,+$P(PSN567ND,"^",4),0)),"^"),1:"")
64 .S ^TMP($J,LIST,+PSNVAL,4)=$P(PSN567ND,"^",5)
65 .S ^TMP($J,LIST,+PSNVAL,5)=$S($P(PSN567ND,"^",6):$P(PSN567ND,"^",6)_"^"_$P($G(^PSNDF(50.68,+$P(PSN567ND,"^",6),0)),"^"),1:"")
66 .N Y S Y=$P(PSN567ND,"^",7) D
67 ..I Y S ^TMP($J,LIST,+PSNVAL,7)=$G(Y) X ^DD("DD") S ^TMP($J,LIST,+PSNVAL,7)=^TMP($J,LIST,+PSNVAL,7)_"^"_$G(Y) Q
68 ..S ^TMP($J,LIST,+PSNVAL,7)=""
69 .S ^TMP($J,LIST,+PSNVAL,8)=$S($P(PSN567ND,"^",8):$P(PSN567ND,"^",8)_"^"_$P($G(^PS(50.609,+$P(PSN567ND,"^",8),0)),"^"),1:"")
70 .S ^TMP($J,LIST,+PSNVAL,9)=$S($P(PSN567ND,"^",9):$P(PSN567ND,"^",9)_"^"_$P($G(^PS(50.608,+$P(PSN567ND,"^",9),0)),"^"),1:"")
71 .N PSN567NR S PSN567NR=$P(PSN567ND,"^",10) D
72 ..I PSN567NR'="",PSN567RX'="",PSN567RX[(PSN567NR_":") S ^TMP($J,LIST,+PSNVAL,10)=PSN567NR_"^"_$P($E(PSN567RX,$F(PSN567RX,(PSN567NR_":")),999),";") Q
73 ..S ^TMP($J,LIST,+PSNVAL,10)=""
74 .S PSNENCT=PSNENCT+1
75 S ^TMP($J,LIST,0)=$S($G(PSNENCT):$G(PSNENCT),1:"-1^NO DATA FOUND")
76 Q
77 ;
78SETSCRN ;
79 S SCR("S")="S ND=$P($G(^PSNDF(50.67,+Y,0)),""^"",7) I ND=""""!(ND>PSNFL)"
80 Q
Note: See TracBrowser for help on using the repository browser.