source: FOIAVistA/trunk/r/NATIONAL_DRUG_FILE-PSN/PSN50P68.m@ 945

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

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1PSN50P68 ;BIR/LDT - API FOR INFORMATION FROM FILE 50.68; 5 Sep 03
2 ;;4.0; NATIONAL DRUG FILE;**80,94,104,109**; 30 Oct 98
3 ;
4FORM(PSNIEN) ;
5 ;PSNIEN - IEN of entry in VA PRODUCT file (#50.68).
6 ;Returns NATIONAL FORMULARY NAME field (#4) of the VA PRODUCT file (#50.68).
7 I +$G(PSNIEN)'>0 Q ""
8 Q $P($G(^PSNDF(50.68,+PSNIEN,0)),"^",6)
9 ;
10DATA(PSNIEN,PSNFT,LIST) ;
11 ;PSNIEN - IEN of entry in VA PRODUCT file (#50.68).
12 ;PSNFT - Free Text name in VA PRODUCT file (#50.68).
13 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
14 ; Field Number of the data piece beingreturned.
15 N DIERR,ZZERR,PSN50P68,PSN,PSNSERVP
16 S PSNSERVP=$$PATCH^XPDUTL("PSN*4.0*103")
17 I $G(LIST)']"" Q
18 K ^TMP($J,LIST)
19 I +$G(PSNIEN)'>0,($G(PSNFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
20 I $G(PSNIEN)]"",+$G(PSNIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
21 I $G(PSNIEN)]"" N PSNIEN2 S PSNIEN2=$$FIND1^DIC(50.68,"","B","`"_PSNIEN,,,"") 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.68,+PSNIEN2,".01;.05;3;4;11;12;13;19;2000","IE","PSN50P68") S PSN(1)=0
25 .F S PSN(1)=$O(PSN50P68(50.68,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.68,,"@;.01","QP",PSNFT,,"B",,,"")
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 PSN50P68 D GETS^DIQ(50.68,+PSNIEN,".01;.05;3;4;11;12;13;19;2000","IE","PSN50P68") S PSN(1)=0
32 ..F S PSN(1)=$O(PSN50P68(50.68,PSN(1))) Q:'PSN(1) D SETZRO
33 K ^TMP("DILIST",$J)
34 Q
35SETZRO ;
36 S ^TMP($J,LIST,+PSN(1),.01)=$G(PSN50P68(50.68,PSN(1),.01,"I"))
37 S ^TMP($J,LIST,"B",$G(PSN50P68(50.68,PSN(1),.01,"I")),+PSN(1))=""
38 S ^TMP($J,LIST,+PSN(1),.05)=$S($G(PSN50P68(50.68,PSN(1),.05,"I"))="":"",1:$G(PSN50P68(50.68,PSN(1),.05,"I"))_"^"_$G(PSN50P68(50.68,PSN(1),.05,"E")))
39 S ^TMP($J,LIST,+PSN(1),3)=$S($G(PSN50P68(50.68,PSN(1),3,"I"))="":"",1:$G(PSN50P68(50.68,PSN(1),3,"I"))_"^"_$G(PSN50P68(50.68,PSN(1),3,"E")))
40 S ^TMP($J,LIST,+PSN(1),4)=$G(PSN50P68(50.68,PSN(1),4,"I"))
41 S ^TMP($J,LIST,+PSN(1),11)=$G(PSN50P68(50.68,PSN(1),11,"I"))
42 S ^TMP($J,LIST,+PSN(1),12)=$G(PSN50P68(50.68,PSN(1),12,"I"))
43 S ^TMP($J,LIST,+PSN(1),13)=$G(PSN50P68(50.68,PSN(1),13,"I"))
44 S ^TMP($J,LIST,+PSN(1),19)=$S($G(PSN50P68(50.68,PSN(1),19,"I"))="":"",1:$G(PSN50P68(50.68,PSN(1),19,"I"))_"^"_$G(PSN50P68(50.68,PSN(1),19,"E")))
45 I $G(PSNSERVP) S ^TMP($J,LIST,+PSN(1),2000)=$S($G(PSN50P68(50.68,PSN(1),2000,"I"))'="":$G(PSN50P68(50.68,PSN(1),2000,"I")),1:600000)
46 Q
47 ;
48LOOP ;
49 N PSNIEN,CNT,PSN50DD1,PSN50DD2,PSN50DD3,PSN1NOD,PSNZNOD,PSN1NOD,PSN7FED
50 D FIELD^DID(50.68,19,"Z","POINTER","PSN50DD1","PSN50DD2") S PSN50DD3=$G(PSN50DD1("POINTER"))
51 S CNT=0
52 S PSNIEN=0 F S PSNIEN=$O(^PSNDF(50.68,PSNIEN)) Q:'PSNIEN D
53 .S PSNZNOD=$G(^PSNDF(50.68,PSNIEN,0)),PSN1NOD=$G(^(1)),PSN7FED=$P($G(^(7)),"^")
54 .I $P(PSNZNOD,"^")="" Q
55 .S CNT=CNT+1
56 .S ^TMP($J,LIST,PSNIEN,.01)=$P(PSNZNOD,"^")
57 .S ^TMP($J,LIST,"B",$P(PSNZNOD,"^"),PSNIEN)=""
58 .S ^TMP($J,LIST,PSNIEN,.05)=$S($P(PSNZNOD,"^",2)="":"",1:$P(PSNZNOD,"^",2)_"^"_$P($G(^PSNDF(50.6,+$P(PSNZNOD,"^",2),0)),"^"))
59 .S ^TMP($J,LIST,PSNIEN,3)=$S($P(PSNZNOD,"^",5)="":"",1:$P(PSNZNOD,"^",5)_"^"_$P($G(^PS(50.607,+$P(PSNZNOD,"^",5),0)),"^"))
60 .S ^TMP($J,LIST,PSNIEN,4)=$P(PSNZNOD,"^",6)
61 .S ^TMP($J,LIST,PSNIEN,11)=$P(PSN1NOD,"^",5)
62 .S ^TMP($J,LIST,PSNIEN,12)=$P(PSN1NOD,"^",6)
63 .S ^TMP($J,LIST,PSNIEN,13)=$P(PSN1NOD,"^",7)
64 .I PSN50DD3'="",PSN7FED'="",PSN50DD3[(PSN7FED_":") S ^TMP($J,LIST,PSNIEN,19)=PSN7FED_"^"_$P($E(PSN50DD3,$F(PSN50DD3,(PSN7FED_":")),999),";")
65 .I '$D(^TMP($J,LIST,PSNIEN,19)) S ^TMP($J,LIST,PSNIEN,19)=""
66 .I $G(PSNSERVP) S ^TMP($J,LIST,PSNIEN,2000)=$S($P($G(^PSNDF(50.68,PSNIEN,"PFS")),"^")'="":$P($G(^PSNDF(50.68,PSNIEN,"PFS")),"^"),1:600000)
67 S ^TMP($J,LIST,0)=$S(+CNT>0:CNT,1:"-1^NO DATA FOUND")
68 Q
Note: See TracBrowser for help on using the repository browser.