source: WorldVistAEHR/trunk/r/NATIONAL_DRUG_FILE-PSN/PSNNGR.m@ 1686

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

initial load of WorldVistAEHR

File size: 1.3 KB
RevLine 
[613]1PSNNGR ;BIR/WRT-creates UTILITY GLOBAL OF INGREDIENTS FOR EACH VAPN FROM ^PSNDF(50.6, ;09/21/98 7:54
2 ;;4.0; NATIONAL DRUG FILE;; 30 Oct 98
3 ; This routine is to be used in conjunction of the allergies package.
4 ; It expects an input of PSNDA=internal number in File 50.6
5 ; Returns ^TMP("PSN",$J,IFN)=Primary Ingredient
6 ; IFN=Internal # from 50.416 of primary ingredient
7 ; If PSNDA doesn't exist, PSNID & ^TMP("PSN",$J) are killed
8 ; Variables X,J,K,PSNPN are used and are killed before exiting
9 ;
10START K ^TMP("PSN",$J),PSNID D BEGIN
11 K PSNPN,PSNDA,J,K,X,PSNID
12 Q
13BEGIN Q:'$D(PSNDA) Q:'$D(^PSNDF(50.6,PSNDA)) D VAPN
14 Q
15VAPN S DA=PSNDA,X=$$VAP^PSNAPIS(DA,.LIST) I X]"" D GETLIST
16 Q
17GETLIST F HH=0:0 S HH=$O(LIST(HH)) Q:'HH S PSNPN=HH D BLD
18 Q
19BLD S PSNID=PSNDA_"A"_PSNPN D INGR
20 Q
21INGR F J=0:0 S J=$O(^PS(50.416,"APD",PSNID,J)) Q:'J I $D(^PS(50.416,J,0)) S X=^(0),K=J S:$P(X,"^",2) K=$P(X,"^",2),X=^PS(50.416,K,0) S ^TMP("PSN",$J,K)=$P(X,"^",1)
22 K J,K,X
23 Q
24DISPDRG K ^TMP("PSNDD",$J),PSNDD D STRT
25 K PSNDA,PSNVPN,PSNDD,J,K,X
26 Q
27STRT Q:'PSNDA Q:'PSNVPN Q:'$D(^PSNDF(50.6,PSNDA)) Q:'$D(^PSNDF(50.68,PSNVPN)) S PSNDD=PSNDA_"A"_PSNVPN D FNDING
28 Q
29FNDING F J=0:0 S J=$O(^PS(50.416,"APD",PSNDD,J)) Q:'J I $D(^PS(50.416,J,0)) S X=^(0),K=J S:$P(X,"^",2) K=$P(X,"^",2),X=^PS(50.416,K,0) S ^TMP("PSNDD",$J,K)=$P(X,"^",1)
30 K J,K,X
31 Q
Note: See TracBrowser for help on using the repository browser.