source: WorldVistAEHR/trunk/r/NATIONAL_DRUG_FILE-PSN/PSN50P6.m@ 623

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

initial load of WorldVistAEHR

File size: 2.7 KB
Line 
1PSN50P6 ;BIR/LDT - API FOR INFORMATION FROM FILE 50.6; 5 Sep 03
2 ;;4.0; NATIONAL DRUG FILE;**80**; 30 Oct 98
3 ;
4ZERO(PSNIEN,PSNFT,PSNFL,PSNX,LIST) ;
5 ;PSNIEN - IEN of entry in VA GENERIC file (#50.6).
6 ;PSNFT - Free Text name in VA GENERIC file (#50.6).
7 ;PSNFL - Inactive flag - "" - All entries
8 ; FileMan Date - Only entries with no Inactive Date or an Inactive Date
9 ; greater than this date.
10 ;PSNX - exact match flag 1 - exact match wanted
11 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
12 ; Field Number of the data piece being returned.
13 ;Returns NAME field (#.01), and INACTIVE DATE field (#1) of VA GENERIC file (#50.6).
14 N DIERR,ZZERR,PSNP50P6,SCR,PSN
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.6,"","A","`"_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.6,+PSNIEN2,".01;1","IE","PSNP50P6") S PSN(1)=0
25 .F S PSN(1)=$O(PSNP50P6(50.6,PSN(1))) Q:'PSN(1) D SETALL
26 I $G(PSNIEN)="",$G(PSNFT)]"" D
27 .I PSNFT["??" D LOOP Q
28 .D FIND^DIC(50.6,,"@;.01;","QP"_$S($G(PSNX)=1:"X",1:""),PSNFT,,"B",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 PSNP50P6 D GETS^DIQ(50.6,+PSNIEN,".01;1","IE","PSNP50P6") S PSN(1)=0
32 ..F S PSN(1)=$O(PSNP50P6(50.6,PSN(1))) Q:'PSN(1) D SETALL
33 K ^TMP("DILIST",$J)
34 Q
35 ;
36ROOT() ;
37 ;get version dependent NDF reference
38 I $$VERSION^XPDUTL("PSN")<4 Q "^PSNDF("
39 Q "^PSNDF(50.6," ; new reference for ver 4.0
40 ;
41SETALL ;
42 S ^TMP($J,LIST,+PSN(1),.01)=$G(PSNP50P6(50.6,PSN(1),.01,"I"))
43 S ^TMP($J,LIST,"B",$G(PSNP50P6(50.6,PSN(1),.01,"I")),+PSN(1))=""
44 S ^TMP($J,LIST,+PSN(1),1)=$S($G(PSNP50P6(50.6,PSN(1),1,"I"))="":"",1:PSNP50P6(50.6,PSN(1),1,"I")_"^"_PSNP50P6(50.6,PSN(1),1,"E"))
45 Q
46 ;
47SETSCRN ;Set Screen for inactive VA Generic
48 ;Naked reference below refers to ^PS(50.6,+Y,0)
49 S SCR("S")="S ND=$P($G(^(0)),U,2) I ND=""""!(ND>PSNFL)"
50 Q
51 ;
52LOOP ;
53 N PSNIEN,CNT S CNT=0
54 S PSNIEN=0 F S PSNIEN=$O(^PSNDF(50.6,PSNIEN)) Q:'PSNIEN D
55 .I $G(PSNFL),$P($G(^PSNDF(50.6,PSNIEN,0)),"^",2),$P($G(^(0)),"^",2)'>PSNFL Q
56 .K PSNP50P6 D GETS^DIQ(50.6,+PSNIEN,".01;1","IE","PSNP50P6") S PSN(1)=0 D
57 ..F S PSN(1)=$O(PSNP50P6(50.6,PSN(1))) Q:'PSN(1) D SETALL S CNT=CNT+1
58 S ^TMP($J,LIST,0)=+CNT
59 Q
Note: See TracBrowser for help on using the repository browser.