Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSN50P68

PSN50P68.m

Go to the documentation of this file.
PSN50P68 ;BIR/LDT-API FOR INFORMATION FROM FILE 50.68 ; 5 Sep 03
 ;;4.0;NATIONAL DRUG FILE;**80,94,104,109,396**; 30 Oct 98;Build 190
 ;
FORM(PSNIEN) ;
 ;PSNIEN - IEN of entry in VA PRODUCT file (#50.68).
 ;Returns NATIONAL FORMULARY NAME field (#4) of the VA PRODUCT file (#50.68).
 I +$G(PSNIEN)'>0 Q ""
 Q $P($G(^PSNDF(50.68,+PSNIEN,0)),"^",6)
 ;
DATA(PSNIEN,PSNFT,LIST) ;
 ;PSNIEN - IEN of entry in VA PRODUCT file (#50.68).
 ;PSNFT - Free Text name in  VA PRODUCT file (#50.68).
 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
 ;       Field Number of the data piece beingreturned.
 N DIERR,ZZERR,PSN50P68,PSN,PSNSERVP
 S PSNSERVP=$$PATCH^XPDUTL("PSN*4.0*103")
 I $G(LIST)']"" Q
 K ^TMP($J,LIST)
 I +$G(PSNIEN)'>0,($G(PSNFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
 I $G(PSNIEN)]"",+$G(PSNIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
 I $G(PSNIEN)]"" N PSNIEN2 S PSNIEN2=$$FIND1^DIC(50.68,"","B","`"_PSNIEN,,,"") D
 .I +PSNIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
 .S ^TMP($J,LIST,0)=1
 .D GETS^DIQ(50.68,+PSNIEN2,".01;.05;3;4;5;6;8;11;12;13;19;2000;101;102;103;104;105;108*","IE","PSN50P68") S PSN(1)=0
 .F  S PSN(1)=$O(PSN50P68(50.68,PSN(1))) Q:'PSN(1)  D SETZRO
 .S PSN(1)=0 F  S PSN(1)=$O(PSN50P68(50.68108,PSN(1))) Q:'PSN(1)  D CLEFF
 I $G(PSNIEN)="",$G(PSNFT)]"" D
 .I PSNFT["??" D LOOP Q
 .D FIND^DIC(50.68,,"@;.01","QP",PSNFT,,"B",,,"")
 .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
 .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
 ..S PSNIEN=+^TMP("DILIST",$J,PSNXX,0) K PSN50P68 D GETS^DIQ(50.68,+PSNIEN,".01;.05;3;4;5;6;8;11;12;13;19;2000;101;102;103;104;105;108*","IE","PSN50P68") S PSN(1)=0
 ..F  S PSN(1)=$O(PSN50P68(50.68,PSN(1))) Q:'PSN(1)  D SETZRO
 K ^TMP("DILIST",$J)
 Q
SETZRO ;
 S ^TMP($J,LIST,+PSN(1),.01)=$G(PSN50P68(50.68,PSN(1),.01,"I"))
 S ^TMP($J,LIST,"B",$G(PSN50P68(50.68,PSN(1),.01,"I")),+PSN(1))=""
 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")))
 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")))
 S ^TMP($J,LIST,+PSN(1),4)=$G(PSN50P68(50.68,PSN(1),4,"I"))
 S ^TMP($J,LIST,+PSN(1),5)=$G(PSN50P68(50.68,PSN(1),5,"I"))
 S ^TMP($J,LIST,+PSN(1),6)=$G(PSN50P68(50.68,PSN(1),6,"I"))
 S ^TMP($J,LIST,+PSN(1),8)=$G(PSN50P68(50.68,PSN(1),8,"I"))
 S ^TMP($J,LIST,+PSN(1),11)=$G(PSN50P68(50.68,PSN(1),11,"I"))
 S ^TMP($J,LIST,+PSN(1),12)=$G(PSN50P68(50.68,PSN(1),12,"I"))
 S ^TMP($J,LIST,+PSN(1),13)=$G(PSN50P68(50.68,PSN(1),13,"I"))
 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")))
 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)
 S ^TMP($J,LIST,+PSN(1),101)=$G(PSN50P68(50.68,PSN(1),101,"I"))
 S ^TMP($J,LIST,+PSN(1),102)=$G(PSN50P68(50.68,PSN(1),102,"I"))
 S ^TMP($J,LIST,+PSN(1),103)=$G(PSN50P68(50.68,PSN(1),103,"I"))
 S ^TMP($J,LIST,+PSN(1),104)=$G(PSN50P68(50.68,PSN(1),104,"I"))
 ;S ^TMP($J,LIST,+PSN(1),105)=$G(PSN50P68(50.68,PSN(1),105,"I"))
 N PSNHAZWC,X S PSNHAZWC=0
 F  S PSNHAZWC=$O(PSN50P68(50.68,PSN(1),105,PSNHAZWC)) Q:'PSNHAZWC  D
 .S X="",X=PSN50P68(50.68,PSN(1),105,PSNHAZWC) S ^TMP($J,LIST,+PSN(1),105,PSNHAZWC)=X
 Q
 ;
CLEFF ;set clinical effects of drug 
 S ^TMP($J,LIST,$P(PSN(1),",",2),108,$P(PSN(1),","),.01)=$G(PSN50P68(50.68108,PSN(1),.01,"I"))
 S ^TMP($J,LIST,$P(PSN(1),",",2),108,$P(PSN(1),","),1)=$G(PSN50P68(50.68108,PSN(1),1,"I"))
 S ^TMP($J,LIST,$P(PSN(1),",",2),108,$P(PSN(1),","),2)=$G(PSN50P68(50.68108,PSN(1),2,"I"))
 Q
 ;
LOOP ;
 N PSNIEN,CNT,PSN50DD1,PSN50DD2,PSN50DD3,PSN1NOD,PSNZNOD,PSN1NOD,PSN7FED
 D FIELD^DID(50.68,19,"Z","POINTER","PSN50DD1","PSN50DD2") S PSN50DD3=$G(PSN50DD1("POINTER"))
 S CNT=0
 S PSNIEN=0 F  S PSNIEN=$O(^PSNDF(50.68,PSNIEN)) Q:'PSNIEN  D
 .S PSNZNOD=$G(^PSNDF(50.68,PSNIEN,0)),PSN1NOD=$G(^(1)),PSN7FED=$P($G(^(7)),"^")
 .I $P(PSNZNOD,"^")="" Q
 .S CNT=CNT+1
 .S ^TMP($J,LIST,PSNIEN,.01)=$P(PSNZNOD,"^")
 .S ^TMP($J,LIST,"B",$P(PSNZNOD,"^"),PSNIEN)=""
 .S ^TMP($J,LIST,PSNIEN,.05)=$S($P(PSNZNOD,"^",2)="":"",1:$P(PSNZNOD,"^",2)_"^"_$P($G(^PSNDF(50.6,+$P(PSNZNOD,"^",2),0)),"^"))
 .S ^TMP($J,LIST,PSNIEN,3)=$S($P(PSNZNOD,"^",5)="":"",1:$P(PSNZNOD,"^",5)_"^"_$P($G(^PS(50.607,+$P(PSNZNOD,"^",5),0)),"^"))
 .S ^TMP($J,LIST,PSNIEN,4)=$P(PSNZNOD,"^",6)
 .S ^TMP($J,LIST,PSNIEN,11)=$P(PSN1NOD,"^",5)
 .S ^TMP($J,LIST,PSNIEN,12)=$P(PSN1NOD,"^",6)
 .S ^TMP($J,LIST,PSNIEN,13)=$P(PSN1NOD,"^",7)
 .I PSN50DD3'="",PSN7FED'="",PSN50DD3[(PSN7FED_":") S ^TMP($J,LIST,PSNIEN,19)=PSN7FED_"^"_$P($E(PSN50DD3,$F(PSN50DD3,(PSN7FED_":")),999),";")
 .I '$D(^TMP($J,LIST,PSNIEN,19)) S ^TMP($J,LIST,PSNIEN,19)=""
 .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)
 .S ^TMP($J,LIST,PSNIEN,101)=$P(PSN1NOD,"^",5)
 S ^TMP($J,LIST,0)=$S(+CNT>0:CNT,1:"-1^NO DATA FOUND")
 Q