source: WorldVistAEHR/trunk/r/NATIONAL_DRUG_FILE-PSN/PSN50P4A.m@ 1073

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

initial load of WorldVistAEHR

File size: 2.6 KB
Line 
1PSN50P4A ;BIR/LDT - API FOR INFORMATION FROM FILE 50.416; 5 Sep 03
2 ;;4.0; NATIONAL DRUG FILE;**80**; 30 Oct 98
3 ;
4 ;
5SETALL ;
6 S ^TMP($J,LIST,+PSN(1),.01)=$G(PSN50P41(50.416,PSN(1),.01,"I"))
7 S ^TMP($J,LIST,"B",$G(PSN50P41(50.416,PSN(1),.01,"I")),+PSN(1))=""
8 S ^TMP($J,LIST,+PSN(1),2)=$S($G(PSN50P41(50.416,PSN(1),2,"I"))="":"",1:PSN50P41(50.416,PSN(1),2,"I")_"^"_PSN50P41(50.416,PSN(1),2,"E"))
9 S ^TMP($J,LIST,+PSN(1),3)=$S($G(PSN50P41(50.416,PSN(1),3,"I"))="":"",1:PSN50P41(50.416,PSN(1),3,"I")_"^"_PSN50P41(50.416,PSN(1),3,"E"))
10 Q
11 ;
12SETALL2 ;
13 S ^TMP($J,LIST,+PSN(1),.01)=$G(PSN50P41(50.416,PSN(1),.01,"I"))
14 S ^TMP($J,LIST,"P",$G(PSN50P41(50.416,PSN(1),.01,"I")),+PSN(1))=""
15 S ^TMP($J,LIST,+PSN(1),2)=$S($G(PSN50P41(50.416,PSN(1),2,"I"))="":"",1:PSN50P41(50.416,PSN(1),2,"I")_"^"_PSN50P41(50.416,PSN(1),2,"E"))
16 Q
17 ;
18LOOP(PSN) ;
19 N PSNIEN,CNT S CNT=0
20 S PSNIEN=0 F S PSNIEN=$O(^PS(50.416,PSNIEN)) Q:'PSNIEN D @(PSN)
21 S ^TMP($J,LIST,0)=$S(CNT>0:CNT,1:"-1^NO DATA FOUND")
22 Q
23 ;
241 ;
25 I +$G(PSNFL)>0,$P($G(^PS(50.416,PSNIEN,2)),"^")]"",$P($G(^(2)),"^")'>PSNFL Q
26 K PSN50P41 D GETS^DIQ(50.416,+PSNIEN,".01;2;3","IE","PSN50P41") S PSN(1)=0 D
27 .F S PSN(1)=$O(PSN50P41(50.416,PSN(1))) Q:'PSN(1) D SETALL S CNT=CNT+1
28 K PSN50P41,^TMP("DILIST",$J)
29 Q
30 ;
312 ;
32 N CNT1
33 I $O(^PS(50.416,+PSNIEN,1,0)),'$D(^PS(50.416,+PSNIEN,1,0)) D SETHDR
34 K ^TMP("PSNAPD",$J) D GETS^DIQ(50.416,+PSNIEN,".01;1*","IE","^TMP(""PSNAPD"",$J)") S PSN(1)=0
35 F S PSN(1)=$O(^TMP("PSNAPD",$J,50.416,PSN(1))) Q:'PSN(1) D
36 .S ^TMP($J,LIST,+PSN(1),.01)=$G(^TMP("PSNAPD",$J,50.416,PSN(1),.01,"I"))
37 .S ^TMP($J,LIST,"B",$G(^TMP("PSNAPD",$J,50.416,PSN(1),.01,"I")),+PSN(1))=""
38 .S (CNT1,PSN(2))=0 F S PSN(2)=$O(^TMP("PSNAPD",$J,50.4161,PSN(2))) Q:'PSN(2) D
39 ..S ^TMP($J,LIST,+PSN(1),"ID",+PSN(2),.01)=$G(^TMP("PSNAPD",$J,50.4161,PSN(2),.01,"I")),CNT1=CNT1+1
40 .S ^TMP($J,LIST,+PSN(1),"ID",0)=$S($G(CNT)>0:CNT,1:"-1^NO DATA FOUND")
41 K ^TMP("PSNAPD",$J),^TMP("DILIST",$J)
42 Q
43 ;
44LOOP2 ;
45 N PSNIEN,PSNIEN2,CNT S CNT=0
46 S PSNIEN="" F S PSNIEN=$O(^PS(50.416,"P",PSNIEN)) Q:PSNIEN="" S PSNIEN2=0 F S PSNIEN2=$O(^PS(50.416,"P",PSNIEN,PSNIEN2)) Q:'PSNIEN2 D
47 .K PSN50P41 D GETS^DIQ(50.416,+PSNIEN2,".01;2*","IE","PSN50P41") S PSN(1)=0 D
48 ..F S PSN(1)=$O(PSN50P41(50.416,PSN(1))) Q:'PSN(1) D SETALL2 S CNT=CNT+1
49 S ^TMP($J,LIST,0)=+CNT
50 Q
51 ;
52SETSCRN ;Set Screen for inactive Drug Ingredients
53 ;Naked reference below refers to ^PS(50.416,+Y,2)
54 S SCR("S")="S ND=$G(^(2)) I ND=""""!(ND>PSNFL)"
55 Q
56 ;
57SETHDR ;
58 N PSNCNT,PSNNUM S (PSNCNT,PSNNUM)=0
59 F S PSNNUM=$O(^PS(50.416,+PSNIEN,1,PSNNUM)) Q:'PSNNUM S PSNCNT=PSNCNT+1
60 S ^PS(50.416,+PSNIEN,1,0)="^50.4161A^"_PSNCNT_"^"_PSNCNT
61 Q
Note: See TracBrowser for help on using the repository browser.